diff --git a/.gitattributes b/.gitattributes index 7f3faf132f3a72e7d39f015fd678f89823ec626c..50e43c429f1f40af3c2db98092f645089c27a8b4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2888,3 +2888,23 @@ kirkton/staff-app/assets/assets/brand/drunkencoo-hero.7c01fed6cb075a3a8e4f969bff kirkton/staff-app/assets/assets/brand/drunkencoo.272f746bf13376f503acd81a524a7998.png filter=lfs diff=lfs merge=lfs -text kirkton/staff-app/assets/assets/brand/smokinggoat-hero.b2ae48c4a1fcf2521ae9ff58435a6649.png filter=lfs diff=lfs merge=lfs -text kirkton/staff-app/assets/assets/brand/smokinggoat.fff2a9a694b41fed68c80a2c9bfe65da.png filter=lfs diff=lfs merge=lfs -text +abbotsford/chef-app/assets/assets/brand/drunkencoo-hero.7c01fed6cb075a3a8e4f969bff1cf103.png filter=lfs diff=lfs merge=lfs -text +abbotsford/chef-app/assets/assets/brand/drunkencoo.272f746bf13376f503acd81a524a7998.png filter=lfs diff=lfs merge=lfs -text +abbotsford/chef-app/assets/assets/brand/smokinggoat-hero.b2ae48c4a1fcf2521ae9ff58435a6649.png filter=lfs diff=lfs merge=lfs -text +abbotsford/chef-app/assets/assets/brand/smokinggoat.fff2a9a694b41fed68c80a2c9bfe65da.png filter=lfs diff=lfs merge=lfs -text +abbotsford/customer-app/assets/assets/brand/drunkencoo-hero.7c01fed6cb075a3a8e4f969bff1cf103.png filter=lfs diff=lfs merge=lfs -text +abbotsford/customer-app/assets/assets/brand/drunkencoo.272f746bf13376f503acd81a524a7998.png filter=lfs diff=lfs merge=lfs -text +abbotsford/customer-app/assets/assets/brand/smokinggoat-hero.b2ae48c4a1fcf2521ae9ff58435a6649.png filter=lfs diff=lfs merge=lfs -text +abbotsford/customer-app/assets/assets/brand/smokinggoat.fff2a9a694b41fed68c80a2c9bfe65da.png filter=lfs diff=lfs merge=lfs -text +abbotsford/display-app/assets/assets/brand/drunkencoo-hero.7c01fed6cb075a3a8e4f969bff1cf103.png filter=lfs diff=lfs merge=lfs -text +abbotsford/display-app/assets/assets/brand/drunkencoo.272f746bf13376f503acd81a524a7998.png filter=lfs diff=lfs merge=lfs -text +abbotsford/display-app/assets/assets/brand/smokinggoat-hero.b2ae48c4a1fcf2521ae9ff58435a6649.png filter=lfs diff=lfs merge=lfs -text +abbotsford/display-app/assets/assets/brand/smokinggoat.fff2a9a694b41fed68c80a2c9bfe65da.png filter=lfs diff=lfs merge=lfs -text +abbotsford/owner-app/assets/assets/brand/drunkencoo-hero.7c01fed6cb075a3a8e4f969bff1cf103.png filter=lfs diff=lfs merge=lfs -text +abbotsford/owner-app/assets/assets/brand/drunkencoo.272f746bf13376f503acd81a524a7998.png filter=lfs diff=lfs merge=lfs -text +abbotsford/owner-app/assets/assets/brand/smokinggoat-hero.b2ae48c4a1fcf2521ae9ff58435a6649.png filter=lfs diff=lfs merge=lfs -text +abbotsford/owner-app/assets/assets/brand/smokinggoat.fff2a9a694b41fed68c80a2c9bfe65da.png filter=lfs diff=lfs merge=lfs -text +abbotsford/staff-app/assets/assets/brand/drunkencoo-hero.7c01fed6cb075a3a8e4f969bff1cf103.png filter=lfs diff=lfs merge=lfs -text +abbotsford/staff-app/assets/assets/brand/drunkencoo.272f746bf13376f503acd81a524a7998.png filter=lfs diff=lfs merge=lfs -text +abbotsford/staff-app/assets/assets/brand/smokinggoat-hero.b2ae48c4a1fcf2521ae9ff58435a6649.png filter=lfs diff=lfs merge=lfs -text +abbotsford/staff-app/assets/assets/brand/smokinggoat.fff2a9a694b41fed68c80a2c9bfe65da.png filter=lfs diff=lfs merge=lfs -text diff --git a/abbotsford/chef-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js b/abbotsford/chef-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js new file mode 100644 index 0000000000000000000000000000000000000000..8039fc81f8fac85dbe1964b30e03ea44f335ea65 --- /dev/null +++ b/abbotsford/chef-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},802,[805,31,807,25]); \ No newline at end of file diff --git a/abbotsford/chef-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js b/abbotsford/chef-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js new file mode 100644 index 0000000000000000000000000000000000000000..283d584fafbdddc8e5e6b0b5633e099144c8d6ba --- /dev/null +++ b/abbotsford/chef-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js @@ -0,0 +1 @@ +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return b}});var n=_r(_d[0]),t=_r(_d[1]),s=_r(_d[2]),a=e(_r(_d[3])),l=e(_r(_d[4])),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]);function b(){const{rid:e,did:b}=(0,t.useLocalSearchParams)(),j=(0,h.useRestaurant)(e),x=(0,h.useMenu)(e).find(e=>e.id===b),y=(0,h.useCustomer)(),m=(0,h.useRecipeCards)(e).find(e=>e.id===x?.recipeCardId),k=m?.signOff&&m.photo?(0,g.recipeCards)().photoSource(m.photo):null,v=(0,h.useStore)(e=>e.addLine),w=(0,n.useTakeawayMenu)(n=>n.byVenue[e]),S=(0,h.useStore)(n=>n.basket.restaurantId===e&&'table'===n.basket.mode),[C,B]=(0,s.useState)(()=>(x?.optionGroups??[]).filter(e=>e.required).map(e=>e.choices[0].id)),[$,I]=(0,s.useState)(1),[P,T]=(0,s.useState)(''),[L,O]=(0,s.useState)(!1),[D,A]=(0,s.useState)(!1),[M,R]=(0,s.useState)(!1),[q,_]=(0,s.useState)(!1),N=(0,s.useMemo)(()=>x?(0,c.effectiveAllergens)(x,C):{},[x,C]);if(!j||!x)return(0,f.jsx)(d.Screen,{title:"Not found",children:(0,f.jsx)(d.T,{children:"Dish not found."})});const G=(0,c.conflictsFor)(N,y.allergies),Y=(x.price??0)+(x.optionGroups??[]).flatMap(e=>e.choices).filter(e=>C.includes(e.id)).reduce((e,n)=>e+n.priceDelta,0),z=S||j.fictional?'on':(0,n.takeawayAvail)(x,w),F=x.soldOut||!x.signOff||null===x.price||'on'!==z,Q=(e,n)=>{const t=x.optionGroups.find(n=>n.id===e);B(e=>{const s=t.choices.map(e=>e.id);return t.multi?e.includes(n)?e.filter(e=>e!==n):[...e,n]:e.includes(n)&&!t.required?e.filter(e=>e!==n):[...e.filter(e=>!s.includes(e)),n]})},V=e=>{h.useStore.getState().basket.restaurantId!==j.id&&h.useStore.getState().startBasket(j.id,'takeaway'),v({itemId:x.id,qty:$,choiceIds:C,notes:P,override:e?{allergens:G.contains,at:(new Date).toISOString()}:void 0}),O(!1),_(!0)};return(0,f.jsxs)(d.Screen,{title:x.name,subtitle:j.name,right:(0,f.jsx)(o.BasketButton,{}),children:[k?(0,f.jsx)(a.default,{testID:"dish-photo",source:k,accessibilityLabel:`${x.name}${'example'===m?.origin?' (example photo)':''}`,style:{width:'100%',height:200,borderRadius:12},resizeMode:"cover"}):null,(0,f.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(d.T,{weight:"bold",size:20,colour:p.colours.gold,children:null===x.price?x.priceNote:(0,u.gbp)(Y)}),x.dietary.map(e=>(0,f.jsx)(d.Badge,{kind:"ok",label:e},e))]}),(0,f.jsx)(d.T,{children:x.description}),G.contains.length?(0,f.jsx)(d.Banner,{kind:"danger",title:`Blocked: contains ${G.contains.map(c.allergenLabel).join(', ')}`,children:`You\u2019ve told us: ${y.allergies.filter(e=>G.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`).join('; ')}. This dish can\u2019t be added unless you deliberately override (for example, ordering for someone else).`}):null,G.may.length?(0,f.jsx)(d.Banner,{kind:"warn",title:`Warning: may contain ${G.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact is possible (e.g. shared fryer). Please speak to staff before ordering."}):null,(x.optionGroups??[]).map(e=>(0,f.jsxs)(d.Card,{children:[(0,f.jsxs)(d.T,{weight:"semibold",children:[e.name,e.required?' (required)':' (optional)']}),(0,f.jsx)(d.Row,{wrap:!0,gap:6,children:e.choices.map(n=>(0,f.jsx)(d.Chip,{label:n.label,sub:n.priceDelta?`+${(0,u.gbp)(n.priceDelta)}`:void 0,selected:C.includes(n.id),onPress:()=>Q(e.id,n.id)},n.id))})]},e.id)),(0,f.jsx)(d.Card,{children:(0,f.jsx)(r.AllergenPanel,{item:x,map:N,declared:y.allergies})}),j.fictional?null:(0,f.jsx)(d.AllergenNotice,{phone:j.phone}),(0,f.jsx)(d.Field,{label:"Notes for the kitchen (optional)",placeholder:"e.g. no gherkins",value:P,onChangeText:T}),(0,f.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(d.T,{weight:"semibold",children:"Quantity"}),(0,f.jsx)(d.Stepper,{value:$,onChange:I,label:"quantity"})]}),q?(0,f.jsx)(d.Banner,{kind:"success",title:"Added to basket",children:G.contains.length?'Allergy override recorded \u2014 the kitchen will see a large allergy alert.':'Carry on browsing or go to your basket.'}):null,F?(0,f.jsx)(d.Banner,{kind:"warn",children:x.soldOut||'sold-out'===z?'Sold out today.':'off'===z&&x.signOff&&null!==x.price?'This dish isn\u2019t on the takeaway menu. You can have it when you eat in.':x.signOff?'Price on the specials board \u2014 ask staff.':'Not available to order online until the head chef signs off its allergens.'}):G.contains.length?(0,f.jsxs)(l.default,{style:{gap:8},children:[(0,f.jsx)(d.Button,{kind:"secondary",label:"Choose something else",onPress:()=>t.router.back()}),(0,f.jsx)(d.Button,{kind:"danger",label:"Override and add anyway\u2026",onPress:()=>{A(!1),R(!1),O(!0)},testID:"override-open"})]}):(0,f.jsxs)(d.Row,{gap:8,children:[(0,f.jsx)(d.Button,{style:{flex:1},label:`Add ${$} to basket \xb7 ${(0,u.gbp)(Y*$)}`,onPress:()=>V(!1),testID:"add-to-basket"}),q?(0,f.jsx)(d.Button,{kind:"secondary",label:"Basket",onPress:()=>t.router.push('/customer/basket')}):null]}),(0,f.jsxs)(d.Sheet,{visible:L,onClose:()=>O(!1),title:"Allergy override",children:[(0,f.jsx)(d.Banner,{kind:"danger",title:`${x.name} contains ${G.contains.map(c.allergenLabel).join(', ')}`,children:`Your profile says: ${y.allergies.filter(e=>G.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`).join('; ')}.`}),(0,f.jsx)(d.Toggle,{label:"I understand this dish contains an allergen I have declared",value:D,onChange:A}),(0,f.jsx)(d.Toggle,{label:"It is for someone without this allergy, or I have spoken to staff",value:M,onChange:R}),(0,f.jsx)(d.Muted,{children:"The override is logged and shown to the kitchen as an allergy alert that must be acknowledged."}),(0,f.jsx)(d.Button,{kind:"danger",disabled:!D||!M,label:"Confirm override and add",onPress:()=>V(!0),testID:"override-confirm"})]})]})}},779,[836,805,31,197,128,837,838,818,819,820,823,839,825,25]); \ No newline at end of file diff --git a/abbotsford/chef-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js b/abbotsford/chef-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js new file mode 100644 index 0000000000000000000000000000000000000000..1bcd14167edfb4176466ea1f3be5800f7b8a603b --- /dev/null +++ b/abbotsford/chef-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),u=_r(d[4]),c=_r(d[5]),s=_r(d[6]),l=_r(d[7]);function f(){const{n:f,r:b}=(0,r.useLocalSearchParams)(),E=(0,u.useStore)(t=>t.startBasket),[_,h]=(0,n.useState)(!1),S=b??c.VENUE_RID,j=(0,u.useOrderAtTable)(S),I=(0,s.guestServer)();return(0,n.useEffect)(()=>{t.LIVE_VENUE_BUILD||I||(j&&E(S,'table',String(f)),h(!0))},[S,f,j,I]),t.LIVE_VENUE_BUILD||I?(0,l.jsx)(o.Screen,{title:"Order at the table",children:(0,l.jsx)(o.Banner,{kind:"demo",title:"Scan the code on your table",children:"To order from your table, scan the QR code printed on it. Or order at the bar."})}):_?(0,l.jsx)(r.Redirect,{href:`/customer/${S}`}):null}},795,[842,805,31,818,823,5,845,25]); \ No newline at end of file diff --git a/abbotsford/chef-app/_expo/static/js/web/[oid]-0ef90855abb82d22ac5def655ebb19b6.js b/abbotsford/chef-app/_expo/static/js/web/[oid]-0ef90855abb82d22ac5def655ebb19b6.js new file mode 100644 index 0000000000000000000000000000000000000000..81acba145dab8bc4100c40e7594b32179f512f42 --- /dev/null +++ b/abbotsford/chef-app/_expo/static/js/web/[oid]-0ef90855abb82d22ac5def655ebb19b6.js @@ -0,0 +1,3 @@ +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=_r(d[0]),l=_r(d[1]),s=_r(d[2]),r=_r(d[3]),n=(e=r)&&e.__esModule?e:{default:e},o=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),y=_r(d[10]),b=_r(d[11]),j=_r(d[12]);const x=[['new','Placed'],['acknowledged','Accepted'],['preparing','Cooking'],['ready','Ready to collect'],['collected','Collected']],w=[['new','Sent'],['acknowledged','Accepted'],['preparing','Cooking'],['served','Food out'],['closed','Paid']];function f(){const{oid:e}=(0,l.useLocalSearchParams)(),r=(0,p.useOrder)(e),f=(0,p.useRestaurant)(r?.restaurantId),[k,T]=(0,s.useState)(0),[S,C]=(0,s.useState)(''),[v,M]=(0,s.useState)(!1),[P,A]=(0,s.useState)(0),[R,$]=(0,s.useState)(r?.split?.ways??1);if(!r||!f)return(0,j.jsx)(i.Screen,{title:"Order",children:(0,j.jsx)(i.T,{children:"Order not found."})});const O='takeaway'===r.type?x:w,I=Math.max(0,O.findIndex(([e])=>e===r.status)),N=Math.round(r.subtotal*P/100),B='table'===r.type?r.subtotal+(r.split?r.tip:N):r.total,_=B-r.paid,H=r.split?.ways??R,D=r.split?.paidShares??0,F=Math.ceil(B/H),q='collected'===r.status||'closed'===r.status;return(0,j.jsxs)(i.Screen,{title:`Order ${r.ref}`,subtitle:`${f.name} \xb7 ${'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Collection at ${r.slotTime?(0,h.hm)(new Date(r.slotTime)):'\u2014'}`}`,children:['takeaway'===r.type?(0,j.jsx)(b.TakeawayPayCard,{o:r,phone:f.phone}):null,'takeaway'===r.type&&'awaiting_payment'!==r.status&&'cancelled'!==r.status?(0,j.jsx)(i.Banner,{kind:"success",title:'ready'===r.status?'Your order is ready!':'Order placed',children:'ready'===r.status?'Head to the bar and give your order number. Staff will check allergies with you at handover.':`Show order number ${r.ref} at the bar when you arrive.`}):null,'awaiting_payment'===r.status||'cancelled'===r.status?null:(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.H2,{children:"Status"}),O.map(([e,t],l)=>(0,j.jsxs)(i.Row,{gap:10,children:[(0,j.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:l<=I?y.colours.gold:y.colours.surface2,borderWidth:1,borderColor:y.colours.gold}}),(0,j.jsx)(i.T,{weight:l===I?'semibold':'regular',colour:l<=I?y.colours.text:y.colours.muted,children:t})]},e)),r.allergyAck?(0,j.jsxs)(i.Muted,{children:["Kitchen signed off your allergies (",r.allergyAck.by,", ",(0,h.hm)(new Date(r.allergyAck.at)),")"]}):r.allergies.length?(0,j.jsx)(i.Muted,{children:"Waiting for the kitchen to sign off your allergies\u2026"}):null,'takeaway'!==r.type||q?null:(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.Button,{small:!0,kind:'on-my-way'===r.customerSignal?'primary':'secondary',label:"On my way",onPress:()=>p.repo.orders.customerSignal(r.id,'on-my-way')}),(0,j.jsx)(i.Button,{small:!0,kind:'here'===r.customerSignal?'primary':'secondary',label:"I\u2019m here",onPress:()=>p.repo.orders.customerSignal(r.id,'here')})]})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.H2,{children:"Items"}),r.lines.map((e,t)=>(0,j.jsxs)(n.default,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{style:{flex:1},children:[e.qty,"\xd7 ",e.name]}),(0,j.jsx)(i.T,{children:(0,u.gbp)(e.unitPrice*e.qty)})]}),e.choices.length?(0,j.jsx)(i.Muted,{children:e.choices.join(' \xb7 ')}):null,e.overridden?(0,j.jsx)(i.Badge,{kind:"red",label:`Allergy override: ${e.contains.map(c.allergenLabel).join(', ')}`}):null]},t)),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Subtotal"}),(0,j.jsx)(i.T,{children:(0,u.gbp)(r.subtotal)})]}),r.giftCardApplied?(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Of which gift card"}),(0,j.jsxs)(i.T,{colour:y.colours.ok,children:["\u2212",(0,u.gbp)(r.giftCardApplied)]})]}):null,r.tip?(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Tip"}),(0,j.jsx)(i.T,{children:(0,u.gbp)(r.tip)})]}):null,(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Paid (test, no real money)"}),(0,j.jsx)(i.T,{weight:"semibold",colour:y.colours.gold,children:(0,u.gbp)(r.paid)})]})]}),'table'===r.type&&'closed'!==r.status&&'cancelled'!==r.status?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsxs)(i.H2,{children:["Your bill \u2014 ",(0,t.tableNumbers)(r.tableNo)]}),r.split?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(i.T,{children:["Total ",(0,u.gbp)(B)," \xb7 split ",H," way",H>1?'s':''," \xb7 ",(0,u.gbp)(F)," each"]}),(0,j.jsxs)(i.T,{children:["Shares paid: ",D," of ",H," \xb7 remaining ",(0,u.gbp)(_)]}),(0,j.jsx)(i.Muted,{children:"Pay with a member of staff at your table. Online card payment for the table bill isn\u2019t set up."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Add a tip?"}),(0,j.jsx)(i.Row,{wrap:!0,children:[0,10,12.5,15].map(e=>(0,j.jsx)(i.Chip,{label:e?`${e}%`:'No tip',selected:P===e,onPress:()=>A(e)},e))}),(0,j.jsx)(i.Muted,{children:"Tips go to staff under the restaurant\u2019s tipping policy (Employment (Allocation of Tips) Act 2023)."}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Split evenly between"}),(0,j.jsx)(i.Stepper,{value:R,onChange:$,min:1,max:8,label:"people"})]}),(0,j.jsxs)(i.T,{children:["Total ",(0,u.gbp)(r.subtotal+N),R>1?` \xb7 ${(0,u.gbp)(Math.ceil((r.subtotal+N)/R))} each`:'']}),(0,j.jsx)(i.Button,{label:"Get the bill",onPress:()=>p.repo.orders.setSplit(r.id,R,N),testID:"get-bill"})]})]}):null,!q||r.rated||v?null:(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.H2,{children:"How was everything?"}),(0,j.jsxs)(i.Muted,{children:["One tap \u2014 this goes privately to ",f.name," only, never published."]}),(0,j.jsx)(o.Stars,{value:k,onChange:T}),k?(0,j.jsx)(i.Field,{label:"Anything to add? (optional)",value:S,onChangeText:C}):null,(0,j.jsx)(i.Button,{label:"Send feedback",disabled:!k,onPress:()=>{p.repo.feedback.add({restaurantId:f.id,orderId:r.id,customerId:r.customerId,customerName:r.customerName,stars:k,comment:S,context:'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Takeaway ${r.ref}`}),M(!0)},testID:"send-rating"})]}),v||r.rated?(0,j.jsx)(i.Banner,{kind:"success",children:"Thanks \u2014 your feedback went privately to the restaurant."}):null,q?(0,j.jsx)(i.Button,{kind:"secondary",label:"View stamp card",onPress:()=>l.router.push(`/customer/${f.id}/loyalty`)}):null]})}},792,[812,805,31,128,840,818,819,820,822,823,825,879,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPayCard=function({o:e,phone:y}){const[f,k]=(0,n.useState)(Date.now()),[w,x]=(0,n.useState)(!1),[j,b]=(0,n.useState)(''),[P,v]=(0,n.useState)(null),_=(0,n.useRef)(!1),B=(0,c.payView)(e,f);(0,n.useEffect)(()=>{const e=setInterval(()=>k(Date.now()),1e3);return()=>clearInterval(e)},[]);const T='pay'===B.kind||'expired'===B.kind&&_.current&&'awaiting_payment'===e.status;(0,n.useEffect)(()=>{if(!T||!_.current)return;const n=setInterval(()=>{(0,h.checkPaid)(e.id)},1e4),r=t.default.addEventListener('change',n=>{'active'===n&&(0,h.checkPaid)(e.id)});return()=>{clearInterval(n),r.remove()}},[T,e.id]);if('none'===B.kind)return null;if('sending'===B.kind)return(0,p.jsx)(s.Banner,{kind:"warn",title:"Saving your order\u2026",children:"Sending it to the restaurant. Card payment opens in a moment."});if('refused'===B.kind)return(0,p.jsxs)(s.Banner,{kind:"danger",title:"The restaurant couldn\u2019t take this order",children:[(0,p.jsx)(s.T,{size:14,colour:"#FFE3DF",children:`${B.reason} Nothing has been charged.`}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to the menu",onPress:()=>o.router.replace(`/customer/${e.restaurantId}`)})]});if('paid'===B.kind)return(0,p.jsx)(s.Banner,{kind:"success",title:`Paid ${(0,l.gbp)(B.amount)} by card`,children:B.late?'Your payment came in after the time ran out. The restaurant has your order and will contact you if the collection time needs to change.':'Your order has gone to the kitchen.'});if('expired'===B.kind)return(0,p.jsxs)(s.Banner,{kind:"warn",title:'awaiting_payment'===e.status?'Checking your payment\u2026':'Time ran out: order not sent',children:[(0,p.jsx)(s.T,{size:14,children:'awaiting_payment'===e.status?'We\u2019re checking with the payment page. If you paid, your order will show as paid shortly.':`Nothing has been charged. You can order again${y?` or ring ${y}`:''}.`}),'awaiting_payment'!==e.status?(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Order again",onPress:()=>o.router.replace(`/customer/${e.restaurantId}`)}):null]});return(0,p.jsxs)(s.Card,{highlight:u.colours.gold,children:[(0,p.jsx)(s.H2,{children:"Pay to send your order"}),(0,p.jsxs)(s.T,{children:["Your order goes to the kitchen once it\u2019s paid. Time left to pay: ",(0,p.jsx)(s.T,{weight:"bold",colour:B.secondsLeft<120?u.colours.red:u.colours.gold,children:(0,c.mmss)(B.secondsLeft)})]}),(0,p.jsx)(s.Button,{label:w?'Opening the payment page\u2026':`Pay ${(0,l.gbp)(e.total)} by card`,disabled:w||B.secondsLeft<120,onPress:async()=>{x(!0),b('');const n='undefined'!=typeof window?window.open('','_blank'):null,t=await(0,h.getPayLink)(e.id);if(x(!1),!t.ok)return n?.close(),void b(t.message);if(v(t.url),_.current=!0,n)try{return void(n.location.href=t.url)}catch{}},testID:"pay-card"}),B.secondsLeft<120?(0,p.jsx)(s.Muted,{children:"Not enough time left to pay. Wait for this order to expire, then order again."}):null,P?(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Open the payment page again",onPress:()=>{'undefined'!=typeof window?window.open(P,'_blank'):r.default.openURL(P)}}):null,P?(0,p.jsx)(s.Button,{small:!0,kind:"ghost",label:"I\u2019ve paid: check now",onPress:()=>{(0,h.checkPaid)(e.id)}}):null,j?(0,p.jsx)(s.T,{size:14,colour:u.colours.red,children:j}):null,(0,p.jsx)(s.Muted,{children:"Secure card payment on the restaurant\u2019s website. Apple Pay and Google Pay may be offered there."})]})};var n=_r(d[0]),t=e(_r(d[1])),r=e(_r(d[2]));_r(d[3]);var o=_r(d[4]),s=_r(d[5]),l=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10])},879,[31,232,240,123,805,818,820,825,836,880,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_OFF",{enumerable:!0,get:function(){return o}}),e.getPayLink=async function(u){try{if(!await(0,n.guestSession)())return{ok:!1,message:'Can\u2019t reach the restaurant. Check your signal and try again.'};const{data:c,error:y}=await(0,t.getSupabase)().functions.invoke('takeaway-pay',{body:{order_id:u}}),f=await s(c,y);return f&&'string'==typeof f.url&&f.url.startsWith('https://')?{ok:!0,url:f.url,expiresAt:String(f.expiresAt??''),amountPence:Number(f.amountPence??0)}:{ok:!1,message:'string'==typeof f?.error?f.error:o}}catch{return{ok:!1,message:o}}},e.checkPaid=async function(o){try{const{data:u,error:c}=await(0,t.getSupabase)().functions.invoke('takeaway-pay-check',{body:{order_id:o}}),y=await s(u,c);return(0,n.nudgeGuestSync)(),y?.off?'off':String(y?.state??'unknown')}catch{return'unknown'}};var t=r(d[0]),n=r(d[1]);const o='Card payment isn\u2019t available right now. Nothing has been charged. Please ring the restaurant.';async function s(t,n){if(t&&'object'==typeof t)return t;const o=n?.context;try{const t=o?.json?await o.json():null;return t&&'object'==typeof t?t:null}catch{return null}}},880,[871,824]); \ No newline at end of file diff --git a/abbotsford/chef-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js b/abbotsford/chef-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js new file mode 100644 index 0000000000000000000000000000000000000000..aa5686de2b7746d4738fdfd057a3991ab57eb798 --- /dev/null +++ b/abbotsford/chef-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);r(d[1]);var n=r(d[2]),c=r(d[3]),o=r(d[4]),f=r(d[5]);function s(){const{section:s}=(0,t.useLocalSearchParams)();return(0,c.canShow)('chef')?s&&(0,o.chefSectionAllowed)(String(s))?(0,f.jsx)(n.ChefApp,{section:String(s)},String(s)):(0,f.jsx)(t.Redirect,{href:"/kitchen"}):(0,f.jsx)(t.Redirect,{href:c.ENTRY[c.APP_VARIANT]})}},776,[805,31,806,807,808,25]); \ No newline at end of file diff --git a/abbotsford/chef-app/_expo/static/js/web/[token]-060d0a0e0a07c4da23ca6d5b04c35e87.js b/abbotsford/chef-app/_expo/static/js/web/[token]-060d0a0e0a07c4da23ca6d5b04c35e87.js new file mode 100644 index 0000000000000000000000000000000000000000..8c5817048cdc931527ad3e9965aa37403fbf03f4 --- /dev/null +++ b/abbotsford/chef-app/_expo/static/js/web/[token]-060d0a0e0a07c4da23ca6d5b04c35e87.js @@ -0,0 +1,3 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]);function u(){const{token:u}=(0,t.useLocalSearchParams)(),h=(0,c.cleanToken)(u);return h?(0,s.guestServer)()?(0,l.jsx)(o.TableOrderLive,{token:h}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"demo",title:"Not connected",children:"This preview isn't connected to a venue, so table orders can't be sent from here."})}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"warn",title:"This code isn't working",children:"Please scan the QR code on your table again, or ask a member of staff."})})}},796,[805,31,818,882,884,845,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},882,[873,812,31,128,818,819,820,884,883,823,825,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})},883,[871,824,884]); \ No newline at end of file diff --git a/abbotsford/chef-app/_expo/static/js/web/__common-d92ed2b513b48a7e75fdf07ee4f937c8.js b/abbotsford/chef-app/_expo/static/js/web/__common-d92ed2b513b48a7e75fdf07ee4f937c8.js new file mode 100644 index 0000000000000000000000000000000000000000..be68213a01c22de9cae91a315fead9749f6fdf1d --- /dev/null +++ b/abbotsford/chef-app/_expo/static/js/web/__common-d92ed2b513b48a7e75fdf07ee4f937c8.js @@ -0,0 +1,588 @@ +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}Object.defineProperty(e,"__esModule",{value:!0}),r(d[0]),t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e)},805,[1297,1298,1308,1309,1311]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:K}=(0,z.useChef)(3e4);(0,we.useReviewAlerts)(i);const V=(0,_.useSignedIn)(),X=V?.id??z.CHEF_ID,Z=V?.ownerAccess&&'owner'!==V.role?'owner privileges':V?.managerAccess&&'staff'===V.role?'manager privileges':'',Ce=(0,Se.useSync)(e=>e.perms),Pe=Ce.includes('*')||Ce.includes('takings.view');(0,o.useSoldOutLink)(!0,(V?.name??n).replace(' (example)',''));const Oe=e?Be[e]:void 0,[Ee,Le]=(0,A.useState)(Oe?.tab??'home'),[Ne,We]=(0,A.useState)(Oe?.k??null),[Fe,Ge]=(0,A.useState)(Oe?.stock??'levels'),[Ke,Me]=(0,A.useState)(void 0),[Ve,ze]=(0,A.useState)(Oe?.gp??'dishes'),Ue=(0,A.useRef)(null),qe=(0,y.ymd)(K),Qe=(0,y.ymd)(new Date(K.getTime()+864e5));(0,p.useTipsPosted)(i,qe);const Ye=(0,ie.useTravelDay)('chef',qe),Je='home'===Ee&&!Ye;(0,S.useKitchenTodoChime)(i,qe,()=>tt('kitchen','bookings')),(0,me.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,_.ensureAttendance)((new Date).toISOString().slice(0,10),K)},[]);const Xe=(0,A.useRef)({t:'home',k:null});Xe.current={t:Ee,k:Ne};const Ze=(0,A.useRef)([]),et=(0,r.useScrollMemory)(Ue),tt=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Pe||(t=null);const s=Xe.current;s.t===e&&s.k===t||(Ze.current=[...Ze.current,{...s,y:et.leave()}].slice(-30),et.restore(0)),Le(e),We(t)},[Pe]),st=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Xe.current;let t=Ze.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ze.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return et.leave(),Le(s.t),We(s.k),et.restore(s.y??0),!0},[]);(0,l.useWebBack)(st);const it=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ge(s),'gp'===e&&s&&ze(s),tt(e,t)})},[tt]),(0,b.useShiftReminders)({rid:i,staffId:X,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:V?.id??'',name:n,onOpen:e=>{'orderlists'===e&&tt('kitchen','orderlists'),'chat'===e&&tt('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:V?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',st);return()=>e.remove()},[st]),(0,A.useEffect)(()=>{'takings'!==Ne||Pe||(We(null),Le('kitchen'))},[Ne,Pe]),(0,Se.useSync)(e=>e.perms.join(','));const at=(0,H.kitchenHistoryAccess)(i),ot=Ae.filter(e=>('takings'!==e.id||Pe)&&('bookinghistory'!==e.id||at)&&('kitchensetup'!==e.id||at)),nt=Ne&&('takings'!==Ne||Pe)?Ae.find(e=>e.id===Ne):null,rt=((0,E.default)().width,nt?nt.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:ge.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[Ee]);return(0,Re.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:M.colours.bg},edges:['top','bottom'],children:[(0,Re.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:M.colours.border,gap:6},children:[(0,Re.jsx)(L.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,Re.jsx)(F.VoiceSlot,{size:44})}),(0,Re.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'80%',paddingRight:8},children:[(0,Re.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${Z?`, ${Z}`:''}`,style:{borderWidth:1,borderColor:M.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Re.jsxs)(G.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Re.jsx)(ue.StaffAvatar,{id:z.CHEF_ID,size:24,ring:!1}),(0,Re.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Re.jsxs)(G.T,{size:13,weight:"semibold",colour:M.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),Z?(0,Re.jsx)(G.Muted,{center:!1,size:10,numberOfLines:1,children:Z}):null]})]})}),(0,f.openedFromDisplay)()?(0,Re.jsx)(f.BackToDisplayButton,{compact:!0}):null]}),(0,Re.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Re.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,he.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:M.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Re.jsx)(G.T,{size:13,colour:M.colours.gold,children:"Staff app \u203a"})})]}),(0,Re.jsxs)(O.default,{ref:Ue,...et.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Ee?(0,Re.jsx)(ce.AlertsBanner,{}):null,'home'===Ee?(0,Re.jsx)(de.WhosOnShift,{}):null,(0,Re.jsx)(l.BackTitleRow,{back:!('home'===Ee&&!Ne||it),onBack:st,title:rt}),'home'===Ee?(0,Re.jsx)(ie.DayBar,{app:"chef",today:qe}):null,'home'===Ee&&Ye?(0,Re.jsx)(ie.DayView,{rid:i,day:Ye,today:qe,app:"chef"}):null,'home'===Ee?(0,Re.jsx)(le.WhoBar,{}):null,Je&&V?(0,Re.jsx)(h.MyTasksToday,{rid:i,staffId:V.id,name:V.name,onShift:(0,b.shiftNow)(V.id,K.getTime()).on}):null,Je&&(0,k.isKitchenViaDisplay)()?(0,Re.jsx)($e,{go:(e,t)=>{'stock'===e&&t&&Ge(t),'gp'===e&&t&&ze(t),'orders'===e&&Me(t),tt(e,'kitchen'===e?t??null:null)}}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(p.TodaysTipsCard,{rid:i,today:qe}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(p.TipsPotCard,{rid:i,today:qe}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(x.CoversToday,{rid:i,onPress:()=>tt('kitchen','bookings')}):null,Je?(0,Re.jsx)(j.LastFoodBanner,{rid:i,now:K}):null,Je?(0,Re.jsx)(w.NextTableFreeCard,{rid:i,now:K}):null,Je?(0,Re.jsx)(v.KitchenSignoffs,{rid:i,today:qe,by:n,app:"chef"}):null,Je?(0,Re.jsxs)(L.default,{style:{gap:4},children:[(0,Re.jsx)(v.PlattersBooked,{rid:i,date:qe,label:"Platters booked today"}),(0,Re.jsx)(v.PlattersBooked,{rid:i,date:Qe,label:"Platters booked tomorrow"})]}):null,Je?(0,Re.jsx)(Te.ChefAssistantButton,{}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)($e,{go:(e,t)=>{'stock'===e&&t&&Ge(t),'gp'===e&&t&&ze(t),'orders'===e&&Me(t),tt(e,'kitchen'===e?t??null:null)}}):null,'stock'!==Ee||c.PITCH?null:(0,Re.jsx)(te.KitchenCosts,{rid:i,me:(V?.name??n).replace(' (example)',''),actor:{name:(V?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Fe?'deliveries':'take'===Fe?'count':'deliveries'},`s-${Fe}`),'gp'!==Ee||c.PITCH?null:(0,Re.jsx)(te.KitchenCosts,{rid:i,me:(V?.name??n).replace(' (example)',''),actor:{name:(V?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ve}`),'stock'===Ee&&c.PITCH?(0,Re.jsx)(ee.StockScreen,{initial:Fe},Fe):null,'gp'===Ee&&c.PITCH?(0,Re.jsx)(U.GpScreen,{initial:Ve},Ve):null,'creator'===Ee?(0,Re.jsx)(ge.DishCreator,{rid:i,canPublish:!1}):null,'orders'===Ee?(0,Re.jsx)(Y.OrdersScreen,{focus:Ke},Ke??'all'):null,'rota'===Ee?(0,Re.jsx)(G.Card,{children:(0,Re.jsx)(J.KitchenRotaTab,{today:qe})}):null,'kitchen'!==Ee||nt?null:(0,Re.jsxs)(L.default,{style:{gap:10},children:[(0,Re.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:M.colours.border,backgroundColor:M.colours.surface,overflow:'hidden'},children:[He.map(e=>(0,Re.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>tt(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Re.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Re.jsxs)(L.default,{style:{flex:1},children:[(0,Re.jsx)(G.T,{weight:"medium",children:e.title}),(0,Re.jsx)(G.Muted,{children:e.sub})]}),(0,Re.jsx)(G.T,{colour:M.colours.muted,children:"\u203a"})]})},e.id)),ot.map(e=>(0,Re.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>tt(Ee,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:M.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Re.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Re.jsxs)(L.default,{style:{flex:1},children:[(0,Re.jsx)(G.T,{weight:"medium",children:e.title}),(0,Re.jsx)(G.Muted,{children:e.sub})]}),(0,Re.jsx)(G.T,{colour:M.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Re.jsx)(G.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Re.jsxs)(G.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Se.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ne&&X?(0,Re.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Re.jsx)(ne.ClockInOut,{}),(0,Re.jsx)(re.MyUpcomingShifts,{staffId:X,team:!0})]}):null,'mypay'===Ne?(0,Re.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Re.jsx)(ae.MyPeriods,{staffId:X}),(0,Re.jsx)(se.MyHoursPay,{staffId:X}),(0,Re.jsx)(oe.MyTips,{staffId:X}),(0,Re.jsx)(G.Card,{children:(0,Re.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ne?(0,Re.jsx)(L.default,{testID:"chef-alerts",children:(0,Re.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ne?(0,Re.jsx)(t.AvatarMaker,{meId:V?.id??z.CHEF_ID,me:n}):null,'reviews'===Ne?(0,Re.jsx)(je.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ne?(0,Re.jsx)(R.BookingHistory,{rid:i,today:qe}):null,'bookings'===Ne?(0,Re.jsx)(I.TodaysBookings,{rid:i,today:qe,by:n,app:"chef"}):null,'specials'===Ne?(0,Re.jsx)(fe.SpecialsEditor,{rid:i,me:n,app:"chef",now:K}):null,'forecast'===Ne?(0,Re.jsx)(q.ChefForecast,{openPrep:()=>tt('kitchen','prep')}):null,'prep'===Ne?(0,Re.jsx)(Q.PrepScreen,{}):null,'live'===Ne?(0,Re.jsx)(Q.TeamScreen,{}):null,'waste'===Ne?(0,Re.jsx)(Q.WasteScreen,{}):null,'recipes'===Ne?(0,Re.jsx)(xe.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ne?(0,Re.jsx)(Q.AllergenScreen,{openCards:()=>tt('kitchen','recipes')}):null,'takings'===Ne&&Pe?(0,Re.jsx)(p.CashUpScreen,{rid:i,today:qe,canEdit:!1,chartsOnly:!0,who:{id:X,name:n.replace(' (example)','')}}):null,'board'===Ne?(0,Re.jsx)(ve.QuestionBoard,{rid:i,today:qe,manager:!1,by:""}):null,'teamtasks'===Ne?(0,Re.jsx)(h.KitchenTeamTasks,{rid:i,actor:V}):null,'orderlists'===Ne?(0,Re.jsx)(C.OrderListsScreen,{rid:i,today:qe,editor:!0,who:{id:X,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ne?at?(0,Re.jsx)(D.TempUnitsSetup,{}):(0,Re.jsx)(G.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ne||'compliance'===Ne||'foodsafety'===Ne?(0,Re.jsx)(ke.HaccpLog,{mode:"chef",me:n,meId:z.CHEF_ID,now:K,rid:i}):null,'accidents'===Ne?(0,Re.jsx)(pe.AccidentBook,{app:"chef",me:n,meId:z.CHEF_ID,now:K,seeAll:!1}):null]}),(0,Re.jsx)(Ie.BottomTabs,{tablist:!0,background:M.colours.surface,active:'orders'===Ee?'kitchen':Ee,onPress:e=>tt(e),tabs:De.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Re.jsx)(Te.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Me(t),tt('orders')):'gp'===e?tt('gp'):tt('kitchen',e)}}),(0,Re.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Re.jsx)(ye.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),fe=_r(_d[67]),be=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]),Ie=_r(_d[79]),Re=_r(_d[80]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const De=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:ge.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],He=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],Ae=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],Be={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function $e({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,z.useChef)(3e4),d=(0,X.useSheetReminders)(),u=(0,z.useWeek)(),{covers:h,label:p,enough:k,booked:f}=(0,z.useForecast)(),b=(0,Y.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,z.isLow)(e.onHand,e.par)),x=b.filter(e=>e.ordersToday&&!e.placedToday),j=(0,V.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,Ce.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,te.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Re.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Re.jsx)(ke.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Re.jsxs)(G.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Re.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Re.jsxs)(G.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Re.jsx)(Z.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Re.jsx)(G.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Re.jsxs)(G.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,z.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,z.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,z.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Re.jsx)(z.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,K.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Re.jsx)(z.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,K.gbp)((0,z.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Re.jsx)(z.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Re.jsx)(z.Tile,{label:"Waste this week",value:t.waste.length?(0,K.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,z.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Re.jsx)(z.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Re.jsx)(z.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${f}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Re.jsx)(z.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Re.jsxs)(G.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Re.jsx)(G.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Re.jsxs)(G.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Re.jsx)(G.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[ge.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Re.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:M.colours.gold,backgroundColor:M.colours.surface},children:(0,Re.jsxs)(G.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Re.jsx)(G.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Re.jsx)(Pe.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},806,[1064,1386,1216,940,1387,1039,1040,1041,2,1054,1043,1044,977,1163,998,822,942,1413,1414,991,1053,1051,1052,945,1418,1427,1429,1175,31,234,123,264,152,288,128,290,867,946,818,820,825,951,1439,1441,1442,1443,1445,1453,1452,1454,972,1456,1457,1058,943,1059,1061,1060,1480,1037,938,1038,994,865,1062,1448,1063,1488,959,1497,961,1048,841,948,1049,823,1501,939,824,1057,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"IS_OWNER_DESKTOP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"IS_CAR",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"APP_VARIANT",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"ENTRY",{enumerable:!0,get:function(){return l}}),_e.isAllowedPath=function(e,n=f){return!(t.IS_ISOLATED_VENUE&&/^\/(customer|table)(\/|$)/.test(e)&&![`/customer/${t.VENUE_RID}`,`/customer/${t.VENUE_RID}/`].includes(e))&&('/'===e||''===e||_[n].test(e))},_e.canShow=function(e,t=f){return t===e||'owner'===t&&'customer'===e};var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};const u=o.default.expoConfig?.extra?.appVariant??void 0??'owner',c=!1,s=!1,f=['owner','staff','customer','display','chef'].includes(u)?u:'owner',l={owner:'/owner',staff:'/team',customer:`/customer/${t.VENUE_RID}`,display:'/display',chef:'/kitchen'},_={owner:/^\/(owner|customer|table)(\/|$)/,customer:/^\/(customer|table)(\/|$)/,staff:/^\/team(\/|$)/,display:/^\/display(\/|$)/,chef:/^\/kitchen(\/|$)/}},807,[5,409]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PERMISSIONS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"CHEF_SECTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"chefSectionAllowed",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"rotaView",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"chatView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ticketView",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"supplierView",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"auditView",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"CARD_ROLE_APP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"cardCostsVisible",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"ownJobSeesCosts",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"costsAllowedFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ownJobManagesLinks",{enumerable:!0,get:function(){return h}});const e={owner:'all',manager:'all',staff:new Set(['rota-shifts','tickets','eighty-six','allergens']),chef:new Set(['stock','costing','gp','waste','dish-sales','prep','ordering','allergens','compliance','rota-shifts','kitchen-chat','tickets','eighty-six','specials'])},t=(t,n)=>{const a=e[t];return'all'===a||a.has(n)},n={stock:'stock','stock-take':'stock',deliveries:'stock',gp:'gp','price-changes':'gp','gp-week':'gp','menu-engineering':'dish-sales',orders:'ordering',forecast:'prep',prep:'prep',live:'tickets',waste:'waste',allergens:'allergens',compliance:'compliance',haccp:'compliance',accidents:'compliance','new-dish':'gp',specials:'specials',recipes:'allergens','recipe-cards':'allergens'},a=e=>e in n&&t('chef',n[e]),s=(e,n,a)=>t(e,'staff-personal')?{staff:n,shifts:a}:{staff:n.filter(e=>e.active).map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},job:e.job})),shifts:a.filter(e=>e.published).map(({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l})=>({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l}))},c=(e,t)=>'chef'===e?t.filter(e=>'kitchen'===e.ch&&!e.removed):t,l=(e,n)=>t(e,'customer-personal')?n:n.map(({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),f=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text)),u={'head-chef':'chef',manager:'manager',owner:'owner',staff:'staff'},p=(e,n="edit")=>'edit'===n&&t(u[e]??'staff','costing'),b=e=>'owner'===e.role||'manager'===e.role||'Head Chef'===e.level,m=e=>!e||b(e),h=e=>'owner'===e.role||'manager'===e.role},808,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},812,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},813,[31,264,274,128,1172,825,818,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_DWELL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"dwellBands",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"bandLabel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fmtMins",{enumerable:!0,get:function(){return o}}),_e.dwellFor=function(e,t,r=[]){const o=n(e),i=Math.max(0,o.findIndex(e=>t<=e.upTo)),s=o[i]??o[o.length-1];if(!1===e?.settings.dwellLearn)return{mins:s.mins,learned:!1,samples:0};const a=0===i?1:o[i-1].upTo+1,u=r.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt&&e.partySize>=a&&e.partySize<=s.upTo).map(e=>(new Date(e.finishedAt).getTime()-new Date(e.seatedAt).getTime())/6e4).filter(e=>e>=20&&e<=360).sort((e,t)=>e-t);if(u.length<8)return{mins:s.mins,learned:!1,samples:u.length};const l=u[Math.floor(u.length/2)];return{mins:5*Math.round((s.mins+l)/2/5),learned:!0,samples:u.length}},Object.defineProperty(_e,"DAYS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ruleText",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"ANCHORAGE_EVENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"regularEventsOf",{enumerable:!0,get:function(){return l}}),_e.occursOn=m,_e.nextOccurrence=function(e,t){const n=f(t);for(let t=0;t<400;t++){const r=c(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t));if(m(e,r))return r}return null},_e.expandEvents=function(e,t,n,r){const o=[];if(!t.some(e=>e.active))return o;const i=f(n),s=f(r);for(let n=i;n<=s;n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)){const r=c(n);for(const n of t)m(n,r)&&o.push({id:`${n.id}:${r}`,restaurantId:e,date:r,title:n.name,kind:'event',example:!1,source:'regular',description:[n.time?`from ${n.time}`:'',n.lastFood?`last food orders ${n.lastFood}`:'',n.notes??''].filter(Boolean).join(' \xb7 '),busier:n.busier,lastFood:n.lastFood,time:n.time})}return o},_e.lastFoodOn=function(t,n){if(!t)return null;const r=f(n).getDay(),o=t.settings.lastFoodByDay?.[r],s=(0,e.kitchenHoursOn)(t,f(n));let a=s?{time:s[1],reason:'kitchen closes'}:null;o&&(!a||oe?.settings.dwellBands?.length?e.settings.dwellBands:t,r=(e,t)=>{const n=0===t?1:e[t-1].upTo+1,r=e[t].upTo;return r>=9999?`${n} or more covers`:n===r?`${n} cover${1===n?'':'s'}`:`${n}\u2013${r} covers`},o=e=>e%60==0?`${e/60} hour${60===e?'':'s'}`:e>60?`${Math.floor(e/60)} h ${e%60} min`:`${e} min`;const i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],s=['','first','second','third','fourth'],a=e=>'last'===e.kind?`Last ${i[e.weekday]} of every month`:'nth'===e.kind?`${s[e.n][0].toUpperCase()}${s[e.n].slice(1)} ${i[e.weekday]} of every month`:'weekly'===e.kind?`Every ${i[e.weekday]}`:`One-off: ${e.date}`,u=[{id:'ev-music-night',name:'Open Mic Night',rule:{kind:'last',weekday:0},time:'20:00',notes:'Live music from 8pm.',busier:!0,lastFood:'19:00',active:!0}],l=e=>e?.settings.regularEvents??('anchorage'===e?.id?u:[]),d=e=>String(e).padStart(2,'0'),c=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`,f=e=>new Date(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)));function m(e,t){if(!e.active)return!1;const n=e.rule;if('once'===n.kind)return n.date===t;const r=f(t);return r.getDay()===n.weekday&&('weekly'===n.kind||('nth'===n.kind?Math.ceil(r.getDate()/7)===n.n:new Date(r.getFullYear(),r.getMonth(),r.getDate()+7).getMonth()!==r.getMonth()))}const b=e=>e?.settings.afterLastFood??'drinks',p=e=>{const[t,n]=e.split(':').map(Number);return`${t%12||12}${n?`:${d(n)}`:''}${t<12?'am':'pm'}`},y=e=>e?.settings.showTakeaway??'anchorage'!==e?.id,h=e=>!1!==e?.settings.coversCounter,O=e=>!1!==e?.settings.nextTableFree,$=e=>!1!==e?.settings.dogQuestion,w=e=>!1!==e?.settings.dietQuestion,F=e=>!1!==e?.settings.accessQuestion,k=(e,t)=>e?.settings.holidayFullNames?t:t.replace(/\s*\(substitute day\)/gi,'').trim()},814,[833]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},815,[873,31,123,128,25]); +__d(function(_g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.startForm=function(t=Date.now()){return{openedAt:t,hp:''}},e.guardFor=function(t,n=Date.now()){return{hp:t.hp,formMs:Math.max(0,Math.round(n-t.openedAt))}},e.rememberGuard=function(n,o){t.set(n,o)},e.takeGuard=function(n){const o=t.get(n);return o?(t.delete(n),o):{}};const t=new Map},816,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedFields=W,_e.historyText=D,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=W(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:D(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${A(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!W(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return E}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: 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.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],h=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],u=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],w=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),k=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return k(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){const i=y(e);return l.filter(e=>M(e,i)!==M(e,t))}const j=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,A=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function D(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${j(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${j(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${j(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${h.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=w(o.holds),i=w(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${A(s)}`}const E=e=>e.map(e=>f[e]).join(', ')},817,[832,1172,1419,958]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return A}}),_e.BrandBar=z,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,B.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,B.jsx)(v,{}):null]});return(0,B.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,B.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,B.jsx)(z,{title:t,subtitle:r,back:o,right:l})}),c?(0,B.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,B.jsx)(p.default,{style:{flex:1},children:u}),s?(0,B.jsx)(p.default,{style:N.footer,children:(0,B.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=F,_e.Card=H,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,B.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:D?'center':'flex-start'}],children:(0,B.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=E,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return $}}),_e.Row=O,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return _}}),_e.Field=function({label:e,...t}){return(0,B.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,B.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,B.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t,style:[N.input,t.multiline&&{minHeight:70,textAlignVertical:'top'},t.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,B.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,B.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,B.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,B.jsxs)(O,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,B.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,B.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,B.jsxs)(O,{gap:10,children:[(0,B.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,B.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,B.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,B.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,B.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,B.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w}){const{height:W}=(0,x.default)(),k=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},S=(0,r.useTyping)(),I=(0,r.useVisibleArea)(),D=S&&I&&I.height({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,B.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,R?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,B.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,B.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,B.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,B.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,B.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]);const R=['kirkton','abbotsford'].includes(k.VENUE_RID),D='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(D&&('semibold'===l||'bold'===l)&&!j);return(0,B.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,B.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,B.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),A=e=>(0,B.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??D});function z({title:e,back:t=!0,right:r,subtitle:o}){return(0,B.jsxs)(p.default,{style:N.brandBar,children:[(0,B.jsxs)(p.default,{style:N.row,children:[(0,B.jsx)(p.default,{style:N.brandSide,children:t?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,B.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,B.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,B.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,B.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,B.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,B.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,B.jsx)(A,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function v(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,B.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,B.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function F({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,B.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,B.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,B.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function H({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,B.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,B.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function E({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,B.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,B.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,B.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}A.statusLine=!0,F.centreRow=!0;const V=({phone:e})=>(0,B.jsx)(E,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),$=()=>(0,B.jsx)(E,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function O({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===H?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(D&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,B.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=D&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,B.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const _=()=>(0,B.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},818,[1162,835,1346,873,805,878,31,240,257,123,264,152,47,272,128,288,290,825,1344,1347,5,807,867,25]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ALLERGENS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"allergenLabel",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEVERITIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"severityLabel",{enumerable:!0,get:function(){return s}}),e.effectiveAllergens=function(l,n=[]){const t={...l.allergens};for(const s of l.optionGroups??[])for(const l of s.choices)if(n.includes(l.id)&&l.allergens)for(const[n,s]of Object.entries(l.allergens))'contains'!==t[n]&&(t[n]=s);return t},e.conflictsFor=function(l,n){const t=[],s=[];for(const a of n)'contains'===l[a.allergen]?t.push(a.allergen):'may'===l[a.allergen]&&s.push(a.allergen);return{contains:t,may:s}},Object.defineProperty(e,"hasConflict",{enumerable:!0,get:function(){return a}});const l=[{id:'gluten',label:'Cereals containing gluten',short:'Gluten'},{id:'crustaceans',label:'Crustaceans',short:'Crustaceans'},{id:'molluscs',label:'Molluscs',short:'Molluscs'},{id:'eggs',label:'Eggs',short:'Eggs'},{id:'fish',label:'Fish',short:'Fish'},{id:'peanuts',label:'Peanuts',short:'Peanuts'},{id:'treenuts',label:'Tree nuts',short:'Tree nuts'},{id:'soya',label:'Soya',short:'Soya'},{id:'milk',label:'Milk',short:'Milk'},{id:'celery',label:'Celery',short:'Celery'},{id:'mustard',label:'Mustard',short:'Mustard'},{id:'sesame',label:'Sesame',short:'Sesame'},{id:'sulphites',label:'Sulphur dioxide / sulphites',short:'Sulphites'},{id:'lupin',label:'Lupin',short:'Lupin'}],n=n=>l.find(l=>l.id===n)?.short??n,t=[{id:'intolerance',label:'Intolerance'},{id:'allergy',label:'Allergy'},{id:'coeliac',label:'Coeliac disease'},{id:'anaphylaxis',label:'Severe \u2014 anaphylaxis risk'}],s=l=>t.find(n=>n.id===l)?.label??l;const a=l=>l.contains.length>0||l.may.length>0},819,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"gbp",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return n}});const t=t=>`\xa3${(t/100).toFixed(2)}`,n=t=>Math.round(100*t)},820,[]); +__d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSlotMinutesOf=s,e.bookingNoticeMinsOf=r,e.bookingCoversPerStartOf=u,e.bookingPartiesPerStartOf=l,e.onlinePartyBounds=c,Object.defineProperty(e,"COVERS_WINDOW_MINS",{enumerable:!0,get:function(){return f}}),e.coversInHalfHour=m,e.countInStartSlot=p,e.bookingLimitsHint=function(t){const n=s(t),o=u(t),f=l(t),m=r(t),p=c(t);if(null!=o||null!=f){const t=[];return null!=o&&null!=f?t.push(`up to ${o} people and ${f} bookings at each start time`):null!=o?t.push(`up to ${o} people at each start time`):t.push(`up to ${f} bookings at each start time`),(p.max<100||p.min>1)&&t.push(`parties of ${p.min} to ${p.max}`),t.push(`from ${m} minutes ahead`),t.push('table rules still apply'),`Times are every ${n} minutes: ${t.join(', ')}.`}return`Times are every ${n} minutes. Covers per slot (${t.settings.bookingCoversPerSlot} per half hour) and table rules still apply.`},e.takeawaySlots=function(o,s,r){const u=(0,t.hoursFor)(o,r);if(!u)return[];const l=o.settings.slotMinutes,c=(0,n.addMins)(r,o.settings.leadMins),f=[];for(let t=new Date(u.open);t<=u.close;t=(0,n.addMins)(t,l)){if(tn.restaurantId===o.id&&'takeaway'===n.type&&'cancelled'!==n.status&&n.slotTime&&new Date(n.slotTime).getTime()===t.getTime()).length;f.push({time:new Date(t),label:(0,n.hm)(t),taken:r,cap:o.settings.slotCap,full:r>=o.settings.slotCap})}return f},e.bookingSlots=function(c,f,d,h,k,M=()=>0){const y=(0,t.hoursFor)(c,f);if(!y)return[];const S=[],$=y.close,P=(0,o.lastFoodOn)(c,b(f)),v=P?(0,n.atTime)(f,P.time):$,I='drinks'===(0,o.afterLastFood)(c),O=s(c),C=r(c),N=u(c),T=l(c);for(let t=new Date(y.open);t<=$;t=(0,n.addMins)(t,O)){const o=(0,n.hm)(t),s=t>v;if(s&&!I)continue;const r=null!=N?p(d,o,O):m(d,o),u=(N??c.settings.bookingCoversPerSlot)-r,l=null!=T?p(M,o,O):0,f=null!=T?T-l:void 0,b=t.getTime()=1;S.push({time:o,left:u,available:!b&&u>=h&&y,past:b,...s?{drinksOnly:!0}:{},...null!=f?{partiesLeft:f,partiesCap:T}:{}})}return S};var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]);function s(t){const n=t.settings.bookingSlotMinutes;return 5===n||10===n||15===n||20===n||30===n?n:15}function r(t){const n=t.settings.bookingNoticeMins;return'number'==typeof n&&Number.isInteger(n)&&n>=0&&n<=1440?n:30}function u(t){const n=t.settings.bookingCoversPerStart;return'number'==typeof n&&Number.isInteger(n)&&n>0&&n<=200?n:null}function l(t){const n=t.settings.bookingPartiesPerStart;return'number'==typeof n&&Number.isInteger(n)&&n>0&&n<=50?n:null}function c(t){const n=t.settings.onlinePartyMin,o=t.settings.onlinePartyMax,s='number'==typeof n&&Number.isInteger(n)&&n>=1&&n<=100?n:1;return{min:s,max:'number'==typeof o&&Number.isInteger(o)&&o>=s&&o<=100?o:100}}const f=30;function m(t,o){const s=Math.floor((0,n.toMins)(o)/f)*f;let r=0;for(let o=0;o`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},821,[833,822,814]); +__d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"pad",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return n}}),e.venueYmd=function(t,u="Europe/London"){try{const n=new Intl.DateTimeFormat('en-CA',{timeZone:u,year:'numeric',month:'2-digit',day:'2-digit'}).format(t);if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n}catch{}return n(t)},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseYmd",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toMins",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fromMins",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"atTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"addMins",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"dayShort",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"dayLong",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"monthLong",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"niceDate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"niceDateYear",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"minsBetween",{enumerable:!0,get:function(){return P}});const t=t=>String(t).padStart(2,'0'),n=n=>`${n.getFullYear()}-${t(n.getMonth()+1)}-${t(n.getDate())}`;const u=n=>`${t(n.getHours())}:${t(n.getMinutes())}`,a=t=>{const[n,u,a]=t.split('-').map(Number);return new Date(n,u-1,a)},o=t=>{const[n,u]=t.split(':').map(Number);return 60*n+u},c=n=>`${t(Math.floor(n/60))}:${t(n%60)}`,d=(t,n)=>{const u=new Date(t);return u.setHours(0,0,0,0),u.setMinutes(o(n)),u},m=(t,n)=>new Date(t.getTime()+6e4*n),b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],y=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],f=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],l=['January','February','March','April','May','June','July','August','September','October','November','December'],p=t=>b[t.getDay()],s=t=>y[t.getDay()],O=t=>l[t],M=t=>`${b[t.getDay()]} ${t.getDate()} ${f[t.getMonth()]}`,j=t=>`${M(t)} ${t.getFullYear()}`,P=(t,n)=>Math.round((n.getTime()-t.getTime())/6e4)},822,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"repo",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=t.localRepositories},823,[1348,1079]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return Q.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return Q.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return Q.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return Q.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return Q.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return et}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ct}}),i.rotaReconcile=Dt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();de.useOwner.getState().chatMarkRead(e,{[t]:a});const s=de.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>de.useOwner.getState().chatSeen(t,e)),Qt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await De().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(de.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await De().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(de.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await De().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return de.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...vt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(me.PITCH)return Se.unlockCashUp(e,t,a);const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await De().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?le.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):le.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})),{ok:!0,until:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.readCashAudit=async function(e){if(me.PITCH)return Se.cashAudit(e);const t=Ue.getState().venueId;if(!t)return[];let a=De().from('cash_up_audit').select('at, action, changed_by_name, tbl, for_date, reason, old_row, new_row').eq('venue_id',t).order('at',{ascending:!1}).limit(50);e&&(a=a.eq('row_id',e));const{data:s,error:n}=await a;return n||!Array.isArray(s)?[]:s.map(e=>({at:String(e.at),action:String(e.action),by:String(e.changed_by_name??'\u2014'),tbl:String(e.tbl),forDate:e.for_date??void 0,reason:e.reason??void 0,changed:(0,A.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=Ue.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await De().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(ya.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=_a,i.readAccessLog=async function(){const e=Ue.getState().venueId;if(!e)return[];try{const{data:t}=await De().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ue.getState().venueId;if(!e)return[];const{data:t,error:a}=await De().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await De().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=ha.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await De().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return ha.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await De().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return ya}}),i.claimInvite=Na,i.makeChromeHandover=async function(){const e=Ue.getState();if(me.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await De().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Ke});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(me.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await De().rpc('claim_chrome_handover',{p_code:e,p_app:Ke});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),Le&&ja(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(me.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{Me();const{data:t,error:a}=await De().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(me.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await De().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),Le&&ja(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{Me(),await De().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Aa)}catch{}},i.signedInHereAs=async function(e){Me();const t=await L.kv.get(Aa,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return Me(),await L.kv.get(Ca,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ue.getState();if(!u.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==u.VENUE_UUID||e.staffRef!==C.useSession.getState().meId)return null;Me();const t=await L.kv.get(Ca,null);return t?(0,C.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ue.getState();if(!u.IS_WILDINGS||'staff'!==e.kind||e.venueId!==u.VENUE_UUID||e.staffRef!==C.useSession.getState().meId)return null;Me();const t=await L.kv.get(Ca,null);return t?(0,C.appUrl)('staff',t):null},i.forgetSignInHere=async function(){Me(),await L.kv.remove(Aa),await L.kv.remove(Ca),Ee({mode:'signin',perms:[]});try{await Ba()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ue.getState().venueId;if(me.PITCH||!s||'staff'!==Ue.getState().kind)return{ok:!0};if(!(0,ue.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await qa('approve_shift_swap',{p_venue:s,p_shift:e,p_to_ref:t,p_kind:a}),{ok:!0}}catch(e){return{ok:!1,message:String(e?.message??e).replace(/^.*?:\s*/,'')||'Not allowed'}}},i.claimInviteForSync=async function(e){const t=await Na(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(me.PITCH)return Se.reissueInvite(e);const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await De().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.currentStaffAppLinks=async function(e){const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return qa('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return qa('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return qa('staff_app_link_history',{p_venue:Ue.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await qa('revoke_staff_app_link',{p_venue:Ue.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(me.PITCH)return Se.linkPhones();const e=Ue.getState().venueId;if(!e||'staff'!==Ue.getState().kind)return{};try{const t=await qa('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(me.PITCH)return Se.resetPhone(e);const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return Number(await qa('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(me.PITCH)return Se.inviteStatus();const e=Ue.getState().venueId;if(!e)return{};const{data:t,error:a}=await De().rpc('invite_status',{p_venue:e});if(a||!Array.isArray(t))return{};const s={};for(const e of t)s[String(e.staff_ref)]={state:e.state,expiresAt:e.expires_at??void 0,usedAt:e.used_at??void 0,devices:Number(e.devices??0)};return s},i.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Ta();const{data:t,error:a}=await De().rpc(u.IS_QUEUED_VENUE?'claim_'+u.VENUE_RID+'_pairing_code':u.IS_GREENSIDE?'claim_greenside_pairing_code':u.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':u.IS_KIRKTON?'claim_kirkton_pairing_code':u.IS_WILDINGS?'claim_wildings_pairing_code':u.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':u.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)return{ok:!1,error:'That code was not accepted. It may have expired. Ask a manager for a new one.'};const n={kind:'device',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await L.kv.set(Oa,n),ja(),{ok:!0,venueName:s.venue_name}}catch(e){const t=String(e?.message??e);return/fetch|network/i.test(t)?{ok:!1,error:'No connection. Check the tablet\u2019s Wi-Fi and try again.'}:/rate|too many/i.test(t)?{ok:!1,error:'Too many tries from this network. Wait a little and try again.'}:{ok:!1,error:/valid|switched off/i.test(t)?t:`Couldn\u2019t pair: ${t}`}}},i.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Ta();const{data:e,error:t}=await De().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ka,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:Pa(e)}}},i.carPairPoll=async function(e){try{Me();const t=e??await L.kv.get(Ka,null);if(!t)return'unknown';const{data:a,error:s}=await De().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,Y.carPairApproved)(n)){const e=(0,Y.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Oa,null);await L.kv.set(Oa,e),await L.kv.remove(Aa),C.useSession.getState().meId&&C.useSession.getState().signOut(),de.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||ja()}return'revoked'!==i&&'unknown'!==i||await Ma(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{Me(),await De().rpc('car_sign_out')}catch{}await Ma(),await Ba();try{await De().auth.signOut({scope:'local'})}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await qa('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:Pa(e)}}},i.carList=async function(){const e=Ue.getState().venueId;if(!e)return[];return(await qa('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=Ue.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await qa('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:Pa(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Oa),await Ba();try{await De().auth.signOut()}catch{}Ee({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Aa),await L.kv.remove(Ca),await Ba();try{await De().auth.signOut()}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'Disconnected. Open your personal invite link to connect again.'})},i.wipeThisDevice=async function(e={}){try{await Ba()}catch{}try{(0,K.isSupabaseConfigured)()&&await De().auth.signOut({scope:'local'})}catch{}let t=0;try{const e='undefined'!=typeof navigator?navigator:null,t=await(e?.serviceWorker?.getRegistration?.()),a=await(t?.pushManager?.getSubscription?.());a&&await a.unsubscribe()}catch{}for(const e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${u.VENUE_RID}:`)):(0,O.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!u.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This device has been wiped.'}),!1!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=xa,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return qa}}),i.mendSession=Fa,i.startAppSync=async function(e=u.VENUE_RID){if(u.IS_ISOLATED_VENUE&&e!==u.VENUE_RID)return;if(Le)return;Le=!0,$a=e,'customer'===Ke&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(Me(),'customer'!==Ke){const t=e=>new Promise(t=>{try{if(!e?.persist||e.persist.hasHydrated())return t();const a=e.persist.onFinishHydration(()=>{a?.(),t()});setTimeout(t,3e3)}catch{t()}}),a='chef'===Ke&&(0,w.isAnchorage)(e)?[z.useStore,de.useOwner,re.useKitchen,oe.useSafety,ae.useCardStore,S.useGpCalc,se.useOrderSheets,y.useSpecials,D.useHr]:[z.useStore,de.useOwner,re.useKitchen];if(await Promise.all(a.map(t)),'chef'===Ke&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ee({mode:'offline',message:'Saved kitchen data could not be backed up. Nothing was cleared. Free some device storage, then reopen.',lastError:'Legacy kitchen archive not ready'});try{await Cs(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ee({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ee({mode:'off'});$.mutationQueue.subscribe(()=>{const e=$.mutationQueue.waiting,t=e[0];Ee({pending:$.mutationQueue.pending.length,failed:$.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,j.describeWrite)(t)}: ${(0,j.plainReason)({...t.lastErr},'retry')}`:void 0})}),$.mutationQueue.onFailed(e=>Ee({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:$.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,j.describeWrite)(e),why:'conflict'===e.reason?(0,j.plainReason)({code:'conflict'},'refused'):(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),qe.push((0,P.onConnectivity)(e=>Ee({mode:e?Ue.getState().venueId?'live':Ue.getState().mode:Ue.getState().venueId?'offline':Ue.getState().mode}))),await Wa()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return Ga}}),i.serverOrder=es,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ts}}),i.nudgeGuestSync=function(){as?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return ss}}),i.stockSaveBlocker=ns,i.stockEventStatus=function(e){if(et(e))return{state:'saved'};const t=$.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,j.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=is,i.saveStockEventsNow=rs,i.bookingSaveBlocker=ds,i.resendUnsavedBookings=ls,i.saveBookingsNow=fs,i.waitForBookingSave=function(e,t=12e3){if(!Ne())return Promise.resolve({state:'local'});const a=ds();if(a)return Promise.resolve({state:'refused',why:a});const s=us()[0]?.venueId??'',n=()=>os.some(t=>$.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,P.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push($.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push($.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||us().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||us().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=Ss,i.tempLogState=function(){const e=hs()[0]?.venueId??'',t=hs().find(e=>'temp_readings'===e.spec.table),a=$.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!$.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(H.useTempSaves.getState().notSaved),i=oe.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ys,i.waitForTempSave=function(e,t,a=1e4){if(!Ne()||!hs().length)return Promise.resolve({state:'local'});const s=Ss(e);if(s)return Promise.resolve({state:'refused',why:s});const n=hs()[0]?.venueId??'',i=hs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>H.useTempSaves.getState().notSaved[(0,H.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>$.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=ks,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Ls}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=qs.get(a);if('customer'!==Ke||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():qs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),qa('public_day',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:Fe(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:Fe(a.from_time),to:Fe(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),qs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Ls.setState(e=>({n:e.n+1}))}).catch(()=>{const e=qs.get(a);e&&!e.ok&&qs.delete(a)}));const n=qs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ue.getState().venueId;if(!n||'staff'!==Ue.getState().kind)throw new Error('Connect to your venue first.');const i=await qa('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ue.getState().venueId;if(!e||'staff'!==Ue.getState().kind)return null;return(await qa('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');await qa('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),S=t(r[10]),h=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),K=t(r[27]),P=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),L=t(r[32]),B=t(r[33]),j=t(r[34]),F=t(r[35]),$=t(r[36]),W=t(r[37]),H=t(r[38]),Q=t(r[39]),V=t(r[40]),G=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),Se=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(a){if('default'!==a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,t})(_e),he=t(r[64]),ye=t(r[65]),we=t(r[66]),ve=t(r[67]),be=t(r[68]),ke=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]);const De=()=>(0,N.getSupabase)();$.mutationQueue.setExecutor(B.executeMutation),(0,x.setClockServer)(()=>'staff'===Ue.getState().kind);const Ue=(0,T.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ee=e=>Ue.setState(e),Te=e=>{const t=Ue.getState().perms;return t.includes('*')||t.includes(e)},Ne=()=>{const e=Ue.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ue.subscribe(()=>(0,Re.setLiveData)(Ne()));let Ke=Z.IS_CAR?'car':Z.APP_VARIANT,Pe=!1;const Me=()=>{Pe||((0,L.setSyncNamespace)(Ke),Pe=!0)};let xe=[],qe=[],Le=!1;const Be=()=>(new Date).toISOString().slice(0,10),je=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),Fe=e=>e?e.slice(0,5):'',$e=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],We=e=>JSON.parse(JSON.stringify(e));function He(e,t){const a=je(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write')),filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=We(e);if(t)return{id:e.id,venue_id:a,walk_date:e.date,arrived_at:e.seatedAt??e.createdAt,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:$e(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,ue.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:$e(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Qe(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>'guest'!==Ue.getState().kind,filter:e=>e.gte('created_at',t),inWindow:e=>e.createdAt>=t,toRow:(e,t)=>({id:e.id,venue_id:t,ref:e.ref,customer_id:(0,ue.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:We(e.lines??[]),allergies:$e(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:We(e.allergyChain??{}),readiness:We(e.readiness??{}),allergy_ticks:We(e.allergyTicks??{}),handover_check:e.handoverCheck?We(e.handoverCheck):null,accepted:e.accepted?We(e.accepted):null,doc:We(e)}),fromRow:t=>t.doc&&'object'==typeof t.doc?{...t.doc,id:String(t.id),restaurantId:e,status:t.status??t.doc.status}:null,apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Ve(e){const t=je(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...X.useBlocks.getState().blocks,...X.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==Ue.getState().kind,filter:e=>e.gte('block_date',t),inWindow:e=>e.date>=t,toRow:(e,t)=>({id:e.id,venue_id:t,block_date:e.date,from_time:e.from,to_time:e.to,reason:e.reason??null,note:e.note??null,area_id:e.areaId??null,area_name:e.areaName??null,created_by:e.by,created_at:e.createdAt,doc:We(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,X.blockClock)(t.from_time)??a?.from,n=(0,X.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>X.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>X.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ge=null,Je='Main plan';function ze(e){const t=e=>We({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ee.useFloor.getState().plans[e]??(0,ee.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Te('floor.manage')||Te('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ge??(0,Oe.uuidFrom)(`plan:${a}`),venue_id:a,name:Je||'Main plan',is_active:!0,...t(e),updated_by:(0,Y.actorStamp)({isCar:Z.IS_CAR,kind:Ue.getState().kind,staffRef:Ue.getState().staffRef,fallback:Ke})}),fromRow:e=>(Ge=String(e.id),Je=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,Ae.withSeedBest)(e,t[0]):void 0;a&&ee.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ee.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Ze(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>te.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Te('stock.manage'),matchKey:e=>({key:e}),toRow:(e,t)=>({venue_id:t,key:e.key,name:e.name,plural:e.plural,unit:e.unit,low_at:e.lowAt,supplier_id:e.supplierId?(0,ue.isUuid)(e.supplierId)?e.supplierId:(0,Oe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),fromRow:e=>{return{key:e.key,name:e.name,plural:e.plural,unit:e.unit,lowAt:Number(e.low_at),icon:e.icon??'\u2022',sort:e.sort??0,active:!1!==e.active,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),lt.get(t)??t)}:{}};var t},apply:(t,a)=>te.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.get(e.key)??e),o=new Set(r.map(e=>e.key));return{items:{...s.items,[e]:[...r,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>te.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Ye=new Set,Xe=new Set;$.mutationQueue.onDone(e=>{'stock_events'===e.table&&Xe.add(e.rowKey)});const et=e=>Xe.has(e)||Ye.has(e),tt=()=>Te('*')||Te('staff.manage')||Te('recipes.edit')||Te('recipes.signoff'),at=()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write'));function st(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>te.useShellStore.getState().events.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,ue.isUuid)(t.id)&&!!(te.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write')),filter:e=>e.gte('at',t).order('at',{ascending:!1}),inWindow:e=>e.at>=t,toRow:(e,t)=>({id:e.id,venue_id:t,item:e.kind,delta:e.delta,reason:e.reason,undoes:e.undoes&&(0,ue.isUuid)(e.undoes)&&(et(e.undoes)||$.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Ye.add(String(t.id)),{id:String(t.id),rid:e,kind:t.item,delta:Number(t.delta),reason:t.reason,by:t.by_name??'',app:t.app??'',at:new Date(t.at).toISOString(),...t.undoes?{undoes:String(t.undoes)}:{}}),apply:(e,t)=>te.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>te.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function nt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(te.useShellStore.getState().server[e]?.counts??{}).map(([e,t])=>({item:e,quantity:t})),key:e=>e.item,rowKey:e=>String(e.item),syncable:()=>!1,writable:()=>!1,toRow:()=>({}),fromRow:e=>({item:String(e.item),quantity:Number(e.quantity)}),apply:(a,s)=>{t={...te.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;te.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Ye]}}}))},afterRead:()=>{te.useShellStore.getState().server[e]||te.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Ye]}}}))},subscribe:()=>()=>{}}}const it=new Set;function rt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ae.useCardStore.getState().cards.filter(t=>t.restaurantId===e).map(e=>({card:e,item:t.find(t=>t.id===e.menuItemId)}))},key:e=>e.card.id,rowKey:e=>String(e.id),syncable:t=>(0,ue.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Te('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Oe.photoPath)(a,s),t=ot(s.photo);t&&((0,ae.cachePhotoAs)(e,t),dt(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Oe.cardToRow)(s,a);return{...i,...r,doc:We({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(a.card))return null;const s=t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:new Date(t.signed_off_at).toISOString()}:null;return{card:{...a.card,id:String(t.id),restaurantId:e,signOff:s&&a.card.signOff?a.card.signOff:s,...t.photo_url?{photo:t.photo_url}:{}},item:a.item?{...a.item,restaurantId:e,signOff:(0,w.isAnchorage)(e)&&(0,w.demoActor)(a.item.signOff?.by)?null:a.item.signOff}:void 0}},supersededBy:(e,t)=>t.some(t=>t.card.menuItemId===e.card.menuItemId&&t.card.id!==e.card.id),apply:(e,t)=>{if(!Te('recipes.edit')&&t.length){const e=new Set(t);ae.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ae.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),r=t.cards.filter(e=>!a.has(e.id)&&(s.has(e.id)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=ae.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ot=e=>(0,ae.readLocalPhoto)(e);async function dt(e,t){if(!it.has(e)){it.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await De().storage.from(Oe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){it.delete(e),Ee({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const ut=new Map,ct=(0,T.create)(()=>({n:0}));(0,ae.setStoragePhotoResolver)(e=>{const t=ut.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ue.getState().mode?(t||(ut.set(e,{url:'',at:Date.now()}),De().storage.from(Oe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(ut.set(e,{url:t.signedUrl,at:Date.now()}),ct.setState(e=>({n:e.n+1})),ae.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const lt=new Map;const ft=(e,t)=>{const a=(0,ue.isUuid)(t)?t:(0,Oe.uuidFrom)(`sup:${e}:${t}`);return lt.set(a,t),a};function pt(e){return{name:'order_sheets',table:'suppliers',list:()=>se.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Te('suppliers.manage'),toRow:(e,t)=>({id:ft(t,e.id),venue_id:t,name:e.name||'Supplier',category:e.goods||null,contact:e.contact??null,phones:e.number?[e.number]:[],website:e.url||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,notes:e.notes||null,doc:{kind:'sheet',localId:e.id,sheet:We(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(lt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>se.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.get(e.id)??e),o=new Set(r.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...r,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>se.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,ue.isUuid)(e)?e:(0,Oe.uuidFrom)(`sup:${Ue.getState().venueId}:${e}`)})}}let gt=!1,mt=!1;const _t=new Map,St=new Map,ht=new Map,yt=new Map,wt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',vt=e=>'owner'===e?{role:'owner',level:'Owner'}:'manager'===e?{role:'manager',level:'Manager'}:'supervisor'===e?{role:'manager',level:'Supervisor'}:'head_chef'===e?{role:'staff',level:'Head Chef'}:{role:'staff',level:'Staff'},bt=(e,t)=>({...e,managerAccess:t}),kt=()=>({nickname:gt,display:mt}),It=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=bt({role:e.role,level:e.level??vt(wt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},kt())};const Rt=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ot=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},At=e=>{const t=de.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,c.isKitchenTeam)(t)},Ct=2e3;function Dt(e,t){return t||!e.length||e.length>=Ct?null:e=>(0,ue.isUuid)(e.id)}function Ut(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Dt(t,Te('rota.manage')):null,keepOnEmpty:()=>e&&!Te('rota.manage'),list:()=>de.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&_t.has(e.staffId)&&(Te('rota.manage')||At(e.staffId)),writable:()=>Te('rota.manage')||Te('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(Rt());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ot(e.start),end_time:Ot(e.end),published:!!e.published,doc:We(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Et(){const e=je(62),t=e=>Te('rota.manage')||e.staffId===Ue.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>de.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ue.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=je(2)&&e.staffId===Ue.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:We(e.breaks??[]),break_mins:e.breakMins??0,doc:We((0,v.privateAttendance)(u.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(u.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Tt(){const e=je(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>de.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&e.staffId===Ue.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ue.getState().kind,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,ue.isUuid)(e.attendanceId)?e.attendanceId:null,kind:e.kind,suggested_in:e.suggestedIn??null,suggested_out:e.suggestedOut??null,note:(e.note??'').slice(0,300)||null,status:'open',doc:We({...e,status:'open'})}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),date:String(e.work_date).slice(0,10),attendanceId:e.attendance_id?String(e.attendance_id):t.attendanceId,kind:e.kind,suggestedIn:e.suggested_in?new Date(e.suggested_in).toISOString():void 0,suggestedOut:e.suggested_out?new Date(e.suggested_out).toISOString():void 0,note:e.note??'',at:t.at??new Date(e.created_at).toISOString(),status:e.status,resolvedBy:e.resolved_by_name??void 0,resolvedAt:e.resolved_at?new Date(e.resolved_at).toISOString():void 0}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Nt(e){de.leaveRemote.decide=t=>!(!Te('rota.manage')||!(0,ue.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&($.mutationQueue.enqueue({table:'staff_leave',venueId:e,kind:'rpc',fn:'staff_leave_decide',rowKey:t.id,values:{p_id:t.id,p_status:t.status}}),!0),qe.push(()=>{de.leaveRemote.decide=null})}function Kt(e){de.timesheetRemote.send=(t,a)=>{if(!Te('rota.manage')||!(0,ue.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return $.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:We(s)}}),!0}const s=a;if('attendance_void'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&($.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:We(s.breaks??[]),p_reason:n,p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0},qe.push(()=>{de.timesheetRemote.send=null})}function Pt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('created_at',new Date(Date.now()-2592e6).toISOString()),inWindow:()=>!1,toRow:(e,t)=>{return{id:(a=e.id,(0,ue.isUuid)(a)?a:(0,Oe.uuidFrom)(`outbox:${a}`)),local_id:e.id,venue_id:t,channel:e.channel,kind:e.kind,to_address:e.to||'',to_name:e.toName||null,subject:e.subject??null,body:e.body,html:e.html??null,ref_type:e.refType,ref_id:(0,ue.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:We(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.useStore.setState(t=>{const a=new Set(t.outbox.map(e=>e.id));return{outbox:[...e.filter(e=>!a.has(e.id)),...t.outbox].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,300)}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const Mt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function xt(e,t){if(!Array.isArray(t))return;const a=t.filter(e=>e&&'string'==typeof e.id&&'string'==typeof e.date&&'string'==typeof e.title).map(t=>({...t,restaurantId:e,example:!1}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function qt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[We({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ee.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:Mt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Te('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...Bt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...Bt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...Bt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Lt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Lt=t.feature_flags??{},Bt=t.settings??{};const a=t.settings?.app?.restaurant;if(!a)return null;const s='string'==typeof t.settings?.whatsapp?t.settings.whatsapp:void 0;return s&&!a.settings?.whatsapp&&(a.settings={...a.settings,whatsapp:s}),We({restaurant:{...a,id:e},msgTemplates:t.settings?.ops?.msgTemplates??{},display:t.settings?.ops?.display??{},games:!1!==t.feature_flags?.games,...Array.isArray(t.settings?.app?.events)?{events:t.settings.app.events}:{}})},apply:t=>{const a=t[0];a&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,p.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&ee.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&xt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ee.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Lt=null,Bt=null;const jt=()=>new Date(Date.now()-2592e6).toISOString(),Ft=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>_t.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},$t=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,ve.dmId)(t[0],t[1]):null},Wt=()=>Ue.getState().perms.includes('*');function Ht(){const e=()=>Ue.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>de.useOwner.getState().chat.filter(e=>(0,ue.isUuid)(e.id)).map(e=>We({id:e.id,ch:e.ch,from:e.from,text:e.text,photo:e.photo,at:e.at,removed:!!e.removed})),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>!!Ft(t.ch)&&(t.from===e()||Wt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('created_at',jt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=jt(),toRow:(e,t)=>{const a=Ft(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:_t.get(e.from)??null;return{id:e.id,venue_id:t,channel:a,from_staff:s,body:e.text??null,photo:e.photo??null,removed:e.removed,created_at:e.at}},fromRow:e=>{const t=$t(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?We({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>de.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=$t(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=de.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,ve.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,be.soundAllowed)())try{(0,be.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Qt(e,t,a){const s=Ue.getState();if(!we.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=_t.get(e),i='*'===t?'*':Ft(t);if(n&&i)try{await De().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Vt(e){const t=Ue.getState().staffRef,a=t?_t.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await De().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':$t(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&de.useOwner.getState().chatMarkRead(t,i)}catch{}}function Gt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=U.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:We(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:We(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'break_rules'===e.kind?'break_rules':'reminder',doc:e.doc??{}}),apply:(t,a)=>U.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[e];const o=new Map(t.filter(e=>'reminder'===e.kind).map(t=>[t.id,{...t.doc,id:t.id,rid:e}])),d=s.reminders.filter(e=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>U.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function Jt(e){const t=je(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>U.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.reminderId)&&e.staffRef===Ue.getState().staffRef,writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('for_date',t).order('done_at',{ascending:!1}),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,reminder_id:e.reminderId,for_date:e.forDate,staff_ref:e.staffRef,staff_name:e.staffName.slice(0,80),done_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,reminderId:String(t.reminder_id),forDate:String(t.for_date).slice(0,10),staffRef:t.staff_ref??'',staffName:t.staff_name??'Team',at:new Date(t.done_at).toISOString()}),apply:(e,t)=>U.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>U.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function zt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Zt=e=>null==e||''===e?null:Number(e),Yt=e=>e.filter(e=>!e.startsWith('data:')),Xt=()=>Te('takings.view');function ea(e){const t=!Xt();return{name:'cash_ups',table:'cash_ups',list:()=>le.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,k.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,k.tradingDay)()&&!e.onServer),writable:()=>Te('wages.manage')||(0,b.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,k.tradingDay)()):e.gte('for_date',je(400)),...t?{inWindow:e=>e.date===(0,k.tradingDay)()}:{},toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:We(e.vals),cash_tips:'number'==typeof e.vals.cashTips?e.vals.cashTips:null,card_tips:'number'==typeof e.vals.cardTips?e.vals.cardTips:null,photos:Yt(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,date:String(t.for_date),vals:t.vals??{},photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>le.useCashUp.setState(s=>({cashUps:zt(s.cashUps,t.map(e=>{const t=s.cashUps.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function ta(e){return{name:'sales_reports',table:'sales_reports',list:()=>le.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Te('wages.manage')||(0,b.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:We(e.vals),categories:e.categories,photos:Yt(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,weekStart:String(t.week_start),vals:t.vals??{},categories:t.categories??[],photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>le.useCashUp.setState(s=>({sales:zt(s.sales,t.map(e=>{const t=s.sales.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function aa(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=le.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,le.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Te('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:We({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,le.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>le.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function sa(e){return{name:'day_tips',table:'day_tips',list:()=>le.useCashUp.getState().tips.filter(t=>t.rid===e).map(e=>({...e,id:e.date})),key:e=>e.id,rowKey:e=>String(e.for_date),syncable:()=>!1,writable:()=>!1,deletes:!1,filter:e=>e.gte('for_date',je(120)),toRow:()=>({}),fromRow:t=>({id:String(t.for_date),rid:e,date:String(t.for_date),total:Number(t.total),postedAt:String(t.posted_at),postedBy:t.posted_by??void 0}),apply:t=>le.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function na(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>le.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('wages.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,for_date:e.forDate??null,through_date:e.throughDate??null,amount:e.amount,reason:e.reason??null,by_name:e.by,at:e.at}),fromRow:t=>({id:String(t.id),rid:e,kind:'payout'===t.kind?'payout':'correction',forDate:t.for_date??void 0,throughDate:t.through_date??void 0,amount:Zt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>le.useCashUp.setState(s=>({pot:zt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function ia(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=le.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Te('wages.manage'),toRow:(e,t)=>({venue_id:t,show_today:e.showToday,show_pot:e.showPot,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'show',showToday:!1!==e.show_today,showPot:!1!==e.show_pot}),apply:t=>le.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function ra(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>ce.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:We(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ce.useNotifs.setState(s=>({items:zt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ce.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function oa(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=fe.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:We(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:We(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings')||Te('suppliers.order'),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'settings'===e.kind?'settings':'list',doc:e.doc??{}}),apply:(t,a)=>fe.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...pe.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:zt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function da(e){const t=()=>Te('venue.settings')||Te('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>fe.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,ue.isUuid)(a.id)&&(0,ue.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,fe.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ue.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:Ue.getState().staffRef)||null,doc:We(n),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),listId:String(t.list_id),status:t.status??'open',rid:e}),apply:(t,a)=>fe.useOrderLists.setState(s=>({items:zt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){const t=je(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>fe.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings')||Te('suppliers.order'),filter:e=>e.gte('finished_at',t).order('finished_at',{ascending:!1}).limit(300),toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,list_id:e.listId,finished_at:e.finishedAt,finished_by:e.finishedByName.slice(0,80),doc:We(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useOrderLists.setState(s=>({history:zt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function ca(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=ge.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:We(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Te('venue.settings'),toRow:(e,t)=>({venue_id:t,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'area',doc:e.doc??{}}),apply:t=>{const a=t[0];a&&ge.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>ge.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function la(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=he.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,he.libraryRowId)(e),kind:'library',doc:We({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,he.personRowId)(e,i),kind:'person',staffRef:i,doc:We({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=de.useOwner.getState().staff.find(e=>e.id===Ue.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=de.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ye.canEditTasks)(t,a)},writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,staff_ref:e.staffRef??null,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'library'===e.kind?'library':'person',staffRef:e.staff_ref??void 0,doc:e.doc??{}}),apply:t=>he.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,he.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>he.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function fa(e){const t=je(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>he.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ue.getState();return e.byRef===t.staffRef||Te('staff.manage')},writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('for_date',t),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffRef,task_id:e.taskId,for_date:e.forDate,ticked_by_ref:e.byRef,ticked_by_name:e.byName.slice(0,80),ticked_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,staffRef:String(t.staff_ref),taskId:String(t.task_id),forDate:String(t.for_date).slice(0,10),byRef:String(t.ticked_by_ref??''),byName:String(t.ticked_by_name??''),at:String(t.ticked_at)}),apply:(t,a)=>he.useDailyTasks.setState(s=>({ticks:zt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>he.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function pa(e,t=!1){const a=je(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ke.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ue.getState().kind||Te('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Oe.uuidFrom)(`soldout:${a}:${e.itemId}`),venue_id:a,item_id:e.itemId.slice(0,80),name:e.name.slice(0,120),is_on:e.on,marked_at:e.at,by_name:(e.by||'Staff').slice(0,80),clear_after:e.clearAfter??null,...t?{auto:!!e.auto,kept:!!e.kept}:{}}),fromRow:a=>({rid:e,itemId:String(a.item_id),name:String(a.name??''),on:!0===a.is_on,at:String(a.marked_at),by:String(a.by_name??''),clearAfter:a.clear_after?String(a.clear_after):void 0,...t?{auto:!0===a.auto,kept:!0===a.kept}:{}}),apply:(t,a)=>ke.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ke.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Ie.autoSync.soldOutRead.add(e)}}}function ga(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Ie.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:(0,Oe.uuidFrom)(`soldoutlink:${t}:${e.itemId}`),venue_id:t,item_id:e.itemId.slice(0,80),uses:e.uses.slice(0,10).map(e=>({key:String(e.key).slice(0,40),qty:Math.max(0,Math.min(99,Number(e.qty)||0))})),auto:!!e.auto,updated_at:e.at,updated_by:(e.by||'Staff').slice(0,80)}),fromRow:t=>({rid:e,itemId:String(t.item_id),uses:(Array.isArray(t.uses)?t.uses:[]).map(e=>({key:String(e.key??''),qty:Number(e.qty)||0})).filter(e=>e.key&&e.qty>0),at:String(t.updated_at??''),by:String(t.updated_by??''),...!0===t.auto?{auto:!0}:{}}),apply:(t,a)=>Ie.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>Ie.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Ie.autoSync.linksRead.add(e)}}}async function ma(e,t="*"){const a='*'===t?`table:${e}`:`table:${e}.${t}`;try{const s=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:n}=await Promise.race([De().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function _a(){const e=Ue.getState().venueId;if(e)try{const{data:t}=await De().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();ya.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const ha=new Map;const ya=(0,T.create)(()=>({live:!1,known:!1}));async function wa(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([De().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function va(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([De().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const ba=(e,t)=>We({id:String(e.id),venue:t,body:String(e.body??''),kind:'yesno'===e.kind?'yesno':'up',up:Number(e.up_count??0),yes:Number(e.yes_count??0),no:Number(e.no_count??0),hidden:!!e.hidden,reply:e.reply??void 0,replyAt:e.reply_at??void 0,postedOn:String(e.posted_on??'').slice(0,10)}),ka='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Ia(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>D.useHr.getState().questions.filter(t=>t.venue===e&&(0,ue.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>ba(t,e),filter:e=>e.gte('posted_on',new Date(Date.now()-10368e6).toISOString().slice(0,10)),apply:(e,t)=>{const a=new Set(t);D.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>D.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Ra(e,t){const a=(t,a,s)=>{$.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(D.hrRemote,{live:!0,checkout:t=>a('hr_checkout',t.token,{p_venue:e,p_day:t.day,p_token:t.token,p_morale:t.morale,p_staffing:t.staffing,p_question:t.question??null,p_kind:t.kind??'up',p_shout_to:t.shoutTo??null,p_shout_body:t.shoutBody??null}),post:(t,s,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),vote:(e,t,s)=>a('hr_vote',e,{p_question:e,p_token:t,p_vote:s}),moderate:(e,t,s)=>a('hr_moderate',e,{p_question:e,p_action:t,p_reason:s}),reply:(e,t)=>a('hr_reply',e,{p_question:e,p_reply:t}),trend:async(t,a,s)=>{try{const{data:t,error:n}=await De().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?null:(t??[]).map(e=>({day:String(e.day).slice(0,10),answers:Number(e.answers),morale:Number(e.morale),staffing:null==e.staffing?null:Number(e.staffing),short:Number(e.short),perfect:Number(e.perfect),over:Number(e.over)}))}catch{return null}},shouts:async(a,s)=>{try{const{data:a,error:n}=await De().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?null:(a??[]).map(e=>({id:String(e.id),venue:t,day:String(e.day).slice(0,10),to:String(e.to_name),body:e.body??void 0}))}catch{return null}},log:async()=>{try{const{data:a,error:s}=await De().from('hr_mod_log').select('id,question_id,action,reason,by_name,at').eq('venue_id',e).order('at',{ascending:!1}).limit(30);return s?null:(a??[]).map(e=>({id:String(e.id),venue:t,questionId:String(e.question_id??''),action:e.action,reason:e.reason??void 0,by:String(e.by_name??'A manager'),at:String(e.at)}))}catch{return null}},refresh:async()=>{try{const{data:a,error:s}=await De().from('hr_questions').select(ka).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||D.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>ba(e,t)))}catch{}}}),qe.push(()=>{Object.assign(D.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Oa='pair:v1',Aa='staff:v1',Ca='staff:rejoin:v1';async function Da(e){const t=u.IS_QUEUED_VENUE?'claim_'+u.VENUE_RID+'_invite':u.IS_GREENSIDE?'claim_greenside_invite':u.IS_ABBOTSFORD?'claim_abbotsford_invite':u.IS_KIRKTON?'claim_kirkton_invite':u.IS_WILDINGS?'claim_wildings_invite':u.IS_KIRKMICHAEL?'claim_kirkmichael_invite':u.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:Ke,p_device:(0,C.deviceId)()},s=await De().rpc(t,{...a,p_phone:(0,C.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?De().rpc(t,a):s}async function Ua(){if('display'===Ke||'customer'===Ke||me.PITCH)return'none';const e=await L.kv.get(Ca,null);if(!e)return'none';try{await Ta();const{data:t,error:a}=await Da(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ca),await L.kv.remove(Aa),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Aa,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await L.kv.remove(Ca),'refused')}catch{return'offline'}}const Ea=e=>/jwt|refresh|token|401|not authenticated|invalid claim|session/i.test(String(e?.message??e))&&!/fetch|network/i.test(String(e?.message??e));async function Ta(){Me();const{data:e}=await De().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await De().auth.signInAnonymously();if(!t)return;const a=429===t.status||/rate|too many/i.test(t.message);if(!a||e>=2){if(a)throw new Error('Too many people are connecting from this network right now. Wait a few minutes, or switch to mobile data, and open the link again.');throw t}Ee({message:'Lots of people are connecting at once. Trying again in a moment\u2026'}),await new Promise(t=>setTimeout(t,0===e?15e3:45e3))}}async function Na(e){if(me.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await Da(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,u.venueKey)(`cc-pending-invite:${Ke}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),await L.kv.set(Ca,e),Le&&ja(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ee({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ka='car:request:v1',Pa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function Ma(){await L.kv.remove(Oa),await L.kv.remove(Aa),await L.kv.remove(Ka),C.useSession.getState().meId&&C.useSession.getState().signOut()}async function xa(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Ta(),!0}catch{return!1}}const qa=async(e,t={})=>{if(me.PITCH)return(0,_e.pitchRpc)(e,t);const{data:a,error:s}=await De().rpc(e,t);if(s)throw s;return a};let La=null;async function Ba(){for(const e of qe)try{e()}catch{}qe=[],xe.forEach(e=>e.stop()),xe=[],La&&(clearInterval(La),La=null)}async function ja(){await Ba(),await Wa()}async function Fa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Ke||me.PITCH)return!1;try{Me();const{data:e}=await De().auth.getSession();if(e.session){const{error:e}=await De().auth.refreshSession();if(!e)return!0}if('display'===Ke)return!1;if(!await L.kv.get(Ca,null))return!1;if(e.session)try{await De().auth.signOut({scope:'local'})}catch{}return'ok'===await Ua()&&(ja(),!0)}catch{return!1}}(0,l.setSessionMender)(Fa);let $a=u.VENUE_RID;async function Wa(){try{const e='undefined'!=typeof navigator?navigator.storage:null;e?.persist&&e.persist()}catch{}try{const e='undefined'!=typeof window?window.CoverChargeNative:null;e&&'function'==typeof e.checkUpdate&&/CoverChargePhone\//.test(navigator.userAgent)&&e.checkUpdate()}catch{}const e=$a;try{if(Ee({mode:'connecting'}),await $.mutationQueue.load(),'customer'===Ke)return void await za(e);let t=await L.kv.get(Oa,null),a=await L.kv.get(Aa,null);if(Z.IS_CAR&&!t&&a){const e=(0,Y.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Oa,t)),await L.kv.remove(Aa),a=null,C.useSession.getState().meId&&C.useSession.getState().signOut()}if(u.IS_ISOLATED_VENUE&&(t&&!(0,u.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,u.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ee({mode:'display'===Ke?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await De().auth.getSession();if('display'!==Ke&&!Z.IS_CAR&&a&&!s.session){const t=await Ua();if('offline'===t)return Ee({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{$a===e&&ja()},6e4);'refused'===t&&a.staffRef&&C.useSession.getState().meId===a.staffRef&&C.useSession.getState().signOut(),a=await L.kv.get(Aa,null),({data:s}=await De().auth.getSession())}const n='display'===Ke||Z.IS_CAR?t:a;if(!s.session||!n)return void Ee({mode:'display'===Ke||Z.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await qa('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Ke||Z.IS_CAR?await L.kv.remove(Oa):(await L.kv.remove(Aa),await L.kv.remove(Ca)),'staff'===n.kind&&n.staffRef&&C.useSession.getState().meId===n.staffRef&&C.useSession.getState().signOut(),void Ee({mode:'display'===Ke||Z.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Ke?'This display was unpaired by a manager.':Z.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,P.isOnline)()||/fetch|network/i.test(String(t?.message)))Ee({mode:'offline'});else if(Ea(t)&&'display'!==Ke){const{error:t}=await De().auth.refreshSession();t&&'ok'===await Ua()&&setTimeout(()=>{$a===e&&ja()},500)}i=Ue.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ee({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Z.IS_CAR&&'staff'===n.kind&&n.staffRef&&C.useSession.getState().meId!==n.staffRef&&(C.useSession.getState().signIn(n.staffRef),de.useOwner.setState({staffAs:n.staffRef})),Z.IS_CAR&&(C.useSession.getState().meId&&C.useSession.getState().signOut(),de.useOwner.setState({previewRole:'owner'})),await Qa(n.venueId,e,n.kind)}catch(e){Ee({mode:'local',lastError:String(e?.message??e)})}}const Ha=new Set(['venues','staff','bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_items','stock_events','stock_counts','recipe_cards','suppliers','supplier_orders','rota_shifts','attendance','time_requests','game_scores','floor_live','chat_messages','venue_reminders','reminder_done']);async function Qa(e,a,s){if(!(0,u.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Z.IS_CAR&&'device'===s;await ks(a),qe.push(xs(e));try{const{data:t}=await De().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])ht.set(e.key,e.id),yt.set(e.id,e.key)}catch{}const i=[qt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>de.useOwner.getState().staff.map(It),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Te('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,kt()),toRow:(e,t)=>(0,F.staffRow)(e,t,kt(),e.managerAccess||e.ownerAccess?null:ht.get(wt(e))),fromRow:e=>{if(!e.external_ref)return null;_t.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ns.set(String(e.external_ref),e.avatar_path??null);const t=bt(vt(yt.get(String(e.role_id))),!0===e.manager_access);return(0,F.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},kt())},apply:e=>de.useOwner.setState(t=>{const a=new Map(e.map(e=>[e.id,e])),s=t.staff.map(e=>a.has(e.id)?{...e,...a.get(e.id)}:e),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ms()},onRemote:()=>{Ms()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=de.useOwner.getState(),t=ie.useSetup.getState().sites[$a]?.staffGrade??{};return e.staff.filter(e=>_t.has(e.id)).map(a=>We({id:a.id,hourly:e.hourly[a.id]??null,salaried:!!a.salaried,noTax:!!a.noTax,grade:t[a.id]||void 0}))},key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>_t.has(e.id),writable:()=>Te('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:_t.get(e.id),venue_id:t,hourly_rate:null==e.hourly?null:e.hourly/100,salaried:e.salaried,no_tax:e.noTax,pay_grade:e.grade??null}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?We({id:t,hourly:null==e.hourly_rate?null:Math.round(100*Number(e.hourly_rate)),salaried:!!e.salaried,noTax:!!e.no_tax,grade:e.pay_grade||void 0}):null},apply:e=>de.useOwner.setState(t=>{const a={...t.hourly},s=new Map(e.map(e=>[e.id,e]));for(const t of e)null==t.hourly?delete a[t.id]:a[t.id]=t.hourly;if(e.length){const t=ie.useSetup.getState().sites[$a],a={...t?.staffGrade??{}};let s=!1;for(const t of e)(a[t.id]||void 0)!==t.grade&&(s=!0,t.grade?a[t.id]=t.grade:delete a[t.id]);s&&ie.useSetup.getState().patch($a,{staffGrade:a})}return{hourly:a,staff:t.staff.map(e=>s.has(e.id)?{...e,salaried:s.get(e.id).salaried,noTax:s.get(e.id).noTax}:e)}}),subscribe:e=>{const t=de.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=ie.useSetup.subscribe((t,a)=>{t.sites[$a]?.staffGrade!==a.sites[$a]?.staffGrade&&e()});return()=>{t(),a()}}},He(a,!1),He(a,!0),Ve(a),ze(a),Qe(a),Ze(a),st(a),nt(a),pt(a),{name:'supplier_directory',table:'suppliers',list:()=>de.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,name:e.name||'Supplier',category:e.category,contact:e.contact||null,phones:e.phones.filter(Boolean),email:e.email||null,website:e.website||null,account_ref:e.account||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,doc:{kind:'directory',localId:e.id,supplier:We(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>de.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.supplierId),writable:()=>Te('suppliers.order')||Te('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Be(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:We(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},rt(a),Us(a)];Te('wages.view')&&i.push(Es(a)),n&&(i.push(Ut(!0),Et(),Tt(),Pt(a)),Kt(e)),n&&await ma('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>de.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&/^\d{4}-\d{2}-\d{2}$/.test(e.from)&&/^\d{4}-\d{2}-\d{2}$/.test(e.to)&&e.to>=e.from&&(e.staffId===Ue.getState().staffRef&&'pending'===e.status||Te('rota.manage')),writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffId,from_date:e.from,to_date:e.to,reason:(e.reason??'').slice(0,200)||null,status:e.status,doc:We(e)}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),from:String(e.from_date).slice(0,10),to:String(e.to_date).slice(0,10),reason:e.reason??t.reason??'Holiday',status:e.status,by:e.requested_by_name??t.by,decidedBy:e.decided_by_name??void 0}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{leave:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ha.add('staff_leave'),Nt(e));const o=n&&await va();if(we.useChatSync.setState({synced:o,checked:!0}),qe.push(()=>we.useChatSync.setState({synced:!1})),o&&i.push(Ht(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(ve.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>_t.has(e.id),writable:()=>Te('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:_t.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:_t.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>ve.useKitchenExtra.setState(a=>{const s={...a.extra};return t.forEach(e=>{delete s[e]}),e.forEach(e=>{s[e.id]=e.include}),{extra:s}}),subscribe:e=>ve.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ma('hr_questions')&&(i.push(Ia(a)),Ha.add('hr_questions'),Ra(e,a)),'guest'!==s&&'customer'!==Ke&&await ma('temp_readings')&&(i.push((0,Q.tempUnitsSpec)(oe.useSafety,tt),(0,Q.tempReadingsSpec)(oe.useSafety,at)),Ha.add('temp_units'),Ha.add('temp_readings')),'guest'!==s&&'customer'!==Ke&&await ma('cooksafe_records')&&(i.push((0,V.cooksafeSpec)(oe.useSafety,G.useCookSafe,oe.isSeedAccident,at)),Ha.add('cooksafe_records')),'guest'!==s&&await ma('sold_out_items')?(i.push(pa(a,await ma('sold_out_items','auto'))),Ha.add('sold_out_items')):Ie.autoSync.soldOutRead.add(a),'guest'!==s&&await ma('sold_out_links')?(i.push(ga(a)),Ha.add('sold_out_links')):Ie.autoSync.linksRead.add(a),U.useReminders.getState().ensure(a),'guest'!==s&&await wa()&&(i.push(Gt(a)),n&&i.push(Jt(a))),ce.useNotifs.getState().ensure(a),fe.useOrderLists.getState().ensure(a),n){gt=await ma('staff','nickname'),mt=await ma('staff','display_clock');const[e,t,s,n]=await Promise.all([ma('scheduled_notifications'),ma('order_lists'),ma('venue_clock_area'),ma('daily_tasks')]);he.useDailyTasks.getState().ensure(a),n&&(i.push(la(a),fa(a)),Ha.add('daily_tasks'),Ha.add('daily_task_ticks')),e&&(i.push(ra(a)),_a()),t&&i.push(oa(a),da(a),ua(a)),s&&i.push(ca(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&Ha.add(n)}if('guest'!==s&&await ma('day_tips')){i.push(sa(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ha.add(e);await ma('tips_pot_events')&&i.push(na(a),ia(a)),n&&(Xt()||(0,le.forgetPastTakings)(a,(0,k.tradingDay)()),i.push(ea(a),aa(a)),Ha.add('cash_ups'),Xt()&&(i.push(ta(a)),Ha.add('sales_reports')),t(r[76])(r[75],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Ut(),Et()),await ma('scheduled_notifications')&&i.push(ra(a)));let d=!1;const c=()=>{if(Z.IS_CAR&&n&&Te('recipes.edit'))return!0;const e=de.useOwner.getState().staff.find(e=>e.id===Ue.getState().staffRef);return!!e&&e.active&&Te('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&c()&&await ma('ingredient_prices')&&(i.push((0,S.gpSyncSpec)('ing',c)),Ha.add('ingredient_prices'),await ma('card_costs')&&(i.push((0,S.gpSyncSpec)('card',c)),Ha.add('card_costs')),await ma('kitchen_deliveries')&&(i.push((0,S.gpSyncSpec)('del',c)),Ha.add('kitchen_deliveries')),await ma('kitchen_stock_counts')&&(i.push((0,S.gpSyncSpec)('count',c)),Ha.add('kitchen_stock_counts'))),(0,Ce.specialsSyncOn)()&&'guest'!==s&&await ma('specials_boards')&&(i.push((0,Ce.specialsBoardSpec)(a,()=>Te('recipes.edit')||Te('floor.manage')||Te('*'))),Ha.add('specials_boards'));const l={onActivity:()=>Ee({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ee({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ee({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await qa('whoami')??[]).some(t=>t.venue_id===e))return void($a===a&&ja());for(const a of xe){if(a.spec.name!==t)continue;const{count:s,error:n}=await De().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ds()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||H.useTempSaves.getState().mark({id:t,table:e,why:Ss(e)??'this screen could not send it'})}};xe=i.map(t=>new J.EntityBridge(t,e,l)),await Promise.all(xe.map(e=>e.start()));let f=0;const p=async()=>{if(!(f&&Date.now()-f<6e4)){f=Date.now();try{await g()}finally{f=0}}},g=async()=>{if(n&&(0,P.isOnline)())try{const t=await qa('whoami');if(!t?.some(t=>t.venue_id===e))return void($a===a&&ja())}catch(e){if(Ea(e)){if(Z.IS_CAR)return void($a===a&&ja());const e=await Ua();return void('ok'!==e&&'refused'!==e||$a===a&&ja())}}let t=0;for(const[a,s]of xe.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(we.useChatSync.getState().error&&we.useChatSync.setState({error:void 0}),await Vt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&we.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,P.setOnline)(!0),Ee({mode:'live',lastSyncAt:e,lastServerAt:e}),$.mutationQueue.flush()}else Ee({mode:'offline'});if(!Te('wages.view')){const e=Ue.getState().staffRef;de.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([p(),new Promise(e=>setTimeout(e,3e4))]);const m=new Map;for(const e of xe)m.set(e.spec.table,[...m.get(e.spec.table)??[],e]);const _=[...m.keys()].filter(e=>Ha.has(e)).map(e=>({table:e,venueColumn:m.get(e)[0].spec.venueColumn}));let y=!1;const w=(0,J.venueChannel)(e,_,(e,t,a)=>{for(const s of m.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ee({lastSyncAt:s,lastServerAt:s})},e=>{Ee({realtime:e}),'SUBSCRIBED'===e?(y&&p(),y=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(y=!0)});qe.push(()=>{De().removeChannel(w)}),qe.push((0,P.onConnectivity)(e=>{e&&p()}));const v=xe.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),b=(0,M.superviseSync)({fastMs:Ga(Ke),readFast:async()=>{for(const e of v)await e.read()},readAll:p,flush:()=>{$.mutationQueue.flush()},wake:()=>{$.mutationQueue.retryNow()},restart:()=>{$a===a&&ja()},realtime:()=>Ue.getState().realtime,lastServerAt:()=>{const e=Ue.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,P.setOnline)(!0),Ee({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Ea,refreshAuth:async()=>{await De().auth.refreshSession()},heartbeat:()=>Va(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});qe.push(b.stop)}async function Va(e){const t=Ue.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await qa('sync_heartbeat',{p_venue:e,p_device:(0,C.deviceId)()??'unknown',p_app:Ke,p_version:q.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const Ga=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ue.getState(),queue:$.mutationQueue.pending.map(e=>e.table),failedTables:$.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),me.PITCH&&(window.__ccSyncPreview=e=>Ee(e)));const Ja='guest:sent:v1';async function za(e){Ee({kind:'guest',venueSlug:e,perms:[]});try{const t=(await qa('public_venue',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!u.IS_ISOLATED_VENUE||t.id===u.VENUE_UUID)){Ee({venueId:t.id,venueName:t.name}),await ks(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,p.withWildingsAddress)({...a,id:e}):t)})),xt(e,t.app?.events)}await Za(e),Ee({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ee({mode:(0,P.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Za(e).catch(()=>{})},6e4);qe.push(()=>clearInterval(t)),u.IS_ISOLATED_VENUE||await Ya(e)}async function Za(e){const t=await qa('public_menu',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ae.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}});try{const t=await qa('public_takeaway_menu',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function Ya(e){let t=await L.kv.get(Ja,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,ue.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,ue.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await xa())return;for(const a of n)try{const s=(await qa('guest_create_booking',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_booking:{...We(a),...(0,R.takeGuard)(a.id),allergies:$e(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&z.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Ee({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await qa('guest_create_takeaway',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_order:{...We(a),...(0,R.takeGuard)(a.id),allergies:$e(a.allergies)}}))?.[0];t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?es(e,s):e)}))}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ee({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ts(s)}}:e)})))}await L.kv.set(Ja,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await qa('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ja,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await qa('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.useStore.setState(e=>({bookings:e.bookings.map(e=>{const a=t.get(e.id);return a&&a.status&&a.status!==e.status&&'declined'!==a.status?{...e,status:a.status}:'declined'===a?.status&&'cancelled'!==e.status?{...e,status:'cancelled'}:e}),orders:e.orders.map(e=>{const a=t.get(e.id);if(!a)return e;const s=es(e,a);return Xa(s)===Xa(e)?e:s})})),Ee({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ee({mode:(0,P.isOnline)()?Ue.getState().mode:'offline'})}finally{a=!1}}};qe.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),La=setInterval(()=>{n()},15e3),as=()=>{n()},n()}const Xa=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function es(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ts=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let as=null;const ss={bridges:()=>xe,restart:ja};function ns(){const e=Ue.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Te('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function is(){const e=xe.find(e=>'stock_events'===e.spec.table);if(!e||ns())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&($.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function rs(){const e=xe.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}is();try{await $.mutationQueue.retryNow()}catch{}}Ue.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{rs()},3e3)});const os=['bookings','walk_ins'];function ds(){const e=Ue.getState();return Ne()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Te('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const us=()=>xe.filter(e=>os.includes(e.spec.table)),cs=e=>$.mutationQueue.failed.some(t=>os.includes(t.table)&&t.rowKey===e);function ls(e=!1){return ds()?0:us().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&cs(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function fs(e=!1){const t=ds();if(t)return t;for(const e of us())try{await e.read()}catch{}ls(e);try{await $.mutationQueue.retryNow()}catch{}return e&&ps(),null}function ps(){const e=us()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(us().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||cs(s)||os.some(t=>$.mutationQueue.hasPending(t,e,s))||t.clear(s)}$.mutationQueue.onFailed(e=>{os.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),$.mutationQueue.onDone(e=>{os.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let gs=null;const ms=(e=2500)=>{gs&&clearTimeout(gs),gs=setTimeout(()=>{gs=null,fs(!1)},e)};(0,P.onConnectivity)(e=>{e&&ms()}),Ue.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Te('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&ms(3e3)});const _s=['temp_readings','temp_units'];function Ss(e="temp_readings"){const t=Ue.getState();return Ne()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||tt()?'device'!==t.kind||Te('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const hs=()=>xe.filter(e=>_s.includes(e.spec.table));async function ys(e=!1){const t=Ss();if(t)return t;for(const e of hs())try{await e.read()}catch{}const a=hs()[0]?.venueId??'';for(const t of hs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,$.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await $.mutationQueue.retryNow()}catch{}if(e){const e=H.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=hs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||$.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,H.tempKey)(t.table,t.id))}}return null}$.mutationQueue.onFailed(e=>{_s.includes(e.table)&&H.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),$.mutationQueue.onDone(e=>{_s.includes(e.table)&&H.useTempSaves.getState().clear((0,H.tempKey)(e.table,e.rowKey))});let ws=null;const vs=(e=3e3)=>{ws&&clearTimeout(ws),ws=setTimeout(()=>{ws=null,ys(!1)},e)};(0,P.onConnectivity)(e=>{e&&vs()}),Ue.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Te('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&vs(3500)});const bs='golive:v1:';async function ks(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Cs(e):(await L.kv.get(bs+e,!1)||await Cs(e),await L.kv.get(Os+e,!1)||(As(e),await L.kv.set(Os+e,!0)),await L.kv.get(Is+e,!1)||(Rs(),await L.kv.set(Is+e,!0)))}const Is='golive:v3:';function Rs(){const e=e=>JSON.stringify(e).includes('(example)');try{re.useKitchen.setState(t=>({waste:t.waste.filter(t=>!e(t)),stockTakes:t.stockTakes.filter(t=>!e(t)),deliveries:t.deliveries.filter(e=>'dl-today-fish'!==e.id&&'dl-today-veg'!==e.id)}))}catch{}}const Os='golive:v2:';function As(e){const t=e=>JSON.stringify(e).includes('(example)');z.useStore.setState(t=>({customer:{...t.customer,name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}},stampCards:t.stampCards.filter(t=>t.restaurantId!==e),giftCards:t.giftCards.filter(t=>t.restaurantId!==e),ratings:t.ratings.filter(t=>t.restaurantId!==e),events:t.events.filter(t=>!(t.example&&(t.restaurantId===e||null===t.restaurantId)))})),de.useOwner.setState(e=>({referrals:[],coats:[],merchOrders:[],lost:[],customerTags:{},offers:e.offers.filter(e=>!t(e)),changeRequests:e.changeRequests.filter(e=>!t(e)),campaigns:e.campaigns.filter(e=>!t(e)),supplierOrders:e.supplierOrders.filter(e=>!t(e)),chat:e.chat.filter(e=>e.id.startsWith('m-seed-')).map((e,t)=>({...e,at:new Date(Date.now()-6e4*(5-t)).toISOString()}))}))}async function Cs(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,re.stripKitchenExamples)(re.useKitchen.getState()),s=de.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:oe.useSafety.getState().accidents.filter(e=>!(0,oe.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(re.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',re.useKitchen.getState()),re.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),de.useOwner.setState(n)),r(oe.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',oe.useSafety.getState()),oe.useSafety.setState(i));const o=(0,D.stripHrSamples)(D.useHr.getState());r(D.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',D.useHr.getState()),D.useHr.setState(o));const d=(0,S.stripGpSamples)(S.useGpCalc.getState());r(S.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',S.useGpCalc.getState()),S.useGpCalc.setState(d));const u=se.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),se.useOrderSheets.setState(c));const l=ae.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ae.useCardStore.setState(f)),void await L.kv.set(bs+e,!0)}const t=t=>t.restaurantId===e&&!(0,ue.isUuid)(t.id);z.useStore.setState(a=>({bookings:a.bookings.filter(e=>!t(e)),orders:a.orders.filter(e=>!t(e)),waitlist:a.waitlist.filter(t=>t.restaurantId!==e),walkIns:Object.fromEntries(Object.entries(a.walkIns).filter(([t])=>!t.includes(e)))})),X.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,ue.isUuid)(t.id))})),ee.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),de.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,ue.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,ue.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,ue.isUuid)(e.id)),leave:e.leave.filter(e=>(0,ue.isUuid)(e.id)),swaps:[]}));try{re.useKitchen.setState(e=>(0,re.stripKitchenExamples)(e))}catch{}de.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,ue.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.supplierId))}));try{oe.useSafety.setState(e=>({accidents:e.accidents.filter(e=>{return!String(e.id).startsWith('acc-ex')&&(t=e,!JSON.stringify(t).includes('(example)'));var t})}))}catch{}await L.kv.set(bs+e,!0)}const Ds=(e,t)=>We({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Us(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ee.useFloor.getState().live[e]??{}).map(([e,t])=>Ds(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ue.getState().kind||Te('device.write'),deletes:!1,matchKey:e=>({table_name:e}),toRow:(e,t)=>({venue_id:t,table_name:e.name,stage:e.stage??null,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note?e.note.slice(0,200):null,updated_by:(0,Y.actorStamp)({isCar:Z.IS_CAR,kind:Ue.getState().kind,staffRef:Ue.getState().staffRef,fallback:Ke})}),fromRow:e=>Ds(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ee.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>ee.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Es(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(ie.useSetup.getState().sites[e]?.grades??ie.DEFAULT_GRADES).map((e,t)=>({id:e.id,name:e.name,pence:e.pence,sort:t})),key:e=>e.id,rowKey:e=>String(e.grade_id),syncable:e=>!!e.id&&!!e.name,writable:()=>Te('wages.manage'),matchKey:e=>({grade_id:e}),toRow:(e,t)=>({venue_id:t,grade_id:e.id,name:e.name.slice(0,60),pence:Math.max(0,Math.min(1e5,Math.round(e.pence))),sort:e.sort}),fromRow:e=>({id:String(e.grade_id),name:String(e.name),pence:Number(e.pence),sort:Number(e.sort??0)}),apply:(t,a)=>{if(!t.length&&!a.length)return;const s=ie.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));ie.useSetup.getState().patch(e,{grades:i})},subscribe:t=>ie.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ts='staff-avatars',Ns=new Map;let Ks=!1;const Ps=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ms(){if(!Ks){Ks=!0;try{for(const[e,t]of Ns){const a=ne.useAvatars.getState().photos[e];if(!t){a?.path&&ne.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ue.getState().staffRef)continue;const{data:s,error:n}=await De().storage.from(Ts).download(t);if(n||!s)continue;const i=await Ps(s);i.startsWith('data:image/')&&ne.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ks=!1}}}function xs(e){const t=async()=>{const t=Ue.getState().staffRef,a=t?_t.get(t)??Ue.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ue.getState().kind)return;const s=ne.useAvatars.getState().photos[t];try{const n=Ns.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&De().storage.from(Ts).remove([t]).catch(()=>{})};if(!s){const e=!!ne.useAvatars.getState().clears?.[t];return e&&n&&(await qa('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ns.set(t,null),i(n)),void(e&&ne.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ee({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===r.type?'jpg':'image/webp'===r.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await De().storage.from(Ts).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await qa('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ns.set(t,d),n!==d&&i(n),ne.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ee({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ne.useAvatars.getState().photos},s=ne.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Te('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ue.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ns.set(t,null),ne.useAvatars.getState().doneClear(t),qa('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>De().storage.from(Ts).remove([e])).catch(()=>{})}});return t(),s}const qs=new Map,Ls=(0,T.create)(()=>({n:0}))},824,{"0":836,"1":1267,"2":5,"3":1268,"4":1169,"5":6,"6":1192,"7":842,"8":1193,"9":1196,"10":1165,"11":808,"12":863,"13":1082,"14":868,"15":1045,"16":1047,"17":978,"18":816,"19":1272,"20":13,"21":865,"22":1274,"23":996,"24":1181,"25":993,"26":871,"27":1168,"28":1277,"29":1167,"30":1042,"31":1041,"32":1266,"33":1279,"34":1278,"35":1282,"36":1072,"37":1283,"38":1284,"39":1285,"40":1286,"41":1288,"42":1164,"43":878,"44":807,"45":975,"46":828,"47":829,"48":1084,"49":1166,"50":1085,"51":1223,"52":1094,"53":1289,"54":1178,"55":861,"56":1097,"57":995,"58":1046,"59":1055,"60":1291,"61":1292,"62":2,"63":1293,"64":1179,"65":1180,"66":1294,"67":1190,"68":944,"69":940,"70":980,"71":1216,"72":1177,"73":1067,"74":1295,"75":1073,"76":29,"paths":{}}); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"colours",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"font",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return A}}),e.brandColour=function(I,S=F.gold){const r=/^#([0-9a-f]{6})$/i.exec(I??'');if(!r)return S;const _=parseInt(r[1],16),t=(_>>16)/255,E=(_>>8&255)/255,n=(255&_)/255,o=Math.max(t,E,n),A=Math.min(t,E,n),l=o-A;if(l<.12)return I;const D=o===t?((E-n)/l+6)%6*60:o===E?60*((n-t)/l+2):60*((t-E)/l+4);return D>65&&D<320?S:I};var I=_r(_d[0]),S=_r(_d[1]),r=_r(_d[2]),_=_r(_d[3]),t=_r(_d[4]),E=_r(_d[5]);const F={bg:I.IS_SOUTERS?'#56152A':I.IS_WILDINGS?'#272A2F':'#0B0B0B',surface:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#141414',surface2:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#363A42':'#1D1C1A',border:I.IS_SOUTERS?'#87435B':I.IS_WILDINGS?'#50545C':'#34302A',gold:I.IS_WILDINGS?'#FFE3A5':I.IS_KIRKMICHAEL?'#B87754':I.IS_SOUTERS?'#A4622E':'#CFA45F',goldLight:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',goldTint:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',goldMuted:I.IS_WILDINGS?'#DDC694':I.IS_KIRKMICHAEL?'#C2937A':I.IS_SOUTERS?'#C18F67':'#BFA06C',hairline:'rgba(255,255,255,0.09)',tile:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#18171A',tilePressed:I.IS_SOUTERS?'#64223B':I.IS_WILDINGS?'#393D45':'#211F1C',accentBg:I.IS_WILDINGS?'rgba(255,227,165,0.13)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.13)':I.IS_SOUTERS?'rgba(164,98,46,0.13)':'rgba(207,164,95,0.13)',accentBorder:I.IS_WILDINGS?'rgba(255,227,165,0.38)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.38)':I.IS_SOUTERS?'rgba(164,98,46,0.38)':'rgba(207,164,95,0.38)',text:'#F5F1E8',muted:'#B8B0A0',onGold:I.IS_WILDINGS?'#272A2F':I.IS_KIRKMICHAEL?'#0B0B0B':I.IS_SOUTERS?'#FFFFFF':'#0B0B0B',red:'#FF6B5E',redBg:'#4A1310',redSolid:'#C62F22',amber:'#FFB547',amberBg:'#3F2C05',shellfishFree:'#6EC470',ok:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',okBg:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',blue:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',blueBg:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#39352C':'#1E1A12',...I.IS_GREENSIDE?r.GREENSIDE_PALETTE:{},...I.IS_QUEUED_VENUE?S.QUEUED_PALETTE:{},...I.IS_KIRKTON?t.KIRKTON_PALETTE:{},...I.IS_ABBOTSFORD?_.ABBOTSFORD_PALETTE:{}},n={regular:'Poppins_400Regular',medium:'Poppins_500Medium',semibold:'Poppins_600SemiBold',bold:'Poppins_700Bold'},o={small:E.type.small,body:E.type.body,large:E.type.large,title:E.type.title,hero:E.type.hero},A={s:E.radii.s,m:E.radii.m,l:E.radii.l}},825,[5,1341,1191,1342,1343,1344]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},826,[240]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.templatesFor=function(t){const n={...r.DEFAULT_TEMPLATES};for(const o of Object.keys(r.DEFAULT_TEMPLATES))n[o]={...r.DEFAULT_TEMPLATES[o],...t?.[o]??{}};return n},e.composeBooking=function(t,n,o,c,u){if(n.walkIn)return[];return s(t,'booking-confirmation'===t?'booking':'booking-request'===t?'request':'declined',(0,r.bookingVars)(n,o),{phone:n.phone,email:n.email,name:n.name},{refType:'booking',refId:n.id,ref:n.ref},o,c,u)},e.composeOrder=function(t,n,o,c){return'takeaway'!==t.type?[]:s('order-confirmation','order',(0,r.orderVars)(t,n),{phone:t.phone,email:t.email,name:t.customerName},{refType:'order',refId:t.id,ref:t.ref},n,o,c)},e.deliverQueued=async function(r,n){if(!(0,t.isLive)())return;const o=(0,t.activeProvider)();for(const t of r){const r=await o.deliver(t);n(t.id,r.ok?{status:'sent'}:{status:'failed',error:r.error})}},e.statusLabel=function(t){const r='sms'===t.channel?'Text':'Email';return'preview'===t.status?`${r}: Ready (preview mode)`:'queued'===t.status?`${r}: Sending\u2026`:'sent'===t.status?`${r} sent`:`${r}: Not sent (failed)`},Object.defineProperty(e,"PREVIEW_BANNER",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);Object.keys(t).forEach(function(r){'default'===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})});var r=_r(d[1]);Object.keys(r).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var n=_r(d[2]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=()=>`msg-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-4)}`;function s(s,c,u,l,f,m,p,b){const y=[],v=(0,t.isLive)()?'queued':'preview',h=(0,t.activeProvider)().id,E=(0,n.guestPhone)(l.phone);if(E.ok&&y.push({id:o(),restaurantId:m.id,at:b,channel:'sms',kind:s,to:E.pretty,toName:l.name,body:(0,r.toGsm)((0,r.fill)(p[c].sms,u.sms)),...f,status:v,provider:h}),l.email?.trim()){const t=(0,r.fillEmailText)(p[c].body,u.email),n=(0,r.fill)(p[c].subject,u.email);y.push({id:o(),restaurantId:m.id,at:b,channel:'email',kind:s,to:l.email.trim(),toName:l.name,subject:n,body:t,html:(0,r.emailHtml)(t,{venue:m.name,preheader:n}),...f,status:v,provider:h})}return y}const c='Preview mode, not sent yet. Connect a text and email service to go live.'},827,[1212,1213,1214]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCK_REASONS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return m}}),_e.blockClock=function(e){if('string'==typeof e){const t=/(\d{1,2}):(\d{2})/.exec(e);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}return e instanceof Date&&!Number.isNaN(e.getTime())?`${String(e.getHours()).padStart(2,'0')}:${String(e.getMinutes()).padStart(2,'0')}`:void 0},Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return k}}),_e.blockedTablesAt=v,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return M}}),_e.closedAreasAt=function(e,t,o,n){const a=(0,u.toMins)(n),s=p(e,t,o).filter(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).map(e=>e.areaId);return new Set([...s,...[...v(e,t,o,n)].map(M)])},_e.blockAt=S,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,u.toMins)(e.to)>(0,u.toMins)(n))).sort((e,t)=>e.date===t.date?(0,u.toMins)(e.from)-(0,u.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o={...t,id:(0,a.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,a.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)}))},remove:(t,o)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>{const n=e.blocks.find(e=>e.id===t);return n?{blocks:e.blocks.filter(e=>e.id!==t),removed:[...e.removed,{...n,removedAt:(new Date).toISOString(),removedBy:o??n.by}]}:e})},put:t=>e(e=>{const o=e.blocks.filter(e=>e.id!==t.id),n=e.removed.filter(e=>e.id!==t.id);return t.removedAt?{blocks:o,removed:[...n,t]}:{blocks:[...o,t],removed:n}})}),{name:'covercharge-blocks-v1',storage:(0,c.createJSONStorage)(()=>n.default),version:2,migrate:e=>{const t=e??{};return{blocks:t.blocks??[],removed:t.removed??[]}}}));const k=e=>!e.areaId&&!e.tables?.length;function v(e,t,o,n){const a=(0,u.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).flatMap(e=>e.tables))}const O=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&k(e)).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),p=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),M=e=>`tbl:${e}`;function S(e,t,o,n){const a=(0,u.toMins)(n);return O(e,t,o).find(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to))}const $=(e,t,o,n)=>S(e,t,o,n),h=e=>e.privateFunction?`${e.privateFunction.title} \xb7 ${e.privateFunction.covers} Covers \xb7 ${e.areaName??'Whole venue'} \xb7 until ${e.to}`:e.tables?.length?`${e.tables.map(t.tableNumbers).join(', ')} blocked until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:e.areaId?`${e.areaName??'Area'} closed until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:`Bookings paused until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`,y=(e,t)=>{const o=m(e=>e.blocks);return O(o,e,t)}},828,[812,1188,1097,993,1189,822,990,1173]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SETTINGS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"seedPlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useFloor",{enumerable:!0,get:function(){return p}}),_e.hashOldPins=f,Object.defineProperty(_e,"usePlan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useDisplaySettings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"planOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j}}),_e.tablesLabel=v,_e.tableCardLabel=function(e){return(0,t.withTableWord)(v(e))},Object.defineProperty(_e,"joinTables",{enumerable:!0,get:function(){return S}});var e,n=r(d[0]),t=r(d[1]),a=r(d[2]),s=(e=a)&&e.__esModule?e:{default:e},i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});const u={privacy:!0,idleMins:2,pinOn:!1,...i.DEFAULT_WAKE,tonightCards:!0},b=e=>'souters'===e||n.IS_ISOLATED_VENUE&&'souters'===n.VENUE_RID?{areas:[{id:'su-restaurant',name:'Restaurant'},{id:'su-bar',name:'Bar'},{id:'su-mezzanine',name:'Mezzanine / private dining'},{id:'su-garden',name:'Beer garden',outdoor:!0},{id:'su-icecream',name:'Ice cream & cake corner'}],tables:[],joins:[],sections:[],fixtures:[]}:'kirkmichael'===e||n.IS_ISOLATED_VENUE&&'kirkmichael'===n.VENUE_RID?{areas:[{id:'km-restaurant',name:'Restaurant'},{id:'km-bar',name:'Bar'},{id:'km-private',name:'Private dining',label:'The Room (about 18 covers) \u2014 table plan to confirm'}],tables:[],joins:[],sections:[],fixtures:[]}:['wildings','greenside'].includes(e)||n.IS_ISOLATED_VENUE?{areas:[],tables:[],joins:[],sections:[],fixtures:[]}:'anchorage'===e?(0,c.anchoragePlan)():(0,c.starterPlan)(),p=(0,l.create)()((0,o.persist)((e,t)=>{const a=e=>t().plans[e]??b(e);return{plans:n.IS_ISOLATED_VENUE?{[n.VENUE_RID]:b(n.VENUE_RID)}:{anchorage:(0,c.anchoragePlan)()},live:{},settings:{},smsLog:[],setPlan:(n,t)=>e(e=>({plans:{...e.plans,[n]:t}})),updateTable:(n,t,s)=>{const i=a(n);e(e=>({plans:{...e.plans,[n]:{...i,tables:i.tables.map(e=>e.id===t?{...e,...s}:e)}}}))},addTable:(n,t)=>{const s=a(n);e(e=>({plans:{...e.plans,[n]:{...s,tables:[...s.tables,t]}}}))},removeTable:(n,t)=>{const s=a(n),i=s.tables.find(e=>e.id===t);e(e=>({plans:{...e.plans,[n]:{...s,tables:s.tables.filter(e=>e.id!==t),joins:s.joins.filter(e=>!i||!e.tables.includes(i.name))}}}))},setLive:(n,t,a)=>e(e=>({live:{...e.live,[n]:{...e.live[n]??{},[t]:{...e.live[n]?.[t]??{},...a}}}})),setSettings:(n,t)=>e(e=>({settings:{...e.settings,[n]:{...u,...e.settings[n]??{},...t}}})),logSms:(n,t,a)=>e(e=>{return{smsLog:[{id:(s='sms',`${s}-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`),rid:n,at:t,text:a},...e.smsLog].slice(0,50)};var s}),resetPlan:n=>e(e=>({plans:{...e.plans,[n]:b(n)}}))}},{name:'covercharge-floor-v1',version:6,storage:(0,o.createJSONStorage)(()=>s.default),migrate:(e,n)=>{const t=e??{};let a=t;if(n<2){const e={};for(const[n,a]of Object.entries(t.plans??{}))e[n]='anchorage'===n?(0,c.anchoragePlan)():(0,c.normalisePlan)(a);e.anchorage=(0,c.anchoragePlan)(),a={...t,plans:e,live:{}}}else if(n<3)a={...t,plans:{...t.plans??{},anchorage:(0,c.anchoragePlan)()}};else if(n<4){const e=t.plans?.anchorage;e&&(a={...t,plans:{...t.plans,anchorage:{...e,joins:(e.joins??[]).filter(e=>!(2===e.tables.length&&e.tables.includes('1')&&e.tables.includes('2')))}}})}return n<5&&(a={...a,settings:f(a.settings)}),n<6&&a.plans?.anchorage&&(a={...a,plans:{...a.plans,anchorage:(0,c.withSeedBest)('anchorage',a.plans.anchorage)}}),a}}));function f(e){const n={};for(const[t,a]of Object.entries(e??{})){const{pin:e,...s}=a??{};n[t]={...u,...s,...'pinHash'in s?{}:(0,i.fromOldPin)(e)}}return n}const h=e=>p(n=>n.plans[e])??E(e),N={};function E(e){return N[e]??=b(e)}const O=e=>{const n=p(n=>n.settings[e]);return n?{...u,...n}:u},P=e=>p.getState().plans[e]??E(e),j=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[];function v(e){const n=j((0,t.tableNumbers)(e));if(!n.length)return'';if(1===n.length)return n[0];const a=n.map(e=>/^\d+$/.test(e)?Number(e):NaN),s=a.every(e=>!Number.isNaN(e))?[...n].sort((e,n)=>Number(e)-Number(n)):n;return a.every(e=>!Number.isNaN(e))&&s.length>=3&&s.every((e,n)=>0===n||Number(e)===Number(s[n-1])+1)?`${s[0]}\u2013${s[s.length-1]}`:s.join(' + ')}const S=e=>[...new Set(e)].sort((e,n)=>/^\d+$/.test(e)&&/^\d+$/.test(n)?Number(e)-Number(n):e.localeCompare(n)).join('+')},829,[5,812,1188,984,993,1189,1067]); +__d(function(_g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STATUS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"STAGE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"turnFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"startOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"durOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"endOf",{enumerable:!0,get:function(){return f}}),e.clashes=function(a,s=90){const n=new Set,l=a.filter(t=>g(t)&&t.table);for(let a=0;a(0,t.tablesOf)(d.table).includes(a))&&(u(o)t.date===n&&!['cancelled','noshow'].includes(t.status)).sort((t,a)=>t.time.localeCompare(a.time));for(const s of a.tables){const a=i.filter(a=>(0,t.tablesOf)(a.table).includes(s.name)),n=a[0],o=(0,t.tablesOf)(n?.table);l[s.name]={table:s,status:n?'soon':'free',next:n,covers:n?.partySize??0,dayBookings:a.length?a:void 0,group:o.length>1?o:void 0,allergy:!(!n?.allergies?.length&&!n?.allergyNote),vip:n?.tags?.find(t=>'VIP'===t)??n?.tags?.find(t=>'Regular'===t),occasion:n?.occasion??h(n?.notes)}}return l},e.floorView=function(a,n,l,i,o,d=90,c){const b={},g=n.filter(t=>t.date===S(o));for(const n of a.tables){const a=i[n.name]??{},y=g.filter(a=>(0,t.tablesOf)(a.table).includes(n.name)),S=y.find(t=>'seated'===(0,s.shownStatus)(t)),v=y.filter(t=>'confirmed'===t.status).sort((t,a)=>t.time.localeCompare(a.time)).find(t=>O(o,t)>=-20),T=v?Math.round(O(o,v)):void 0,w=S?void 0:p(y,o,d),F=l.find(t=>'table'===t.type&&t.tableNo===n.name&&!['closed','cancelled','collected'].includes(t.status));let j='free';a.blocked?j='blocked':S?j=a.stage??'seated':!c?.has(n.areaId)&&!c?.has(`tbl:${n.name}`)||F?a.dirty?j='dirty':F?j=a.stage??'seated':v&&(j='soon'):j='blocked';const A=S,P=A?.tags?.find(t=>'VIP'===t)??A?.tags?.find(t=>'Regular'===t)??(A?void 0:v?.tags?.[0]);b[n.name]={table:n,status:j,booking:A,next:v,due:w,nextIn:T,covers:A?.partySize??0,group:(()=>{const a=(0,t.tablesOf)((A??('soon'===j?v:void 0))?.table);return a.length>1?a:void 0})(),orderOnly:!A&&!!F,note:a.note,seatedMins:A?Math.max(0,Math.round((o.getTime()-u(A).getTime())/6e4)):void 0,freeAt:A?f(A,d):void 0,allergy:!!(A?.allergies?.length||A?.allergyNote||!A&&(v?.allergies?.length||v?.allergyNote)||F?.allergies?.length),vip:P,occasion:A?.occasion??(A?void 0:v?.occasion??h(v?.notes))??h(A?.notes)}}return b},e.dueOnTable=p,Object.defineProperty(e,"OCCASION_ICON",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"tableAllowed",{enumerable:!0,get:function(){return v}}),e.suggestTable=function(s,n,l,i,o,d,c=90,b,p){const h=[...s.tables.map(t=>({name:t.name,seats:t.maxSeats,min:t.minSeats,parts:[t.name]})),...s.joins.map(t=>{const a=s.tables.filter(a=>t.tables.includes(a.name));return{name:t.tables.join('+'),seats:a.reduce((t,a)=>t+a.maxSeats,0),min:a.reduce((t,a)=>t+a.minSeats,0),parts:t.tables}})].filter(t=>t.parts.every(t=>v(s,t,p))),y=o.getTime()+6e4*d,O=new Set((0,a.bestTables)(s));let S=null;for(const a of h){if(a.seats['blocked'].includes(l[t]?.status)))continue;const s=!!l&&a.parts.some(t=>['seated','mains','dessert','bill','dirty'].includes(l[t]?.status)),d=n.filter(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()o.getTime()).length,p=1===a.parts.length&&O.has(a.parts[0])?12:0,h=(s?1e3:0)+100*d+10*(a.seats-i)+(i({name:t.name,seats:t.maxSeats,parts:[t.name]})),...s.joins.map(t=>({name:t.tables.join('+'),seats:s.tables.filter(a=>t.tables.includes(a.name)).reduce((t,a)=>t+a.maxSeats,0),parts:t.tables}))].filter(t=>t.seats>=l&&t.parts.every(t=>v(s,t,c))).filter(a=>!n.some(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()i.getTime())),y=new Set((0,a.bestTables)(s)),O=t=>1===t.parts.length&&y.has(t.parts[0])?0:1;return h.sort((t,a)=>t.seats-a.seats||t.parts.length-a.parts.length||O(t)-O(a)).map(t=>({table:t.name,seats:t.seats,area:s.areas.find(a=>a.id===s.tables.find(a=>a.name===t.parts[0])?.areaId)?.name??''}))},e.seatedPartiesAt=function(a,s,n){return s.filter(s=>s.date===n&&'seated'===s.status&&(0,t.tablesOf)(s.table).includes(a))},Object.defineProperty(e,"unseatStatus",{enumerable:!0,get:function(){return T}});var t=r(_d[0]),a=r(_d[1]),s=r(_d[2]);const n={colour:'#3A2F1E',fg:'#F1DDB0'},l={colour:'#CFA45F',fg:'#0B0B0B'},i={free:{label:'Free',...n},soon:{label:'Booked later',colour:'#9A3050',fg:'#FFF6F0'},seated:{label:'Seated',...l},mains:{label:'Seated',...l},dessert:{label:'Seated',...l},bill:{label:'Seated',...l},dirty:{label:'Needs clearing',colour:'#6E6555',fg:'#FFFFFF'},blocked:{label:'Blocked',...n}},o={seated:'Seated',mains:'Mains',dessert:'Dessert',bill:'Bill requested'},d=['seated','mains','dessert','bill'],c=(t,a=90)=>Math.min(a+60,a+15*Math.max(0,Math.ceil((t-2)/2))),u=t=>'seated'===(0,s.shownStatus)(t)&&t.seatedAt?new Date(t.seatedAt):new Date(`${t.date}T${t.time}:00`),b=(t,a=90)=>t.durationMins??c(t.partySize,a),f=(t,a=90)=>new Date(u(t).getTime()+6e4*b(t,a)),g=t=>!['cancelled','noshow','finished'].includes(t.status);function p(t,a,s=90){return t.filter(t=>'confirmed'===t.status&&O(a,t)<=45&&-O(a,t)t.time.localeCompare(a.time))[0]}const h=t=>t?/birthday/i.test(t)?'birthday':/anniversary/i.test(t)?'anniversary':void 0:void 0,y={birthday:'\ud83c\udf82',anniversary:'\ud83d\udc9d',celebration:'\ud83e\udd42'},O=(t,a)=>(new Date(`${a.date}T${a.time}:00`).getTime()-t.getTime())/6e4,S=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,v=(t,a,s)=>{const n=t.tables.find(t=>t.name===a);if(!n)return!1;const l=t.areas.find(t=>t.id===n.areaId);return!(s?.dog&&!(void 0!==n.dogOk?n.dogOk:l?.dogs))&&(!s?.closed?.has(n.areaId)&&!s?.closed?.has(`tbl:${n.name}`))};const T=t=>t.walkIn?'cancelled':'confirmed'},830,[829,1067,832]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"emptyNeeds",{enumerable:!0,get:function(){return w}}),_e.needsMissing=function(e,l=[]){const s=[];null===e.allergy?s.push('Answer the allergy question first'):'yes'!==e.allergy||e.allergens.length||l.length||e.allergyNote.trim()||s.push('Pick the allergens or describe them');null===e.dog&&s.push('Say whether a dog is coming');return s},_e.needsPatch=function(e,l=[]){const s='yes'===e.allergy?e.allergens.filter(e=>!l.some(l=>l.allergen===e)).map(l=>({allergen:l,severity:e.severity})):[],t=Object.entries(e.holds).filter(([,e])=>e>0).map(([e,l])=>{const s=e.indexOf(':');return{kind:e.startsWith('item:')?'item':'stock',id:s>=0?e.slice(s+1):e,qty:l}}),a=e.dog?Math.max(1,e.dogs):0,n={...e.wheelchair?{wheelchair:e.wheelchair}:{},...e.stepFree?{stepFree:!0}:{},...e.toilet?{toilet:!0}:{},...e.assistDog?{assistDog:!0}:{},...e.accessNote.trim()?{note:e.accessNote.trim()}:{}},r={...e.vegan?{vegan:e.vegan}:{},...e.vegetarian?{vegetarian:e.vegetarian}:{}};return{allergies:[...l,...s],allergyNone:'none'===e.allergy&&!l.length||void 0,allergyPeople:'yes'===e.allergy?e.allergyPeople:void 0,allergyNote:'yes'===e.allergy&&e.allergyNote.trim()?e.allergyNote.trim():void 0,dog:a>0,dogs:a||void 0,access:Object.keys(n).length?n:void 0,diet:Object.keys(r).length?r:void 0,holds:t.length?t:void 0,tableReq:e.tableReq.length?e.tableReq:void 0}},_e.FirstQuestions=function({rid:e,value:l,onChange:a,party:r,audience:i,profile:o=[]}){const y=e=>a({...l,...e}),b=(0,p.usePlan)(e),[x,j]=(0,t.useState)(!1),k=(0,s.dogQuestionOn)((0,u.useRestaurant)(e));(0,t.useEffect)(()=>{k||null!==l.dog||a({...l,dog:!1})},[k,l.dog]);const w=x?m.ALLERGENS:m.ALLERGENS.filter(e=>['gluten','milk','peanuts','treenuts','crustaceans','molluscs','fish','eggs','sesame'].includes(e.id)||l.allergens.includes(e.id)),q=[...o.map(e=>e.allergen),...l.allergens],M=(0,f.dogSetUp)(b);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(R,{tone:"red",testID:"q-allergens",children:[(0,v.jsx)(C,{sub:'guest'===i?'We ask everyone first, so the kitchen can keep you safe.':'Ask every guest first. It goes to the kitchen in red.',children:"\u26a0\ufe0f Does anyone in the party have a food allergy?"}),o.length?(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(e=>(0,v.jsx)(h.Badge,{kind:"red",label:`${m.ALLERGENS.find(l=>l.id===e.allergen)?.short} (from your profile)`},e.allergen))}):null,(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No allergies",selected:'none'===l.allergy,onPress:()=>y({allergy:'none',allergens:[]})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes, allergies",selected:'yes'===l.allergy,onPress:()=>y({allergy:'yes'})})})]}),'none'===l.allergy&&o.length?(0,v.jsx)(h.Muted,{children:"Your profile allergies above are still shared with the kitchen."}):null,'yes'===l.allergy?(0,v.jsxs)(n.default,{style:{gap:10},testID:"allergen-picker",children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"Which allergens? (the 14 UK allergens)"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[w.map(e=>(0,v.jsx)(h.Chip,{label:e.short,selected:l.allergens.includes(e.id)||o.some(l=>l.allergen===e.id),disabled:o.some(l=>l.allergen===e.id),onPress:()=>y({allergens:l.allergens.includes(e.id)?l.allergens.filter(l=>l!==e.id):[...l.allergens,e.id]})},e.id)),x?null:(0,v.jsx)(h.Chip,{label:"All 14\u2026",onPress:()=>j(!0)})]}),(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"How serious?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:m.SEVERITIES.map(e=>(0,v.jsx)(h.Chip,{label:e.label,selected:l.severity===e.id,onPress:()=>y({severity:e.id})},e.id))}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many people with allergies?"}),(0,v.jsx)(h.Stepper,{value:Math.min(l.allergyPeople,r),onChange:e=>y({allergyPeople:e}),min:1,max:Math.max(1,r),label:"people with allergies"})]}),(0,v.jsx)(h.Field,{label:"Anything else the kitchen should know? (optional)",value:l.allergyNote,onChangeText:e=>y({allergyNote:e}),placeholder:"e.g. traces of sesame, one child with coeliac disease",testID:"allergy-note"}),q.length?(0,v.jsx)(c.MenuAllergyCheck,{rid:e,allergens:q,audience:i}):null]}):null]}),k?(0,v.jsxs)(R,{tone:"gold",testID:"q-dogs",children:[(0,v.jsx)(C,{sub:M?'Well-behaved dogs are welcome at our dog-friendly tables.':'staff'===i?'Dog-friendly tables aren\u2019t marked yet (Managers \u203a Booking options), so any table is offered for now.':void 0,children:"\ud83d\udc15 Are you bringing a dog?"}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No",selected:!1===l.dog,onPress:()=>y({dog:!1})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes",selected:!0===l.dog,onPress:()=>y({dog:!0,dogs:Math.max(1,l.dogs)})})})]}),l.dog?(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many dogs?"}),(0,v.jsx)(h.Stepper,{value:l.dogs,onChange:e=>y({dogs:e}),min:1,max:4,label:"dogs"})]}):null]}):null]})},_e.useReserveAvailability=q,_e.MoreQuestions=function({rid:e,r:l,value:a,onChange:r,party:i,date:o,time:c,today:y,bookings:m,audience:b,showTables:x}){const j=e=>r({...a,...e}),w=l.settings,S=(0,u.useMenu)(e),P=(0,t.useMemo)(()=>S.filter(e=>/\((V|VG|Ve)\)|vegan|vegetarian/i.test(`${e.name} ${e.tags?.join(' ')??''}`)).slice(0,4),[S.length]),N=q(e,l,o,y,m,b),T=e=>a.holds[e]??0,D=(0,f.stockNeed)({holds:Object.entries(a.holds).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.indexOf(':')>=0?e.slice(e.indexOf(':')+1):e,qty:l}))},N.items),$=(e,l)=>Math.min(10,...e.map(e=>{const s=(D[e.key]??0)-T(l)*e.qty;return Math.floor(((N.free[e.key]??0)-s)/e.qty)})),I=(e,l,s,t)=>{const r=T(e),i=t<=0&&0===r;return(0,v.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'center',gap:10,opacity:i?.55:1},testID:`reserve-${e.replace(':','-')}`,children:[(0,v.jsxs)(n.default,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(h.T,{weight:"semibold",children:l}),(0,v.jsx)(h.Muted,{children:i?'Unavailable \u2014 none left for this day':s})]}),i?(0,v.jsx)(h.Badge,{kind:"neutral",label:"Unavailable"}):(0,v.jsx)(h.Stepper,{value:r,onChange:l=>j({holds:{...a.holds,[e]:Math.max(0,Math.min(l,Math.max(r,t)))}}),min:0,max:Math.max(r,Math.min(10,t)),label:l})]},e)},O=N.items.length>0||!1!==w.reserveStock&&N.stock.length>0,A=(0,p.usePlan)(e);return(0,v.jsxs)(v.Fragment,{children:[(0,s.accessQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-access",children:[(0,v.jsx)(C,{sub:"Optional. Tell us and we\u2019ll have the right table ready.",children:"\u267f Access needs"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Wheelchair users"}),(0,v.jsx)(h.Stepper,{value:a.wheelchair,onChange:e=>j({wheelchair:e}),min:0,max:Math.max(1,i),label:"wheelchair users"})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"Step-free access",selected:a.stepFree,onPress:()=>j({stepFree:!a.stepFree})}),(0,v.jsx)(h.Chip,{label:"Accessible toilet",selected:a.toilet,onPress:()=>j({toilet:!a.toilet})}),(0,v.jsx)(h.Chip,{label:"Assistance dog",selected:a.assistDog,onPress:()=>j({assistDog:!a.assistDog})})]}),(0,v.jsx)(h.Field,{label:"Anything else? (optional)",value:a.accessNote,onChangeText:e=>j({accessNote:e}),placeholder:"e.g. needs a chair with arms"}),w.accessStatement?.trim()?(0,v.jsx)(h.Muted,{children:w.accessStatement.trim()}):null]}):null,(0,s.dietQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-veg",children:[(0,v.jsx)(C,{sub:"We\u2019d love to look after you. Optional.",children:"\u24cb Any vegans or vegetarians?"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegan"}),(0,v.jsx)(h.Stepper,{value:a.vegan,onChange:e=>j({vegan:e}),min:0,max:Math.max(1,i),label:"vegans"})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegetarian"}),(0,v.jsx)(h.Stepper,{value:a.vegetarian,onChange:e=>j({vegetarian:e}),min:0,max:Math.max(1,i),label:"vegetarians"})]}),!1!==w.vegTeaser&&P.length&&(a.vegan||a.vegetarian)?(0,v.jsxs)(h.Muted,{children:["On the menu: ",P.map(e=>e.name).join(' \xb7 ')]}):null]}):null,O?(0,v.jsxs)(R,{tone:"gold",testID:"q-reserve",children:[(0,v.jsx)(C,{sub:N.known?'Held for you from today\u2019s count.':o>y||'guest'===b?'Held for you; the kitchen confirms and orders in.':void 0,children:"\ud83e\udd9e Reserve with your table"}),N.items.map(e=>I(`item:${e.id}`,`${e.name}${k(e.price)}`,e.description||e.uses.map(e=>`${e.qty} ${N.stock.find(l=>l.key===e.key)?.name.toLowerCase()??e.key}`).join(' + '),$(e.uses,`item:${e.id}`))),!1!==w.reserveStock?N.stock.map(e=>I(`stock:${e.key}`,`Reserve ${e.name.toLowerCase()}`,N.known?`${N.free[e.key]} available today`:'Held for the kitchen to order',$([{key:e.key,qty:1}],`stock:${e.key}`))):null,'staff'===b&&N.known?(0,v.jsxs)(h.Muted,{children:["Today: ",N.stock.map(e=>`${N.free[e.key]} ${e.plural.toLowerCase()} free (${N.reserved[e.key]??0} reserved)`).join(' \xb7 ')]}):null]}):null,x&&!1!==w.tableRequests&&A.tables.length?(0,v.jsx)(M,{rid:e,value:a,onChange:r,party:i,hide:w.tableRequestHide??[]}):null]})},_e.dogTimeOk=function(e,l,s,t,a){if(!a)return!0;const n=e.settings.maxDogsPerSlot;return!n||(0,f.dogsAt)(l,s,t)+a<=n},Object.defineProperty(_e,"accessibleSetUp",{enumerable:!0,get:function(){return f.accessibleSetUp}});var e,l=_r(d[0]),s=_r(d[1]),t=_r(d[2]),a=_r(d[3]),n=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),i=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),p=_r(d[10]),y=_r(d[11]),m=_r(d[12]),b=_r(d[13]),x=_r(d[14]),f=_r(d[15]),j=_r(d[16]),v=_r(d[17]);const k=e=>'display'===x.APP_VARIANT?'':` \xb7 ${(0,b.gbp)(e)}`,w=()=>({allergy:null,allergens:[],severity:'allergy',allergyPeople:1,allergyNote:'',dog:null,dogs:1,wheelchair:0,stepFree:!1,toilet:!1,assistDog:!1,accessNote:'',vegan:0,vegetarian:0,holds:{},tableReq:[]});const R=({children:e,tone:l,testID:s})=>(0,v.jsx)(n.default,{testID:s,style:{gap:10,padding:16,borderRadius:16,borderWidth:'plain'===l?1:1.5,borderColor:'red'===l?j.colours.red:'gold'===l?j.colours.accentBorder:j.colours.hairline,backgroundColor:'red'===l?'#1E1110':j.colours.surface},children:e}),C=({children:e,sub:l})=>(0,v.jsxs)(n.default,{style:{gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:e}),l?(0,v.jsx)(h.Muted,{children:l}):null]});function q(e,l,s,t,a,n,i){const o=(0,f.reservablesOf)(l),c=(0,y.useStockItems)(e),h=(0,y.useShellStore)((0,r.useShallow)(l=>(0,y.venueCounts)(l,e))),u=(0,y.useShellStore)(l=>!!l.server[e]),p=(0,f.reservedOn)(a,s,o,i),m=s===t&&('staff'===n||u),b={};for(const e of c)b[e.key]=m?Math.max(0,Math.floor((h[e.key]??0)-(p[e.key]??0))):1/0;return{items:o,stock:c,free:b,reserved:p,known:m}}function M({rid:e,value:s,onChange:a,party:r,hide:c}){const u=(0,p.usePlan)(e),y=u.areas.filter(e=>u.tables.some(l=>l.areaId===e.id&&!c.includes(l.name))),[m,b]=(0,t.useState)(y[0]?.id??''),x=s.dog?s.dogs:0,k=e=>c.includes(e)?'Not bookable':(0,f.tableBlockReason)(u,e,r,x,s.wheelchair>0||s.stepFree),w=Object.fromEntries(u.tables.map(e=>[e.name,{table:e,status:k(e.name)?'blocked':'free',covers:0,allergy:!1}])),q=e=>{if(k(e))return;const l=s.tableReq.includes(e)?s.tableReq.filter(l=>l!==e):[...s.tableReq,e].slice(-2);a({...s,tableReq:l})},M=u.tables.filter(e=>e.areaId===m&&!c.includes(e.name));return(0,v.jsxs)(R,{tone:"plain",testID:"q-table",children:[(0,v.jsx)(C,{sub:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best.",children:"\ud83e\ude91 Request a table (optional)"}),y.length>1?(0,v.jsx)(i.AreaTabs,{plan:u,area:m,onPick:b}):null,(0,v.jsx)(n.default,{testID:"q-table-plan",style:{height:240,borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:j.colours.hairline},children:(0,v.jsx)(o.FloorCanvas,{plan:u,areaId:m,mode:"live",view:w,privacy:!0,fit:"contain",crop:!0,maxH:260,highlight:s.tableReq,onTap:e=>q(e.name)})}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>{const t=k(e.name),a=s.tableReq.indexOf(e.name);return(0,v.jsx)(h.Chip,{label:`${(0,l.tableNumbers)(e.name)}`,sub:t||(0===a?'1st choice':1===a?'2nd choice':`${e.maxSeats} seats`),selected:a>=0,disabled:!!t,onPress:()=>q(e.name)},e.name)})}),s.tableReq.length?(0,v.jsxs)(h.T,{size:14,colour:j.colours.goldLight,children:["Requested: ",s.tableReq.map((e,s)=>`${(0,l.tableNumbers)(e)}${s?' (2nd choice)':''}`).join(', ')]}):(0,v.jsx)(h.Muted,{children:"Tap a table; tap another for a second choice."})]})}},831,[812,814,31,128,881,953,952,1425,818,823,829,1084,819,820,807,832,825,25]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ACTIVE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ANCHORAGE_RESERVABLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"reservablesOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"holdId",{enumerable:!0,get:function(){return s}}),e.stockNeed=a,e.reservedBookingsOn=function(t,r,o,i){return t.filter(t=>t.date===r&&n(t)&&'finished'!==t.status).map(t=>({booking:t,qty:a(t,o)[i]??0})).filter(t=>t.qty>0).sort((t,r)=>t.booking.time.localeCompare(r.booking.time))},e.reservedOn=c,e.usedOn=function(t,r,n){const o={};for(const i of t)if(i.date===r)for(const t of i.holds??[])if(t.served)for(const[r,s]of Object.entries(a({...i,holds:[{...t,served:void 0}]},n)))o[r]=(o[r]??0)+s;return o},e.heldSummary=function(t,r,o){const i={},a={};for(const o of t)if(o.date===r&&n(o))for(const t of o.holds??[])if(!t.served){const r=s(t.id);'item'===t.kind?i[r]=(i[r]??0)+t.qty:a[r]=(a[r]??0)+t.qty}return{platters:Object.values(i).reduce((t,r)=>t+r,0),byItem:i,single:a,stock:c(t,r,o)}},e.holdsText=function(t,r,n){return(t.holds??[]).filter(t=>t.qty>0).map(t=>{const o=s(t.id);return`${'item'===t.kind?l(r.find(t=>t.id===o)?.name??'Reserved item'):n.find(t=>t.key===o)?.name??o} x${t.qty}${t.served?' (served)':''}`}).join(', ')},Object.defineProperty(e,"shortItem",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"needsAllergenSeen",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"needsHoldOk",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"hasAllergens",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"allergenText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"dogCount",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"hasAccess",{enumerable:!0,get:function(){return p}}),e.accessText=function(t){const r=t.access;return r?[r.wheelchair?`${r.wheelchair} wheelchair user${1===r.wheelchair?'':'s'}`:'',r.stepFree?'step-free access':'',r.toilet?'accessible toilet':'',r.assistDog?'assistance dog':'',r.note?.trim()??''].filter(Boolean).join(', '):''},Object.defineProperty(e,"dietText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"accessibleSetUp",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"dogSetUp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"isAccessible",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isDogOk",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dogsAt",{enumerable:!0,get:function(){return P}}),e.tableBlockReason=function(t,n,o,i,s){const a=t.tables.find(t=>t.name===n);return a?a.maxSeats0&&k(t)&&!(0,r.tableDogOk)(t,a)?'No dogs here':s&&O(t)&&!a.accessible?'Not step-free':'':'Not available'},Object.defineProperty(e,"holidayName",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"coverDone",{enumerable:!0,get:function(){return w}}),e.shownStatus=$,e.seatedCoversOn=function(t,r){return t.filter(t=>t.date===r&&['seated','finished'].includes($(t))).reduce((t,r)=>t+(r.partySize||0),0)},e.laterTodayCovers=function(t,r){return t.filter(t=>t.date===r&&!t.walkIn&&'walk-in'!==t.source&&['confirmed','pending'].includes($(t))).reduce((t,r)=>t+(r.partySize||0),0)},Object.defineProperty(e,"laterTodayLine",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"isWalkInBooking",{enumerable:!0,get:function(){return q}}),e.partiesLine=function(t){const r=t.filter(n),o=r.filter(t=>!q(t)).length,i=r.length-o;return`${o} ${1===o?'booking':'bookings'} \xb7 ${i} ${1===i?'walk-in':'walk-ins'}`},Object.defineProperty(e,"COVERS_FOUR_LABELS",{enumerable:!0,get:function(){return N}}),e.coversFour=T,e.coversCard=function(t,r,o){const i=t.filter(t=>t.date===r&&n(t)),s=t=>t.reduce((t,r)=>t+(r.partySize||0),0);return{...T(t,r),booked:s(i.filter(t=>!q(t))),walkIns:s(i.filter(q))}},e.coversToday=function(t,r){return T(t,r)};var t=_r(_d[0]),r=_r(_d[1]);const n=t=>!['cancelled','noshow'].includes(t.status),o=[{id:'seafood-platter-2',name:'Seafood Platter for 2',price:16e3,description:'Whole crab and lobster with all the trimmings, for two to share.',uses:[{key:'crab',qty:1},{key:'lobster',qty:1}],active:!0}],i=t=>(t?.settings.reservables??('anchorage'===t?.id?o:[])).filter(t=>t.active),s=t=>t.startsWith(':')?t.slice(1):t;function a(t,r,n=!1){const o={};for(const i of t.holds??[]){if(i.served&&!n)continue;const t=s(i.id);if('stock'===i.kind)o[t]=(o[t]??0)+i.qty;else for(const n of r.find(r=>r.id===t)?.uses??[])o[n.key]=(o[n.key]??0)+n.qty*i.qty}return o}function c(t,r,o,i){const s={};for(const c of t)if(c.date===r&&n(c)&&'finished'!==c.status&&c.id!==i)for(const[t,r]of Object.entries(a(c,o)))s[t]=(s[t]??0)+r;return s}const l=t=>/platter/i.test(t)?'Platter':t.replace(/ for \d+$/i,''),d=t=>n(t)&&(t.allergies.length>0||!!t.allergyNote?.trim())&&!t.allergyAck,u=t=>n(t)&&(t.holds??[]).some(t=>t.qty>0&&!t.served)&&!t.holdOk,f=t=>t.allergies.length>0||!!t.allergyNote?.trim(),b=r=>[r.allergies.map(r=>(0,t.allergenLabel)(r.allergen)).join(', '),r.allergyNote?.trim()].filter(Boolean).join(' \xb7 ')+(r.allergyPeople?` (${r.allergyPeople} ${1===r.allergyPeople?'person':'people'})`:''),y=t=>t.dogs??(t.dog?1:0),p=t=>!(!t.access||!(t.access.wheelchair||t.access.stepFree||t.access.toilet||t.access.assistDog||t.access.note?.trim()));const h=t=>[t.diet?.vegan?`${t.diet.vegan} vegan`:'',t.diet?.vegetarian?`${t.diet.vegetarian} vegetarian`:''].filter(Boolean).join(', '),O=t=>t.tables.some(t=>t.accessible),k=t=>t.tables.some(t=>void 0!==t.dogOk)||t.areas.some(t=>t.dogs),v=(t,r)=>r.split('+').every(r=>!!t.tables.find(t=>t.name===r.trim())?.accessible),j=(t,n)=>n.split('+').every(n=>{const o=t.tables.find(t=>t.name===n.trim());return!!o&&(0,r.tableDogOk)(t,o)}),P=(t,r,o,i)=>t.filter(t=>t.id!==i&&t.date===r&&t.time===o&&n(t)).reduce((t,r)=>t+y(r),0);const S=t=>t.replace(/\s*\(substitute day\)/gi,'').trim(),w=t=>'finished'===t.status;function $(t){if('seated'===t.status&&t.seatedAt){const r=new Date(t.seatedAt);if((isNaN(r.getTime())?t.date:r.toLocaleDateString('en-CA',{timeZone:'Europe/London'}))t>0?`${t} more ${1===t?'cover':'covers'} booked for later today.`:'No more bookings for later today.',q=t=>!!t.walkIn||'walk-in'===t.source;const N=['Done','Seated','To come','Total'];function T(t,r){const o=t.filter(t=>t.date===r&&n(t)),i=t=>t.reduce((t,r)=>t+(r.partySize||0),0),s=i(o.filter(w)),a=i(o.filter(t=>!w(t)&&'seated'===$(t))),c=i(o.filter(t=>!q(t)&&['confirmed','pending'].includes($(t))));return{done:s,seated:a,toCome:c,total:s+a+c}}},832,[819,1067]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SEASONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hourSetsOf",{enumerable:!0,get:function(){return n}}),e.seasonOn=s,e.kitchenHoursOn=l,e.hoursFor=function(r,n){const u=l(r,n);return u?{open:(0,t.atTime)(n,u[0]),close:(0,t.atTime)(n,u[1])}:null};var t=_r(_d[0]);const r=[{id:'winter',name:'Winter',hours:{0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']}},{id:'summer',name:'Summer',hours:null}],n=t=>t.settings.hourSets??('anchorage'===t.id?r:[]),u=t=>`${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,o=t=>`${t.getFullYear()}-${u(t)}`;function s(t,r){const o=n(t).filter(t=>t.hours);if(!o.length)return null;const s=o.filter(t=>t.start).sort((t,r)=>t.start.localeCompare(r.start));if(s.length<2)return s[0]??o[0];const l=u(r);return[...s].reverse().find(t=>t.start<=l)??s[s.length-1]}function l(t,r){const n=(t.settings.hourOverrides??[]).find(t=>t.date===o(r));if(n)return n.hours;const u=s(t,r);return u?.hours?u.hours[r.getDay()]??null:t.kitchenHours[r.getDay()]??null}},833,[822]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},834,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GoldX=h,_e.GoldClose=j,Object.defineProperty(_e,"TEXT_ONLY_CLOSE",{enumerable:!0,get:function(){return x}}),_e.ToastClose=function({onPress:e,label:o="Close",testID:s,size:l="md",style:c,colour:h}){return x?(0,b.jsx)(t.default,{testID:s,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:[{minWidth:64,minHeight:48,alignItems:'center',justifyContent:'center',paddingHorizontal:8},c],children:(0,b.jsx)(u.Text,{style:{fontSize:16,color:h??n.colours.text},children:"Close"})}):(0,b.jsx)(j,{onPress:e,label:o,testID:s,size:l,style:c})},r(d[0]);var t=e(r(d[1])),o=e(r(d[2])),s=r(d[3]),l=e(s),n=r(d[4]),c=r(d[5]),u=r(d[6]),b=r(d[7]);function h({size:e=16,colour:t=n.colours.gold,stroke:o}){const c=o??(e>=20?2.4:2.2);return(0,b.jsx)(l.default,{width:e,height:e,viewBox:"0 0 24 24",accessible:!1,focusable:!1,pointerEvents:"none",children:(0,b.jsx)(s.Path,{d:"M6 6 L18 18 M18 6 L6 18",stroke:t,strokeWidth:Math.min(4,c*(24/e)),strokeLinecap:"round",fill:"none"})})}const f={sm:32,md:38,lg:46},y={sm:13,md:15,lg:18};function j({onPress:e,label:s="Close",testID:l,size:c="md",style:u,disabled:j,hint:x}){const C=f[c],I=Math.max(44,C+8);return(0,b.jsx)(t.default,{testID:l,accessibilityRole:"button",accessibilityLabel:s,accessibilityHint:x,disabled:j,onPress:e,dataSet:{goldClose:'1'},style:[{width:I,height:I,alignItems:'center',justifyContent:'center',flexShrink:0,opacity:j?.4:1},u],children:({pressed:e,hovered:t})=>(0,b.jsx)(o.default,{style:{width:C,height:C,borderRadius:C/2,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:e||t?n.colours.gold:n.colours.accentBorder,backgroundColor:e?n.colours.goldTint:t?n.colours.accentBg:'rgba(0,0,0,0.18)'},children:(0,b.jsx)(h,{size:y[c],colour:e?n.colours.goldLight:n.colours.gold})})})}const x=['kirkton','abbotsford'].includes(c.VENUE_RID)},835,[31,264,128,987,825,5,873,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return l}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,l=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},836,[993]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:l,declared:s}){return(0,c.jsxs)(a.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,c.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(d.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,n.isLiveVenue)()?null:(0,c.jsx)(d.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,c.jsx)(a.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:t.ALLERGENS.map(e=>{const n=l[e.id],u=s.find(l=>l.allergen===e.id),f='contains'===n?o.colours.redBg:'may'===n?o.colours.amberBg:o.colours.surface2,h='contains'===n?'#FFD9D4':'may'===n?'#FFE2A8':o.colours.muted;return(0,c.jsxs)(a.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:u?2:1,borderColor:u?o.colours.red:o.colours.border},children:[(0,c.jsx)(d.T,{size:14,weight:"medium",colour:n?h:o.colours.text,children:e.label}),(0,c.jsxs)(d.T,{size:13,colour:h,children:['contains'===n?'Contains':'may'===n?'May contain':'Not listed',u?` \xb7 YOUR ALLERGY (${(0,t.severityLabel)(u.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,c.jsxs)(d.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,c.jsx)(a.default,{testID:"allergen-signoff",children:(0,c.jsx)(d.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${u(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,c.jsx)(d.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:l,declared:n,signedOff:s}){const a=Object.entries(l);return a.length?(0,c.jsx)(d.Row,{wrap:!0,gap:5,children:a.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,l])=>{const s=n.some(l=>l.allergen===e);return(0,c.jsx)(d.Badge,{label:`${s?'\u26a0 ':''}${(0,t.allergenLabel)(e)}${'may'===l?' (may)':''}`,kind:s?'contains'===l?'red':'amber':'neutral'},e)})}):(0,c.jsx)(d.Muted,{children:(0,e.noAllergenWords)(s)})};var e=r(_d[0]);r(_d[1]);var l,n=r(_d[2]),s=r(_d[3]),a=(l=s)&&l.__esModule?l:{default:l},t=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]);const u=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},837,[1267,31,1096,128,819,825,818,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BasketButton=function(){const s=(0,l.useBasket)().lines.reduce((e,s)=>e+s.qty,0);return s?(0,c.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Basket, ${s} items`,onPress:()=>e.router.push('/customer/basket'),style:{backgroundColor:u.colours.gold,borderRadius:999,paddingHorizontal:12,paddingVertical:6},children:(0,c.jsxs)(n.T,{weight:"semibold",colour:u.colours.onGold,size:14,children:["Basket \xb7 ",s]})}):null};var e=r(d[0]);r(d[1]);var s,t=r(d[2]),o=(s=t)&&s.__esModule?s:{default:s},l=r(d[3]),u=r(d[4]),n=r(d[5]),c=r(d[6])},838,[805,31,264,823,825,818,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setRecipeCardRepository=function(n){t=n,r.forEach(t=>t())},e.recipeCards=function(){if(!t)throw new Error('Recipe card repository not set up');return t},Object.defineProperty(e,"hasRecipeCards",{enumerable:!0,get:function(){return n}}),e.onRepositorySwap=function(t){return r.add(t),()=>{r.delete(t)}};let t=null;const r=new Set;const n=()=>!!t},839,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Stars=function({value:e,onChange:s,size:n=36}){return(0,c.jsx)(t.Row,{gap:6,children:[1,2,3,4,5].map(u=>(0,c.jsx)(l.default,{disabled:!s,accessibilityRole:"button",accessibilityLabel:`${u} star${u>1?'s':''}`,onPress:()=>s?.(u),hitSlop:4,children:(0,c.jsx)(t.T,{size:n,colour:u<=e?o.colours.gold:'#555',children:"\u2605"})},u))})},r(d[0]);var e,s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),c=r(d[4])},840,[31,264,825,818,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},841,[31,123,264,128,881,818,825,978,1498,1499,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_VENUE_SLUGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LIVE_VENUE_BUILD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return n}});var c=r(d[0]);const b=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"],f=b.includes(c.VENUE_RID),n=c=>b.includes(c)||['6349aa07-3fec-46e9-8c69-7b1b08494793','41ce63ca-ae46-432d-a5ba-25e1b801e64d','43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6','47f86b36-4c99-466a-be9c-30eb3d79f1e1','e0afad1d-cbc1-414a-add6-92e47d302139','24624ea5-d1e3-4182-b0d1-73402b8a1532','1bc2a056-2ef6-4585-abfd-b7d21c84f215',"59766322-119e-4036-a18a-f6909f60a8d2","596c6f7e-9797-4e16-84fe-db4a99fa1bdc","5d500571-e205-4ead-bb58-60e986b6f40e","f43f20ad-55d0-4008-88c8-7738dc1698df","6abc2793-93ab-4e23-a705-b4011a5cc011","78bff97d-5f07-440a-bb99-f6a6118da7a3","cd985ff5-2443-458d-ac8b-342d553628cf","35f870fc-772c-4aad-bb9e-09a9a16bc925","f500ef12-b405-438b-9671-e54289bec5dd"].includes(c)},842,[5]); +__d(function(_g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MockPay=function({visible:e,onClose:h,amount:p,restaurantId:j,allowGiftCard:b=!0,onPaid:x,title:f="Pay"}){const y=(0,o.useRestaurant)(j),g=(0,o.useGiftCards)(j).filter(e=>e.balance>0),[m,w]=(0,s.useState)(),[P,C]=(0,s.useState)('Test card \u2022\u2022\u2022\u2022 4242'),[T,v]=(0,s.useState)(!1),M=g.find(e=>e.code===m),R=M?Math.min(M.balance,p):0,_=p-R;if(!y?.fictional)return(0,u.jsxs)(c.Sheet,{visible:e,onClose:h,title:f,children:[(0,u.jsxs)(c.T,{children:["Online card payment isn\u2019t set up for this yet, so nothing can be paid here. Please ask at the restaurant",y?.phone?` or phone ${y.phone}`:'',"."]}),(0,u.jsx)(c.Button,{kind:"secondary",label:"Close",onPress:h})]});return(0,u.jsxs)(c.Sheet,{visible:e,onClose:h,title:f,children:[(0,u.jsx)(c.DemoPaymentNotice,{}),b&&g.length>0?(0,u.jsxs)(l.default,{style:{gap:6},children:[(0,u.jsx)(c.T,{weight:"semibold",children:"Use a gift card"}),(0,u.jsxs)(c.Row,{wrap:!0,children:[(0,u.jsx)(c.Chip,{label:"None",selected:!m,onPress:()=>w(void 0)}),g.map(e=>(0,u.jsx)(c.Chip,{label:`${e.code.slice(0,8)}\u2026`,sub:`${(0,n.gbp)(e.balance)} left`,selected:m===e.code,onPress:()=>w(e.code)},e.id))]})]}):null,(0,u.jsx)(c.T,{weight:"semibold",children:"Payment method"}),(0,u.jsx)(c.Row,{wrap:!0,children:['Test card \u2022\u2022\u2022\u2022 4242','Apple Pay (test)','Google Pay (test)'].map(e=>(0,u.jsx)(c.Chip,{label:e,selected:P===e,onPress:()=>C(e)},e))}),(0,u.jsxs)(l.default,{style:{gap:2},children:[(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.Muted,{children:"Amount"}),(0,u.jsx)(c.T,{children:(0,n.gbp)(p)})]}),R?(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.Muted,{children:"Gift card"}),(0,u.jsxs)(c.T,{colour:r.colours.ok,children:["\u2212",(0,n.gbp)(R)]})]}):null,(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.T,{weight:"semibold",children:"To pay now"}),(0,u.jsx)(c.T,{weight:"bold",size:20,colour:r.colours.gold,children:(0,n.gbp)(_)})]})]}),T?(0,u.jsx)(t.default,{color:r.colours.gold}):(0,u.jsx)(c.Button,{label:`Pay ${(0,n.gbp)(_)} \u2014 demo`,onPress:()=>{v(!0),setTimeout(()=>{v(!1),x({giftCardCode:m,giftApplied:R,method:P})},700)},testID:"mock-pay-confirm"})]})};var s=_r(d[0]),t=e(_r(d[1])),l=e(_r(d[2])),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7])},843,[31,247,128,823,820,825,818,25]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftLive=function({slug:e,venue:n}){const{info:x,mine:b,err:S,load:w,pay:k}=j(e),[T,P]=(0,t.useState)(null),[D,C]=(0,t.useState)(''),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(''),[I,M]=(0,t.useState)(''),[E,L]=(0,t.useState)(!1),[R,A]=(0,t.useState)(''),[_,H]=(0,t.useState)(null),F=f(e);if(!x)return(0,h.jsx)(a.Screen,{title:"Gift cards",subtitle:n,children:S?(0,h.jsx)(a.Banner,{kind:"warn",title:S}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const N=D?(0,o.poundsToPence)(D)??0:T??x.amounts[1]??x.amounts[0]??0;return(0,h.jsxs)(a.Screen,{title:"Gift cards",subtitle:`${n}: used only at ${n}`,children:[_?(0,h.jsx)(s.default,{testID:"gift-made",children:(0,h.jsx)(a.Card,{highlight:u.colours.gold,children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift card code"}),(0,h.jsx)(a.T,{size:26,weight:"bold",colour:u.colours.gold,center:!0,children:_.code}),(0,h.jsxs)(a.Muted,{center:!0,children:["Shown once and kept on this phone. Write it down or take a screenshot to give it to ",O||'them',"."]}),(0,h.jsxs)(a.Banner,{kind:"warn",title:`Pay ${(0,l.gbp)(_.pence)} at the bar or till`,children:["Show reference ",_.ref,". The card works once staff mark it paid.",k.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"gift",id:_.id,pay:k})]})})}):null,(0,h.jsx)(g,{onDone:w}),(0,h.jsx)(s.default,{testID:"gift-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift cards"}),b.cards.length?b.cards.map(t=>(0,h.jsxs)(s.default,{style:{gap:2},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{style:{flex:1},children:F[t.id]??`\u2022\u2022\u2022\u2022 ${t.last4}`}),(0,h.jsxs)(a.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balancePence)," of ",(0,l.gbp)(t.initialPence)]})]}),(0,h.jsxs)(a.Muted,{size:12,children:[o.STATUS_WORDS[t.status]??t.status,t.expiresAt?` \xb7 use by ${p(t.expiresAt)}`:'','waiting-payment'===t.status?` \xb7 reference ${t.ref}`:'']}),'waiting-payment'===t.status&&_?.id!==t.id?(0,h.jsx)(m,{slug:e,kind:"gift",id:t.id,pay:k}):null]},t.id)):(0,h.jsx)(a.Muted,{children:"None yet."})]})})}),x.giftsOn?(0,h.jsx)(s.default,{testID:"gift-buy",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:8},children:[(0,h.jsx)(a.H2,{children:"Buy a gift card"}),(0,h.jsx)(a.Row,{wrap:!0,children:x.amounts.map(e=>(0,h.jsx)(a.Chip,{label:(0,l.gbp)(e),selected:!D&&N===e,onPress:()=>{C(''),P(e)}},e))}),(0,h.jsx)(a.Field,{label:`Or another amount (\xa3${x.minPence/100} to \xa3${x.maxPence/100})`,keyboardType:"decimal-pad",value:D,onChangeText:C,placeholder:"e.g. 40",testID:"gift-custom"}),(0,h.jsx)(a.Field,{label:"Who it\u2019s for",value:O,onChangeText:$,testID:"gift-recipient"}),(0,h.jsx)(a.Field,{label:"From",value:v,onChangeText:B}),(0,h.jsx)(a.Field,{label:"Message",value:I,onChangeText:M,multiline:!0,placeholder:"Happy birthday!"}),(0,h.jsxs)(a.Muted,{size:12,children:["Use within ",(0,o.expiryWords)(x.expiryMonths)," of paying. Part-use leaves a balance.",x.terms?` ${x.terms}`:'']}),(0,h.jsx)(s.default,{testID:"gift-pay-placeholder",children:(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER})}),R?(0,h.jsx)(a.Banner,{kind:"warn",title:R}):null,(0,h.jsx)(a.Button,{label:E?'Saving\u2026':`Get a ${(0,l.gbp)(N)} gift card, pay at the till`,testID:"gift-buy-btn",disabled:E||Nx.maxPence,onPress:async()=>{L(!0),A('');try{const t=await(0,c.buyGift)(e,{amount:N,recipient:O,from:v,message:I});t.code&&y(e,t.id,t.code),H({id:t.id,code:t.code??'',ref:t.ref,pence:t.initialPence}),w()}catch(e){A((0,r.plainError)(e))}finally{L(!1)}}})]})})}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n} isn\u2019t selling gift cards in the app yet`,children:"Ask at the bar."})]})},_e.ShopLive=function({slug:e,venue:n,guestName:p}){const{info:x,mine:f,err:y,load:b,pay:S}=j(e),[w,k]=(0,t.useState)({}),[T,P]=(0,t.useState)(p),[D,C]=(0,t.useState)(!1),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(null);if(!x)return(0,h.jsx)(a.Screen,{title:"Shop",subtitle:n,children:y?(0,h.jsx)(a.Banner,{kind:"warn",title:y}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const I=Object.entries(w).filter(([,e])=>e>0).map(([e,t])=>({id:e,qty:t})),M=(0,o.basketTotal)(I,x.products);return(0,h.jsxs)(a.Screen,{title:"Shop",subtitle:`${n}: collect at the venue`,children:[v?(0,h.jsxs)(s.default,{testID:"shop-done",children:[(0,h.jsxs)(a.Banner,{kind:"warn",title:`Order ${v.ref}: pay ${(0,l.gbp)(v.total)} at the bar or till`,children:["Staff will have it ready to collect once it\u2019s paid.",S.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"shop",id:v.id,pay:S})]}):null,(0,h.jsx)(g,{onDone:b}),x.shopOn?(0,h.jsxs)(h.Fragment,{children:[x.products.length?x.products.map(e=>(0,h.jsx)(s.default,{testID:`shop-item-${e.id}`,children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,h.jsx)(a.T,{colour:u.colours.gold,children:(0,l.gbp)(e.pricePence)})]}),e.details?(0,h.jsx)(a.Muted,{children:e.details}):null,e.soldOut?(0,h.jsx)(a.Badge,{kind:"amber",label:"Sold out"}):(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(a.Muted,{children:"How many"}),(0,h.jsx)(a.Stepper,{value:w[e.id]??0,min:0,max:20,label:`${e.name} quantity`,onChange:t=>k({...w,[e.id]:t})})]})]})})},e.id)):(0,h.jsx)(a.Muted,{children:"Nothing in the shop yet."}),I.length?(0,h.jsx)(s.default,{testID:"shop-basket",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",children:"Total"}),(0,h.jsx)(a.T,{weight:"semibold",colour:u.colours.gold,children:(0,l.gbp)(M)})]}),(0,h.jsx)(a.Field,{label:"Name for collection",value:T,onChangeText:P,testID:"shop-name"}),(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER}),O?(0,h.jsx)(a.Banner,{kind:"warn",title:O}):null,(0,h.jsx)(a.Button,{label:D?'Sending\u2026':'Order, pay at the till',testID:"shop-order-btn",disabled:D||!T.trim(),onPress:async()=>{C(!0),$('');try{const t=await(0,c.shopOrder)(e,I,T);B({id:t.id,ref:t.ref,total:t.totalPence}),k({}),b()}catch(e){$((0,r.plainError)(e))}finally{C(!1)}}})]})})}):null]}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n}\u2019s shop isn\u2019t open in the app yet`,children:"Ask at the bar."}),f.orders.length?(0,h.jsx)(s.default,{testID:"shop-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsx)(a.H2,{children:"Your shop orders"}),f.orders.map(e=>(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(a.T,{style:{flex:1},children:[e.ref," \xb7 ",e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')]}),(0,h.jsx)(a.Muted,{children:o.STATUS_WORDS[e.status]??e.status})]},e.ref))]})})}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},a=_r(d[2]),l=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]);const p=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},x=e=>`cc-gift-codes:${e}:v1`;function f(e){try{return JSON.parse(globalThis.localStorage?.getItem(x(e))||'{}')}catch{return{}}}function y(e,t,n){try{const s=f(e);s[t]=n,globalThis.localStorage?.setItem(x(e),JSON.stringify(s))}catch{}}function j(e){const[n,s]=(0,t.useState)(null),[a,l]=(0,t.useState)({cards:[],orders:[]}),[o,u]=(0,t.useState)(''),[h,p]=(0,t.useState)({provider:'none',cardOn:!1,testMode:!0}),x=(0,t.useCallback)(()=>{u(''),(0,c.shopPublic)(e).then(s).catch(e=>u((0,r.plainError)(e))),(0,c.myShop)(e).then(l).catch(()=>{}),(0,c.payPublic)(e).then(p)},[e]);return(0,t.useEffect)(()=>{x()},[x]),{info:n,mine:a,err:o,load:x,pay:h}}function g({onDone:e}){const[n,l]=(0,t.useState)('');return(0,t.useEffect)(()=>{const t='undefined'!=typeof window?new URLSearchParams(window.location.search).get('paid'):null;if(!t||!/^[0-9a-f-]{36}$/.test(t))return;let n=0;const s=()=>(0,c.payStatus)(t).then(t=>{l(t.status),'paid'===t.status?e():n++<10&&setTimeout(s,2e3)}).catch(()=>{});s()},[e]),n?(0,h.jsx)(s.default,{testID:"pay-back",children:(0,h.jsx)(a.Banner,{kind:'paid'===n?'success':'warn',title:'paid'===n?'Paid by card (TEST MODE: no real money)':'expired'===n?'The card payment timed out. Pay at the bar or till.':'Checking the card payment\u2026'})}):null}function m({slug:e,kind:n,id:l,pay:o}){const[u,p]=(0,t.useState)(!1),[x,f]=(0,t.useState)('');return o.cardOn?(0,h.jsxs)(s.default,{testID:`pay-card-${n}`,style:{gap:4},children:[(0,h.jsx)(a.Button,{label:u?'Opening card payment\u2026':'Pay by card (TEST MODE)',kind:"secondary",disabled:u,onPress:async()=>{p(!0),f('');try{const t=await(0,c.payStart)(e,n,l);window.location.assign(t.url)}catch(e){f((0,r.plainError)(e))}finally{p(!1)}}}),(0,h.jsx)(a.Muted,{size:12,children:"Test mode: use a Stripe test card. No real money is taken."}),x?(0,h.jsx)(a.Banner,{kind:"warn",title:x}):null]}):null}},844,[31,128,818,820,1069,1070,1071,825,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"guestServer",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"useGuestLoyalty",{enumerable:!0,get:function(){return _}}),e.refreshGuest=async function(t){if(!c())return;_.setState(n=>({loading:{...n.loading,[t]:!0}}));try{const n=await(0,o.rpc)('loyalty_public',{p_venue_slug:t});if(_.setState(r=>({info:{...r.info,[t]:n}})),await(0,o.guestSession)()){const n=await(0,o.rpc)('loyalty_my_card',{p_venue_slug:t});_.setState(r=>({card:{...r.card,[t]:n??null}}))}}finally{_.setState(n=>({loading:{...n.loading,[t]:!1}}))}},e.guestJoin=async function(t,n){if(!await(0,o.guestSession)())throw new Error('No connection. Try again when you are back online.');const r=await(0,o.rpc)('loyalty_guest_join',{p_venue_slug:t,p_name:n.name.trim(),p_phone:n.phone.trim()||null,p_email:n.email.trim()||null,p_consent:n.consent,p_consent_text:n.consentText,p_referral:n.referral?(0,l.cleanCode)(n.referral):null});return p(t,r),r},e.guestClaim=async function(t,n){if(!await(0,o.guestSession)())return{ok:!1,error:'No connection. Try again when you are back online.'};const r=await(0,o.rpc)('loyalty_guest_claim',{p_venue_slug:t,p_code:(0,l.cleanCode)(n)});return r?.error?{ok:!1,error:String(r.error)}:(p(t,r),{ok:!0,card:r,linked:!!r.linked})},e.guestLinkCode=async function(t){return(0,o.rpc)('loyalty_guest_link_code',{p_venue_slug:t})},e.guestLeave=async function(t){await(0,o.rpc)('loyalty_guest_leave',{p_venue_slug:t}),p(t,null)},Object.defineProperty(e,"staffFind",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"staffCard",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"staffStamp",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"staffRedeem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"staffJoin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"staffCode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"staffRemove",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"loyaltySummary",{enumerable:!0,get:function(){return P}}),e.readSettings=async function(){const{data:t,error:n}=await u().from('loyalty_settings').select('*').eq('venue_id',y()).maybeSingle();if(n)throw n;return(0,l.settingsFromRow)(t)},e.saveSettings=async function(t){const{error:n}=await u().from('loyalty_settings').upsert({venue_id:y(),...(0,l.settingsToRow)(t),updated_by:(o.useSync.getState().staffRef??'').slice(0,80)||'manager',updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readOffers=k,e.saveOffer=C,e.watchLoyalty=function(t){if(!f())return()=>{};const n=y();let r=u().channel(`cc-loyalty:${n}:${Math.random().toString(36).slice(2,8)}`);for(const o of['loyalty_settings','loyalty_offers','loyalty_guests','loyalty_stamps','loyalty_rewards','loyalty_referrals'])r=r.on('postgres_changes',{event:'*',schema:'public',table:o,filter:`venue_id=eq.${n}`},()=>t());return r.subscribe(),()=>{try{u().removeChannel(r)}catch{}}},e.migrateLocalOnce=async function(t,n,r){if(!f())return 0;const o=`loyalty:migrated:${y()}`;if(await n(o))return 0;let s=0;if(!(await k()).length)for(const n of t.offers.filter(t=>'offer'===t.kind&&!JSON.stringify(t).includes('(example)')))await C({title:n.title.slice(0,80),details:(n.body??'').slice(0,500),startsOn:null,endsOn:n.until??null,isOn:!!n.live}),s++;return await r(o),s};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=_r(d[3]),s=_r(d[4]),l=_r(d[5]);const u=()=>(0,n.getSupabase)(),c=()=>(0,r.isSupabaseConfigured)()&&!s.PITCH,f=()=>c()&&'staff'===o.useSync.getState().kind&&!!o.useSync.getState().venueId,y=()=>{const t=o.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},_=(0,t.create)(()=>({info:{},card:{},loading:{}}));const p=(t,n)=>_.setState(r=>({card:{...r.card,[t]:n}}));const b=t=>(0,o.rpc)('loyalty_staff_find',{p_venue:y(),p_q:t}),w=t=>(0,o.rpc)('loyalty_staff_card',{p_guest:t}),v=t=>(0,o.rpc)('loyalty_staff_stamp',{p_guest:t}),S=t=>(0,o.rpc)('loyalty_staff_redeem',{p_reward:t}),O=t=>(0,o.rpc)('loyalty_staff_join',{p_venue:y(),p_name:t.name.trim(),p_phone:t.phone.trim()||null,p_email:t.email.trim()||null,p_consent:t.consent,p_consent_text:t.consentText}),h=(t,n)=>(0,o.rpc)('loyalty_staff_code',{p_venue:y(),p_kind:t,p_guest:n??null}),j=t=>(0,o.rpc)('loyalty_staff_remove',{p_guest:t}),P=()=>(0,o.rpc)('loyalty_summary',{p_venue:y()});async function k(){const{data:t,error:n}=await u().from('loyalty_offers').select('*').eq('venue_id',y()).order('created_at');if(n)throw n;return(t??[]).map(l.offerFromRow)}async function C(t){const n={venue_id:y(),title:t.title.trim(),details:t.details.trim(),starts_on:t.startsOn||null,ends_on:t.endsOn||null,is_on:t.isOn,updated_at:(new Date).toISOString()},{error:r}=t.id?await u().from('loyalty_offers').update(n).eq('id',t.id):await u().from('loyalty_offers').insert(n);if(r)throw r}},845,[993,871,1168,824,2,1069]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},860,[31,264,128,288,818,825,1466,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"leaveOn",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"leaveRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return b}}),_e.liveAttendance=function(e){const t=y.get(e);if(t)return t;const n=e.some(e=>e.voided)?e.filter(e=>!e.voided):e;return y.set(e,n),n},Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return P}}),_e.openShiftOf=A,_e.loggedBreakMins=M,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return F}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),n=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,n)=>t&&n.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${n} (${t})`:n},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return Q}});var e,t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),i=_r(_d[3]),s=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=(e=d)&&e.__esModule?e:{default:e},f=_r(_d[8]),u=_r(_d[9]),l=_r(_d[10]),p=_r(_d[11]);const m=(e,t,n)=>e.find(e=>e.staffId===t&&'approved'===e.status&&e.from<=n&&n<=e.to),h={decide:null},g=e=>e.out?e.signOff?'confirmed':'awaiting':'open',b=e=>!!e.out&&!!e.signOff,y=new WeakMap;const k={send:null},I=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,w=e=>{const[t,n,a]=e.split('-').map(Number);return(new Date(t,n-1,a).getDay()+6)%7},E=(e,t)=>{const[n,a,i]=e.split('-').map(Number);return I(new Date(n,a-1,i+t))},S=e=>E(e,-w(e)),O=(e,t)=>e.filter(e=>e.date===t),v=(e,t,n)=>e.find(e=>e.staffId===t&&e.date===n),R=(e,t)=>t?e:e.filter(e=>e.published),_=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],$=1271,L=6,D=['ql-wix-view','ql-wix-edit'],T=e=>D.includes(e.id)||'Website bookings'===e.group,P=[{id:'ql-gmail',label:'Work email (Gmail)',url:'',icon:'\u2709\ufe0f',kind:'gmail',staff:!1,builtIn:!0},{id:'ql-wix-view',label:'View site',url:'https://www.anchoragedunure.com',icon:'\ud83c\udf10',kind:'link',group:'Website bookings',staff:!1,builtIn:!0},{id:'ql-wix-edit',label:'Edit site',url:'https://manage.wix.com',icon:'\ud83d\udd8a\ufe0f',kind:'link',group:'Website bookings',staff:!1,builtIn:!0}];function A(e,t,n){const a=new Date(n).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&a-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function M(e,t=new Date){const n=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():n)-new Date(t.start).getTime()),0)/6e4)}const j=e=>!!e?.breaks?.some(e=>!e.end),N=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,C=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function B(){return l.ROSTER.map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},role:e.role,job:e.job,active:!0,level:e.level,dept:e.dept,salaried:e.salaried,noTax:e.noTax,...U.includes(e.id)?{displayClock:!0}:{}}))}const U=['st-jack'];function V(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const q=()=>{const e={tronc:{method:'hours',points:{FOH:1,Bar:1,Kitchen:.8,KP:.6,Manager:1},includeManagers:!0,includeOwner:!1,custom:{},text:'The Anchorage tipping policy (template)\n\n1. 100% of tips paid by card and cash tips put in the tip jar go to staff. Nothing is deducted.\n2. Tips are pooled and shared by paid hours worked in each pay period (breaks excluded).\n3. The owner does not take a share. Managers share only for hours worked on the floor or in the kitchen.\n4. Tips are paid with wages, no later than the end of the month after the tip was paid.\n5. Tip records are kept for 3 years. Ask a manager for your records at any time.'},troncCash:{},troncHistory:[],troncLog:[],chat:[],chatMuted:{},chatRead:{},referral:{giverReward:'Free dessert',friendReward:'\xa35 off first order',active:!0},referrals:[],reminders:{h24:!0,h2:!0,confirmText:!0},coats:[],merch:[],merchOrders:[],marketingDraft:void 0,socialAccounts:{facebook:!0,instagram:!0,tiktok:!0,youtube:!0},socialPosts:[],socialDraft:void 0,quickLinks:P.map(e=>({...e})),workEmail:'',staff:B(),rosterVersion:l.ROSTER_VERSION,previewRole:'owner',staffAs:l.ROSTER.find(e=>'staff'===e.app)?.id??l.ROSTER[0]?.id??'',offers:[],photos:[],changeRequests:[],changesUsed:2,site:t.VENUE_RID,branding:{},checks:{},lost:[],lostReports:[],campaigns:[],shifts:[],rotaPublished:void 0,leave:[],swaps:[],availability:{},attendance:[],attLog:[],timeRequests:[],geofence:{lat:55.4047,lng:-4.7606,radius:100},simLocation:'venue',consent:{},hourly:V(),payPeriod:'weekly',suppliers:[],supplierOrders:[],staffCanViewSuppliers:!1,readNotes:{},customerTags:{'cust-demo':['Allergy','Regular'],'cr-2':['VIP'],'cr-5':['Takeaway']}};if(s.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE)return{...e,changesUsed:0,customerTags:{},socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1}};if(!t.IS_ISOLATED_VENUE)return e;for(const t of Object.keys(e))Array.isArray(e[t])&&(e[t]=[]);return{...e,site:t.VENUE_RID,staffAs:'',hourly:{},customerTags:{},geofence:{lat:0,lng:0,radius:100},tronc:{...e.tronc,text:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].name+' tipping policy \u2014 to confirm.':t.IS_ABBOTSFORD?'The Abbotsford Hotel tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKTON?'The Kirkton Inn tipping policy \u2014 awaiting venue confirmation.':t.IS_GREENSIDE?'The Greenside Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_WILDINGS?'Wildings Hotel & Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKMICHAEL?"The Kirkmichael Arms tipping policy \u2014 awaiting venue confirmation.":"Souter's Inn tipping policy \u2014 awaiting venue confirmation."},changesUsed:0,socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1},quickLinks:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?[]:t.IS_GREENSIDE?[{id:'greenside-phone',label:'Call 01655 889685',url:'tel:01655889685',icon:'',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_WILDINGS?[{id:'wildings-phone',label:'Call to book',url:'tel:01655331401',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0},{id:'wildings-email',label:'Email to book',url:'mailto:bookings@wildingsrestaurant-hotel.co.uk',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_KIRKMICHAEL?[{id:'kirkmichael-site',label:'Venue website',url:'https://www.kirkmichaelarms.co.uk/',icon:'\ud83c\udf10',kind:'link',group:'Website',staff:!0,builtIn:!0}]:[{id:'souters-book',label:'Guest table requests',url:'https://covercharge-apps.static.hf.space/souters/customer-app/',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}],branding:{[t.VENUE_RID]:{accent:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?a.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},x=(0,f.create)()((0,u.persist)((e,n)=>({...q(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,n,a)=>e(e=>({staff:[...e.staff,{id:N('st'),name:t,role:n,job:a,active:!0,level:W[n]}]})),saveSupplier:t=>e(e=>({suppliers:e.suppliers.some(e=>e.id===t.id)?e.suppliers.map(e=>e.id===t.id?t:e):[...e.suppliers,t]})),setRate:(t,n)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(n))}})),clearRate:t=>e(e=>{const n={...e.hourly};return delete n[t],{hourly:n}}),updateStaff:(t,n)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...n}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:N('of')},...e.offers]})),updateOffer:(t,n)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...n}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:N('ph'),caption:t,tone:C[e.photos.length%C.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,n)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:N('cr'),text:t,at:n,status:'requested'},...e.changeRequests]}),setSite:n=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:n}),setBranding:(t,n)=>e(e=>{const a={...e.branding};return n?a[t]={...a[t],...n}:delete a[t],{branding:a}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:N('sp')},...e.socialPosts]})),setSocialPost:(t,n)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...n}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,n,a)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[n]??[];return{...e,reactions:{...e.reactions,[n]:i.includes(a)?i.filter(e=>e!==a):[...i,a]}}})})),chatSeen:(t,n)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(n))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(n)?e:{...e,seenBy:[...e.seenBy,n]})}:e),chatMarkRead:(t,n)=>e(e=>{const a={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(n))(!a[e]||Date.parse(t)>Date.parse(a[e]))&&(a[e]=t);const i=e=>Math.max(Date.parse(a['*']??'')||0,Date.parse(a[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:a},chat:s}}),chatPatch:(t,n)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...n}:e)})),chatMute:(t,n)=>e(e=>{const a=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),sys:(t,n,a)=>e(e=>({chat:[...e.chat,{id:N('m'),ch:t,from:'system',text:n,at:a,reactions:{},seenBy:[]}]})),tick:(t,n,a,i)=>e(e=>({checks:{...e.checks,[t]:{by:n,at:a,value:i}}})),untick:t=>e(e=>{const n={...e.checks};return delete n[t],{checks:n}}),addLost:t=>e(e=>({lost:[{...t,id:N('lp'),status:'held'},...e.lost]})),setLost:(t,n)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...n}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:N('cp')},...e.campaigns]})),setCampaign:(t,n)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...n}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:w(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:w(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,a)=>{const i=n(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const n=E(t,e),o=E(a,e);i.shifts.filter(e=>e.date===n&&s.has(e.staffId)&&!m(i.leave,e.staffId,o)&&!i.shifts.some(t=>t.staffId===e.staffId&&t.date===o)&&!r.some(t=>t.staffId===e.staffId&&t.date===o)).forEach(e=>r.push({id:(0,p.uuid)(),staffId:e.staffId,date:o,day:w(o),start:e.start,end:e.end,note:e.note,published:!1}))}return r.length&&e({shifts:[...i.shifts,...r]}),r.length},publishWeek:t=>{const n=E(t,6);let a=0;return e(e=>({shifts:e.shifts.map(e=>e.daten||e.published&&!e.changed?e:(a++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),a},removeShift:t=>e(e=>({shifts:e.shifts.filter(e=>e.id!==t)})),markRead:t=>e(e=>({readNotes:{...e.readNotes,...Object.fromEntries(t.map(e=>[e,!0]))}})),toggleTag:(t,n)=>e(e=>{const a=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>{const n={...t,id:(0,p.uuid)(),status:t.status??'pending'};return e(e=>({leave:[n,...e.leave]})),n},setLeave:(t,a)=>{e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:a}:e)}));const i=n().leave.find(e=>e.id===t);i&&h.decide?.(i)},addSwap:t=>e(e=>({swaps:[{...t,id:N('sw'),status:'open'},...e.swaps]})),setSwap:(t,n)=>e(e=>{const a=e.swaps.find(e=>e.id===t);return{shifts:'approved'===n&&a?.toId?e.shifts.map(e=>e.id===a.shiftId?{...e,staffId:a.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:n}:e)}}),toggleAvail:(t,n)=>e(e=>{const a=e.availability[t]??[];return{availability:{...e.availability,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),clock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.filter(e=>e.staffId===t&&e.in&&!e.out&&new Date(i).getTime()-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0];if('in'===a)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:n,in:i,inSite:s}]};const d=e=>e?.map(e=>e.end?e:{...e,end:i});return o?{attendance:e.attendance.map(e=>e.id===o.id?{...e,out:i,outSite:s,breakMins:r??M({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.find(e=>e.id===t),d=e.staff.find(e=>e.id===o?.staffId),c=o?.[n]?new Date(o[n]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[n]:a,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:N('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${n} from ${c} to ${new Date(a).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,n,a)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...n,geo:a?[...e.geo??[],a].slice(-20):e.geo}:e)})),breakToggle:(t,a,i)=>{const s=n(),r=A(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===a?d:!d)return!1;const c='start'===a?[...o,{start:i}]:o.map(e=>e.end?e:{...e,end:i});return e({attendance:s.attendance.map(e=>e.id===r.id?{...e,breaks:c,breakMins:M({breaks:c})}:e)}),!0},adjustBreak:(t,n,a,i,s)=>e(e=>{const r=e.attendance.find(e=>e.id===t),o=e.staff.find(e=>e.id===r?.staffId);return{attendance:e.attendance.map(e=>e.id===t?{...e,breakMins:n,adjusted:{by:a,at:s,reason:i}}:e),attLog:[{id:N('al'),at:s,text:`${a} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${n}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const a=n(),i=t.id?a.attendance.find(e=>e.id===t.id):void 0,s=t.reason.trim();if(s.length<3)return null;if(t.out&&t.out<=t.in)return null;const r=e=>e?new Date(e).toTimeString().slice(0,5):'none',o=(e,n,a)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:n,to:a,reason:s}),d=a.staff.find(e=>e.id===t.staffId)?.name??'staff';let c;const f=[];if(i){const e=[...i.audit??[]];if(i.signOff&&(e.push(o('reopened','Confirmed','Awaiting sign-off')),f.push(`${t.by} reopened ${d}'s confirmed ${i.date} entry`)),i.in!==t.in&&(e.push(o('clock_in',r(i.in),r(t.in))),f.push(`${t.by} changed ${d} clock-in from ${r(i.in)} to ${r(t.in)}: ${s}`)),(i.out??'')!==(t.out??'')&&(e.push(o('clock_out',r(i.out),r(t.out))),f.push(`${t.by} changed ${d} clock-out from ${r(i.out)} to ${r(t.out)}: ${s}`)),(i.breakMins??0)!==t.breakMins&&(e.push(o('break',`${i.breakMins??0}m`,`${t.breakMins}m`)),f.push(`${t.by} changed ${d} break from ${i.breakMins??0}m to ${t.breakMins}m: ${s}`)),e.length===(i.audit??[]).length)return i;const n=t.out?i.breaks?.map(e=>e.end?e:{...e,end:t.out}):i.breaks;c={...i,in:t.in,out:t.out,breakMins:t.breakMins,breaks:n,signOff:void 0,adjusted:{by:t.by,at:t.now,reason:s},audit:e}}else c={id:t.id??(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:s},audit:[o('added',void 0,`${r(t.in)}\u2013${t.out?r(t.out):'open'}, break ${t.breakMins}m`)]},f.push(`${t.by} added ${d}'s ${t.date} entry ${r(t.in)}\u2013${t.out?r(t.out):'open'} (break ${t.breakMins}m): ${s}`);return t.request&&(c={...c,audit:[...c.audit??[],o('request_applied')]}),k.send?.('attendance_override',c,{reason:s}),e(e=>({attendance:i?e.attendance.map(e=>e.id===i.id?c:e):[...e.attendance,c],attLog:[...f.reverse().map(e=>({id:N('al'),at:t.now,text:e})),...e.attLog]})),c},voidEntry:(t,a,i,s,r)=>{const o=n(),d=o.attendance.find(e=>e.id===t);if(!d||d.voided||d.signOff||s.trim().length<3)return!1;const c={...d,voided:{by:a,at:r,reason:s.trim()},audit:[...d.audit??[],{at:r,by:a,byId:i,action:'voided',from:'In hours',to:'Removed',reason:s.trim()}]};k.send?.('attendance_void',c,{reason:s.trim()});const f=o.staff.find(e=>e.id===d.staffId)?.name??'staff';return e({attendance:o.attendance.map(e=>e.id===t?c:e),attLog:[{id:N('al'),at:r,text:`${a} removed ${f}'s ${d.date} shift (kept in the history): ${s.trim()}`},...o.attLog]}),!0},deleteEntry:(t,a,i,s)=>{const r=n(),o=r.attendance.find(e=>e.id===t);if(!o)return{ok:!1,message:'Not found.'};if(o.signOff)return{ok:!1,message:"This shift has been signed off and can't be deleted."};const d={...o,audit:[...o.audit??[],{at:s,by:a,byId:i,action:'voided',from:'In hours',to:'Deleted'}]};k.send?.('attendance_delete',d);const c=r.staff.find(e=>e.id===o.staffId)?.name??'staff';return e({attendance:r.attendance.filter(e=>e.id!==t),attLog:[{id:N('al'),at:s,text:`${a} deleted ${c}'s ${o.date} shift`},...r.attLog]}),{ok:!0}},addPastShift:t=>{if(!t.staffId||!t.in||!t.out||t.out<=t.in)return null;const a=(t.note??'').trim()||'Past shift (historical entry)',i={id:(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:a},signOff:{by:t.by,byId:t.byId,at:t.now},audit:[{at:t.now,by:t.by,byId:t.byId,action:'added',to:`${t.in}\u2013${t.out}, break ${t.breakMins}m`,reason:a},{at:t.now,by:t.by,byId:t.byId,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed',reason:'Historical entry'}]};k.send?.('attendance_add_past',i,{reason:a});const s=n().staff.find(e=>e.id===t.staffId)?.name??'staff';return e(e=>({attendance:[...e.attendance,i],attLog:[{id:N('al'),at:t.now,text:`${t.by} entered ${s}'s past shift on ${t.date}`},...e.attLog]})),i},confirmEntries:(t,a,i,s)=>{const r=n(),o=new Set(t),d=[],c=r.attendance.map(e=>{if(!o.has(e.id)||!e.out||e.signOff)return e;const t={...e,signOff:{by:a,byId:i,at:s},audit:[...e.audit??[],{at:s,by:a,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>k.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:N('al'),at:s,text:`${a} confirmed ${d.length} ${1===d.length?'entry':'entries'} (${[...new Set(d.map(e=>e.date))].join(', ')})`},...r.attLog]}),d.length):0},addTimeRequest:t=>e(e=>({timeRequests:[{...t,id:(0,p.uuid)(),status:'open'},...e.timeRequests]})),resolveTimeRequest:(t,a,i,s)=>{const r=n().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:a,resolvedBy:i,resolvedAt:s};k.send?.('time_request_resolve',o),e(e=>({timeRequests:e.timeRequests.map(e=>e.id===t?o:e)}))},setGeofence:t=>e(e=>({geofence:{...e.geofence,...t}})),setSimLocation:t=>e({simLocation:t}),giveConsent:(t,n)=>e(e=>({consent:{...e.consent,[t]:n}})),resetOwner:()=>e(q()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const n=new Set(e.staff.map(e=>e.id)),a=B().filter(e=>!n.has(e.id));return{staff:a.length?[...e.staff,...a]:e.staff,hourly:{...e.hourly,...V()},rosterVersion:l.ROSTER_VERSION}})}),{name:'covercharge-owner-v1',version:6,storage:(0,u.createJSONStorage)(()=>c.default),migrate:async(e,t)=>{if(s.LIVE_VENUE_BUILD&&e)return await(0,o.archiveChefCache)('owner',e),{...e,...(0,i.stripOwnerLiveSamples)(e)};if(e&&t<2&&Array.isArray(e.quickLinks)&&(e.quickLinks=e.quickLinks.map(e=>D.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=q();Object.assign(e,{staff:t.staff,hourly:t.hourly,shifts:t.shifts,leave:t.leave,swaps:t.swaps,availability:t.availability,attendance:[],attLog:[],consent:{},chat:[],chatMuted:{},troncHistory:[],staffAs:t.staffAs,previewRole:'owner',rosterVersion:l.ROSTER_VERSION,rotaPublished:void 0})}if(e&&t<4){const t=S(I(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:E(t,e.day??0),published:!0}),e.timeRequests=e.timeRequests??[]}return s.LIVE_VENUE_BUILD&&e&&(Object.assign(e,(0,i.stripOwnerLiveSamples)(e)),e.chat=(e.chat||[]).filter(e=>!(0,r.isSeedChefChat)(e)),e.suppliers=(e.suppliers||[]).filter(e=>!/^sup-[1-9]$/.test(e.id)||!/^(Example|Sample)\b/.test(e.name)),e.supplierOrders=(e.supplierOrders||[]).filter(e=>!/\(example\)/i.test(e.by||''))),e}})),K=(e,t,n)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${n(t)}/h`,W={owner:'Owner',manager:'Manager',staff:'Staff'},F={forecasts:e=>'staff'!==e,manage:e=>'staff'!==e,staffAdmin:e=>'owner'===e,billing:e=>'owner'===e,takings:e=>'staff'!==e,publishSocial:e=>'staff'!==e};const G=e=>[e.name.replace(/\s*\([^)]*\)\s*$/,'').replace(' (example)',''),e.nickname??''].map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>[e,e.split(' ')[0]]).filter((e,t,n)=>n.indexOf(e)===t),H=(e,t)=>{const n=t.trim().toLowerCase();if(!n)return!1;const a=G(e);return a.includes(n)||a.includes(n.split(' ')[0])},Q=(e,t)=>{const n=t.trim().toLowerCase();return!n||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(n))}},861,[5,6,1191,1193,842,1082,1196,1188,993,1189,15,1097]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t,signedOff:!1}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},862,[931,31,197,257,264,152,128,837,818,863,819,864,822,825,1295,25,1489]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSpecials",{enumerable:!0,get:function(){return _}});var e,t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),n=r(_d[3]),o=r(_d[4]),c=(e=o)&&e.__esModule?e:{default:e},l=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),y=r(_d[9]);const p=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock)}catch{return new Date}};let S=0;const f=()=>`sb-${Date.now().toString(36)}${(S++).toString(36)}`,b=(e,t)=>u.useStore.setState(s=>({audit:[{id:`au-${f()}`,restaurantId:e,at:p().toISOString(),kind:'allergy',text:t},...s.audit].slice(0,300)})),_=(0,l.create)()((0,d.persist)((e,t)=>({...n.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{current:{},history:[]}:(0,h.seedSpecials)(p()),post:(t,s,i,n)=>{e(e=>(0,h.postBoard)(e,t,s,i,n,p(),f())),s.items.length&&b(t,`Specials board: allergens for ${s.items.length} typed special${1===s.items.length?'':'s'} checked and signed off by ${i}`)},clear:(t,s)=>{e(e=>(0,h.clearBoard)(e,t)),b(t,`Specials board cleared by ${s}`)},reuse:(s,i,n,o)=>{const c=t().history.find(e=>e.id===i);e(e=>(0,h.reuseBoard)(e,s,i,n,o,p(),f())),c?.items.length&&b(s,`Specials board re-used: ${c.items.length} typed special${1===c.items.length?'':'s'}, allergens as previously checked, signed off by ${n}`)},remove:t=>e(e=>(0,h.deleteFromHistory)(e,t))}),{name:'covercharge-specials-v1',storage:(0,d.createJSONStorage)(()=>c.default),version:1,partialize:e=>({current:e.current,history:e.history})})),E=async()=>{if(!(0,y.liveData)())return;const e=_.getState(),n=e=>String(e.id).startsWith('sb-seed')&&(!s.LIVE_VENUE_BUILD||(0,t.demoActor)(e.postedBy)&&(!e.allergenCheck||(0,t.demoActor)(e.allergenCheck.by))&&(!e.photo||e.photo===h.SAMPLE_PHOTO)&&e.items.every(e=>/\(sample\)/i.test(e.name))),o=Object.fromEntries(Object.entries(e.current).filter(([,e])=>!(e&&n(e)))),c=e.history.filter(e=>!n(e));Object.keys(o).length===Object.keys(e.current).length&&c.length===e.history.length||(s.LIVE_VENUE_BUILD&&await(0,i.archiveChefCache)('specials',{current:e.current,history:e.history}),_.setState({current:o,history:c}))};(0,y.onDataModeChange)(E);try{_.persist?.onFinishHydration?.(E)}catch{}E()},863,[1082,842,1196,5,1188,993,1189,864,878,1216]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAMPLE_PHOTO",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_MAX",{enumerable:!0,get:function(){return n}}),e.parsePrice=function(t){const n=t.trim().replace(/^\xa3\s*/,'');return n?/^\d{1,3}(\.\d{1,2})?$/.test(n)?Math.round(100*parseFloat(n)):NaN:null},Object.defineProperty(e,"priceText",{enumerable:!0,get:function(){return s}}),e.itemProblems=a,e.draftProblems=i,e.cycleAllergen=function(t,n){const s={...t};s[n]?'contains'===s[n]?s[n]='may':delete s[n]:s[n]='contains';return s},e.postBoard=function(t,n,s,a,l,c,d){const u=i(s);if(u.length)throw new Error(u[0]);const p={id:d,restaurantId:n,photo:s.photo,app:l,postedBy:a,postedAt:c.toISOString(),items:s.items.map(t=>({...t,name:t.name.trim(),description:t.description.trim()})),allergenCheck:s.items.length?{by:a,at:c.toISOString()}:null};return{current:{...t.current,[n]:p},history:o(t.history,t.current[n],n)}},e.clearBoard=function(t,n){return{current:{...t.current,[n]:null},history:o(t.history,t.current[n],n)}},e.reuseBoard=function(t,n,s,a,i,l,c){const d=t.history.find(t=>t.id===s&&t.restaurantId===n);if(!d)return t;const u={...d,id:c,app:i,postedBy:a,postedAt:l.toISOString(),reusedFrom:d.id,allergenCheck:d.items.length?{by:a,at:l.toISOString()}:null},p={...t,history:t.history.filter(t=>t.id!==s)};return{current:{...t.current,[n]:u},history:o(p.history,t.current[n],n)}},e.deleteFromHistory=function(t,n){return{...t,history:t.history.filter(t=>t.id!==n)}},Object.defineProperty(e,"historyFor",{enumerable:!0,get:function(){return l}}),e.whenText=h,Object.defineProperty(e,"isToday",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"freshness",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"lastUpdated",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"boardSummary",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SAMPLE_ITEMS",{enumerable:!0,get:function(){return k}}),e.seedSpecials=function(n){const s=60*n.getHours()+n.getMinutes()>=702?S(n,0,11,42):new Date(n.getTime()-6e5),a=S(n,1,11,20),i=S(n,3,12,5);return{current:{anchorage:{id:'sb-seed-today',restaurantId:'anchorage',photo:null,items:k,postedAt:s.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:{by:'Head Chef (example)',at:s.toISOString()}}},history:[{id:'sb-seed-yday',restaurantId:'anchorage',photo:null,postedAt:a.toISOString(),postedBy:'Duty Manager (example)',app:'managers',allergenCheck:{by:'Duty Manager (example)',at:a.toISOString()},items:[{id:'sp-y1',name:'Pan-fried sea bass, samphire, brown shrimp butter (sample)',description:'Sample dish.',price:2100,allergens:{fish:'contains',crustaceans:'contains',milk:'contains'}},{id:'sp-y2',name:'Smoked haddock fishcake, poached egg (sample)',description:'Sample dish: with wholegrain mustard sauce.',price:1250,allergens:{fish:'contains',eggs:'contains',gluten:'contains',milk:'contains',mustard:'contains'}},{id:'sp-y3',name:'Lemon posset, shortbread (sample)',description:'Sample pudding.',price:750,allergens:{milk:'contains',gluten:'contains'}}]},{id:'sb-seed-photo',restaurantId:'anchorage',photo:t,items:[],postedAt:i.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:null}]}};const t='sample:chalkboard',n=8;const s=t=>null===t?'Ask your server':`\xa3${(t/100).toFixed(2)}`;function a(t){const n=[];t.name.trim().length<3&&n.push('Add a dish name'),null!==t.price&&(!Number.isFinite(t.price)||t.price<=0||t.price>5e4)&&n.push('Check the price');const s=Object.keys(t.allergens).length;return s||t.noAllergens||n.push('Choose its allergens, or tick \u201cNone of the 14\u201d'),s&&t.noAllergens&&n.push('Allergens chosen and \u201cNone of the 14\u201d both ticked'),n}function i(t){const n=[];return t.photo||t.items.length||n.push('Add a photo of the board or type at least one special'),t.items.forEach((t,s)=>a(t).forEach(t=>n.push(`Special ${s+1}: ${t}`))),t.items.length&&!t.allergensChecked&&n.push('Confirm you have checked the allergens'),n}const o=(t,s,a)=>{if(!s)return t;return[...[s,...t.filter(t=>t.restaurantId===a&&t.id!==s.id)].slice(0,n),...t.filter(t=>t.restaurantId!==a)]};const l=(t,n)=>t.history.filter(t=>t.restaurantId===n),c=t=>String(t).padStart(2,'0'),d=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],p=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate();function h(t,n){const s=new Date(t),a=`${c(s.getHours())}:${c(s.getMinutes())}`;if(p(s,n))return`today at ${a}`;const i=new Date(n);return i.setDate(i.getDate()-1),p(s,i)?`yesterday at ${a}`:`${d[s.getDay()]} ${s.getDate()} ${u[s.getMonth()]} at ${a}`}const m=(t,n)=>p(new Date(t),n),y=(t,n)=>`Updated ${h(t.postedAt,n)}`,f=(t,n)=>`Last updated ${h(t.postedAt,n)} by ${t.postedBy}`,b=t=>[t.photo?'Photo':'',t.items.length?`${t.items.length} typed special${1===t.items.length?'':'s'}`:''].filter(Boolean).join(' + '),S=(t,n,s,a)=>{const i=new Date(t);return i.setDate(i.getDate()-n),i.setHours(s,a,0,0),i},k=[{id:'sp-hake',name:'Grilled hake, crushed new potatoes, salsa verde (sample)',description:'Sample dish: day-boat hake, lemon and caper salsa verde.',price:1950,allergens:{fish:'contains',mustard:'contains',sulphites:'may'}},{id:'sp-scallops',name:'Half-shell scallops, garlic and herb butter (sample)',description:'Sample dish: three scallops grilled in the shell, crusty bread.',price:1400,allergens:{molluscs:'contains',milk:'contains',gluten:'contains'}},{id:'sp-crab',name:'Crab and chilli linguine (sample)',description:'Sample dish: brown and white crab meat, chilli, parsley, lemon.',price:1850,allergens:{crustaceans:'contains',gluten:'contains',eggs:'contains',molluscs:'may'}},{id:'sp-mussels',name:'Mussels in cider and leek cream (sample)',description:'Sample dish: rope-grown mussels, dry cider, leeks, cream. Main with chips.',price:1300,allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',celery:'may'}}]},864,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addressWithoutInvite",{enumerable:!0,get:function(){return u.addressWithoutInvite}}),Object.defineProperty(_e,"inviteFromLocation",{enumerable:!0,get:function(){return u.inviteFromLocation}}),Object.defineProperty(_e,"useSession",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"rosterPerson",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"APP_NAME",{enumerable:!0,get:function(){return S}}),_e.sha256Hex=y,_e.inviteFromText=function(e){const t=e.trim(),n=t.match(/[?&#](?:invite|i)=([A-Za-z0-9_-]{10,})/);return n?n[1]:/^[A-Za-z0-9_-]{10,}$/.test(t)?t:null},_e.personForInvite=async function(e){if(a.IS_ISOLATED_VENUE)return;const t=await y(e);return t?l.ROSTER.find(e=>e.tokenHash===t):void 0},Object.defineProperty(_e,"DEVICE_KEY",{enumerable:!0,get:function(){return p}}),_e.deviceId=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(p);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(p,e)}return e}catch{return null}},Object.defineProperty(_e,"PHONE_KEY",{enumerable:!0,get:function(){return I}}),_e.phoneKey=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(I);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(I,e)}return e}catch{return null}},Object.defineProperty(_e,"START_INVITE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"START_HANDOVER",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"START_KITCHEN",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"START_GO",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"START_LOYALTY_CODE",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"START_TABLE_TOKEN",{enumerable:!0,get:function(){return O}}),_e.appUrl=function(e,t){if('undefined'==typeof window||!window.location)return null;const{origin:n,pathname:o}=window.location,i=o.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/),a=i?i[1]:'/';return`${n}${a}${e}-app/index.html${t?`#invite=${encodeURIComponent(t)}`:''}`},_e.levelJob=function(e,t){const n=(e??'').trim(),o=(t??'').trim();return n?!o||o.toLowerCase().startsWith(n.toLowerCase())?o||n:`${n} \xb7 ${o}`:o};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]),a=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]),u=r(d[7]),f=r(d[8]);const w={getItem:e=>{try{if((0,f.isKitchenViaDisplay)())return Promise.resolve('undefined'!=typeof sessionStorage?sessionStorage.getItem((0,f.kitchenSessionStoreName)()):null)}catch{}return n.default.getItem(e)},setItem:(e,t)=>{try{if((0,f.isKitchenViaDisplay)())return sessionStorage.setItem((0,f.kitchenSessionStoreName)(),t),Promise.resolve()}catch{}return n.default.setItem(e,t)},removeItem:e=>{try{(0,f.isKitchenViaDisplay)()&&sessionStorage.removeItem((0,f.kitchenSessionStoreName)())}catch{}return n.default.removeItem(e)}},h=(0,o.create)()((0,i.persist)(e=>({meId:null,welcomed:{},signIn:t=>e({meId:t,signedInAt:(new Date).toISOString()}),signOut:()=>e({meId:null,signedInAt:void 0}),markWelcomed:t=>e(e=>({welcomed:{...e.welcomed,[t]:(new Date).toISOString()}}))}),{name:c.IS_CAR?'covercharge-car-session-v1':'covercharge-session-v1',storage:(0,i.createJSONStorage)(()=>w),version:c.IS_CAR?2:1,partialize:e=>(0,s.persistedSessionSlice)(c.IS_CAR,e),migrate:e=>c.IS_CAR?(0,s.migrateCarSession)(e):e})),m=e=>!a.IS_ISOLATED_VENUE&&e?l.ROSTER.find(t=>t.id===e):void 0,S={owner:'CoverCharge for Managers',staff:'CoverCharge for Staff',chef:'CoverCharge for Head Chef'};async function y(e){const t=globalThis.crypto?.subtle;if(!t)return null;const n=await t.digest('SHA-256',(new TextEncoder).encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,'0')).join('')}const p=(0,a.venueKey)('covercharge-device-id');const I=(0,a.venueKey)('covercharge-phone-key');const v=(()=>{try{if('undefined'==typeof window||!window.location)return null;if(c.IS_CAR){try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(null,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}return null}const e=(0,a.venueKey)(`cc-pending-invite:${c.APP_VARIANT}`);let t=(0,u.inviteFromLocation)(window.location.search,window.location.hash);try{t?localStorage.setItem(e,t):t=localStorage.getItem(e)}catch{}if(t&&!/^[A-Za-z0-9_-]{10,64}$/.test(t)&&(t=null),t&&window.history?.replaceState){const e=()=>{try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};e();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[?&#]invite=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const t of[300,1e3,2500,5e3,1e4,2e4])setTimeout(e,t)}return t}catch{return null}})(),A=(()=>{try{if('undefined'==typeof window||!window.location||c.IS_CAR)return null;const e=(0,u.handoverFromHash)(window.location.hash);if(!e)return null;const t=()=>{try{/[#&]ccchrome=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};t();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[#&]ccchrome=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const e of[300,1e3,2500,5e3])setTimeout(t,e);return e}catch{return null}})(),b=(()=>{try{if('undefined'==typeof window||!window.location||c.IS_CAR)return null;const e=(0,f.kitchenTicketFromHash)(window.location.hash);if(!e)return null;const t=()=>{try{/[#&]cckitchen=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};t();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[#&]cckitchen=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const e of[300,1e3,2500,5e3])setTimeout(t,e);return e}catch{return null}})(),_=(()=>{try{return'undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('go'):null}catch{return null}})(),T=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('loyalty'):null;return e&&/^[A-Za-z0-9-]{4,12}$/.test(e)?e.toUpperCase():null}catch{return null}})(),O=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('table'):null;return e&&/^[A-Za-z2-9]{16}$/.test(e)?e.toUpperCase():null}catch{return null}})()},865,[1188,993,1189,5,807,1273,15,1272,977]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},866,[31,128,875,818,823,865,1069,845,825,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BUILTIN_LOGOS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HERO_LOGOS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"HEADER_LOGO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACCENTS",{enumerable:!0,get:function(){return z}}),_e.useBrandRid=k,_e.useBrand=A,_e.PoweredBy=H,_e.RestaurantLogo=L,_e.RestaurantHero=function({rid:e,size:r=200,showPlace:o=!0}){const c=A(e),u='wildings'===c.rid||'greenside'===c.rid||'kirkton'===c.rid||'abbotsford'===c.rid||(0,t.isQueuedVenue)(c.rid),x='yasmins'===c.rid?c.logo:u?S[c.rid]:c.custom?c.logo:S[c.rid]??c.logo;return(0,p.jsxs)(s.default,{testID:"restaurant-hero",style:{alignItems:'center',gap:6},children:[x?(0,p.jsx)(l.default,{source:x,accessibilityLabel:`${c.name} logo`,style:{width:r,height:r,borderRadius:!u&&c.custom?r/2:0},resizeMode:"contain"}):(0,p.jsx)(L,{rid:c.rid,size:r}),u?null:(0,p.jsx)(n.Text,{testID:"restaurant-hero-name",style:[{fontFamily:f.fonts.semibold,fontSize:26,lineHeight:34,color:f.colours.text,textAlign:'center'},(0,h.webLine)({lineHeight:34},26)],children:c.name}),o&&c.place?(0,p.jsx)(n.Text,{style:[{fontFamily:f.fonts.regular,fontSize:14,lineHeight:20,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:20},14)],children:c.place}):null]})},_e.VenueName=I,_e.RestaurantBrand=function({rid:e,sub:t,size:r=T,nameSuffix:o,beside:l}){const c=A(e);if('display'===x.APP_VARIANT||l)return(0,p.jsx)(s.default,{style:{gap:2,flexShrink:1},children:(0,p.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,p.jsx)(L,{rid:c.rid,size:r}),(0,p.jsxs)(s.default,{style:{flexShrink:1,flex:1,minWidth:0},children:[(0,p.jsx)(I,{name:c.name+(o??''),lines:2,bold:!0}),(0,p.jsx)(s.default,{testID:"display-powered-by",style:{marginLeft:14,marginTop:-1},children:(0,p.jsx)(H,{})}),t?(0,p.jsx)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:c.accentText},(0,h.webLine)({lineHeight:16},12)],children:t}):null]})]})});return(0,p.jsxs)(s.default,{testID:"venue-header-block",dataSet:{centre:'heading'},style:{gap:4,alignItems:'center',alignSelf:'center',maxWidth:420,width:'100%'},children:[(0,p.jsx)(L,{rid:c.rid,size:r}),(0,p.jsx)(I,{name:c.name+(o??'')}),t?(0,p.jsx)(n.Text,{numberOfLines:2,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:16},12)],children:t}):null,(0,p.jsx)(H,{})]})},_e.VenueHeaderBlock=function({rid:e,name:t,badge:r,place:o}){return(0,p.jsxs)(s.default,{testID:"venue-header-block",dataSet:{centre:'heading'},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',alignSelf:'center',gap:12,maxWidth:420,width:'100%'},children:[(0,p.jsx)(L,{rid:e,size:44}),(0,p.jsxs)(s.default,{style:{flexShrink:1,minWidth:0,alignItems:'center',gap:2},children:[(0,p.jsx)(I,{name:t}),(0,p.jsx)(s.default,{testID:"app-badge",accessibilityLabel:`${r} app`,style:{borderWidth:1,borderColor:f.colours.gold,borderRadius:6,paddingHorizontal:6,paddingVertical:1},children:(0,p.jsx)(n.Text,{style:[{fontFamily:f.fonts.bold,fontSize:10,lineHeight:14,color:f.colours.gold,textAlign:'center'},(0,h.webLine)({lineHeight:14},10)],children:r})}),o?(0,p.jsx)(n.Text,{testID:"venue-header-place",dataSet:{centre:'heading'},style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:f.colours.muted,textAlign:'center'},(0,h.webLine)({lineHeight:16},12)],children:o}):null,(0,p.jsx)(H,{})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=e(_r(d[3])),l=e(_r(d[4]));_r(d[5]);var s=e(_r(d[6])),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),x=_r(d[11]),b=_r(d[12]),y=_r(d[13]),j=_r(d[14]),p=_r(d[15]);const w={"3idiots":_r(d[16]),cecchinis:_r(d[17]),mrbasrais:_r(d[18]),yasmins:_r(d[19]),williewastles:_r(d[20]),rupeeroom:_r(d[21]),smokinggoat:_r(d[22]),pizzaioli:_r(d[23]),drunkencoo:_r(d[24]),abbotsford:_r(d[25]),kirkton:_r(d[26]),greenside:_r(d[27]),wildings:_r(d[28]),kirkmichael:_r(d[29]),souters:_r(d[30]),anchorage:_r(d[31]),saltmarsh:_r(d[32]),brae:_r(d[33])},S={"3idiots":_r(d[34]),cecchinis:_r(d[35]),mrbasrais:_r(d[36]),yasmins:_r(d[37]),williewastles:_r(d[38]),rupeeroom:_r(d[39]),smokinggoat:_r(d[40]),pizzaioli:_r(d[41]),drunkencoo:_r(d[42]),abbotsford:_r(d[43]),kirkton:_r(d[44]),greenside:_r(d[45]),wildings:_r(d[46]),kirkmichael:_r(d[47]),souters:_r(d[30]),anchorage:_r(d[48])};y.PITCH&&!y.PITCH_ANCHORAGE&&(delete w.anchorage,delete S.anchorage);const T=48,z=['#CFA45F','#D4AF61','#C9A24A','#E2C489','#F2EDE4','#A88B5A','#B08D57','#D9774B'];function k(e){const t=(0,r.useGlobalSearchParams)(),n=(0,u.useOwner)(e=>e.site),o='string'==typeof t.rid?t.rid:void 0;return b.IS_ISOLATED_VENUE?b.VENUE_RID:e??o??n??b.VENUE_RID}function A(e){const t=k(e),n=(0,c.useStore)(e=>e.restaurants.find(e=>e.id===t)),r=(0,u.useOwner)(e=>e.branding[t]),l=r?.logoUri?{uri:r.logoUri}:w[t],s=r?.accent??f.colours.gold,h=o.default.useMemo(()=>(0,j.checkAccent)(s,f.colours.bg,f.colours.onGold,f.colours.text),[s]);return{rid:t,name:n?.name??'Restaurant',place:n?.location??'',logo:l,accent:s,accentText:h.accentText,onAccent:h.onAccent,custom:!!r?.logoUri}}function H({size:e=10}){return(0,p.jsxs)(n.Text,{accessibilityLabel:"powered by CoverCharge",style:[{fontFamily:f.fonts.regular,fontSize:e,lineHeight:Math.round(1.35*e),color:f.colours.muted,textAlign:'center'},(0,h.webLine)({lineHeight:Math.round(1.35*e)},e)],children:["powered by ",(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.text},children:"Cover"}),(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.gold},children:"Charge"})]})}function L({rid:e,size:t=T}){const r=A(e);if(r.logo)return(0,p.jsx)(l.default,{source:r.logo,accessibilityLabel:`${r.name} logo`,style:{width:t,height:t,borderRadius:r.custom?t/2:0},resizeMode:"contain"});const o=r.name.replace(/^The /,'').split(/\s+/).map(e=>e[0]).join('').slice(0,2).toUpperCase();return(0,p.jsx)(s.default,{accessibilityLabel:`${r.name} logo`,style:{width:t,height:t,borderRadius:t/2,borderWidth:2,borderColor:r.accentText,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.bold,color:r.accentText,fontSize:.36*t},children:o})})}function I({name:e,size:t=17,lines:r,bold:o}){return(0,p.jsx)(n.Text,{testID:"venue-header-name",accessibilityRole:"header",accessibilityLabel:e,numberOfLines:r,style:[{fontFamily:o?f.fonts.bold:f.fonts.semibold,fontSize:t,lineHeight:Math.ceil(1.35*t),color:f.colours.text,textAlign:'center',flexShrink:1,minWidth:0},(0,h.webLine)({lineHeight:Math.ceil(1.35*t)},t),{overflowWrap:'normal',wordBreak:'keep-all'}],children:e})}},867,[6,873,805,31,197,123,128,823,861,825,1347,807,5,2,1345,25,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PUB_LOCATIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"privateClockVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"pubLocation",{enumerable:!0,get:function(){return s}}),e.venueClockArea=function(a,o={}){if((0,t.isQueuedVenue)(a)&&!t.queuedVenues[a].clockArea.on)return(0,n.cleanArea)({...o,on:!0===o.on&&'number'==typeof o.lat&&'number'==typeof o.lng,offRotaPrompt:!1});const l=s(a);if(!l)return(0,n.cleanArea)(o);const c=(0,n.cleanArea)({lat:l.lat,lng:l.lng,radius:150,...o});return{...c,lat:c.lat??l.lat,lng:c.lng??l.lng,on:!0,offRotaPrompt:!1}},e.venueClockGeo=l,e.privateAttendance=function(n,a){if(!o(n)&&!(0,t.isQueuedVenue)(n))return a;const s={...a};for(const t of['lat','lng','latitude','longitude','coords','position','location','acc','dist','accuracy','distance','outSite'])delete s[t];a.geo&&(s.geo=a.geo.map(t=>l(n,t)).filter(t=>!!t));return s};var t=r(d[0]),n=r(d[1]);const a={"3idiots":{name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",lat:55.4650286,lng:-4.6283062,source:"Verified exact-address venue pack"},cecchinis:{name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",lat:55.461505,lng:-4.6345736,source:"Verified exact-address venue pack"},williewastles:{name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",lat:55.4646261,lng:-4.6323929,source:"Verified exact-address venue pack"},smokinggoat:{name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",lat:55.464226,lng:-4.6326035,source:"Verified exact-address venue pack"},drunkencoo:{name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",lat:55.4570308,lng:-4.6294663,source:"Verified exact-address venue pack"},abbotsford:{name:'The Abbotsford Hotel',address:'14 Corsehill Road, Ayr KA7 2ST',lat:55.4488797,lng:-4.6314856,source:'Official FSA1696388, exact address match verified6 Nov2026'},kirkton:{name:'The Kirkton Inn',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',lat:55.3971215,lng:-4.5920177,source:'Public FSA establishment1955433 verified6 November2026'},greenside:{name:'The Greenside Restaurant',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',lat:55.3542369,lng:-4.6851418,source:'Official Find us Google Maps link, place point, verified 6 November 2026'},kirkmichael:{name:'The Kirkmichael Arms',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',lat:55.3458202,lng:-4.6180793,source:'venue-profile.json geo, matched to the venue address'},souters:{name:"Souter\u2019s Inn",address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',lat:55.3297218,lng:-4.7772979,source:'Food Standards Agency establishment 1863840, address matched'}},o=t=>Object.prototype.hasOwnProperty.call(a,t),s=t=>o(t)?a[t]:void 0;function l(n,a){return o(n)||(0,t.isQueuedVenue)(n)?'in'===a.action?{action:'in',at:a.at,inside:a.inside,...a.override?{override:{by:a.override.by,byId:a.override.byId,reason:a.override.reason}}:{}}:void 0:a}},868,[6,869]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_RADIUS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_RADIUS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ACCURACY_CAP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_BREAK_OPTIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_CLOCK_AREA",{enumerable:!0,get:function(){return r}}),e.distanceM=s,Object.defineProperty(e,"validLat",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validLng",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"areaSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"clampRadius",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"accuracyAllowance",{enumerable:!0,get:function(){return p}}),e.isInside=h,e.cleanArea=function(t){const n=(t.breakOptions??a).map(t=>Math.round(Number(t))).filter(t=>Number.isFinite(t)&&t>0&&t<=180);return{...r,...t,lat:c(t.lat)?t.lat:null,lng:l(t.lng)?t.lng:null,radius:f(t.radius??r.radius),on:!1!==t.on,offRotaPrompt:!1!==t.offRotaPrompt,breakOptions:[...new Set(n)].sort((t,n)=>t-n).slice(0,12),offRotaTitle:(t.offRotaTitle??'').trim().slice(0,80)||r.offRotaTitle,offRotaBody:(t.offRotaBody??'').trim().slice(0,160)||r.offRotaBody}},Object.defineProperty(e,"ACTION_WORD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DENIED_TEXT",{enumerable:!0,get:function(){return m}}),e.gate=function(t,n,o,a,r="browser"){if(!t.on||!d(t)){const r={action:n,at:a,inside:null,unchecked:!0};return'object'==typeof o&&Object.assign(r,{lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc)}),{allowed:!0,geo:r,warn:t.on?'The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':void 0}}if('object'!=typeof o){const t='app-phone-off'===r?m['app-phone-off']:'denied'===o?m[r]:'timeout'===o?'Your phone couldn\u2019t find your location in time. Step outside or near a window and try again.':'unsupported'===o?'This phone or browser can\u2019t share its location. Ask a manager to record it for you.':'Your phone couldn\u2019t find your location. Check Location is on, then try again.';return{allowed:!1,message:`You need to be at the venue to ${b[n]}. ${t}`,geo:{action:n,at:a,inside:!1}}}const u=h(t,o),s={action:n,at:a,lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc),dist:u.dist,inside:u.inside};if(u.inside)return{allowed:!0,geo:s};const c=u.dist>=1e3?`${(u.dist/1e3).toFixed(1)} km`:`${u.dist} m`;return{allowed:!1,geo:s,message:`You need to be at the venue to ${b[n]}. You look to be about ${c} away (allowed ${u.limit} m). If you\u2019re at the venue, try again in a moment or ask a manager to record it for you.`}},e.overrideGeo=function(t,n,o,a){const r=a.trim();return r.length<3?null:{action:t,at:n,inside:null,override:{by:o.name,byId:o.id,reason:r.slice(0,200)}}},e.offRotaDue=function(t){return!(!(t.area.offRotaPrompt&&d(t.area)&&t.inside)||t.clockedIn||t.dismissedToday)&&!t.shifts.some(n=>t.nowHours>=n.start-1&&t.nowHours<(n.end<=n.start?n.end+24:n.end))},Object.defineProperty(e,"breakLabel",{enumerable:!0,get:function(){return O}});const t=50,n=2e3,o=50,a=[5,10,15,20,30,45,60],r={lat:null,lng:null,radius:100,on:!0,breakOptions:[...a],offRotaPrompt:!0,offRotaTitle:'Do you want to sign in?',offRotaBody:'Should you be on the rota?'},u=t=>t*Math.PI/180;function s(t,n){const o=u(n.lat-t.lat),a=u(n.lng-t.lng),r=Math.sin(o/2)**2+Math.cos(u(t.lat))*Math.cos(u(n.lat))*Math.sin(a/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(r)))}const c=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-90&&t<=90,l=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-180&&t<=180,d=t=>c(t.lat)&&l(t.lng),f=o=>Number.isFinite(o)?Math.min(n,Math.max(t,Math.round(o))):r.radius,p=t=>Number.isFinite(t)&&t>0?Math.min(t,o):0;function h(t,n){const o=s({lat:t.lat,lng:t.lng},n),a=f(t.radius)+p(n.acc);return{inside:o<=a,dist:Math.round(o),limit:Math.round(a)}}const b={in:'clock in',out:'clock out',break_start:'start a break',break_end:'end your break'},m={browser:'Location is turned off for this browser. Turn it on in your phone\u2019s settings (Location \u203a allow for this browser), then try again.',iphone:'Location is turned off for this app. On your iPhone open Settings \u203a Privacy & Security \u203a Location Services \u203a Safari Websites and choose While Using the App, then try again.',app:'Location is turned off for this app. Tap Open app settings, then Permissions \u203a Location \u203a Allow only while using the app. Then come back and try again.','app-old':'This version of the app can\u2019t use location. Tap Update the app at the bottom of the screen, then tap Allow when your phone asks.','app-phone-off':'Location is switched off on your phone. Tap Open location settings, turn on Use location, then come back and try again.'};const y=t=>Math.round(1e6*t)/1e6;const O=t=>60===t?'1 hour':t%60==0?t/60+" hours":t>60?`${Math.floor(t/60)} h ${t%60} min`:`${t} min`},869,[]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},870,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FETCH_TIMEOUT_MS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"READER_TIMEOUT_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"fetchLimitMs",{enumerable:!0,get:function(){return _}}),_e.fetchWithTimeout=S,_e.getSupabase=function(){if(c)return c;if(!(0,s.isSupabaseConfigured)())throw new Error('Supabase is not configured: set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in .env.local');return c=(0,o.createClient)(s.SUPABASE_URL,s.SUPABASE_ANON_KEY,{auth:{storage:n.default,persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!1,storageKey:`${(0,u.syncNamespace)()}auth`},realtime:{params:{eventsPerSecond:10}},global:{fetch:S}}),c},_e.setSupabaseClient=function(e){c=e};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),u=r(d[3]);let c=null;const f=2e4,l=15e4,b=/\/functions\/v1\/(delivery-read|plan-photo-read)(\?|$)/,_=e=>b.test(e)?l:/\/storage\/v1\//.test(e)?12e4:f;function S(e,t){const n='string'==typeof e?e:e instanceof URL?e.href:e.url,o=_(n);if('undefined'==typeof AbortController)return fetch(e,t);const s=new AbortController,u=t?.signal;u&&(u.aborted?s.abort():u.addEventListener('abort',()=>s.abort(),{once:!0}));const c=setTimeout(()=>s.abort(),o);return fetch(e,{...t,signal:s.signal}).catch(e=>{if(s.signal.aborted&&!u?.aborted)throw new TypeError(`Failed to fetch (network timeout after ${o/1e3} s)`);throw e}).finally(()=>clearTimeout(c))}},871,[1188,1224,1168,1266]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedSessions=o,e.queuedRequestSlots=u,e.queuedRequestError=function(t,o,s,a=new Date){if(o.name.trim().length<2||o.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(o.phone)||!/^[0-9]{7,15}$/.test(o.phone.replace(/\D/g,''))||o.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email))return'Enter your name, phone number and email.';if(o.notes.length>2e3)return'Keep notes under 2000 characters.';const c=(0,n.localDate)(a),d=(0,n.localDate)(new Date(+a+63072e6));if(!o.date||o.dated||!u(t,o.date,s).includes(o.time||''))return'Choose a future date and a time within confirmed kitchen service hours.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return o.date===c&&(o.time||'')<=l?'Choose a future time.':!Number.isInteger(o.covers)||o.covers<1||o.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]),n=r(_d[1]);function o(n){const o=t.queuedVenues[n];return o?.kitchenSessionsByDay??o?.hours.sessionsByDay??void 0}const s=t=>60*+t.slice(0,2)+ +t.slice(3);function u(n,u,a){if(!/^\d{4}-\d{2}-\d{2}$/.test(u))return[];const c=new Date(u+'T12:00:00Z');if(!Number.isFinite(+c)||c.toISOString().slice(0,10)!==u)return[];const d=(a??o(n))?.[c.getUTCDay()];if(!Array.isArray(d))return[];const l=[],f=t.queuedVenues[n]?.booking.lastSittingMinutesBeforeClose??0;for(const t of d){if(!Array.isArray(t)||2!==t.length||!t.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))continue;const n=s(t[0]),o=s(t[1]);if(!(n>=o))for(let t=n;t(0,t.getSupabase)();const s=e=>{const t=String(e?.message||'');return/^(Requests are not enabled|Too many|Please complete|Enter your|Choose |This request|Only this venue)/.test(t)?t:'Unable to send or load requests. Check your connection and try again, or call the hotel.'}},874,[6,871]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},875,[31,128,1502,825,25]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.forecastToday=function(u,c,h,f,p,v){const k=(0,e.venueBusy)(u,c,p),M=(0,a.examplesAllowed)(),b=(0,n.clampWeeks)(u.settings.forecastMinWeeks),w=M?null:v??(0,n.buildHistory)(u.id,c,h,[],p,b),H=M||!!w?.enough,O=(0,r.hoursFor)(u,p),S=[],C=(0,s.ymd)(p);let I=1;for(const e of f.filter(e=>e.date===C&&(null===e.restaurantId||e.restaurantId===u.id)))S.push(e.title.replace(/\s*\(substitute day\)/gi,'')),!1!==e.busier&&(I*='bank-holiday'===e.kind?1.25:'event'===e.kind?1.15:1.1);if(!O)return{busy:k,open:!1,hours:[],restOfDay:{covers:0,low:0,high:0,takeaway:0,booked:0},flags:S,suggestions:['Kitchen closed today (per listed hours).'],multiplier:I,example:M,enough:H,minWeeks:b};const x=M?o.EXAMPLE_HISTORY[u.id]??o.EXAMPLE_HISTORY.default:H&&w?w:{covers:{},takeaway:{}},E=p.getDay(),N=l(u,p),$=(0,t.lastFoodOn)(u,C);let _=O.close.getMinutes()>0?O.close.getHours():O.close.getHours()-1;if($){const[e,t]=$.time.split(':').map(Number);_=Math.min(_,t>0?e:e-1),'kitchen closes'!==$.reason&&S.push(`Last food orders ${$.time} (${$.reason})`)}const P=c.filter(e=>e.restaurantId===u.id&&e.date===C&&['confirmed','seated','finished'].includes(e.status)),T=P.filter(e=>!e.walkIn&&'finished'!==e.status).map(e=>Number(e.time.slice(0,2))),A=Math.min(N[0],O.open.getHours(),...T),L=Math.max(N[1],_,...T),R=[];for(let e=A;e<=L;e++){const t=e>=O.open.getHours()&&e<=_,o=x.covers[E]?.[e]??0,r=x.takeaway[E]?.[e]??0,a=P.filter(t=>!t.walkIn&&'finished'!==t.status&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),n=P.filter(t=>t.walkIn&&['seated','finished'].includes(t.status)&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),i=t?Math.round(o*u.settings.walkInShare*I):0,c=H&&t?Math.max(0,Math.round(o*I*(1-u.settings.walkInShare))-a):0,l=Math.max(n,i)+c,f=a+l,p=h.filter(t=>t.restaurantId===u.id&&'takeaway'===t.type&&'cancelled'!==t.status&&t.slotTime&&new Date(t.slotTime).getHours()===e&&(0,s.ymd)(new Date(t.slotTime))===C).length,y=t?Math.max(p,Math.round(r*I)):p;R.push({hour:e,booked:a,walkIns:l,covers:f,coversLow:H?Math.round(.8*f):f,coversHigh:H?Math.round(1.2*f):f,takeawayPlaced:p,takeaway:y,historicalCovers:o})}const D=y(u,E);if(H&&D){const e=D-R.reduce((e,t)=>e+t.covers,0),t=R.filter(e=>e.hour>=O.open.getHours()&&e.hour<=_);if(e>0&&t.length){const o=t.map(e=>e.historicalCovers),r=i(e,o.reduce((e,t)=>e+t,0)>0?o:t.map(()=>1));t.forEach((e,t)=>{const o=r[t];o&&(e.floorAdded=o,e.walkIns+=o,e.covers+=o,e.coversHigh=Math.max(e.coversHigh,Math.round(1.2*e.covers)))})}const o=R.reduce((e,t)=>e+t.coversLow,0);if(oMath.max(1,e.covers)));t.forEach((t,o)=>{t.coversLow=Math.min(t.covers,t.coversLow+e[o])})}}const j=p.getHours()+(p.getMinutes()>=30?1:0),W=R.filter(e=>e.hour>=j),F=W[0],B=e=>W.reduce((t,o)=>t+e(o),0),G={covers:B(e=>e.covers),low:B(e=>e.coversLow),high:B(e=>e.coversHigh),takeaway:B(e=>e.takeaway),booked:B(e=>e.booked)},z=[],V=u.settings.capacityPerHour,X=W.reduce((e,t)=>!e||t.covers>e.covers?t:e,void 0);X&&X.covers>=.85*V&&z.push(`Dining room near capacity around ${String(X.hour).padStart(2,'0')}:00 (about ${X.covers} of ${V} covers) \u2014 consider pausing or capping takeaway slots then.`);const Y=W.find(e=>e.historicalCovers>0&&e.covers>1.1*e.historicalCovers);Y&&z.push(`Busier than a usual ${['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][E]} from ${String(Y.hour).padStart(2,'0')}:00 \u2014 consider one more on the floor.`);G.takeaway>=10&&z.push(`About ${G.takeaway} takeaway orders expected \u2014 prep extra haddock and chips.`);H||z.unshift(`Not enough history yet. ${(0,a.notEnoughTip)(b)}`);z.length||z.push('Looks like a normal service \u2014 no action suggested.');return{busy:k,open:!0,nextHour:F,hours:R,restOfDay:G,flags:S,suggestions:z,multiplier:I,example:M,enough:H,minWeeks:b,minCovers:D??void 0}},_e.spread=i,Object.defineProperty(_e,"ANCHORAGE_FORECAST_HOURS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"forecastHoursOf",{enumerable:!0,get:function(){return c}}),_e.forecastWindow=l,Object.defineProperty(_e,"ANCHORAGE_MIN_COVERS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"MIN_COVERS_NOTE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"minCoversOf",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"minCoversOn",{enumerable:!0,get:function(){return y}}),_e.coversRange=function(e,t,o=!0){const r=Math.min(e,t),s=Math.max(e,t),a=r===s?String(r):`${r} to ${s}`;return o?`${a} ${1===s?'Cover':'Covers'}`:a};var e=_r(d[0]),t=_r(d[1]),o=_r(d[2]),r=_r(d[3]),s=_r(d[4]),a=_r(d[5]),n=_r(d[6]);function i(e,t){const o=t.reduce((e,t)=>e+t,0)||1,r=t.map(t=>e*t/o),s=r.map(Math.floor);let a=e-s.reduce((e,t)=>e+t,0);return r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]).forEach(([,e])=>{a>0&&(s[e]++,a--)}),s}const u={0:['12:00','22:00'],1:null,2:null,3:['12:00','22:00'],4:['12:00','22:00'],5:['12:00','22:00'],6:['12:00','22:00']},c=e=>e.settings.forecastHours??('anchorage'===e.id?u:{});function l(e,t){const o=(0,r.hoursFor)(e,t),s=o.close.getMinutes()>0?o.close.getHours():o.close.getHours()-1,a=c(e)[t.getDay()];if(!a)return[o.open.getHours(),s];const[n]=a[0].split(':').map(Number),[i,u]=a[1].split(':').map(Number);return[Math.min(n,o.open.getHours()),Math.max(u>0?i:i-1,s)]}const h={0:50,6:50},f='Gordon, 4 Nov 2026',p=e=>e.settings.minCoversByDay??('anchorage'===e.id?h:{}),y=(e,t)=>{const o=p(e)[t];return o&&o>0?Math.round(o):null}},876,[930,814,1440,833,822,1216,1091]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.estimateWait=function(t,n,u){const o=Math.max(6,Math.round(n/6*u));return t*o}},877,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return y.uuid}}),_e.nowFrom=S,_e.linesFromBasket=w,Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return u.DEMO_CUSTOMER_ID}});var e,t=_r(d[0]),a=_r(d[1]),r=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),o=(e=i)&&e.__esModule?e:{default:e},l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),g=_r(d[9]),m=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),k=_r(d[14]),y=_r(d[15]);const $=(e,t,a)=>e.reduce((e,a)=>a.startsWith(t)?Math.max(e,Number(a.slice(t.length))||0):e,a)+1,I=e=>`${e}-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-3)}`;function S(e){return'live'===e.mode?new Date:new Date(e.simStartMs+(Date.now()-e.anchorRealMs))}function h(){const e=(0,u.defaultSimStart)();return{clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},...(0,u.buildSeed)(e),outbox:[],msgTemplates:{}}}function w(e,t,a){return e.lines.flatMap(e=>{const r=t.find(t=>t.id===e.itemId);if(!r)return[];const n=(0,b.resolveItem)(r),s=(n.optionGroups??[]).flatMap(t=>t.choices.filter(t=>e.choiceIds.includes(t.id))),i=(n.price??0)+s.reduce((e,t)=>e+t.priceDelta,0),o=(0,p.conflictsFor)((0,p.effectiveAllergens)(n,e.choiceIds),a);return[{itemId:n.id,name:n.name,qty:e.qty,unitPrice:i,choices:s.map(e=>e.label),notes:e.notes,contains:o.contains,may:o.may,overridden:!!e.override&&o.contains.every(t=>e.override.allergens.includes(t)),prepMins:n.prepMins,choiceIds:s.map(e=>e.id)}]})}const O=e=>{const t='ABCDEFGHJKLMNPQRSTUVWXYZ23456789',a=()=>Array.from({length:4},()=>t[Math.floor(32*Math.random())]).join('');return`${e}-${a()}-${a()}-${a()}`},C=(0,l.create)()((0,c.persist)((e,t)=>{const a=()=>S(t().clock),r=(t,r,n)=>e(e=>({audit:[{id:I('au'),restaurantId:t,at:a().toISOString(),kind:r,text:n},...e.audit].slice(0,300)})),n=(a,n,s)=>{if(!a||s<=0)return 0;const i=t().giftCards.find(e=>e.code===a&&e.restaurantId===n);if(!i||i.balance<=0)return 0;const o=Math.min(i.balance,s);return e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-o}:e)})),r(n,'giftcard',`Gift card ${a.slice(0,8)}\u2026 redeemed \xa3${(o/100).toFixed(2)} (balance \xa3${((i.balance-o)/100).toFixed(2)})`),o},s=e=>{const a=t().restaurants.find(t=>t.id===e.restaurantId);a&&e.customerId===t().customer.id&&e.subtotal>=a.settings.stampMinSpend&&t().addStamp(e.restaurantId,e.customerId,'takeaway'===e.type?'Takeaway (auto on collection)':'Table QR bill (auto on payment)')},i=e=>(0,f.templatesFor)(t().msgTemplates[e]),o=a=>{a.length&&(e(e=>({outbox:[...a,...e.outbox].slice(0,300)})),(0,f.deliverQueued)(a.filter(e=>'queued'===e.status),(e,a)=>t().updateOutbox(e,a)))},l=(e,r)=>{const n=t().restaurants.find(e=>e.id===r.restaurantId);n&&o((0,f.composeBooking)(e,r,n,i(n.id),a().toISOString()))},c=e=>{const r=t().restaurants.find(t=>t.id===e.restaurantId);r&&o((0,f.composeOrder)(e,r,i(r.id),a().toISOString()))};return{...h(),resetDemo:()=>e(h()),setClockMode:()=>e({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),skipMinutes:()=>{},updateCustomer:t=>e(e=>({customer:{...e.customer,...t}})),setAllergy:(t,a)=>e(e=>{const r=e.customer.allergies.filter(e=>e.allergen!==t);return{customer:{...e.customer,allergies:a?[...r,{allergen:t,severity:a}]:r}}}),startBasket:(t,a,r)=>e(e=>{const n=e.basket.restaurantId===t&&e.basket.mode===a&&e.basket.tableNo===r;return{basket:{restaurantId:t,mode:a,tableNo:r,lines:n?e.basket.lines:[]}}}),addLine:t=>e(e=>({basket:{...e.basket,lines:[...e.basket.lines,{...t,key:I('ln')}]}})),setLineQty:(t,a)=>e(e=>({basket:{...e.basket,lines:a<=0?e.basket.lines.filter(e=>e.key!==t):e.basket.lines.map(e=>e.key===t?{...e,qty:a}:e)}})),overrideLine:(t,r)=>e(e=>({basket:{...e.basket,lines:e.basket.lines.map(e=>e.key===t?{...e,override:{allergens:r,at:a().toISOString()}}:e)}})),clearBasket:()=>e(e=>({basket:{...e.basket,lines:[]}})),placeOrder:({slotTime:n,tip:s,notes:i,phone:o,email:l,customerName:u})=>{const g=t(),m=g.basket,p=m.restaurantId,b=w(m,g.menu,g.customer.allergies),f=b.reduce((e,t)=>e+t.unitPrice*t.qty,0),k='table'===m.mode,I=$(g.orders.filter(e=>e.restaurantId===p).map(e=>e.ref),k?'Q-':'T-',k?g.counters.table:g.counters.order),S=!k,h=f+(S?0:s),O=(u??'').trim()||g.customer.name,C={id:(0,y.uuid)(),ref:`${k?'Q':'T'}-${I}`,restaurantId:p,customerId:g.customer.id,customerName:O,type:m.mode,tableNo:m.tableNo,slotTime:n,lines:b,subtotal:f,tip:S?0:s,giftCardApplied:0,giftCardCode:void 0,total:h,paid:0,status:S?'awaiting_payment':'new',createdAt:a().toISOString(),allergies:g.customer.allergies,readiness:{},notes:i,channel:'app',...'takeaway'===m.mode?{phone:o??g.customer.phone,email:l??g.customer.email}:{}};e(e=>({orders:[C,...e.orders],basket:{...e.basket,lines:[]},counters:k?{...e.counters,table:I}:{...e.counters,order:I}}));const v=b.filter(e=>e.overridden);return r(p,'order',`Order ${C.ref} placed (${k?`Table ${m.tableNo}`:'takeaway'})${v.length?` \u2014 ALLERGY OVERRIDE on ${v.map(e=>e.name).join(', ')}`:''}`),C.allergies.length&&r(p,'allergy',`Allergies declared and confirmed by customer on ${C.ref}: ${C.allergies.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),'awaiting_payment'!==C.status&&c(C),C},setOrderStatus:(a,n,i)=>{const o=t().orders.find(e=>e.id===a);o&&((0,k.statusBlock)(o,n,(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===a?{...e,status:n}:e)})),r(o.restaurantId,'order',`${o.ref} \u2192 ${n}${i?` by ${i}`:''}`),'collected'===n&&'takeaway'===o.type&&s(o)))},ackOrderAllergy:(n,s)=>{const i=t().orders.find(e=>e.id===n);if(!i||!(0,k.canSign)(i,'kitchen',(0,k.linkedBooking)(i,t().bookings)))return;const o={by:s,at:a().toISOString()};e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyAck:o,status:'new'===e.status?'acknowledged':e.status}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 3/5 Kitchen on ${i.ref}: ${s} (chef signed off before cooking)`)},tickOrderAllergy:(n,s,i,o=!0)=>{const l=t().orders.find(e=>e.id===n);if(!l)return;const c={...l.allergyTicks??{}};o?c[s]={by:i,at:a().toISOString()}:delete c[s],e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyTicks:c}:e)})),r(l.restaurantId,'allergy',`${l.ref}: kitchen ${o?'confirmed':'unticked'} ${s} (${i})`)},ackReadiness:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);o&&('cook'===s&&(0,k.statusBlock)(o,'preparing',(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,readiness:{...e.readiness,[s]:{by:i,at:a().toISOString()}},status:'cook'===s&&['new','acknowledged'].includes(e.status)?'preparing':e.status}:e)})),r(o.restaurantId,'order',`${o.ref}: ${'cook'===s?'started cooking':'bagged'} (${i})`)))},handoverCheck:(n,s)=>{const i=t().orders.find(e=>e.id===n);i&&(0,k.canSign)(i,'table',(0,k.linkedBooking)(i,t().bookings))&&(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,handoverCheck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 5/5 Table on ${i.ref}: ${s} (served and checked with the guest; chain complete)`))},signAllergyStep:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o||!i.trim())return!1;const l=(0,k.linkedBooking)(o,t().bookings);if(!(0,k.canSign)(o,s,l))return!1;if('kitchen'===s)return t().ackOrderAllergy(n,i),!0;if('table'===s)return t().handoverCheck(n,i),!0;const c={by:i,at:a().toISOString()};'booked'===s&&l&&l.allergies.length&&!l.allergyAck?e(e=>({bookings:e.bookings.map(e=>e.id===l.id?{...e,allergyAck:c}:e)})):e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyChain:{...e.allergyChain,[s]:c}}:e)}));const u=(0,k.stepInfo)(s);return r(o.restaurantId,'allergy',`Allergen sign-off ${u.n}/5 ${u.label} on ${o.ref}: ${i} (${u.what.toLowerCase()})`),!0},customerSignal:(t,a)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,customerSignal:a}:e)})),setSplit:(t,a,r)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,tip:r,total:e.subtotal+r,split:{ways:a,paidShares:e.split?.paidShares??0}}:e)})),payTable:(a,{shares:i,giftCardCode:o})=>{const l=t().orders.find(e=>e.id===a);if(!l)return;const c=l.split?.ways??1,u=Math.ceil(l.total/c),g=Math.min(c,(l.split?.paidShares??0)+i),m=g>=c,p=m?l.total-l.paid:Math.min(l.total-l.paid,u*i),b=n(o,l.restaurantId,p),f={...l,giftCardApplied:l.giftCardApplied+b,giftCardCode:b?o:l.giftCardCode,paid:l.paid+p,split:{ways:c,paidShares:g},status:m?'closed':l.status};e(e=>({orders:e.orders.map(e=>e.id===a?f:e)})),r(l.restaurantId,'order',`${l.ref} (Table ${l.tableNo}) ${m?'bill paid in full':`share ${g}/${c} paid`} (paid at the till)`),m&&s(f)},createBooking:n=>{const s=$(t().bookings.filter(e=>e.restaurantId===n.restaurantId).map(e=>e.ref),'BK-',t().counters.booking),i=t().restaurants.find(e=>e.id===n.restaurantId)?.settings,o='online'===n.source&&!!i&&(n.partySize>(i.autoAcceptUpTo??7)||!!i.reviewRequests&&!!n.notes.trim()),c={...n,id:(0,y.uuid)(),ref:`BK-${s}`,status:o?'pending':'confirmed',createdAt:a().toISOString()};return e(e=>({bookings:[...e.bookings,c],counters:{...e.counters,booking:s}})),r(c.restaurantId,'booking',`Booking ${o?'request ':''}${c.ref}: ${c.name}, ${c.partySize} on ${c.date} ${c.time}${c.source?` (${c.source})`:''}${c.allergies.length?' \u2014 allergies declared':''}`),l(o?'booking-request':'booking-confirmation',c),c},decideBooking:(n,s,i)=>{const o=t().bookings.find(e=>e.id===n);if(!o||'pending'!==o.status)return;const c={by:i,at:a().toISOString(),outcome:s},u='confirmed'===s?'confirmed':'cancelled';e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:u,decided:c}:e)})),r(o.restaurantId,'booking',`Booking request ${o.ref} (${o.name}, ${o.partySize}) ${s} by ${i}`),l('confirmed'===s?'booking-confirmation':'booking-declined',{...o,status:u})},addOutbox:t=>e(e=>({outbox:[...t,...e.outbox].slice(0,300)})),updateOutbox:(t,a)=>e(e=>({outbox:e.outbox.map(e=>e.id===t?{...e,...a}:e)})),clearOutbox:t=>e(e=>({outbox:e.outbox.filter(e=>e.restaurantId!==t)})),setTemplate:(t,a,r)=>e(e=>{const n={...e.msgTemplates[t]??{}};return null===r?delete n[a]:n[a]={...n[a]??{},...r},{msgTemplates:{...e.msgTemplates,[t]:n}}}),acceptOrder:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o)return!1;const l='new'===o.status&&!!(0,k.statusBlock)(o,'acknowledged',(0,k.linkedBooking)(o,t().bookings)),c=a(),u=i?new Date(c.getTime()+6e4*i).toISOString():o.readyBy;return e(e=>({orders:e.orders.map(e=>e.id===n?{...e,status:'new'!==e.status||l?e.status:'acknowledged',accepted:e.accepted??{by:s,at:c.toISOString()},readyBy:u}:e)})),r(o.restaurantId,'order',`${o.ref} accepted by ${s}${i?`, ready by ${String(new Date(u).getHours()).padStart(2,'0')}:${String(new Date(u).getMinutes()).padStart(2,'0')}`:''}`),!l},setBookingStatus:(n,s)=>{const i=t().bookings.find(e=>e.id===n),o=a().toISOString();e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:s,...'seated'===s?{seatedAt:o}:'finished'===s?{finishedAt:o,table:void 0}:{}}:e)})),i&&r(i.restaurantId,'booking',`${i.ref} ${i.name} \u2192 ${s}`)},seatWalkIn:(n,s,i,o)=>{const l=a(),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,u=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,g=t().bookings.filter(e=>e.restaurantId===n&&e.walkIn&&e.date===c).reduce((e,t)=>Math.max(e,Number(t.ref.slice(2))||0),0)+1,m={id:(0,y.uuid)(),ref:`W-${g}`,restaurantId:n,customerId:null,name:'Walk-in',partySize:s,date:c,time:u,table:i||void 0,allergies:[],notes:(o??'').trim(),status:'seated',security:'none',depositPaid:0,createdAt:l.toISOString(),seatedAt:l.toISOString(),walkIn:!0,source:'walk-in'};return e(e=>({bookings:[...e.bookings,m]})),r(n,'walkin',`Walk-in ${m.ref} seated: ${s} cover(s)${i?`, Table ${i}`:', table to assign'}`),m},setBookingTable:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,table:n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.name} \u2192 ${n?n.includes('+')?`Tables ${n.split('+').join(' + ')}`:`Table ${n}`:'no table'}`)},updateBooking:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,...n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.walkIn?'Walk-in':s.name} moved/updated${n.table?` \u2192 Table ${n.table}`:''}${n.time?` at ${n.time}`:''}${n.durationMins?` for ${n.durationMins} min`:''}`)},undoWalkIn:a=>{const n=t().bookings.find(e=>e.id===a);n&&n.walkIn&&(e(e=>({bookings:e.bookings.filter(e=>e.id!==a)})),r(n.restaurantId,'walkin',`Walk-in ${n.ref} undone`))},ackBookingAllergy:(n,s)=>{const i=t().bookings.find(e=>e.id===n);i&&!i.allergyAck&&(e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,allergyAck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 1/5 Booked on ${i.ref} (${i.name}): ${s} (allergy recorded)`))},joinWaitlist:(n,s,i,o)=>{const l=t().waitlist.filter(e=>e.restaurantId===n).reduce((e,t)=>Math.max(e,t.number),0)+1,c={id:I('wl'),restaurantId:n,number:l,name:s,partySize:i,joinedAt:a().toISOString(),status:'waiting',customerId:o};return e(e=>({waitlist:[...e.waitlist,c]})),r(n,'waitlist',`${s} (${i}) joined the waitlist as #${l}`),c},setWaitlistStatus:(a,n)=>{const s=t().waitlist.find(e=>e.id===a);e(e=>({waitlist:e.waitlist.map(e=>e.id===a?{...e,status:n}:e)})),s&&(r(s.restaurantId,'waitlist',`Waitlist #${s.number} ${s.name} \u2192 ${n}`),'seated'===n&&t().addWalkIn(s.restaurantId,s.partySize))},addWalkIn:(t,a)=>{e(e=>({walkIns:{...e.walkIns,[t]:(e.walkIns[t]??0)+a}})),r(t,'walkin',`Walk-in seated: ${a} cover(s)`)},addStamp:(n,s,i)=>{const o=t().restaurants.find(e=>e.id===n);o&&(e(e=>{const t=e.stampCards.find(e=>e.restaurantId===n&&e.customerId===s),r=t??{restaurantId:n,customerId:s,stamps:0,rewardsAvailable:0,history:[]};let l=r.stamps+1,c=r.rewardsAvailable;l>=o.settings.stampTarget&&(l=0,c+=1);const u={...r,stamps:l,rewardsAvailable:c,history:[{at:a().toISOString(),source:i},...r.history]};return{stampCards:t?e.stampCards.map(e=>e===t?u:e):[...e.stampCards,u]}}),r(n,'stamp',`Stamp added (${i})`))},redeemReward:(t,a)=>{e(e=>({stampCards:e.stampCards.map(e=>e.restaurantId===t&&e.customerId===a&&e.rewardsAvailable>0?{...e,rewardsAvailable:e.rewardsAvailable-1}:e)})),r(t,'stamp','Loyalty reward redeemed')},buyGiftCard:(n,s,i,o)=>{const l=n.slice(0,3).toUpperCase(),c={id:I('gc'),code:O(l),restaurantId:n,initial:s,balance:s,ownerId:t().customer.id,recipientName:i,message:o,createdAt:a().toISOString()};return e(e=>({giftCards:[c,...e.giftCards]})),r(n,'giftcard',`Gift card sold \xa3${(s/100).toFixed(2)} (demo payment)`),c},redeemGiftCard:(a,n,s)=>{const i=t().giftCards.find(e=>e.code.toUpperCase()===a.trim().toUpperCase());return!(!i||n<=0||n>i.balance)&&(e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-n}:e)})),r(i.restaurantId,'giftcard',`Gift card ${i.code} redeemed \xa3${(n/100).toFixed(2)} by ${s}`),!0)},honourLegacyCard:(t,n,s,i)=>{const o={id:I('gc'),code:n.trim().toUpperCase(),restaurantId:t,initial:s,balance:s,ownerId:'legacy',recipientName:'Legacy website bookings gift card',message:`Honoured by ${i}`,createdAt:a().toISOString().slice(0,10),legacy:!0};return e(e=>({giftCards:[o,...e.giftCards]})),r(t,'giftcard',`Legacy website bookings gift card ${o.code} honoured (\xa3${(s/100).toFixed(2)}) by ${i}`),o},addEvent:t=>e(e=>({events:[...e.events,{...t,id:I('ev')}]})),addRating:t=>{e(e=>({ratings:[{...t,id:I('rt'),createdAt:a().toISOString()},...e.ratings],orders:t.orderId?e.orders.map(e=>e.id===t.orderId?{...e,rated:!0}:e):e.orders})),r(t.restaurantId,'rating',`Private rating ${t.stars}/5 from ${t.customerName}`)},updateMenuItem:(a,n)=>{const{name:s,section:i,price:o,allergens:l,allergenNotes:c,...u}=n,g={};void 0!==s&&(g.dish=s),void 0!==i&&(g.section=i),'price'in n&&(g.price=o??null),void 0!==l&&(g.allergens=l),'allergenNotes'in n&&(g.allergenNotes=c);const m='optionGroups'in n,p=(0,b.menuCardBridge)();p&&(Object.keys(g).length||m)&&p.menuEdited(a,g,'CoverCharge for Managers',m);const f=p?u:n;Object.keys(f).length&&e(e=>({menu:e.menu.map(e=>e.id===a?{...e,...f}:e)}));const k=t().menu.find(e=>e.id===a);k&&Object.keys(f).length&&r(k.restaurantId,'menu',`Menu: ${(0,b.resolveItem)(k).name} updated`)},setSignOff:(t,r)=>{const n=(0,b.menuCardBridge)();n?r?n.signOff(t,r):n.menuEdited(t,{},'CoverCharge for Managers',!0):e(e=>({menu:e.menu.map(e=>e.id===t?{...e,signOff:r?{by:r,at:a().toISOString().slice(0,10)}:null}:e)}))},addAudit:(e,t,a)=>r(e,t,a),updateSettings:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,settings:{...e.settings,...a}}:e)})),'takeawayPaused'in a&&r(t,'order',"Takeaway slots "+(a.takeawayPaused?'PAUSED':'resumed'))},addMenuItem:t=>{const a=I('m');return e(e=>({menu:[...e.menu,{...t,id:a}]})),(0,b.menuCardBridge)()?.menuItemAdded({...t,id:a}),r(t.restaurantId,'menu',`Menu: ${t.name} added (recipe card awaiting head chef sign-off)`),a},updateRestaurant:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,...a}:e)})),r(t,'menu',`Restaurant info updated (${Object.keys(a).join(', ')})`)},placeManualOrder:({restaurantId:n,type:s,channel:i,customerName:o,phone:l,email:u,tableNo:g,slotTime:m,lines:f,allergies:k,notes:I,by:S})=>{const h=t(),w=f.flatMap(({itemId:e,qty:t})=>{const a=h.menu.find(t=>t.id===e);if(!a||t<=0)return[];const r=(0,b.resolveItem)(a),n=(0,p.conflictsFor)((0,p.effectiveAllergens)(r),k);return[{itemId:e,name:r.name,qty:t,unitPrice:r.price??0,choices:[],notes:'',contains:n.contains,may:n.may,overridden:!1,prepMins:r.prepMins}]}),O=w.reduce((e,t)=>e+t.unitPrice*t.qty,0),C='table'===s,v=$(h.orders.filter(e=>e.restaurantId===n).map(e=>e.ref),C?'Q-':'T-',C?h.counters.table:h.counters.order),A={id:(0,y.uuid)(),ref:`${C?'Q':'T'}-${v}`,restaurantId:n,customerId:`manual-${i}`,customerName:o||(C?`Table ${g}`:'Walk-in'),type:s,tableNo:g,slotTime:m,lines:w,subtotal:O,tip:0,giftCardApplied:0,total:O,paid:0,status:'new',createdAt:a().toISOString(),allergies:k,readiness:{},notes:I,channel:i,...l?{phone:l}:{},...u?{email:u}:{},...k.length?{allergyChain:{booked:{by:S,at:a().toISOString()}}}:{}};return e(e=>({orders:[A,...e.orders],counters:C?{...e.counters,table:v}:{...e.counters,order:v}})),r(n,'order',`Order ${A.ref} taken by ${S} (${'phone'===i?'phone':'walk-in'===i?'walk-in takeaway':`Table ${g}`})`),k.length&&r(n,'allergy',`Allergen sign-off 1/5 Booked on ${A.ref}: ${S} recorded ${k.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),(l||u)&&c(A),A},ackAlert:(t,r)=>e(e=>({alertAcks:{...e.alertAcks,[t]:{by:r,at:a().toISOString()}}}))}},{name:'covercharge-demo-v1',version:9,migrate:async(e,t)=>{if(!e)return e;if(n.LIVE_VENUE_BUILD)return await(0,s.archiveChefCache)('core',e),Object.assign(e,(0,r.stripCoreLiveSamples)(e)),e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},e;if(e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},t<6){try{e.restaurants=(e.restaurants??[]).map(e=>'saltmarsh'===e?.id?{...e,name:'The Venue'}:e)}catch{}try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e?.id&&JSON.stringify(e.kitchenHours)===JSON.stringify(g.ANCHORAGE_KITCHEN_OLD)?{...e,kitchenHours:g.ANCHORAGE_KITCHEN,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.'}:e)}catch{}}if(t<5)try{e.events=(e.events??[]).map(e=>'string'==typeof e?.title&&/\(substitute day\)/i.test(e.title)?{...e,title:e.title.replace(/\s*\(substitute day\)/gi,'').trim()}:e)}catch{}if(t<4)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id&&e.settings&&!e.settings.pay?{...e,settings:{...e.settings,pay:g.ANCHORAGE_PAY}}:e)}catch{}if(t<3)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id?{...e,settings:{...e.settings,orderAtTable:!1}}:e),e.orders=(e.orders??[]).filter(e=>'ord-seed-3'!==e.id&&'Q-2018'!==e.ref),e.audit=(e.audit??[]).filter(e=>!String(e.text??'').includes('Q-2018'))}catch{}if(t>=2)return e;try{const t=(0,u.buildSeed)((0,u.defaultSimStart)()),a=new Map(t.bookings.map(e=>[e.id,e])),r=new Set((0,m.anchoragePlan)().tables.map(e=>e.name)),n=e=>!e||e.split('+').every(e=>r.has(e));e.bookings=(e.bookings??[]).map(e=>{const t=a.get(e.id);return t?{...e,table:t.table,dog:t.dog,notes:t.notes}:'anchorage'!==e.restaurantId||n(e.table)?e:{...e,table:void 0}})}catch{}return e},merge:(e,r)=>{const n={...r,...e};return a.IS_WILDINGS&&(n.restaurants=n.restaurants.map(t.withWildingsAddress)),n},storage:(0,c.createJSONStorage)(()=>o.default)}))},878,[1192,5,1193,842,1196,1188,993,1189,1205,3,1067,819,1186,827,974,1097]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShallow",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]);function o(e){const t=u.default.useRef(void 0);return u=>{const o=e(u);return(0,n.shallow)(t.current,o)?t.current:t.current=o}}},881,[31,1215]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLE_ORDER_DEFAULT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"cleanToken",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"isTableNo",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fromRow",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"toRow",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"hm",{enumerable:!0,get:function(){return l}}),_e.openAt=function(e,t){const r=a(t),n=e.openFrom?a(e.openFrom):null,o=e.lastOrders?a(e.lastOrders):null;return null!==n&&null!==o?n<=o?r>=n&&r=n||r=n:null===o||r{const t=(e??'').trim().toUpperCase();return/^[A-Z2-9]{16}$/.test(t)?t:null},r=e=>/^[0-9]{1,4}$/.test(e),n=t=>t?{on:!!t.is_on,tables:Array.isArray(t.tables)?t.tables.map(String):null,staffAccept:!1!==t.staff_accept,openFrom:t.open_from?String(t.open_from).slice(0,5):null,lastOrders:t.last_orders?String(t.last_orders).slice(0,5):null,guestTip:t.guest_tip??''}:{...e},o=e=>({is_on:e.on,tables:e.tables&&e.tables.length?e.tables.filter(r):null,staff_accept:e.staffAccept,open_from:e.openFrom,last_orders:e.lastOrders,guest_tip:e.guestTip.slice(0,300)}),a=e=>{const[t,r]=e.split(':').map(Number);return 60*t+r},l=e=>`${String(Math.floor(e/60)%24).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`;const s=(e,t)=>e.reduce((e,r)=>e+r.qty*(t.find(e=>e.id===r.id)?.pricePence??0),0),u=(e,t,r)=>e.map(e=>t.find(t=>t.id===e.id)).filter(e=>!!e&&(e.allergens.some(e=>r.includes(e))||e.mayContain.some(e=>r.includes(e)))),c=(e,t)=>`${e.replace(/\/$/,'')}/t?k=${t}`,f=(e,t)=>`${e.replace(/\/$/,'')}/customer-app/index.html?table=${t}`,p=e=>{const t=e.trim();return t.length>=2&&t.length<=40&&/\p{L}/u.test(t)},b=e=>{const t=e.trim();return!t||/^\+?[0-9][0-9 ()-]{6,19}$/.test(t)},m=e=>'table'===e.type&&'table-qr'===e.channel,y=e=>m(e)&&!!e.held&&!e.accepted&&'cancelled'!==e.status,h=e=>!y(e),O=e=>'cancelled'===e.status?e.cancelReason?`Cancelled: ${e.cancelReason}`:'Cancelled by the staff.':e.held&&!e.accepted?'Sent. Waiting for a member of staff to accept it.':'served'===e.status||'collected'===e.status||'closed'===e.status?'Served. Enjoy!':'ready'===e.status?'Ready: on its way to your table.':'Accepted: the kitchen has your order.',P=['Sold out','Wrong table','Sent twice','Kitchen closed','Guest asked to cancel'],j='Pay at the bar or with your server. Paying by card from your phone is coming later.'},884,[]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.venueBusy=function(n,s,a){const d=(0,t.ymd)(new Date(a.getTime()-48384e5)),r=(0,t.ymd)(a),u=n.settings.busyLearningSince,o=u&&/^\d{4}-\d{2}-\d{2}$/.test(u)&&u>d?u:d,l=new Map,y=new Set,c=new Set,h=new Set;for(const a of s){if(h.has(a.id)||a.restaurantId!==n.id||a.date=r||!['confirmed','seated','finished'].includes(a.status)||!Number.isFinite(a.partySize)||a.partySize<=0)continue;h.add(a.id),y.add(a.date);const s=new Date(a.date+'T12:00:00');s.setDate(s.getDate()-(s.getDay()+6)%7),c.add((0,t.ymd)(s));const d=a.date+'T'+a.time.slice(0,2);l.set(d,(l.get(d)??0)+a.partySize)}const w=[...l.values()].sort((t,n)=>t-n),f=[...y].sort(),M=(f.length?Math.round((new Date(r+'T12:00:00').getTime()-new Date(f[0]+'T12:00:00').getTime())/864e5):0)>=28&&c.size>=4&&y.size>=16&&w.length>=40,b=n.settings.busyCoversPerHour,v=Number.isFinite(b)&&b>=1?Math.round(b):30,S=M&&!1!==n.settings.busyLearning,z=S?Math.max(1,Math.ceil(w[Math.ceil(.85*w.length)-1])):v,D=Math.max(1,Math.ceil(z/2));return{busy:z,steady:D,learned:S,weeks:c.size,enough:M,words:`Busy level: ${z} Covers an hour (${S?`learned from your last ${c.size} weeks`:null!=b?'set by you':'starting level'})`}},e.hourlyBand=function(t,n){return t>=n?'Busy':t>=Math.ceil(n/2)?'Steady':'Quiet'};var t=_r(_d[0])},930,[822]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_BG",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SOUTERS_SURFACE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_TYPE_SCALE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"soutersFont",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"soutersSurface",{enumerable:!0,get:function(){return f}}),e.soutersInk=function(o){if(!t.IS_SOUTERS)return o;const c=(0,n.normaliseHex)(o);return c?'#A4622E'===c?'#D9AD8A':(0,n.contrast)(c,u)<4.5?'#FFFFFF':o:o};var t=r(d[0]),n=r(d[1]);const u='#56152A',o='#43122F',c=.88,S=n=>t.IS_SOUTERS?Math.round(n*c*100)/100:n,f=n=>t.IS_SOUTERS?o:n},931,[5,1345]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEEN",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOUTERS_GUIDE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"KIRKMICHAEL_GUIDE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WILDINGS_GUIDE",{enumerable:!0,get:function(){return o}}),_e.guideCalendarEvents=function(e,t){return e.events.filter(e=>e.date).map(e=>({id:`${t}-ev-${e.date}-${e.title.toLowerCase().replace(/[^a-z0-9]+/g,'-').slice(0,40)}`,restaurantId:t,date:e.date,title:e.title,kind:'event',description:`${e.when}. ${e.detail}`,example:!1,source:e.source,time:e.time}))};const e='10 November 2026',t={id:'souters',name:"Souter's Inn",place:'Kirkoswald, Ayrshire',about:["Souter's Inn is a restaurant and bar in the village of Kirkoswald, Ayrshire. The official site describes a cosy country welcome and menus built around regional produce, with a bar, an ice cream shop and cake corner, and an upstairs dining room for private events.","The building stands on the site of the school house that Robert Burns attended in 1772, according to the official about page. Souter Johnnie's house and the old parish church and graveyard, known from Tam o' Shanter, are nearby.",'The official menu page says the inn can seat up to 130 diners. It also has a takeaway menu and lists breakfast every day.'],hoursTitle:'Opening hours',hoursLines:['Open daily from 9am, seven days a week.','Breakfast: 9am\u201311.45am, Monday to Sunday.','\xc0 la carte, children\u2019s, vegetarian and takeaway menus: 12 noon\u20139pm, Monday to Sunday.','Desserts: 9am\u20139pm, Monday to Sunday.','Meat Feast menu: every Tuesday, 12 noon\u20139pm.'],hoursNotes:['These kitchen hours are from the official menu page, checked 10 November 2026. The official homepage also says the inn is open daily from 9am.','Destination South Ayrshire, checked the same day, lists the inn open 9am\u20139pm, seven days a week, and says food is served all day.','Christmas Day and other festive closing times were not published on the official site on 10 November 2026. Bar last orders are not listed separately from the 9pm food hours.'],hoursSource:'https://www.soutersinn.com/menu and https://www.soutersinn.com/ (10 November 2026); Destination South Ayrshire listing also checked the same day.',festive:{title:'Festive flavours, from 1 December',lines:['Festive dishes are served from 1 December, alongside the usual menu.','A set festive menu is offered for tables of 10 or more: two courses \xa329.95 or three courses \xa335.95, Monday to Sunday 12 noon\u20139pm, with crackers included. Coffee or tea with a mince pie is \xa33.00.'],source:'https://www.soutersinn.com/ and the Festive Menu PDF linked from https://www.soutersinn.com/menu (10 November 2026).'},eventsIntro:'The official What\u2019s On page describes regular quiz nights and live music, but on 10 November 2026 the only dated listing was already in the past. Upcoming details below are taken from the official homepage and festive menu. Call 01655 760653 to ask about dates.',events:[{title:'Festive dishes and set festive menu',when:'From 1 December 2026',date:'2026-12-01',detail:'Festive dishes join the usual menu from 1 December. The set festive menu is for tables of 10 or more, two courses \xa329.95 or three courses \xa335.95, 12 noon\u20139pm, crackers included.',source:'https://www.soutersinn.com/ and festive menu PDF (10 November 2026).'}],regularEvents:[{title:'Meat Feast Tuesdays',detail:'Every Tuesday, 12 noon\u20139pm, with a dedicated meat feast menu.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Quiz nights and live music',detail:'The official What\u2019s On page says quiz nights and weekend live music are a regular part of the calendar. No future dates were published on 10 November 2026 \u2014 call to ask what\u2019s next.',source:'https://www.soutersinn.com/whatson (10 November 2026).'}],address:'47 Main Road, Kirkoswald, Ayrshire KA19 8HY',phone:'01655 760653',email:'souters@southernayr.com',website:'https://www.soutersinn.com/',websiteLabel:'soutersinn.com',socials:[{label:'Facebook',url:'https://www.facebook.com/soutersinn'},{label:'Instagram',url:'https://www.instagram.com/soutersinn/'},{label:'TikTok',url:'https://www.tiktok.com/@souters_inn'}],mapQuery:'Souter\'s Inn, 47 Main Road, Kirkoswald, KA19 8HY',booking:['Send a table request in this app, or call 01655 760653. Staff will confirm. No payment is taken here.','A general table deposit and cancellation policy was not published on the official website on 10 November 2026.'],policies:[{title:'Allergens',body:'Menus can change with the season and fresh produce. Please tell waiting staff about allergens or other dietary needs before you order.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Parking and access',body:'Destination South Ayrshire, checked 10 November 2026, lists parking, blue badge parking, disabled access, free Wi-Fi, and a welcome for walkers and cyclists. The official website does not spell these out itself.',source:'https://destinationsouthayrshire.co.uk/eat-and-drink/souters-inn/ (10 November 2026).'},{title:'Children',body:'A children\u2019s menu is served Monday to Sunday, 12 noon\u20139pm.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Dogs',body:'A dog policy was not published on the official website or the Destination South Ayrshire listing on 10 November 2026. Please call to ask.',source:'Official site and Destination South Ayrshire, 10 November 2026.'}],drinks:{title:'The bar',body:'The official menu page describes a bar with wines, ales, whiskies and cocktails. A priced drinks list was not published on the pages checked on 10 November 2026.',source:'https://www.soutersinn.com/menu (10 November 2026).'},awards:['TripAdvisor Travellers\u2019 Choice 2026, and 4.3 out of 5 from 1,119 TripAdvisor reviews, checked 10 November 2026.'],reviews:[{summary:'4.3 out of 5 from 1,119 reviews on TripAdvisor, and a Travellers\u2019 Choice award in 2026.',source:'TripAdvisor listing for Souter\u2019s Inn, Kirkoswald, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g3649164-d6729564-Reviews-Souter_s_Inn-Kirkoswald_South_Ayrshire_Ayrshire_Scotland.html',quotes:[{text:'Absolute perfection from start to finish! \u2026 The atmosphere is warm and welcoming, and the service was top-notch right from the moment we walked through the door.',by:'Anna',date:'6 October 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'},{text:'The staff were superb, the ambiance was amazing. By far the best pub food I have ever had. Could not fault this establishment at all.',by:'johnhK5391CS',date:'28 September 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'},{text:'Really put these guys to the test today, table of 12 from toddlers to grandparents, everyone enjoyed their food, service was fantastic.',by:'Kate',date:'9 October 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'}]}],functions:[{title:'Upstairs private dining',body:'The official functions page says the upstairs room comfortably seats 45, or 60 standing, with its own private bar. It is offered for birthdays, family dinners, funeral gatherings, baby showers, ticketed events and live music, with options from afternoon tea and buffets to three-course menus.',source:'https://www.soutersinn.com/functions (10 November 2026).'},{title:'Mezzanine seating',body:'The official menu page describes the upper mezzanine as a private dining area with its own oak bar, overlooking the patisserie and the lower bar, and says it can seat up to 70 guests. That figure differs from the 45 seated / 60 standing numbers on the functions page. Both are from the official site; please ask the venue which applies to your booking.',source:'https://www.soutersinn.com/menu and https://www.soutersinn.com/functions (10 November 2026).'}],giftVouchers:'Gift vouchers are listed on the official website. Call 01655 760653 or use the Gift Voucher link on soutersinn.com to ask. No payment is taken in this app.',photos:[{file:'gallery-1.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7160-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'gallery-2.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7187-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'gallery-3.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7218-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'upstairs-1.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+1-1920w.jpg',page:'https://www.soutersinn.com/functions'},{file:'upstairs-2.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+2-1920w.jpg',page:'https://www.soutersinn.com/functions'},{file:'upstairs-3.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+3-1920w.jpg',page:'https://www.soutersinn.com/functions'}],gaps:['Christmas Day and other festive closing times not published on the official site (10 November 2026).','Dog policy not published.','Priced wine, ale and cocktail lists not on the official pages checked.','A general table deposit policy was not published (ticketed events have used a deposit in the past).','Bar last orders not listed separately.','A current VisitScotland listing was not retrieved today (the page request failed).','No live Google review count was confirmed today \u2014 TripAdvisor figures were used instead.'],conflicts:['Functions page: upstairs seats 45, or 60 standing. Menu page: mezzanine seats up to 70. Prefer neither figure alone \u2014 both are official; shown together.','Official about page: Burns attended the school house in 1772. Destination South Ayrshire says 1775. The app uses 1772 from the official site.']},s={id:'kirkmichael',name:'The Kirkmichael Arms',place:'Kirkmichael, Ayrshire',about:['The Kirkmichael Arms is a Michelin-listed restaurant and bar in the village of Kirkmichael, South Ayrshire. The official site says it has been a pub since 1700, and names it Best Scottish Pub at The Scotsman Scran Awards 2025.','Chef and owner Justin Galea, who trained in Melbourne, took the pub on sight unseen after it closed in 2023, when two locals set out to bring it back as the heart of the village. The Herald has named him one of the 50 most exciting chefs working in Scotland.','The kitchen smokes its own salmon, churns butter, cures bacon and bakes bread, drawing on Scottish produce with classical French technique and occasional Asian influences. The official site is clear that it is still a proper pub \u2014 Sunday lunch, a pint by the fire, or a full dinner.'],hoursTitle:'Opening hours',hoursLines:['Monday to Wednesday: closed.','Thursday to Sunday: from 1pm, until 10.30pm.'],hoursNotes:['The visible official website copy, checked 10 November 2026, says \u201cThursday to Sunday from 1pm\u201d and does not print a closing time. The same official homepage publishes hours data of 13:00\u201322:30 on those days, which is what is shown above.','Kitchen last orders are not listed separately from closing time.','Opening times between Christmas and New Year were still \u201cto be confirmed\u201d on the official Christmas 2026 page (updated 9 October 2026, checked 10 November 2026). The restaurant is closed on Christmas Day.'],hoursSource:'https://www.kirkmichaelarms.co.uk/ (visible copy and published hours data, 10 November 2026).',festive:{title:'Christmas and New Year 2026',lines:['Christmas Day boxes, for cooking at home, can be collected on Wednesday 23 December: \xa3205 feeds 4, or \xa3310 feeds 6, paid when you order. Email enquiries@thekirkmichaelarms.co.uk. Optional extras include beech-smoked salmon at \xa310 per 100g and bottled cocktails at \xa335\u2013\xa340.','Friday 11 December: Secret Santa name share. Friday 18 December: Christmas quiz, Secret Santa and pub Christmas party. Saturday 19 December: carol night, with loaded hot chocolate, mulled wine and mince pies. Sunday 20 December: Unofficial Christmas Lunch (also the Sunday carvery).','Christmas Eve (24 December): \xe0 la carte, no set festive menu. Christmas Day: restaurant closed. Boxing Day (26 December): dinner. Sunday 27 December: open as normal. New Year\u2019s Eve (31 December): \xa3125 per person.','Sunday carvery from 1pm on 6, 13, 20 and 27 December. Private Christmas parties and pub buyouts are available \u2014 email to discuss.'],source:'https://www.kirkmichaelarms.co.uk/wilderness-journal/best-christmas-dining-ayrshire (updated 9 October 2026, checked 10 November 2026).'},eventsIntro:'The official bar page mentions quiz nights and open-mic jams as part of pub life, without a dated public calendar beyond the Christmas 2026 lineup below.',events:[{title:'Secret Santa name share',when:'Friday 11 December 2026',date:'2026-12-11',detail:'Share your name for the Secret Santa, or drop your name and gift in any time before 18 December.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas quiz, Secret Santa and pub party',when:'Friday 18 December 2026',date:'2026-12-18',detail:'Festive quiz and the Matt Davey Secret Santa Extravaganza, with a stick-or-twist gift draw.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Carol night at the Arms',when:'Saturday 19 December 2026',date:'2026-12-19',detail:'Christmas music by the fire, with loaded hot chocolate, mulled wine and mince pies.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Unofficial Christmas Lunch and Sunday carvery',when:'Sunday 20 December 2026, from 1pm',date:'2026-12-20',time:'13:00',detail:'A proper Christmas roast on the Sunday before Christmas Day, and a Sunday carvery from 1pm.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas box collection',when:'Wednesday 23 December 2026',date:'2026-12-23',detail:'Collect Christmas Day boxes ordered in advance (\xa3205 for 4 or \xa3310 for 6). Restaurant is closed on Christmas Day.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas Eve dining',when:'Thursday 24 December 2026',date:'2026-12-24',detail:'\xc0 la carte, with no set Christmas menu.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Boxing Day dinner',when:'Saturday 26 December 2026',date:'2026-12-26',detail:'Open for dinner on Boxing Day.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Sunday carvery',when:'Sunday 27 December 2026, from 1pm',date:'2026-12-27',time:'13:00',detail:'Open as normal, with Sunday carvery from 1pm.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'New Year\u2019s Eve',when:'Thursday 31 December 2026',date:'2026-12-31',detail:'New Year\u2019s Eve, \xa3125 per person. Opening times earlier in that week were still to be confirmed.',source:'Official Christmas 2026 page, checked 10 November 2026.'}],regularEvents:[{title:'Quiz nights and open-mic jams',detail:'The official bar page lists quiz nights and open-mic jams as part of regular pub life. No separate future dates were published on 10 November 2026, apart from the Christmas quiz on 18 December.',source:'https://www.kirkmichaelarms.co.uk/bar (10 November 2026).'},{title:'Sunday carvery',detail:'Sunday carvery is a regular service. In December 2026 it is from 1pm on the 6th, 13th, 20th and 27th.',source:'Official Christmas 2026 page and Sunday carvery journal, 10 November 2026.'},{title:'Whisky tasting',detail:'The official site has a whisky tasting page and describes a carefully chosen malt list. Ask staff about current tastings and prices \u2014 many list prices were unpublished on the sample drinks menus.',source:'https://www.kirkmichaelarms.co.uk/ (10 November 2026).'}],address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',phone:'01655 750 200',email:'enquiries@thekirkmichaelarms.co.uk',website:'https://www.kirkmichaelarms.co.uk/',websiteLabel:'kirkmichaelarms.co.uk',socials:[{label:'Facebook',url:'https://www.facebook.com/kirkmichaelarms/'},{label:'Instagram',url:'https://www.instagram.com/kirkmichaelarms_unfiltered/'}],mapQuery:'The Kirkmichael Arms, 3-5 Straiton Road, Kirkmichael, KA19 7PH',booking:['Send a table request in this app, or call 01655 750 200, or email enquiries@thekirkmichaelarms.co.uk. Staff will confirm. No payment is taken here.','The official website, checked 10 November 2026, says: if you cancel less than 48 hours before your booking, or do not show up, there is a \xa325 charge per person. Parties of 6 or more are asked for a \xa315 per person deposit, redeemed when you visit.','Pub buyouts: Monday to Thursday \xa33,500; Friday to Sunday \xa35,000. Email for availability.'],policies:[{title:'Cancellation and deposits',body:'The venue\u2019s own website says a \xa325 per person charge applies if you cancel less than 48 hours before your booking or do not show up. Larger parties of 6 or more are asked to pay a \xa315 per person deposit, redeemed at the time of your visit. No deposit is taken in this app.',source:'https://www.kirkmichaelarms.co.uk/booking (10 November 2026).'},{title:'Dogs',body:'The official Sunday carvery journal says dogs are welcome in the pub area, and that there is no dress code.',source:'https://www.kirkmichaelarms.co.uk/wilderness-journal/best-sunday-carvery-ayrshire (10 November 2026).'},{title:'Children',body:'A sample children\u2019s menu is published, at \xa314.95 for three courses.',source:'https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'},{title:'Parking',body:'The official Sunday carvery journal says there is plenty of parking in the village. A dedicated venue car park is not described on the official pages checked.',source:'Official Sunday carvery journal, 10 November 2026.'},{title:'Accessibility',body:'An accessibility statement was not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Allergens',body:'Please speak to staff about allergens. Allergen information was not published on the sample menus checked on 10 November 2026.',source:'https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'}],drinks:{title:'The bar',body:'The official bar page describes a proper pub, with local beers, carefully chosen wines and malts, quiz nights and open-mic jams. Sample whisky and wine menus are on the official menus page; many prices were unpublished (ask staff).',source:'https://www.kirkmichaelarms.co.uk/bar and https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'},awards:['Best Scottish Pub, The Scotsman Scran Awards 2025 (official site, 10 November 2026).','Michelin-listed / Michelin-recommended (official site, 10 November 2026).','Justin Galea named among The Herald\u2019s 50 most exciting chefs in Scotland (official site, 10 November 2026).'],reviews:[{summary:'4.6 out of 5 from 700 reviews on TripAdvisor, checked 10 November 2026.',source:'TripAdvisor listing for The Kirkmichael Arms, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g551837-d2637644-Reviews-The_Kirkmichael_Arms-Maybole_South_Ayrshire_Ayrshire_Scotland.html',quotes:[]}],functions:[{title:'Private Christmas parties and pub buyouts',body:'The official Christmas page says larger gatherings can have a dedicated space and festive menus, and that pub buyouts are offered. The official booking page lists buyout rates of \xa33,500 Monday to Thursday and \xa35,000 Friday to Sunday.',source:'Official Christmas 2026 page and https://www.kirkmichaelarms.co.uk/booking (10 November 2026).'}],photos:[{file:'exterior.jpg',alt:'The Kirkmichael Arms, from the official website',source:'https://www.kirkmichaelarms.co.uk/photos/Kirkmichael%20Arms-20_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/'},{file:'interior.jpg',alt:'Inside The Kirkmichael Arms, from the official website',source:'https://www.kirkmichaelarms.co.uk/photos/Kirkmichael%20Arms-895_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/'},{file:'bar.jpg',alt:'The bar at The Kirkmichael Arms',source:'https://www.kirkmichaelarms.co.uk/photos/bar/Kirkmichael-Arms-825.jpg',page:'https://www.kirkmichaelarms.co.uk/bar'},{file:'restaurant.jpg',alt:'The restaurant at The Kirkmichael Arms',source:'https://www.kirkmichaelarms.co.uk/photos/restaurant/Kirkmichael-Arms-412_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/restaurant'},{file:'story.jpg',alt:'The Kirkmichael Arms, from the official story page',source:'https://cdn.sanity.io/images/1er2n88p/production/6f2f9988ce1bf9df9c63a12af667ae89d5442bfb-1600x1067.jpg',page:'https://www.kirkmichaelarms.co.uk/our-story'},{file:'contact.jpg',alt:'The Kirkmichael Arms, from the official contact page',source:'https://www.kirkmichaelarms.co.uk/photos/contact/Kirkmichael%20Arms-544.jpg',page:'https://www.kirkmichaelarms.co.uk/contact'}],gaps:['Kitchen last orders not published separately.','Hours between Christmas and New Year still to be confirmed on the official Christmas page.','Accessibility details not published.','No official guest quotes on the website \u2014 only the TripAdvisor rating is shown.','A live Google review count was not confirmed today.','VisitScotland listing not confirmed today.','Many whisky and wine prices unpublished on the sample drinks menus.'],conflicts:['Visible official copy says \u201cfrom 1pm\u201d; official hours data on the same homepage lists 13:00\u201322:30. The app shows both, and uses 22:30 as the published close.']},o={id:'wildings',name:'Wildings Hotel & Restaurant',place:'Maidens, Ayrshire',about:['Wildings is a family-run hotel and restaurant in the harbour village of Maidens, on the Ayrshire coast, looking out over the Firth of Clyde towards Arran. The official site says it has two contemporary restaurants and 11 comfortable bedrooms, many with sea views.','It is run by the Sage family, now in its second generation. The official homepage names the owners as Dorothy, Sonya and Nicola. They describe warm hospitality and food made from local, seasonal produce from land and sea.','The village sits by a sandy beach and a historic harbour, with Culzean Castle and Country Park along the coast and golf courses nearby.'],hoursTitle:'Kitchen hours',hoursLines:['Lunch, Monday to Saturday: 12 noon\u20132pm.','Sunday lunch: 12 noon\u20132.30pm.','Dinner, every day: 6pm\u20139pm.'],hoursNotes:['These hours are from the official homepage, checked 10 November 2026. The kitchen is closed between lunch and dinner.','The lunch menu PDF still prints Sunday lunch as 12 noon\u20132.00pm, which is earlier than the website\u2019s 2.30pm. The app follows the official website for hours, and notes the PDF difference.','Bar opening hours, and Christmas or other seasonal closing times, were not published on the official pages checked on 10 November 2026. Please call 01655 331 401 to ask.'],hoursSource:'https://www.wildingshotel.com/ (10 November 2026). Lunch PDF conflict noted from the official menus linked at https://www.wildingshotel.com/team.',eventsIntro:'No dated public events, quiz nights or festive opening hours were published on the official pages checked on 10 November 2026. Call or email to ask about private dining, celebrations and seasonal hours.',events:[],regularEvents:[],address:'Maidens Rd, Maidens, Girvan, KA26 9NR',phone:'01655 331 401',email:'bookings@wildingsrestaurant-hotel.co.uk',website:'https://www.wildingshotel.com/',websiteLabel:'wildingshotel.com',socials:[{label:'Facebook',url:'https://www.facebook.com/profile.php?id=100057663900963'},{label:'Instagram',url:'https://www.instagram.com/wildingsmaidens/'}],mapQuery:'Wildings Hotel, Maidens Rd, Maidens, Girvan, KA26 9NR',booking:['Send a table or room request in this app, or call 01655 331 401, or email bookings@wildingsrestaurant-hotel.co.uk. Staff will confirm. No payment is taken here.','A deposit or cancellation policy was not published on the official website on 10 November 2026.','Visit Girvan, a local guide checked the same day, says booking is essential, especially at weekends, in summer and during busy golf events on the coast, and that hours can shift seasonally \u2014 confirm when you book.'],policies:[{title:'Allergens',body:'Please tell the person taking your order about any allergies. The official menus say the venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.',source:'Official menu PDFs linked from https://www.wildingshotel.com/team (10 November 2026).'},{title:'Parties of six or more',body:'Parties of six or more: no separate or split bills.',source:'Official menu PDFs, 10 November 2026.'},{title:'Children',body:'A children\u2019s menu is offered for under 11s, at \xa39 for one course, \xa310 for two courses or \xa311 for three courses, with extra servings at \xa33.95.',source:'Official kids menu PDF, 10 November 2026.'},{title:'Parking',body:'The official website does not itself describe parking. A guest testimonial on the official homepage mentions \u201cplenty of parking\u201d. TripAdvisor\u2019s hotel listing, checked 10 November 2026, lists free parking. Visit Girvan says parking is at the Harbour Road car park.',source:'Official homepage testimonial; TripAdvisor hotel listing; https://www.girvanholidayhome.co.uk/wildings-restaurant-maidens.html (all 10 November 2026).'},{title:'Dogs',body:'A dog policy was not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Accessibility',body:'Accessibility details were not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Check-in and check-out',body:'Check-in and check-out times were not published on the official website on 10 November 2026. Please ask the hotel when you book.',source:'Official site, 10 November 2026.'}],drinks:{title:'Drinks',body:'A guest testimonial on the official homepage mentions a good selection of alcoholic and non-alcoholic drinks. A priced wine or bar list was not published on the official pages checked on 10 November 2026. Ask staff.',source:'https://www.wildingshotel.com/ (10 November 2026).'},awards:[],reviews:[{summary:'On TripAdvisor, checked 10 November 2026: the restaurant listing is 4.4 out of 5 from 1,326 reviews, and the hotel listing is 4.6 out of 5 from 89 reviews.',source:'TripAdvisor restaurant and hotel listings for Wildings, Maidens, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g947977-d951940-Reviews-Wildings_Hotel_and_Restaurant-Maidens_South_Ayrshire_Ayrshire_Scotland.html',quotes:[{text:'Huge room (room 2), lovely view of the seafront \u2026 Room was comfortable and warm. Always amazing food expertly prepared \u2026 Staff are all friendly and chatty \u2026 plenty of parking.',by:'Lynn Pope',source:'Testimonial on https://www.wildingshotel.com/ (10 November 2026).'}]}],rooms:{intro:'The official site lists 11 bedrooms, including single, double, king, twin and family rooms, many with sea views and a full Scottish breakfast included. Call reception on 01655 331 401, or email, to enquire.',items:[{name:'Double room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'King room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'Twin room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'Family room',price:'From \xa3205',note:'Including full Scottish breakfast.'}],source:'https://www.wildingshotel.com/prices (10 November 2026).',notes:['Single rooms are mentioned on the official accommodation page, but no single-room price was published on 10 November 2026 \u2014 please call to ask.','Prices can change. Confirm with the hotel when you book.']},functions:[{title:'Private dining',body:'The official website shows a private dining room among its restaurant photographs. No published capacity, hire rate or wedding package was found on the official pages checked on 10 November 2026. Call or email to ask.',source:'https://www.wildingshotel.com/ (10 November 2026).'}],photos:[{file:'exterior.jpg',alt:'The exterior of Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/out1-508w.jpg',page:'https://www.wildingshotel.com/'},{file:'room.jpg',alt:'A bedroom at Wildings, from the official accommodation page',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Room+Wildings+edit-680w.png',page:'https://www.wildingshotel.com/prices'},{file:'booths.jpg',alt:'Restaurant booths at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+boths+in+restaurant-1920w.png',page:'https://www.wildingshotel.com/'},{file:'restaurant.jpg',alt:'The main restaurant at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+main+restaurant-1920w.png',page:'https://www.wildingshotel.com/'},{file:'private-dining.jpg',alt:'Private dining at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+restaurant+private-1920w.png',page:'https://www.wildingshotel.com/'},{file:'fish.jpg',alt:'A fish dish at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Fish+close+up+widlings-1920w.png',page:'https://www.wildingshotel.com/'}],gaps:['Bar hours not published.','Christmas and seasonal hours not published.','Dog policy, accessibility, and official check-in / check-out times not published.','Single-room price not published.','No priced drinks list.','No official events calendar found.','A live Google review count was not confirmed today.','VisitScotland listing not confirmed today.'],conflicts:['Official footer and contact page use Maidens Rd, Maidens, Girvan, KA26 9NR. TripAdvisor listings (hotel and restaurant) and some older pages use Harbour Road, same postcode. The app uses Maidens Rd from the official site.','Official website Sunday lunch to 2.30pm; official lunch PDF still says 12 noon\u20132.00pm. The app follows the website for hours.']}},932,[]); +__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])},933,[31,1067,825,818,25]); +__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])},934,[990,951]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},935,[31,128,1419,825,988,818,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:l,inStaffApp:n,shiftManager:a,big:o,testID:d}){const[h,p]=(0,t.useState)(!1),x=(0,u.useSession)(e=>e.meId),y=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:n,role:l,shiftManager:a})||x&&!(0,m.canChangeBookings)(y)?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S.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:()=>p(!0),style:{minHeight:o?64:44}}),h?(0,$.jsx)(F,{rid:e,id:s.id,who:i,onClose:()=>p(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:l,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,n.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,$.jsx)(F,{rid:e,id:o,who:i,hidePrivate:a,onClose:l}):(0,$.jsxs)(S.Sheet,{visible:!0,onClose:l,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,$.jsx)(S.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${N(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}, ${N(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,$.jsx)(S.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,$.jsx)(S.Button,{kind:"ghost",label:"Close",onPress:l,style:{minHeight:44}})]})},_e.EditBookingSheet=F;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),l=(e=i)&&e.__esModule?e:{default:e},n=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),u=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),C=_r(_d[19]),f=_r(_d[20]),I=_r(_d[21]),w=_r(_d[22]),k=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]);const P=/^([01]\d|2[0-3]):[0-5]\d$/,O=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const N=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,j.ymd)(s)?'Tomorrow':B(e)};const E=e=>e?(e/100).toFixed(e%100?2:0):'',W=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},B=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',z=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')}`:''},R=e=>e.charAt(0).toUpperCase()+e.slice(1);function L({title:e,children:t,testID:s}){return(0,$.jsxs)(l.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:y.colours.hairline,alignItems:'stretch'},children:[(0,$.jsx)(S.T,{size:17,weight:"semibold",center:!0,colour:y.colours.goldLight,children:e}),t]})}const A=({label:e,value:t,onChange:s,max:i=20,testID:l})=>(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,children:e}),(0,$.jsx)(S.Stepper,{testID:l,value:t,min:0,max:i,onChange:s,label:e})]});function F({rid:e,id:i,who:u,onClose:b,hidePrivate:m=!1}){(0,I.useBlurOutside)();const N=(0,n.useBookings)(e),F=N.find(e=>e.id===i),M=(0,d.useRestaurant)(e),H=(0,a.usePlan)(e),_=(0,o.useBlocks)(e=>e.blocks),[V,Y]=(0,t.useState)(F?(0,c.draftOf)(F):null),[G,U]=(0,t.useState)(null),[q,X]=(0,t.useState)(null),[K,Q]=(0,t.useState)(E(F?(0,c.draftOf)(F).depositDue:0)),[J,Z]=(0,t.useState)(E(F?(0,c.draftOf)(F).depositAmount:0)),[ee,te]=(0,t.useState)(B(F?(0,c.draftOf)(F).depositDate:''));if(!F||!V||!M)return null;const se=e=>{U(null),X(null),Y({...V,...e})},ie=(0,k.depositOf)(M.settings),le=e=>{const t=e.partySize??V.partySize,s=Math.min(e.children??V.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(F)&&V.depositOn&&!V.depositPaid&&W(K||'0')===(0,k.depositDue)(ie,V.partySize,V.children??0)){const e=(0,k.depositDue)(ie,t,s);e>0&&Q(E(e))}se({...e,children:s})},ne=O(V.time),ae=P.test(ne),oe=V.area?H.areas.filter(e=>e.name===V.area).map(e=>e.id):null,de=e=>!oe||e.split('+').every(e=>oe.includes(H.tables.find(t=>t.name===e)?.areaId??'')),re=(0,x.tableOptions)(H,N.filter(e=>e.date===V.date),V.table).filter(e=>de(e)||e===V.table),ce=!(V.depositOn&&(Number.isNaN(W(K||'0'))||V.depositPaid&&(Number.isNaN(W(J||'0'))||ee.trim()&&!z(ee)))),he={...V,time:ne,depositDue:W(K||'0')||0,depositAmount:W(J||'0')||0,depositDate:z(ee)},pe=(0,c.changedFields)(F,he),ue=M.settings.turnMins??90,ge=async()=>{const t=(0,c.editPatch)(F,he,{by:u||'Team member',app:r.APP_VARIANT});if(Object.keys(t).length&&await n.repo.bookings.update(F.id,t),'seated'===F.status&&'table'in t&&t.table!==F.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(F.table),l=s(t.table),n=a.useFloor.getState(),o=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!l.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),l.forEach(t=>n.setLive(e,t,{stage:o,dirty:!1}))}X(`Saved. Changed: ${(0,c.editedWords)(pe)}.`),U(null),b()},be=V.allergies??[],me=e=>se({allergyNone:!1,allergies:be.some(t=>t.allergen===e)?be.filter(t=>t.allergen!==e):[...be,{allergen:e,severity:'allergy'}]}),xe=(0,c.historyLines)(F);return(0,$.jsxs)(S.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${F.name} \xb7 ${F.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,$.jsx)(l.default,{style:{alignItems:'center'},children:(0,$.jsx)(v.DepositChip,{b:F,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(F)?(0,$.jsx)(l.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,$.jsxs)(L,{title:"Deposit",testID:"edit-section-deposit",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"No deposit",selected:!V.depositOn,testID:"edit-deposit-none",onPress:()=>se({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,$.jsx)(S.Chip,{label:"Deposit due",selected:!!V.depositOn&&!V.depositPaid&&!V.depositWaived,testID:"edit-deposit-due",onPress:()=>se({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,$.jsx)(S.Chip,{label:"Deposit paid",selected:!!V.depositOn&&!!V.depositPaid,testID:"edit-deposit-paid",onPress:()=>{J||Z(K),ee||te(B((0,j.ymd)(new Date))),se({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),V.depositOn&&!V.depositPaid&&V.depositWaived?(0,$.jsx)(S.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),V.depositOn&&!V.depositPaid&&V.depositWaived?(0,$.jsxs)(S.T,{size:15,center:!0,colour:y.colours.goldLight,testID:"edit-deposit-waived-by",children:[F.depositWaived?.by?(0,k.waiverText)(F.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,V.depositWaived||pe.includes('deposit')?null:(0,$.jsx)(l.default,{style:{alignItems:'center'},children:(0,$.jsx)(w.WaiveDepositButton,{b:F,who:u,onDone:e=>Y({...V,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e})})}),V.depositOn?(0,$.jsx)(S.Field,{label:"Deposit due (\xa3)",value:K,onChangeText:e=>{Q(e),se({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,V.depositOn&&V.depositPaid?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S.Field,{label:"Amount paid (\xa3)",value:J,onChangeText:e=>{Z(e),se({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"How was it paid?"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,$.jsx)(S.Chip,{label:R(e),selected:V.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>se({depositMethod:e})},e))}),(0,$.jsx)(S.Field,{label:"Date paid (DD/MM/YYYY)",value:ee,onChangeText:e=>{te((0,s.slashDate)(e,ee)),se({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),ee.trim()&&!z(ee)?(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ce?null:(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,$.jsx)(S.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,$.jsxs)(L,{title:"When",testID:"edit-section-when",children:[(0,$.jsx)(D.BookingDatePicker,{r:M,today:new Date,value:V.date,onChange:e=>se({date:e})}),(0,$.jsx)(S.Field,{label:"Time (24-hour, for example 19:15)",value:V.time,onChangeText:e=>se({time:e}),testID:"edit-time"}),ae?null:(0,$.jsx)(S.T,{size:15,colour:y.colours.amber,children:"Write the time like 19:15."}),(0,$.jsx)(C.AdultsChildren,{value:(0,f.peopleOf)(V.partySize,V.children),onChange:e=>le(e),depositsOn:ie.on&&ie.perPersonPence>0,testID:"edit-people"}),(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,children:"Table time"}),(0,$.jsx)(S.Stepper,{testID:"edit-duration",value:V.duration||0,min:0,max:360,step:15,onChange:e=>se({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,$.jsxs)(L,{title:"Where",testID:"edit-section-where",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"Any area",selected:!V.area,testID:"edit-area-any",onPress:()=>se({area:''})}),H.areas.map(e=>(0,$.jsx)(S.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:V.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>se({area:e.name})},e.id))]}),(0,$.jsx)(S.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(V.table)}),(0,x.splitChoices)(V.table).length?(0,$.jsxs)(l.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:"Split the joined tables"}),(0,$.jsx)(S.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,x.splitChoices)(V.table).map(e=>(0,$.jsx)(S.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>se({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,$.jsxs)(S.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Button,{kind:V.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(V.table?'':', chosen'),onPress:()=>se({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),re.map(e=>(0,$.jsx)(S.Button,{kind:e===V.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===V.table?', chosen':''}`,onPress:()=>se({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,$.jsxs)(L,{title:"Guest",testID:"edit-section-guest",children:[(0,$.jsx)(S.Field,{label:"Name",value:V.name,onChangeText:e=>se({name:e}),testID:"edit-name"}),(0,$.jsx)(S.Field,{label:"Phone",value:V.phone,onChangeText:e=>se({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,$.jsx)(S.Field,{label:"Email",value:V.email,onChangeText:e=>se({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"Booked by"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:V.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>se({source:e.id})},e.id))}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(V.tags??[]).includes(e);return(0,$.jsx)(S.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>se({tags:t?(V.tags??[]).filter(t=>t!==e):[...V.tags??[],e].sort()})},e)})})]}),(0,$.jsxs)(L,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,$.jsx)(A,{label:"Dogs",value:V.dogs??0,max:6,onChange:e=>se({dogs:e}),testID:"edit-dogs"}),(0,$.jsx)(A,{label:"High chairs",value:V.highChairs??0,max:10,onChange:e=>se({highChairs:e}),testID:"edit-high-chairs"}),(0,$.jsx)(A,{label:"Wheelchair users",value:V.wheelchair??0,max:10,onChange:e=>se({wheelchair:e}),testID:"edit-wheelchair"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"Occasion"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:(V.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>se({occasion:e.id})},e.id||'none'))})]}),(0,$.jsxs)(L,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"No allergies",selected:!!V.allergyNone&&!be.length,testID:"edit-allergy-none",onPress:()=>se({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,$.jsx)(S.Chip,{label:e.short,selected:be.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>me(e.id)},e.id))]}),be.map(e=>(0,$.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,$.jsxs)(S.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,$.jsx)(S.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>se({allergies:be.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,$.jsx)(S.Field,{label:"Anything else about allergies",value:V.allergyNote,onChangeText:e=>se({allergyNote:e}),testID:"edit-allergy-note"}),pe.includes('allergies')&&be.length?(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,$.jsx)(A,{label:"Vegan",value:V.vegan??0,max:V.partySize,onChange:e=>se({vegan:e}),testID:"edit-vegan"}),(0,$.jsx)(A,{label:"Vegetarian",value:V.vegetarian??0,max:V.partySize,onChange:e=>se({vegetarian:e}),testID:"edit-vegetarian"})]}),(V.holds??[]).length||(F.holds??[]).some(e=>e.qty>0&&!e.served)?(0,$.jsxs)(L,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,$.jsx)(S.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(V.holds??[]).map(e=>{const t=(0,h.reservablesOf)(M),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),n=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,$.jsxs)(l.default,{testID:n,style:{gap:6,width:'100%'},children:[(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,$.jsx)(S.Stepper,{testID:n,value:e.qty,min:0,max:20,onChange:t=>se({holds:(0,c.setEditableHoldQty)(V.holds??[],e.kind,e.id,t)}),label:i})]}),(0,$.jsx)(S.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${n}-remove`,onPress:()=>se({holds:(0,c.removeEditableHold)(V.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(V.holds??[]).length?null:(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==F.status?(0,$.jsxs)(L,{title:"Status",testID:"edit-section-status",children:[(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:V.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>se({status:e.id})},e.id))}),(0,$.jsx)(S.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,$.jsx)(L,{title:"Notes",testID:"edit-section-notes",children:(0,$.jsx)(S.Field,{label:"Notes",value:V.notes,onChangeText:e=>se({notes:e}),placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),G?(0,$.jsxs)(l.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg},children:[G.map(e=>(0,$.jsx)(S.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,$.jsx)(S.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,q?(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:q}):null,(0,$.jsxs)(S.Row,{gap:8,wrap:!0,children:[(0,$.jsx)(S.Button,{label:G?'Save anyway':'Save changes',testID:"edit-save",disabled:!ae||!ce||V.name.trim().length<1||!pe.length,onPress:()=>{const t=ae?(0,o.blockAt)(_,e,V.date,ne):void 0,s=(0,c.editWarnings)(F,he,N,t,ue,H);!s.length||G?ge():U(s)},style:{minHeight:56,flex:1}}),(0,$.jsx)(S.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),xe.length?(0,$.jsx)(L,{title:"Changes",testID:"edit-history",children:xe.slice(0,12).map((e,t)=>(0,$.jsx)(S.T,{size:14,center:!0,colour:y.colours.muted,children:e},t))}):null,(0,$.jsx)(T.CancelBookingButton,{rid:e,b:F,name:F.name,big:!0,onDone:()=>b()}),(0,$.jsx)(T.ReinstateBookingButton,{b:F,name:F.name,today:(0,j.ymd)(new Date),onDone:()=>b()})]})}},936,[31,834,128,823,829,828,1079,807,817,832,819,865,861,990,1419,825,822,1424,992,1421,1422,1423,1074,14,989,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useScreensaverAsleep",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"useDisplayToolsH",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(0,t.create)(t=>({asleep:!1,set:n=>t({asleep:n})})),s=(0,t.create)(()=>({h:65}))},937,[993]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),u=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),f=(0,n.useOwner)(e=>e.staff),x=(0,r.workingNow)(u,f,t),b=(0,r.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:b,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'center',flexShrink:1,minWidth:0},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'center',alignItems:'center',minWidth:0},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:o.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:o.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'center',alignItems:'center',flexShrink:1,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:o.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:o.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:b,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:o.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:o.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:o.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:o.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),h=_r(d[7])},938,[31,128,951,861,1481,825,818,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},939,[873,31,128,818,823,940,861,982,980,981,878,825,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOut",{enumerable:!0,get:function(){return f}}),_e.setSoldOutBy=m,_e.setSoldOut=function(e,t,n){if(!o.useStore.getState().menu.find(t=>t.id===e))return;n&&m(n);p.add(e);try{o.useStore.getState().updateMenuItem(e,{soldOut:t})}finally{p.delete(e)}},_e.soldOutNow=function(e,t=c()){return(0,i.activeSoldOut)(f.getState().entries,e,t)},_e.linkSoldOut=h,_e.useSoldOutLink=function(e,t,n=!0){const r=_r(d[9]);r.useEffect(()=>{n&&h({adopt:e})},[e,n]),r.useEffect(()=>{n&&m(t)},[t,n])};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),a=_r(d[2]),i=_r(d[3]),s=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]);const c=()=>{try{return(0,o.nowFrom)(o.useStore.getState().clock)}catch{return new Date}},f=(0,r.create)()((0,a.persist)((e,t)=>({entries:[],adopted:{},mark:(t,n,r,a)=>{const u=c(),l=o.useStore.getState().restaurants.find(e=>e.id===t),f=(0,i.soldOutSettingsOf)(l?.settings?.soldOut),S=l?(0,s.hoursFor)(l,u)?.close??null:null,m=(0,i.clearAfterFor)(u,f,S),p={rid:t,itemId:n,name:r.slice(0,120),on:!0,at:u.toISOString(),by:a.slice(0,80),clearAfter:m?.toISOString(),auto:!1,kept:!1};e(e=>({entries:[...e.entries.filter(e=>!(e.rid===t&&e.itemId===n)),p]}))},back:(n,r,a)=>{const i=t().entries.find(e=>e.rid===n&&e.itemId===r);i&&i.on&&e(e=>({entries:e.entries.map(e=>e===i?{...e,on:!1,at:c().toISOString(),by:a.slice(0,80),clearAfter:void 0,kept:!0}:e)}))},expire:(n,r)=>{const a=(0,i.expiredSoldOut)(t().entries,n,r);if(!a.length)return 0;const s=new Set(a.map(e=>e.itemId));return e(e=>({entries:e.entries.map(e=>e.rid===n&&s.has(e.itemId)?{...e,on:!1,by:'Cleared automatically',clearAfter:void 0}:e)})),a.length}}),{name:'covercharge-soldout-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default),partialize:e=>({entries:e.entries.slice(-500),adopted:e.adopted})}));let S='Staff';function m(e){e&&(S=e.replace(' (example)',''))}const p=new Set;let O=null;function h(e){if(O)return O;let t=!1;const n=(e=o.useStore.getState().menu)=>new Map(e.map(e=>[e.id,e.soldOut]));let r=n();if(e.adopt){const e={...f.getState().adopted},t=[];for(const t of o.useStore.getState().menu)e[t.restaurantId];for(const t of o.useStore.getState().menu)e[t.restaurantId]=!0;f.setState(n=>({entries:[...n.entries,...t],adopted:e}))}const a=()=>{const e=c(),a=f.getState().entries,i=o.useStore.getState().menu,s=new Map;for(const t of a){const n=t.on&&(!t.clearAfter||new Date(t.clearAfter).getTime()>e.getTime());s.set(`${t.rid}|${t.itemId}`,n)}const u=i.filter(e=>s.has(`${e.restaurantId}|${e.id}`)&&s.get(`${e.restaurantId}|${e.id}`)!==e.soldOut);if(u.length){t=!0;try{const e=new Map(u.map(e=>[e.id,s.get(`${e.restaurantId}|${e.id}`)]));o.useStore.setState(t=>({menu:t.menu.map(t=>e.has(t.id)?{...t,soldOut:e.get(t.id)}:t)}))}finally{t=!1,r=n()}}},i=o.useStore.subscribe((e,i)=>{if(e.menu===i.menu)return;const s=n(e.menu);let o=!1;if(!t)for(const t of e.menu){const e=r.get(t.id);void 0!==e&&e!==t.soldOut&&(p.has(t.id)?t.soldOut?f.getState().mark(t.restaurantId,t.id,t.name,S):f.getState().back(t.restaurantId,t.id,S):o=!0)}r=s,o&&setTimeout(a,0)}),s=f.subscribe((e,t)=>{e.entries!==t.entries&&a()}),u=()=>{const e=c(),t=new Set(f.getState().entries.filter(e=>e.on).map(e=>e.rid));for(const n of t)f.getState().expire(n,e)};u(),a();const l=setInterval(u,3e4);let m=null;if(e.adopt)try{m=_r(d[8],"./autoSoldOutStore").startAutoSoldOut()}catch{m=null}return O=()=>{i(),s(),clearInterval(l),m&&m(),O=null},O}u.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchLive=e=>(0,l.setLiveData)(!!e),globalThis.__pitchSoldOut=e=>{const t=o.useStore.getState(),n=t.restaurants[0]?.id;if(!n)return;const r=t.menu.filter(e=>e.restaurantId===n&&!e.hidden),a=['Sticky toffee pudding','Cullen skink','Fish supper','Steak pie','Haggis bon bons','Cranachan','Lemon tart','Mussels','Scampi','Venison burger','Chips (large)','Oysters','Lobster thermidor','Crab claws','Tablet ice cream','Beef shin','Smoked salmon','Cheeseboard','Halibut','Clootie dumpling'],i=(new Date).toISOString(),s=Array.from({length:e},(e,t)=>r[t]?{id:r[t].id,name:r[t].name}:{id:`pitch-so-${t}`,name:a[t%a.length]});f.setState(e=>({entries:[...e.entries.filter(e=>e.rid!==n||!s.some(t=>t.id===e.itemId)).map(e=>e.rid===n?{...e,on:!1}:e),...s.map(e=>({rid:n,itemId:e.id,name:e.name,on:!0,at:i,by:'Chef'}))]}))})},940,[1188,993,1189,982,833,878,2,1216,980,31]); +__d(function(g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dismissNotice",{enumerable:!0,get:function(){return u.dismissNotice}}),Object.defineProperty(_e,"notify",{enumerable:!0,get:function(){return u.notify}}),Object.defineProperty(_e,"useSliders",{enumerable:!0,get:function(){return u.useSliders}}),Object.defineProperty(_e,"SLIDER",{enumerable:!0,get:function(){return j}}),_e.SliderButton=k,_e.SliderCard=C,_e.SliderHost=function(){y();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(0,t.useEffect)(()=>{if(p)return window.ccSlider=e=>(0,u.notify)(e),()=>{delete window.ccSlider}},[]),(0,t.useEffect)(()=>{if(o.current&&clearTimeout(o.current),!n)return;const e=void 0!==n.timeoutMs?n.timeoutMs:n.actions?.length||n.content?null:6e3;return e&&(o.current=setTimeout(()=>u.useSliders.getState().dismiss(n.id),e)),()=>{o.current&&clearTimeout(o.current)}},[n?.id,n?.timeoutMs]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!p||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=p?'fixed':'absolute';return(0,f.jsxs)(f.Fragment,{children:[n.modal?(0,f.jsx)(s.default,{...x('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,f.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...p?{bottom:l?`${12+l}px`:'calc(12px + env(safe-area-inset-bottom))'}:{}},children:(0,f.jsx)(C,{n:n,waiting:e.length-1,onClose:()=>u.useSliders.getState().dismiss(n.id)},n.id+':'+(n.seq??0))})]})};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=e(r(d[4])),l=e(r(d[5])),c=r(d[6]),a=r(d[7]),u=r(d[8]),b=r(d[9]),f=r(d[10]);const p='undefined'!=typeof document,h="\n[data-ccsl=\"in\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccsl-in{from{opacity:0;transform:translate3d(0,110%,0)}to{opacity:1;transform:none}}\n[data-ccsl=\"urgent\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both,ccsl-red 1.6s ease-in-out .45s infinite}\n@keyframes ccsl-red{0%,100%{box-shadow:0 10px 30px rgba(0,0,0,.6),0 0 0 1px rgba(255,107,94,.55)}50%{box-shadow:0 10px 40px rgba(0,0,0,.6),0 0 0 2px #FF6B5E,0 0 34px rgba(255,107,94,.45)}}\n[data-ccsl=\"dim\"]{animation:ccsl-dim .3s ease both}\n@keyframes ccsl-dim{from{opacity:0}to{opacity:1}}\n@media (prefers-reduced-motion: reduce){[data-ccsl]{animation:none !important}}\n",x=e=>p?{dataSet:{ccsl:e}}:{};function y(){(0,t.useEffect)(()=>{if(!p||document.getElementById('cc-slider-css'))return;const e=document.createElement('style');e.id='cc-slider-css',e.textContent=h,document.head.appendChild(e)},[])}const j={bg:'#17140F',border:'rgba(207,164,95,.55)',text:'#F5F1E8',quiet:'#A89A80',gold:c.colours.gold,ink:'#17130D'},w=(e="normal")=>'urgent'===e?c.colours.red:'warn'===e?c.colours.amber:c.colours.gold,S=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':j.border;function k({a:e,onDone:t,big:o}){const s=e.kind??'primary';return(0,f.jsx)(n.default,{testID:e.testID,accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{try{e.onPress?.()}finally{e.keepOpen||t()}},style:({pressed:e})=>({minHeight:o?56:44,minWidth:44,paddingHorizontal:'ghost'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?j.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,f.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?j.ink:'danger'===s?c.colours.red:j.quiet,children:e.label})})}function C({n:e,onClose:t,waiting:n=0,maxWidth:c=520}){y();const u=e.tone??'normal',h=w(u),C=e.content,z=!!e.big,{height:I}=(0,l.default)(),D=e.actions??[];return(0,f.jsxs)(s.default,{testID:e.testID??'cc-slider',accessibilityRole:"summary",accessibilityLabel:`${e.kicker?e.kicker+': ':''}${e.title}`,...x('urgent'===u?'urgent':'in'),style:{width:'100%',maxWidth:z?Math.max(c,900):c,alignSelf:'center',borderRadius:14,backgroundColor:j.bg,borderWidth:1,borderColor:S(u),overflow:'hidden',...p?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,f.jsx)(s.default,{style:{position:'absolute',left:0,top:0,bottom:0,width:5,backgroundColor:h}}):null,(0,f.jsxs)(o.default,{style:{maxHeight:Math.max(220,I-40)},contentContainerStyle:{paddingVertical:z?18:12,paddingLeft:'normal'!==u?z?24:18:z?20:14,paddingRight:z?20:14,gap:z?10:6},children:[(0,f.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:12},children:[e.icon?(0,f.jsx)(a.T,{size:z?34:22,children:e.icon}):null,(0,f.jsxs)(s.default,{style:{flex:1,gap:2},children:[e.kicker?(0,f.jsx)(a.T,{size:z?15:11,weight:"bold",colour:h,style:{letterSpacing:1.4},children:e.kicker}):null,(0,f.jsx)(a.T,{size:z?24:15,weight:"medium",colour:j.text,children:e.title}),e.body?(0,f.jsx)(a.T,{size:z?18:13,colour:j.quiet,children:e.body}):null]}),D.length||C?null:(0,f.jsx)(b.ToastClose,{testID:"cc-slider-ok",label:`Close: ${e.title}`,onPress:t,size:z?'lg':'md',colour:j.quiet})]}),C?(0,f.jsx)(C,{close:t}):null,D.length?(0,f.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:D.map(e=>(0,f.jsx)(k,{a:e,onDone:t,big:z},e.label))}):null,n>0?(0,f.jsxs)(a.T,{size:z?14:11,colour:j.quiet,center:!0,style:{alignSelf:'stretch'},children:[n," more waiting"]}):null]})]})}},941,[31,123,264,152,128,288,825,818,978,835,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CoversToday=function({rid:e,onPress:p,big:x,sound:$,testID:v="covers-today",day:j,compact:C=!1,snug:w=!1,tight:T=!1,aside:k}){const D=(0,c.useBookings)(e),S=(0,c.useNow)(3e4),I=(0,h.venueYmd)(S),L=j&&j!==I?j:I,_=L!==I,M=(0,u.coversFour)(D,L),R=(0,y.dayWord)(L,I),z=/^(Today|Yesterday|Tomorrow)$/.test(R),O=`COVERS ${R.toUpperCase()}`,P=_?`${z?`${R}\u2019s`:R} bookings \u203a`:'Today\u2019s bookings \u203a',W=_?`${z?`${R}, `:''}${(0,y.dayLong)(L)}`:'today',E=(0,o.useLiveState)();if('ready'!==E)return(0,f.jsx)(o.LiveWait,{state:E,title:"Covers today",testID:`${v}-wait`});const F=x?64:T?28:w?36:44,V=M.total?Math.min(1,M.done/M.total):0,Y=(e,o,t,c)=>(0,f.jsxs)(s.default,{style:{flex:1,alignItems:'center',gap:T?2:w?4:6,minWidth:0},children:[(0,f.jsx)(l.SplitFlap,{value:o,height:F,colour:t,testID:`covers-${c}`,sound:$}),(0,f.jsx)(n.T,{size:T?11:x||C?14:12,weight:"semibold",colour:b.colours.muted,numberOfLines:1,center:C||T,style:{letterSpacing:.4},children:e})]});return(0,f.jsxs)(t.default,{testID:v,dataSet:{centreExempt:'dashboard-card'},accessibilityRole:"button",disabled:!p,onPress:p,accessibilityLabel:`Covers ${W}: ${M.done} done, ${M.seated} seated, ${M.toCome} to come, ${M.total} total.${p?` Opens ${_?'that day\u2019s':'today\u2019s'} bookings.`:''}`,style:({pressed:e})=>({backgroundColor:e?b.colours.tilePressed:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:T?6:16,...w&&!T?{paddingVertical:8,paddingHorizontal:10}:null,gap:T?4:w?8:12}),children:[T?null:(0,f.jsxs)(s.default,{style:{flexDirection:C?'column':'row',justifyContent:'space-between',alignItems:'center',gap:C?w?2:6:void 0},children:[(0,f.jsx)(n.T,{center:C,size:C?16:12,weight:"semibold",colour:b.colours.goldMuted,style:{letterSpacing:1.6},children:O}),p?(0,f.jsx)(n.T,{center:C,size:C?14:12,colour:b.colours.muted,children:P}):null]}),(0,f.jsxs)(s.default,{style:{flexDirection:'row',gap:8},children:[Y('Done',M.done,b.colours.text,'done'),Y('Seated',M.seated,b.colours.text,'seated'),Y('To come',M.toCome,b.colours.text,'tocome'),Y('Total',M.total,b.colours.goldLight,'total')]}),T?null:(0,f.jsx)(s.default,{style:{height:4,borderRadius:2,backgroundColor:'rgba(255,255,255,0.06)',overflow:'hidden'},children:(0,f.jsx)(s.default,{style:{width:`${Math.round(100*V)}%`,height:4,backgroundColor:b.colours.gold,borderRadius:2}})})]})},r(d[0]);var o=r(d[1]),t=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),b=r(d[10]),f=r(d[11])},942,[31,1387,264,128,1412,818,823,832,822,965,825,25]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},943,[812,965,942,992,31,128,993,818,823,832,833,814,822,825,1408,991,1077,25]); +__d(function(_g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setDisplaySilent",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"soundAllowed",{enumerable:!0,get:function(){return u}}),e.chime=function(t="bright"){if(!u())return void l('__ccChimesBlocked');try{const n=o();if(!n)return;('bright'===t?[880,1318.5]:[659.3]).forEach((o,c)=>{const i=n.currentTime+.16*c,u=n.createOscillator(),l=n.createGain();u.type='sine',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime('bright'===t?.12:.07,i+.02),l.gain.exponentialRampToValueAtTime(1e-4,i+.9),u.connect(l).connect(n.destination),u.start(i),u.stop(i+.95)}),l('__ccChimes')}catch{}},Object.defineProperty(e,"LOW_CHIME_MIN",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"LOW_CHIME_MAX",{enumerable:!0,get:function(){return d}}),e.lowChime=function(t=0){if(!u())return void l('__ccChimesBlocked');const n=s+.095*Math.max(0,Math.min(1,t));'undefined'!=typeof window&&(window.__ccLowChimeLevels=[...window.__ccLowChimeLevels??[],Math.round(1e3*n)/1e3].slice(-40));try{const t=o();if(!t)return;[220,164.8].forEach((o,c)=>{const i=t.currentTime+.42*c,u=t.createOscillator(),l=t.createGain(),s=t.createBiquadFilter?.();u.type='triangle',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime(n,i+.12),l.gain.exponentialRampToValueAtTime(1e-4,i+1.6),s?(s.type='lowpass',s.frequency.value=900,u.connect(s).connect(l).connect(t.destination)):u.connect(l).connect(t.destination),u.start(i),u.stop(i+1.7)}),l('__ccLowChimes')}catch{}},Object.defineProperty(e,"flapSoundOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setFlapSound",{enumerable:!0,get:function(){return w}}),e.flapClick=function(){if('display'!==t.APP_VARIANT&&!c)return;if(!p())return;try{const t=o();if(!t)return;const n=t.currentTime,c=Math.floor(.03*t.sampleRate),i=t.createBuffer(1,c,t.sampleRate),u=i.getChannelData(0);for(let t=0;t{if('undefined'==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;return t?(n||(n=new t),'suspended'===n.state&&n.resume?.().catch?.(()=>{}),n):null};if('undefined'!=typeof window){const t=()=>{try{o()}catch{}window.removeEventListener('pointerdown',t)};window.addEventListener('pointerdown',t)}let c=!1;const i=t=>{c=t},u=()=>'display'!==t.APP_VARIANT&&!c,l=t=>{'undefined'!=typeof window&&(window[t]=(window[t]??0)+1)};const s=.015,d=.11;const f='cc-flap-sound',p=()=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(f)}catch{return!1}},w=t=>{try{localStorage.setItem(f,t?'1':'0')}catch{}}},944,[123,807]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},945,[812,31,978,823,832,822,944]); +__d(function(g,r,i,a,_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()})}},946,[805,31,288,128,993,807,951,1170,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},947,[31,128,987,825,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},948,[31,807,1498]); +__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'},949,[825]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=A,_e.resetTableLive=W,_e.seatBookingNow=E,_e.finishBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'finished'),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=H,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=Y,_e.WalkInSheet=U,_e.WalkInMatchPrompt=Q,_e.AssignTableSheet=V,_e.undoNotice=G,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[i,n]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>n({b:e}),combineTables:e=>n({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(U,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:G}):null,l?(0,L.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,L.jsx)(V,{booking:i.b,combine:i.combine,onClose:()=>n(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=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),B=_r(_d[28]),z=_r(_d[29]),O=_r(_d[30]),N=_r(_d[31]),M=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function A(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function E(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)}function H(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=A(e),a=(0,v.useFloor)(t=>t.live[e])??{},i=(0,v.usePlan)(e),n=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(n,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(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,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function Y({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=i?6:8,f=i?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(n??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],n=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!n,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,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?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:n?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:n?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function U({onClose:e,onSeated:a,wide:i,initialTable:n}){const{rid:r,r:d,now:x}=(0,y.useCtx)(15e3),T=H(r,x),[I,$]=(0,c.useState)(2),[P,B]=(0,c.useState)(!1),[z,N]=(0,c.useState)(n??null),R=(0,v.usePlan)(r),A=(0,k.useBookings)(r),_=(0,D.useBlocks)(e=>e.blocks),U=(0,D.closedAreasAt)(_,r,(0,w.ymd)(x),(0,w.hm)(x)),V=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(T).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(R,A.filter(e=>e.date===(0,w.ymd)(x)),e,I,x,(0,j.turnFor)(I,d.settings.turnMins),90,void 0,{closed:U})?.table??null},[R,A,T,I,U.size,x.getTime()]);(0,c.useEffect)(()=>{z&&(0,v.tablesOf)(z).some(e=>'Closed'===T[e]?.label)&&N(null)},[z,U.size]);const[G,K]=(0,c.useState)(!1),[X,J]=(0,c.useState)(''),Z=(e,t=String(e),s=()=>{B(!1),$(e)})=>{const o='9+'===t?P:!P&&I===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},ee=(0,L.jsx)(s.PartySizeInput,{value:I,onChange:$,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),te=(0,L.jsxs)(m.default,{style:{gap:8,width:i?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>Z(e)),Z(9,'9+',()=>{B(!0),$(e=>e>=9?e:9)})]}),P?ee:null]}),[se,oe]=(0,c.useState)(!1),[le,ae]=(0,c.useState)(null),ie=async(t=z,s=!1)=>{if(!se&&(0,M.guardBookingChange)(F)){if(!s){const e=(0,O.bookingsNearWalkIn)(A,x,I);if(e.length)return void ae({at:t,list:e})}oe(!0);try{const s=await k.repo.bookings.seatWalkIn(r,I,t??void 0,X);W(r,t??void 0),a(s),e()}finally{oe(!1)}}},ne=async(t,s)=>{if(!se&&(0,M.guardBookingChange)(F)){oe(!0);try{const o=s??t.table??null;o&&o!==t.table&&await k.repo.bookings.assignTable(t.id,o),await E(r,{...t,table:o??void 0}),(0,u.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})`}),ae(null),e()}finally{oe(!1)}}},re=(0,L.jsxs)(m.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),z?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>N(null)}):null]}),(0,L.jsx)(Y,{use:T,value:z,onPick:e=>{T[e]&&!T[e].busy?ie(e):N(z===e?null:e)},big:i,dense:i,best:V,bestSet:(0,h.bestTables)(R)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",V&&!z?` (suggested for ${I}: ${(0,l.tableNumbers)(V)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(x)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${I} ${1===I?'person':'people'}${z?` \xb7 ${(0,l.tableNumbers)(z)}`:''}`,disabled:se,onPress:()=>{ie()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[te,re]}):(0,L.jsxs)(L.Fragment,{children:[te,re]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[G?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:X,onChangeText:J,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>K(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),le?(0,L.jsx)(Q,{list:le.list,busy:se,onYes:e=>{ne(e,le.at)},onNo:()=>{const e=le.at;ae(null),ie(e,!0)},onClose:()=>ae(null)}):null]})}function Q({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,L.jsx)(C.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,L.jsxs)(m.default,{style:{gap:14},children:[e.map((e,o)=>(0,L.jsxs)(m.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,L.jsx)(m.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:26,weight:"bold",colour:S.colours.goldLight,testID:"walkin-match-question",children:(0,O.walkInMatchQuestion)(e)})}),e.table?(0,L.jsxs)(C.T,{size:17,colour:S.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,L.jsx)(C.T,{size:17,colour:S.colours.text,children:e.ref}),(0,L.jsx)(C.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,L.jsx)(C.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,y.useCtx)(15e3),n=H(o,i),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(i)),t,e.partySize,i,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,i.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),$=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,P=D.reduce((e,t)=>e+$(t),0),B=D.length>0&&P{if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},O=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${P} seats for ${e.partySize} Covers`:'No tables picked yet'})}),B?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-P," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:O,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(Y,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function G(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:O}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[A,W]=(0,c.useState)(ee.blocks),[_,Y]=(0,c.useState)(!1),[q,U]=(0,c.useState)(''),[Q,V]=(0,c.useState)(2),[G,K]=(0,c.useState)(0),X=Math.min(G,Math.max(0,Q-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ie,ne]=(0,c.useState)('phone'),[re,de]=(0,c.useState)((0,$.emptyNeeds)()),ue=(0,$.needsMissing)(re),[ce,be]=(0,c.useState)(null),ge=(0,v.usePlan)(b),he=(0,z.dogSetUp)(ge),pe=!0===re.dog&&he,me=re.dog?re.dogs:0,fe=(0,w.parseYmd)(A),ye=(0,j.turnFor)(Q,h.settings.turnMins),ke=E.filter(e=>e.date===A),xe=e=>(0,j.freeTablesAt)(ge,ke,Q,new Date(`${A}${(0,l.tableNumbers)(e)}:00`),ye,h.settings.turnMins,{dog:!0,closed:(0,D.closedAreasAt)(H,b,A,e)}),je=pe&&J?xe(J):[];(0,c.useEffect)(()=>{be(null)},[pe,J,Q]);const we=(0,x.bookingSlots)(h,fe,e=>E.filter(t=>t.date===A&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Q,A===(0,w.ymd)(p)?p:(0,w.addMins)(fe,0),e=>E.filter(t=>t.date===A&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Se=(0,T.guestPhone)(se),[Te,Ce]=(0,c.useState)(!1),ve=J?we.find(e=>e.time===J):void 0,De=ve&&ve.left=2&&!!J&&(!$e||Te)&&(0,o.validParty)(Q)&&Se.ok&&(0,T.emailOk)(le)&&(!Pe||Be&&_)&&(!pe||je.length>0)&&!ze,Ne=re.wheelchair>0||re.stepFree;return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(fe)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)($.FirstQuestions,{rid:b,value:re,onChange:de,party:Q,audience:"staff"}),re.dog&&!he?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:A,onChange:e=>{e!==A&&(W(e),Z(null),Y(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===ie,onPress:()=>ne('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===ie,onPress:()=>ne('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:U,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Se.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Se.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,L.jsx)(n.AdultsChildren,{value:(0,r.peopleOf)(Q,X),onChange:e=>{V(e.partySize),K(e.children),Ce(!1)},depositsOn:(0,i.depositOf)(h.settings).on&&(0,i.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:we.map(e=>{const t=pe&&e.available&&!xe(e.time).length||!(0,$.dogTimeOk)(h,E,A,e.time,me);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,A,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),Y(!1),Ce(!1)}},e.time)})}),$e?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[De?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Q,De.left,De.time)}):null,Ie?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ie.time,Ie.cap)}):null,(0,L.jsx)(C.Chip,{label:Te?'Booking over the limit: on':'Book anyway (over the limit)',selected:Te,onPress:()=>Ce(e=>!e),testID:"nb-over-ok"})]}):null,pe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",ge.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),je.length?(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:je.slice(0,10).map((e,t)=>(0,L.jsx)(C.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${Ne&&(0,z.accessibleSetUp)(ge)&&!(0,z.isAccessible)(ge,e.table)?' \xb7 not step-free':''}`,selected:(ce??je[0].table)===e.table,onPress:()=>be(e.table)},e.table))}):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Q," at ",J,". Try another time."]})]}):null,Pe?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Pe.from,"\u2013",Pe.to,Pe.reason?` (${Pe.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:_?'Manager override on':'Override and book anyway',selected:_,onPress:()=>Y(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,we.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(fe)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)($.MoreQuestions,{rid:b,r:h,value:re,onChange:de,party:Q,date:A,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ne&&!(0,z.accessibleSetUp)(ge)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:P.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(h.settings),Q,X))," (",(0,a.gbp)((0,i.depositOf)(h.settings).perPersonPence)," per adult for ",(0,i.depositOf)(h.settings).fromParty,"+",X?`; ${X} ${1===X?'child':'children'} free`:'; children free',"). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsxs)(C.Muted,{children:["The guest gets a confirmation text",le.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ze?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:ue.length?ue[0]:'Save booking',testID:"nb-save",disabled:!Oe,onPress:()=>{if(A<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,$.needsPatch)(re),s=re.tableReq.find(e=>!pe||je.some(t=>t.table===e)),o=pe?null:(0,N.requestedFreeTable)(re.tableReq,{date:A,time:J,partySize:Q},ge.tables.map(e=>e.name),ke,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Q,date:A,time:J,notes:ee.trim(),security:(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?'deposit':'none',depositPaid:0,...X?{children:X}:{},...(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?{depositDue:(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X),depositPolicy:(0,i.depositWords)((0,i.depositOf)(h.settings),Q,h.name,X).join(' '),depositRefundable:(0,i.depositOf)(h.settings).refundable,depositCutoffHours:(0,i.depositOf)(h.settings).cutoffHours}:{},phone:Se.pretty,email:le.trim()||void 0,source:ie,...e,...we.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...pe?{table:ce??s??je[0]?.table}:o?{table:o}:{}}).then(e=>(0,B.postNewBookingToKitchen)(e,O)).catch(()=>{}),u?.({date:A,time:J,name:q.trim()}),t()}})]})}},950,[873,813,1172,812,820,14,1421,1422,1423,941,31,1067,264,128,807,951,823,821,830,822,825,827,818,829,828,1424,831,817,991,832,1426,958,957,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtH",{enumerable:!0,get:function(){return d.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return d.fmtHDay}}),Object.defineProperty(_e,"authorityRole",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return b}}),_e.useShiftManager=h,_e.useSignedIn=S,_e.useCtx=function(e=1e4){const u=(0,t.useContext)(y),i=(0,r.useOwner)(e=>e.site),f=(0,r.useOwner)(e=>e.previewRole),c=(0,r.useOwner)(e=>e.staffAs),d=S(),l=u||'staff'===o.APP_VARIANT,D=(0,t.useContext)(b),O=h(),A=o.IS_CAR?'owner':l?D&&O?'manager':'staff':d?w(f,p(d)):f,I=(0,r.useOwner)(e=>e.staff),R=(0,n.useRestaurant)(i),M=(0,n.useNow)(e),C=o.IS_CAR?s.CAR_DEVICE_ID:d?d.id:l&&c?c:m[A],P=o.IS_CAR?s.CAR_ACTOR:I.find(e=>e.id===C)?.name??'Team member';return{rid:i,r:R,now:M,role:A,me:P,meId:C,today:(0,a.venueYmd)(M),signedIn:!o.IS_CAR&&!!d}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return A}}),_e.ensureAttendance=function(t,n){if(e.LIVE_VENUE_BUILD||(0,u.isLive)())return;const o=r.useOwner.getState(),s=[],i=o.staff.find(e=>e.active&&'manager'===e.role)??o.staff.find(e=>e.active&&'owner'===e.role),f=new Date(n);f.setDate(n.getDate()-O(n));const c=(0,a.ymd)(f),d=(0,a.ymd)(new Date(f.getFullYear(),f.getMonth(),f.getDate()+6)),m=(e,t,n)=>{const r=new Date(e);return r.setHours(0,0,0,0),r.setMinutes(Math.round(60*t)+n),r.toISOString()};for(let e=42;e>=1;e--){const t=new Date(n);t.setDate(t.getDate()-e);const r=(0,a.ymd)(t);if(o.attendance.some(e=>e.date===r))continue;const u=o.shifts.filter(e=>e.date===r&&!1!==e.published);(u.length?u:o.shifts.filter(e=>e.day===O(t)&&e.date>=c&&e.date<=d&&!1!==e.published)).forEach((n,a)=>{const o=e=>Math.round((7*r.charCodeAt(9)+13*a+e)%17-5),u=n.end-n.start,f=u>8?30:u>6?20:0,c=e>2&&i?{signOff:{by:i.name,byId:i.id,at:m(t,34,a)}}:{};s.push({id:`at-${r}-${n.staffId}`,staffId:n.staffId,date:r,in:m(t,n.start,o(1)),out:m(t,n.end,o(2)),inSite:!0,outSite:!0,breakMins:f,...c})})}s.length&&r.useOwner.setState({attendance:[...r.useOwner.getState().attendance,...s]})},_e.paidMins=function(e,t){if(!e.in)return{worked:0,brk:0,paid:0};const n=Math.max(0,Math.round(((e.out?new Date(e.out):t).getTime()-new Date(e.in).getTime())/6e4)),r=e.breakMins??0;return{worked:n,brk:r,paid:Math.max(0,n-r)}},Object.defineProperty(_e,"hmDur",{enumerable:!0,get:function(){return I}}),_e.payRange=function(e,t,n){const r=new Date(n);if(r.setHours(0,0,0,0),'monthly'===e){const e=new Date(r.getFullYear(),r.getMonth()+t,1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{s:e,e:n,key:`m-${(0,a.ymd)(e)}`}}const o='weekly'===e?7:14,s=new Date(r);s.setDate(r.getDate()-O(r));let u=new Date(s);if('fortnightly'===e){const e=new Date(2026,0,5);(Math.round((s.getTime()-e.getTime())/6048e5)%2+2)%2==1&&u.setDate(u.getDate()-7)}u.setDate(u.getDate()+t*o);const i=new Date(u);return i.setDate(u.getDate()+o-1),{s:u,e:i,key:`${e[0]}-${(0,a.ymd)(u)}`}},_e.useHourly=function(){const e=S(),t=(0,r.useOwner)(e=>e.hourly);return o.IS_CAR||e?t:R};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),r=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]),u=_r(_d[7]),i=_r(_d[8]),f=_r(_d[9]),c=_r(_d[10]),d=_r(_d[11]);const m={owner:c.ROSTER.find(e=>'owner'===e.role)?.id??'',manager:c.ROSTER.find(e=>'manager'===e.role)?.id??'',staff:c.ROSTER.find(e=>'staff'===e.app)?.id??''},l={staff:0,manager:1,owner:2},p=e=>e.ownerAccess?'owner':e.managerAccess&&'staff'===e.role?'manager':e.role,w=(e,t)=>l[e]>l[t]?t:e,y=(0,t.createContext)(!1),D=()=>(0,t.useContext)(y),b=(0,t.createContext)(!1);function h(){const e=(0,t.useContext)(y)||'staff'===o.APP_VARIANT,n=S(),r=(0,u.useSync)(e=>!!e.venueId&&'staff'===e.kind),a=(0,u.useSync)(e=>e.perms);return(0,i.shiftManagerOn)({inStaffApp:e,managerAccess:n?.managerAccess,role:n?.role,app:(0,f.rosterPerson)(n?.id)?.app,live:r,perms:a})}function S(){const e=(0,f.useSession)(e=>e.meId),t=(0,r.useOwner)(e=>e.staff);return e?t.find(t=>t.id===e&&t.active):void 0}const O=e=>(e.getDay()+6)%7,A=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const I=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const R={}},951,[842,31,823,861,822,807,975,824,1099,865,15,1098]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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,'+')}},952,[931,812,983,31,119,123,128,829,830,825,818,991,1067,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"areaMarks",{enumerable:!0,get:function(){return n}}),_e.AreaTabs=function({plan:o,area:e,onPick:u,counts:a,closed:b}){return(0,c.jsx)(t.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:o.areas.map(o=>{const h=o.id===e,f=b?.has(o.id);return(0,c.jsx)(l.default,{testID:`area-${o.id}`,accessibilityRole:"tab",accessibilityLabel:`Area ${o.name}${o.dogs?', dogs allowed':''}${o.outdoor?', outdoor':''}${f?', closed for weather':''}`,accessibilityState:{selected:h},onPress:()=>u(o.id),style:{maxWidth:'100%',minWidth:0,flexShrink:1,minHeight:48,paddingHorizontal:16,borderRadius:24,borderWidth:1.5,borderColor:h?s.colours.gold:f?s.colours.blue:s.colours.border,backgroundColor:h?s.colours.gold:s.colours.surface,justifyContent:'center'},children:(0,c.jsxs)(t.T,{weight:"semibold",size:15,colour:h?s.colours.onGold:s.colours.text,children:[o.name,n(o),f?(0,c.jsx)(t.T,{size:12,colour:h?s.colours.onGold:s.colours.blue,children:" closed"}):null,a?.[o.id]?(0,c.jsxs)(t.T,{size:12,colour:h?s.colours.onGold:s.colours.muted,children:[" ",a[o.id]]}):null]})},o.id)})})},r(d[0]);var o,e=r(d[1]),l=(o=e)&&o.__esModule?o:{default:o},s=r(d[2]),t=r(d[3]),c=r(d[4]);const n=o=>`${o.dogs?' \ud83d\udc3e':''}${o.outdoor?' \ud83c\udf26':''}`},953,[31,264,825,818,25]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=R,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),N=a.now,F=e=>l({t:'set',p:e}),[H,O]=(0,i.useState)(e.startStep??'areas'),[U,G]=(0,i.useState)(e.initial.areas[0]?.id??''),[_,K]=(0,i.useState)(null),X=(0,w.useOwner)(e=>e.site),J=(0,y.useFloor)(e=>e.settings[X]),Y=!1!==J?.gridSnap,Z=(0,j.gridOf)(J?.gridSize),[q,V]=(0,i.useState)(null),[Q,ee]=(0,i.useState)(null),[se,te]=(0,i.useState)(null),ae=(0,T.useSync)(e=>e.venueId),le=e.role??'staff',[oe,ne]=(0,i.useState)(''),{width:re,height:ie}=(0,c.default)(),de=re>=900,ue=a.past.length>0||JSON.stringify(N)!==JSON.stringify(e.initial),ce=(0,b.planCounts)(N);(0,i.useEffect)(()=>{N.areas.some(e=>e.id===U)||G(N.areas[0]?.id??'')},[N.areas,U]),(0,i.useEffect)(()=>{oe&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:oe,timeoutMs:3500,testID:'plan-toast'}),ne(''))},[oe]);const he='table'===_?.kind?N.tables.find(e=>e.id===_.id):void 0,be='fixture'===_?.kind?(N.fixtures??[]).find(e=>e.id===_.id):void 0,ge=(e,s)=>{const t=N.tables.find(s=>s.id===e),a=t&&s.name&&s.name!==t.name?N.joins.map(e=>({...e,tables:e.tables.map(e=>e===t.name?s.name:e)})):N.joins,l=t&&s.name&&s.name!==t.name?N.areas.map(e=>e.best?.includes(t.name)?{...e,best:e.best.map(e=>e===t.name?s.name:e)}:e):N.areas;F({...N,areas:l,joins:a,tables:N.tables.map(t=>t.id===e?{...t,...s}:t)})},pe=e=>{const s=N.tables.find(s=>s.id===e);F({...N,tables:N.tables.filter(s=>s.id!==e),joins:N.joins.filter(e=>!s||!e.tables.includes(s.name))}),K(null)},me=e=>{const s=b.FIXTURES.find(s=>s.id===e),t={id:(0,b.fid)('fx'),areaId:U,kind:e,x:25*Math.round((b.PLAN_W-s.w)/50),y:25,w:s.w,h:s.h};F({...N,fixtures:[...N.fixtures??[],t]}),K({kind:'fixture',id:t.id})},xe=e=>{const s=(0,j.tidyArea)(N,e,Z),t=(0,j.movedCount)(N,s);t?(F(s),ne(`Tidied: ${t} table${1===t?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):ne('Already tidy: every table is on the grid and lined up.')},fe=e=>{const s=(0,b.autoArrange)(N.tables.filter(s=>s.areaId===e),$(N,e));F({...N,tables:[...N.tables.filter(s=>s.areaId!==e),...s]}),ne('Layout tidied. Undo if you preferred it before.')};(0,i.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const s=e.target?.tagName;if('INPUT'===s||'TEXTAREA'===s)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==H||!_)return;const t=e.altKey?1:Y?Z:5,a={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowUp:[0,-t],ArrowDown:[0,t]}[e.key];a&&(e.preventDefault(),je(_.kind,_.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===_.kind?pe(_.id):(F({...N,fixtures:(N.fixtures??[]).filter(e=>e.id!==_.id)}),K(null))),'r'===e.key.toLowerCase()&&ye(_.kind,_.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const je=(e,s,t,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(b.PLAN_W-e.w,l?e.x+t:t)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});F('table'===e?{...N,tables:N.tables.map(e=>e.id===s?{...e,...o(e)}:e)}:{...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?{...e,...o(e)}:e)})},ye=(e,s)=>{F('table'===e?{...N,tables:N.tables.map(e=>e.id===s?(0,b.rotate90)(e):e)}:{...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?(0,b.rotate90)(e):e)})},we='display'===e.mode;return(0,I.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[we?(0,I.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,I.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,I.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,I.jsx)(h.default,{style:{backgroundColor:(0,s.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,I.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,I.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,I.jsxs)(h.default,{style:{marginRight:6},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,I.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,I.jsx)(x.Row,{gap:6,children:k.map(e=>{const s=e.id===H;return(0,I.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{O(e.id),K(null),V(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:s?p.colours.gold:p.colours.border,backgroundColor:s?p.colours.goldTint:'transparent'},children:[(0,I.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:s?p.colours.gold:p.colours.surface2},children:(0,I.jsx)(x.T,{size:13,weight:"bold",colour:s?p.colours.onGold:p.colours.muted,children:e.n})}),(0,I.jsx)(x.T,{weight:"semibold",size:15,colour:s?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,I.jsx)(h.default,{style:{flex:1}}),(0,I.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,I.jsxs)(x.T,{weight:"bold",size:16,children:[ce.tables," tables \xb7 ",ce.seats," seats"]}),(0,I.jsxs)(x.Muted,{size:12,children:[N.areas.length," area",1===N.areas.length?'':'s',ue?' \xb7 unsaved changes':'']})]}),(0,I.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,I.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,I.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>ue?ee({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,I.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!ue,onPress:()=>ee({title:'Save changes to the table plan?',body:`${ce.tables} tables \xb7 ${ce.seats} seats across ${N.areas.length} area${1===N.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(R(N))}),style:{minHeight:44}}),ae?(0,I.jsx)(S.NamedPlanButtons,{onSaveAs:()=>te('save'),onList:()=>te('list')}):null]}),(0,I.jsxs)(h.default,{style:{flex:1},children:['areas'===H?(0,I.jsx)(M,{plan:N,set:F,confirm:ee,wide:de,next:()=>O('tables'),toast:ne}):null,'tables'===H?(0,I.jsx)(E,{plan:N,set:F,area:U,setArea:G,addTables:(e,s)=>{let t={...N,areas:[...N.areas],tables:[...N.tables]};const a=new Set(t.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const s of e){if(a.has(s.name)){l.push(s.name);continue}let e=U;if(s.area){const a=t.areas.find(e=>e.name.toLowerCase()===s.area.toLowerCase());a?e=a.id:(e=A(t,s.area),t.areas.push({id:e,name:s.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(s.name,e,s.seats,P(t,e)),[d]=(0,b.placeNew)(t.tables.filter(s=>s.areaId===e),[i],(t.fixtures??[]).filter(s=>s.areaId===e));t.tables.push(d),a.add(s.name),n.add(e),o++}if(s)for(const e of n){const s=t.tables.filter(s=>s.areaId===e),a=(0,b.autoArrange)(s,$(t,e));t={...t,tables:[...t.tables.filter(s=>s.areaId!==e),...a]}}return o&&F(t),ne(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:pe,patch:ge,wide:de,next:()=>O('arrange'),back:()=>O('areas')}):null,'arrange'===H?(0,I.jsxs)(h.default,{style:{flex:1,flexDirection:de?'row':'column'},children:[(0,I.jsxs)(h.default,{style:{flex:1,padding:10,gap:8,minHeight:de?void 0:Math.min(420,.5*ie)},children:[(0,I.jsx)(L,{plan:N,area:U,onPick:e=>{G(e),K(null),V(null)}}),q?(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,I.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(N.tables.find(e=>e.id===q)?.name),"."]}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>V(null)})]}):null,(0,I.jsx)(f.DesignerCanvas,{plan:N,areaId:U,sel:_,onSelect:e=>{if(q&&'table'===e?.kind&&e.id!==q){const s=N.tables.find(e=>e.id===q),t=N.tables.find(s=>s.id===e.id),a=N.joins.find(e=>e.tables.includes(s.name)),l=a?N.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,t.name])].sort((e,s)=>(0,b.numOf)(e)-(0,b.numOf)(s))}:e).filter(e=>e===a||!e.tables.includes(t.name)):[...N.joins.filter(e=>!e.tables.includes(t.name)),{id:(0,b.fid)('j'),tables:[s.name,t.name].sort((e,s)=>(0,b.numOf)(e)-(0,b.numOf)(s))}];return F({...N,joins:l}),V(null),ne(`Joined: book as ${l.find(e=>e.tables.includes(s.name)).tables.join('+')}`),void K(e)}V(null),K(e)},snapOn:Y,grid:Z,joinFrom:q,onMove:(e,s,t,a)=>je(e,s,t,a),onResize:(e,s,t,a)=>{if('table'===e){const e=N.tables.find(e=>e.id===s);if('round'===e.shape){const l=Math.max(t,a);ge(s,{w:l,h:l,x:e.x,y:e.y})}else ge(s,{w:t,h:a,shape:t===a?'square':'rect',x:e.x,y:e.y})}else F({...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?{...e,w:t,h:a}:e)})}}),(0,I.jsxs)(x.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",Y?`tables snap to a ${Z} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,I.jsx)(u.default,{style:{width:de?330:void 0,flexGrow:de?0:1,flexShrink:0,flexBasis:de?330:void 0,borderLeftWidth:de?1:0,borderTopWidth:de?0:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:he?(0,I.jsx)(W,{t:he,plan:N,patch:e=>ge(he.id,e),rotate:()=>ye('table',he.id),remove:()=>pe(he.id),duplicate:()=>{const e=z(N),s={...he,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[t]=(0,b.placeNew)(N.tables.filter(e=>e.areaId===he.areaId),[s],(N.fixtures??[]).filter(e=>e.areaId===he.areaId));F({...N,tables:[...N.tables,t]}),K({kind:'table',id:t.id}),ne(`${(0,o.tableNumbers)(e)} added`)},join:()=>V(he.id),split:e=>F({...N,joins:N.joins.filter(s=>s.id!==e)}),moveArea:e=>{const[s]=(0,b.placeNew)(N.tables.filter(s=>s.areaId===e),[{...he,areaId:e,sectionId:P(N,e)}],(N.fixtures??[]).filter(s=>s.areaId===e));F({...N,tables:N.tables.map(e=>e.id===he.id?s:e)}),G(e)},onDone:()=>K(null),toast:ne}):be?(0,I.jsxs)(h.default,{style:{gap:10},children:[(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===be.kind)?.label}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>K(null)})]}),(0,I.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,I.jsx)(x.Chip,{label:e.label,selected:be.kind===e.id,onPress:()=>F({...N,fixtures:(N.fixtures??[]).map(s=>s.id===be.id?{...s,kind:e.id}:s)})},e.id))}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>ye('fixture',be.id)}),(0,I.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{F({...N,fixtures:(N.fixtures??[]).filter(e=>e.id!==be.id)}),K(null)}})]}):(0,I.jsxs)(h.default,{style:{gap:12},children:[(0,I.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",N.areas.find(e=>e.id===U)?.name??'']}),(0,I.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,I.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=z(N),s=(0,b.newTable)(e,U,4,P(N,U)),[t]=(0,b.placeNew)(N.tables.filter(e=>e.areaId===U),[s],(N.fixtures??[]).filter(e=>e.areaId===U));F({...N,tables:[...N.tables,t]}),K({kind:'table',id:t.id})}}),(0,I.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,I.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,I.jsx)(x.Chip,{label:e.label,onPress:()=>me(e.id)})},e.id))}),(0,I.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>xe(U)}),(0,I.jsx)(x.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>fe(U)}),(0,I.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:e=>y.useFloor.getState().setSettings(X,{...y.DEFAULT_SETTINGS,...J??{},gridSnap:e})}),(0,I.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:N.areas.map(e=>{const s=(0,b.planCounts)(N,e.id);return(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsxs)(x.T,{size:14,children:[e.name,(0,C.areaMarks)(e)]}),(0,I.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})})]})})]}):null]}),Q?(0,I.jsx)(h.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,I.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,I.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:Q.title}),(0,I.jsx)(t.GoldClose,{onPress:()=>ee(null),label:"Close",testID:"designer-confirm-close"})]}),(0,I.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:Q.body}),(0,I.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ee(null)}),(0,I.jsx)(x.Button,{kind:Q.danger?'danger':'primary',label:Q.ok,testID:"confirm-ok",onPress:()=>{const e=Q;ee(null),e.run()}})]})]})}):null,'save'===se&&ae?(0,I.jsx)(S.SaveAsPlanDialog,{venueId:ae,plan:R(N),onClose:()=>te(null),onSaved:()=>te(null),toast:ne}):null,'list'===se&&ae?(0,I.jsx)(S.SavedPlansDialog,{venueId:ae,mode:e.mode,role:le,isCar:v.IS_CAR,onClose:()=>te(null),onLive:s=>{l({t:'reset',p:s}),e.onLiveChange?.(s),te(null)},toast:ne}):null]})};var s=r(_d[0]),t=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(r(_d[11])),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),C=r(_d[19]),S=r(_d[20]),T=r(_d[21]),v=r(_d[22]),I=r(_d[23]);const k=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(e,s){return'set'===s.t?{past:[...e.past,e.now].slice(-80),now:s.p,future:[]}:'undo'===s.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===s.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:s.p,future:[]}}function R(e){const s=new Set(e.tables.map(e=>e.name)),t=[...e.sections];for(const s of e.areas)t.some(e=>e.id===`s-${s.id}`)||e.tables.some(e=>e.areaId===s.id&&e.sectionId)||t.push({id:`s-${s.id}`,name:s.name,colour:'#CFA45F',server:''});return{...e,sections:t,fixtures:(e.fixtures??[]).filter(s=>e.areas.some(e=>e.id===s.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>s.has(e)))}}const z=e=>{let s=1;const t=new Set(e.tables.map(e=>e.name));for(;t.has(String(s));)s++;return String(s)},P=(e,s)=>e.tables.find(e=>e.areaId===s)?.sectionId??`s-${s}`,$=(e,s)=>(e.fixtures??[]).some(e=>e.areaId===s&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,s)=>{let t=(0,b.slug)(s),a=2;for(;e.areas.some(e=>e.id===t);)t=`${(0,b.slug)(s)}-${a++}`;return t};function B({label:e,glyph:s,onPress:a,disabled:l}){return(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===s?(0,I.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,I.jsx)(t.GoldX,{size:14}),(0,I.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,I.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[s,(0,I.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:s,onPick:t}){return(0,I.jsx)(u.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===s,o=(0,b.planCounts)(e,a.id);return(0,I.jsx)(d.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>t(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,I.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,C.areaMarks)(a)," ",(0,I.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function M({plan:e,set:s,confirm:t,wide:l,next:n,toast:c}){const[f,j]=(0,i.useState)(''),y=(t,a)=>s({...e,areas:e.areas.map(e=>e.id===t?{...e,...a}:e)}),w=(t,a)=>{const l=[...e.areas],o=t+a;o<0||o>=l.length||([l[t],l[o]]=[l[o],l[t]],s({...e,areas:l}))},C=()=>{const t=f.trim();if(!t)return;if(e.areas.some(e=>e.name.toLowerCase()===t.toLowerCase()))return void c(`There's already an area called ${t}`);const a=A(e,t);s({...e,areas:[...e.areas,{id:a,name:t,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:t,colour:'#CFA45F',server:''}]}),j('')};return(0,I.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,I.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,I.jsx)(x.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,I.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(F,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,I.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,I.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,I.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,I.jsx)(x.Row,{gap:8,children:(0,I.jsx)(F,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,I.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),N.map(t=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===t;return(0,I.jsx)(d.default,{testID:`area-colour-${a.id}-${t.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${t}`,onPress:()=>s({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:t}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:t}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:t,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},t)})]}),(()=>{const s=e.tables.filter(e=>e.areaId===a.id).sort((e,s)=>e.name.localeCompare(s.name,void 0,{numeric:!0})),t=a.best??[];return s.length?(0,I.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:s.map(e=>(0,I.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:t.includes(e.name),onPress:()=>y(a.id,{best:t.includes(e.name)?t.filter(s=>s!==e.name):[...t,e.name]})},e.id))}),(0,I.jsx)(x.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,I.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,I.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,I.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,I.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,I.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>t({title:`Remove ${a.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>s({...e,areas:e.areas.filter(e=>e.id!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,I.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,I.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,I.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,I.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,I.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,I.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>t({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{s(e.make()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,I.jsx)(x.T,{weight:"semibold",children:e.name}),(0,I.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const N=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function F({value:e,onCommit:s,label:t="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,I.jsx)(a.TextInput,{accessibilityLabel:t,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>s(o.trim()),onSubmitEditing:()=>s(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function E({plan:e,set:s,area:t,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[S,T]=(0,i.useState)(4),[v,k]=(0,i.useState)(''),[D,R]=(0,i.useState)(!0),P=(0,i.useMemo)(()=>(0,b.parseTableList)(v),[v]),$=e.tables.filter(e=>e.areaId===t).sort(b.byNumber),A=z(e),M=e.areas.find(e=>e.id===t),N=(e,s)=>{const t=(0,b.sizeFor)(s),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(e.id,{maxSeats:s,minSeats:Math.min(e.minSeats,s),...l?{}:'round'===e.shape?{w:t.h,h:t.h}:{w:t.w,h:t.h,shape:t.shape}})};return(0,I.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,I.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,I.jsx)(L,{plan:e,area:t,onPick:l}),(0,I.jsxs)(x.Muted,{children:[M?`${M.name}${M.dogs?' \xb7 dogs allowed':''}${M.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,I.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:$.length?$.map((e,s)=>(0,I.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:s?1:0,borderColor:p.colours.border},children:[(0,I.jsxs)(h.default,{style:{width:92},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,I.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,I.jsx)(h.default,{style:{flex:1},children:(0,I.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:s=>N(e,s)})}),(0,I.jsx)(x.Muted,{children:"seats"}),(0,I.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,I.jsx)(h.default,{style:{padding:16},children:(0,I.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,I.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,I.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,I.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",M?.name]}),(0,I.jsxs)(x.Row,{gap:10,children:[(0,I.jsxs)(h.default,{style:{width:120},children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,I.jsx)(a.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:A,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,I.jsxs)(h.default,{children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,I.jsx)(x.Stepper,{value:S,min:1,max:20,label:"seats",onChange:T})]})]}),(0,I.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||A)}`,testID:"add-table",onPress:()=>{n([{name:(w||A).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,I.jsx)(x.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,I.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:v,onChangeText:k,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),v.trim()?(0,I.jsxs)(x.T,{size:14,colour:P.items.length?p.colours.ok:p.colours.amber,children:["Found ",P.items.length," table",1===P.items.length?'':'s'," \xb7 ",P.items.reduce((e,s)=>e+s.seats,0)," seats",P.skipped.length?` \xb7 couldn't read: ${P.skipped.slice(0,2).join('; ')}`:'']}):null,(0,I.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:D,onChange:R}),(0,I.jsx)(x.Button,{label:P.items.length?`Add ${P.items.length} tables`:'Add tables',testID:"paste-add",disabled:!P.items.length,onPress:()=>{n(P.items,D)&&k('')}})]})]})]})}function W({t:e,plan:s,patch:t,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,i.useState)(e.name);(0,i.useEffect)(()=>S(e.name),[e.id,e.name]);const T=s.joins.find(s=>s.tables.includes(e.name)),v=()=>{const a=C.trim().toUpperCase();if(a&&a!==e.name)return s.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void S(e.name)):void t({name:a})};return(0,I.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,I.jsx)(l.TableNumberWarning,{plan:s}),(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,I.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:v,onSubmitEditing:v,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,I.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:s=>t({maxSeats:s,minSeats:Math.min(e.minSeats,s)})})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,I.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>t({minSeats:e})})]}),(0,I.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,I.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const s=Math.max(e.w,e.h);t({shape:'square',w:s,h:s})}}),(0,I.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const s=Math.max(e.w,e.h);t({shape:'round',w:s,h:s})}}),(0,I.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const s=(0,b.sizeFor)(Math.max(5,e.maxSeats));t({shape:'rect',w:e.h>e.w?e.w:s.w,h:e.h>e.w?s.w:s.h})}}),(0,I.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const s=(0,b.sizeFor)(e.maxSeats);t({shape:s.shape,w:s.w,h:s.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),T?(0,I.jsxs)(h.default,{style:{gap:6},children:[(0,I.jsxs)(x.T,{size:14,children:["Joined with ",T.tables.filter(s=>s!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,I.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(T.tables.join('+'))})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(T.id),style:{flex:1}})]})]}):(0,I.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,I.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>t({online:e})}),s.areas.length>1?(0,I.jsxs)(h.default,{style:{gap:6},children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:s.areas.map(s=>(0,I.jsx)(x.Chip,{label:s.name,selected:s.id===e.areaId,onPress:()=>s.id!==e.areaId&&j(s.id)},s.id))})]}):null,(0,I.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},954,[931,835,873,933,812,941,31,123,264,152,288,128,1067,825,818,1538,1539,829,861,953,1541,824,807,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"saverConnected",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"SAVER_BUCKET",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useSaverCfg",{enumerable:!0,get:function(){return S}}),_e.loadSaver=v,_e.saveSaver=async function(e,t){const n=f();if(!n)return void S.getState().set(e);const{error:o}=await l().from('display_screensaver').upsert({venue_id:n,...(0,u.saverToRow)(e),updated_at:(new Date).toISOString(),updated_by:t.slice(0,80)});if(o)throw o;S.getState().set(e)},_e.watchSaver=y,_e.uploadSaverPhoto=async function(e,t){const n=f();if(!n)throw new Error('Photos need the venue connection.');if(t>=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},955,[31,993,871,824,985]); +__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})]})]})}},956,[989,31,128,823,829,958,825,818,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.guardBookingChange=w,_e.saveTablesReported=async function(e,t,n,o,s,u){if(!w(u,{b:t,tables:n}))return!1;const v=n.length?(0,h.notSavedWhat)({...t,name:o,table:n.join('+')}):`Taking the table off ${o}`;u(`Saving ${v}\u2026`);try{await(0,b.saveBookingTables)(e,t,n)}catch(e){const t=`${v} did not save: ${String(e?.message??e).slice(0,120)}`;return u(t),(0,l.announce)(t),!1}const y=await(0,c.waitForBookingSave)(t.id);if('saved'===y.state||'local'===y.state){const e=(0,r.savedWords)(o,t.partySize,n,s);return u(e),(0,l.announce)(e),!0}const k='waiting'===y.state?`${v}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${v} did not save. ${f("why"in y?y.why:"the shared system did not take it")}. Tap the red banner to try again.`;return u(k),(0,l.announce)(k),!1},_e.reportBookingSave=async function(e,t,n,o){const s=await(0,c.waitForBookingSave)(e);if('saved'===s.state||'local'===s.state)return o(t),(0,l.announce)(t),!0;const r='waiting'===s.state?`${n}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${n} did not save. ${f('why'in s?s.why:'the shared system did not take it')}. Tap the red banner to try again.`;return o(r),(0,l.announce)(r),!1},_e.BookingSaveBanner=function({rid:e,testID:r="booking-save-banner",margin:c}){const b=(0,h.useBookingSaves)(e=>e.notSaved),w=(0,s.useBookings)(e).filter(e=>b[e.id]).map(e=>void 0!==b[e.id].want?{...e,table:b[e.id].want||void 0}:e),{msg:S,retry:$}=k(),m=(0,t.useRef)(''),p=w.map(e=>(0,h.notSavedLine)(e)),B=w.map(e=>e.id).sort().join(',');if((0,t.useEffect)(()=>{B&&B!==m.current&&(0,l.announce)(1===w.length?p[0]:`${w.length} booking changes did not save. Tap the red banner to try again.`),m.current=B},[B]),!w.length)return null;const j=1===w.length?p[0]:`${w.length} booking changes did not save. Tap to try again.`;return(0,y.jsx)(n.default,{testID:r,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${j}${w.length>1?` ${w.map(e=>(0,h.notSavedWhat)(e)).join('. ')}.`:''} ${f(b[w[0].id].why)}.`,onPress:$,style:{...c??{},alignSelf:'stretch',gap:4,padding:12,borderRadius:12,borderWidth:2,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:(0,y.jsxs)(o.default,{accessibilityRole:"alert",style:{alignItems:'center',gap:4},children:[(0,y.jsx)(v.T,{testID:`${r}-title`,size:17,weight:"semibold",center:!0,colour:"#FFD2CC",children:j}),w.length>1?w.slice(0,6).map(e=>(0,y.jsx)(v.T,{testID:`${r}-line`,size:15,center:!0,colour:"#FFD2CC",children:(0,h.notSavedWhat)(e)},e.id)):null,(0,y.jsx)(v.T,{testID:`${r}-why`,size:14,center:!0,colour:"#FFB3AA",children:w.length>1?`${f(b[w[0].id].why)}${w.length>6?` \xb7 and ${w.length-6} more`:''}`:f(b[w[0].id].why)}),S?(0,y.jsx)(v.T,{testID:`${r}-msg`,size:14,center:!0,colour:u.colours.goldLight,children:S}):null]})})},_e.BookingNotSavedLine=function({b:e}){const t=(0,h.useBookingSaves)(t=>t.notSaved[e.id]),{msg:o,retry:s}=k();if(!t)return null;void 0!==t.want&&(e={...e,table:t.want||void 0});return(0,y.jsxs)(n.default,{testID:`booking-not-saved-${e.id}`,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${(0,h.notSavedLine)(e)} ${f(t.why)}.`,onPress:s,style:{alignSelf:'stretch',padding:8,borderRadius:10,borderWidth:1.5,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:[(0,y.jsx)(v.T,{size:15,weight:"semibold",center:!0,colour:"#FFD2CC",children:(0,h.notSavedLine)(e)}),o?(0,y.jsx)(v.T,{size:13,center:!0,colour:u.colours.goldLight,children:o}):null]})};var t=_r(d[0]),n=e(_r(d[1])),o=e(_r(d[2])),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),b=_r(d[9]),v=_r(d[10]),y=_r(d[11]);const f=e=>e.charAt(0).toUpperCase()+e.slice(1);function w(e,t){const n=(0,c.bookingSaveBlocker)();if(!n)return!0;t&&h.useBookingSaves.getState().mark({id:t.b.id,table:t.b.walkIn?'walk_ins':'bookings',why:n,...t.tables?{want:t.tables.join('+')}:{}});const o=`${t?(0,h.notSavedWhat)({...t.b,...t.tables?{table:t.tables.join('+')||void 0}:{}}):'This change'} did not save: ${n}.`;return e?.(o),(0,l.announce)(o),!1}function k(){const[e,n]=(0,t.useState)('');return{msg:e,retry:async()=>{n('Saving\u2026'),(0,l.announce)('Saving');const e=await(0,c.saveBookingsNow)(!0),t=e?`Not saved: ${e}.`:h.useBookingSaves.getState().count()?'Sent again. The banner clears when the shared system takes it.':'Nothing is left waiting. Check the plan and make the change again if it is not there.';n(t),(0,l.announce)(t)}}}},957,[31,264,128,823,958,1420,824,1283,825,988,818,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=u,e.requestedFreeTable=function(t,n,a,s,l=90){const o={id:n.id??'new',status:'confirmed',...n};for(const n of t)if(a.includes(n)&&!u(o,[n],s,l).length)return n;return null},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=c,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${c(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${c(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${c(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))}function c(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},958,[812,830]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},959,[812,1038,31,123,264,128,987,823,825,818,1490,941,961,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"unconfirmedTakeaways",{enumerable:!0,get:function(){return x}}),_e.useBuildingChime=function(e,s=4e3,i=6e4){const o=(0,a.useAlerts)(e=>e.prefs.muted);(0,t.useEffect)(()=>{if(!e||o)return;const t=Date.now(),l=()=>(0,c.lowChime)(Math.min(1,(Date.now()-t)/i));l();const n=setInterval(l,s);return()=>clearInterval(n)},[e,o,s,i])},_e.TakeawayFacts=b,_e.TakeawayTakeover=function({rid:e,me:i}){const o=(0,l.useOrders)(e),n=x(o),a=n[0],c=s.default.useRef(i);return c.current=i,(0,t.useEffect)(()=>{a?(0,f.notify)({id:'takeaway-takeover',tone:a.allergies.length?'urgent':'warn',modal:!0,big:!0,testID:'takeaway-takeover',icon:'\ud83e\udd61',kicker:'NEW TAKEAWAY ORDER',title:`Order ${a.ref}: read it, then tap Confirm`,body:"This stays on screen until someone confirms."+(n.length>1?` ${n.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,j.jsx)(y,{rid:e,id:a.id,me:c.current})}):(0,f.dismissNotice)('takeaway-takeover')},[a?.id,n.length,e]),(0,t.useEffect)(()=>()=>(0,f.dismissNotice)('takeaway-takeover'),[]),null};var t=r(d[0]),s=e(t),i=e(r(d[1])),o=e(r(d[2])),l=r(d[3]),n=r(d[4]),a=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),j=r(d[10]);const w=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'As soon as possible',x=e=>e.filter(e=>'takeaway'===e.type&&'new'===e.status&&!e.accepted).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function b({o:e,big:t,personal:s=!0}){const o=t?1:.8;return(0,j.jsxs)(i.default,{style:{gap:10},children:[(0,j.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:18},children:[(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Collection"}),(0,j.jsx)(h.T,{size:34*o,weight:"bold",colour:u.colours.goldLight,children:w(e.slotTime)})]}),s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Customer"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.customerName})]}):null,s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Phone"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.phone??'Not given'})]}):null,(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Order"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.ref})]})]}),e.allergies.length?(0,j.jsxs)(i.default,{testID:"takeover-allergy",style:{backgroundColor:'#7A140D',borderRadius:12,padding:12,borderWidth:2,borderColor:'#FFB3AB'},children:[(0,j.jsxs)(h.T,{size:22*o,weight:"bold",colour:"#FFFFFF",children:["\u26a0 ALLERGY: ",e.allergies.map(e=>`${(0,n.allergenLabel)(e.allergen)} (${(0,n.severityLabel)(e.severity)})`).join(', ')]}),e.lines.filter(e=>e.overridden).map((e,t)=>(0,j.jsxs)(h.T,{size:16*o,weight:"semibold",colour:"#FFE3DF",children:["Customer overrode a warning: ",e.name," contains ",e.contains.map(n.allergenLabel).join(', ')]},t))]}):(0,j.jsx)(h.T,{size:16*o,colour:u.colours.ok,children:"No allergies declared"}),(0,j.jsx)(i.default,{style:{gap:4},children:e.lines.map((e,t)=>(0,j.jsxs)(h.T,{size:22*o,weight:"semibold",children:[e.qty," \xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 \u201c${e.notes}\u201d`:'']},t))})]})}function y({rid:e,id:t,me:s}){const n=(0,l.useOrders)(e).find(e=>e.id===t),{width:a}=(0,o.default)();return n?(0,j.jsxs)(i.default,{style:{gap:12},children:[(0,j.jsx)(b,{o:n,big:a>=700}),(0,j.jsx)(h.Button,{label:`Confirm order ${n.ref}`,testID:"takeover-confirm",onPress:()=>{l.repo.orders.accept(n.id,s)},style:{minHeight:72,borderRadius:14}})]}):null}},960,[31,128,288,823,819,961,944,825,818,941,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},961,[1491,1492,1494,1493,1495,944,1496]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'Closed for weather':'For weather',accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),I=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{testID:"block-today",title:"Today",sub:T?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!T,onPress:()=>m('today')}),(0,f.jsx)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},962,[812,31,1465,971,264,128,828,829,833,822,825,818,1081,1546,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:w,now:b,turnBase:v,blocks:M=[],height:T=150,forecastNote:$,emptyText:D,past:A,closed:k,compact:C=!1,dense:I=!1,bare:z=!1,fill:F=!1,fit:L=!1,tight:S=!1,live:_=!1}){const[H,O]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),P=j.getTime()-18e5,E=w.getTime()+36e5,R=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(P),new Date(E),v),[e,P,E,v]),X=60*j.getHours()+j.getMinutes(),U=60*w.getHours()+w.getMinutes(),W=(0,t.useMemo)(()=>(0,f.chartBands)(M,X,U),[M,X,U]),G=new Date(j);G.setHours(0,0,0,0);const V=e=>G.getTime()+6e4*e,Y=Math.max(8,...R.map(e=>e.covers)),Z=R.reduce((e,t)=>!t.covers||(0,f.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),W)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),q=L&&N?Math.max(24,Math.floor(N)):Math.max(48,T-m.AXIS_BAND),J=I?8:16,K=Math.max(10,H-28-8),Q=Math.max(10,q-J-6),ee=e=>28+(e-P)/(E-P)*K,te=e=>J+Q-e/(1.15*Y)*Q,se=[];for(let e=new Date(P);e.getTime()<=E;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=P&&t.getTime()<=E&&se.push(t.getTime())}const ie=_?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ne=Math.min(E,Math.max(P,b.getTime())),oe=k?null:_?{t:ne,covers:ie,text:(0,m.seatedNowText)(ie)}:Z,le=H?(0,m.layoutChart)({width:H,height:q,t0:P,t1:E,hours:se,busiest:oe}):{hours:[],busiest:null},re=R.map((e,t)=>`${t?'L':'M'}${ee(e.t).toFixed(1)},${te(e.covers).toFixed(1)}`).join(' '),ae=F&&re&&R.length>1?`${re} L${ee(R[R.length-1].t).toFixed(1)},${te(0).toFixed(1)} L${ee(R[0].t).toFixed(1)},${te(0).toFixed(1)} Z`:'',de=(0,i.coversFour)(e,e[0]?.date??''),he=`Total ${de.total} ${1===de.total?'Cover':'Covers'}`,ue=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,ce=le.busiest?.text??(k?'':_?(0,m.seatedNowText)(ie):Z?(0,m.busiestText)(Z.t,Z.covers):''),xe=W.map(e=>e.spoken).join('. '),ge=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(w)}.${ce?` ${ce}.`:''}${xe?` ${xe}.`:''}`,me=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(n.default,{testID:"day-graph",style:[h.look.panel,L?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:z?4:I?2:10,paddingBottom:z?2:6,backgroundColor:c.colours.bg}],children:[z?null:C?(0,y.jsxs)(n.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(d.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(d.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:he})]}):(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(d.T,{size:I?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(d.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:he})]}),z||S?null:k?$?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:$}):null:(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),$?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:$}):(0,y.jsx)(n.default,{style:{flex:1}}),(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(w)]})]}),(0,y.jsx)(n.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ge,onLayout:e=>{O(e.nativeEvent.layout.width),L&&B(e.nativeEvent.layout.height)},style:L?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,T-m.AXIS_BAND),minHeight:24,overflow:'hidden'}:{height:q,minHeight:q},children:H?(0,y.jsxs)(l.default,{width:H,height:q,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${me}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${me}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),W.map((e,t)=>(0,y.jsx)(o.Rect,{x:ee(V(e.fromMin)),y:J,width:Math.max(3,ee(V(e.toMin))-ee(V(e.fromMin))),height:Q,fill:`url(#${me}-${e.strength})`},`${e.fromMin}-${t}`)),ae?(0,y.jsx)(o.Path,{d:ae,fill:"#3A2F1E",stroke:"none"}):null,re?(0,y.jsx)(o.Path,{d:re,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,k?null:[j,w].map((e,t)=>(0,y.jsx)(o.Line,{x1:ee(e.getTime()),x2:ee(e.getTime()),y1:J,y2:J+Q,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:le.busiest.x+le.busiest.w/2,y:le.busiest.y+le.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:le.busiest.text}):null,ue?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+K/2,y:J+Q/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null}),(0,y.jsxs)(n.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(d.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),le.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,H)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,H-t),s));return(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':it.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},964,[]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_BACK",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"DAY_AHEAD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"DAY_IDLE_MS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"dayOffset",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"shiftDay",{enumerable:!0,get:function(){return y}}),_e.dayWord=f,Object.defineProperty(_e,"dayLong",{enumerable:!0,get:function(){return p}}),_e.bookingsForDay=function(e,t,o){return e.filter(e=>e.date===t&&(0,n.ACTIVE)(e))},_e.dayCovers=function(e,t,o){return(0,n.coversFour)(e,t)},_e.DaySwitch=function({day:e,today:n,onDay:b,back:x=c,ahead:j=u,idPrefix:$="display-day",stacked:D=!1,header:w=!1,onPickDate:C}){const P=h(e,n),k=t=>{const o=y(e,t);b(o===n?null:o)},L=y(e,-1),I=y(e,1),v=0!==P,T=(e,o,n,s,c)=>(0,d.jsx)(t.default,{testID:c,accessibilityRole:"button",accessibilityLabel:o,accessibilityState:{disabled:s},disabled:s,onPress:n,style:({pressed:e})=>({minHeight:44,minWidth:w?44:D?140:92,flex:D?1:void 0,paddingHorizontal:w?8:D?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,opacity:s?.35:1,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:(0,d.jsx)(i.T,{center:D,size:D?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:D?void 0:1,children:e})}),O=f(e,n),W=C?(0,d.jsx)(t.default,{testID:`${$}-cal`,accessibilityRole:"button",accessibilityLabel:"Pick a date from the calendar",onPress:C,style:({pressed:e})=>({minHeight:44,minWidth:w?44:D?140:92,flex:D?1:void 0,paddingHorizontal:w?8:D?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:w?(0,d.jsxs)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{width:18,height:16,borderWidth:1.5,borderColor:l.colours.goldLight,borderRadius:3,overflow:'hidden'},children:[(0,d.jsx)(o.default,{style:{height:4,backgroundColor:l.colours.goldLight}}),(0,d.jsx)(o.default,{style:{flex:1,flexDirection:'row',flexWrap:'wrap',padding:1.5,gap:1.5,justifyContent:'center',alignContent:'center'},children:[0,1,2,3].map(e=>(0,d.jsx)(o.default,{style:{width:3,height:3,backgroundColor:l.colours.goldLight}},e))})]}):(0,d.jsx)(i.T,{center:D,size:D?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:1,children:"Calendar"})}):null;return D?(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1,borderColor:v?l.colours.gold:l.colours.hairline,backgroundColor:v?l.colours.goldTint:l.colours.surface},children:[(0,d.jsxs)(o.default,{testID:`${$}-label`,accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${O}, ${p(e)}`,style:{gap:2,alignItems:'center'},children:[(0,d.jsx)(i.T,{center:!0,size:20,weight:"semibold",colour:l.colours.goldLight,children:O}),(0,d.jsx)(i.T,{center:!0,size:16,children:p(e)})]}),(0,d.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),T('Today','Back to today',()=>b(null),!1,'back-to-today'),W,T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]})]}):w?(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,flexShrink:1,minWidth:0},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),(0,d.jsx)(t.default,{testID:`${$}-label`,accessibilityRole:v||C?'button':'text',disabled:!v&&!C,onPress:()=>v?b(null):C?.(),accessibilityLabel:v?`Showing ${O===(0,s.niceDate)((0,s.parseYmd)(e))?'':`${O}, `}${p(e)}. Back to today`:C?`Showing today, ${p(e)}. Open the calendar to pick a date`:`Showing today, ${p(e)}`,style:({pressed:e})=>({minWidth:72,maxWidth:220,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:8,borderWidth:v?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:v?l.colours.goldTint:'transparent'}),children:(0,d.jsx)(i.T,{size:14,weight:"semibold",colour:v?l.colours.gold:l.colours.text,numberOfLines:1,children:v&&O!==(0,s.niceDate)((0,s.parseYmd)(e))?`${O} \xb7 ${(0,s.niceDate)((0,s.parseYmd)(e))}`:O})}),W,T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]}):(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:8},children:[(0,d.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),(0,d.jsxs)(t.default,{testID:`${$}-label`,accessibilityRole:v||C?'button':'text',disabled:!v&&!C,onPress:()=>v?b(null):C?.(),accessibilityLabel:v?`Showing ${O===(0,s.niceDate)((0,s.parseYmd)(e))?'':`${O}, `}${p(e)}. Back to today`:C?`Showing today, ${p(e)}. Open the calendar to pick a date`:`Showing today, ${p(e)}`,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:6,borderWidth:v?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:v?l.colours.goldTint:'transparent'}),children:[(0,d.jsx)(i.T,{size:15,weight:"semibold",colour:v?l.colours.gold:l.colours.text,numberOfLines:1,children:v&&O!==(0,s.niceDate)((0,s.parseYmd)(e))?`${O} \xb7 ${(0,s.niceDate)((0,s.parseYmd)(e))}`:O}),v?(0,d.jsx)(i.T,{size:11,colour:l.colours.muted,numberOfLines:1,children:"Tap for today"}):null]}),T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]}),W?(0,d.jsx)(o.default,{style:{alignItems:'center'},children:W}):null]})},r(_d[0]);var t=e(r(_d[1])),o=e(r(_d[2])),i=r(_d[3]),n=r(_d[4]),s=r(_d[5]),l=r(_d[6]),d=r(_d[7]);const c=365,u=365,b=12e4,h=(e,t)=>Math.round(((0,s.parseYmd)(e).getTime()-(0,s.parseYmd)(t).getTime())/864e5),y=(e,t)=>(0,s.ymd)((0,s.addMins)((0,s.parseYmd)(e),1440*t+120));function f(e,t){const o=h(e,t);return 0===o?'Today':-1===o?'Yesterday':1===o?'Tomorrow':(0,s.niceDate)((0,s.parseYmd)(e))}const p=e=>(0,s.parseYmd)(e).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},965,[31,264,128,818,832,822,825,25]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CalendarGlyph=function({colour:e=o.colours.goldLight,size:t=18}){const s=Math.max(2,Math.round(.16*t));return(0,u.jsxs)(l.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{width:t,height:t-2,borderWidth:1.5,borderColor:e,borderRadius:3,overflow:'hidden',backgroundColor:'transparent'},children:[(0,u.jsx)(l.default,{style:{height:Math.max(3,Math.round(.22*t)),backgroundColor:e}}),(0,u.jsx)(l.default,{style:{flex:1,flexDirection:'row',flexWrap:'wrap',padding:2,gap:2,justifyContent:'center',alignContent:'center'},children:Array.from({length:4},(t,i)=>(0,u.jsx)(l.default,{style:{width:s,height:s,borderRadius:.5,backgroundColor:e,opacity:.9}},i))})]})},_e.DisplayCalendar=function({visible:e,today:b,day:f,bookings:x,restaurant:p,now:j,onDay:D,onClose:w,back:C=d.DAY_BACK,ahead:I=d.DAY_AHEAD,idPrefix:T="display-cal",showBusy:_=!0,sheetTestID:S}){const[$,v]=(0,t.useState)(f.slice(0,7)),[B,k]=(0,t.useState)(0);(0,t.useEffect)(()=>{e&&v(f.slice(0,7))},[e,f]);const R=(0,n.venueBusy)(p,x,j??new Date).busy,E=(0,c.monthCells)($),P=(0,c.shiftMonth)($,-1),L=(0,c.shiftMonth)($,1),O=(0,c.monthInRange)(P,b,C,I),Y=(0,c.monthInRange)(L,b,C,I),M=B/7,N=e=>M>=46?e.slice(0,3):e.slice(0,2),A=e=>{D(e===b?null:e),w()},U=(0,c.quickJumps)(b);return(0,u.jsx)(i.Sheet,{visible:e,onClose:w,title:"Pick a date",centerTitle:!0,maxWidth:560,testID:S??T,footer:(0,u.jsxs)(l.default,{style:{gap:10,alignItems:'center'},children:[(0,u.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:U.map(e=>{const t=(0,c.inDisplayRange)(e.date,b,C,I);return(0,u.jsx)(i.Chip,{label:e.label,selected:f===e.date,disabled:!t,testID:`${T}-jump-${e.id}`,accessibilityLabel:`${e.label}, ${(0,c.longDay)(e.date)}${t?'':', not available'}`,onPress:()=>{t&&(v(e.date.slice(0,7)),A(e.date))}},e.id)})}),(0,u.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:(0,u.jsx)(i.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close calendar",testID:`${T}-close`,onPress:w})})]}),children:(0,u.jsxs)(l.default,{style:{gap:10,alignItems:'stretch'},children:[(0,u.jsx)(i.T,{size:22,weight:"bold",colour:o.colours.goldLight,center:!0,accessibilityRole:"header",testID:`${T}-month`,children:(0,c.monthName)($)}),(0,u.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Previous month",accessibilityLabel:O?`Previous month, ${(0,c.monthName)(P)}`:`Previous month, ${(0,c.monthName)(P)}, not available`,disabled:!O,testID:`${T}-prev`,onPress:()=>v(P)}),(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Next month",accessibilityLabel:Y?`Next month, ${(0,c.monthName)(L)}`:`Next month, ${(0,c.monthName)(L)}, not available`,disabled:!Y,testID:`${T}-next`,onPress:()=>v(L)})]}),(0,u.jsxs)(l.default,{onLayout:e=>k(e.nativeEvent.layout.width),style:{width:'100%'},children:[(0,u.jsx)(l.default,{style:{flexDirection:'row'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:h.map(e=>(0,u.jsx)(l.default,{style:{width:'14.2857%',alignItems:'center'},children:(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,center:!0,children:N(e)})},e))}),(0,u.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},testID:`${T}-grid`,children:E.map((e,t)=>{if(!e)return(0,u.jsx)(l.default,{style:{width:'14.2857%',height:56}},`blank-${t}`);const n=(0,c.inDisplayRange)(e,b,C,I),d=e===f,h=(0,c.dayIsClosed)(p,e),j=_?(0,c.dayCoversTotal)(x,e):0,D=_?(0,c.dayBusyTier)(j,R,(0,c.serviceHoursOf)(p,e)):'none';return(0,u.jsxs)(s.default,{testID:`${T}-${e}`,accessibilityRole:"button",accessibilityLabel:(0,c.calendarDayLabel)(e,b,f,j,D,h,_),accessibilityState:{selected:d,disabled:!n},disabled:!n,onPress:()=>A(e),style:{width:'14.2857%',height:56,minHeight:56,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:d||e===b?1.5:0,borderColor:o.colours.gold,backgroundColor:d?o.colours.goldTint:'transparent',opacity:n?h?.45:1:.3},children:[(0,u.jsx)(i.T,{size:17,weight:d||e===b?'bold':'regular',colour:d?o.colours.goldLight:h?o.colours.muted:o.colours.text,center:!0,children:Number(e.slice(8))}),_?(0,u.jsx)(y,{tier:D}):null]},e)})})]}),(0,u.jsx)(l.default,{testID:`${T}-key`,children:(0,u.jsxs)(i.Row,{wrap:!0,gap:12,style:{justifyContent:'center',paddingTop:2},children:[_?[['silver','Quiet'],['bronze','Steady'],['gold','Busy']].map(([e,t])=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,u.jsx)(l.default,{style:{width:c.BUSY_DOT_SIZE[e],height:c.BUSY_DOT_SIZE[e],borderRadius:c.BUSY_DOT_SIZE[e]/2,backgroundColor:c.BUSY_DOT[e]}}),(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,children:t})]},e)):null,(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,children:"Closed days are faded"})]})})]})})};var t=r(_d[0]),s=e(r(_d[1])),l=e(r(_d[2])),i=r(_d[3]),n=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]);const h=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];function y({tier:e}){const t=c.BUSY_DOT_SIZE[e];return'none'===e?(0,u.jsx)(l.default,{style:{width:c.BUSY_DOT_SIZE.gold,height:c.BUSY_DOT_SIZE.gold,marginTop:2}}):(0,u.jsx)(l.default,{testID:`busy-dot-${e}`,style:{width:t,height:t,borderRadius:t/2,marginTop:2,backgroundColor:c.BUSY_DOT[e]}})}},966,[31,264,128,818,930,825,965,1409,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))}},967,[]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},968,[812,986]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},969,[31,264,128,818,968,825,947,25]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){if(t&&t.length&&o)return t.find(t=>t.staffId===n&&'approved'===t.status&&t.from<=o&&o<=t.to)}Object.defineProperty(e,'__esModule',{value:!0}),e.leaveCovering=t,Object.defineProperty(e,"coveredByLeave",{enumerable:!0,get:function(){return n}}),e.workingShifts=function(t,o){return o&&o.length?t.filter(t=>!n(o,t)):t},e.leaveLabel=function(t){return/sick|ill/i.test(t?.reason??'')?'Off sick':'On holiday'},e.leaveNote=function(t){return['Approved time off',t.reason&&'Holiday'!==t.reason?t.reason:'',t.decidedBy?`approved by ${t.decidedBy.replace(' (example)','')}`:''].filter(Boolean).join(' \xb7 ')};const n=(n,o)=>!!t(n,o.staffId,o.date)},970,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},971,[5,1341,1191,931,123,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}),Object.defineProperty(_e,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d}){const m=(0,h.useShellfish)(e,t,s),b=$(e),[f,p]=(0,o.useState)(!1),k=T(e,m.items.find(e=>e.supplierId)?.supplierId),x=(0,r.useLiveState)();if('ready'!==x)return(0,j.jsx)(r.LiveWait,{state:x,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!m.items.length)return null;const v=m.items.filter(e=>m.isLow(e.key)),w=m.items.length<=3?m.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:v.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,m.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",w]}),(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:m.items.map(t=>{const s=m.counts[t.key]??0,o=m.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),b[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,b[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-b[t.key]))]}):null]},t.key)})})]}),!n&&v.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",v.map(t=>`${(0,u.fmtStockCount)(e,t,m.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:k?`Order from ${k} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||v.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:k?`${k} order sheet \u203a`:'Order sheets \u203a'})}),f?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>p(!1),onOrder:l?()=>{p(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},972,[1083,807,31,1387,971,197,264,128,1455,818,1086,1084,1085,825,823,832,822,1420,824,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyChain=j,_e.BookingAllergyChain=function({b:l,me:t,readOnly:k}){const p=(0,i.useOrders)(l.restaurantId),S=(0,o.useStore)(e=>e.ackBookingAllergy);if(!l.allergies.length)return null;const A=p.find(e=>e.allergies.length&&!['cancelled','closed'].includes(e.status)&&(e.bookingId===l.id||!e.bookingId&&(0,c.linkedBooking)(e,[l])?.id===l.id));if(A)return(0,h.jsx)(j,{o:A,me:t,readOnly:k,compact:!0});const I={booked:l.allergyAck,ordered:void 0,kitchen:void 0,pass:void 0,table:void 0};return(0,h.jsxs)(s.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:l.allergyAck?u.colours.border:u.colours.red,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(n.T,{size:13,weight:"semibold",colour:"#FFD9D4",children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(n.Badge,{kind:l.allergyAck?'amber':'red',label:(l.allergyAck?1:0)+" of 5"})]}),(0,h.jsx)(y,{chain:I,next:l.allergyAck?null:'booked',testID:`allergy-steps-${l.ref}`}),l.allergyAck?(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:l.allergyAck.by,size:20,ring:!1}),(0,h.jsxs)(n.Muted,{style:{flex:1},children:["1. Booked: ",b(l.allergyAck.by)," at ",x(l.allergyAck.at),". Steps 2 to 5 are signed on the table's order."]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(n.T,{size:13,children:"Next: 1. Booked. Allergy recorded (who took it)."}),k?null:(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(n.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off Booked on ${l.ref}`,disabled:!t.trim(),onPress:()=>S(l.id,t)}),(0,h.jsxs)(n.Muted,{children:["as ",b(t)]})]})]})]})};var e=r(d[0]);r(d[1]);var l,t=r(d[2]),s=(l=t)&&l.__esModule?l:{default:l},n=r(d[3]),i=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]),h=r(d[9]);const x=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),b=e=>e.replace(' (example)','');function y({chain:e,next:l,testID:t}){return(0,h.jsx)(s.default,{testID:t,accessibilityLabel:`Allergen sign-off ${c.CHAIN_STEPS.filter(l=>e[l.id]).length} of 5`,style:{flexDirection:'row',alignItems:'flex-start'},children:c.CHAIN_STEPS.map((t,i)=>{const o=!!e[t.id],f=l===t.id,y=o?u.colours.ok:f?u.colours.gold:u.colours.border,j=0===i?'flex-start':i===c.CHAIN_STEPS.length-1?'flex-end':'center',k=(0,h.jsxs)(s.default,{style:{width:'200%',alignSelf:j,alignItems:j},children:[(0,h.jsx)(n.T,{size:11,weight:f?'semibold':'regular',colour:o?u.colours.text:f?u.colours.gold:u.colours.muted,style:{textAlign:0===i?'left':i===c.CHAIN_STEPS.length-1?'right':'center'},children:t.label}),e[t.id]?(0,h.jsxs)(n.T,{size:10,colour:u.colours.muted,numberOfLines:1,style:{textAlign:0===i?'left':i===c.CHAIN_STEPS.length-1?'right':'center'},children:[b(e[t.id].by).split(' ')[0]," ",x(e[t.id].at)]}):null]}),p=i%2==1;return(0,h.jsxs)(s.default,{style:{flex:1,alignItems:'center'},children:[(0,h.jsx)(s.default,{style:{minHeight:30,justifyContent:'flex-end',alignSelf:'stretch',alignItems:j},children:p?k:null}),(0,h.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',width:'100%',marginVertical:2},children:[(0,h.jsx)(s.default,{style:{flex:1,height:2,backgroundColor:i?o||f?y:u.colours.border:'transparent'}}),(0,h.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,borderWidth:2,borderColor:y,backgroundColor:o?u.colours.ok:'transparent',alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(n.T,{size:12,weight:"bold",colour:o?'#0B0B0B':f?u.colours.gold:u.colours.muted,children:o?'\u2713':String(t.n)})}),(0,h.jsx)(s.default,{style:{flex:1,height:2,backgroundColor:i<4?o?u.colours.ok:u.colours.border:'transparent'}})]}),(0,h.jsx)(s.default,{style:{minHeight:30,alignSelf:'stretch',alignItems:j},children:p?null:k})]},t.id)})})}function j({o:l,me:t,readOnly:j,compact:k}){const p=(0,i.useBookings)(l.restaurantId),S=(0,o.useStore)(e=>e.signAllergyStep);if(!l.allergies.length)return null;const A=(0,c.linkedBooking)(l,p),I=(0,c.orderChain)(l,A),C=(0,c.nextStep)(l,A),w=c.CHAIN_STEPS.filter(e=>I[e.id]).length,T=C?(0,c.stepInfo)(C):null,B='table'===C&&!['ready','served','collected'].includes(l.status);return(0,h.jsxs)(s.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:C?u.colours.red:u.colours.ok,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(n.T,{size:13,weight:"semibold",colour:C?'#FFD9D4':'#E2C489',children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(n.Badge,{kind:C?'red':'ok',label:C?`${w} of 5`:'Complete'})]}),(0,h.jsx)(y,{chain:I,next:C,testID:`allergy-steps-${l.ref}`}),k?null:c.CHAIN_STEPS.filter(e=>I[e.id]).map(e=>(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:I[e.id].by,size:20,ring:!1}),(0,h.jsxs)(n.Muted,{style:{flex:1},children:[e.n,". ",e.label,": ",b(I[e.id].by)," at ",x(I[e.id].at)]})]},e.id)),T?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(n.T,{size:13,children:["Next: ",T.n,". ",T.label,". ",T.what,"."]}),j?null:(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(n.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off ${T.label} on ${l.ref}`,disabled:!t.trim()||B,onPress:()=>S(l.id,C,t)}),(0,h.jsxs)(n.Muted,{children:["as ",b(t)]})]}),B?(0,h.jsx)(n.Muted,{children:"Signed off at the pass. The table step is signed when the dish is served."}):(0,h.jsx)(n.Muted,{children:"The ticket can't move on until this step is signed off."})]}):(0,h.jsx)(n.Muted,{children:"All five steps signed off. The full chain is in the allergen audit log."})]})}},973,[931,31,128,818,1079,878,974,825,994,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CHAIN_STEPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"stepInfo",{enumerable:!0,get:function(){return t}}),e.linkedBooking=l,e.orderChain=o,e.nextStep=s,Object.defineProperty(e,"doneCount",{enumerable:!0,get:function(){return c}}),e.canSign=function(n,t,l){return s(n,l)===t},e.statusBlock=function(n,l,s){if(!n.allergies.length||'cancelled'===l)return null;const c=o(n,s),u=n=>c[n]?null:`${t(n).n}. ${t(n).label} needs signing off first`;return'acknowledged'===l||'preparing'===l||'ready'===l?u('booked')??u('ordered')??u('kitchen'):'served'===l?u('booked')??u('ordered')??u('kitchen')??u('pass'):'collected'===l||'closed'===l?u('booked')??u('ordered')??u('kitchen')??u('pass')??u('table'):null},e.chainNeedsAction=function(n,t){const o=s(n,l(n,t));return!(!o||'table'===o&&!['ready','served'].includes(n.status))},e.bookingNeedsAction=function(n,t){return n.allergies.length>0&&!n.allergyAck&&!t.some(t=>t.allergies.length&&l(t,[n])?.id===n.id)};const n=[{id:'booked',n:1,label:'Booked',what:'Allergy recorded (who took it)'},{id:'ordered',n:2,label:'Ordered',what:'Server confirms with the guest'},{id:'kitchen',n:3,label:'Kitchen',what:'Chef signs off before cooking'},{id:'pass',n:4,label:'Pass',what:'Checked before it leaves the pass'},{id:'table',n:5,label:'Table',what:'Server signs off when served'}],t=t=>n.find(n=>n.id===t);function l(n,t){return n.bookingId?t.find(t=>t.id===n.bookingId):'table'===n.type&&n.tableNo?t.find(t=>t.restaurantId===n.restaurantId&&'seated'===t.status&&!!t.table&&t.table.split('+').includes(String(n.tableNo))):void 0}function o(n,t){return{booked:n.allergyChain?.booked??(t?.allergies.length?t.allergyAck:void 0),ordered:n.allergyChain?.ordered,kitchen:n.allergyAck,pass:n.allergyChain?.pass,table:n.handoverCheck}}function s(t,l){if(!t.allergies.length)return null;const s=o(t,l);return n.find(n=>!s[n.id])?.id??null}const c=(t,l)=>{const s=o(t,l);return n.filter(n=>s[n.id]).length}},974,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_ACTOR",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CAR_DEVICE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"CAR_DEFAULT_LABEL",{enumerable:!0,get:function(){return u}}),e.carDeviceIdentity=c,e.actorStamp=function(t){if(t.isCar)return r;if((0,n.isKitchenViaDisplay)())return(0,n.kitchenActor)();if('device'===t.kind)return'Display';return t.staffRef&&String(t.staffRef).trim()||t.fallback||'Staff'},e.migrateCarStaffIdentity=function(n){return n?.venueId?c({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,label:n.label}):null},e.carPairApproved=function(n){return'approved'===String(n?.status??'')&&!(!n?.venue_id&&!n?.venueId)};var n=_r(d[0]);const r='Car',t='car-device',u='Tesla';function c(n){return{kind:'device',venueId:String(n.venue_id??n.venueId??''),venueSlug:String(n.venue_slug??n.venueSlug??'anchorage'),venueName:String(n.venue_name??n.venueName??'The Anchorage'),canWrite:!0,role:'owner',displayName:r,label:n.label&&String(n.label).trim()||u}}},975,[977]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ROLE_BADGES",{enumerable:!0,get:function(){return n}}),e.cleanBadge=t,Object.defineProperty(e,"badgeSpoken",{enumerable:!0,get:function(){return o}}),e.assignShiftBadge=function(n,o,c){const s=t(c);return n.map(n=>n.id===o?{...n,badge:s,changed:!!n.published||n.changed}:n)};const n=['Bar','Floor','Upstairs KP','Downstairs KP','Sauce','Larder'];function t(t){const o=String(t??'').trim().toLowerCase();return n.find(n=>n.toLowerCase()===o)}const o=n=>t(n)?`, on ${t(n)}`:''},976,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KITCHEN_TICKET_RE",{enumerable:!0,get:function(){return t}}),e.kitchenTicketFromHash=function(n){const c=(n||'').match(/[#&]cckitchen=([A-Za-z0-9_-]{24,64})(?:&|$)/);return c&&t.test(c[1])?c[1]:null},e.chefKitchenUrl=function(t,n){const c=t.includes('?')?t.replace('?','?from=display&'):t.replace(/(#|$)/,'?from=display$1'),[s,o]=c.split('#'),u=(o||'').split('&').filter(t=>t&&!t.startsWith('cckitchen=')).join('&');return`${s}#cckitchen=${n}${u?`&${u}`:''}`},e.markKitchenViaDisplay=function(t,s){try{if('undefined'==typeof sessionStorage)return;t?(sessionStorage.setItem(n,'1'),s&&sessionStorage.setItem('cc-kitchen-actor',String(s).slice(0,60))):(sessionStorage.removeItem(n),sessionStorage.removeItem('cc-kitchen-actor'),sessionStorage.removeItem(c))}catch{}},e.isKitchenViaDisplay=function(){try{return'undefined'!=typeof sessionStorage&&'1'===sessionStorage.getItem(n)}catch{return!1}},e.kitchenActor=function(){try{return`${('undefined'!=typeof sessionStorage?sessionStorage.getItem('cc-kitchen-actor'):null)||'Head Chef'} via Display`.slice(0,80)}catch{return'Head Chef via Display'}},e.kitchenSessionStoreName=function(){return c};const t=/^[A-Za-z0-9_-]{24,64}$/,n='cc-kitchen-via-display',c='covercharge-kitchen-session-v1'},977,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSliders",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"notify",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"dismissNotice",{enumerable:!0,get:function(){return c}});var t=r(d[0]);let u=0;const s=t=>'urgent'===t.tone?0:'warn'===t.tone?1:2,n=(0,t.create)()((t,n)=>({queue:[],push:n=>t(t=>{const o=t.queue.find(t=>t.id===n.id),c=o?t.queue.map(t=>t.id===n.id?{...n,seq:o.seq}:t):[...t.queue,{...n,seq:++u}];return{queue:(f=c,[...f].sort((t,u)=>s(t)-s(u)||(t.seq??0)-(u.seq??0))).slice(0,40)};var f}),dismiss:u=>{const s=n().queue.find(t=>t.id===u);if(s){t(t=>({queue:t.queue.filter(t=>t.id!==u)}));try{s.onClose?.()}catch{}}},dismissWhere:t=>{for(const u of n().queue.filter(t))n().dismiss(u.id)}})),o=t=>n.getState().push(t),c=t=>n.getState().dismiss(t)},978,[993]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"pinProblem",{enumerable:!0,get:function(){return r.pinProblem}}),Object.defineProperty(_e,"ERROR_TEXT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"errorText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useDisplayTiles",{enumerable:!0,get:function(){return u}}),_e.refreshTiles=async function(){const e=await l('display_staff_list',{});Array.isArray(e)&&u.setState({tiles:e,at:Date.now()});const t=await l('display_pin_lengths',{});t&&'object'==typeof t&&!('ok'in t)&&u.setState({lens:t})},_e.refreshManagers=async function(){const e=await l('display_managers',{});Array.isArray(e)&&u.setState({managers:e})},Object.defineProperty(_e,"displayClock",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"displayChangePin",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"displayAddTemp",{enumerable:!0,get:function(){return y}}),_e.setStaffPin=async function(e,n,a=4){const o=_();if(!o)return{ok:!1,error:'Sign in to the venue to set PINs (they are kept on the server only).'};const s=(0,r.pinProblem)(n,a);if(s)return{ok:!1,error:s};try{const{error:r}=await(0,t.getSupabase)().rpc('set_staff_pin',{p_venue:o,p_staff_ref:e,p_pin:n});return r?{ok:!1,error:r.message.replace(/^.*?:\s*(?=The PIN|Pick a PIN)/,'')}:{ok:!0}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},_e.addTempStaff=async function(e){const n=_();if(!n)return{ok:!1,error:'Sign in to the venue to add temp staff (the code is made and kept on the server).'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc('add_temp_staff',{p_venue:n,p_name:e.name,p_dept:e.dept??null,p_rate:e.rate??null,p_until:e.until||null});return a?{ok:!1,error:a.message}:{ok:!0,...r}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},Object.defineProperty(_e,"usePinStatus",{enumerable:!0,get:function(){return k}}),_e.refreshPinStatus=async function(){const e=_();if(!e)return;try{const{data:n}=await(0,t.getSupabase)().rpc('staff_pin_status',{p_venue:e});Array.isArray(n)&&k.setState(Object.fromEntries(n.map(e=>[e.staff_ref,{hasPin:e.has_pin,locked:e.locked}])),!0)}catch{}},_e.localTiles=function(e,t){return e.filter(e=>e.active&&e.displayClock&&!(e.temp&&e.tempUntil&&e.tempUntil({ref:e.id,name:e.name,nickname:e.nickname,dept:e.dept,temp:!!e.temp})).sort((e,t)=>Number(!!e.temp)-Number(!!t.temp)||e.name.localeCompare(t.name))},Object.defineProperty(_e,"displayBlockChange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"displayBlockEdit",{enumerable:!0,get:function(){return h}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]),a=_r(d[4]),o=_r(d[5]);const s={wrong:'That PIN is not right. Try again.',locked:'Too many wrong tries. Locked for 15 minutes, or ask a manager to reset your PIN.',nopin:'No PIN set yet. Ask a manager to set one in Staff & roles.',notallowed:'This person can\u2019t clock in at the Display. A manager can turn it on in Staff & roles.',already:'Already clocked in.',notin:'Not clocked in yet.',onbreak:'Already on a break.',notmanager:'Only an owner or manager can add temp staff.',format:'The new PIN must be 4 to 8 digits (6 or more for managers and owners).',weak:'Pick a PIN that is harder to guess (not all the same digit or a run like 1234).',devicelocked:'Too many wrong PINs on this Display. Wait 15 minutes, then try again.',unpaired:'Pair this Display first (Settings \u203a Devices on the Managers app), then try again.',offline:'No connection. Try again in a moment.'},c=(e,t)=>'format'===e&&t?.min?`The new PIN must be ${t.min} to 8 digits.`:s[e??'']??(e||'Something went wrong. Try again.'),p=()=>'device'===n.useSync.getState().kind&&!!n.useSync.getState().venueId;async function l(e,n){if(a.PITCH)return(0,o.pitchClock)(e,n);if(!p())return{ok:!1,error:'unpaired'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc(e,n);return a?{ok:!1,error:/paired Display/.test(a.message)?'unpaired':a.message}:r}catch{return{ok:!1,error:'offline'}}}const u=(0,e.create)(()=>({tiles:null,managers:[],lens:{}}));const f=(e,t,n,r={})=>l('display_clock',{p_staff_ref:e,p_pin:t,p_action:n,p_break_mins:r.breakMins??null,p_off_rota:!!r.offRota}),m=(e,t,n)=>l('display_change_pin',{p_staff_ref:e,p_old:t,p_new:n}),y=(e,t,n)=>l('display_add_temp',{p_manager_ref:e,p_manager_pin:t,p_name:n.name,p_dept:n.dept??null,p_rate:n.rate??null,p_until:n.until||null}),_=()=>'staff'===n.useSync.getState().kind?n.useSync.getState().venueId:void 0;const k=(0,e.create)(()=>({}));const b=(e,t,n,r,a)=>l('display_block_change',{p_manager_ref:e,p_manager_pin:t,p_block_id:n,p_action:r,p_doc:a}),h=(e,t,n,r)=>l('display_block_edit',{p_block_id:e,p_action:t,p_doc:n,p_by:r})},979,[993,871,824,1536,2,1537]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOutLinks",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isAutoLink",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"autoSync",{enumerable:!0,get:function(){return v}}),_e.itemsFor=b,_e.dishUsesFor=p,_e.countsFor=O,_e.reasonFor=function(e,t,n){const s=n??p(e).find(e=>e.id===t)?.uses??[],r=O(e),i=c.useStore.getState().menu.find(e=>e.id===t)?.name??'';return(0,u.dishReason)(i,(0,u.shortOf)(s,r),r,b(e))},_e.runAutoSoldOut=y,_e.startAutoSoldOut=function(){if(w)return w;let e=null;const t=()=>{e||(e=setTimeout(()=>{e=null,y()},400))},n=[d.useShellStore.subscribe((e,n)=>{e.events===n.events&&e.server===n.server&&e.items===n.items||t()}),h.subscribe(t),S.useCardStore.subscribe((e,n)=>{e.cards!==n.cards&&t()}),c.useStore.subscribe((e,n)=>{e.menu===n.menu&&e.restaurants===n.restaurants||t()}),f.useSoldOut.subscribe((e,n)=>{e.entries!==n.entries&&t()})],s=setInterval(t,6e4);return t(),w=()=>{n.forEach(e=>e()),clearInterval(s),e&&clearTimeout(e),w=null},w},_e.useAutoSoldOutView=function(e){const t=(0,c.useStore)(e=>e.menu),n=h(e=>e.links),s=(0,S.useCardStore)(e=>e.cards),r=(0,d.useShellStore)(t=>t.items[e]);(0,d.useShellStore)(e=>e.events),(0,d.useShellStore)(t=>t.server[e]);const i=(r??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active})),o=p(e,t,n,s,i),l=O(e);return{dishes:o,counts:l,items:i,reason:e=>{const t=o.find(t=>t.id===e);return t?(0,u.dishReason)(t.name,(0,u.shortOf)(t.uses,l),l,i):''},links:n}};var e,t=_r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[1]),r=_r(_d[2]),u=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),S=_r(_d[9]),f=_r(_d[10]);const m=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},h=(0,s.create)()((0,r.persist)(e=>({links:[],setLink:(t,n,s,r)=>e(e=>{const u=e.links.filter(e=>!(e.rid===t&&e.itemId===n));return{links:[...u,{rid:t,itemId:n,uses:s?s.filter(e=>e.qty>0).slice(0,10):[],at:m().toISOString(),by:r.slice(0,80),...s?{}:{auto:!0}}]}})}),{name:'covercharge-soldout-links-v1',version:1,storage:(0,r.createJSONStorage)(()=>n.default)})),k=e=>!!e&&!0===e.auto,v={soldOutRead:new Set,linksRead:new Set};function b(e){return(d.useShellStore.getState().items[e]??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active}))}function p(e,t=c.useStore.getState().menu,n=h.getState().links,s=S.useCardStore.getState().cards,r=b(e)){const i=[];for(const o of t){if(o.restaurantId!==e||o.hidden)continue;const t=s.find(t=>t.restaurantId===e&&t.menuItemId===o.id),l=n.find(t=>t.rid===e&&t.itemId===o.id),c=(0,u.inferUses)(o,t,r),d=k(l)?c:(0,u.usesFor)(o,l,t,r);i.push({id:o.id,name:o.name,uses:d.uses,source:d.source,guess:c.uses})}return i}function O(e){return(0,d.venueCounts)(d.useShellStore.getState(),e)}function I(e){const t={};for(const n of d.useShellStore.getState().events)n.rid===e&&(!t[n.kind]||n.at>t[n.kind])&&(t[n.kind]=n.at);return t}function y(e=m()){const t=c.useStore.getState();let n=0;for(const s of t.restaurants){const t=s.id;if((0,o.liveData)()&&(!d.useShellStore.getState().server[t]||!v.soldOutRead.has(t)||!v.linksRead.has(t)))continue;const r=(0,i.soldOutSettingsOf)(s.settings?.soldOut).auto,l=p(t),c=(0,u.planAuto)({rid:t,enabled:r,dishes:l,counts:O(t),entries:f.useSoldOut.getState().entries,lastChange:I(t),now:e});if(!c.mark.length&&!c.clear.length)continue;const S=e.toISOString();f.useSoldOut.setState(e=>{const n=new Set(c.clear),s=new Map(c.mark.map(e=>[e.itemId,e.name])),r=e.entries.filter(e=>!(e.rid===t&&s.has(e.itemId))).map(e=>e.rid===t&&n.has(e.itemId)?{...e,on:!1,at:S,by:'Count back up',kept:!1,clearAfter:void 0}:e);return{entries:[...r,...c.mark.map(e=>({rid:t,itemId:e.itemId,name:e.name.slice(0,120),on:!0,at:S,by:'Live count',auto:!0,kept:!1}))]}}),n+=c.mark.length+c.clear.length}return n}let w=null;l.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchCounts=e=>{const t=c.useStore.getState().restaurants[0]?.id;if(!t)return;const n=O(t),s=m().toISOString(),r=Object.entries(e).filter(([e,t])=>(n[e]??0)!==t).map(([e,r],u)=>({id:`pitch-count-${Date.now()}-${u}`,rid:t,kind:e,delta:r-(n[e]??0),reason:'count',by:'Chef',app:'chef',at:s}));return r.length&&d.useShellStore.setState(e=>({events:[...e.events,...r]})),y()})},980,[1188,993,1189,981,982,1216,2,878,1084,1166,940]); +__d(function(_g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.parseQty=i,_e.inferUses=u,_e.usesFor=function(e,t,n,o){const s=new Set(o.filter(e=>!1!==e.active).map(e=>e.key));return t?{uses:t.uses.filter(e=>s.has(e.key)&&e.qty>0),source:t.uses.length?'link':'none'}:u(e,n,o)},_e.shortOf=c,_e.shortReason=f,_e.dishReason=function(e,t,n,o){if(!t.length)return'';const i=e.replace(/\([^)]*\)/g,'').trim(),a=e=>{const t=o.find(t=>t.key===e);return!!t&&new RegExp(`\\b(${s(t)})$`,'i').test(i)},l=t.filter(e=>!a(e.key));return l.length?f(l,n,o):t.some(e=>(n[e.key]??0)>0)?'not enough left':'none left'},Object.defineProperty(_e,"withReason",{enumerable:!0,get:function(){return h}}),_e.usesText=function(e,t){return e.length?e.map(e=>{const n=t.find(t=>t.key===e.key),o=(n?.name??e.key).toLowerCase(),s=(n?.plural??`${o}s`).toLowerCase();return`${.5===e.qty?'\xbd':Number.isInteger(e.qty)?String(e.qty):`${Math.floor(e.qty)}\xbd`} ${e.qty>1?s:o}`}).join(', '):'Not linked to the counts'},_e.planAuto=function(e){const{rid:t,enabled:n,dishes:o,counts:s,entries:i,lastChange:a,now:l}=e,u={mark:[],clear:[]},f=new Map(i.filter(e=>e.rid===t).map(e=>[e.itemId,e])),h=l.getTime(),m=e=>e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>h),d=new Set;for(const e of o){d.add(e.id);const t=f.get(e.id),o=n?c(e.uses,s):[];if(o.length){if(t&&m(t))continue;if(t&&t.kept){const e=o.map(e=>a[e.key]??'').sort().pop()??'';if(!e||e<=t.at)continue}u.mark.push({itemId:e.id,name:e.name})}else t&&t.auto&&m(t)&&u.clear.push(e.id)}for(const e of f.values())e.auto&&m(e)&&!d.has(e.itemId)&&u.clear.push(e.itemId);return u};const e='meat|bisque|stock|cakes?|claws?|sauce|butter|oil|paste|salad|mayo|mayonnaise|thermidor|tails?|bon|croquettes?|p\xe2t\xe9|pate|rolls?|soup|linguine|ravioli',t=/^(g|kg|gram|grams|ml|l|litre|litres|oz|lb|lbs|cl)$/i,n={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,half:.5,'\xbd':.5},o=e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&'),s=e=>{const t=new Set([e.name,e.plural].map(e=>e.trim().toLowerCase()).filter(Boolean));for(const e of[...t])e.endsWith('s')?t.add(e.slice(0,-1)):t.add(e+'s');return[...t].sort((e,t)=>t.length-e.length).map(o).join('|')};function i(e){const t=(e||'').trim().toLowerCase();if(!t)return 1;if(/^\xbd$|^half\b/.test(t))return.5;const o=t.match(/^(\d+(?:\.\d+)?)\s*(\xbd)?/);if(o)return Number(o[1])+(o[2]?.5:0);const s=t.split(/\s+/)[0];return n[s]??1}const a=(e,t)=>'half'===e.unit?Math.max(.5,Math.round(2*t)/2):Math.max(1,Math.round(t)),l=e=>(e.optionGroups??[]).some(e=>e.choices.some(e=>/\bhalf\b/i.test(e.label)));function u(n,o,u){const c=u.filter(e=>!1!==e.active&&'kg'!==e.unit),f=(e,t)=>({source:e,uses:t.map(t=>{const o=c.find(e=>e.key===t.key),s='half'===o.unit&&l(n)&&'description'!==e?.5:t.qty;return{key:t.key,qty:a(o,s)}})});if(o){const e=[];for(const n of c){const a=new RegExp(`\\b(${s(n)})\\b`,'i'),l=o.ingredients.find(e=>a.test(e.name)&&!t.test((e.unit||'').trim())&&!/\b(meat|stock|bisque|oil|butter|paste)\b/i.test(e.name));l&&e.push({key:n.key,qty:i(`${l.qty} ${l.unit}`)})}if(e.length)return f('card',e)}const h=n.description??'';{const t=[];for(const n of c){const o=new RegExp(`\\b(half an?|a|an|one|two|three|four|five|six|\\d+(?:\\.\\d+)?|\xbd)\\s+(?:(?:whole|fresh|live|dressed|local)\\s+)?(?:[A-Za-z'\u2019-]+\\s+){0,2}?(${s(n)})\\b(?!\\s+(?:${e}))`,'i'),a=h.match(o);a&&t.push({key:n.key,qty:i(a[1])})}if(t.length)return f('description',t)}{const e=n.name.replace(/\([^)]*\)/g,'').trim(),t=[];for(const n of c)new RegExp(`\\b(${s(n)})$`,'i').test(e)&&t.push({key:n.key,qty:1});if(t.length)return f('name',t)}return{uses:[],source:'none'}}function c(e,t){return e.filter(e=>(t[e.key]??0)(n.find(t=>t.key===e)?.name??e).toLowerCase(),s=e.filter(e=>(t[e.key]??0)<=0).map(e=>o(e.key)),i=e.filter(e=>(t[e.key]??0)>0).map(e=>o(e.key)),a=e=>e.length<=2?e.join(' or '):`${e.slice(0,-1).join(', ')} or ${e[e.length-1]}`;return[s.length?`no ${a(s)}`:'',i.length?`not enough ${a(i)}`:''].filter(Boolean).join(', ')}const h=(e,t)=>t?`${e.replace(/\s*\([^)]*\)\s*$/,'').trim()||e} (${t})`:e},981,[]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SOLD_OUT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOLD_OUT_CLEAR_LABEL",{enumerable:!0,get:function(){return t}}),_e.soldOutSettingsOf=function(t){const n='morning'===t?.clear||'manual'===t?.clear||'close'===t?.clear?t.clear:e.clear,o=/^([01]\d|2[0-3]):[0-5]\d$/.test(t?.morningAt??'')?t.morningAt:e.morningAt;return{clear:n,morningAt:o,auto:!1!==t?.auto}},_e.clearAfterFor=function(e,t,o){if('manual'===t.clear)return;const c=(()=>{const o=n(e,t.morningAt);return ee.getTime()?o:c},_e.activeSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>o)).sort((e,t)=>t.at.localeCompare(e.at)||e.name.localeCompare(t.name))},_e.expiredSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&!!e.clearAfter&&new Date(e.clearAfter).getTime()<=o)},_e.stripText=o,_e.stripNeedsTicker=function(e,t,n){return o(e).length*n*.56>Math.max(0,t-150)},_e.soldOutCount=function(e){return 1===e?'1 dish sold out':`${e} dishes sold out`};const e={clear:'close',morningAt:'05:00',auto:!0},t={close:'When the kitchen closes',morning:'Next morning',manual:'Only when someone taps Back on'};const n=(e,t,n=0)=>{const[o,c]=t.split(':').map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+n,o,c,0,0)};function o(e){return e.join(' \xb7 ')}},982,[]); +__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(0,n.sha256HexSync)(`cc-wake:${i}:${t}`),o={pinHash:a(t,i),pinSalt:i,pinLen:4,pinDefault:!0};function u(){const n=globalThis.crypto,t=new Uint8Array(12);if(n?.getRandomValues)n.getRandomValues(t);else for(let n=0;nn.toString(16).padStart(2,'0')).join('')}const l=(n,t)=>a(t,n.pinSalt)===n.pinHash},984,[1276]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/(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])},986,[819]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n.default}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=(t=e)&&t.__esModule?t:{default:t}},987,[1318]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,s,t){const l=(0,p.tableKey)(t),o=(0,g.tablesOf)(s.table);await h.repo.bookings.update(s.id,(0,y.tablePatch)(l||null)),'seated'===s.status&&s.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(s=>g.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0})),l&&(0,j.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:j=90,onClose:$,onSaved:w,onPickOnPlan:T,canClear:L=!0}){const S=(0,g.usePlan)(e),P=(0,h.useBookings)(e),[W,z]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),D=(0,l.useMemo)(()=>(0,p.pickGroups)(S),[S]),I=P.filter(e=>e.date===y.date),B=(0,p.seatsOf)(S,W),R=(0,p.seatLine)(B.total,y.partySize),O=(0,p.pickClashes)(y,W,I,j),M=e=>(0,p.pickClashes)(y,[e],I,j)[0]?.with,N=(0,p.tableKey)(W)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,m.useBlocks)(e=>e.blocks),A=(0,m.blockAt)(_,e,y.date,y.time),[F,G]=(0,l.useState)(null),Y=e=>{G(null),z(s=>(0,p.toggleTable)(s,e))},[K]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{K&&(0,c.announce)(`Tables can't be saved: ${K}.`)},[K]);const[E,H]=(0,l.useState)(!1),U=async s=>{(0,o.guardBookingChange)(w,{b:y,tables:s})?(H(!0),$(),await(0,o.saveTablesReported)(e,y,s,f,(0,p.seatsOf)(S,s).total,e=>w?.(e))):$()},V=(0,v.jsxs)(u.default,{style:{gap:8},children:[(0,v.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(W)} picked. ${R.text}.`,children:[(0,v.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(W)}),(0,v.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:R.text})]}),A?(0,v.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,v.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,O.length?(0,v.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(O)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,v.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(O)," You can still save."]})}):null,F?(0,v.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:F,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,v.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:F}),(0,v.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,v.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(W)} for ${f}, ${y.partySize} people`,disabled:E,onPress:()=>{U(W)},style:[C,{flexGrow:1}]}),(0,v.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>G(null),style:C})]})]}):null,(0,v.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[F?null:(0,v.jsx)(x.Button,{testID:"table-pick-save",label:E?'Saving\u2026':O.length?'Save anyway':'Save tables',disabled:!N||!W.length||E,accessibilityLabel:`${O.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(W)} for ${f}. ${R.text}.${O.length?` ${(0,p.clashWords)(O)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(w,{b:y,tables:W}))return void $();const e=(0,p.overCapacityAsk)(W,B.total,y.partySize);!e||F?U(W):G(e)},style:[C,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&L?(0,v.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:E,onPress:()=>U([]),style:C}):null,(0,v.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:C})]})]});return(0,v.jsxs)(x.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:V,children:[(0,v.jsx)(s.TableNumberWarning,{plan:S}),K?(0,v.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${K}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,v.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${K}.`})}):null,(0,v.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),T?(0,v.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>T(W),style:C}):null,D.map(e=>(0,v.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,v.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,v.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const s=W.includes(e.name),l=M(e.name);return(0,v.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:s},'aria-checked':s,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,s,l),onPress:()=>Y(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?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!s?'dashed':'solid',backgroundColor:s?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,v.jsx)(x.T,{size:18,weight:"semibold",colour:s?k.colours.onGold:k.colours.text,children:(0,t.tableNumbers)(e.name)}),(0,v.jsxs)(x.T,{size:14,colour:s?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),D.length?null:(0,v.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var s=r(d[0]),t=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),m=r(d[16]),v=r(d[17]);const C={minHeight:56}},988,[933,812,31,957,824,1420,264,128,823,829,1419,958,825,822,818,950,828,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})]})]})}},989,[31,128,823,829,1419,967,958,825,865,861,807,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"BOOKING_VIEW_ONLY",{enumerable:!0,get:function(){return n}}),e.isKitchenPorter=o,e.canChangeBookings=function(n){return!n||(!('owner'!==n.role&&'manager'!==n.role&&!n.ownerAccess&&!n.managerAccess)||('boolean'==typeof n.bookingWrite?n.bookingWrite:!o(n)))},Object.defineProperty(e,"BOOKING_CHANGE_ACTIONS",{enumerable:!0,get:function(){return t}});const n='View only. Ask a manager to change bookings.';function o(n){return!(!n||'staff'!==n.role)&&/porter|KP/i.test(n.job??'')}const t=new Set(['add_walkin','seat_booking','finish_booking','no_show','cancel_booking','move_booking','change_booking','decide_booking','block_table','waitlist_seat'])},990,[]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenBar=p,_e.NeedsPills=k,_e.BookingNeeds=x,Object.defineProperty(_e,"needsIcons",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"confirmHolds",{enumerable:!0,get:function(){return S}}),_e.serveHolds=y,_e.postNewBookingToKitchen=function(e,t){if(!t||'system'===t)return;const s=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),l=[],r=`${e.name}, ${(0,c.niceDate)((0,c.parseYmd)(e.date)).slice(0,3)} ${e.time}${e.table?`, table ${e.table}`:''}`;if((e.holds??[]).filter(e=>e.qty>0).length){const t=I(e.restaurantId);l.push(`${(0,u.holdsText)(e,(0,u.reservablesOf)(s),t)} reserved: ${r}. Tap Platter OK in the Head Chef app.`)}(0,u.hasAllergens)(e)&&l.push(`\u26a0\ufe0f Allergens: ${(0,u.allergenText)(e)} \u2014 ${r}. Please sign \u2018Allergens seen\u2019.`);if(!l.length)return;a.useOwner.getState().chatSend({ch:'kitchen',from:t,text:l.join('\n'),at:(new Date).toISOString()})},_e.useKitchenTodo=D,_e.KitchenSignoffs=function({rid:t,today:s,by:a,app:f,canConfirm:p=!0,showAll:k}){const j=D(t,s),I=(0,o.useBookings)(t),T=(0,o.useRestaurant)(t),O=(0,n.useStockItems)(t),$=(0,u.reservablesOf)(T),A=I.filter(e=>e.date===s&&!['cancelled','noshow'].includes(e.status)&&(e.holds??[]).some(e=>e.qty>0)),C=k?[...j,...A.filter(e=>!j.includes(e))]:j;return C.length?(0,b.jsxs)(l.default,{testID:"kitchen-signoffs",style:{gap:10,padding:16,borderRadius:16,borderWidth:1.5,borderColor:j.length?h.colours.amber:h.colours.hairline,backgroundColor:h.colours.surface},children:[(0,b.jsx)(r.T,{size:12,weight:"semibold",colour:j.length?h.colours.amber:h.colours.goldMuted,style:{letterSpacing:1.6},children:j.length?`KITCHEN SIGN-OFF NEEDED (${j.length})`:'RESERVED TODAY'}),C.map(t=>(0,b.jsxs)(l.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:h.colours.hairline},testID:`signoff-${t.ref}`,children:[(0,b.jsxs)(r.T,{weight:"semibold",children:[t.name," \xb7 ",t.partySize," Covers \xb7 ",t.date===s?'Today':(0,c.niceDate)((0,c.parseYmd)(t.date))," ",t.time,t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:'']}),(0,b.jsx)(x,{b:t}),p?(0,b.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,u.needsAllergenSeen)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"danger",label:"Allergens seen",testID:`allergens-seen-${t.ref}`,onPress:()=>o.useStore.getState().ackBookingAllergy(t.id,a)}):null,(0,u.needsHoldOk)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"success",label:/platter/i.test((0,u.holdsText)(t,$,O))?'Platter OK':'Reservation OK',testID:`platter-ok-${t.ref}`,onPress:()=>S(t.id,a)}):null,t.date===s&&t.holdOk&&(t.holds??[]).some(e=>!e.served)&&['seated','confirmed'].includes(t.status)?(0,b.jsx)(r.Button,{small:!0,kind:"secondary",label:"Served",testID:`served-${t.ref}`,onPress:()=>y(t,a,f)}):null]}):(0,b.jsx)(r.Muted,{children:"The kitchen signs these off."})]},t.id))]}):null},_e.PlattersBooked=function({rid:e,date:t,label:s}){const a=(0,o.useBookings)(e),c=(0,o.useRestaurant)(e),f=(0,n.useStockItems)(e),p=(0,u.heldSummary)(a,t,(0,u.reservablesOf)(c)),k=Object.entries(p.stock).filter(([,e])=>e>0).map(([e,t])=>`${t} ${(f.find(t=>t.key===e)?.name??e).toLowerCase()}`);return p.platters||k.length?(0,b.jsx)(l.default,{testID:"platters-booked",children:(0,b.jsxs)(r.T,{weight:"semibold",colour:h.colours.goldLight,children:[s??'Platters booked',": ",p.platters,k.length?` (${k.join(', ')})`:'']})}):null};var e=_r(d[0]);_r(d[1]);var t,s=_r(d[2]),l=(t=s)&&t.__esModule?t:{default:t},r=_r(d[3]),o=_r(d[4]),n=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);const f=({label:e,bg:t,fg:s,border:o,testID:n})=>(0,b.jsx)(l.default,{testID:n,style:{backgroundColor:t,borderColor:o,borderWidth:1,borderRadius:999,paddingHorizontal:9,paddingVertical:2},children:(0,b.jsx)(r.T,{size:13,weight:"semibold",colour:s,children:e})});function p({b:e,big:t}){return(0,u.hasAllergens)(e)?(0,b.jsxs)(l.default,{testID:`allergen-bar-${e.ref}`,style:{backgroundColor:h.colours.redSolid,borderRadius:10,paddingHorizontal:10,paddingVertical:t?8:5,gap:2},children:[(0,b.jsxs)(r.T,{size:t?16:13,weight:"bold",colour:"#FFFFFF",children:["\u26a0\ufe0f ALLERGENS: ",(0,u.allergenText)(e)]}),e.allergyAck?(0,b.jsxs)(r.T,{size:12,colour:"#FFE3DF",children:["Seen by kitchen: ",e.allergyAck.by]}):(0,b.jsx)(r.T,{size:12,colour:"#FFE3DF",children:"Kitchen hasn\u2019t signed \u2018Allergens seen\u2019 yet"})]}):null}function k({b:t,r:s}){const l=(0,n.useStockItems)(t.restaurantId),o=(0,u.reservablesOf)(s),a=(t.holds??[]).some(e=>e.qty>0),c=[];return t.drinksOnly&&c.push((0,b.jsx)(f,{testID:"pill-drinks",label:"\ud83c\udf77 Drinks only (after last food orders)",bg:h.colours.surface2,fg:h.colours.goldLight,border:h.colours.accentBorder},"x")),(0,u.hasAccess)(t)&&c.push((0,b.jsx)(f,{testID:"pill-access",label:`\u267f ${(0,u.accessText)(t)}`,bg:h.colours.blueBg,fg:"#E2C489",border:h.colours.blue},"a")),(0,u.dogCount)(t)&&c.push((0,b.jsx)(f,{testID:"pill-dog",label:"\ud83d\udc15 "+((0,u.dogCount)(t)>1?`${(0,u.dogCount)(t)} dogs`:'Dog'),bg:h.colours.surface2,fg:h.colours.text,border:h.colours.hairline},"d")),(0,u.dietText)(t)&&c.push((0,b.jsx)(f,{testID:"pill-veg",label:`\u24cb ${(0,u.dietText)(t)}`,bg:"#2A2216",fg:"#E2C489",border:"#CFA45F"},"v")),a&&c.push(t.holdOk?(0,b.jsx)(f,{testID:"pill-platter",label:`\u2713 ${(0,u.holdsText)(t,o,l)} \xb7 confirmed`,bg:h.colours.okBg,fg:"#E2C489",border:h.colours.ok},"h"):(0,b.jsx)(f,{testID:"pill-platter",label:`\ud83e\udd9e ${(0,u.holdsText)(t,o,l)} \xb7 awaiting kitchen`,bg:h.colours.amberBg,fg:"#FFE2A8",border:h.colours.amber},"h")),t.tableReq?.length&&c.push((0,b.jsx)(f,{testID:"pill-request",label:`Requested: ${t.tableReq.map(t=>`${(0,e.tableNumbers)(t)}`).join(' or ')}`,bg:h.colours.goldTint,fg:h.colours.goldLight,border:h.colours.accentBorder},"t")),c.length?(0,b.jsx)(r.Row,{wrap:!0,gap:6,children:c}):null}function x({b:e,big:t}){const s=(0,o.useRestaurant)(e.restaurantId);return(0,b.jsxs)(l.default,{style:{gap:6},children:[(0,b.jsx)(p,{b:e,big:t}),(0,b.jsx)(k,{b:e,r:s})]})}const j=e=>[(0,u.hasAllergens)(e)?'\u26a0\ufe0f':'',(0,u.hasAccess)(e)?'\u267f':'',(0,u.dogCount)(e)?'\ud83d\udc15':'',(0,u.dietText)(e)?'\u24cb':'',(e.holds??[]).some(e=>e.qty>0)?e.holdOk?'\ud83e\udd9e\u2713':'\ud83e\udd9e':''].filter(Boolean).join(' '),S=(e,t)=>o.useStore.getState().updateBooking(e,{holdOk:{by:t,at:(new Date).toISOString()}});function y(e,t,s){const l=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),r=(0,u.stockNeed)(e,(0,u.reservablesOf)(l));for(const[l,o]of Object.entries(r))o>0&&n.shellfish.append({rid:e.restaurantId,kind:l,delta:-o,reason:'sold',by:t,app:s});const a=(new Date).toISOString();o.useStore.getState().updateBooking(e.id,{holds:(e.holds??[]).map(e=>e.served?e:{...e,served:{by:t,at:a}})})}const I=e=>n.useShellStore.getState().items[e]??[];function D(e,t){return(0,o.useBookings)(e).filter(e=>e.date>=t&&!e.walkIn&&((0,u.needsAllergenSeen)(e)||(0,u.needsHoldOk)(e))).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time))}},991,[812,31,128,818,823,1084,861,832,822,825,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},992,[31,128,14,825,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})},993,[1203,1204]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function i(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_AVATARS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"AVATAR_BGS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"AVATAR_RINGS",{enumerable:!0,get:function(){return j}}),_e.specFor=E,_e.AvatarArt=$,_e.AvatarLook=v,_e.useStaffMember=M,_e.StaffAvatar=function({id:i,name:t,size:s=34,ring:c=!0}){const f=M(i,t),h=f?.id??i,u=(0,n.useAvatars)(i=>h?i.photos[h]:void 0),F=(0,o.useSetup)(i=>h?i.looks[h]:void 0),j=`${(f?.name??t??'Team member').replace(' (example)','')}'s avatar`;return(0,y.jsx)(r.default,{testID:h?`avatar-${h}`:'avatar',accessibilityLabel:j,accessibilityRole:"image",style:{width:s,height:s,borderRadius:s/2,overflow:'hidden',borderWidth:c?Math.max(1,s/22):0,borderColor:x.colours.gold,backgroundColor:(0,e.soutersSurface)('#111')},children:u?(0,y.jsx)(l.default,{source:{uri:u.dataUrl},style:{width:'100%',height:'100%'},accessibilityIgnoresInvertColors:!0}):(0,y.jsx)(v,{look:F,id:h,name:f?.name??t,size:s-(c?2*Math.max(1,s/22):0)})})};var e=_r(d[0]);_r(d[1]);var l=i(_r(d[2])),r=i(_r(d[3])),t=_r(d[4]),s=i(t),c=_r(d[5]),n=_r(d[6]),o=_r(d[7]),x=_r(d[8]),f=_r(d[9]),h=_r(d[10]),y=_r(d[11]);const u=Object.fromEntries(h.ROSTER.map(i=>[i.id,i.avatar])),F=['#2A2520','#B89A72','#D9A441','#4A3F35','#3A3029','#8A6A3B'],j=['#E9B949','#CFA45F'],C=F,p=['#F1C7A5','#E8B48F','#C68B5E','#8D5B3E','#F4D2B8','#A86B45'],A=['#2B1B12','#7A4E2A','#151515','#C2462E','#D9B26A'],b=['quiff','flip','crop','beehive','bob','curls'],k=i=>{let e=7;for(const l of i)e=31*e+l.charCodeAt(0)>>>0;return e};function E(i,e){if(i&&u[i])return u[i];const l=k(i||e||'crew');return{bg:C[l%6],ring:j[l%2],skin:p[(l>>3)%6],hair:A[(l>>6)%5],hairStyle:b[(l>>9)%6],suit:'#F2EAD8',antenna:['ball','star','none'][(l>>12)%3]}}const O=(i,e,l)=>`M${i} ${e-l} Q${i+.18*l} ${e-.18*l} ${i+l} ${e} Q${i+.18*l} ${e+.18*l} ${i} ${e+l} Q${i-.18*l} ${e+.18*l} ${i-l} ${e} Q${i-.18*l} ${e-.18*l} ${i} ${e-l}Z`;function $({spec:i,size:e=40}){const l=i,r='#1B1B1B',c='flip'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M29 50 C26 30 40 22 50 22 C60 22 74 30 71 50 C75 56 79 60 76 65 C72 60 69 58 66 57 L34 57 C31 58 28 60 24 65 C21 60 25 56 29 50Z",fill:l.hair}):'bob'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M30 58 C27 32 40 24 50 24 C60 24 73 32 70 58 L66 60 L34 60Z",fill:l.hair}):'beehive'===l.hairStyle?(0,y.jsxs)(t.G,{children:[(0,y.jsx)(t.Ellipse,{cx:50,cy:25,rx:15,ry:14,fill:l.hair}),(0,y.jsx)(t.Path,{d:"M31 54 C28 34 40 27 50 27 C60 27 72 34 69 54 Z",fill:l.hair})]}):'curls'===l.hairStyle?(0,y.jsx)(t.G,{children:[[34,34],[40,27],[50,24],[60,27],[66,34],[69,43],[31,43]].map(([i,e],r)=>(0,y.jsx)(t.Circle,{cx:i,cy:e,r:7,fill:l.hair},r))}):null,n='quiff'===l.hairStyle?(0,y.jsxs)(t.G,{children:[(0,y.jsx)(t.Path,{d:"M32 42 C31 27 43 23 51 25 C61 22 70 30 68 42 C63 35 57 33 50 34 C43 34 37 37 32 42Z",fill:l.hair}),(0,y.jsx)(t.Path,{d:"M46 26 C51 14 66 14 66 23 C61 20 54 21 50 28Z",fill:l.hair})]}):'crop'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M32 42 C31 28 42 25 50 25 C58 25 69 28 68 42 C64 36 58 33 50 33 C42 33 36 36 32 42Z",fill:l.hair}):'curls'===l.hairStyle?null:(0,y.jsx)(t.Path,{d:"M32 43 C33 30 42 27 50 27 C58 27 67 30 68 43 C61 38 57 33 51 33 C47 37 39 41 32 43Z",fill:l.hair});return(0,y.jsxs)(s.default,{width:e,height:e,viewBox:"0 0 100 100",children:[(0,y.jsx)(t.Circle,{cx:50,cy:50,r:50,fill:l.bg}),(0,y.jsx)(t.Ellipse,{cx:50,cy:50,rx:46,ry:13,fill:"none",stroke:"#FFF4E0",strokeOpacity:.28,strokeWidth:1.6,transform:"rotate(-28 50 50)"}),(0,y.jsx)(t.Path,{d:O(16,24,6),fill:"#FFF4E0",fillOpacity:.85}),(0,y.jsx)(t.Path,{d:O(84,34,4),fill:"#FFF4E0",fillOpacity:.7}),(0,y.jsx)(t.Circle,{cx:80,cy:16,r:1.6,fill:"#FFF4E0",fillOpacity:.8}),(0,y.jsx)(t.Circle,{cx:22,cy:70,r:1.3,fill:"#FFF4E0",fillOpacity:.6}),(0,y.jsx)(t.Path,{d:"M12 100 C14 82 31 74 50 74 C69 74 86 82 88 100 Z",fill:l.suit}),(0,y.jsx)(t.Path,{d:"M36 100 L40 84 L50 90 L60 84 L64 100Z",fill:l.ring,fillOpacity:.35}),(0,y.jsx)(t.Rect,{x:44,y:60,width:12,height:12,fill:l.skin}),c,(0,y.jsx)(t.Ellipse,{cx:50,cy:46,rx:17,ry:18.5,fill:l.skin}),n,l.specs?(0,y.jsxs)(t.G,{stroke:r,strokeWidth:1.6,fill:"#FFFFFF",fillOpacity:.25,children:[(0,y.jsx)(t.Rect,{x:37,y:42,width:11,height:8,rx:4}),(0,y.jsx)(t.Rect,{x:52,y:42,width:11,height:8,rx:4}),(0,y.jsx)(t.Line,{x1:48,y1:45,x2:52,y2:45})]}):null,(0,y.jsx)(t.Ellipse,{cx:42.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,y.jsx)(t.Ellipse,{cx:57.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,y.jsx)(t.Circle,{cx:43.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,y.jsx)(t.Circle,{cx:58.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,y.jsx)(t.Circle,{cx:38,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,y.jsx)(t.Circle,{cx:62,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,y.jsx)(t.Path,{d:"M44.5 55 Q50 60 55.5 55",stroke:r,strokeWidth:1.8,fill:"none",strokeLinecap:"round"}),(0,y.jsx)(t.Ellipse,{cx:50,cy:74,rx:21,ry:5.5,fill:l.ring}),(0,y.jsx)(t.Ellipse,{cx:50,cy:73,rx:16,ry:3,fill:"#000000",fillOpacity:.18}),(0,y.jsx)(t.Circle,{cx:50,cy:88,r:4,fill:l.ring}),(0,y.jsx)(t.Circle,{cx:50,cy:88,r:1.6,fill:l.bg}),(0,y.jsx)(t.Circle,{cx:50,cy:45,r:29,fill:"#FFF4E0",fillOpacity:.1,stroke:"#FFF4E0",strokeOpacity:.85,strokeWidth:2}),(0,y.jsx)(t.Path,{d:"M29 36 A23 23 0 0 1 41 22",stroke:"#FFFFFF",strokeOpacity:.85,strokeWidth:3.2,fill:"none",strokeLinecap:"round"}),(0,y.jsx)(t.Circle,{cx:28.5,cy:42,r:1.5,fill:"#FFFFFF",fillOpacity:.85}),'none'!==l.antenna?(0,y.jsx)(t.Line,{x1:50,y1:16,x2:50,y2:8,stroke:l.ring,strokeWidth:2}):null,'ball'===l.antenna?(0,y.jsx)(t.Circle,{cx:50,cy:6.5,r:3.3,fill:l.ring}):'star'===l.antenna?(0,y.jsx)(t.Path,{d:O(50,6.5,4.5),fill:l.ring}):null]})}function v({look:i,id:e,name:r,size:t=40}){const s=null!=i&&i>=1e3?f.AVATAR_OPTIONS.find(e=>e.look===i):void 0;return s?(0,y.jsx)(l.default,{source:{uri:s.dataUrl},style:{width:t,height:t},accessibilityLabel:s.name}):(0,y.jsx)($,{spec:null!=i?E(`${e??r}#look${i}`):E(e,r),size:t})}const P=i=>(i??'').replace(' (example)','').trim().toLowerCase();function M(i,e){const l=(0,c.useOwner)(i=>i.staff);return i?l.find(e=>e.id===i):e?l.find(i=>P(i.name)===P(e)):void 0}},994,[931,31,197,128,987,861,1223,1094,825,1383,15,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"notifSeedId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"headChefId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"gmId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"seedsFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useNotifs",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),p=r(d[5]),f=r(d[6]),c=r(d[7]);const l=(e,t)=>(0,o.uuidFrom)(`sched-notif:${t}:${e}`),S=()=>p.ROSTER.find(e=>'Head Chef'===e.level)?.id??p.ROSTER.find(e=>'chef'===e.app)?.id??'',b=()=>p.ROSTER.find(e=>'Manager'===e.level)?.id??'',h=e=>'anchorage'===e?(0,u.anchorageSeeds)(t=>l(e,t),S(),b()):[],O=()=>(new Date).toISOString(),v=(0,s.create)()((0,n.persist)((e,t)=>({items:[],snooze:{},ensure:i=>{const s=t().items,n=s.map(e=>(0,c.fixSupplierNames)(e.title)!==e.title||(0,c.fixSupplierNames)(e.message)!==e.message?{...e,title:(0,c.fixSupplierNames)(e.title),message:(0,c.fixSupplierNames)(e.message),updatedAt:O()}:e);n.some((e,t)=>e!==s[t])&&e({items:n});const o=new Set(t().items.map(e=>e.id)),u=h(i).filter(e=>!o.has(e.id)).map(e=>({...e,rid:i}));u.length&&e(e=>({items:[...e.items,...u]}))},add:(t,i)=>{const s=(0,f.uuid)();return e(e=>({items:[...e.items,{...i,id:s,rid:t,updatedAt:O()}]})),s},update:(t,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...i,updatedAt:O()}:e)})),remove:t=>e(e=>({items:e.items.flatMap(e=>e.id!==t?[e]:e.seed?[{...e,removed:!0,paused:!0,updatedAt:O()}]:[])})),resetSeeds:t=>{const i=new Map(h(t).map(e=>[e.id,e]));e(e=>{const s=e.items.map(e=>i.has(e.id)?{...i.get(e.id),rid:t,updatedAt:O()}:e),n=new Set(s.map(e=>e.id));return{items:[...s,...[...i.values()].filter(e=>!n.has(e.id)).map(e=>({...e,rid:t,updatedAt:O()}))]}})},setSnooze:(t,i)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[t,i]])}))}),{name:'covercharge-sched-notifs-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)}))},995,[1188,993,1189,1177,997,15,1097,1290]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"chairsId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rulesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useReminders",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"rulesOf",{enumerable:!0,get:function(){return A}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},n=_r(d[1]),s=_r(d[2]),u=_r(d[3]),o=_r(d[4]),l=_r(d[5]);const c=e=>(0,u.uuidFrom)(`reminder:chairs:${e}`),p=e=>(0,u.uuidFrom)(`break-rules:${e}`),f=()=>(new Date).toISOString(),b=(0,n.create)()((0,s.persist)((e,r)=>({reminders:[],rules:{},done:[],snooze:{},ensure:t=>{const n=r(),s={};n.reminders.some(e=>e.id===c(t))||(s.reminders=[...n.reminders,{...(0,o.defaultChairs)(c(t),t),rid:t}]),n.rules[t]||(s.rules={...n.rules,[t]:{...o.DEFAULT_BREAK_RULES,id:p(t)}}),Object.keys(s).length&&e(s)},add:(r,t)=>{const n=(0,l.uuid)();return e(e=>({reminders:[...e.reminders,{...t,id:n,rid:r,updatedAt:f()}]})),n},update:(r,t)=>e(e=>({reminders:e.reminders.map(e=>e.id===r?{...e,...t,updatedAt:f()}:e)})),remove:r=>e(e=>({reminders:e.reminders.flatMap(e=>e.id!==r?[e]:e.builtIn?[{...e,removed:!0,paused:!0,updatedAt:f()}]:[])})),resetReminder:r=>e(e=>({reminders:e.reminders.map(e=>e.id===r&&'chairs'===e.builtIn?{...(0,o.defaultChairs)(r,e.rid),rid:e.rid,updatedAt:f()}:e)})),setRules:(r,t)=>e(e=>({rules:{...e.rules,[r]:{...(0,o.clampRules)({...e.rules[r]??o.DEFAULT_BREAK_RULES,...t}),id:p(r),updatedAt:f()}}})),resetRules:r=>e(e=>({rules:{...e.rules,[r]:{...o.DEFAULT_BREAK_RULES,id:p(r),updatedAt:f()}}})),markDone:r=>e(e=>({done:[{...r,id:(0,l.uuid)(),at:r.at??f()},...e.done].slice(0,400)})),setSnooze:(r,t)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[r,t]])}))}),{name:'covercharge-reminders-v1',version:1,storage:(0,s.createJSONStorage)(()=>t.default)})),A=e=>(0,o.clampRules)(b.getState().rules[e]??o.DEFAULT_BREAK_RULES)},996,[1188,993,1189,1177,1181,1097]); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_FILTER_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOTIF_DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOTIF_GROUP_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"IN_APP_WINDOW_MINS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PUSH_WINDOW_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KITCHEN_OPEN_DAYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"TITLE_MAX",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MESSAGE_MAX",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validHm",{enumerable:!0,get:function(){return u}}),e.ukNow=p,Object.defineProperty(e,"timeOn",{enumerable:!0,get:function(){return m}}),e.notifDue=function(t,n,r=s){const o=p(n),d=m(t,o.dow);if(t.paused||t.removed||!u(d)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd,at:d};const f=l(d);return{due:o.mins>=f&&o.minst.days.includes(n));if(!r.length)return'No days ticked';const s=new Map;for(const n of r){const r=m(t,n);s.set(r,[...s.get(r)??[],n])}const o=t=>7===t.length?'Every day':t.map(t=>n[t]).join(', ');return[...s.entries()].map(([t,n])=>`${o(n)} at ${t}`).join('; ')+' (UK time)'},e.validateNotif=function(t){if(!t.title.trim())return'Give it a name.';if(t.title.length>f)return`Keep the name under ${f} letters.`;if(!t.message.trim())return'Type the message people will see.';if(t.message.length>c)return`Keep the message under ${c} letters.`;if(!u(t.time))return'Type the time as HH:MM, e.g. 21:00.';for(const n of Object.values(t.dayTimes??{}))if(!u(n))return'Type each day\u2019s time as HH:MM.';return t.days.length?t.recipients.staff.length||t.recipients.groups.length||(t.recipients.onShiftIn??[]).length?t.sendBy.inApp||t.sendBy.push?null:'Choose how to send it.':'Tick at least one person or group.':'Tick at least one day.'},e.anchorageSeeds=function(t,n,r){const s={staff:[n,r].filter(Boolean),groups:[]},o={inApp:!0,push:!0};return[{id:t('mills-milk'),seed:'mills-milk',title:'Mills milk order',message:'Make sure an order before 9:30',days:[...d],time:'21:00',dayTimes:{5:'20:55',0:'20:55'},recipients:s,sendBy:o},{id:t('peronis'),seed:'peronis',title:"Pieroni's order",message:"order Pieroni's by phone",days:[...d],time:'21:05',recipients:s,sendBy:o},{id:t('veg-second'),seed:'veg-second',title:'Veg order',message:'Order veg on the app before 11 PM',days:[...d],time:'21:15',recipients:s,sendBy:o},{id:t('reeds'),seed:'reeds',title:'Reids order',message:'Order Reids',days:[3,4],time:'21:25',recipients:s,sendBy:o},{id:t('spezbona'),seed:'spezbona',title:'Spes Bona order',message:'Do we need anything from Spes Bona for this week? Message Anna if we do for Friday delivery.',days:[3],time:'15:00',recipients:s,sendBy:o},{id:t('olsens'),seed:'olsens',title:"Olsen's order",message:"Place Olsen's order before 3:30 PM. By phone.",days:[2],time:'13:00',recipients:{staff:[r],groups:[]},sendBy:o},{id:t('allsons-list'),seed:'allsons-list',title:'Alsons drinks list',message:'Add anything extra to the Alsons drinks list.',days:[0],time:'20:00',recipients:{staff:['st-finn'],groups:[]},sendBy:o,open:{page:'orderlists',list:'allsons'}},{id:t('tea-towels'),seed:'tea-towels',title:'Tea towels',message:'Put a load of tea towels on to wash.',days:[...d],time:'15:00',recipients:{staff:[],groups:[],onShiftIn:['kp'],fallback:{staff:[],groups:['head_chef']}},sendBy:o},{id:t('rota-upload'),seed:'rota-upload',title:'Rota upload',message:"Make sure you have uploaded next week's rota.",days:[0],time:'20:50',recipients:s,sendBy:o}]};const t={kitchen:'On shift: Kitchen',foh:'On shift: Front of house',bar:'On shift: Bar',kp:'On shift: KPs',chefs:'On shift: Chefs'},n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],r={on_shift:'Everyone on shift',everyone:'Everyone',managers:'Owners and managers',head_chef:'Head Chef',kitchen:'Kitchen team',foh:'Front of house'},s=120,o=15,d=[3,4,5,6,0],f=60,c=160,u=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t),l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));function p(t){const r='number'==typeof t?new Date(t):t,s={};for(const t of new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(r))s[t.type]=t.value;return{dow:n.indexOf(String(s.weekday).slice(0,3)),mins:60*Number(s.hour)+Number(s.minute),ymd:`${s.year}-${s.month}-${s.day}`}}const m=(t,n)=>{const r=t.dayTimes?.[String(n)];return r&&u(r)?r:t.time};const h=t=>t.open?`./?open=${t.open.page}${t.open.list?`&list=${encodeURIComponent(t.open.list)}`:''}`:'./',y=(t,n)=>`${t.id}:${n}`,g=t=>(t??'').toLowerCase(),b=t=>t.level?['owner','manager'].includes(g(t.level)):['owner','manager'].includes(g(t.role)),O=t=>'head_chef'===g(t.role)||'head chef'===g(t.level)||'chef'===g(t.app)||/head chef/.test(g(t.job)),P=t=>'kitchen'===g(t.department)||/chef|kitchen|kp|porter/.test(g(t.job))||O(t),k=t=>/\bkp\b|kitchen porter/.test(g(t.job));function j(t,n){const r=g(n.department);return'kitchen'===t?P(n):'kp'===t?k(n):'chefs'===t?O(n)||/chef|commis/.test(g(n.job)):'bar'===t?'bar'===r||/\bbar/.test(g(n.job)):'front of house'===r||!r&&!P(n)&&!b(n)}function _(t,n,r=[]){const s=v(t.recipients,n,r),o=t.recipients.fallback;return s.length||!o?s:v({staff:o.staff,groups:o.groups},n,r)}const w=(t,n,r=[])=>!!t.recipients.fallback&&!v(t.recipients,n,r).length;function v(t,n,r){const s=t,o=n.filter(t=>!1!==t.active),d=new Set;for(const t of s.staff)o.some(n=>n.id===t)&&d.add(t);for(const t of s.groups)for(const n of o)('everyone'===t||'on_shift'===t&&r.includes(n.id)||'managers'===t&&b(n)||'head_chef'===t&&O(n)||'kitchen'===t&&P(n)||'foh'===t&&!P(n)&&!b(n))&&d.add(n.id);for(const t of s.onShiftIn??[])for(const n of o)r.includes(n.id)&&j(t,n)&&d.add(n.id);return[...d].sort()}const M=t=>({id:t.external_ref,role:t.roles?.key??void 0,job:t.job_title??'',department:t.department??'',active:!1!==t.active}),T=(t,n,r,s=[])=>_(t,r,s).includes(n)},997,[]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shiftNow=k,e.useShiftReminders=function({rid:c,staffId:u,name:h,kitchen:b,onStartBreak:S}){const D=(0,t.useRef)(S);D.current=S;const v=(0,t.useRef)(h);v.current=h;const I=(0,s.useReminders)(t=>`${t.reminders.length}:${t.done.length}:${JSON.stringify(t.rules[c]??{})}:${t.reminders.map(t=>t.updatedAt??'').join()}`),w=(0,r.useOwner)(t=>`${t.attendance.length}:${t.shifts.length}:${t.leave.length}`);(0,t.useEffect)(()=>{s.useReminders.getState().ensure(c);const t=()=>{const t=f(),{att:h,shift:S,on:I}=k(u,t),w=s.useReminders.getState();if(!I||!u)return w.reminders.forEach(t=>(0,a.dismissNotice)(`rem:${t.id}`)),void(0,a.dismissNotice)('break-reminder');const $=(0,s.rulesOf)(c),R=h?.in?new Date(h.in).getTime():void 0,p=!!h?.breaks?.length,y=`break:${h?.id??S?.id??''}`,M=(0,o.breakDue)({now:t,clockIn:R,shiftStart:S?l(S.date,S.start):void 0,shiftEnd:S?l(S.date,S.end):void 0,rotaBreak:void 0!==S?.breakAt?l(S.date,S.breakAt):void 0,hadBreak:p,rules:$},w.snooze[y]??0);if(M){const r=R??(S?l(S.date,S.start):t);(0,a.notify)({id:'break-reminder',tone:3===M.stage?'warn':'normal',icon:'\ud83e\uded6',kicker:'BREAK REMINDER',testID:'break-reminder',timeoutMs:null,title:M.label,body:`${R?'Clocked in':'Shift started'} at ${m(r)}. ${3===M.stage?'':'Over 6 hours needs a 20-minute break.'}`.trim(),actions:[{label:'Start break',testID:'break-reminder-start',onPress:()=>{if(!h)return D.current?.(),void(0,a.notify)({id:'break-clock-first',title:'Clock in first, then tap Start break.',body:'Your break is started from the clock screen.',timeoutMs:6e3});const t=new Date(f()).toISOString();(0,n.clockAction)('break_start',{rid:c,staffId:u,date:t.slice(0,10),at:t}).then(t=>{t.ok||(0,a.notify)({id:'break-blocked',tone:'warn',title:'Break not started',body:t.message,timeoutMs:1e4}),D.current?.()})}},{label:'Later',kind:'ghost',testID:'break-reminder-later',onPress:()=>{s.useReminders.getState().setSnooze(y,f()+6e4*$.snoozeMins),(0,a.dismissNotice)('break-reminder')}}]})}else(0,a.dismissNotice)('break-reminder');const N=r.useOwner.getState().staff.find(t=>t.id===u),O=b??(0,d.inKitchen)(N);for(const n of w.reminders){if(n.rid!==c)continue;const r=`rem:${n.id}`;if(n.removed||!(0,o.audienceMatch)(n.audience,O)){(0,a.dismissNotice)(r);continue}const{due:d,forDate:m}=(0,o.reminderDue)(n,t),l=w.done.find(t=>t.reminderId===n.id&&t.forDate===m),k=`rem:${n.id}:${m}`;!d||l||(w.snooze[k]??0)>t?(0,a.dismissNotice)(r):(0,a.notify)({id:r,icon:'\ud83e\ude91',kicker:'REMINDER',title:n.text,testID:'venue-reminder',timeoutMs:null,body:`For everyone on shift${'all'===n.audience?'':'kitchen'===n.audience?' in the kitchen':' front of house'}. Tap Done once it\u2019s done.`,actions:[{label:'Done',testID:'venue-reminder-done',onPress:()=>s.useReminders.getState().markDone({rid:c,reminderId:n.id,forDate:m,at:new Date(f()).toISOString(),staffRef:u,staffName:v.current.replace(' (example)','')})},{label:'Later',kind:'ghost',onPress:()=>s.useReminders.getState().setSnooze(k,f()+6e4*$.snoozeMins)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[c,u,I,w,b])};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]);const f=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock).getTime()}catch{return Date.now()}},m=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=(t,n)=>{const[r,s,o]=t.split('-').map(Number);return new Date(r,s-1,o,Math.floor(n),Math.round(n%1*60)).getTime()};function k(t,n){const s=r.useOwner.getState(),a=(0,r.openShiftOf)(s.attendance,t,new Date(n)),d=(0,o.ukClock)(n).ymd,c=(0,u.workingShifts)(s.shifts,s.leave),f=c.find(r=>r.staffId===t&&r.date===d&&!1!==r.published&&l(r.date,r.start)<=n&&nn.staffId===t&&n.date===d&&!1!==n.published):void 0),m=!a&&!!f&&s.attendance.some(n=>n.staffId===t&&n.date===d&&!!n.out&&new Date(n.out).getTime()>=l(f.date,f.start));return{att:a,shift:f,on:!!a||!!f&&!m}}},998,[31,1176,861,996,1181,978,1190,878,970]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"START_PAIR",{enumerable:!0,get:function(){return t}});const t=(()=>{try{if('undefined'==typeof window||!window.location)return null;const t=new URL(window.location.href),n=new URLSearchParams(t.hash.replace(/^#/,'')),c=t.searchParams.get('pair')||n.get('pair');if(!c)return null;t.searchParams.delete('pair'),n.delete('pair');const o=n.toString();return window.history.replaceState(null,'',t.pathname+(t.search?t.search:'')+(o?`#${o}`:'')),c}catch{return null}})()},999,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1037,[31,128,951,825,818,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCKED_STEPS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"BLOCKED_INTRO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"BLOCKED_SPOKEN",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"STILL_OFF",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"ALERTS_PROMPT_ON",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"usePushPrompt",{enumerable:!0,get:function(){return O}}),_e.bannerFor=L,_e.titleFor=R,_e.chromeUrlFor=B,_e.AlertsBanner=function(){const e=O(e=>e.mode);if(!e)return null;const{line:n,action:o}=L(e);return(0,C.jsxs)(r.default,{testID:"alerts-banner",accessibilityRole:"button",accessibilityLabel:`${n} ${o}.`,accessibilityHint:"Opens the steps",onPress:()=>O.setState({open:!0}),style:{alignSelf:'center',maxWidth:420,width:'100%',minHeight:48,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1,borderColor:l.colours.accentBorder,backgroundColor:l.colours.surface2},children:[(0,C.jsx)(H,{size:18}),(0,C.jsxs)(t.Text,{testID:"alerts-banner-text",style:{color:'#F2E6C9',fontSize:15,textAlign:'center',flexShrink:1},children:[n," ",(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontWeight:'700',textDecorationLine:'underline'},children:o})]})]})},_e.PushPrompt=function(){const e=(0,s.useSync)(e=>e.kind),u=(0,s.useSync)(e=>e.staffRef),p=(0,s.useSync)(e=>e.venueId),b=O(e=>e.mode),m=O(e=>e.open),x=e=>O.setState(e?{mode:e}:{mode:null,open:!1}),[w,A]=(0,n.useState)(null),[L,_]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!k.includes(f.APP_VARIANT)||!P)return;if(h.PITCH)return globalThis.__pitchPushPrompt=e=>{A(null),O.setState({mode:e,open:!!e})},void(globalThis.__pitchPushBanner=e=>{A(null),O.setState({mode:e,open:!1})});if('staff'!==e||!u||!p)return;let t=!0;const n=async()=>{let e='unsupported';if(!(0,c.inApkWebView)()){try{e=await(0,c.pushState)()}catch{return}if(!t)return;if('on'===e)return x(null),void(0,c.resaveIfAllowed)().catch(()=>{});if('off'===e&&'undefined'!=typeof Notification&&'granted'===Notification.permission){let e=!1;try{e=await(0,c.resaveIfAllowed)()}catch{}if(!t)return;if(e)return void x(null)}}const n=z(e);t&&(n&&Date.now()-D()>I?O.setState({mode:n}):x(null))};n();const o=()=>{'undefined'!=typeof document&&'visible'===document.visibilityState&&n()};try{document.addEventListener('visibilitychange',o)}catch{}return()=>{t=!1;try{document.removeEventListener('visibilitychange',o)}catch{}}},[e,u,p]),!b||!m)return null;const F=R(b),N={minHeight:64,borderRadius:16,justifyContent:'center',alignItems:'center',paddingHorizontal:20,backgroundColor:l.colours.gold,alignSelf:'stretch'},W=(e,n)=>(0,C.jsxs)(i.default,{style:{flexDirection:'row',gap:12,alignItems:'center',alignSelf:'stretch'},children:[(0,C.jsx)(i.default,{style:{width:30,height:30,borderRadius:15,borderWidth:1.5,borderColor:l.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontSize:15,fontWeight:'700'},children:e})}),(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,flex:1,lineHeight:22},children:n})]},e);return(0,C.jsx)(i.default,{testID:"alerts-prompt-backdrop",style:{position:'fixed',left:0,right:0,top:0,bottom:0,zIndex:2147483100,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:18},children:(0,C.jsxs)(i.default,{testID:"alerts-prompt",accessibilityRole:'dialog',accessibilityLabel:F,style:{width:'100%',maxWidth:380,backgroundColor:l.colours.surface2,borderColor:l.colours.accentBorder,borderWidth:1,borderRadius:22,paddingHorizontal:22,paddingTop:22,paddingBottom:18,alignItems:'center',gap:14,shadowColor:'#000',shadowOpacity:.5,shadowRadius:24,shadowOffset:{width:0,height:10}},children:[(0,C.jsx)(i.default,{style:{position:'absolute',top:10,right:10},children:(0,C.jsx)(y.GoldClose,{testID:"alerts-prompt-close",label:"Close",onPress:()=>{A(null),O.setState({open:!1})}})}),(0,C.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1.5,borderColor:l.colours.gold,alignItems:'center',justifyContent:'center',marginTop:6},children:(0,C.jsx)(H,{})}),(0,C.jsx)(t.Text,{testID:"alerts-prompt-title",accessibilityRole:"header",style:{color:l.colours.goldLight,fontSize:22,fontWeight:'700',textAlign:'center',lineHeight:28,paddingHorizontal:8},children:F}),'off'===b?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(r.default,{testID:"alerts-prompt-turn-on",accessibilityRole:"button",disabled:L,accessibilityState:{disabled:L,busy:L},accessibilityLabel:"Turn on alerts. Your phone will then ask to allow notifications: tap Allow.",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{const e=await(0,c.turnOnPush)();if(e.ok)return void x(null);A(e.message);const t=z(await(0,c.pushState)());x(t||null)}catch{A('Could not turn on alerts. Please try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Turning on\u2026':'Turn on alerts'})}),(0,C.jsxs)(t.Text,{testID:"alerts-prompt-allow",style:{color:'#F2E6C9',fontSize:17,textAlign:'center'},children:["When your phone asks, tap ",(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontWeight:'700'},children:"Allow"}),"."]})]}):null,'blocked'===b?(0,C.jsxs)(i.default,{testID:"alerts-prompt-blocked",accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"assertive",accessibilityLabel:j,style:{alignSelf:'stretch',gap:8},children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:17,textAlign:'center'},children:T}),S.map((e,t)=>W(t+1,e))]}):null,'blocked'===b?(0,C.jsx)(r.default,{testID:"alerts-prompt-recheck",accessibilityRole:"button",disabled:L,accessibilityState:{disabled:L,busy:L},accessibilityLabel:"I\u2019ve allowed it. Check again.",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{if('blocked'===await(0,c.pushState)())return void A(v);const e=await(0,c.turnOnPush)();if(e.ok)return void x(null);A(e.message);const t=z(await(0,c.pushState)());x(t)}catch{A('Could not check alerts. Please try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Checking\u2026':'I\u2019ve allowed it, check again'})}):null,'ios'===b?(0,C.jsxs)(i.default,{testID:"alerts-prompt-ios",style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,textAlign:'center'},children:"iPhone only sends alerts to apps on the Home Screen. First:"}),W(1,'Tap the Share button (the square with the arrow) in Safari.'),W(2,'Tap Add to Home Screen, then Add.'),W(3,'Open CoverCharge from your Home Screen.'),W(4,'Tap Turn on alerts, then Allow.')]}):null,'apk'===b||'webview'===b?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,textAlign:'center'},children:'apk'===b?'The phone app can\u2019t show alerts when it\u2019s closed. Chrome can. You\u2019ll stay signed in as you.':'This browser can\u2019t get alerts. Open CoverCharge in Chrome.'}),(0,C.jsx)(r.default,{testID:"alerts-prompt-open-chrome",accessibilityRole:"button",disabled:L,accessibilityLabel:"Open CoverCharge in Chrome to turn on alerts",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{let e=null;if('apk'===b){const t=await(0,s.makeChromeHandover)();if(!t.ok)return void A(t.message);e=t.code}const t=B(window.location.href,e,'apk'===b);if(h.PITCH)return A('Opening Chrome\u2026'),void(globalThis.__pitchLastChromeUrl=t);A('Opening Chrome\u2026 Then tap Turn on alerts there, and Allow.');try{window.location.href=t}catch{await o.default.openURL(t)}}catch{A('Could not open Chrome. Check your connection and try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Opening\u2026':'Open in Chrome'})}),(0,C.jsx)(t.Text,{style:{color:'#CFC6B4',fontSize:14,textAlign:'center'},children:"In Chrome: tap Turn on alerts, then Allow."})]}):null,w?(0,C.jsx)(i.default,{accessibilityLiveRegion:"assertive",accessibilityRole:'alert',children:(0,C.jsx)(t.Text,{testID:"alerts-prompt-msg",style:{color:l.colours.goldLight,fontSize:15,textAlign:'center'},children:w})}):null,(0,C.jsx)(r.default,{testID:"alerts-prompt-later",accessibilityRole:"button",accessibilityLabel:"Not now. Hide this until tomorrow",onPress:()=>{E(),A(null),x(null)},style:{minHeight:48,justifyContent:'center',paddingHorizontal:24},children:(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontSize:17,textDecorationLine:'underline'},children:"Not now"})})]})})};var t=_r(d[0]),n=_r(d[1]),o=e(_r(d[2]));_r(d[3]);var r=e(_r(d[4])),i=e(_r(d[5])),l=_r(d[6]),s=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),f=_r(d[11]),p=_r(d[12]),b=_r(d[13]),y=_r(d[14]),m=_r(d[15]),x=e(m),C=_r(d[16]);const w='cc-alerts-prompt-v1',S=['In Chrome, tap the three dots at the top right, then Settings.','Tap Site settings, then Notifications.','Find CoverCharge (covercharge-apps) under Blocked, tap it, and choose Allow.','Come back here and tap \u201cI\u2019ve allowed it, check again\u201d.'],T='Chrome has alerts switched off for CoverCharge on this phone, so the app can\u2019t ask again. To switch them back on:',j=`${T} ${S.map((e,t)=>`${t+1}. ${e}`).join(' ')}`,v='Alerts are still off in Chrome. Follow the steps above, then tap check again.',I=864e5,k=['owner','staff','chef'],P=!(b.IS_ISOLATED_VENUE||b.IS_QUEUED_VENUE||b.IS_GREENSIDE||b.IS_ABBOTSFORD||b.IS_KIRKTON),A=k.includes(f.APP_VARIANT)&&P&&!h.PITCH,O=(0,u.create)(()=>({mode:null,open:!1}));function L(e){return{line:'Alerts are off on this phone.',action:'off'===e?'Tap to turn on':'ios'===e?'Tap to see how':'apk'===e||'webview'===e?'Tap to open in Chrome':'Tap to fix'}}function R(e){return'apk'===e||'webview'===e?'Open CoverCharge in Chrome to turn on alerts':'ios'===e?'Add CoverCharge to your Home Screen':'blocked'===e?'Turn alerts back on in Chrome':'Turn on alerts so you don\u2019t miss orders and reminders'}const _=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent);function D(){try{const e=JSON.parse(localStorage.getItem(w)||'{}');return Number(e.later||0)}catch{return 0}}function E(){try{localStorage.setItem(w,JSON.stringify({later:Date.now(),version:p.APP_VERSION}))}catch{}}function z(e){return _()?'apk':(0,c.inApkWebView)()?'webview':'off'===e?'off':'blocked'===e?'blocked':'ios-home-screen'===e?'ios':null}function B(e,t,n){const o=new URL(e),r=`${o.origin}${o.pathname.replace(/[^/]*$/,'')}index.html${t?`#ccchrome=${t}`:''}`;return n?`googlechrome://navigate?url=${encodeURIComponent(r)}`:`intent://${o.host}${o.pathname.replace(/[^/]*$/,'')}index.html#Intent;scheme=https;package=com.android.chrome;end`}function H({size:e=32}={}){return(0,C.jsxs)(x.default,{width:e,height:e,viewBox:"0 0 24 24",accessible:!1,pointerEvents:"none",children:[(0,C.jsx)(m.Path,{d:"M6 16 V11 a6 6 0 0 1 12 0 V16 l1.5 2 H4.5 Z",stroke:l.colours.gold,strokeWidth:1.7,strokeLinejoin:"round",fill:"none"}),(0,C.jsx)(m.Path,{d:"M10 20.5 a2 2 0 0 0 4 0",stroke:l.colours.gold,strokeWidth:1.7,strokeLinecap:"round",fill:"none"})]})}},1038,[873,31,240,123,264,128,825,824,1388,993,2,807,1041,5,835,987,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"currentScrollY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"screenGeneration",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"restoreScroll",{enumerable:!0,get:function(){return o}}),_e.useScrollMemory=function(u){const c=(0,e.useRef)(0),o=(0,e.useRef)(0),l=(0,e.useRef)(0),s=(0,e.useRef)(0),f=(0,e.useRef)(0),v=(0,e.useRef)(null),y=(0,e.useRef)([]),h=()=>{y.current.forEach(clearTimeout),y.current=[]},b=()=>{const e=v.current;null!=e&&(u.current?.scrollTo({y:e,animated:!1}),f.current-s.current>=e-2&&(c.current=e,o.current=e,v.current=null,h()))},p=(0,e.useCallback)(e=>{if(h(),v.current=Math.max(0,e),e<=0)return v.current=null,u.current?.scrollTo({y:0,animated:!1}),c.current=0,void(o.current=0);for(const e of[0,30,80,160,320,600,1e3,1600,2500])y.current.push(setTimeout(b,e));y.current.push(setTimeout(()=>{v.current=null},2600))},[]);t={y:()=>o.current,restore:p};const R=(0,e.useCallback)(()=>{n++;return o.current},[]);return{props:{scrollEventThrottle:32,onScroll:e=>{const t=e.nativeEvent.contentOffset.y;c.current=t,s.current=e.nativeEvent.layoutMeasurement.height,f.current=e.nativeEvent.contentSize.height,Date.now()-l.current>250&&null==v.current&&(o.current=t)},onScrollBeginDrag:()=>{v.current=null,h()},onContentSizeChange:(e,t)=>{f.current=t,l.current=Date.now(),b()},onLayout:e=>{s.current=e.nativeEvent.layout.height}},restore:p,leave:R}};var e=r(d[0]);let t=null,n=0;const u=()=>t?t.y():0,c=()=>n,o=e=>t?.restore(e)},1039,[31]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBackLayers",{enumerable:!0,get:function(){return f}}),_e.runBackLayer=function(){const e=f.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(e,n,o=!0){const s=(0,t.useRef)(n);s.current=n,(0,t.useEffect)(()=>{if(!e)return;const t=++y,n=(0,u.currentScrollY)(),l=(0,u.screenGeneration)();return f.setState(e=>({layers:[...e.layers,{id:t,fn:()=>s.current(),own:o}]})),()=>{f.setState(e=>({layers:e.layers.filter(e=>e.id!==t)})),(0,u.screenGeneration)()===l&&(0,u.restoreScroll)(n)}},[e,o])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"BACK_GUTTER",{enumerable:!0,get:function(){return w}}),_e.BackTitleRow=function({back:e,onBack:n,title:s}){const[l,u]=(0,t.useState)(0),[f,y]=(0,t.useState)({w:96,h:48}),[p,b]=(0,t.useState)(0),S=Array.from(new Set(String(s??'').split(/\s+/).filter(Boolean)));String(s??'').length>=20&&S.length>=3&&S.push('00000000');const v=Math.max(w,Math.ceil(f.w)+4),j=e&&l>0&&l-2*v0&&(0===l||0===p);return(0,h.jsxs)(o.default,{testID:"screen-title-row",onLayout:e=>u(Math.round(e.nativeEvent.layout.width)),style:{minHeight:44,justifyContent:'center',alignItems:'center',paddingHorizontal:e&&!j?v:0,paddingTop:j?f.h:0},children:[e?(0,h.jsx)(o.default,{style:{position:'absolute',left:0,top:0},onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width),n=Math.round(e.nativeEvent.layout.height);y(e=>e.w===t&&e.h===n?e:{w:t,h:n})},children:(0,h.jsx)(g,{onPress:n})}):null,(0,h.jsx)(c.T,{size:22,weight:"bold",center:!0,style:B?{opacity:0}:void 0,accessibilityRole:"header",children:s}),e&&S.length?(0,h.jsx)(o.default,{"aria-hidden":!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{position:'absolute',left:0,top:0,opacity:0,alignItems:'flex-start'},onLayout:e=>b(Math.ceil(e.nativeEvent.layout.width)),children:S.map(e=>(0,h.jsx)(c.T,{size:22,weight:"bold",numberOfLines:1,style:{alignSelf:'flex-start'},children:e},e))}):null]})},_e.BackButton=g,_e.useWebBack=function(e){const n=(0,t.useRef)(e);n.current=e,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.history?.pushState)return;const e=()=>{try{window.history.pushState({...window.history.state??{},ccBack:Date.now()},'',window.location.href)}catch{}};e();const t=t=>{n.current()&&(t.stopImmediatePropagation?.(),e())};return window.addEventListener('popstate',t,!0),()=>window.removeEventListener('popstate',t,!0)},[])};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]);const f=(0,s.create)(()=>({layers:[]}));let y=0;const p=()=>f(e=>e.layers.some(e=>e.own)),w=100;function g({onPress:e,testID:t="screen-back",label:o="Back"}){return(0,h.jsx)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,h.jsxs)(c.T,{size:18,weight:"semibold",colour:l.colours.gold,children:["\u2039 ",o]})})}},1040,[31,123,264,128,993,825,818,1039,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.184'},1041,[]); +__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()})},1042,[31,1072]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTasksProgress=function(e,s){const t=(0,r.useDailyTasks)(t=>t.people[(0,r.personKey)(e,s)]?.tasks)??[],i=(0,r.useDailyTasks)(e=>e.ticks),{ymd:l,dow:o}=T();return(0,c.progress)(t,i,s,l,o)},_e.DailyTasksEditor=j,_e.MyTasksToday=function({rid:e,staffId:s,name:t,onShift:i}){const u=(0,r.useDailyTasks)(t=>t.people[(0,r.personKey)(e,s)]?.tasks)??[],h=(0,r.useDailyTasks)(e=>e.ticks),{ymd:y,dow:x}=T(),p=(0,c.tasksFor)(u,x);if(!s||!p.length)return null;const f=(0,c.progress)(u,h,s,y,x);return(0,k.jsx)(o.default,{testID:"my-tasks-today",children:(0,k.jsxs)(n.Card,{children:[(0,k.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(n.T,{weight:"semibold",colour:d.colours.gold,children:"My tasks today"}),(0,k.jsx)(n.Badge,{kind:f.done===f.total?'gold':'neutral',label:`${f.done} of ${f.total}`})]}),i?null:(0,k.jsx)(n.Muted,{size:12,children:"You\u2019re not on shift right now. You can still tick these when you are."}),p.map(c=>{const u=h.find(t=>t.id===(0,r.tickId)(e,s,c.id,y));return(0,k.jsxs)(l.default,{testID:`my-task-${c.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:!!u},disabled:!i,onPress:()=>r.useDailyTasks.getState().toggleTick(e,s,c.id,y,{id:s,name:t.replace(' (example)','')}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:8,opacity:i?1:.6},children:[(0,k.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:1.5,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:u?'#2a2414':'transparent'},children:u?(0,k.jsx)(n.T,{colour:d.colours.gold,children:"\u2713"}):null}),(0,k.jsxs)(o.default,{style:{flex:1},children:[(0,k.jsx)(n.T,{style:{textDecorationLine:u?'line-through':'none'},children:c.text}),u?(0,k.jsxs)(n.Muted,{size:12,children:["Done at ",b(u.at)]}):null]})]},c.id)}),(0,k.jsx)(n.Muted,{size:12,children:"Tip: tick each one as you finish it. Your manager sees how you\u2019re getting on. They start fresh every day."})]})})},_e.TaskLibrarySettings=function({rid:e}){(0,i.useEffect)(()=>{r.useDailyTasks.getState().ensure(e)},[e]);const t=(0,r.useDailyTasks)(s=>s.library[e]?.items)??[],[l,u]=(0,i.useState)(''),[h,x]=(0,i.useState)({}),f=r.useDailyTasks.getState(),b=s=>f.setLibrary(e,s);return(0,k.jsxs)(o.default,{style:{gap:8},testID:"task-library",children:[(0,k.jsx)(n.Muted,{size:13,children:"Tip: these are quick picks when you add someone\u2019s daily tasks (Staff & roles \u203a a person \u203a Daily tasks). You can always type a new one there too."}),t.map((e,i)=>(0,k.jsxs)(n.Row,{gap:6,style:{opacity:e.archived?.5:1},children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:`Rename ${e.text}`,value:h[e.id]??e.text,onChangeText:s=>x(t=>({...t,[e.id]:s})),onBlur:()=>{const s=(0,c.cleanTaskText)(h[e.id]??'');s&&s!==e.text&&b(t.map(t=>t.id===e.id?{...t,text:s}:t))},style:{...p,flex:1,minWidth:0}}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2191",disabled:0===i,onPress:()=>b((0,c.move)(t,i,-1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2193",disabled:i===t.length-1,onPress:()=>b((0,c.move)(t,i,1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>b(t.map(s=>s.id===e.id?{...s,archived:!s.archived}:s))})]},e.id)),(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:"New library task",testID:"task-lib-new",value:l,onChangeText:u,placeholder:"e.g. Check the beer garden",placeholderTextColor:d.colours.muted,style:{...p,flex:1}}),(0,k.jsx)(n.Button,{small:!0,label:"Add",disabled:!(0,c.cleanTaskText)(l),onPress:()=>{b([...t,{id:(0,y.uuid)(),text:(0,c.cleanTaskText)(l)}]),u('')}})]})]})},_e.KitchenTeamTasks=function({rid:e,actor:s}){const t=(0,x.useOwner)(e=>e.staff).filter(e=>e.active&&s&&(0,c.canEditTasks)(s,e));return(0,k.jsxs)(o.default,{style:{gap:10},testID:"kitchen-team-tasks",children:[(0,k.jsx)(n.Muted,{size:13,children:"Tip: set the daily tasks for your kitchen team here. They see them as \u2018My tasks today\u2019 when they\u2019re on shift and tick them off. Your own list and front of house lists are set by a manager."}),s?null:(0,k.jsx)(n.Muted,{children:"Sign in to change your team\u2019s tasks."}),s&&!t.length?(0,k.jsx)(n.Muted,{children:"No kitchen staff found. A manager can set each person\u2019s department in Staff & roles."}):null,t.map(t=>(0,k.jsxs)(n.Card,{children:[(0,k.jsx)(n.T,{weight:"semibold",children:(0,x.staffLabel)(t).replace(' (example)','')}),(0,k.jsxs)(n.Muted,{size:12,children:[t.job,t.dept?` \xb7 ${t.dept}`:'']}),(0,k.jsx)(j,{rid:e,person:t,actor:s})]},t.id))]})};var s=_r(_d[0]),t=_r(_d[1]),i=_r(_d[2]),l=e(_r(_d[3])),o=e(_r(_d[4])),n=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),k=_r(_d[13]);const p={minHeight:42,borderRadius:10,borderWidth:1,borderColor:d.colours.hairline,backgroundColor:d.colours.surface2,color:d.colours.text,paddingHorizontal:10,fontSize:15},f=[1,2,3,4,5,6,0],b=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),T=(e=Date.now())=>{const s=(0,u.ukClock)(e);return{ymd:s.ymd,dow:new Date(`${s.ymd}T12:00:00Z`).getUTCDay()}};function j({rid:e,person:u,actor:y}){(0,i.useEffect)(()=>{r.useDailyTasks.getState().ensure(e)},[e]);const x=(0,r.useDailyTasks)(s=>s.people[(0,r.personKey)(e,u.id)]?.tasks)??[],j=((0,r.useDailyTasks)(s=>s.library[e]?.items)??[]).filter(e=>!e.archived),w=(0,r.useDailyTasks)(e=>e.ticks),[D,v]=(0,i.useState)(!1),[C,S]=(0,i.useState)(''),[$,I]=(0,i.useState)(null),M=r.useDailyTasks.getState(),P=(0,c.canEditTasks)(y,u),{ymd:R,dow:L}=T(),z=(0,c.progress)(x,w,u.id,R,L),B=s=>M.setTasks(e,u.id,s),A=e=>{const s=x;B(x.filter(s=>s.id!==e.id)),(0,h.notify)({id:`task-undo-${e.id}`,title:`Removed \u201c${e.text}\u201d`,timeoutMs:8e3,actions:[{label:'Undo',testID:'task-undo',onPress:()=>B(s)}]})};return(0,k.jsxs)(o.default,{testID:`tasks-${u.id}`,style:{gap:6},children:[(0,k.jsx)(l.default,{accessibilityRole:"button",testID:`tasks-open-${u.id}`,onPress:()=>v(!D),children:(0,k.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(n.T,{weight:"semibold",colour:d.colours.gold,children:["Daily tasks ",D?'\u25b4':'\u25be']}),(0,k.jsx)(n.Muted,{size:12,children:x.length?`${z.done} of ${z.total} done today`:'None yet'})]})}),D?(0,k.jsxs)(o.default,{style:{gap:6},children:[x.map((s,i)=>{const l=w.find(t=>t.id===(0,r.tickId)(e,u.id,s.id,R));return(0,k.jsxs)(o.default,{testID:`task-row-${i}`,style:{borderTopWidth:1,borderColor:d.colours.hairline,paddingTop:6,gap:4},children:[(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsxs)(n.T,{style:{flex:1},colour:l?d.colours.gold:d.colours.text,children:[l?'\u2713 ':'',s.text]}),P?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2191",accessibilityLabel:`Move ${s.text} up`,disabled:0===i,onPress:()=>B((0,c.move)(x,i,-1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2193",accessibilityLabel:`Move ${s.text} down`,disabled:i===x.length-1,onPress:()=>B((0,c.move)(x,i,1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"Days",onPress:()=>I($===s.id?null:s.id)}),(0,k.jsx)(t.GoldClose,{size:"sm",testID:`task-remove-${i}`,label:`Remove ${s.text}`,onPress:()=>A(s)})]}):null]}),(0,k.jsxs)(n.Muted,{size:12,children:[s.days?.length?s.days.map(e=>c.TASK_DAY_NAMES[e]).join(', '):'Every day',l?` \xb7 ticked by ${l.byName.split(' ')[0]} at ${b(l.at)}`:'']}),$===s.id?(0,k.jsx)(n.Row,{wrap:!0,gap:4,children:f.map(e=>{const t=!!s.days?.includes(e);return(0,k.jsx)(n.Chip,{label:c.TASK_DAY_NAMES[e],selected:t,onPress:()=>B(x.map(i=>i.id===s.id?{...i,days:t?(i.days??[]).filter(s=>s!==e):[...i.days??[],e].sort()}:i))},e)})}):null]},s.id)}),P?(0,k.jsxs)(o.default,{style:{gap:6},children:[(0,k.jsx)(n.Row,{wrap:!0,gap:4,children:j.filter(e=>!x.some(s=>s.text.toLowerCase()===e.text.toLowerCase())).slice(0,12).map(s=>(0,k.jsx)(n.Chip,{testID:"task-lib-chip",label:`${s.text}`,onPress:()=>M.addTask(e,u.id,s.text,s.id)},s.id))}),(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:"New task",testID:`task-new-${u.id}`,value:C,onChangeText:S,placeholder:"Type a task, e.g. Restock the bar fridges",placeholderTextColor:d.colours.muted,style:{...p,flex:1},onSubmitEditing:()=>{(0,c.cleanTaskText)(C)&&(M.addTask(e,u.id,C),S(''))}}),(0,k.jsx)(n.Button,{small:!0,testID:`task-add-${u.id}`,label:"Add",disabled:!(0,c.cleanTaskText)(C),onPress:()=>{M.addTask(e,u.id,C),S('')}})]})]}):(0,k.jsx)(n.Muted,{size:12,children:'staff'===y?.role?'You can\u2019t change this list.':''})]}):null]})}},1043,[873,835,31,264,128,818,825,1179,1180,1181,978,1097,861,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.readBack=B,_e.ReviewSheet=L,_e.Bars=z,_e.CashCharts=A,_e.CashUpScreen=function(e){return e.closer?(0,$.jsx)(N,{rid:e.rid,tonight:e.today,who:e.who}):(0,$.jsx)(E,{...e})},_e.CloserCashUp=N,_e.PastDayCard=O,_e.TodaysTipsCard=function({rid:e,today:t,big:s}){const a=(0,f.useTipsShow)(e),o=(0,f.useCashUp)(e=>e.tips).filter(s=>s.rid===e&&(s.date===t||s.date===(0,x.addDaysYmd)(t,-1))).sort((e,t)=>t.date.localeCompare(e.date))[0],l=G(o?.total??0);return a.showToday&&o?(0,$.jsx)(p.Card,{highlight:y.colours.gold,children:(0,$.jsxs)(c.default,{testID:"todays-tips",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,$.jsx)(Y,{n:Math.ceil(o.total/25)}),(0,$.jsxs)(c.default,{style:{flex:1,gap:2},children:[(0,$.jsx)(p.T,{size:12,weight:"semibold",colour:y.colours.gold,style:{letterSpacing:1.5},children:o.date===t?'TODAY\u2019S TIPS':'LAST NIGHT\u2019S TIPS'}),(0,$.jsx)(p.T,{size:s?40:32,weight:"bold",colour:y.colours.goldLight,children:P(l)}),(0,$.jsxs)(p.Muted,{children:["Cash + card tips for the whole team \xb7 ",M(o.date),". Thank you, everyone."]})]})]})}):null},_e.TipsPotCard=V,_e.postTipsNotice=K,_e.latestDayTips=Z,_e.useTipsPosted=function(e,t,s=!0){const a=(0,f.useCashUp)(e=>e.tips),o=(0,f.useTipsShow)(e);(0,l.useEffect)(()=>{if(!s||!o.showToday)return;const l=Z(a,e,t);l&&K(e,l.date,l.total,t)},[e,t,a,o.showToday,s])},_e.CashUpSettings=function({rid:e}){const t=U(e),s=(t,s)=>f.useCashUp.getState().setFields(e,t,s),l=(e,l)=>(0,$.jsxs)(c.default,{style:{gap:6},children:[(0,$.jsx)(p.T,{weight:"semibold",children:l}),t[e].map((l,n)=>(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(o.TextInput,{testID:`cf-${e}-${l.key}`,value:l.label,onChangeText:a=>s(e,t[e].map((e,t)=>t===n?{...e,label:a.slice(0,40)}:e)),style:{flex:1,minHeight:38,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',color:y.colours.text,paddingHorizontal:8}}),(0,$.jsx)(p.Muted,{children:'money'===l.kind?'\xa3':'number'===l.kind?'#':'text'}),l.fixed?(0,$.jsx)(p.Muted,{children:"needed"}):(0,$.jsx)(a.GoldClose,{size:"sm",label:`Remove ${l.label}`,onPress:()=>s(e,t[e].filter((e,t)=>t!==n))})]},l.key)),(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"secondary",label:"Money figure",onPress:()=>s(e,[...t[e],{key:`f${Date.now().toString(36)}`,label:'New figure',kind:'money'}])}),(0,$.jsx)(p.Button,{small:!0,kind:"secondary",label:"Number",onPress:()=>s(e,[...t[e],{key:`n${Date.now().toString(36)}`,label:'New number',kind:'number'}])})]})]});return(0,$.jsxs)(c.default,{testID:"cashup-settings",style:{gap:12},children:[(0,$.jsx)(p.Muted,{children:"Tip: match these to the boxes on your paper cash up sheet and till printout. Cash tips total and Card tips total are needed for Today\u2019s tips and the Tips pot."}),l('cashFields','Cash up sheet'),l('salesFields','Weekly sales report')]})},_e.TipsSettings=function({rid:e}){const t=(0,f.useTipsShow)(e);return(0,$.jsxs)(c.default,{testID:"tips-settings",style:{gap:8},children:[(0,$.jsx)(p.Muted,{children:"Staff only ever see the team total: never anyone\u2019s share or pay. The Display never shows tips or money."}),(0,$.jsx)(p.Toggle,{testID:"tips-show-today",label:"Show Today\u2019s tips in the staff apps",value:t.showToday,onChange:t=>f.useCashUp.getState().setShow(e,{showToday:t})}),(0,$.jsx)(p.Toggle,{testID:"tips-show-pot",label:"Show the Tips pot in the staff apps",value:t.showPot,onChange:t=>f.useCashUp.getState().setShow(e,{showPot:t})})]})};var t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),n=e(_r(_d[5])),r=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),h=e(_r(_d[9])),c=e(_r(_d[10])),u=e(_r(_d[11])),p=_r(_d[12]),y=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),k=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]),T=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),I=_r(_d[26]),$=_r(_d[27]);const P=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,M=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function B(e){const t=t=>'number'==typeof e[t]?e[t]:null,s=(0,x.combinedTips)(e);return[['Gross',t('gross')],['card',t('card')],['cash',t('cash')],['tips',s],['food',t('food')],['drink',t('drink')]].filter(([,e])=>null!=e).map(([e,t])=>`${e} ${P(t)}`).join(', ')}function R({p:e,h:s}){const[a,o]=(0,l.useState)(e.startsWith('data:')?e:null),n=e.startsWith('data:')||(0,w.photosAllowed)();return(0,l.useEffect)(()=>{!a&&n&&(0,w.photoUrl)(e).then(o)},[e,n]),n?a?(0,$.jsx)(d.default,{source:{uri:a},style:{width:'100%',height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#111')},resizeMode:"contain"}):(0,$.jsx)(c.default,{style:{height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(p.Muted,{children:"Photo"})}):(0,$.jsx)(c.default,{testID:"photo-owners-only",accessible:!0,accessibilityLabel:"Taking-sheet photo. Only owners can view saved photos.",style:{height:Math.min(s,90),borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center',padding:10},children:(0,$.jsx)(p.Muted,{center:!0,children:"Photo saved. Only owners can view it."})})}function L({draft:e,fields:t,onClose:s,onConfirm:n,keyLabel:r,onKey:i,keyChoices:d}){const{width:h,height:f}=(0,u.default)(),m=h>=820;e.only&&(t=t.filter(t=>e.only.includes(t.key)));const[k,b]=(0,l.useState)(()=>Object.fromEntries(t.map(t=>[t.key,(0,x.isBlank)(e.vals[t.key])?'':String(e.vals[t.key])]))),[j,w]=(0,l.useState)(()=>e.categories.map(e=>({name:e.name,amount:String(e.amount)}))),[C,T]=(0,l.useState)(!1),v=Object.fromEntries(t.map(e=>[e.key,'text'===e.kind?k[e.key]?.trim()||null:(0,x.parseAmount)(k[e.key]??'',e.kind)])),S=t.filter(e=>'text'!==e.kind&&(k[e.key]??'').trim()&&null==v[e.key]).map(e=>e.key),D=(0,x.missing)(t,v),I=j.map(e=>({name:e.name.trim(),amount:(0,x.parseAmount)(e.amount)})).filter(e=>e.name),P=I.some(e=>null==e.amount),M=e=>({minHeight:42,borderRadius:10,borderWidth:e?2:1,borderColor:e?y.colours.amber:'rgba(255,255,255,0.15)',backgroundColor:e?'rgba(232,168,56,0.08)':'#141312',color:y.colours.text,paddingHorizontal:10,fontSize:17}),B=(0,$.jsx)(c.default,{testID:"review-photos",style:{gap:8,flex:m?1:void 0},children:e.photos.length?e.photos.map((t,s)=>(0,$.jsx)(R,{p:t,h:m?Math.max(300,.62*f/Math.min(2,e.photos.length)):260},s)):(0,$.jsx)(p.Muted,{children:"No photo: typed by hand."})}),L=(0,$.jsxs)(c.default,{testID:"review-fields",style:{gap:8,flex:m?1:void 0},children:[(0,$.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(p.Muted,{children:r}),d.map(t=>(0,$.jsx)(p.Chip,{label:t.label,selected:e.key===t.value,onPress:()=>i(t.value)},t.value))]}),t.map(e=>{const t='text'!==e.kind&&!(k[e.key]??'').trim()||S.includes(e.key);return(0,$.jsxs)(c.default,{style:{gap:3},children:[(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.T,{weight:"semibold",size:14,children:e.label}),t&&'text'!==e.kind?(0,$.jsx)(p.Badge,{kind:"amber",label:S.includes(e.key)?'Check this':'Not read: type it'}):null]}),(0,$.jsx)(o.TextInput,{testID:`review-${e.key}`,value:k[e.key]??'',onChangeText:t=>b(s=>({...s,[e.key]:t})),keyboardType:'text'===e.kind?'default':'decimal-pad',placeholder:'money'===e.kind?'\xa3':'number'===e.kind?'Number':'Optional',placeholderTextColor:"#777",style:M(t)})]},e.key)}),'sales'===e.kind?(0,$.jsxs)(c.default,{testID:"review-categories",style:{gap:6},children:[(0,$.jsx)(p.T,{weight:"semibold",size:14,children:"Sales by category (if the printout has them)"}),j.map((e,t)=>(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(o.TextInput,{value:e.name,onChangeText:e=>w(s=>s.map((s,a)=>a===t?{...s,name:e}:s)),placeholder:"e.g. Food",placeholderTextColor:"#777",style:[M(!1),{flex:2}]}),(0,$.jsx)(o.TextInput,{value:e.amount,onChangeText:e=>w(s=>s.map((s,a)=>a===t?{...s,amount:e}:s)),placeholder:"\xa3",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:[M(!e.amount.trim()||null==(0,x.parseAmount)(e.amount)),{flex:1}]}),(0,$.jsx)(a.GoldClose,{size:"sm",label:"Remove category",onPress:()=>w(e=>e.filter((e,s)=>s!==t))})]},t)),(0,$.jsx)(p.Button,{small:!0,kind:"secondary",testID:"review-add-cat",label:"Add a category",onPress:()=>w(e=>[...e,{name:'',amount:''}])})]}):null]});return(0,$.jsxs)(p.Sheet,{visible:!0,onClose:s,title:'cashup'===e.kind?'Check the cash up':'Check the weekly sales',maxWidth:1100,testID:"review-sheet",children:[(0,$.jsx)(p.Muted,{children:"Tip: check each figure against the photo. Nothing is saved until you tap Confirm. Amber boxes weren\u2019t read: type them, or leave them blank if the sheet doesn\u2019t have them."}),'edit'===e.reader||e.only?null:e.reader?(0,$.jsx)(p.Banner,{kind:"info",title:"Read from the photo",children:e.note}):e.photos.length?(0,$.jsx)(p.Banner,{kind:"info",title:"Type it from the photo",children:e.note}):null,m?(0,$.jsxs)(c.default,{style:{flexDirection:'row',gap:14},children:[B,L]}):(0,$.jsxs)($.Fragment,{children:[B,L]}),D.length?(0,$.jsxs)(p.Muted,{children:[D.length," figure",1===D.length?'':'s'," still blank. Blank means \u201cnot on the sheet\u201d, never zero."]}):null,(0,$.jsxs)(p.Row,{gap:8,children:[(0,$.jsx)(p.Button,{testID:"review-confirm",label:C?'Saving\u2026':'Confirm and save',disabled:C||!!S.length||P||!t.some(e=>'text'!==e.kind&&null!=v[e.key]),onPress:async()=>{T(!0),await n(v,I.map(e=>({name:e.name,amount:e.amount}))),T(!1)}}),(0,$.jsx)(p.Button,{kind:"secondary",label:"Cancel",onPress:s})]})]})}function z({data:e,height:t=140,testID:s,fmt:a=P}){const o=Math.max(1,...e.map(e=>e.value??0));return(0,$.jsxs)(c.default,{testID:s,style:{gap:4},children:[(0,$.jsx)(c.default,{style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:t},children:e.map((e,s)=>(0,$.jsxs)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'flex-end',height:t},children:[null!=e.value?(0,$.jsx)(p.T,{size:9,colour:y.colours.muted,children:a(e.value).replace('.00','')}):null,(0,$.jsx)(c.default,{style:{width:'80%',height:null==e.value?2:Math.max(3,e.value/o*(t-16)),borderRadius:4,backgroundColor:null==e.value?'#333':e.hi?y.colours.goldLight:y.colours.gold,opacity:null==e.value?.6:1}})]},s))}),(0,$.jsx)(c.default,{style:{flexDirection:'row',gap:4},children:e.map((e,t)=>(0,$.jsx)(p.T,{size:9,colour:y.colours.muted,style:{flex:1,textAlign:'center'},children:e.label},t))})]})}function A({rid:e,today:s}){const a=(0,f.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e),o=(0,f.useCashUp)(e=>e.sales).filter(t=>t.rid===e),l=(0,x.dailySeries)(a,s,14),n=(0,x.dailySeries)(a,s,14,x.combinedTips),r=(0,x.weekStartOf)(s),i=Array.from({length:8},(e,t)=>(0,x.addDaysYmd)(r,7*(t-7))).map(e=>{const t=o.find(t=>t.weekStart===e&&t.confirmedAt),s=t?.vals.net;return{label:M(e).split(' ').slice(1).join(' '),value:'number'==typeof s?s:null,hi:e===r}}),d=[...o].filter(e=>e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0],h=d?(0,x.weekCompare)(o,d.weekStart):null,u=d?.categories??[],m=Math.max(1,...u.map(e=>e.amount)),k=d?(0,x.weekCompare)(o,d.weekStart,'covers'):null;return(0,$.jsxs)(c.default,{testID:"cash-charts",style:{gap:12},children:[(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Takings, last 14 days"}),(0,$.jsx)(p.Muted,{children:"Card + cash from confirmed cash ups. A grey line means no cash up that day."}),(0,$.jsx)(z,{testID:"chart-daily",data:l.map(e=>({label:M(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Tips, last 14 days"}),(0,$.jsx)(p.Muted,{children:"Cash + card tips, team total."}),(0,$.jsx)(z,{testID:"chart-tips",height:100,data:n.map(e=>({label:M(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Weekly net sales"}),h&&null!=h.now?(0,$.jsx)(c.default,{testID:"week-compare",children:(0,$.jsxs)(p.T,{size:15,children:["Week of ",M(d.weekStart),": ",P(h.now),null!=h.prev?` \xb7 week before ${P(h.prev)}`:'',null!=h.change?` \xb7 ${h.change>=0?'\u25b2':'\u25bc'} ${Math.abs(h.change)}%`:'']})}):(0,$.jsx)(p.Muted,{children:"No weekly sales report yet."}),k&&null!=k.now?(0,$.jsxs)(p.Muted,{children:["Covers ",k.now,null!=k.prev?` (week before ${k.prev})`:'']}):null,(0,$.jsx)(z,{testID:"chart-weekly",data:i})]}),u.length?(0,$.jsxs)(p.Card,{children:[(0,$.jsxs)(p.T,{weight:"semibold",children:["By category, week of ",M(d.weekStart)]}),(0,$.jsx)(c.default,{testID:"chart-categories",style:{gap:6},children:u.map(e=>(0,$.jsxs)(c.default,{style:{gap:2},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(p.T,{size:14,children:e.name}),(0,$.jsx)(p.T,{size:14,colour:y.colours.goldLight,children:P(e.amount)})]}),(0,$.jsx)(c.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2826')},children:(0,$.jsx)(c.default,{style:{width:e.amount/m*100+"%",height:10,borderRadius:5,backgroundColor:y.colours.gold}})})]},e.name))})]}):null]})}function U(e){const t=(0,f.useCashSettings)(e),s=(0,m.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings.cashUpRecord);return(0,l.useMemo)(()=>({...t,record:s,cashFields:(0,x.cashFieldsForRecord)(t.cashFields,s)}),[t,s])}const F=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}):'',W=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`;function N({rid:e,tonight:t,who:s}){const a=U(e),o=(0,f.useCashUp)(e=>e.cashUps).find(s=>s.rid===e&&s.date===t),[r,i]=(0,l.useState)(null),[d,u]=(0,l.useState)(null),[m,k]=(0,l.useState)(!1),b=!!o?.confirmedAt,j=async e=>{if(b)return;const s=e?await(0,w.pickPhotos)({source:e}):[];if(e&&!s.length)return void u('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');let o,l={vals:{},reader:null,note:'Type the figures from the sheet.'};s.length&&(k(!0),u('Reading the photo\u2026'),o=await Promise.all(s.map((e,s)=>(0,w.uploadPhoto)('cashup',t,e,s))),l=await(0,C.readSheet)('cashup',o.filter(e=>!!e),a.cashFields),k(!1),u(null)),i({kind:'cashup',key:t,photos:s,vals:l.vals,categories:[],unread:(0,x.missing)(a.cashFields,l.vals),note:l.note,reader:l.reader,uploaded:o})},T=async a=>{if(!r||b)return void i(null);const o=r.uploaded&&r.uploaded.length===r.photos.length?r.uploaded:await Promise.all(r.photos.map((e,s)=>(0,w.uploadPhoto)('cashup',t,e,s))),l=r.photos.map((e,t)=>o[t]??e);f.useCashUp.getState().saveCashUp({rid:e,date:t,vals:a,photos:l,confirmedBy:s.name,confirmedAt:(new Date).toISOString(),readBy:r.reader});const d=B(a);u(`Tonight\u2019s cash up is saved and signed off${d?`: ${d}`:''}.${o.some(e=>null==e)&&r.photos.length?' The photo will be sent when this phone is back online.':''}`);try{n.default.announceForAccessibility?.(`Saved and signed off. ${d}`)}catch{}i(null)};return(0,$.jsxs)(c.default,{testID:"cashup-screen",style:{gap:12,alignItems:'center',width:'100%'},children:[d?(0,$.jsx)(p.Banner,{kind:"info",children:d}):null,(0,$.jsx)(p.Card,{highlight:y.colours.gold,children:(0,$.jsxs)(c.default,{testID:"closer-cashup",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:20,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Tonight\u2019s cash up"}),(0,$.jsxs)(p.T,{center:!0,size:15,colour:y.colours.muted,testID:"closer-day",children:[M(t)," \xb7 ",W(t)]}),b?(0,$.jsxs)(c.default,{testID:"closer-done",accessible:!0,accessibilityLabel:`Tonight's cash up is done. Submitted by ${o?.confirmedBy??'someone'} at ${F(o?.confirmedAt)}. ${B(o.vals)}. It is signed off. If something is wrong, ask an owner to unlock it.`,style:{alignItems:'center',gap:6,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:18,weight:"semibold",colour:y.colours.goldLight,children:"Done and signed off"}),(0,$.jsxs)(p.T,{center:!0,size:15,children:["Submitted by ",o?.confirmedBy??'\u2014'," at ",F(o?.confirmedAt)]}),(0,$.jsx)(p.T,{center:!0,size:15,children:B(o.vals)||'No figures'}),o.photos.length?(0,$.jsxs)(p.Muted,{center:!0,size:13,children:[o.photos.length," photo",o.photos.length>1?'s':''," of the taking sheet sent to the owners."]}):null,(0,$.jsx)(p.Muted,{center:!0,size:13,children:"If something is wrong, ask an owner to unlock it."})]}):(0,$.jsxs)($.Fragment,{children:[a.record?.length?(0,$.jsxs)(c.default,{testID:"cashup-record",accessibilityLabel:`What to record at nightly cash up. ${a.record.join(', ')}`,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"What to record"}),a.record.map(e=>(0,$.jsx)(p.T,{center:!0,children:e},e))]}):null,(0,$.jsx)(h.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:m,onPress:()=>{j('camera')},style:({pressed:e})=>({minHeight:64,width:'100%',borderRadius:16,backgroundColor:e?y.colours.goldLight:y.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:m?.5:1}),children:(0,$.jsx)(p.T,{center:!0,size:20,weight:"semibold",colour:y.colours.onGold,children:m?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,$.jsx)(p.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{j('gallery')}}),(0,$.jsx)(p.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{j(null)}})]}),(0,$.jsx)(p.Muted,{center:!0,size:13,children:"Check the figures, then Confirm. Once confirmed it\u2019s signed off, and the photo goes to the owners only."})]})]})}),(0,$.jsx)(p.Muted,{center:!0,size:12,testID:"closer-note",children:"You can do tonight\u2019s cash up only. Past takings, charts and sales reports are for owners and managers."}),r?(0,$.jsx)(L,{draft:r,fields:a.cashFields,onClose:()=>i(null),onConfirm:e=>T(e),keyLabel:"Day",keyChoices:[{label:'Tonight',value:t}],onKey:()=>{}},`closer-${r.photos.length}`):null]})}function E({rid:e,today:t,canEdit:s,who:a,chartsOnly:o,backdate:r}){const i=U(e),d=(0,f.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e).sort((e,t)=>t.date.localeCompare(e.date)),u=(0,f.useCashUp)(e=>e.sales).filter(t=>t.rid===e).sort((e,t)=>t.weekStart.localeCompare(e.weekStart)),[m,k]=(0,l.useState)(null),[b,j]=(0,l.useState)(null),D=(0,v.useLockedFor)(e),[I,R]=(0,l.useState)(!1),[z,F]=(0,l.useState)(null),W=async(e,s,a,o)=>{const l=a??('cashup'===e?t:(0,x.weekStartOf)((0,x.addDaysYmd)(t,-7)));if(D(e,l))return void j((0,v.lockedMessage)(e,l));const n=s?await(0,w.pickPhotos)({source:s}):[];if(s&&!n.length)return void j('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');const r='cashup'===e?i.cashFields:i.salesFields;let h,c={vals:{},reader:null,note:'Type the figures from the sheet.',categories:[]};n.length&&(R(!0),j('Reading the photo\u2026'),h=await Promise.all(n.map((t,s)=>(0,w.uploadPhoto)(e,l,t,s))),c=await(0,C.readSheet)(e,h.filter(e=>!!e),r),R(!1),j(null));const u=o&&'cashup'===e?d.find(e=>e.date===l)?.vals:void 0;k({kind:e,key:l,photos:n,vals:u?{...c.vals,...u}:c.vals,categories:c.categories??[],unread:(0,x.missing)(r,c.vals),note:c.note,reader:o?'edit':c.reader,uploaded:h,only:o})},N=[0,1,2].map(e=>({label:0===e?'Today':1===e?'Yesterday':M((0,x.addDaysYmd)(t,-e)),value:(0,x.addDaysYmd)(t,-e)}));'cashup'!==m?.kind||N.some(e=>e.value===m.key)||N.push({label:M(m.key),value:m.key});const E=[0,1,2].map(e=>{const s=(0,x.weekStartOf)((0,x.addDaysYmd)(t,-7*e));return{label:0===e?'This week':1===e?'Last week':`w/c ${M(s)}`,value:s}});return(0,$.jsxs)(c.default,{testID:"cashup-screen",style:{gap:12},children:[(0,$.jsx)(p.Muted,{children:"Tip: at the end of the night, tap Take a picture of the taking sheet: the figures are filled in from the photo for you to check beside it, then Confirm. Bigger venues can Upload a spreadsheet (CSV or Excel) for one night or several. Gross takings feed Spend per head. Head Chefs can see the graphs."}),b?(0,$.jsx)(p.Banner,{kind:"info",children:b}):null,(0,$.jsx)(V,{rid:e,today:t,manage:s,who:a}),s&&!o?(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"End of night cash up"}),i.record?.length?(0,$.jsxs)(c.default,{testID:"cashup-record",accessibilityLabel:`What to record at nightly cash up. ${i.record.join(', ')}`,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"What to record at nightly cash up"}),i.record.map(e=>(0,$.jsx)(p.T,{center:!0,children:e},e))]}):null,(0,$.jsx)(h.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:I,onPress:()=>{W('cashup','camera')},style:({pressed:e})=>({minHeight:64,borderRadius:16,backgroundColor:e?y.colours.goldLight:y.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:I?.5:1}),children:(0,$.jsx)(p.T,{size:20,weight:"semibold",colour:y.colours.onGold,children:I?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(p.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{W('cashup','gallery')}}),(0,$.jsx)(p.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{W('cashup',null)}}),(0,$.jsx)(p.Button,{testID:"cashup-sheet",kind:"secondary",label:"Upload a spreadsheet",accessibilityLabel:"Upload a spreadsheet of takings, CSV or Excel, for one night or several",onPress:async()=>{const e=await(0,T.pickSpreadsheet)();e&&('error'in e?j(e.error):F(e))}}),(0,$.jsx)(p.Button,{testID:"cashup-takings",kind:"secondary",label:"Enter takings",accessibilityLabel:"Enter tonight's takings: gross, and food and drink if you have them",onPress:()=>{W('cashup',null,t,x.TAKINGS_KEYS)}})]}),(0,$.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"Weekly sales report"}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(p.Button,{testID:"upload-sales",label:"Upload weekly sales report",onPress:()=>{W('sales','camera')}}),(0,$.jsx)(p.Button,{testID:"sales-gallery",kind:"secondary",label:"Choose from gallery",onPress:()=>{W('sales','gallery')}}),(0,$.jsx)(p.Button,{testID:"sales-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{W('sales',null)}})]}),(0,$.jsx)(p.Muted,{children:"Several pages? Pick them all at once. Fields can be changed in Settings \u203a Advanced \u203a Cash up."})]}):null,s&&r&&!o?(0,$.jsx)(O,{today:t,has:e=>d.some(t=>t.date===e),paid:t=>(0,S.paidOutFor)(t,f.useCashUp.getState().pot,e),onOpen:e=>{if(D('cashup',e))return void j((0,v.lockedMessage)('cashup',e));const t=d.find(t=>t.date===e);k({kind:'cashup',key:e,photos:t?.photos??[],vals:t?.vals??{},categories:[],unread:[],note:t?'':'Type the figures for that day.',reader:'edit'})}}):null,(0,$.jsx)(A,{rid:e,today:t}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Recent cash ups"}),d.length?d.slice(0,10).map(e=>(0,$.jsxs)(c.default,{testID:`cashup-row-${e.date}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)',gap:2},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(p.T,{weight:"semibold",children:M(e.date)}),(0,$.jsx)(p.T,{colour:y.colours.goldLight,children:P((0,x.takings)(e.vals))})]}),(0,$.jsx)(p.Muted,{children:i.cashFields.filter(e=>'text'!==e.kind&&'card'!==e.key&&'cash'!==e.key).map(t=>`${t.label} ${(0,x.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?P(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),(0,$.jsxs)(p.Muted,{children:["Confirmed by ",e.confirmedBy??'\u2014',e.photos.length?` \xb7 ${e.photos.length} photo${e.photos.length>1?'s':''}`:'']}),(0,S.historyLines)(e.vals).slice(0,3).map(t=>(0,$.jsx)(p.Muted,{size:12,testID:`cashup-later-${e.date}`,children:t},t)),s&&!D('cashup',e.date)?(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit",onPress:()=>k({kind:'cashup',key:e.date,photos:e.photos,vals:e.vals,categories:[],unread:[],note:'',reader:'edit'})}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:`takings-edit-${e.date}`,label:null==(0,x.grossOf)(e.vals)?'Add takings':'Edit takings',onPress:()=>k({kind:'cashup',key:e.date,photos:[],vals:e.vals,categories:[],unread:[],note:'',reader:'edit',only:x.TAKINGS_KEYS})})]}):null,s?(0,$.jsx)(v.CashLockControls,{kind:"cashup",item:e,label:M(e.date)}):null]},e.id)):(0,$.jsx)(p.Muted,{children:"None yet."})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Weekly sales reports"}),u.length?u.slice(0,8).map(e=>(0,$.jsxs)(c.default,{style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(p.T,{weight:"semibold",children:["w/c ",M(e.weekStart)]}),(0,$.jsx)(p.T,{colour:y.colours.goldLight,children:P('number'==typeof e.vals.net?e.vals.net:null)})]}),(0,$.jsx)(p.Muted,{children:i.salesFields.filter(e=>'net'!==e.key).map(t=>`${t.label} ${(0,x.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?P(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),s?(0,$.jsx)(v.CashLockControls,{kind:"sales",item:e,label:`w/c ${M(e.weekStart)}`}):null]},e.id)):(0,$.jsx)(p.Muted,{children:"None yet."})]}),z?(0,$.jsx)(T.SpreadsheetImport,{rid:e,file:z,who:a,locked:e=>D('cashup',e),onClose:()=>F(null),onSaved:e=>{j(e),F(null)}}):null,m?(0,$.jsx)(L,{draft:m,fields:'cashup'===m.kind?i.cashFields:i.salesFields,onClose:()=>k(null),onConfirm:async(s,o)=>{if(!m)return;if(D(m.kind,m.key))return j((0,v.lockedMessage)(m.kind,m.key)),void k(null);const l=m.uploaded&&m.uploaded.length===m.photos.length?m.uploaded:await Promise.all(m.photos.map((e,t)=>(0,w.uploadPhoto)(m.kind,m.key,e,t))),r=m.photos.map((e,t)=>l[t]??e),i=(new Date).toISOString();if('cashup'===m.kind){const o=d.find(e=>e.date===m.key),l=m.only&&o?{...o.vals,...s}:s,h=m.keynull==e)&&m.photos.length&&j(e=>`${e??''} The photo is kept on this device only (not signed in or offline).`),k(null)},keyLabel:'cashup'===m.kind?'Day':'Week starting',keyChoices:'cashup'===m.kind?N:E,onKey:e=>k({...m,key:e})},`${m.kind}-${m.photos.length}`):null]})}function O({today:e,has:t,paid:a,onOpen:o}){const[n,r]=(0,l.useState)((0,x.addDaysYmd)(e,-1)),[i,d]=(0,l.useState)((0,I.ukHistoryDate)((0,x.addDaysYmd)(e,-1))),[h,u]=(0,l.useState)(!1),f=(0,I.parseHistoryInput)(i)??'',m=(0,S.backdateProblem)(f,e),k=m?n:f,b=!m&&t(k),j=m?null:a(k),w=e=>{r(e),d((0,I.ukHistoryDate)(e))};return(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsxs)(c.default,{testID:"cashup-backdate",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:20,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Cash up for another day"}),(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.text,children:"Missed a night? Enter or correct takings and tips for any past day. It counts on that day everywhere."}),(0,$.jsx)(c.default,{style:{width:'100%',maxWidth:360},children:(0,$.jsx)(p.Field,{label:"Day (DD/MM/YYYY)",value:i,onChangeText:e=>d((0,s.slashDate)(e,i)),placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"cashup-backdate-date",style:{textAlign:'center'},accessibilityLabel:"Day of the cash up, as day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1})}),m?(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.amber,testID:"cashup-backdate-problem",children:m}):(0,$.jsx)(c.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cashup-backdate-status",children:(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.goldLight,children:b?`There is already a cash up for ${M(k)}: it opens for editing.`:`No cash up yet for ${M(k)}.`})}),j?(0,$.jsx)(c.default,{testID:"cashup-backdate-paid",style:{borderWidth:1,borderColor:y.colours.amber,borderRadius:10,padding:10,maxWidth:520},children:(0,$.jsxs)(p.T,{center:!0,size:14,colour:y.colours.amber,children:["Tips up to ",M(j.throughDate)," were already paid out. Tips you add for this day won\u2019t be in the pot automatically: add a correction in the Tips pot if they should still be shared."]})}):null,(0,$.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center'},children:[(0,$.jsx)(p.Button,{kind:"secondary",label:"Pick a date",testID:"cashup-backdate-pick",accessibilityLabel:`Pick a day from a calendar. Now ${m?'no valid day':M(k)}`,onPress:()=>u(!0),style:{minHeight:56}}),(0,$.jsx)(p.Button,{label:m?'Open cash up':b?`Edit cash up for ${M(k)}`:`Add cash up for ${M(k)}`,testID:"cashup-backdate-open",disabled:!!m,accessibilityLabel:m?'Open cash up, enter a valid past day first':`${b?'Edit':'Add'} the cash up for ${M(k)}`,onPress:()=>{w(k),o(k)},style:{minHeight:56}})]}),(0,$.jsxs)(p.Muted,{center:!0,children:["Saved with your name and the time, e.g. \u201cAdded later by you, ",M(e),"\u201d. Nothing is sent to anyone."]})]}),(0,$.jsx)(D.LookBackCalendar,{visible:h,today:e,selected:m?n:k,purpose:"Cash up for another day",idPrefix:"cashup-backdate",onClose:()=>u(!1),onPick:e=>{w(e),u(!1)}})]})}function Y({n:e,testID:t}){const s=Math.max(1,Math.min(14,e));return(0,$.jsx)(c.default,{testID:t,style:{width:64,height:114,justifyContent:'flex-end'},children:Array.from({length:s}).map((e,t)=>(0,$.jsx)(H,{delay:50*t},t))})}function H({delay:e}){const t=(0,l.useRef)(new r.default.Value(1)).current;return(0,l.useEffect)(()=>{r.default.timing(t,{toValue:0,duration:420,delay:e,easing:i.default.out(i.default.back(1.6)),useNativeDriver:!1}).start()},[]),(0,$.jsx)(r.default.View,{style:{height:7,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[0,-120]})}],opacity:t.interpolate({inputRange:[0,1],outputRange:[1,0]})},children:(0,$.jsx)(c.default,{style:{width:60,height:12,borderRadius:30,backgroundColor:y.colours.gold,borderWidth:1,borderColor:y.colours.goldLight}})})}function G(e){const[t,s]=(0,l.useState)(e),a=(0,l.useRef)(e);return(0,l.useEffect)(()=>{const t=a.current,o=e;if(t===o)return;const l=Date.now(),n=setInterval(()=>{const e=Math.min(1,(Date.now()-l)/1200);s(Math.round(100*(t+(o-t)*(1-Math.pow(1-e,3))))/100),e>=1&&(clearInterval(n),a.current=o)},40);return()=>clearInterval(n)},[e]),t}function V({rid:e,today:t,manage:s,who:a,big:o}){const n=(0,f.useTipsShow)(e),r=(0,f.useCashUp)(e=>e.tips).filter(t=>t.rid===e),i=(0,f.useCashUp)(e=>e.pot).filter(t=>t.rid===e),d=(0,b.useVenuePay)(e).pay,h=(0,k.tipsPeriod)(d,t),u=(0,l.useMemo)(()=>(0,x.tipsPot)(r,i,h.start,t),[r,i,h.start,t]),m=G(u.total),[j,w]=(0,l.useState)(null);return n.showPot||s?(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsxs)(c.default,{testID:"tips-pot",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,$.jsx)(Y,{n:Math.ceil(u.total/100),testID:"tips-pot-coins"},u.total),(0,$.jsxs)(c.default,{style:{flex:1,gap:2},children:[(0,$.jsx)(p.T,{size:12,weight:"semibold",colour:y.colours.gold,style:{letterSpacing:1.5},children:"TIPS POT"}),(0,$.jsx)(p.T,{size:o?40:32,weight:"bold",colour:y.colours.goldLight,children:P(m)}),(0,$.jsxs)(p.Muted,{children:["Tips held for the team since ",M(u.from),h.payday?` \xb7 next tip payday ${M(h.payday)}`:'',". Confirmed cash ups only.",n.showPot?'':' (Hidden from staff.)']})]})]}),s?(0,$.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"secondary",testID:"pot-payout",label:"Mark payout done",onPress:()=>w('payout')}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:"pot-correct",label:"Correct an entry",onPress:()=>w('correct')}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:"pot-history",label:"Past pots",onPress:()=>w('history')})]}):null,'payout'===j?(0,$.jsxs)(p.Sheet,{visible:!0,onClose:()=>w(null),title:"Mark payout done",maxWidth:520,testID:"pot-payout-sheet",children:[(0,$.jsxs)(p.T,{children:["Pay out ",P(u.total)," (tips from ",M(u.from)," to ",M(t),")?"]}),(0,$.jsx)(p.Muted,{children:"The pot goes back to \xa30.00 for the next period. This is logged and kept in Past pots. No money is moved by the app."}),(0,$.jsx)(p.Button,{testID:"pot-payout-confirm",label:"Yes, payout done",onPress:()=>{f.useCashUp.getState().addPotEvent({rid:e,kind:'payout',throughDate:t,amount:u.total,by:a?.name??'Manager'}),w(null)}})]}):null,'correct'===j?(0,$.jsx)(_,{rid:e,today:t,who:a,onClose:()=>w(null)}):null,'history'===j?(0,$.jsxs)(p.Sheet,{visible:!0,onClose:()=>w(null),title:"Past pots and corrections",maxWidth:560,testID:"pot-history-sheet",children:[u.history.length||i.some(e=>'correction'===e.kind)?null:(0,$.jsx)(p.Muted,{children:"No payouts or corrections yet."}),i.slice().sort((e,t)=>t.at.localeCompare(e.at)).map(e=>(0,$.jsxs)(c.default,{style:{paddingVertical:4},children:[(0,$.jsx)(p.T,{weight:"semibold",children:'payout'===e.kind?`Paid out ${P(e.amount)}`:`Correction ${e.amount>=0?'+':'\u2212'}${P(Math.abs(e.amount))} for ${M(e.forDate)}`}),(0,$.jsxs)(p.Muted,{children:['payout'===e.kind?`Tips to ${M(e.throughDate)}`:`\u201c${e.reason}\u201d`," \xb7 ",e.by," \xb7 ",new Date(e.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]})]},e.id))]}):null]}):null}function _({rid:e,today:s,who:a,onClose:n}){const[r,i]=(0,l.useState)(s),[d,h]=(0,l.useState)(''),[c,u]=(0,l.useState)(''),m=(0,x.parseAmount)(d),k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',backgroundColor:(0,t.soutersSurface)('#141312'),color:y.colours.text,paddingHorizontal:10,fontSize:16};return(0,$.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Correct an entry",maxWidth:520,testID:"pot-correct-sheet",children:[(0,$.jsx)(p.Muted,{children:"Tip: add or take off an amount for a day (use a minus for less, e.g. -5). Every correction is logged with your name and the reason."}),(0,$.jsx)(p.Row,{wrap:!0,gap:6,children:[0,1,2,3].map(e=>{const t=(0,x.addDaysYmd)(s,-e);return(0,$.jsx)(p.Chip,{label:0===e?'Today':M(t),selected:r===t,onPress:()=>i(t)},t)})}),(0,$.jsx)(o.TextInput,{testID:"pot-correct-amount",value:d,onChangeText:h,placeholder:"\xa3 e.g. -5.00",placeholderTextColor:"#777",keyboardType:"numbers-and-punctuation",style:k}),(0,$.jsx)(o.TextInput,{testID:"pot-correct-reason",value:c,onChangeText:u,placeholder:"Reason (required)",placeholderTextColor:"#777",maxLength:200,style:k}),(0,$.jsx)(p.Button,{testID:"pot-correct-save",label:"Save correction",disabled:null==m||0===m||!c.trim(),onPress:()=>{f.useCashUp.getState().addPotEvent({rid:e,kind:'correction',forDate:r,amount:m,reason:c.trim(),by:a?.name??'Manager'}),n()}})]})}function K(e,t,s,a){if(!Number.isFinite(s))return;const o=`${e}:${t}`;f.useCashUp.getState().seen[o]!==s&&(f.useCashUp.getState().markSeen(o,s),(0,j.notify)({id:`tips-${o}`,icon:'\ud83e\ude99',kicker:'TIPS',title:`${t===a?'Today\u2019s':'Last night\u2019s'} tips: ${P(s)}`,body:'Cash + card tips for the whole team. Added to the Tips pot. Thank you, everyone.',testID:'tips-notice',timeoutMs:12e3,actions:[{label:'Nice',testID:'tips-notice-ok',onPress:()=>{}}]}))}function Z(e,t,s){return e.filter(e=>e.rid===t&&e.date>=(0,x.addDaysYmd)(s,-1)&&e.date<=s).sort((e,t)=>t.date.localeCompare(e.date))[0]}},1044,[931,834,835,873,31,119,121,225,197,264,128,288,818,825,1046,878,13,1182,1183,978,1068,1401,1402,1405,1406,1407,1174,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useCashAccess",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"hasCashUpAccess",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({byRef:{},mine:null,loaded:!1,takings:null,tradingDate:null,photos:null})),n=()=>!0===t.getState().mine},1045,[993]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"cashUpId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"salesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"cashSettingsId",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"defaultCashSettings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useCashUp",{enumerable:!0,get:function(){return b}}),_e.forgetPastTakings=function(e,t){const s=b.getState(),n=s.cashUps.filter(s=>s.rid!==e||s.date===t),r=s.sales.filter(t=>t.rid!==e);n.length===s.cashUps.length&&r.length===s.sales.length||b.setState({cashUps:n,sales:r})},Object.defineProperty(_e,"useCashSettings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useTipsShow",{enumerable:!0,get:function(){return y}});var t=e(_r(d[0])),s=e(_r(d[1])),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]),u=_r(d[5]),l=_r(d[6]);const c=(e,t)=>(0,o.uuidFrom)(`cashup:${e}:${t}`),p=(e,t)=>(0,o.uuidFrom)(`sales:${e}:${t}`),h=e=>(0,o.uuidFrom)(`cashup-settings:${e}`),f=e=>({id:h(e),cashFields:u.DEFAULT_CASHUP_FIELDS.map(e=>({...e})),salesFields:u.DEFAULT_SALES_FIELDS.map(e=>({...e}))}),S=e=>{const t='number'==typeof e.vals.cashTips?e.vals.cashTips:null,s='number'==typeof e.vals.cardTips?e.vals.cardTips:null;return!e.confirmedAt||null==t&&null==s?null:{rid:e.rid,date:e.date,total:Math.round(100*((t??0)+(s??0)))/100,postedAt:e.confirmedAt,postedBy:e.confirmedBy}},b=(0,n.create)()((0,r.persist)((e,t)=>({cashUps:[],sales:[],tips:[],pot:[],settings:{},show:{},seen:{},saveCashUp:t=>{const s={...t,id:c(t.rid,t.date)},n=S(s);return e(e=>({cashUps:[s,...e.cashUps.filter(e=>e.id!==s.id)],tips:n?[n,...e.tips.filter(e=>!(e.rid===n.rid&&e.date===n.date))]:e.tips})),s},saveSales:t=>{const s={...t,id:p(t.rid,t.weekStart)};return e(e=>({sales:[s,...e.sales.filter(e=>e.id!==s.id)]})),s},setFields:(t,s,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??f(t),[s]:n,updatedAt:(new Date).toISOString()}}})),resetFields:t=>e(e=>({settings:{...e.settings,[t]:{...f(t),updatedAt:(new Date).toISOString()}}})),setShow:(t,s)=>e(e=>({show:{...e.show,[t]:{...e.show[t]??{showToday:!0,showPot:!0},...s}}})),addPotEvent:t=>e(e=>({pot:[{...t,id:(0,l.uuid)(),at:(new Date).toISOString()},...e.pot]})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:s}}))}),{name:'covercharge-cashup-v1',storage:(0,r.createJSONStorage)(()=>s.default),partialize:e=>({...e,cashUps:e.cashUps.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))})),sales:e.sales.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))}))})}));const w=e=>{const s=b(t=>t.settings[e])??f(e);return t.default.useMemo(()=>({...s,cashFields:(0,u.withTakingsFields)(s.cashFields)}),[s])},y=e=>b(t=>t.show[e])??{showToday:!0,showPot:!0}},1046,[31,1188,993,1189,1177,13,1097]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PERM_CATALOG",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PERM_KEYS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PERM_GROUPS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"permLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ROLE_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ROLE_LABEL",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ownerLevel",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"has",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ticks",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"toggle",{enumerable:!0,get:function(){return f}}),e.effectivePerms=function(t,n,a){const o=[...new Set([...t,...n])];return(o.includes('*')?o:o.filter(t=>!a.includes(t))).sort()},e.tickSource=function(t,n){return t.extra.includes(n)?'extra':t.removed.includes(n)&&!t.base.includes('*')?'removed':c(t.base,n)?'role':'off'},Object.defineProperty(e,"SOURCE_WORDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"isCloser",{enumerable:!0,get:function(){return p}}),e.tradingDay=function(t=new Date,n="Europe/London"){const a=new Date(t.getTime()-216e5),o=new Intl.DateTimeFormat('en-GB',{timeZone:n,year:'numeric',month:'2-digit',day:'2-digit'}).formatToParts(a),s=t=>o.find(n=>n.type===t)?.value??'';return`${s('year')}-${s('month')}-${s('day')}`},Object.defineProperty(e,"ukDay",{enumerable:!0,get:function(){return b}}),e.logWords=function(t){const n=t=>Array.isArray(t)?t:[],a=t=>t&&'object'==typeof t&&!Array.isArray(t)?t:{};let s=[],u=[];if('role'===t.target_kind){const a=n(t.before),o=n(t.after);s=o.filter(t=>!a.includes(t)),u=a.filter(t=>!o.includes(t))}else{const o=a(t.before),l=a(t.after),c=n(o.extra),g=n(l.extra),f=n(o.removed),d=n(l.removed);s=[...g.filter(t=>!c.includes(t)),...f.filter(t=>!d.includes(t))],u=[...d.filter(t=>!f.includes(t)),...c.filter(t=>!g.includes(t))]}const c='role'===t.target_kind?`${l[t.target_ref??'']??t.target_name??'Role'} role`:t.target_name??'Someone',g=[...s.map(t=>`+ ${o(t)}`),...u.map(t=>`\u2212 ${o(t)}`)];return`${t.changed_by_name??'Admin'}: ${c}${g.length?`, ${g.join(', ')}`:', back to their role'}`},e.logWhen=function(t){const n=new Date(t);return new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',year:'numeric',hour:'2-digit',minute:'2-digit',hour12:!1}).format(n).replace(',','')};const t=[{key:'bookings.manage',label:'Take and change bookings',group:'Bookings & floor'},{key:'bookings.settings',label:'Booking settings: times, tables and blocks',group:'Bookings & floor'},{key:'floor.manage',label:'Edit the table plan and seat tables',group:'Bookings & floor'},{key:'orders.manage',label:'Kitchen and table orders',group:'Bookings & floor'},{key:'stock.manage',label:'Stock and deliveries',group:'Kitchen & stock'},{key:'suppliers.manage',label:'Suppliers',group:'Kitchen & stock'},{key:'suppliers.order',label:'Order from suppliers',group:'Kitchen & stock'},{key:'recipes.edit',label:'Edit recipe cards and allergens',group:'Kitchen & stock'},{key:'recipes.signoff',label:'Sign off recipe cards',group:'Kitchen & stock'},{key:'attendance.view',label:'See everyone\u2019s hours',group:'Team'},{key:'rota.manage',label:'Make the rota and approve timesheets',group:'Team'},{key:'rota.kitchen',label:'Make the kitchen rota (kitchen team only)',group:'Team',note:'Add, change and publish shifts for the kitchen team in the Head Chef app. No hours, pay or takings.'},{key:'rota.swap',label:'Approve shift swaps',group:'Team'},{key:'shift.manager',label:'Shift manager features in the Staff app',group:'Team'},{key:'staff.manage',label:'Add staff and change their details',group:'Team'},{key:'takings.view',label:'See takings, past cash ups and sales reports',group:'Money',note:'Without this, \u201cCan use cash up\u201d is tonight\u2019s cash up only.'},{key:'wages.view',label:'See pay and wages',group:'Money'},{key:'wages.manage',label:'Change pay, cash-up settings and any day\u2019s cash up',group:'Money'},{key:'venue.settings',label:'Change venue settings',group:'Venue'},{key:'devices.manage',label:'Pair and remove screens',group:'Venue'},{key:'outbox.view',label:'See messages sent to guests',group:'Venue'}],n=t.map(t=>t.key),a=[...new Set(t.map(t=>t.group))],o=n=>t.find(t=>t.key===n)?.label??n,s=['owner','manager','supervisor','head_chef','staff'],l={owner:'Owner',manager:'Manager',supervisor:'Supervisor',head_chef:'Head Chef',staff:'Staff'},u=t=>t.includes('*'),c=(t,n)=>t.includes('*')||t.includes(n),g=t=>u(t)?[...n]:n.filter(n=>t.includes(n)),f=(t,n,a)=>(a?[...new Set([...t,n])]:t.filter(t=>t!==n)).sort();const d={role:'from their role',extra:'added just for them',removed:'taken off just for them',off:'off'},p=t=>t.cashUp&&!t.takings;const b=t=>/^\d{4}-\d{2}-\d{2}$/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t},1047,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtDate",{enumerable:!0,get:function(){return j}}),_e.SignOffLine=$,_e.CardView=P,_e.CardEditor=R,_e.RecipeCards=function({rid:e,actor:s,mode:l}){const h=(0,a.useRecipeCards)(e),u=(0,n.useMemo)(()=>h.filter(e=>!c.OFF_CARD_LIST.has(e.menuItemId)),[h]),[p,x]=(0,n.useState)(''),[b,j]=(0,n.useState)([]),[C,w]=(0,n.useState)('free-from'),[I,$]=(0,n.useState)('all'),[D,T]=(0,n.useState)(null),[k,S]=(0,n.useState)(null),v='edit'===l&&(0,m.canEditCards)(s.role),B=v?u:u.filter(e=>!!e.signOff),L=(0,n.useMemo)(()=>{const e='all'===I?B:B.filter(e=>(0,m.cardState)(e)===I);return(0,m.filterCards)(e,p,b,C).slice().sort((e,t)=>e.section.localeCompare(t.section)||M(e.dish).localeCompare(M(t.dish)))},[B,p,b,C,I]),O=u.filter(e=>!e.signOff).length,A=D?u.find(e=>e.id===D):void 0,N=k&&'new'!==k?u.find(e=>e.id===k)??null:null,z=e=>j(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,y.jsxs)(r.default,{testID:"recipe-cards",style:{gap:12},children:['read'===l?(0,y.jsx)(d.Banner,{kind:"info",title:"Read-only",children:"Signed-off recipe cards only. The head chef keeps these up to date."}):(0,y.jsx)(d.Muted,{center:!0,children:(0,m.maySignOff)(s,{createdBy:s.name,createdByRole:s.role})?'You can add, edit and sign off cards. A card goes live once it is signed off. Editing a card clears the sign-off.':'You can add and edit cards. The Head Chef, an owner or a manager signs it off before it goes live. Editing a card clears the sign-off.'}),u.some(e=>'example'===e.origin)?(0,y.jsx)(d.Banner,{kind:"example",title:"Example data",children:"Cards marked \u201cExample data\u201d are made-up examples to show how recipe cards work. Replace them with your own dishes."}):null,v?(0,y.jsx)(d.Button,{testID:"new-card",label:"New recipe card",onPress:()=>S('new')}):null,(0,y.jsx)(t.TextInput,{testID:"card-search",accessibilityLabel:"Search recipe cards",value:p,onChangeText:x,placeholder:"Search dishes or ingredients",placeholderTextColor:"#7D776C",style:d.styles.input}),(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.T,{size:o.font.small,colour:o.colours.muted,children:"Allergens:"}),(0,y.jsx)(d.Chip,{label:"Free from",selected:'free-from'===C,onPress:()=>w('free-from')}),(0,y.jsx)(d.Chip,{label:"Contains",selected:'contains'===C,onPress:()=>w('contains')}),b.length?(0,y.jsx)(d.Chip,{label:"Clear",onPress:()=>j([])}):null]}),(0,y.jsx)(d.Row,{gap:6,wrap:!0,children:f.ALLERGENS.map(e=>(0,y.jsx)(i.default,{testID:`filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:b.includes(e.id)},onPress:()=>z(e.id),style:{paddingVertical:5,paddingHorizontal:10,minHeight:44,minWidth:44,justifyContent:'center',borderRadius:14,borderWidth:1,borderColor:b.includes(e.id)?o.colours.gold:o.colours.border,backgroundColor:b.includes(e.id)?o.colours.gold:'transparent'},children:(0,y.jsx)(d.T,{size:13,colour:b.includes(e.id)?o.colours.onGold:o.colours.text,children:e.short})},e.id))}),v?(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.Chip,{label:`All (${u.length})`,selected:'all'===I,onPress:()=>$('all')}),(0,y.jsx)(d.Chip,{label:`Awaiting sign-off (${O})`,selected:'awaiting'===I,onPress:()=>$('awaiting')}),(0,y.jsx)(d.Chip,{label:`Signed off (${u.length-O})`,selected:'signed-off'===I,onPress:()=>$('signed-off')})]}):null,(0,y.jsx)(r.default,{testID:"card-count",children:(0,y.jsxs)(d.Muted,{center:!0,children:[L.length," ",1===L.length?'card':'cards',b.length?` ${'free-from'===C?'free from':'containing'} ${b.map(f.allergenLabel).join('free-from'===C?' and ':' or ')}`:'']})}),L.map(e=>(0,y.jsx)(E,{c:e,actor:s,mode:l,editable:v,onPress:()=>T(e.id)},e.id)),L.length?null:(0,y.jsx)(r.default,{testID:"cards-empty",style:{alignItems:'center',paddingVertical:16},children:(0,y.jsx)(d.T,{center:!0,colour:o.colours.muted,children:u.length?'No cards match.':'No recipe cards yet.'})}),(0,y.jsx)(d.Sheet,{visible:!!A&&!k,onClose:()=>T(null),title:A?.dish??'',maxWidth:640,testID:"card-sheet",children:A?(0,y.jsx)(P,{card:A,mode:l,actor:'read'===l?{...s,role:'staff'}:s,onEdit:v?()=>S(A.id):void 0}):null}),(0,y.jsx)(d.Sheet,{visible:!!k,onClose:()=>S(null),title:'new'===k?'New recipe card':`Edit: ${N?.dish??''}`,maxWidth:680,testID:"editor-sheet",children:k?(0,y.jsx)(R,{rid:e,card:N,actor:s,onDone:e=>{S(null),T(e)}},k):null})]})},Object.defineProperty(_e,"addedLabel",{enumerable:!0,get:function(){return m.addedLabel}}),Object.defineProperty(_e,"allergenSentence",{enumerable:!0,get:function(){return m.allergenSentence}}),Object.defineProperty(_e,"unsignedOldestFirst",{enumerable:!0,get:function(){return m.unsignedOldestFirst}}),_e.useUnsignedDishes=O,_e.UnsignedDishList=function({rid:e,actor:t,onClose:s,onOpenCards:l}){const i=O(e),c=(0,a.useRecipeCards)(e),[f,p]=(0,n.useState)(null),[x,b]=(0,n.useState)(null),[j,C]=(0,n.useState)(null);(0,h.useBackLayer)(!0,s);const w=x?c.find(e=>e.id===x):void 0,I=j?c.find(e=>e.id===j)??null:null,$=async e=>{try{await(0,u.recipeCards)().signOff(e.id,t),p(null)}catch(t){p({id:e.id,text:t?.message??'Could not sign off.'})}};return(0,y.jsxs)(r.default,{testID:"unsigned-list",style:{gap:12,alignItems:'stretch'},children:[(0,y.jsx)(h.BackButton,{onPress:s,testID:"unsigned-back"}),(0,y.jsx)(d.T,{center:!0,size:22,weight:"bold",colour:o.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Dishes not signed off"}),(0,y.jsx)(d.Muted,{center:!0,testID:"unsigned-status",children:i.length?`${i.length} ${1===i.length?'dish':'dishes'} waiting, oldest first.`:'Every dish is signed off.'}),i.map(({item:e,card:s,at:n})=>{const i=(0,m.allergenSentence)(s?s.allergens:e.allergens),a=!!s&&(0,m.maySignOff)(t,s),c=s?(0,m.signOffBlock)(s):null;return(0,y.jsxs)(d.Card,{highlight:o.colours.amber,style:{alignItems:'center',gap:8},children:[(0,y.jsxs)(r.default,{testID:`unsigned-row-${e.id}`,accessible:!0,accessibilityLabel:`${e.name}, ${(0,m.addedLabel)(n)}, ${i}`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,y.jsx)(d.T,{center:!0,weight:"bold",size:18,children:e.name}),(0,y.jsx)(d.T,{center:!0,children:(0,m.addedLabel)(n)}),(0,y.jsx)(d.Muted,{center:!0,children:i})]}),s&&a&&!c?(0,y.jsx)(d.Button,{testID:`unsigned-sign-${e.id}`,kind:"success",label:"Sign off",accessibilityLabel:`Sign off ${e.name} as ${t.name}`,onPress:()=>$(s),style:{alignSelf:'stretch'}}):null,s&&a&&c?(0,y.jsx)(d.Muted,{center:!0,children:c}):null,s&&!a?(0,y.jsx)(d.Muted,{center:!0,children:"Only the Head Chef, an owner or a manager can sign it off."}):null,s?(0,y.jsx)(d.Button,{small:!0,kind:"secondary",testID:`unsigned-open-${e.id}`,label:a&&c?'Check the recipe card':'Open recipe card',accessibilityLabel:`Open the recipe card for ${e.name}`,onPress:()=>b(s.id),style:{alignSelf:'stretch'}}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d.Muted,{center:!0,children:"No recipe card yet."}),l?(0,y.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open recipe cards",onPress:l,style:{alignSelf:'stretch'}}):null]}),f&&s&&f.id===s.id?(0,y.jsx)(d.Banner,{kind:"danger",children:f.text}):null]},e.id)}),(0,y.jsx)(d.Sheet,{visible:!!w&&!j,onClose:()=>b(null),title:w?.dish??'',maxWidth:640,testID:"unsigned-card-sheet",children:w?(0,y.jsx)(P,{card:w,actor:t,onEdit:(0,m.canEditCards)(t.role)?()=>C(w.id):void 0}):null}),(0,y.jsx)(d.Sheet,{visible:!!j,onClose:()=>C(null),title:`Edit: ${I?.dish??''}`,maxWidth:680,testID:"unsigned-editor-sheet",children:j&&I?(0,y.jsx)(R,{rid:e,card:I,actor:t,onDone:e=>{C(null),b(e)}},j):null})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),l=e(_r(_d[3])),i=e(_r(_d[4])),r=e(_r(_d[5])),o=_r(_d[6]),d=_r(_d[7]),a=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]);const j=e=>{const t=new Date(e.length<=10?`${e}T12:00:00`:e);return isNaN(+t)?e:t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})},C=e=>`\xa3${(Math.round(e)/100).toFixed(2)}`,w=e=>null==e?'Price on the board':C(e),I={example:p.EXAMPLE_TAG,imported:'Imported from the menu',new:null};function $({card:e,testID:t}){return e.signOff?(0,y.jsx)(r.default,{testID:t??'card-signed-off',accessibilityLabel:`Signed off by ${e.signOff.by}, ${j(e.signOff.at)}`,style:{alignItems:'center',gap:4,width:'100%'},children:(0,y.jsxs)(d.T,{center:!0,weight:"bold",colour:o.colours.gold,children:["Signed off by ",e.signOff.by,", ",j(e.signOff.at)]})}):(0,y.jsxs)(r.default,{testID:t??'card-signed-off',accessibilityLabel:"Not signed off yet",style:{alignItems:'center',gap:4,width:'100%'},children:[(0,y.jsx)(d.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:m.STATE_LABEL.awaiting}),(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,children:c.portionCardItemIds.includes(e.menuItemId)?'A portion card for the kitchen. The dish on the menu is not changed by this card.':e.wasLive?'Edited since the last sign-off. Guests see it as awaiting sign-off until a chef signs it again.':'This dish stays off the menu until a chef signs it off.'})]})}function D({dish:e,photo:t,height:s=180,pending:n,index:i,total:a,radius:c=12}){const h=n?{uri:n}:t?(0,u.recipeCards)().photoSource(t):null,f=i&&a?`Photo ${i} of ${a}`:'Plating photo';return h?(0,y.jsx)(l.default,{testID:i?`card-photo-${i}`:'card-photo',accessibilityLabel:`${f}${e?`: ${e}`:''}`,source:h,style:{width:'100%',height:s,borderRadius:c,backgroundColor:o.colours.surface2},resizeMode:"cover"}):(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:"No plating photo yet"+(e?`, ${e}`:''),style:{width:'100%',height:s,borderRadius:c,backgroundColor:o.colours.goldTint,alignItems:'center',justifyContent:'center',borderWidth:1.5,borderColor:o.colours.gold,gap:2},children:[(0,y.jsx)(d.T,{center:!0,size:Math.min(64,Math.max(30,Math.round(.38*s))),weight:"bold",colour:o.colours.gold,children:(e.trim()[0]??'?').toUpperCase()}),s>=120?(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:o.colours.goldLight,children:"No plating photo yet"}):null]})}function T({map:e}){const t=f.ALLERGENS.filter(t=>e[t.id]).map(e=>e.id);return t.length?(0,y.jsx)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:t.map(t=>{const s='may'===e[t],n=s?`May contain ${(0,f.allergenLabel)(t).toLowerCase()}`:(0,f.allergenLabel)(t);return(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:s?n:`Contains ${(0,f.allergenLabel)(t).toLowerCase()}`,style:{paddingHorizontal:12,paddingVertical:6,borderRadius:999,borderWidth:1.5,borderColor:s?o.colours.amber:o.colours.gold,backgroundColor:s?'transparent':o.colours.gold,maxWidth:'100%'},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"semibold",center:!0,colour:s?o.colours.amber:o.colours.onGold,children:n})},t)})}):(0,y.jsx)(d.Muted,{center:!0,children:"None of the UK 14 allergens."})}const k=({label:e,gold:t,testID:s})=>(0,y.jsx)(r.default,{testID:s,style:{paddingHorizontal:12,paddingVertical:5,borderRadius:999,borderWidth:1,borderColor:t?o.colours.gold:o.colours.accentBorder,backgroundColor:t?o.colours.goldTint:o.colours.surface,maxWidth:'100%'},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"medium",center:!0,colour:t?o.colours.goldLight:o.colours.text,children:e})}),S=({title:e})=>(0,y.jsxs)(r.default,{style:{width:'100%',alignItems:'center',gap:4,paddingTop:4},children:[(0,y.jsx)(d.T,{size:13,weight:"semibold",center:!0,colour:o.colours.goldMuted,accessibilityRole:"header",children:e.toUpperCase()}),(0,y.jsx)(r.default,{style:{width:36,height:2,borderRadius:1,backgroundColor:o.colours.gold}})]});function P({card:e,actor:t,onEdit:s,mode:l="edit"}){const[i,a]=(0,n.useState)(null),c=(0,m.signOffBlock)(e),h=I[e.origin],f=(0,m.cardPhotos)(e),p=(0,m.maySignOff)(t,e),x=(0,b.useCardCosting)(e,t.role,l);return(0,y.jsxs)(r.default,{testID:"card-view",style:{gap:12,alignItems:'center',width:'100%'},children:[f.length?(0,y.jsx)(D,{dish:e.dish,photo:f[0],height:220,index:1,total:f.length,radius:18}):(0,y.jsx)(D,{dish:e.dish,height:180,radius:18}),f.length>1?(0,y.jsx)(d.Row,{gap:8,style:{width:'100%'},children:f.slice(1).map((t,s)=>(0,y.jsx)(r.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(D,{dish:e.dish,photo:t,height:72,index:s+2,total:f.length})},t))}):null,(0,y.jsx)(d.T,{center:!0,size:26,weight:"bold",colour:o.colours.gold,accessibilityRole:"header",children:e.dish}),(0,y.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[h?(0,y.jsx)(d.Badge,{label:h,kind:'example'===e.origin?'blue':'neutral'}):null,(0,y.jsx)(k,{label:e.section,gold:!0}),(0,y.jsx)(k,{label:w(e.price)}),x&&x.summary.lines.length?(0,y.jsx)(k,{testID:"card-yield",label:x.summary.batch/Math.max(1,x.summary.perPortion||1)>1.5?`Makes ${Math.round(x.summary.batch/x.summary.perPortion)} portions`:'1 portion'}):null]}),(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:`Created by ${e.createdBy||'not recorded'}`,style:{width:'100%',alignItems:'center'},children:(0,y.jsxs)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,testID:"card-created-by",children:["Created by ",e.createdBy||'Not recorded']})}),(0,y.jsx)(r.default,{style:{width:'100%',paddingVertical:8,paddingHorizontal:10,borderRadius:14,borderWidth:1,borderColor:e.signOff?o.colours.accentBorder:o.colours.amber,backgroundColor:e.signOff?o.colours.accentBg:o.colours.amberBg},children:(0,y.jsx)($,{card:e,testID:"card-status"})}),(0,y.jsx)(S,{title:"Allergens"}),(0,y.jsx)(r.default,{testID:"card-allergens",style:{width:'100%'},children:(0,y.jsx)(T,{map:e.allergens})}),e.allergenNotes?(0,y.jsx)(d.Muted,{center:!0,children:e.allergenNotes}):null,e.allergensConfirmed?(0,y.jsxs)(d.Muted,{center:!0,children:["Allergen list confirmed by ",e.allergensConfirmed.by," on ",j(e.allergensConfirmed.at),"."]}):null,(0,y.jsx)(S,{title:"Ingredients"}),e.ingredients.length?(0,y.jsx)(r.default,{testID:"card-ingredients",style:{width:'100%',borderRadius:14,borderWidth:1,borderColor:o.colours.border,backgroundColor:o.colours.surface,overflow:'hidden'},children:e.ingredients.map((e,t)=>{const s=[e.qty,e.unit].filter(Boolean).join(' '),n=x?.byRecipeIng[e.id];return(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}${s?`, ${s}`:''}${n?`, ${C(n.cost)}`:''}`,style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:10,paddingHorizontal:12,borderTopWidth:t?1:0,borderColor:o.colours.border,minHeight:48},children:[(0,y.jsx)(d.T,{style:{flex:1,minWidth:0},children:e.name}),(0,y.jsxs)(r.default,{style:{alignItems:'flex-end',flexShrink:0,maxWidth:'40%'},children:[(0,y.jsx)(d.T,{weight:"semibold",colour:o.colours.goldLight,style:{textAlign:'right'},children:s||'\u2013'}),n?(0,y.jsx)(d.T,{size:o.font.small,colour:o.colours.muted,style:{textAlign:'right'},children:C(n.cost)}):null]})]},e.id)})}):(0,y.jsx)(d.Muted,{center:!0,children:"No ingredients on this card yet."}),(0,y.jsx)(S,{title:"Method"}),e.steps.length?(0,y.jsx)(r.default,{testID:"card-method",style:{width:'100%',gap:10},children:e.steps.map((e,t)=>(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`Step ${t+1}. ${e}`,style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,y.jsx)(r.default,{style:{width:32,height:32,borderRadius:16,borderWidth:1.5,borderColor:o.colours.gold,backgroundColor:o.colours.goldTint,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"bold",colour:o.colours.gold,children:t+1})}),(0,y.jsx)(d.T,{style:{flex:1,minWidth:0,paddingTop:4},children:e})]},t))}):(0,y.jsxs)(d.Muted,{center:!0,children:["No method yet.",(0,m.canEditCards)(t.role)?' Tap Edit to add the steps.':'']}),(0,y.jsx)(b.CardGpPanel,{card:e,actor:t,mode:l}),(0,y.jsxs)(d.Muted,{center:!0,children:["Version ",e.version," \xb7 last changed ",j(e.updatedAt)," by ",e.updatedBy]}),(0,m.canEditCards)(t.role)&&s?(0,y.jsx)(d.Button,{testID:"edit-card",kind:"secondary",label:"Edit card",accessibilityLabel:`Edit ${e.dish}`,onPress:s,style:{alignSelf:'stretch'}}):null,p&&!e.signOff?(0,y.jsxs)(r.default,{style:{gap:6,width:'100%'},children:[c?(0,y.jsx)(d.Banner,{kind:"warn",title:"Not ready to sign off",children:c}):null,(0,y.jsx)(d.Button,{testID:"sign-off",kind:"success",label:`Sign off as ${t.name}`,accessibilityLabel:`Sign off ${e.dish} as ${t.name}`,disabled:!!c,onPress:async()=>{try{await(0,u.recipeCards)().signOff(e.id,t),a(null)}catch(e){a(e?.message??'Could not sign off.')}}})]}):null,!(0,m.canEditCards)(t.role)||p||e.signOff?null:(0,y.jsx)(d.Banner,{kind:"info",title:"Sign-off",children:"Only the Head Chef, an owner or a manager can sign it off."}),i?(0,y.jsx)(d.Banner,{kind:"danger",children:i}):null]})}const v=()=>`i-${Math.random().toString(36).slice(2,9)}`,B=(e,t,s)=>e?{id:e.id,dish:e.dish,section:e.section,price:null==e.price?'':(e.price/100).toFixed(2),description:'',createdBy:e.createdBy??'',ingredients:e.ingredients.map(e=>({...e})),steps:[...e.steps],allergens:{...e.allergens},dismissed:[...e.dismissed],allergenNotes:e.allergenNotes??'',photos:(0,m.cardPhotos)(e),pending:[],confirm:!!e.allergensConfirmed}:{id:(0,m.uuid)(),dish:'',section:t,price:'',description:'',createdBy:s,ingredients:[{id:v(),name:'',qty:'',unit:''}],steps:[''],allergens:{},dismissed:[],allergenNotes:'',photos:[],pending:[],confirm:!1},L=e=>{const t=e.replace(/[\xa3\s]/g,'');if(!t)return null;const s=Number(t);return isFinite(s)&&s>=0?Math.round(100*s):'bad'};function R({rid:e,card:l,actor:c,onDone:h}){const p=(0,a.useRestaurant)(e),b=p?.sections??['Mains'],[j,C]=(0,n.useState)(()=>B(l,b[0]??'Mains',c.name)),[w,I]=(0,n.useState)(null),[$,T]=(0,n.useState)(null),[k,S]=(0,n.useState)(!1),P=e=>C(t=>({...t,...e})),R=j.ingredients.filter(e=>e.name.trim()),M={ingredients:R,allergens:j.allergens,dismissed:j.dismissed},O=(0,m.suggestAllergens)(R),E=(0,m.unresolved)(M),A=e=>{const t=j.allergens[e],s={...j.allergens};t?'contains'===t?s[e]='may':delete s[e]:s[e]='contains',P({allergens:s,dismissed:j.dismissed.filter(t=>t!==e),confirm:!1})},N=e=>{const t={...j.allergens};delete t[e],P({allergens:t,dismissed:[...new Set([...j.dismissed,e])],confirm:!1})},z=(e,t)=>P({ingredients:j.ingredients.map((s,n)=>n===e?{...s,...t}:s),confirm:!1}),W=(e,t)=>P({steps:j.steps.map((s,n)=>n===e?t:s)}),H=(e,t)=>{const s=[...j.steps],n=e+t;n<0||n>=s.length||([s[e],s[n]]=[s[n],s[e]],P({steps:s}))},_=j.photos.length+j.pending.length,F=async e=>{if(T(null),_>=m.MAX_RECIPE_PHOTOS)T('A card can hold 5 photos.');else try{const t=await(0,x.capturePlatingPhoto)(e);t&&(P({pending:[...j.pending,t]}),T(`Photo ${_+1} of ${m.MAX_RECIPE_PHOTOS}. Compressed on this device: ${t.width}\xd7${t.height}, ${(0,x.kb)(t.bytes)}${t.originalBytes?` (was ${(0,x.kb)(t.originalBytes)})`:''}.`))}catch(e){T(e?.message??'Could not read that photo.')}},[G,V]=(0,n.useState)(!1),U=j.dish||l?.dish||'this dish';return(0,y.jsxs)(r.default,{testID:"card-editor",style:{gap:12},children:[l?.signOff?(0,y.jsx)(d.Banner,{kind:"warn",title:"Saving a change clears the sign-off",children:"This card is signed off. Any change you save clears it until the Head Chef, an owner or a manager signs it off again."}):null,(0,y.jsx)(d.Field,{testID:"dish-name",label:"Dish name",value:j.dish,onChangeText:e=>P({dish:e}),placeholder:"e.g. Cullen skink"}),(0,y.jsx)(d.Field,{testID:"card-created-by-field",label:"Created by",value:j.createdBy,onChangeText:e=>P({createdBy:e}),placeholder:"Chef's name"}),l?null:(0,y.jsx)(d.Field,{testID:"dish-description",label:"Menu description (optional)",value:j.description,onChangeText:e=>P({description:e}),placeholder:"What guests read on the menu"}),(0,y.jsx)(d.T,{size:o.font.small,weight:"medium",colour:o.colours.muted,children:"Menu section"}),(0,y.jsx)(d.Row,{wrap:!0,gap:6,children:b.map(e=>(0,y.jsx)(d.Chip,{label:e,selected:j.section===e,onPress:()=>P({section:e})},e))}),(0,y.jsx)(d.Field,{testID:"dish-price",label:"Price (\xa3)",value:j.price,onChangeText:e=>P({price:e}),placeholder:"Blank = price on the board",keyboardType:"decimal-pad"}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Photos"}),(0,y.jsx)(d.T,{center:!0,colour:o.colours.muted,children:"Up to 5 photos."}),(0,y.jsxs)(r.default,{testID:"card-photos",style:{gap:10,width:'100%',alignItems:'center'},children:[j.photos.map((e,t)=>(0,y.jsxs)(r.default,{style:{width:'100%',gap:6,alignItems:'center'},children:[(0,y.jsx)(D,{dish:U,photo:e,height:160,index:t+1,total:_||j.photos.length}),(0,y.jsx)(d.Button,{testID:`photo-remove-${t+1}`,kind:"ghost",label:`Remove photo ${t+1}`,accessibilityLabel:`Remove photo ${t+1} of ${U}`,onPress:()=>P({photos:j.photos.filter((e,s)=>s!==t)})})]},e)),j.pending.map((e,t)=>(0,y.jsxs)(r.default,{style:{width:'100%',gap:6,alignItems:'center'},children:[(0,y.jsx)(D,{dish:U,pending:e.dataUrl,height:160,index:j.photos.length+t+1,total:_}),(0,y.jsx)(d.Button,{testID:`photo-remove-new-${t+1}`,kind:"ghost",label:`Remove photo ${j.photos.length+t+1}`,accessibilityLabel:`Remove new photo ${j.photos.length+t+1}`,onPress:()=>P({pending:j.pending.filter((e,s)=>s!==t)})})]},`new-${t}`)),_?null:(0,y.jsx)(D,{dish:U,height:160})]}),(0,y.jsx)(d.Button,{testID:"photo-camera",kind:"secondary",label:"Take photo",accessibilityLabel:"Take a photo for this recipe card",disabled:_>=m.MAX_RECIPE_PHOTOS,onPress:()=>F('camera')}),(0,y.jsx)(d.Button,{testID:"photo-library",kind:"secondary",label:"Choose photo",accessibilityLabel:"Choose a photo for this recipe card",disabled:_>=m.MAX_RECIPE_PHOTOS,onPress:()=>F('library')}),$?(0,y.jsx)(r.default,{testID:"photo-info",children:(0,y.jsx)(d.Muted,{center:!0,children:$})}):(0,y.jsx)(d.Muted,{center:!0,children:'shared'===(0,u.recipeCards)().mode?'Photos are shrunk on this device, then shared with the team. Staff and guests only see them once the card is signed off.':'Photos are shrunk on this device before they are saved.'}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Ingredients"}),(0,y.jsx)(d.Muted,{children:"Quantity, unit and ingredient. We suggest allergens from the ingredient names."}),j.ingredients.map((e,n)=>{const l=e.name.trim()?(0,m.suggestAllergens)([e]):[];return(0,y.jsxs)(r.default,{style:{gap:4},children:[(0,y.jsxs)(d.Row,{gap:6,children:[(0,y.jsx)(t.TextInput,{testID:`ing-qty-${n}`,accessibilityLabel:`Quantity ${n+1}`,value:e.qty,onChangeText:e=>z(n,{qty:e}),placeholder:"Qty",placeholderTextColor:"#7D776C",style:[d.styles.input,{width:64}]}),(0,y.jsx)(t.TextInput,{testID:`ing-unit-${n}`,accessibilityLabel:`Unit ${n+1}`,value:e.unit,onChangeText:e=>z(n,{unit:e}),placeholder:"g / ml / each",placeholderTextColor:"#7D776C",style:[d.styles.input,{width:92}]}),(0,y.jsx)(t.TextInput,{testID:`ing-name-${n}`,accessibilityLabel:`Ingredient ${n+1}`,value:e.name,onChangeText:e=>z(n,{name:e}),placeholder:"Ingredient",placeholderTextColor:"#7D776C",style:[d.styles.input,{flex:1}]}),(0,y.jsx)(s.GoldClose,{size:"sm",label:`Remove ingredient ${n+1}`,onPress:()=>P({ingredients:j.ingredients.filter((e,t)=>t!==n)})})]}),l.length?(0,y.jsxs)(d.Muted,{children:["Suggests: ",l.map(f.allergenLabel).join(', ')]}):null]},e.id)}),(0,y.jsx)(d.Button,{testID:"ing-add",small:!0,kind:"ghost",label:"Add ingredient",onPress:()=>P({ingredients:[...j.ingredients,{id:v(),name:'',qty:'',unit:''}]})}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Method"}),j.steps.map((e,n)=>(0,y.jsxs)(d.Row,{gap:6,style:{alignItems:'flex-start'},children:[(0,y.jsx)(d.T,{colour:o.colours.gold,style:{width:20,paddingTop:10},children:n+1}),(0,y.jsx)(t.TextInput,{testID:`step-${n}`,accessibilityLabel:`Step ${n+1}`,value:e,onChangeText:e=>W(n,e),multiline:!0,placeholder:"Describe this step",placeholderTextColor:"#7D776C",style:[d.styles.input,{flex:1,minHeight:56,textAlignVertical:'top'}]}),(0,y.jsxs)(r.default,{style:{gap:4},children:[(0,y.jsx)(i.default,{accessibilityLabel:`Move step ${n+1} up`,onPress:()=>H(n,-1),hitSlop:6,children:(0,y.jsx)(d.T,{colour:o.colours.muted,children:"\u25b2"})}),(0,y.jsx)(i.default,{accessibilityLabel:`Move step ${n+1} down`,onPress:()=>H(n,1),hitSlop:6,children:(0,y.jsx)(d.T,{colour:o.colours.muted,children:"\u25bc"})}),(0,y.jsx)(s.GoldClose,{size:"sm",label:`Remove step ${n+1}`,onPress:()=>P({steps:j.steps.filter((e,t)=>t!==n)})})]})]},n)),(0,y.jsx)(d.Button,{testID:"step-add",small:!0,kind:"ghost",label:"Add step",onPress:()=>P({steps:[...j.steps,'']})}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Allergens (UK 14)"}),(0,y.jsx)(d.Muted,{children:"Tap to cycle: contains \u2192 may contain \u2192 none. Suggested allergens are marked \u201c?\u201d until you add or rule them out."}),E.length?(0,y.jsxs)(r.default,{testID:"allergen-suggestions",style:{gap:6},children:[(0,y.jsx)(d.Banner,{kind:"warn",title:`Check ${E.length} suggested allergen${1===E.length?'':'s'}`,children:E.map(e=>`${(0,f.allergenLabel)(e)} (from ${(0,m.suggestedBy)(R,e).join(', ')})`).join('; ')}),E.map(e=>(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.T,{style:{flex:1},children:(0,f.allergenLabel)(e)}),(0,y.jsx)(d.Button,{testID:`suggest-add-${e}`,small:!0,label:"Contains",onPress:()=>P({allergens:{...j.allergens,[e]:'contains'},confirm:!1})}),(0,y.jsx)(d.Button,{testID:`suggest-may-${e}`,small:!0,kind:"secondary",label:"May contain",onPress:()=>P({allergens:{...j.allergens,[e]:'may'},confirm:!1})}),(0,y.jsx)(d.Button,{testID:`suggest-dismiss-${e}`,small:!0,kind:"ghost",label:"Not in this dish",onPress:()=>N(e)})]},e)),(0,y.jsx)(d.Button,{testID:"apply-suggestions",small:!0,kind:"secondary",label:"Add all suggestions as \u2018contains\u2019",onPress:()=>{const e={...j.allergens};E.forEach(t=>{e[t]='contains'}),P({allergens:e,confirm:!1})}})]}):null,(0,y.jsx)(d.Row,{wrap:!0,gap:6,children:f.ALLERGENS.map(e=>{const t=j.allergens[e.id],s=O.includes(e.id)&&!t&&!j.dismissed.includes(e.id),n='contains'===t?o.colours.redBg:'may'===t?o.colours.amberBg:o.colours.surface2,l='contains'===t?o.colours.red:'may'===t?o.colours.amber:s?o.colours.gold:o.colours.border;return(0,y.jsx)(i.default,{testID:`allergen-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.short}: ${'contains'===t?'contains':'may'===t?'may contain':'not marked'}`,onPress:()=>A(e.id),style:{paddingVertical:6,paddingHorizontal:10,borderRadius:16,borderWidth:s?2:1,borderStyle:s?'dashed':'solid',borderColor:l,backgroundColor:n},children:(0,y.jsxs)(d.T,{size:o.font.small,colour:'contains'===t?'#FFD9D4':'may'===t?'#FFE2A8':o.colours.text,children:[e.short,'may'===t?' (may)':'',s?' ?':'']})},e.id)})}),j.dismissed.length?(0,y.jsxs)(d.Muted,{children:["Ruled out: ",j.dismissed.map(f.allergenLabel).join(', ')]}):null,(0,y.jsx)(d.Field,{testID:"allergen-notes",label:"Allergen notes (optional)",value:j.allergenNotes,onChangeText:e=>P({allergenNotes:e}),placeholder:"e.g. Cooked in the shared fryer"}),(0,y.jsxs)(i.default,{testID:"confirm-allergens",accessibilityRole:"checkbox",accessibilityState:{checked:j.confirm,disabled:E.length>0},disabled:E.length>0,onPress:()=>P({confirm:!j.confirm}),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:j.confirm?o.colours.ok:o.colours.border,opacity:E.length?.5:1},children:[(0,y.jsx)(r.default,{style:{width:22,height:22,borderRadius:4,borderWidth:2,borderColor:j.confirm?o.colours.ok:o.colours.muted,alignItems:'center',justifyContent:'center',backgroundColor:j.confirm?o.colours.okBg:'transparent'},children:j.confirm?(0,y.jsx)(d.T,{colour:o.colours.ok,children:"\u2713"}):null}),(0,y.jsx)(d.T,{style:{flex:1},children:E.length?'Check the suggested allergens above first':`I have checked the allergen list against the ingredients (${c.name})`})]}),w?(0,y.jsx)(d.Banner,{kind:"danger",children:w}):null,(0,y.jsx)(d.Button,{testID:"card-save",label:G?'Saving\u2026':l?'Save changes':'Save card',disabled:G,onPress:async()=>{I(null);const t=L(j.price);if(!j.dish.trim())return I('Give the dish a name.');if('bad'===t)return I('Price should be in pounds, e.g. 14.50 (or leave it blank for "price on the board").');const s=(0,u.recipeCards)();V(!0);try{const n=[...j.photos];for(const t of j.pending){if(n.length>=m.MAX_RECIPE_PHOTOS)break;n.push(await s.savePhoto(e,j.id,t))}const i=j.steps.map(e=>e.trim()).filter(Boolean),r=j.createdBy.trim(),o={dish:j.dish.trim(),section:j.section,price:t,ingredients:R.map(e=>({...e,name:e.name.trim(),qty:e.qty.trim(),unit:e.unit.trim()})),steps:i,allergens:j.allergens,dismissed:j.dismissed,allergenNotes:j.allergenNotes.trim()||void 0,photo:n[0],photos:n,createdBy:r||void 0};if(l)await s.update(l.id,{...o,confirmAllergens:j.confirm},c),h(l.id);else{const t=await s.create(e,{...o,id:j.id,description:j.description.trim()||void 0},c);j.confirm&&await s.update(t.id,{confirmAllergens:!0},c),h(t.id)}}catch(e){I(e?.message??'Could not save the card.')}finally{V(!1)}}}),(0,y.jsx)(d.Muted,{center:!0,children:(0,m.maySignOff)(c,{createdBy:j.createdBy||c.name,createdByRole:c.role})?'After saving, sign the card off so it goes live.':'After saving, the Head Chef, an owner or a manager signs it off before it goes live.'}),l?k?(0,y.jsxs)(d.Row,{gap:8,children:[(0,y.jsx)(d.Button,{testID:"card-delete-yes",small:!0,kind:"danger",label:"Yes, remove this dish",onPress:async()=>{if(l)try{await(0,u.recipeCards)().remove(l.id,c),h(null)}catch(e){I(e?.message??'Could not remove the card.')}}}),(0,y.jsx)(d.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>S(!1)})]}):(0,y.jsx)(d.Button,{testID:"card-delete",small:!0,kind:"ghost",label:"Remove card and dish from the menu",onPress:()=>S(!0)}):null]})}const M=e=>e.replace(/ \xb7 Starter$/,' \xb7 1').replace(/ \xb7 Main$/,' \xb7 2');function O(e){const t=(0,a.useAllMenu)(e),s=(0,a.useRecipeCards)(e);return(0,n.useMemo)(()=>{const e=new Map(s.map(e=>[e.menuItemId,e]));return(0,m.unsignedOldestFirst)(t,t=>e.get(t.id)??(t.recipeCardId?s.find(e=>e.id===t.recipeCardId):void 0))},[t,s])}function E({c:e,actor:t,mode:s,editable:n,onPress:l}){const a=(0,m.cardPhotos)(e),c=(0,b.useCardCosting)(e,'read'===s?'staff':t.role,s),h=f.ALLERGENS.filter(t=>e.allergens[t.id]).length,u=c?.summary.gp,x=c?.summary.tone,C='ok'===x?o.colours.ok:'amber'===x?o.colours.amber:'red'===x?o.colours.red:o.colours.muted,I=`${e.dish}, ${e.section}, ${w(e.price)}, ${h?`${h} allergen${1===h?'':'s'}`:'no allergens marked'}${null!=u?`, GP ${u.toFixed(1)} percent`:''}, created by ${e.createdBy||'not recorded'}, ${e.signOff?`signed off by ${e.signOff.by}`:'awaiting sign-off'}`;return(0,y.jsxs)(i.default,{testID:`card-${e.menuItemId}`,accessibilityRole:"button",accessibilityLabel:I,onPress:l,style:({pressed:t})=>({width:'100%',minHeight:48,flexDirection:'row',gap:12,alignItems:'center',padding:10,borderRadius:18,borderWidth:1,borderColor:!e.signOff&&n?o.colours.amber:o.colours.accentBorder,backgroundColor:t?o.colours.tilePressed:o.colours.tile}),children:[(0,y.jsx)(r.default,{style:{width:84,flexShrink:0},children:(0,y.jsx)(D,{dish:e.dish,photo:a[0],height:84,radius:14})}),(0,y.jsxs)(r.default,{style:{flex:1,minWidth:0,gap:4,alignItems:'center'},children:[(0,y.jsx)(d.T,{center:!0,weight:"bold",size:18,colour:o.colours.gold,children:e.dish}),(0,y.jsxs)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,children:[e.section," \xb7 ",w(e.price),'example'===e.origin?` \xb7 ${p.EXAMPLE_TAG}`:'']}),(0,y.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,y.jsx)(k,{label:h?`${h} allergen${1===h?'':'s'}`:'No allergens marked'}),null!=u?(0,y.jsx)(r.default,{testID:`card-gp-${e.menuItemId}`,style:{paddingHorizontal:10,paddingVertical:4,borderRadius:999,borderWidth:1.5,borderColor:C},children:(0,y.jsxs)(d.T,{size:o.font.small,weight:"bold",colour:C,children:["GP ",u.toFixed(1),"%"]})}):null]}),(0,y.jsxs)(d.T,{center:!0,size:o.font.small,testID:`card-created-${e.menuItemId}`,children:["Created by ",e.createdBy||'Not recorded']}),(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:e.signOff?o.colours.goldLight:o.colours.amber,children:e.signOff?`Signed off by ${e.signOff.by}, ${j(e.signOff.at)}`:m.STATE_LABEL.awaiting})]})]})}},1048,[873,835,31,197,264,128,825,818,823,1447,1040,839,819,1177,1217,1415,1448,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1049,[873,31,264,128,818,825,861,878,1079,1274,1275,25]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ChatAsCtx",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return w.dmId}}),Object.defineProperty(_e,"inChannel",{enumerable:!0,get:function(){return w.inChannel}}),_e.autoPost=function(e,t){const n=new Date(globalThis.__ccNow??Date.now()).toISOString();(Array.isArray(e)?e:[e]).forEach(e=>f.useOwner.getState().sys(e,t,n))},_e.ensureChat=D,_e.useChatUnread=A,Object.defineProperty(_e,"DISPLAY_DEVICE_ID",{enumerable:!0,get:function(){return B}}),_e.chatSender=L,_e.Chat=function({go:e}){return(0,O.jsx)(z,{children:(0,O.jsx)(K,{go:e})})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),a=r(d[3]),o=r(d[4]),i=r(d[5]),l=r(d[6]),c=e(r(d[7])),h=e(r(d[8])),u=e(r(d[9])),m=r(d[10]),f=r(d[11]),p=r(d[12]),b=r(d[13]),x=r(d[14]),j=r(d[15]),y=r(d[16]),w=r(d[17]),C=r(d[18]),v=r(d[19]),S=r(d[20]),k=r(d[21]),O=r(d[22]);const R=(0,i.createContext)(null);function I(e){const t=(0,x.useCtx)(e),n=(0,i.useContext)(R);return n?{...t,meId:n.meId,role:n.role}:t}const T=[{id:'all',name:'Team',icon:'\ud83d\udce2'},{id:'kitchen',name:'Kitchen',icon:'\ud83c\udf73',pinned:!0},{id:'foh',name:'Front of house',icon:'\ud83c\udf7d\ufe0f'},{id:'managers',name:'Managers',icon:'\ud83d\udd11'}],M=[],P=e=>(e??'').replace(' (example)','');function D(e){if(a.LIVE_VENUE_BUILD)return;if(o.IS_WILDINGS)return;const t=f.useOwner.getState();if(t.chat.some(e=>'m-seed-all'===e.id&&/this phone only/.test(e.text??''))&&f.useOwner.getState().chatPatch('m-seed-all',{text:'Welcome to the team chat on CoverCharge.'}),t.chat.length)return;const n=(t,n,s,a={})=>{return{id:`m-seed-${t}`,ch:t,from:'system',text:s,at:(o=n,new Date(e.getTime()-6e4*o).toISOString()),reactions:{},seenBy:[],...a};var o};f.useOwner.setState({chat:[n('all',5,'Welcome to the team chat on CoverCharge.',{pinned:!0}),n('kitchen',4,'Kitchen channel: Head Chef, kitchen team and managers.'),n('foh',3,'Front of house channel: front of house, bar and managers.'),n('managers',2,'Managers channel: owners, managers and the supervisor only.')]})}function A(){const{meId:e}=I(3e4),{role:t}=I(3e4),n=(0,f.useOwner)(e=>e.chat),s=(0,f.useOwner)(e=>e.staff),a=(0,f.useOwner)(t=>t.chatMuted[e]??M),o=(0,i.useMemo)(()=>E(s,e,t),[s,e,t]);return(0,i.useMemo)(()=>{const t={};return n.forEach(n=>{n.removed||n.from===e||n.seenBy.includes(e)||!(0,w.inChannel)(n.ch,o)||(t[n.ch]=(t[n.ch]??0)+1)}),{by:t,total:Object.entries(t).filter(([e])=>!a.includes(e)).reduce((e,[,t])=>e+t,0)}},[n,e,a,o])}function E(e,t,n){if(t===j.CAR_DEVICE_ID)return{id:t,name:j.CAR_ACTOR,role:'owner',job:'',active:!0,level:'Owner',dept:''};if('display-device'===t)return{id:t,name:'Display',role:'owner',job:'',active:!0,level:'Owner',dept:''};const s=e.find(e=>e.id===t);return s||!t?s:{id:t,name:'You',role:n,job:'',active:!0,level:'owner'===n?'Owner':'manager'===n?'Manager':'Staff',dept:''}}const B='display-device';function L(e,t){return e===j.CAR_DEVICE_ID?{id:e,name:j.CAR_ACTOR,role:'owner',job:'',active:!0,level:'Owner',dept:''}:e===B?{id:e,name:'Display',role:'owner',job:'',active:!0,level:'Owner',dept:''}:t.find(t=>t.id===e)}class z extends i.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message??e)}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.err&&this.setState({err:null})}render(){return this.state.err?(0,O.jsxs)(u.default,{style:{gap:10},testID:"chat-error",children:[(0,O.jsx)(m.Banner,{kind:"warn",title:"Chat couldn\u2019t open",children:"Something went wrong showing this chat. Your messages are still saved on this phone. Go back and try again; if it keeps happening, close and reopen the app."}),(0,O.jsx)(m.Button,{kind:"secondary",label:"Back to chats",onPress:()=>{this.setState({err:null}),this.props.onBack?.()}})]}):this.props.children}}const $={owner:b.colours.gold,manager:b.colours.blue,staff:'#7a6f5c'};function _({s:e,size:t=34}){return e?(0,O.jsx)(y.StaffAvatar,{id:e.id,size:t}):(0,O.jsx)(u.default,{style:{width:t,height:t,borderRadius:t/2,backgroundColor:(0,n.soutersSurface)('#333'),alignItems:'center',justifyContent:'center'},children:(0,O.jsx)(m.T,{size:.38*t,weight:"bold",colour:"#111",children:"CC"})})}const N=[{caption:'Specials board',tone:'#4A3A22'},{caption:'Plating: Cullen skink',tone:'#3E2A2A'},{caption:'Delivery arrived',tone:'#40362A'},{caption:'Spillage by the bar',tone:'#2E2E40'}],W=['\ud83d\udc4d','\u2764\ufe0f','\ud83d\ude04','\ud83d\udc4f','\ud83d\udd25'];function H({ch:e,go:a,back:o}){const{now:j,meId:S,role:R,today:M}=I(1e4),D=(0,f.useOwner)(e=>e.staff),A=(0,f.useOwner)(e=>e.chat),E=(0,f.useOwner)(e=>e.shifts),B=(0,f.useOwner)(e=>e.leave),z=A.filter(t=>t.ch===e).sort((e,t)=>e.at.localeCompare(t.at)),[H,K]=(D.find(e=>e.id===S),(0,i.useState)('')),[V,U]=(0,i.useState)(null),[Y,q]=(0,i.useState)(!1),[F,G]=(0,i.useState)(!1),J=e.startsWith('dm:')?e.split(':').slice(1).length:D.filter(t=>t.active&&(0,w.inChannel)(e,t)).length;(0,i.useEffect)(()=>{const t=f.useOwner.getState().chat.some(t=>t.ch===e&&t.from!==S&&!t.seenBy.includes(S));f.useOwner.getState().chatSeen(e,S),t&&(0,v.markChatRead)(S,e)},[e,S,z.length]);const Q=t=>f.useOwner.getState().chatSend({ch:e,from:S,at:j.toISOString(),...t});(0,l.useBackLayer)(!0,o);const X=z.filter(e=>e.pinned&&!e.removed),Z=e.startsWith('dm:')?D.find(t=>t.id===e.split(':').slice(1).find(e=>e!==S)):void 0,ee=Z?.name.replace(' (example)','')??T.find(t=>t.id===e)?.name??'Private message',te=t.AVATAR_OPTIONS.find(t=>t.id===('kitchen'===e?'spatula':'bar'===e?'espresso-martini':'waves')),ne=(0,C.useChatSync)(e=>e.synced),se=(0,k.workingShifts)(E,B).filter(e=>e.staffId===S&&e.published&&e.date>=M).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,10);return(0,O.jsxs)(u.default,{style:{gap:8},children:[(0,O.jsxs)(u.default,{testID:"chat-thread-header",style:{gap:6,alignItems:'center'},children:[(0,O.jsx)(u.default,{style:{alignSelf:'flex-start'},children:(0,O.jsx)(l.BackButton,{onPress:o,testID:"chat-thread-back"})}),Z?(0,O.jsx)(y.StaffAvatar,{id:Z.id,size:88}):(0,O.jsx)(c.default,{testID:"chat-group-avatar",source:{uri:te.dataUrl},style:{width:88,height:88},accessibilityLabel:`${ee} group avatar`}),(0,O.jsx)(m.T,{center:!0,weight:"semibold",size:22,children:ee}),(0,O.jsxs)(m.Muted,{center:!0,children:[J," ",1===J?'member':'members']})]}),X.map(e=>(0,O.jsxs)(m.Card,{highlight:b.colours.gold,children:[(0,O.jsxs)(m.T,{size:12,colour:b.colours.gold,children:["\ud83d\udccc ",'system'===e.from?'Pinned note':`Pinned by ${P(D.find(t=>t.id===e.from)?.name)}`]}),(0,O.jsx)(m.T,{size:14,children:e.text})]},e.id)),z.map((t,s)=>{const o=L(t.from,D),i=t.from===S,l=t.seenBy.filter(e=>e!==t.from).length,c=0===s||t.at.slice(0,10)!==z[s-1].at.slice(0,10);return'system'===t.from?(0,O.jsxs)(u.default,{style:{alignItems:'center',gap:2},children:[c?(0,O.jsx)(m.Muted,{children:(0,p.niceDate)(new Date(t.at))}):null,(0,O.jsx)(u.default,{style:{backgroundColor:(0,n.soutersSurface)('#1c1a14'),borderRadius:10,paddingHorizontal:10,paddingVertical:5,borderWidth:1,borderColor:b.colours.border},children:(0,O.jsxs)(m.T,{size:13,colour:/Allergy|86|Sold out/.test(t.text??'')?b.colours.amber:b.colours.muted,children:["CoverCharge \xb7 ",t.text," \xb7 ",(0,p.hm)(new Date(t.at))]})})]},t.id):(0,O.jsxs)(u.default,{style:{gap:2},children:[c?(0,O.jsx)(m.Muted,{center:!0,children:(0,p.niceDate)(new Date(t.at))}):null,(0,O.jsxs)(m.Row,{style:{alignItems:'flex-start',flexDirection:i?'row-reverse':'row'},children:[(0,O.jsx)(_,{s:o}),(0,O.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:`Message from ${o?.name}`,onPress:()=>U(V===t.id?null:t.id),style:{maxWidth:'78%',backgroundColor:i?'#3a2f12':b.colours.surface,borderRadius:14,padding:9,borderWidth:1,borderColor:t.pinned?b.colours.gold:b.colours.border,gap:3},children:[(0,O.jsxs)(m.Row,{gap:6,children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:o?$[o.role]:b.colours.muted,children:P(o?.name)}),(0,O.jsxs)(m.T,{size:11,colour:b.colours.muted,children:[o?f.ROLE_LABEL[o.role]:''," \xb7 ",(0,p.hm)(new Date(t.at))]})]}),t.removed?(0,O.jsx)(m.T,{size:14,colour:b.colours.muted,children:"Message removed by the owner"}):(0,O.jsxs)(O.Fragment,{children:[t.photo?(0,O.jsx)(u.default,{style:{width:200,height:120,borderRadius:10,backgroundColor:t.photo.tone,justifyContent:'flex-end',padding:6},children:(0,O.jsxs)(m.T,{size:12,children:[t.photo.caption," (example image)"]})}):null,t.text?(0,O.jsx)(m.T,{size:15,children:t.text}):null,'cover'===t.action?(0,O.jsx)(m.Button,{small:!0,kind:"secondary",label:"Open cover requests on the rota",onPress:()=>a('more','rota')}):null]}),Object.entries(t.reactions).filter(([,e])=>e.length).length?(0,O.jsx)(m.Row,{wrap:!0,gap:4,children:Object.entries(t.reactions).filter(([,e])=>e.length).map(([e,t])=>(0,O.jsx)(u.default,{style:{borderRadius:10,paddingHorizontal:6,backgroundColor:t.includes(S)?'#4a3c16':'#222'},children:(0,O.jsxs)(m.T,{size:12,children:[e," ",t.length]})},e))}):null,i?(0,O.jsx)(m.T,{size:11,colour:b.colours.muted,children:l?`Seen by ${l}`:'Sent'}):null]})]}),V!==t.id||t.removed?null:(0,O.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:i?'flex-end':'flex-start',paddingLeft:i?0:40},children:[W.map(e=>(0,O.jsx)(h.default,{accessibilityLabel:`React ${e}`,onPress:()=>{f.useOwner.getState().chatReact(t.id,e,S),U(null)},style:{padding:4},children:(0,O.jsx)(m.T,{size:20,children:e})},e)),'staff'===R||e.startsWith('dm:')?null:(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:t.pinned?'Unpin':'Pin',onPress:()=>{f.useOwner.getState().chatPatch(t.id,{pinned:!t.pinned}),U(null)}}),'owner'!==R||i?null:(0,O.jsx)(m.Button,{small:!0,kind:"danger",label:"Remove",onPress:()=>{f.useOwner.getState().chatPatch(t.id,{removed:!0,pinned:!1}),U(null)}})]})]},t.id)}),(0,O.jsxs)(m.Row,{gap:6,children:[(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Send a photo",onPress:()=>q(!0),style:{padding:8},children:(0,O.jsx)(m.T,{size:20,children:"\ud83c\udf9e\ufe0f"})}),(0,O.jsx)(s.TextInput,{accessibilityLabel:"Message",placeholder:`Message ${ee}`,placeholderTextColor:"#7D776C",value:H,onChangeText:K,style:[m.styles.input,{flex:1,minWidth:0,width:0}]}),(0,O.jsx)(m.Button,{small:!0,label:"Send",disabled:!H.trim(),onPress:()=>{Q({text:H.trim()}),K('')}})]}),(0,O.jsx)(m.Row,{wrap:!0,gap:6,children:(0,O.jsx)(m.Button,{small:!0,kind:"secondary",label:"Ask for shift cover",onPress:()=>G(!0)})}),ne?null:(0,O.jsx)(m.Muted,{center:!0,children:"Not shared yet: this message stays on this phone only. Nobody else will see it."}),(0,O.jsx)(m.Sheet,{visible:Y,onClose:()=>q(!1),title:"Send a photo",children:(0,O.jsx)(m.Row,{wrap:!0,gap:8,children:N.map(e=>(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.caption,onPress:()=>{Q({photo:e}),q(!1)},style:{width:'47%',height:100,borderRadius:10,backgroundColor:e.tone,justifyContent:'flex-end',padding:6},children:(0,O.jsx)(m.T,{size:12,children:e.caption})},e.caption))})}),(0,O.jsxs)(m.Sheet,{visible:F,onClose:()=>G(!1),title:"Ask for shift cover",children:[se.length?null:(0,O.jsx)(m.Muted,{children:"You have no shifts on the rota this week."}),se.map(e=>(0,O.jsx)(m.Button,{kind:"secondary",label:`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`,onPress:()=>{const t=`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`;f.useOwner.getState().addSwap({shiftId:e.id,fromId:S,kind:'cover',note:`Cover asked in chat for ${t}`}),Q({text:`Can anyone cover my ${t} shift? I\u2019ve added a cover request on the rota.`,action:'cover'}),G(!1)}},e.id)),(0,O.jsx)(m.Muted,{children:"Creates a cover request in Rota \u203a Swaps & leave for a manager to approve."})]})]})}function K({go:e}){const{now:t,meId:s,role:a}=I(3e4),o=(0,f.useOwner)(e=>e.staff),l=(0,f.useOwner)(e=>e.chat),c=(0,f.useOwner)(e=>e.chatMuted[s]??M),{by:x,total:j}=A(),y=(0,C.useChatSync)(e=>e.synced),k=(0,C.useChatSync)(e=>e.error),R=(0,w.useKitchenExtra)(e=>e.extra),[B,$]=(0,i.useState)(null),[N,W]=(0,i.useState)(!1),[K,V]=(0,i.useState)(!1);(0,i.useEffect)(()=>{D(t)},[]),(0,i.useEffect)(()=>{$(null)},[s]);const U=(0,S.useChatOpen)(e=>e.ch);(0,i.useEffect)(()=>{if(!U)return;const e=U.startsWith('dm:')||T.some(e=>e.id===U)?U:null;e&&(0,w.inChannel)(e,E(o,s,a))&&$(e),S.useChatOpen.getState().request(void 0)},[U,s,a,o]);const Y=E(o,s,a);if(B)return(0,O.jsx)(z,{resetKey:B,onBack:()=>$(null),children:(0,O.jsx)(H,{ch:B,go:e,back:()=>$(null)})});const q=e=>l.filter(t=>t.ch===e).sort((e,t)=>t.at.localeCompare(e.at))[0],F=o.filter(e=>e.active&&e.id!==s).map(e=>{const t=(0,w.dmId)(s,e.id);return{x:e,id:t,u:x[t]??0,l:q(t)?.at??''}}).sort((e,t)=>t.u-e.u||t.l.localeCompare(e.l)||P(e.x.name).localeCompare(P(t.x.name))),G='owner'===a||'manager'===a,J=({id:e,name:t,icon:s,avatar:a})=>{const i=q(e),l=x[e]??0,f=c.includes(e);return(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:`Open ${t}`,onPress:()=>$(e),style:{padding:12,borderTopWidth:1,borderColor:b.colours.border},children:(0,O.jsxs)(m.Row,{children:[a?(0,O.jsx)(_,{s:a}):(0,O.jsx)(u.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:(0,n.soutersSurface)('#222'),alignItems:'center',justifyContent:'center'},children:(0,O.jsx)(m.T,{size:16,children:s})}),(0,O.jsxs)(u.default,{style:{flex:1},children:[(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{weight:l?'bold':'medium',children:[t,f?' \ud83d\udd15':'']}),i?(0,O.jsx)(m.Muted,{children:(0,p.hm)(new Date(i.at))}):null]}),(0,O.jsx)(m.Muted,{numberOfLines:1,children:i?i.removed?'Message removed':`${'system'===i.from?'CoverCharge':P(L(i.from,o)?.name)}: ${i.text??'Photo'}`:'No messages yet'})]}),l?(0,O.jsx)(u.default,{style:{backgroundColor:f?'#555':b.colours.red,borderRadius:10,minWidth:20,height:20,alignItems:'center',justifyContent:'center',paddingHorizontal:5},children:(0,O.jsx)(m.T,{size:11,weight:"bold",children:l})}):null]})})};return(0,O.jsxs)(u.default,{style:{gap:10},children:[y?(0,O.jsx)(u.default,{testID:"chat-synced",children:(0,O.jsx)(m.Muted,{children:"\u2713 Shared with the team: messages reach everyone in the chat on their own phone."})}):(0,O.jsx)(m.Banner,{kind:"warn",title:"On this device only for now",children:"You\u2019re not connected with your personal link (or chat sharing isn\u2019t switched on yet), so anything you send stays on this device and nobody else will see it. Open your personal invite link to share chat with the team. Use your usual group chat for anything urgent."}),y&&k?(0,O.jsx)(u.default,{testID:"chat-sync-error",children:(0,O.jsx)(m.Banner,{kind:"warn",title:"Can\u2019t reach the server right now",children:"Showing the messages on this phone. New messages will be sent and others\u2019 messages will appear when the connection is back; it retries automatically."})}):null,(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.Muted,{children:["Signed in as ",P(Y?.name)," (",'Head Chef'===Y?.level?'Head Chef':f.ROLE_LABEL[a],")"]}),(0,O.jsxs)(m.Row,{gap:6,children:[j||Object.keys(x).length?(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"chat-mark-all",accessibilityLabel:"Mark all chats as read",onPress:()=>(0,v.markChatRead)(s,'*')}):null,(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:"Chat settings",onPress:()=>V(!0)})]})]}),(0,O.jsxs)(u.default,{style:{borderRadius:14,borderWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface,overflow:'hidden'},children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{padding:10},children:"TEAM CHATS"}),T.filter(e=>'all'===e.id||(0,w.inChannel)(e.id,Y)).map(e=>(0,O.jsx)(J,{id:e.id,name:e.pinned?`${e.name} \ud83d\udccc`:e.name,icon:e.icon},e.id))]}),(0,O.jsxs)(u.default,{style:{borderRadius:14,borderWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface,overflow:'hidden'},children:[(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between',padding:10},children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:b.colours.gold,children:"PRIVATE MESSAGES"}),(0,O.jsx)(m.Button,{small:!0,kind:"success",label:"New message",testID:"chat-new-pm",onPress:()=>W(!0)})]}),F.map(e=>(0,O.jsx)(J,{id:e.id,name:P(e.x.name),avatar:e.x},e.id)),F.length?null:(0,O.jsx)(m.Muted,{style:{padding:10},children:"Nobody else on the team yet."})]}),(0,O.jsx)(m.Muted,{children:"Private messages can only be read by the two people in them; owners and managers can\u2019t read other people\u2019s private messages. The Kitchen chat is for owners, managers, head chefs and kitchen staff, and can\u2019t be left."}),(0,O.jsx)(m.Sheet,{visible:N,onClose:()=>W(!1),title:"New private message",children:o.filter(e=>e.active&&e.id!==s).map(e=>(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:`Message ${e.name}`,onPress:()=>{W(!1),$((0,w.dmId)(s,e.id))},style:{paddingVertical:8},children:(0,O.jsxs)(m.Row,{children:[(0,O.jsx)(_,{s:e}),(0,O.jsxs)(u.default,{children:[(0,O.jsx)(m.T,{children:P(e.name)}),(0,O.jsxs)(m.Muted,{children:[f.ROLE_LABEL[e.role]," \xb7 ",e.job]})]})]})},e.id))}),(0,O.jsxs)(m.Sheet,{visible:K,onClose:()=>V(!1),title:"Chat settings",children:[(0,O.jsx)(m.Banner,{kind:"info",title:"Privacy",children:"Chat is for work. Managers and the owner see messages in the channels they belong to and the owner can remove messages in group chats. Private messages can only be read by the two people in them: the server enforces this, so nobody else (not even the owner) can read them. Don\u2019t share customer card or health details beyond what\u2019s needed for service."}),(0,O.jsx)(m.T,{weight:"semibold",children:"Mute channels"}),T.filter(e=>(0,w.inChannel)(e.id,Y)).map(e=>(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{children:[e.icon," ",e.name]}),(0,O.jsx)(m.Toggle,{label:`Mute ${e.name}`,value:c.includes(e.id),onChange:()=>f.useOwner.getState().chatMute(s,e.id)})]},e.id)),(0,O.jsx)(m.Muted,{children:"Muted channels don\u2019t count towards the tab badge. The Kitchen chat can be muted but not left."}),G?(0,O.jsxs)(u.default,{style:{gap:6},testID:"kitchen-members",children:[(0,O.jsx)(m.T,{weight:"semibold",children:"Kitchen chat members"}),(0,O.jsxs)(m.Muted,{children:["Automatic: owners, managers, head chefs and kitchen staff (chefs, kitchen porters). Change who else is in it here",y?'':'; saved on this device for now',"."]}),o.filter(e=>e.active).map(e=>{const t=R[e.id]??(0,w.kitchenByRule)(e);return(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{children:[P(e.name),null!=R[e.id]?' (changed)':'']}),(0,O.jsx)(m.Toggle,{label:`Kitchen chat: ${P(e.name)}`,value:t,onChange:t=>w.useKitchenExtra.getState().set(e.id,t===(0,w.kitchenByRule)(e)?null:t)})]},e.id)})]}):null]})]})}},1050,[1383,931,873,842,5,31,1040,197,264,128,818,861,822,825,951,975,994,1190,1294,824,1417,970,25]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SNOOZE_MINS",{enumerable:!0,get:function(){return S}}),e.useScheduledNotices=function({rid:u,staffId:S,name:w,onOpen:D}){const I=(0,t.useRef)(w);I.current=w;const N=(0,t.useRef)(D);N.current=D,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.location?.search)return;const t=new URLSearchParams(window.location.search);if('orderlists'===t.get('open'))o.useListOpen.getState().request(t.get('list')??void 0),setTimeout(()=>N.current?.('orderlists'),0);else if('chat'===t.get('open'))c.useChatOpen.getState().request(t.get('ch')??void 0),setTimeout(()=>N.current?.('chat'),0);else{const s=t.get('open');s&&v.includes(s)&&setTimeout(()=>N.current?.(s),0)}},[]);const O=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),b=(0,d.useReminders)(t=>t.done.length);(0,t.useEffect)(()=>{s.useNotifs.getState().ensure(u);const t=()=>{const t=h(),c=s.useNotifs.getState(),v=n.useOwner.getState().staff.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),w=v.filter(s=>!1!==s.active&&(0,p.shiftNow)(s.id,t).on).map(t=>t.id);for(const n of c.items){if(n.rid!==u)continue;const p=`sched:${n.id}`;if(!S||n.removed||n.paused||!n.sendBy.inApp||!(0,f.isRecipient)(n,S,v,w)){(0,l.dismissNotice)(p);continue}const{due:D,forDate:O}=(0,f.notifDue)(n,t),b=d.useReminders.getState().done.find(t=>t.reminderId===n.id&&t.forDate===O),R=`sched:${n.id}:${O}`;!D||b||(c.snooze[R]??0)>t?(0,l.dismissNotice)(p):(0,l.notify)({id:p,icon:'\ud83d\udd14',kicker:'NOTICE',title:n.title,body:n.message,testID:'sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'sched-notice-done',onPress:()=>d.useReminders.getState().markDone({rid:u,reminderId:n.id,forDate:O,at:new Date(h()).toISOString(),staffRef:S,staffName:I.current.replace(' (example)','')})},...'orderlists'===n.open?.page&&N.current?[{label:'Open list',testID:'sched-notice-open',onPress:()=>{o.useListOpen.getState().request(n.open?.list),N.current?.('orderlists')}}]:[],{label:'Later',kind:'ghost',testID:'sched-notice-later',onPress:()=>s.useNotifs.getState().setSnooze(R,h()+9e5)}]})}};t();const c=setInterval(t,2e4);return()=>clearInterval(c)},[u,S,O,b])};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),u=r(_d[6]),f=r(_d[7]),l=r(_d[8]),p=r(_d[9]);const h=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock).getTime()}catch{return Date.now()}},S=15,v=['bookings','rota','notifications','chat']},1051,[31,995,861,1055,1417,996,878,997,978,998]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1052,[868,31,1292,861,878,869,1181,870,978,1176]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ListBadge=C,_e.OrderListsScreen=function({rid:e,who:t,editor:s,today:i}){(0,o.useEffect)(()=>{x.useOrderLists.getState().ensure(e)},[e]);const d=(0,x.useOrderLists)(e=>e.lists).filter(t=>t.rid===e&&!t.archived),n=(0,x.useOrderLists)(e=>e.items);(0,x.useOrderLists)(t=>t.settings[e]);const l=(0,x.orderSettingsOf)(e).allowStaff,h=(0,x.useListOpen)(e=>e.seed),[y,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(!h)return;const e=d.find(e=>e.seed===h);e&&(j(e.id),x.useListOpen.getState().request(void 0))},[h,d.length]);const f=s||l;if(!s&&!l)return(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{children:"Order lists are for managers and the Head Chef here."}),(0,w.jsx)(c.Muted,{children:"Ask a manager to switch on \u201cLet all staff add items\u201d."})]});const b=d.find(e=>e.id===y);if(b)return(0,w.jsx)($,{rid:e,list:b,editor:s,canAdd:f,who:t,today:i,onBack:()=>j(null)});const I=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"order-lists",children:[(0,w.jsxs)(c.Muted,{size:13,children:["Tip: add what\u2019s running low as you notice it. ",s?'On the day, tick what you got, then Finish order.':'A manager or the Head Chef places the order.']}),d.map(t=>{const s=(0,p.liveItems)(n.filter(t=>t.rid===e),t.id).filter(e=>'open'===e.status).length;return(0,w.jsx)(c.Card,{onPress:()=>j(t.id),children:(0,w.jsx)(u.default,{testID:`order-list-card-${t.seed??t.id}`,children:(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,i,I)})]}),(0,w.jsx)(c.Badge,{kind:s?'gold':'neutral',label:`${s} to get`})]})})},t.id)}),d.length?null:(0,w.jsx)(c.Muted,{children:"No order lists yet. Add one in Settings \u203a Advanced \u203a Order lists."})]})};var t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),o=r(_d[3]),d=e(r(_d[4])),n=e(r(_d[5]));r(_d[6]);var l=e(r(_d[7])),u=e(r(_d[8])),c=r(_d[9]),h=r(_d[10]),x=r(_d[11]),p=r(_d[12]),y=r(_d[13]),j=r(_d[14]),f=r(_d[15]),b=r(_d[16]),w=r(_d[17]);const I={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},L=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',v=e=>e.replace(' (example)','').split(' ')[0];function C({list:e,size:s=40}){const i=(0,f.useLogoCache)(t=>t.byList[e.id]),[n,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let t=!0;return!i&&e.logo&&(0,b.orderLogoUrl)(e.logo).then(e=>{t&&l(e)}),()=>{t=!1}},[e.logo,i]);const x=i??n;return x?(0,w.jsx)(d.default,{testID:`list-logo-${e.seed??e.id}`,source:{uri:x},accessibilityLabel:`${e.name} logo`,style:{width:s,height:s,borderRadius:s/2,borderWidth:1,borderColor:h.colours.gold}}):(0,w.jsx)(u.default,{testID:`list-initials-${e.seed??e.id}`,accessibilityLabel:`${e.name}`,style:{width:s,height:s,borderRadius:s/2,backgroundColor:(0,t.soutersSurface)('#1c1a16'),borderWidth:1,borderColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(c.T,{size:.38*s,weight:"bold",colour:h.colours.gold,children:(0,p.initials)(e.name)})})}function D({phone:e}){const t=(0,p.telHref)(e);if(!e||!t)return null;return'undefined'!=typeof navigator&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?(0,w.jsx)(l.default,{testID:"list-phone",accessibilityRole:"link",onPress:()=>{n.default.openURL(t)},children:(0,w.jsxs)(c.T,{colour:h.colours.gold,children:["\ud83d\udcde Call ",e]})}):(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(u.default,{testID:"list-phone",children:(0,w.jsxs)(c.T,{children:["\ud83d\udcde ",e]})}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"list-phone-copy",label:"Copy",onPress:()=>{navigator.clipboard?.writeText(e).then(()=>(0,y.notify)({id:'copied',title:'Number copied',timeoutMs:3e3}))}})]})}function T({list:e}){const t=x.useOrderLists.getState(),s=(0,f.useLogoCache)(t=>!!t.byList[e.id])||!!e.logo,i=async s=>{try{const i=await(0,j.capturePlatingPhoto)(s);if(!i)return;const o=await(0,f.squareLogo)(i.dataUrl,256);f.useLogoCache.getState().put(e.id,o);const d=await(0,b.uploadOrderLogo)(e.id,o);if(d.ok){const s=e.logo;t.updateList(e.id,{logo:d.path}),s&&(0,b.removeOrderLogo)(s)}else'offline'!==d.message&&(0,y.notify)({id:'logo',tone:'warn',title:'Logo saved on this device only',body:d.message,timeoutMs:7e3})}catch(e){(0,y.notify)({id:'logo',tone:'warn',title:'Couldn\u2019t use that picture',body:String(e.message),timeoutMs:7e3})}};return(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-camera",label:s?'Replace: take photo':'Logo: take photo',onPress:()=>{i('camera')}}),(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-library",label:s?'Replace: choose':'Logo: choose image',onPress:()=>{i('library')}}),s?(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"logo-remove",label:"Remove logo",onPress:()=>{f.useLogoCache.getState().drop(e.id),e.logo&&(0,b.removeOrderLogo)(e.logo),t.updateList(e.id,{logo:void 0})}}):null]})}function S({rid:e,list:t,who:i}){const[d,n]=(0,o.useState)(''),[l,y]=(0,o.useState)('1'),[j,f]=(0,o.useState)(''),[b,L]=(0,o.useState)(''),[C,D]=(0,o.useState)(null),T=x.useOrderLists.getState(),S=Number(l.replace(',','.')),B=d.trim().length>0&&(0,p.validQty)(S),$=()=>{n(''),y('1'),L(''),D(null)};return(0,w.jsxs)(u.default,{testID:"order-add",style:{gap:6},children:[(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Item",testID:"order-add-name",value:d,onChangeText:n,placeholder:"Item, e.g. Tennent\u2019s",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Quantity",testID:"order-add-qty",value:l,onChangeText:y,keyboardType:"decimal-pad",style:{...I,width:64,borderColor:(0,p.validQty)(S)?h.colours.hairline:h.colours.red}})]}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:p.UNITS.map(e=>(0,w.jsx)(c.Chip,{label:e||'no unit',selected:j===e,onPress:()=>f(e)},e||'none'))}),(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Note",testID:"order-add-note",value:b,onChangeText:L,placeholder:"Note (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(c.Button,{testID:"order-add-save",label:"Add",disabled:!B,onPress:()=>{const s=(0,p.findDuplicate)(T.items.filter(t=>t.rid===e),t.id,d,j);s?D(s):(T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$())}})]}),(0,w.jsxs)(c.Sheet,{visible:!!C,onClose:()=>D(null),title:"Already on the list",testID:"order-dup",children:[(0,w.jsx)(c.T,{children:C?`${C.name}: ${(0,p.qtyText)(C)} (added by ${v(C.addedByName)})`:''}),(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(c.Button,{testID:"order-dup-bump",label:`Add ${l} more`,onPress:()=>{C&&T.bump(C.id,S,i),$()}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Add as separate item",onPress:()=>{T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$()}})]})]})]})}function B({item:e,editor:t,who:s}){const i=x.useOrderLists.getState(),o='got'===e.status?h.colours.gold:'missing'===e.status?h.colours.amber:h.colours.text;return(0,w.jsxs)(u.default,{testID:`order-item-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.hairline,paddingVertical:8,gap:4},children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",colour:o,style:{flex:1,textDecorationLine:'got'===e.status?'line-through':'none'},children:e.name}),(0,w.jsx)(c.T,{weight:"semibold",children:(0,p.qtyText)(e)})]}),e.note?(0,w.jsxs)(c.Muted,{size:12,children:["Note: ",e.note]}):null,(0,w.jsxs)(c.Muted,{size:12,children:["Added by ",v(e.addedByName)," \xb7 ",L(e.addedAt),e.bumps?.length?` \xb7 +${e.bumps.map(e=>`${e.qty} ${v(e.name)}`).join(', ')}`:'',e.carried?' \xb7 carried over':'']}),'open'!==e.status?(0,w.jsxs)(c.Muted,{size:12,children:['got'===e.status?'Got / ordered':'Missing / not in stock'," \xb7 ",e.statusBy," ",L(e.statusAt)]}):null,t?(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Chip,{testID:`order-got-${e.id}`,label:"\u2713 Got / ordered",selected:'got'===e.status,onPress:()=>i.setStatus(e.id,'got'===e.status?'open':'got',s)}),(0,w.jsx)(c.Chip,{testID:`order-missing-${e.id}`,label:"Missing / not in stock",selected:'missing'===e.status,onPress:()=>i.setStatus(e.id,'missing'===e.status?'open':'missing',s)}),(0,w.jsx)(c.Chip,{testID:`order-remove-${e.id}`,label:"Remove",onPress:()=>{i.removeItem(e.id),(0,y.notify)({id:`undo-${e.id}`,title:`Removed ${e.name}`,timeoutMs:8e3,actions:[{label:'Undo',testID:'order-undo',onPress:()=>i.undoRemove(e.id)}]})}})]}):null]})}function $({rid:e,list:t,editor:d,canAdd:n,who:l,today:j,onBack:f}){(0,i.useBackLayer)(!0,f);const b=(0,x.useOrderLists)(e=>e.items),$=(0,x.useOrderLists)(e=>e.history).filter(e=>e.listId===t.id),P=(0,p.liveItems)(b.filter(t=>t.rid===e),t.id),[k,R]=(0,o.useState)(!1),[O,M]=(0,o.useState)(!1),[A,z]=(0,o.useState)(t.phone??''),N=x.useOrderLists.getState(),q=P.filter(e=>'got'!==e.status).length,H=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:`order-list-${t.seed??t.id}`,children:[(0,w.jsx)(i.BackButton,{onPress:f,testID:"order-list-back"}),(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t,size:48}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{size:18,weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,j,H)})]})]}),(0,w.jsx)(D,{phone:t.phone}),'trip'===t.kind&&d?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(c.Muted,{size:12,children:"Trip day for this trip"}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:[1,2,3,4,5,6,0].map(e=>(0,w.jsx)(c.Chip,{testID:`trip-day-${e}`,label:p.DAY_FULL[e].slice(0,3),selected:(t.tripDay??H)===e,onPress:()=>N.updateList(t.id,{tripDay:e})},e))})]}):null,d?(0,w.jsxs)(u.default,{style:{gap:6},children:[(0,w.jsx)(c.Row,{gap:6,children:(0,w.jsx)(s.TextInput,{accessibilityLabel:"Phone number",testID:"list-phone-edit",value:A,onChangeText:z,onBlur:()=>N.updateList(t.id,{phone:A.trim()||void 0}),placeholder:"Phone (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}})}),(0,w.jsx)(T,{list:t})]}):null]}),n?(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{weight:"semibold",children:"Add to this list"}),(0,w.jsx)(S,{rid:e,list:t,who:l})]}):null,(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",children:"On the list"}),(0,w.jsx)(c.Badge,{kind:"neutral",label:`${P.length}`})]}),P.length?P.map(e=>(0,w.jsx)(B,{item:e,editor:d,who:l},e.id)):(0,w.jsx)(c.Muted,{children:"Nothing on this list yet."}),d&&P.length?(0,w.jsx)(c.Button,{testID:"order-finish",label:"Finish order",onPress:()=>R(!0)}):null]}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"order-history",label:O?'Hide history \u25b4':`History (${$.length}) \u25be`,onPress:()=>M(!O)}),O?$.map(e=>(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.T,{weight:"semibold",children:[L(e.finishedAt)," \xb7 ",v(e.finishedByName)]}),(0,w.jsx)(c.Muted,{size:12,children:e.items.map(e=>`${e.name} ${(0,p.qtyText)(e)}${'missing'===e.status?' (missing)':'open'===e.status?' (not got)':''}`).join(' \xb7 ')}),e.carried?(0,w.jsxs)(c.Muted,{size:12,children:[e.carried," carried over"]}):null]},e.id)):null,(0,w.jsxs)(c.Sheet,{visible:k,onClose:()=>R(!1),title:"Finish this order?",testID:"order-finish-sheet",children:[(0,w.jsxs)(c.T,{children:[P.length-q," got or ordered",q?`, ${q} not got (missing or still open)`:'',"."]}),(0,w.jsx)(c.Muted,{children:"It goes into History with today\u2019s date and your name."}),q?(0,w.jsxs)(c.T,{weight:"semibold",children:["Carry over the ",q," not got to the next order?"]}):null,(0,w.jsxs)(c.Row,{wrap:!0,gap:8,children:[q?(0,w.jsx)(c.Button,{testID:"order-finish-carry",label:"Finish and carry over",onPress:()=>{N.finish(e,t.id,!0,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,body:`${q} carried over`,timeoutMs:6e3})}}):null,(0,w.jsx)(c.Button,{testID:"order-finish-clear",kind:q?'secondary':'primary',label:q?'Finish, don\u2019t carry over':'Finish order',onPress:()=>{N.finish(e,t.id,!1,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,timeoutMs:6e3})}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>R(!1)})]})]})]})}},1053,[931,873,1040,31,197,240,123,264,128,818,825,1055,1291,978,1415,1416,824,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PhoneAlerts=function({what:e="reminders and alerts set for you"}){const[s,h]=(0,t.useState)(null),[u,p]=(0,t.useState)(null),[y,f]=(0,t.useState)(null);(0,t.useEffect)(()=>{let e=!0;return(0,r.inApkWebView)()?h('apk'):(0,r.pushState)().then(t=>{e&&h(t)}).catch(()=>{e&&p('Could not check alerts. Try again.')}),()=>{e=!1}},[]);const b='on'===s?'Alerts are on for this phone.':'blocked'===s?i.BLOCKED_INTRO:'ios-home-screen'===s?'iPhone: add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.':'unsupported'===s?'This browser can\u2019t get alerts when the phone is locked. Open CoverCharge in Chrome.':null;return(0,c.jsxs)(n.default,{testID:"phone-alerts",style:{gap:10,alignItems:'center'},children:[(0,c.jsxs)(l.T,{center:!0,size:16,children:["Get the ",e," on this phone, even when the app is closed."]}),'apk'===s?(0,c.jsx)(l.T,{size:18,weight:"bold",colour:o.colours.gold,center:!0,testID:"alerts-open-chrome",children:"Open CoverCharge in Chrome to turn on alerts"}):null,b?(0,c.jsx)(l.T,{center:!0,size:15,testID:"alerts-status",children:b}):null,'off'===s?(0,c.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,c.jsx)(l.Button,{label:"Turn on alerts",testID:"turn-on-alerts",accessibilityLabel:"Turn on alerts. Your phone will then ask to allow notifications: tap Allow.",style:{minHeight:64,minWidth:260},onPress:async()=>{p(null);try{const e=await(0,r.turnOnPush)();p(e.message),e.ok?h('on'):h(await(0,r.pushState)())}catch{p('Could not turn on alerts. Please try again.')}}}),(0,c.jsx)(l.T,{size:16,center:!0,testID:"alerts-allow-line",children:"When your phone asks, tap Allow."})]}):null,'blocked'===s?(0,c.jsx)(n.default,{style:{gap:6,alignItems:'center',alignSelf:'stretch'},testID:"alerts-blocked-steps",accessible:!0,accessibilityLabel:i.BLOCKED_SPOKEN,children:i.BLOCKED_STEPS.map((e,t)=>(0,c.jsx)(l.T,{size:15,center:!0,children:`${t+1}. ${e}`},t))}):null,'blocked'===s?(0,c.jsx)(l.Button,{label:"I\u2019ve allowed it, check again",testID:"alerts-recheck",accessibilityLabel:"I\u2019ve allowed it. Check again.",style:{minHeight:64,minWidth:260},onPress:async()=>{p(null);try{if('blocked'===await(0,r.pushState)())return void p(i.STILL_OFF);const e=await(0,r.turnOnPush)();p(e.message),h(e.ok?'on':await(0,r.pushState)())}catch{p('Could not check alerts. Please try again.')}}}):null,'on'===s?(0,c.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,c.jsx)(l.Button,{label:"Send me a test notification",testID:"push-test",accessibilityLabel:"Send me a test notification. It goes only to your own phone.",style:{minHeight:56,minWidth:260},onPress:async()=>{f('Sending\u2026'),f((await(0,r.sendTestPush)()).message)}}),y?(0,c.jsx)(n.default,{accessibilityLiveRegion:"polite",children:(0,c.jsx)(l.T,{size:15,center:!0,testID:"push-test-msg",children:y})}):null,(0,c.jsx)(l.Button,{small:!0,kind:"ghost",label:"Turn off alerts on this phone",testID:"turn-off-alerts",onPress:async()=>{const e=await(0,r.turnOffPush)();p(e.message),h(await(0,r.pushState)())}})]}):null,u?(0,c.jsx)(n.default,{accessibilityLiveRegion:"assertive",accessibilityRole:'alert',children:(0,c.jsx)(l.T,{size:15,center:!0,testID:"push-msg",children:u})}):null,(0,c.jsx)(l.Muted,{center:!0,size:13,children:"For this phone only. Each person turns it on on their own phone."})]})};var e,t=_r(d[0]),s=_r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(d[2]),i=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6])},1054,[31,128,818,1038,825,1388,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"orderListSeedId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"orderListSettingsId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"orderListSeeds",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useOrderLists",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"orderSettingsOf",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"useListOpen",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),p=r(d[5]),l=r(d[6]);const c=(e,t)=>(0,u.uuidFrom)(`order-list:${t}:${e}`),S=e=>(0,u.uuidFrom)(`order-list-settings:${e}`),f=e=>'anchorage'===e?[{id:c(e,'allsons'),seed:'allsons',name:'Alsons (drinks)',kind:'running'},{id:c(e,'cash-carry'),seed:'cash-carry',name:'Cash and carry',kind:'trip',tripDay:5}]:[],A=()=>(new Date).toISOString(),O=(0,i.create)()((0,n.persist)((e,t)=>({lists:[],items:[],history:[],settings:{},ensure:s=>{const i=t(),n=new Set(i.lists.map(e=>e.id)),u=f(s).filter(e=>!n.has(e.id)).map(e=>({...e,rid:s})),p={},c=i.lists.map(e=>(0,l.fixSupplierNames)(e.name)!==e.name?{...e,name:(0,l.fixSupplierNames)(e.name),updatedAt:A()}:e);c.some((e,t)=>e!==i.lists[t])&&(p.lists=c),u.length&&(p.lists=[...p.lists??i.lists,...u]),i.settings[s]||(p.settings={...i.settings,[s]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(s)}}),Object.keys(p).length&&e(p)},addList:(t,s)=>{const i=(0,p.uuid)();return e(e=>({lists:[...e.lists,{...s,id:i,rid:t,updatedAt:A()}]})),i},updateList:(t,s)=>e(e=>({lists:e.lists.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),addItem:(t,s)=>{const i=(0,p.uuid)(),n=s.addedAt??A();return e(e=>({items:[...e.items,{...s,id:i,rid:t,status:'open',addedAt:n,updatedAt:n}]})),i},bump:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...(0,o.bumpQty)(e,s,i.id,i.name,A()),rid:e.rid}:e)})),updateItem:(t,s)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),setStatus:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,status:s,statusBy:'open'===s?void 0:i.name,statusAt:'open'===s?void 0:A(),updatedAt:A()}:e)})),removeItem:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!0,updatedAt:A()}:e)})),undoRemove:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!1,updatedAt:A()}:e)})),finish:(s,i,n,u)=>{const l=t().lists.find(e=>e.id===i);if(!l)return null;const c=A(),{round:S,drop:f,carriedOver:O}=(0,o.finishOrder)(l,t().items,n,u,c,p.uuid),_=new Set(f),y=new Map(O.map(e=>[e.id,e])),T={...S,rid:s};return e(e=>({items:e.items.filter(e=>!_.has(e.id)).map(e=>y.has(e.id)?{...y.get(e.id),rid:e.rid}:e),history:[T,...e.history].slice(0,300),lists:e.lists.map(e=>e.id===i?{...e,nextTrip:void 0,updatedAt:c}:e)})),T},setSettings:(t,s)=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,...e.settings[t],...s,id:S(t),updatedAt:A()}}})),resetSettings:t=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(t),updatedAt:A()}}}))}),{name:'covercharge-order-lists-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)})),_=e=>({...o.DEFAULT_ORDER_LIST_SETTINGS,...O.getState().settings[e]}),y=(0,i.create)()(e=>({request:t=>e({seed:t})}))},1055,[1188,993,1189,1177,1291,1097,1290]); +__d(function(g,_r,i,a,_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 P}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return E}}),_e.personFromStaff=H,_e.signInWithText=V,_e.SignInWithLink=z,_e.signInWithHandover=F,_e.useSignedOutGate=function(){const e=(0,k.useSession)(e=>e.meId),n=(0,b.useSync)(e=>'device'===e.kind&&!!e.venueId);return h.IS_CAR?!S.PITCH&&!n:C.includes(h.APP_VARIANT)&&!S.PITCH&&!e&&!K()},_e.InviteGate=function(){const[e,N]=(0,u.useState)(k.useSession.persist.hasHydrated()),[H,V]=(0,u.useState)(k.START_INVITE||k.START_HANDOVER||k.START_KITCHEN?'checking':'done'),[L,U]=(0,u.useState)(null),[G,B]=(0,u.useState)(null),[Y,$]=(0,u.useState)(0),[X,Q]=(0,u.useState)(!1),[q,J]=(0,u.useState)(null),Z=(0,k.useSession)(e=>e.meId),ee=(0,k.useSession)(e=>!Z||!!e.welcomed[Z]);if((0,u.useEffect)(()=>{const e=k.useSession.persist.onFinishHydration(()=>N(!0));return k.useSession.persist.hasHydrated()&&N(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!C.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=k.useSession.getState().meId;if(k.START_KITCHEN&&'chef'===h.APP_VARIANT&&!e){const e=await(0,b.claimDisplayKitchen)(k.START_KITCHEN);if(!t)return;if('ok'===e.status&&e.id.staffRef){(0,y.markKitchenViaDisplay)(!0,e.id.displayName),M(e.id);try{k.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void V('done')}return U('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void V('done')}if(k.START_HANDOVER&&!k.START_INVITE&&!W){W=!0;const n=await(0,b.claimChromeHandover)(k.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef)M(n.id);else if('refused'===n.status&&!e)return B(n.message),void V('done')}if(k.START_INVITE&&!(e&&await(0,b.signedInHereAs)(e)&&await(0,b.rememberedInviteHere)(k.START_INVITE))){const e=await D(k.START_INVITE,e=>{t&&B(e)});if(!t)return;if('refused'===e.kind)return B(e.message),void V('done');if('offline'===e.kind)return Q(!0),void(n=setTimeout(()=>{t&&$(e=>e+1)},1e4));if(Q(!1),'bad'===e.kind)return void V('bad')}const s=O(k.useSession.getState().meId),o=s&&!1!==w.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)k.useSession.getState().signOut();else if(s&&!R(s)&&!k.START_INVITE&&await(0,b.signedInHereAs)(s.id)){if(await(0,b.forgetSignInHere)(),!t)return;k.useSession.getState().signOut(),J(E(s.app))}else if(s&&!R(s)){const e=(0,k.appUrl)(s.app,k.START_INVITE);if(e)return void window.location.replace(e)}V('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,Y]),!C.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(t.QueuedVenueWelcome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?'This link cannot be used here. Ask your authorised manager.':X?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(o.GreensideStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(r.AbbotsfordStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?'This link cannot be used here. Ask your authorised manager.':X?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(l.KirktonStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(s.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Z){const t=s.IsolatedStaffHome,o=k.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(t,{app:o,message:l})})}if(X)return _('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===H)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if(h.IS_OWNER_DESKTOP&&!Z&&!S.PITCH&&!K())return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(p.DesktopSignIn,{onCode:F,refused:G})});if((0,A.inPhoneApp)()&&!Z&&!S.PITCH)return G&&/already been used/i.test(G)?_(P,'invite-app-used'):G&&(0,x.isPhoneLinked)(G)?_(x.PHONE_LINKED_TEXT,'invite-phone-linked'):G?_(G,'invite-app-refused'):_(v,'invite-app-notsetup');if('bad'===H)return(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,j.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,j.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V('done')}),(0,j.jsx)(I.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(G&&!Z&&(0,x.isPhoneLinked)(G))return(0,j.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${x.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,j.jsx)(I.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,j.jsx)(I.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,j.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(G&&!Z)return(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,j.jsx)(I.Muted,{center:!0,children:G}),(0,j.jsx)(I.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,j.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>B(null)})]});if(q&&!Z)return(0,j.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,j.jsx)(I.Muted,{center:!0,children:q}),(0,j.jsx)(z,{})]});if(L&&!Z){const e=/expired/i.test(L);return(0,j.jsxs)(f.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,j.jsx)(I.Muted,{center:!0,children:L}),(0,j.jsx)(I.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!Z&&!S.PITCH&&!K())return(0,j.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:G?'This link can\u2019t be used here':'Sign in to CoverCharge'}),G?(0,j.jsx)(I.Muted,{center:!0,children:G}):null,(0,j.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,j.jsx)(z,{})]});const ne=(0,k.rosterPerson)(Z);return ne&&!ee&&R(ne)&&!(0,y.isKitchenViaDisplay)()?(0,j.jsx)(T.LaunchWelcome,{p:ne,onDone:()=>k.useSession.getState().markWelcomed(ne.id)}):null};var n=_r(d[0]),t=_r(d[1]),s=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),I=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]),w=_r(d[21]),j=_r(d[22]);const P='This app copy has already been set up on another phone. Ask your manager for a new link.',v='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',_=(e,n)=>(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e})}),C=['owner','staff','chef'],R=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,E=e=>`You now use ${k.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function N(e){k.useSession.getState().signIn(e.id);const n=w.useOwner.getState();w.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function H(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const O=e=>{const n=(0,k.rosterPerson)(e);if(n)return n;const t=e?w.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?H(t):void 0};async function D(e,n){const t=await(0,k.personForInvite)(e);if(t)return N(t),R(t)?((0,b.claimInvite)(e).then(e=>{if('refused'===e.status&&k.useSession.getState().meId===t.id&&(k.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==k.useSession.getState().meId){const n=O(e.id.staffRef);n&&N(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const s=await(0,b.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=O(s.id.staffRef)??H({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return N(o),{kind:'ok',p:o}}async function V(e,n=()=>{}){const t=(0,k.inviteFromText)(e);if(!t)return'bad';const s=await D(t,n);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!R(o)){const e=(0,k.appUrl)(o.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,s]=(0,u.useState)('');return(0,j.jsxs)(f.default,{style:{gap:6},children:[(0,j.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,j.jsx)(I.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await V(e,s);s('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,j.jsx)(I.T,{size:13,colour:m.colours.red,children:t}):null]})}function M(e){if(!e.staffRef)return;N(O(e.staffRef)??H({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function F(e){const n=await(0,b.claimChromeHandover)(e);return'ok'===n.status?n.id.staffRef?(M(n.id),'ok'):'bad':'refused'===n.status?{refused:n.message}:'offline'===n.status?'offline':'bad'}let W=!1;const K=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1056,[5,1548,1549,1550,1551,1552,31,123,47,128,807,1553,865,825,1555,818,824,977,2,1411,1272,861,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1057,[31,264,207,128,288,825,1466,25]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=j,_e.periodPay=T,_e.MyHoursPay=C,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),j=(0,a.useOwner)(e=>e.staff),k=(0,i.useMemo)(()=>j.filter(e=>e.active),[j]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:M,rid:v}=(0,y.useCtx)(6e4),N=(0,b.useVenuePay)(v).pay,[B,O]=(0,i.useState)(-1),[L,$]=(0,i.useState)(null),[S,H]=(0,i.useState)(''),[I,W]=(0,i.useState)(null),E=(0,i.useMemo)(()=>k.map(e=>({...T(e.id,B,M,R,D[e.id]??0,N,z),person:e})),[k,B,R,D,N,z]),_=E.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),V=E[0]?.label??'',F=k.find(e=>e.id===L),G=Math.round(100*Number(S));return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,f.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,f.jsx)(P,{label:V,offset:B,setOffset:O,badge:0===B?'Current period':void 0}),(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),E.map(e=>(0,f.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>W(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,f.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:x(e.person.name)}),c&&e.person.noTax?(0,f.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),H(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,f.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]$(null),title:`Hourly rate: ${x(F?.name)}`,children:[(0,f.jsx)(l.Muted,{children:F?`${F.level??a.ROLE_LABEL[F.role]} \xb7 ${F.job}${F.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(F,D[F.id],u.gbp)}`:''}),(0,f.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",value:S,onChangeText:H,style:l.styles.input}),Number.isFinite(G)&&G>0&&G{a.useOwner.getState().setRate(L,G),$(null)}}),L&&null!=D[L]?(0,f.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(L),$(null)}}):null]}),(0,f.jsx)(l.Sheet,{visible:!!I,onClose:()=>W(null),title:`What ${x(k.find(e=>e.id===I)?.name)} sees`,children:I?(0,f.jsx)(C,{staffId:I}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const x=e=>(e??'').replace(' (example)',''),w='Before tax and deductions, estimate';function j(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>T(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function T(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function P({label:e,offset:s,setOffset:t,badge:i}){return(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,f.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e}),i?(0,f.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function C({staffId:e}){const{meId:s,now:C,rid:k}=(0,y.useCtx)(6e4),D=e??s,R=(0,b.useVenuePay)(k).pay,z=(0,a.useOwner)(e=>e.staff).find(e=>e.id===D),M=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[D]??0,O=null!=N[D],[L,$]=(0,i.useState)(0),S=j(D,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...T(D,e,C,M,B,R,v)})),[D,M,B,R,v]);return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Banner,{kind:"info",title:w,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,f.jsxs)(l.Muted,{children:[x(z?.name)," \xb7 ",z?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",R.wagePayDay,[1,21,31].includes(R.wagePayDay)?'st':[2,22].includes(R.wagePayDay)?'nd':[3,23].includes(R.wagePayDay)?'rd':'th',", cut-off the ",R.wageCutoffDay,[1,21].includes(R.wageCutoffDay)?'st':[2,22].includes(R.wageCutoffDay)?'nd':[3,23].includes(R.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,f.jsx)(P,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Confirmed paid hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,f.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Gross pay from hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Tips allocated"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,f.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,f.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,f.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,f.jsxs)(l.Muted,{children:[w,". Tips are shown separately and only once a tip period is approved."]})]}),(0,f.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,f.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,f.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,f.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,f.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,f.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,f.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,f.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,f.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,f.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,f.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,f.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.label}),(0,f.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,f.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",w.toLowerCase()]})]})},e.o))]})}},1058,[873,1464,31,264,128,288,818,861,820,822,825,1075,951,1183,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,v=(0,f.tipsPeriod)(w,S.start,1),z=(0,f.wagePeriod)(w,D.start,1),H=e=>{l({...a,...e}),x(null)};return(0,M.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,M.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,M.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,M.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,M.jsx)(h.Chip,{label:$[e],selected:a.tipsFrequency===e,onPress:()=>H({tipsFrequency:e})},e))}),(0,M.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,M.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,M.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,M.jsxs)(h.Row,{children:[(0,M.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>H({tipsEndsDaysBefore:e})}),(0,M.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,M.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,M.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>H({wagePayDay:e})})]}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,M.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>H({wageCutoffDay:e})})]}),(0,M.jsxs)(h.Muted,{children:["Period runs the ",R(a.wageCutoffDay)," to the ",R(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,M.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,M.jsx)(h.Chip,{label:B[e],selected:(a.weekendRule??'none')===e,onPress:()=>H({weekendRule:e})},e))})]}),(0,M.jsx)(T.SectionHead,{title:"Preview"}),(0,M.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,M.jsx)(I,{label:"Next tips payday",day:S.payday,period:S}),(0,M.jsx)(I,{label:"Then",day:v.payday,period:v}),(0,M.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,M.jsx)(I,{label:"Next payday",day:D.payday,period:D}),(0,M.jsx)(I,{label:"Then",day:z.payday,period:z})]}),(0,M.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,M.jsx)(h.Banner,{kind:"success",title:y}):null,(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=H,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return V}}),_e.summaryTable=E,_e.detailTable=Y,_e.copyText=G,_e.periodOptions=U,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:$}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:$,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:W}=(0,k.useVenuePay)(s),L=(0,y.useOwner)(e=>e.staff),N=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),J=(0,P.useHourly)(),K=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,M.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,M.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,M.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>U(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>H(ye,L,N,r,J),[ye.key,L,N,J,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage($)?(0,M.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===W?(0,M.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,M.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,M.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,M.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,M.jsx)(_,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,M.jsx)(h.Card,{highlight:b.colours.gold,children:(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,M.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,M.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,M.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,M.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,M.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,M.jsx)(v.HoursExport,{}),B?(0,M.jsx)(i.default,{style:{alignItems:'center'},children:(0,M.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,M.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,M.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,M.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,M.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,M.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await G(F(E(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,V(E(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,V(Y(ge))),Te('CSV downloaded (one line per shift).')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=E(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,M.jsx)(h.Banner,{kind:"success",title:he}):null,K?(0,M.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,M.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,M.jsx)(u.HoursSummaryCard,{name:A(e.person),role:O(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,M.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${A(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,M.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,M.jsx)(o.WideTable,{children:(0,M.jsxs)(i.default,{testID:"hours-table",children:[(0,M.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,M.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:q[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,M.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,M.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${A(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,M.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,M.jsxs)(i.default,{style:{width:q[0]},children:[(0,M.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",A(e.person)]}),(0,M.jsx)(h.Muted,{children:O(e.person)})]}),(0,M.jsx)(h.T,{size:14,style:{width:q[1]},children:e.shifts}),(0,M.jsx)(h.T,{size:14,weight:"semibold",style:{width:q[2]},children:(0,l.durText)(e.confirmed)}),(0,M.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:q[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,M.jsx)(h.T,{size:14,style:{width:q[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,M.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:q[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,M.jsxs)(h.T,{size:14,weight:"semibold",style:{width:q[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,M.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,M.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:q[0]},children:["Total (",ge.length,")"]}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[1]},children:me.s}),(0,M.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:q[2]},children:(0,l.durText)(me.c)}),(0,M.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:q[3]},children:(0,l.durText)(me.p)}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,M.jsx)(h.T,{size:14,style:{width:q[5]},children:" "}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,M.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,M.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,M.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,M.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,M.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,M.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,v]=(0,n.useState)(0),$=(0,f.tipsPeriod)(u,S.period.start,D),[B,R]=(0,n.useState)(''),[I,z]=(0,n.useState)({}),[L,N]=(0,n.useState)(null),E=(0,n.useMemo)(()=>H($,p,T,a,{}),[$.key,p,T]),Y=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>I[e.id]??Y(e),_=E.filter(e=>e.confirmed>0||e.pending>0),q=Math.round(100*Number(B.replace(/[\xa3,\s]/g,''))),J=Number.isFinite(q)&&q>0&&q<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(B),K=_.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:Q}=(0,w.allocate)(J?q:0,K.map(e=>e.confirmed)),X={};K.forEach((e,s)=>{X[e.person.id]=Q[s]});const Z=K.reduce((e,s)=>e+s.confirmed,0),ee=Object.values(X).reduce((e,s)=>e+s,0),se=_.filter(e=>e.pending>0&&!U(e.person)),te=se.reduce((e,s)=>e+s.pending,0),oe=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],..._.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[A(e.person),O(e.person),(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&Z?(e.confirmed/Z*100).toFixed(2):'0.00',s?W(X[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(Z),(0,f.hMm)(Z),Z?'100.00':'0.00',W(ee)]],ne=e=>{N(e),setTimeout(()=>N(null),6e3)};return(0,M.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,M.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,M.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,M.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>v(D-1)}),(0,M.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,M.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)($.start,$.end)}),(0,M.jsxs)(h.Muted,{children:[(0,f.ukDate)($.start)," to ",(0,f.ukDate)($.end)," \xb7 ",$.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)($.payday)]}),0===D?(0,M.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>v(D+1)})]}),(0,M.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,M.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,M.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,M.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,M.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:B,onChangeText:R,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),B&&!J?(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,M.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),se.length?(0,M.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,M.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,M.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(te)," not approved yet"]}),(0,M.jsxs)(h.T,{size:14,children:[se.map(e=>`${A(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):_.length?(0,M.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,M.jsx)(o.WideTable,{children:(0,M.jsxs)(i.default,{testID:"tips-table",children:[(0,M.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,M.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),_.map(e=>{const s=U(e.person),t=X[e.person.id]??0;return(0,M.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,M.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${A(e.person)}`,onPress:()=>z({...I,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,M.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,M.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,M.jsxs)(i.default,{style:{width:150},children:[(0,M.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:A(e.person)}),(0,M.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':O(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,M.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,M.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&Z?`${(e.confirmed/Z*100).toFixed(1)}%`:'\u2013'}),(0,M.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,M.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,M.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",K.length," people)"]}),(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(Z)," h"]}),(0,M.jsx)(h.T,{size:14,style:{width:64},children:Z?'100%':'\u2013'}),(0,M.jsx)(h.T,{size:15,weight:"bold",colour:J&&ee===q?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(ee)})]})]})}),_.length?null:(0,M.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),J&&Z?(0,M.jsxs)(h.Muted,{children:["Check: ",K.length," shares add up to ",(0,x.gbp)(ee)," of ",(0,x.gbp)(q)," ",ee===q?'\u2713':'',". \xa3",(q/100/(Z/60)).toFixed(4)," per confirmed hour."]}):null,(0,M.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!J,onPress:async()=>{const e=await G(F(oe()));ne(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!J,onPress:()=>{(0,j.downloadText)(`tips-${$.start}-to-${$.end}.csv`,V(oe())),ne('CSV downloaded.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!J,onPress:()=>{const e=oe();(0,j.printTable)(`Tips ${(0,f.rangeText)($.start,$.end)} (paid ${(0,f.dayMonth)($.payday)})`,`Total ${(0,x.gbp)(q)} shared by confirmed hours${se.length?` \xb7 WARNING ${(0,f.decH)(te)} h not signed off`:''}`,e[0],e.slice(1))}})]}),L?(0,M.jsx)(h.Banner,{kind:"success",title:L}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,M.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,M.jsx)(r.CardHeading,{right:'none'===n?(0,M.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:["Next tips payday: ",(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,M.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:["Next payday: ",(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,M.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,M.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,M.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,M.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?H(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,M.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,M.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,M.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,M.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,M.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,M.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,M.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),v=_r(_d[26]),M=_r(_d[27]);const $={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},B={none:'Keep the date',before:'Friday before',after:'Monday after'};const R=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function I({label:e,day:s,period:t}){return(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:[e,": ",(0,M.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,M.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const z=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function H(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:z(e.in),outT:z(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const O=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,A=e=>e.name.replace(' (example)',''),W=e=>null==e?'':(e/100).toFixed(2),L=e=>e.replace(/[\t\r\n]+/g,' '),N=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,F=e=>e.map(e=>e.map(L).join('\t')).join('\n'),V=e=>e.map(e=>e.map(N).join(',')).join('\r\n');function E(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[A(e.person),O(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[W(e.rate),W(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',W(d.g)]:[]]]}function Y(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[A(e.person),O(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function G(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function U(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function _({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,M.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,M.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,M.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,M.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,M.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const q=[150,54,100,90,48,62,70]},1059,[873,834,1464,31,1465,123,264,288,128,1467,1468,1469,818,878,861,820,1182,825,1385,1061,1075,951,1183,1470,807,1471,1475,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ee,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return se}}),_e.rotaGrid=ne,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:o}=(0,$.useCtx)(6e4),i=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),r=(0,s.useOwner)(e=>e.shifts),d=(0,$.useHourly)(),u=(0,s.useOwner)(e=>e.availability),m=(0,s.useOwner)(e=>e.leave),x=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[I,M]=(0,l.useState)(0),B=(0,Y.useDateCalendar)(),[P,R]=(0,l.useState)(null),[A,z]=(0,l.useState)(null),[H,W]=(0,l.useState)(null),[F,G]=(0,l.useState)('week'),[Q,ie]=(0,l.useState)(!1),le=(0,$.useSignedIn)()?.name??'',re='staff'!==n,de=(0,C.addMins)(Z(t),7*I*1440);de.setHours(0,0,0,0);const ce=ee(de),ue=ce.sales,he='none'===ce.mode,fe=Array.from({length:7},(e,t)=>{const s=new Date(de);return s.setDate(de.getDate()+t),(0,C.ymd)(s)}),me=(0,s.visibleShifts)(r,re).filter(e=>e.date>=fe[0]&&e.date<=fe[6]),ge=(()=>{const e=new Date(de);return e.setDate(e.getDate()-7),(0,C.ymd)(e)})(),pe=me.filter(e=>!e.published||e.changed).length,xe=r.filter(e=>e.date>=ge&&e.date!!(0,s.leaveOn)(m,e,t),je=fe.map(e=>(0,g.workingShifts)(me,m).filter(t=>t.date===e).reduce((e,t)=>{return e+(X(s=t)-J(X(s)))*(d[s.staffId]??0);var s},0)),we=je.reduce((e,t)=>e+t,0),ye=ue.reduce((e,t)=>e+t,0),ke=(e,t)=>t?Math.round(e/t*100):0,Ie=re?i:i.filter(e=>e.id===o),Se=(0,a.useNarrow)(),Ce=Math.max(0,fe.indexOf((0,C.ymd)(t))),[De,ve]=(0,l.useState)(null),Te=De??Ce,$e=(e,t)=>!Se||t===Te,[Oe,Me]=(0,l.useState)(0),Be=ne(Oe,Se?1:7),Pe=Be.cell,Re=Be.name;return(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Week",selected:'week'===F,onPress:()=>G('week')}),(0,V.jsx)(f.Chip,{label:`Swaps & time off (${x.filter(e=>'open'===e.status).length+m.filter(e=>'pending'===e.status).length})`,selected:'requests'===F,onPress:()=>G('requests')}),(0,V.jsx)(f.Chip,{label:"Availability",selected:'availability'===F,onPress:()=>G('availability')})]}),'week'===F?(0,V.jsxs)(V.Fragment,{children:[!re&&o?(0,V.jsx)(k.RequestTimeOff,{meId:o,me:le,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,V.jsx)(h.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,V.jsx)(f.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,N.timeSheetLabel)(fe[0],fe[6]),onPress:()=>{(0,N.setHoursPreset)(fe[0],fe[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,V.jsxs)(h.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Oe?Math.min(Oe,Be.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{M(I-1),R(null)},style:{minWidth:96}}),(0,V.jsxs)(h.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,V.jsxs)(f.T,{weight:"semibold",center:!0,children:["Week of ",(0,C.niceDate)(de)]}),(0,V.jsxs)(f.Muted,{center:!0,children:[0===I?'This week':1===I?'Next week':-1===I?'Last week':I>0?`In ${I} weeks`:-I+" weeks ago",re?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{M(I+1),R(null)},style:{minWidth:96}})]}),(0,V.jsx)(h.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:B.openCal,style:{minWidth:96}})}),(0,V.jsx)(Y.AppDateCalendar,{visible:B.calOpen,today:(0,C.ymd)(t),day:(0,C.ymd)(de),idPrefix:"rota-cal",onClose:B.closeCal,onDay:e=>{M((0,Y.weekOffsetOf)(e??(0,C.ymd)(t),(0,C.ymd)(t))),R(null)}}),re?(0,V.jsxs)(f.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,V.jsx)(f.Button,{small:!0,kind:"secondary",label:"Copy last week"+(xe?` (${xe})`:''),disabled:!xe,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(ge,fe[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,V.jsx)(f.Button,{small:!0,kind:"success",label:pe?`Publish ${pe} ${1===pe?'change':'changes'}`:'Week published',disabled:!pe,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(fe[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),pe?(0,V.jsx)(f.Badge,{kind:"amber",label:`${pe} unpublished`}):me.length?(0,V.jsx)(f.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,P?(0,V.jsx)(f.Banner,{kind:"success",title:P}):null,Se?(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:$.DAY3.map((e,t)=>q.IS_CAR?(0,V.jsx)(f.Button,{kind:t===Te?'primary':'secondary',label:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}`,accessibilityLabel:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}${t===Te?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>ve(t),style:{minHeight:64,minWidth:96}},e):(0,V.jsx)(f.Chip,{label:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}`,selected:t===Te,onPress:()=>ve(t)},e))}):null,(0,V.jsx)(h.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Oe)>1&&Me(t)},style:{alignSelf:'stretch'},children:(0,V.jsx)(oe,{fits:Se||Be.fits,children:(0,V.jsxs)(h.default,{testID:"rota-grid",style:{gap:se,width:Be.width,alignSelf:'center'},children:[(0,V.jsxs)(h.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:se,backgroundColor:D.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:D.colours.hairline,zIndex:5},Se||Be.fits?ae:null],children:[(0,V.jsx)(h.default,{style:{width:Re,justifyContent:'center'},children:(0,V.jsx)(f.T,{size:11,weight:"semibold",colour:D.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),$.DAY3.map((e,s)=>(0,V.jsx)(h.default,{testID:"rota-date",style:{width:Pe,alignItems:'center'},children:(0,V.jsxs)(f.T,{size:Be.big?13:12,weight:"semibold",center:!0,colour:fe[s]===(0,C.ymd)(t)?D.colours.gold:D.colours.text,children:[e," ",(0,C.parseYmd)(fe[s]).getDate()]})},e)).filter($e)]}),Ie.map(e=>(0,V.jsxs)(h.default,{testID:"rota-row",style:{flexDirection:'row',gap:se,alignItems:'center'},children:[(0,V.jsxs)(h.default,{testID:"rota-name",style:{width:Re,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,V.jsx)(O.StaffAvatar,{id:e.id,size:28}),(0,V.jsxs)(h.default,{style:{flex:1,minWidth:0},children:[(0,V.jsx)(f.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,V.jsx)(f.T,{size:11,colour:D.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),$.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(me,e.id,fe[n]),o=(u[e.id]??[]).includes(n),i=be(e.id,fe[n]),l=(0,p.rotaCellWorked)(a,b,e.id,fe[n],re),r=!(!re||!l.workedLine&&!l.onShiftNow);return(0,V.jsxs)(c.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${$.DAY3[n]}, ${l.speech}${(0,E.badgeSpoken)(a?.badge)}${i?', on time off':''}${o?', unavailable':''}`,disabled:!re,onPress:()=>{a?W({staffId:e.id,date:fe[n],shift:a}):z({staffId:e.id,date:fe[n]})},style:({pressed:e})=>({width:Pe,minHeight:q.IS_CAR?64:r?80:52,height:r||(0,E.cleanBadge)(a?.badge)||q.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:l.differs?D.colours.amber:a?a.published?D.colours.gold:D.colours.amber:D.colours.border,backgroundColor:e?D.colours.goldTint:a?a.published?'#2b2414':'#241f14':i?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,E.cleanBadge)(a?.badge)?6:0}),children:[a?(0,V.jsxs)(f.T,{size:Be.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,$.fmtH)(a.start),"\u2013",(0,$.fmtH)(a.end)]}):l.workedLine?null:(0,V.jsx)(f.T,{size:12,center:!0,colour:D.colours.muted,children:i?'Off':o?'Unavail.':re?'Add':'\u2013'}),(0,E.cleanBadge)(a?.badge)?(0,V.jsx)(h.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:D.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,V.jsx)(f.T,{size:10,weight:"semibold",colour:D.colours.gold,center:!0,numberOfLines:1,children:(0,E.cleanBadge)(a?.badge)})}):null,l.workedLine?(0,V.jsx)(f.T,{testID:"rota-worked",size:10,colour:l.differs?D.colours.amber:D.colours.goldLight,center:!0,children:l.workedLine}):null,l.onShiftNow?(0,V.jsx)(f.T,{testID:"rota-on-shift-now",size:10,colour:D.colours.goldLight,center:!0,children:"On shift now"}):null,l.diffLabel?(0,V.jsx)(f.T,{size:10,colour:D.colours.amber,center:!0,children:l.diffLabel}):null,a&&i?(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.blue,children:(0,g.leaveLabel)((0,s.leaveOn)(m,e.id,fe[n])).toLowerCase()}):a&&o?(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.red,children:"unavailable"}):!a||!re||a.published&&!a.changed||l.workedLine||l.onShiftNow?null:(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter($e)]},e.id)),re?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se,marginTop:4},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:"Labour"})}),je.map((e,t)=>(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,children:(0,S.gbp)(e).replace('.00','')})},t)).filter($e)]}),he?null:(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:'example'===ce.mode?'Fcst sales (ex.)':'Fcst sales'})}),ue.map((e,t)=>(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,colour:D.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter($e)]}),he?null:(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:"Labour %"})}),je.map((e,t)=>{const s=ke(e,ue[t]);return(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,weight:"semibold",colour:ue[t]?s>32?D.colours.red:s>26?D.colours.amber:D.colours.ok:D.colours.muted,children:ue[t]?`${s}%`:'\u2013'})},t)}).filter($e)]})]}):null]})})}),!re&&o?(0,V.jsx)(h.default,{testID:"rota-team-on",children:(0,V.jsx)(f.Card,{children:fe.map((e,t)=>(0,V.jsx)(j.TeamOnDay,{date:e,meId:o,label:(0,C.niceDate)((0,C.parseYmd)(e))},e)).filter($e)})}):null,re&&he?(0,V.jsx)(f.Card,{children:(0,V.jsxs)(h.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Labour this week"}),(0,V.jsx)(h.default,{testID:"labour-week-cost",children:(0,V.jsx)(f.T,{weight:"semibold",children:(0,S.gbp)(we)})})]}),(0,V.jsxs)(f.Muted,{children:[(0,S.gbp)(we)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,V.jsx)(f.T,{weight:"semibold",colour:D.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,V.jsx)(f.Muted,{children:`Forecasts start once CoverCharge has ${1===ce.weeks?'1 week':`${ce.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ce.booked?(0,V.jsx)(h.default,{testID:"labour-booked",children:(0,V.jsxs)(f.T,{children:["Booked so far: ",ce.booked," Covers this week"]})}):null]})}):null,re&&!he?(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,V.jsxs)(f.Row,{gap:6,children:['example'===ce.mode?(0,V.jsx)(L.ExampleBadge,{}):null,(0,V.jsx)(f.Badge,{kind:ke(we,ye)>30?'red':'ok',label:`${ke(we,ye)}% this week`})]})]}),(0,V.jsxs)(f.Muted,{children:[(0,S.gbp)(we)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,S.gbp)(ye)," forecast sales. Target 25\u201330%. ",'example'===ce.mode?'Example figures: forecast sales use an example spend per cover.':'Forecast sales are your average takings for each weekday from your cash-ups.']}),(()=>{const e=ke(je[5],ue[5]);return e&&e<24?(0,V.jsxs)(f.T,{size:14,colour:D.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,re?(0,V.jsx)(f.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===F?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v.SectionHead,{title:"Shift swaps & cover"}),x.filter(e=>re||e.fromId===o||e.toId===o).map(e=>{const t=r.find(t=>t.id===e.shiftId),n=i.find(t=>t.id===e.fromId),a=i.find(t=>t.id===e.toId);return(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,V.jsx)(f.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,V.jsxs)(f.Muted,{children:[t?`${$.DAY3[t.day]} ${(0,$.fmtH)(t.start)}\u2013${(0,$.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&re?(0,V.jsxs)(f.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:i.filter(e=>U(n,e)).map(t=>(0,V.jsx)(f.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,V.jsx)(f.Button,{small:!0,label:"Approve",disabled:!e.toId||!U(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(i.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,T.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${$.DAY3[t.day]} ${(0,$.fmtH)(t.start)}\u2013${(0,$.fmtH)(t.end)})`:''}`)}}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),re?null:(0,V.jsxs)(f.Card,{children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,V.jsx)(f.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,V.jsx)(f.Muted,{testID:"swap-dept-note",children:(0,w.isAnchorageVenue)(y.VENUE_RID)?w.ANCHORAGE_SWAP_NOTE:K(i.find(e=>e.id===o))?w.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),me.filter(e=>e.staffId===o).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=x.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,V.jsxs)(h.default,{style:{gap:4,paddingVertical:4},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:14,weight:"medium",children:[$.DAY3[e.day]," ",(0,$.fmtH)(e.start),"\u2013",(0,$.fmtH)(e.end),(0,E.cleanBadge)(e.badge)?` \xb7 ${(0,E.cleanBadge)(e.badge)}`:'']}),t?(0,V.jsx)(f.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:o,kind:'cover',note:'Can anyone cover?'}),(0,T.autoPost)('all',`Cover needed: ${$.DAY3[e.day]} ${(0,$.fmtH)(e.start)}\u2013${(0,$.fmtH)(e.end)} (${(i.find(e=>e.id===o)?.name??'').replace(' (example)','')})`)}}),i.filter(e=>U(i.find(e=>e.id===o),e)).map(t=>(0,V.jsx)(f.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:o,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),me.some(e=>e.staffId===o)?null:(0,V.jsx)(f.Muted,{children:"No shifts on the rota this week."})]}),(0,V.jsx)(v.SectionHead,{title:"Holiday & time off"}),re?(0,V.jsx)(f.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>ie(!0)}):o?(0,V.jsx)(k.RequestTimeOff,{meId:o,me:le,testID:"rota-requests-time-off"}):null,m.filter(e=>re||e.staffId===o).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,V.jsx)(f.Card,{children:(0,V.jsxs)(h.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:(i.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,V.jsx)(f.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,V.jsxs)(f.Muted,{children:[(0,k.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&re?(0,V.jsxs)(f.Row,{gap:6,style:{justifyContent:'center'},children:[(0,V.jsx)(f.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),re&&o?(0,V.jsx)(k.TimeOffSheet,{visible:Q,onClose:()=>ie(!1),meId:o,me:le,manager:!0}):null]}):null,'availability'===F?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(f.Muted,{children:["Days each person can\u2019t work. ",re?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ie.filter(e=>'owner'!==e.role||!re).map(e=>(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{gap:8,children:[(0,V.jsx)(O.StaffAvatar,{id:e.id,size:30}),(0,V.jsx)(f.T,{weight:"semibold",children:e.name})]}),(0,V.jsx)(f.Row,{wrap:!0,gap:4,children:$.DAY3.map((t,n)=>{const a=(u[e.id]??[]).includes(n);return(0,V.jsx)(f.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,H?(0,V.jsx)(_.AssignRoleSheet,{name:(i.find(e=>e.id===H.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,C.niceDate)((0,C.parseYmd)(H.date))} \xb7 ${(0,$.fmtH)(H.shift.start)}\u2013${(0,$.fmtH)(H.shift.end)}`,current:H.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,E.assignShiftBadge)(s.useOwner.getState().shifts,H.shift.id,e)),W(null)},onEditTimes:()=>{z(H),W(null)},onClose:()=>W(null)}):null,A?(0,V.jsx)(te,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:a,meId:u,me:m,r:g,rid:p}=(0,$.useCtx)(5e3),x=((0,M.useClockArea)(e=>e.areas[p]),(0,M.areaOf)(p));const j=(0,B.privateClockVenue)(p),[w,y]=(0,l.useState)(!1),k=(0,s.useOwner)(e=>e.consent[u]),I=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),S=(0,s.useOwner)(e=>e.shifts),[v,T]=(0,l.useState)(!1),[L,H]=(0,l.useState)(null),[N,W]=(0,l.useState)(null),[Y,F]=(0,l.useState)(void 0),[E,_]=(0,l.useState)(null),[q,K]=(0,l.useState)(!1),[U,G]=(0,l.useState)(null),Q=I.filter(t=>t.staffId===u&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],X=Q&&(0,s.isOnBreak)(Q)?Q.breaks[Q.breaks.length-1]:void 0,J=(0,s.visibleShifts)(S,'staff'!==a).find(e=>e.staffId===u&&e.date===t),Z='staff'!==a,ee=Q?(0,$.paidMins)({in:Q.in},e).worked:0,te=x.on&&(0,P.areaSet)(x),se=Q?.geo?.[Q.geo.length-1],ne=I.filter(e=>e.staffId===u&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],ae=(0,r.useClockNotSent)(Q?.id??E?.id??ne?.id),[oe,re]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if(ae)re(!0);else if(oe){const e=setTimeout(()=>re(!1),6e3);return()=>clearTimeout(e)}},[ae]);const de=!ae&&oe,ce=async(s,n={})=>{H(s),W(null),F(void 0);const a=await(0,R.clockAction)(s,{rid:p,staffId:u,date:t,at:new Date(e.getTime()).toISOString(),...n});return H(null),a.ok?('out'===s&&a.att&&(_(a.att),(0,i.hrSettingsOf)(g.settings?.hr).on&&!o.useHr.getState().hasAnswered(p,a.att.id)&&G(a.att)),'in'===s&&_(null),a.att&&(0,r.markClockUnsent)(a.att.id),!0):(W(a.message),F(a.fix),(0,A.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return k?(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.Row,{gap:10,style:{flex:1},children:[(0,V.jsx)(O.StaffAvatar,{id:u,size:48}),(0,V.jsx)(f.T,{weight:"semibold",style:{flex:1},children:m})]}),(0,V.jsx)(f.Badge,{kind:Q?'ok':'neutral',label:Q?`On shift since ${(0,C.hm)(new Date(Q.in))}`:'Not clocked in'})]}),(0,V.jsx)(f.Muted,{children:J?`Today's shift: ${(0,$.fmtH)(J.start)}\u2013${(0,$.fmtH)(J.end)}`:'No shift on the rota today'}),(0,V.jsx)(h.default,{testID:"clock-area-line",children:(0,V.jsx)(f.T,{size:14,colour:D.colours.muted,children:te?j?`Location is checked only when you choose Clock in, at ${g.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${g.name}.`:x.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),se&&!0===se.inside&&null!=se.dist?(0,V.jsxs)(f.Muted,{children:["Last check: at the venue (about ",se.dist," m from the centre)."]}):null,Q?(0,V.jsx)(f.T,{size:30,weight:"bold",center:!0,children:(0,$.hmDur)(ee)}):null,Q&&X?(0,V.jsx)(h.default,{testID:"on-break",children:(0,V.jsxs)(f.T,{size:15,weight:"semibold",colour:D.colours.gold,center:!0,children:["On a break since ",(0,C.hm)(new Date(X.start))," \xb7 ",(0,s.loggedBreakMins)(Q,e)," min so far"]})}):null,Q?(0,V.jsxs)(V.Fragment,{children:[X?(0,V.jsx)(f.Button,{testID:"break-end",kind:"success",label:'break_end'===L?'Checking your location\u2026':'End break',disabled:!!L,onPress:()=>{ce('break_end')}}):(0,V.jsx)(f.Button,{testID:"break-start",kind:"secondary",label:'break_start'===L?'Checking your location\u2026':'Start break',disabled:!!L,onPress:()=>{ce('break_start')}}),(0,V.jsx)(f.Button,{testID:"clock-out",kind:"danger",label:'out'===L?'Checking your location\u2026':'Clock out',disabled:!!L,onPress:()=>{Q.breaks?.length?ce('out'):(W(null),T(!0))}})]}):(0,V.jsx)(f.Button,{testID:"clock-in",kind:"success",label:'in'===L?'Checking your location\u2026':'Clock in',disabled:!!L,onPress:()=>{j?y(!0):ce('in')}}),ae?(0,V.jsxs)(h.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,V.jsx)(f.T,{size:18,weight:"bold",colour:D.colours.gold,center:!0,children:"Not sent yet"}),(0,V.jsx)(f.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,V.jsx)(f.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{d.mutationQueue.retryNow()}})]}):de?(0,V.jsx)(h.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,V.jsx)(f.T,{size:14,colour:D.colours.ok,center:!0,children:"\u2713 Sent"})}):null,Q?.breaks?.length?(0,V.jsxs)(f.Muted,{center:!0,children:["Breaks today: ",Q.breaks.map(e=>`${(0,C.hm)(new Date(e.start))}\u2013${e.end?(0,C.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(Q,e)," min)"]}):null,N?(0,V.jsx)(h.default,{testID:"clock-message",children:(0,V.jsx)(f.Banner,{kind:"warn",title:"Not recorded",children:N})}):null,N&&'settings'===Y?(0,V.jsx)(f.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:z.openAppSettings}):null,N&&'location'===Y?(0,V.jsx)(f.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:z.openLocationSettings}):null,N&&'update'===Y?(0,V.jsx)(f.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:z.checkAppUpdate}):null]}),Z&&!(0,P.areaSet)(x)?(0,V.jsx)(h.default,{testID:"clock-area-warning",children:(0,V.jsx)(f.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,V.jsx)(c.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>K(!0),style:{alignSelf:'center',padding:6},children:(0,V.jsx)(f.T,{size:14,colour:D.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,V.jsx)(le,{onClose:()=>K(!1)}):null,(0,V.jsx)(b.BreakRoomCard,{staffId:u,name:m,now:e}),E?(()=>{const t=(0,$.paidMins)(E,e);return(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsxs)(f.T,{weight:"semibold",colour:D.colours.gold,children:["Clocked out at ",(0,C.hm)(new Date(E.out))]}),(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["Clocked ",(0,$.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,$.hmDur)(t.paid)]}),(0,V.jsxs)(f.Muted,{children:["In ",(0,C.hm)(new Date(E.in))," \xb7 out ",(0,C.hm)(new Date(E.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",E.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,V.jsx)(f.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,V.jsx)(f.Sheet,{visible:w,onClose:()=>y(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,V.jsxs)(h.default,{style:{gap:12},children:[(0,V.jsxs)(f.T,{children:["We check once that you are at ",g.name,", within about ",x.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,V.jsx)(f.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,V.jsx)(f.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{y(!1),ce('in')}}),(0,V.jsx)(f.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>y(!1)})]})}),Z?(0,V.jsx)(ie,{rid:p,today:t,now:e}):null,U?(0,V.jsx)(n.ShiftCheckout,{rid:p,shiftKey:U.id,day:U.date,meId:u,onClose:()=>G(null)}):null,(0,V.jsx)(f.Sheet,{visible:v,onClose:()=>T(!1),title:"Did you take a break? If so, how long?",children:(0,V.jsxs)(h.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,V.jsx)(f.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,V.jsx)(f.Chip,{testID:`forgot-break-${e}`,label:(0,P.breakLabel)(e),disabled:e>=ee,onPress:()=>{T(!1),ce('out',{addedBreak:e})}},e))}),(0,V.jsx)(f.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{T(!1),ce('out',{breakMins:0})}}),ee>360?(0,V.jsx)(f.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,V.jsx)(f.Muted,{children:j?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,V.jsx)(h.default,{style:{gap:10},children:(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsx)(f.T,{weight:"semibold",colour:D.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(f.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",g.name,", within about ",x.radius," m."]}),(0,V.jsx)(f.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,V.jsxs)(V.Fragment,{children:[" ",(0,V.jsxs)(f.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,V.jsx)(f.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",g.name," (within about ",x.radius," m)."]}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,V.jsx)(f.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(u,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,$.useCtx)(3e4);return s!=='staff'?(0,V.jsx)(de,{now:e,today:t,meId:n}):(0,V.jsx)(re,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]);_r(_d[9]);var c=e(_r(_d[10])),u=e(_r(_d[11])),h=e(_r(_d[12])),f=_r(_d[13]),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),B=_r(_d[32]),P=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),W=_r(_d[40]),Y=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),V=_r(_d[46]);const K=e=>(0,w.deptKey)(e?.dept),U=(e,t)=>(0,w.canSwapWith)(e,t,y.VENUE_RID),G=2650,Q=1900,X=e=>e.end-e.start,J=e=>e>8?.5:e>6?.3333333333333333:0,Z=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,$.weekday)(e)),t};function ee(e){const{rid:t,r:s,now:n}=(0,$.useCtx)(6e4),a=(0,m.useBookings)(t),o=(0,m.useOrders)(t),i=(0,m.useEvents)(t),r=(0,L.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,C.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),n=a.filter(e=>!e.walkIn&&'confirmed'===e.status&&t.some(t=>(0,C.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,H.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:l,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:l,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:l,booked:n,sales:t.map(e=>{const t=(0,I.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*G+t.restOfDay.takeaway*Q:0})}},[s,a,o,i,r,(0,C.ymd)(e)])}function te({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,l.useState)(e.shift?.start??12),[i,r]=(0,l.useState)(e.shift?.end??20),[d,c]=(0,l.useState)(e.shift?.breakAt),[u,m]=(0,l.useState)((0,E.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,V.jsxs)(f.Sheet,{visible:!0,onClose:t,title:(0,F.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,V.jsx)(f.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,k.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,V.jsx)(f.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,V.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,V.jsx)(f.Chip,{label:"None",selected:!u,onPress:()=>m(void 0),testID:"shift-badge-none"}),E.ROLE_BADGES.map(e=>(0,V.jsx)(f.Chip,{label:e,selected:u===e,onPress:()=>m(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,V.jsx)(f.Chip,{label:`${e} ${(0,$.fmtH)(t)}\u2013${(0,$.fmtH)(s)}`,selected:a===t&&i===s,onPress:()=>{o(t),r(s)}},e))}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{children:"Start"}),(0,V.jsx)(f.Stepper,{testID:"shift-start",value:a,step:.5,min:F.SHIFT_MIN_START,max:i-1,onChange:o,format:$.fmtH,label:"Start time"})]}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,V.jsx)(f.T,{children:"End"}),(0,V.jsxs)(h.default,{style:{alignItems:'flex-end'},children:[(0,V.jsx)(f.Stepper,{testID:"shift-end",value:i,step:.5,min:a+1,max:F.SHIFT_MAX_END,onChange:r,format:$.fmtH,label:"End time"}),i>=24?(0,V.jsx)(f.Muted,{children:"next day"}):null]})]}),(0,V.jsxs)(f.Muted,{children:[(i-a).toFixed(1),"h scheduled",J(i-a)?`, ${Math.round(60*J(i-a))}m planned break`:'']}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,V.jsx)(f.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,V.jsx)(f.Chip,{label:"Set a break time",onPress:()=>c(Math.min(i-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(i-a)/2)))/4)))}):(0,V.jsxs)(f.Row,{gap:6,children:[(0,V.jsx)(f.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:i-.25,onChange:c,format:$.fmtH,label:"Break time"}),(0,V.jsx)(f.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,V.jsx)(f.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,V.jsx)(f.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:i,breakAt:g?d:void 0,badge:(0,E.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:i,...void 0!==d&&g?{breakAt:d}:{},...(0,E.cleanBadge)(u)?{badge:(0,E.cleanBadge)(u)}:{}}),t()}}),(0,V.jsx)(f.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,V.jsx)(f.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const se=6;function ne(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*se:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+se),big:o>=104,fits:!e||s+t*(o+se)<=e}}const ae={position:'sticky',top:0};function oe({fits:e,children:t}){return e?(0,V.jsx)(h.default,{style:{alignItems:'center'},children:t}):(0,V.jsx)(u.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function ie({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),i=(0,$.useSignedIn)(),{me:r,meId:d}=(0,$.useCtx)(3e4),[c,u]=(0,l.useState)(null),[h,m]=(0,l.useState)(''),[g,p]=(0,l.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,R.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:i?.id??d,name:i?.name??r},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,A.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),p(null)};return(0,V.jsxs)(f.Card,{children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Record it for someone"}),(0,V.jsx)(f.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:a.map(e=>(0,V.jsx)(f.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:x?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,V.jsx)(f.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,V.jsx)(f.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,V.jsx)(f.T,{size:13,colour:D.colours.red,children:g}):null]}):null]})}function le({onClose:e}){const{now:t,today:n,meId:a}=(0,$.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),i=(0,s.useOwner)(e=>e.shifts),r=Array.from({length:7},(e,t)=>(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(n),1440*-t))),[d,c]=(0,l.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(i,!1).find(e=>e.staffId===a&&e.date===d),[m,g]=(0,l.useState)(u&&!u.out?'out':'in'),[p,b]=(0,l.useState)(h?Math.round(60*h.start):720),[j,w]=(0,l.useState)(h?Math.round(60*h.end):1200),[y,k]=(0,l.useState)(''),[I,S]=(0,l.useState)(!1),v=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==m,O='in'!==m,M=T&&O&&j<=p,B=(e,t)=>(0,V.jsx)(f.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,V.jsxs)(f.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,V.jsx)(f.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,V.jsx)(f.Button,{label:"Done",onPress:e})]}):(0,V.jsxs)(f.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,V.jsx)(f.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:r.map(e=>(0,V.jsx)(f.Chip,{label:e===n?'Today':(0,C.niceDate)((0,C.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,V.jsxs)(f.Muted,{children:[h?`Your rota that day: ${(0,$.fmtH)(h.start)}\u2013${(0,$.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,C.hm)(new Date(u.in))}\u2013${u.out?(0,C.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Forgot to clock in",selected:'in'===m,onPress:()=>g('in')}),(0,V.jsx)(f.Chip,{label:"Forgot to clock out",selected:'out'===m,onPress:()=>g('out')}),(0,V.jsx)(f.Chip,{label:"Forgot both",selected:'both'===m,onPress:()=>g('both')})]}),T?(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["In ",v(p)]}),B(b,p)]}):null,O?(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["Out ",v(j),j>=1440?' (next day)':'']}),B(w,j)]}):null,M?(0,V.jsx)(f.T,{size:13,colour:D.colours.red,children:"Clock-out must be after clock-in."}):null,(0,V.jsx)(f.Field,{label:"Note for your manager (optional)",value:y,onChangeText:k,placeholder:"e.g. phone died",maxLength:200}),(0,V.jsx)(f.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:m,suggestedIn:T?(0,x.isoAt)(d,p):void 0,suggestedOut:O?(0,x.isoAt)(d,j):void 0,note:y.trim(),at:t.toISOString()}),S(!0)}})]})}function re(){const{now:e,today:t,meId:n}=(0,$.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),i=(0,s.useOwner)(e=>e.timeRequests),[r,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),m=(0,C.ymd)(Z(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=m),b=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),w=i.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,V.jsxs)(h.default,{style:{gap:10},testID:"my-timesheet",children:[(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,V.jsxs)(h.default,{children:[(0,V.jsx)(f.T,{size:12,colour:D.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,V.jsx)(f.T,{size:28,weight:"bold",colour:D.colours.ok,children:(0,$.hmDur)(b)})]}),(0,V.jsxs)(h.default,{style:{alignItems:'flex-end'},children:[(0,V.jsx)(f.T,{size:12,colour:D.colours.muted,children:"PENDING SIGN-OFF"}),(0,V.jsx)(f.T,{size:18,weight:"semibold",colour:j?D.colours.amber:D.colours.muted,children:(0,$.hmDur)(j)})]})]}),(0,V.jsx)(f.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,V.jsx)(f.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,V.jsx)(v.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,V.jsxs)(h.default,{style:{flex:1},children:[(0,V.jsxs)(f.T,{size:14,children:[(0,C.niceDate)((0,C.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,V.jsxs)(f.Muted,{children:[e.suggestedIn?`in ${(0,C.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,C.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,V.jsx)(f.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,V.jsx)(v.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,$.paidMins)(t,e),i=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,V.jsxs)(f.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(h.default,{style:{flex:1},children:[(0,V.jsx)(f.T,{weight:"semibold",children:(0,C.niceDate)((0,C.parseYmd)(t.date))}),(0,V.jsxs)(f.Muted,{children:[(0,C.hm)(new Date(t.in)),"\u2013",t.out?(0,C.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,$.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,$.fmtH)(n.start)}\u2013${(0,$.fmtH)(n.end)}`:'']})]}),(0,V.jsx)(f.Badge,{kind:(0,x.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,x.statusLabel)(t)})]}),i?(0,V.jsxs)(f.T,{size:13,colour:D.colours.gold,children:["Adjusted by ",i.by.replace(' (example)',''),i.reason?`: ${i.reason}`:'']}):null,t.signOff?(0,V.jsxs)(f.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,V.jsx)(x.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,V.jsx)(f.Muted,{children:"No clocked shifts yet."}),r?(0,V.jsx)(le,{onClose:()=>d(!1)}):null]})}function de({now:e,today:n}){const o=(0,s.useOwner)(e=>e.staff),i=(0,s.useOwner)(e=>e.shifts),r=(0,$.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),u=(0,s.useOwner)(e=>e.timeRequests),m=(0,s.useOwner)(e=>e.leave),p=(0,s.useOwner)(e=>e.attLog),[b,j]=(0,l.useState)(n),[w,y]=(0,l.useState)(null),[k,I]=(0,l.useState)(!1),[T,M]=(0,l.useState)(!1),B=!!(0,$.useSignedIn)(),P=T?(0,N.pastWeekDays)(b,n):Array.from({length:7},(e,t)=>(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===b&&e.in),A=i.filter(e=>e.date===b&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>P.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),Y=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),F=L.reduce((t,s)=>t+(0,$.paidMins)(s,e).paid/60*(r[s.staffId]??0),0),E=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=o.find(e=>e.id===t.staffId),a=(0,s.shiftOf)(i,t.staffId,t.date),l=(0,$.paidMins)(t,e),d=r[t.staffId]??0;return`${n?.name},${t.date},${a?`${(0,$.fmtH)(a.start)}-${(0,$.fmtH)(a.end)}`:'-'},${(0,C.hm)(new Date(t.in))},${(0,C.hm)(new Date(t.out))},${l.brk},${(l.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(l.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==r[t.staffId]?'Rate not set':n?.noTax&&B?'No tax deducted':''}`}));return(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsx)(W.HoursDayPicker,{testID:"ts-pick",date:b,today:n,custom:T,onDate:e=>{j(e),M(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),M(!1)}}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:P.map(e=>(0,V.jsx)(f.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,N.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':T?(0,N.chipDay)(e):(0,C.niceDate)((0,C.parseYmd)(e)).slice(0,6).trim(),selected:b===e,onPress:()=>j(e)},e))}),(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",testID:"ts-week-title",children:T?(0,N.weekTitle)(b,n):'Last 7 days'}),(0,V.jsx)(f.Badge,{kind:"ok",label:`${(0,$.hmDur)(H)} confirmed`})]}),Y?(0,V.jsxs)(f.T,{size:13,colour:D.colours.amber,children:[(0,$.hmDur)(Y)," pending sign-off (not counted yet)"]}):null,(0,V.jsxs)(f.Muted,{children:["Labour cost ",(0,S.gbp)(Math.round(F))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,V.jsx)(a.WideTable,{children:(0,V.jsxs)(h.default,{style:{gap:2},children:[(0,V.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:D.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,V.jsx)(f.T,{size:12,weight:"semibold",colour:D.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const l=o.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(i,t.staffId,b),d=(0,$.paidMins)(t,e),h=(0,x.flagsFor)(t,r,e,n,u).map(e=>e.label);return(0,V.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,V.jsxs)(f.Row,{gap:4,style:{width:110},children:[(0,V.jsx)(O.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,V.jsx)(f.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:l?.name.replace(' (example)','')})]}),(0,V.jsx)(f.T,{size:12,style:{width:86},colour:D.colours.muted,children:r?`${(0,$.fmtH)(r.start)}\u2013${(0,$.fmtH)(r.end)}`:'\u2013'}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:(0,C.hm)(new Date(t.in))}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:t.out?(0,C.hm)(new Date(t.out)):'on'}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,V.jsx)(f.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,$.hmDur)(d.paid):`${(0,$.hmDur)(d.worked)}\u2026`}),(0,V.jsx)(f.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?D.colours.ok:'open'===(0,s.attStatus)(t)?D.colours.blue:D.colours.amber,children:(0,x.statusLabel)(t)}),(0,V.jsx)(f.T,{size:11,style:{width:140},colour:h.length?D.colours.amber:D.colours.ok,children:h.join(', ')||'OK'}),(0,V.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${l?.name}`,onPress:()=>y(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,V.jsx)(f.T,{size:12,colour:D.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,V.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,V.jsx)(f.T,{size:12,style:{width:110},children:o.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,V.jsxs)(f.T,{size:12,style:{width:86},colour:D.colours.muted,children:[(0,$.fmtH)(t.start),"\u2013",(0,$.fmtH)(t.end)]}),(()=>{const s=(0,g.leaveCovering)(m,t.staffId,t.date);return s?(0,V.jsxs)(f.T,{size:12,colour:D.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,g.leaveLabel)(s)," (rota covered)"]}):(0,V.jsx)(f.T,{size:12,colour:b===n&&60*t.start>60*e.getHours()+e.getMinutes()?D.colours.muted:D.colours.red,children:b===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,V.jsx)(f.Muted,{children:"No shifts or clock records for this day."}),(0,V.jsx)(f.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,V.jsx)(f.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,V.jsx)(v.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,V.jsxs)(f.Muted,{children:[(0,C.niceDate)(new Date(e.at))," ",(0,C.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,V.jsx)(f.Muted,{children:"No manual changes yet."}),w?(0,V.jsx)(x.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>y(null)}):null,(0,V.jsxs)(f.Sheet,{visible:k,onClose:()=>I(!1),title:"Payroll export",children:[(0,V.jsxs)(f.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",Y?`${(0,$.hmDur)(Y)} still pending sign-off is left out.`:'']}),(0,V.jsxs)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[E.slice(0,14).map((e,t)=>(0,V.jsx)(f.T,{size:10,colour:t?D.colours.text:D.colours.gold,children:e},t)),E.length>14?(0,V.jsxs)(f.Muted,{children:["\u2026 ",E.length-14," more rows"]}):null]}),(0,V.jsxs)(f.Muted,{children:[E.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1060,[931,861,1049,1464,1274,1275,31,1042,1072,123,264,152,128,818,823,970,1477,1469,1087,1478,1100,5,1101,876,820,822,825,1075,1050,951,994,1292,868,869,1176,978,1411,1090,1091,1472,1474,1408,1098,976,1479,807,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return O}}),_e.allocate=D,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:v,role:P,meId:B,me:F}=(0,x.useCtx)(6e4),R=(0,u.useOwner)(e=>e.staff),N=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),A=(0,u.useOwner)(e=>e.shifts),L=(0,u.useOwner)(e=>e.tronc),z=(0,u.useOwner)(e=>e.troncCash),_=(0,u.useOwner)(e=>e.troncHistory),V=(0,u.useOwner)(e=>e.troncLog),U=(0,c.useOrders)(C),q=(0,j.useVenuePay)(C).pay,[H,W]=(0,i.useState)(-1),[Y,K]=(0,i.useState)(''),[G,Q]=(0,i.useState)(!1),[J,X]=(0,i.useState)(!1),[Z,ee]=(0,i.useState)(L.text),[te,se]=(0,i.useState)(null),oe='staff'!==P,ie='owner'===P,{s:ne,e:re,key:le}=(0,j.venueRange)(q,'tips',H,S),ae=`${(0,h.niceDate)(ne)} \u2013 ${(0,h.niceDate)(re)} ${re.getFullYear()}`,de=_.find(e=>e.key===le),ce=e=>u.useOwner.getState().setOwner({tronc:{...L,...e}}),ue=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),pe=Math.round((re.getTime()-ne.getTime())/864e5)+1,he=(0,i.useMemo)(()=>{let e=U.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(ne)&&e.createdAt.slice(0,10)<=(0,h.ymd)(re)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!ue)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[le,U.length,ue]),me=(0,T.useCashUp)(e=>e.cashUps),fe=Math.round(100*(0,k.cashUpTipsBetween)(me,C,(0,h.ymd)(ne),(0,h.ymd)(re))),ye=z[le]??0,ge=de?de.pot:he+fe+ye,xe=(0,i.useMemo)(()=>{const e={};for(let t=0;tv)break;const o=(0,h.ymd)(s);R.forEach(t=>{const s=N.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[le,N.length,A.length,R.length]),je=R.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&L.includeManagers||'owner'===e.role&&L.includeOwner)),be=(0,i.useMemo)(()=>{if(de)return de.rows;const e=je.map(e=>{const t=(xe[e.id]?.paid??0)/60,s=L.points[O(e)]??1;return'hours'===L.method?t:'points'===L.method?t*s:'equal'===L.method?t>0?1:0:L.custom[e.id]??0}),{amounts:t}=D(ge,e),s=e.reduce((e,t)=>e+t,0);return je.map((o,i)=>({staffId:o.id,hours:(xe[o.id]?.paid??0)/60,points:L.points[O(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[de,je.map(e=>e.id).join(),xe,L,ge]),we=be.reduce((e,t)=>e+t.amount,0),Te=de?0:(()=>{const e=be.map(e=>e.pct);return D(ge,e).remainder})(),Ce=Object.entries(L.custom).filter(([e])=>je.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),Se='custom'===L.method&&Math.abs(Ce-100)>.01,ke=new Date(re.getFullYear(),re.getMonth()+2,0),ve=[..._].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==_.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),Me=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(be.map(e=>{const t=R.find(t=>t.id===e.staffId);return`${I(t.name)},${O(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(we/100).toFixed(2)}`]);return oe?(0,M.jsxs)(l.default,{style:{gap:10},children:[(0,M.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,M.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,M.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>W(H-1)}),(0,M.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,M.jsx)(d.T,{weight:"semibold",children:ae}),de?(0,M.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${de.lockedAt}`}):H>=0?(0,M.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,M.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:H>=0,onPress:()=>W(H+1)})]}),(0,M.jsxs)(d.Card,{children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Card tips on orders"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.card:he)})]}),(0,M.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.cashUps??0:fe)})]})}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Other cash tips"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.cash:ye)})]}),de?null:(0,M.jsxs)(d.Row,{gap:6,children:[(0,M.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:Y,onChangeText:K,style:[d.styles.input,{flex:1}]}),(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(Y)>=0)||''===Y.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{...z,[le]:Math.round(100*Number(Y))}}),K('')}})]}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,M.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(ge)})]}),(0,M.jsx)(d.Muted,{children:ue?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),de?(0,M.jsxs)(d.Muted,{children:["Locked with method: ",$[de.method],"."]}):(0,M.jsxs)(d.Card,{children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,M.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys($).map(e=>(0,M.jsx)(d.Chip,{label:$[e],selected:L.method===e,onPress:()=>ie&&ce({method:e})},e))}),ie?null:(0,M.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===L.method?Object.entries(L.points).map(([e,t])=>(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:e}),(0,M.jsx)(d.Row,{gap:6,children:(0,M.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ie&&ce({points:{...L.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===L.method?(0,M.jsxs)(M.Fragment,{children:[je.map(e=>(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{style:{flex:1},children:I(e.name)}),(0,M.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(L.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ce({custom:{...L.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ce({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,M.jsxs)(d.T,{size:13,colour:Se?m.colours.red:m.colours.ok,children:["Total ",Ce.toFixed(1),"%",Se?' (must be 100%)':' \u2713']})]}):null,(0,M.jsx)(d.Toggle,{label:"Include managers",value:L.includeManagers,onChange:e=>ie&&ce({includeManagers:e})}),(0,M.jsx)(d.Toggle,{label:"Include owner",value:L.includeOwner,onChange:e=>ie&&ce({includeOwner:e})}),L.includeOwner?(0,M.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,M.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[be.map(e=>{const t=R.find(t=>t.id===e.staffId);return(0,M.jsxs)(d.Card,{children:[(0,M.jsxs)(d.T,{center:!0,weight:"semibold",children:[I(t?.name),xe[e.staffId]?.est&&!de?'*':'']}),(0,M.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,M.jsxs)(d.T,{center:!0,children:["Points: ",'points'===L.method||'points'===de?.method?e.points.toFixed(1):'\u2013']}),(0,M.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,M.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,M.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(we)]})]}):(0,M.jsx)(r.default,{horizontal:!0,children:(0,M.jsxs)(l.default,{children:[(0,M.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,M.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),be.map(e=>{const t=R.find(t=>t.id===e.staffId);return(0,M.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,M.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[I(t?.name),xe[e.staffId]?.est&&!de?'*':'']}),(0,M.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,M.jsx)(d.T,{size:13,style:{width:54},children:'points'===L.method||'points'===de?.method?e.points.toFixed(1):'\u2013'}),(0,M.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,M.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,M.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,M.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,M.jsx)(d.T,{size:13,weight:"bold",colour:we===ge?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(we)})]})]})}),(0,M.jsxs)(d.Muted,{children:[we===ge?`\u2713 Total equals the pot (${(0,p.gbp)(ge)}).`:'\u2717 Total does not equal the pot.',Te?` Rounding: ${Te}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),de?null:(0,M.jsx)(d.Button,{label:"Approve & lock period",disabled:!ie||H>=0||Se||we!==ge||ge<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${le}`,key:le,label:ae,end:(0,h.ymd)(re),pot:ge,card:he,cash:ye,cashUps:fe,method:L.method,rows:be,lockedAt:e,by:F};u.useOwner.getState().setOwner({troncHistory:[t,..._],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${F} approved & locked tips for ${ae}: ${(0,p.gbp)(ge)} split ${$[L.method].toLowerCase()} between ${be.filter(e=>e.amount>0).length} staff`},...V]})}}),!de&&H>=0?(0,M.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ie||de?null:(0,M.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,M.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>Q(!0)}),de?(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:de.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!de.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${ae} approved: ${(0,p.gbp)(de.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:_.map(e=>e.id===de.id?{...e,shared:(0,h.niceDate)(S)}:e)}),se('Posted to All staff chat.')}}):null]}),te?(0,M.jsx)(d.Banner,{kind:"info",title:te}):null,(0,M.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,M.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(ge)} = allocated ${(0,p.gbp)(we)}`],[L.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(ke)} ${ke.getFullYear()}`],[!0,'Tip records kept for 3 years',`${_.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${V.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,M.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,M.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,M.jsxs)(l.default,{style:{flex:1},children:[(0,M.jsx)(d.T,{size:14,children:t}),(0,M.jsx)(d.Muted,{children:s})]})]},String(t))),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{ee(L.text),X(!0)}})]}),(0,M.jsx)(y.SectionHead,{title:"Tip history & audit log"}),_.map(e=>(0,M.jsxs)(d.Card,{children:[(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{weight:"semibold",children:e.label}),(0,M.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,M.jsxs)(d.Muted,{children:[$[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),V.map(e=>(0,M.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),_.length||V.length?null:(0,M.jsx)(d.Muted,{children:"No approved periods yet."}),(0,M.jsxs)(d.Sheet,{visible:G,onClose:()=>Q(!1),title:"Tips summary export",children:[(0,M.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,M.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Me.map((e,t)=>(0,M.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,M.jsxs)(d.Muted,{children:[ae," \xb7 ",$[de?.method??L.method]]})]}),(0,M.jsxs)(d.Sheet,{visible:J,onClose:()=>X(!1),title:"Tipping policy",children:[(0,M.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ie,value:Z,onChangeText:ee,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ie?(0,M.jsx)(d.Button,{label:"Save policy",onPress:()=>{ce({text:Z}),X(!1)}}):null,(0,M.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,M.jsx)(E,{})},_e.useStaffTips=N,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=N(e,t);(0,i.useEffect)(()=>{if(!o.showToday||F()||P.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=N(e,t),r=`Tip pot this period, ${B(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${B(i)}`;return(0,M.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,M.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,M.jsx)(A,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,M.jsx)(A,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=E;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),v=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);const $={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},O=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',I=e=>(e??'').replace(' (example)','');function D(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const B=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function F(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const R={pot:186.4,today:48.5};function N(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,v.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||P.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),F()?{pot:R.pot,today:R.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function A({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${B(s)}`;return(0,M.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,M.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,M.jsx)(d.Muted,{center:!0,children:o}):(0,M.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:B(s)})]})}function E(e={}){const t=(0,x.useCtx)(6e4),s=N(t.rid,t.today);return(0,M.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,M.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,M.jsx)(A,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,M.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,M.jsx)(A,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1061,[931,873,842,31,264,152,128,288,818,823,861,820,822,825,1050,1075,951,1183,1088,824,1046,1044,13,1406,1182,2,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AccidentBook=function({me:e,meId:t,now:s,app:a,seeAll:c}){const p=(0,d.useSafety)(e=>e.accidents),[y,x]=(0,n.useState)(c?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,h.jsxs)(o.default,{style:{gap:12},testID:"accident-book",children:[(0,h.jsx)(u.Tabs,{value:y,onChange:x,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:c?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,h.jsx)(j,{me:e,meId:t,now:s,app:a,onSaved:()=>x('list')}):null,'list'===y?(0,h.jsxs)(u.Box,{testID:"accident-list",children:[(c?p:w).length?(c?p:w).map(e=>(0,h.jsx)(b,{a:e,manager:c},e.id)):(0,h.jsx)(l.Muted,{children:"No entries yet."}),!c&&f>0?(0,h.jsx)(o.default,{testID:"accident-others",children:(0,h.jsxs)(l.Muted,{children:[f," other entr",1===f?'y is':'ies are'," in the book. Only managers can see other people\u2019s entries and personal details."]})}):null]}):null,(0,h.jsx)(l.Muted,{children:"In an emergency call 999 first. The accident book is kept on this device for now; nothing is sent or reported to anyone."})]})};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),a=e(r(_d[3])),o=e(r(_d[4])),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]);const p=e=>String(e).padStart(2,'0'),y=e=>`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}T${p(e.getHours())}:${p(e.getMinutes())}`,x=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${p(t.getHours())}:${p(t.getMinutes())}`};function j({me:e,meId:a,now:p,app:x,onSaved:j}){const[b,w]=(0,n.useState)({date:y(p).slice(0,10),time:y(p).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[f,T]=(0,n.useState)(''),[D,I]=(0,n.useState)(''),S=e=>w({...b,...e}),C='Near miss'===b.category,v=(e,s,n,a=!1)=>(0,h.jsxs)(o.default,{style:{gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:e}),(0,h.jsx)(t.TextInput,{accessibilityLabel:e,value:String(b[s]),onChangeText:e=>S({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:a,style:[l.styles.input,a&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,h.jsxs)(u.Box,{testID:"accident-form",children:[(0,h.jsx)(l.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,h.jsxs)(l.Row,{gap:8,children:[(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Date (DD/MM/YYYY)"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Date (DD/MM/YYYY)",...(0,s.slashBox)(b.date,e=>S({date:e})),placeholder:"DD/MM/YYYY",keyboardType:"numbers-and-punctuation",maxLength:10,placeholderTextColor:"#7D776C",style:[l.styles.input,{minWidth:0,width:40}]})]}),(0,h.jsxs)(o.default,{style:{width:110,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Time"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Time",value:b.time,onChangeText:e=>S({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:l.styles.input})]})]}),(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"What kind?"}),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:d.ACCIDENT_CATEGORIES.map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.category===e,onPress:()=>S({category:e})},e))}),v('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),v('Person involved','person','Name'),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.personType===e,onPress:()=>S({personType:e})},e))}),v('What happened','what','Describe what happened, in order',!0),v('Injury','injury',C?'None (near miss)':'e.g. small cut to left thumb'),v('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),v('Witnesses','witnesses','Names, or none'),v('Reported by','reportedBy','Your name'),f?(0,h.jsx)(l.Banner,{kind:"warn",children:f}):null,(0,h.jsx)(l.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(b.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(b.time)?b.category?b.location.trim()&&b.person.trim()&&b.what.trim()?(d.useSafety.getState().addAccident({when:`${b.date}T${b.time}`,location:b.location.trim(),person:b.person.trim(),personType:b.personType,category:b.category,what:b.what.trim(),injury:b.injury.trim()||(C?'None (near miss)':'Not recorded'),firstAid:b.firstAid.trim()||'None recorded',witnesses:b.witnesses.trim()||'None',reportedBy:b.reportedBy.trim()||e,reportedById:a,app:x}),I(`Saved to the accident book: ${b.category}, ${b.location.trim()}.`),T(''),w({...b,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void j()):T('Fill in where it happened, who was involved and what happened.'):T('Pick what kind of accident or near miss it was.'):T('Enter the date as DD/MM/YYYY and the time as HH:MM.')}),D?(0,h.jsx)(o.default,{testID:"accident-saved",children:(0,h.jsx)(l.T,{size:14,colour:c.colours.ok,children:D})}):null,(0,h.jsx)(l.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function b({a:e,manager:s}){const u=d.RIDDOR_CATEGORIES.includes(e.category),[p,y]=(0,n.useState)(e.riddorNote??''),[j,b]=(0,n.useState)(!1);return(0,h.jsxs)(o.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,gap:4},children:[(0,h.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,h.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(l.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,h.jsx)(l.Badge,{kind:'Near miss'===e.category?'blue':u?'red':'amber',label:'Near miss'===e.category?'Near miss':u?'Serious':'Accident'})]}),(0,h.jsxs)(l.Muted,{children:[x(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||s?(0,h.jsxs)(o.default,{style:{gap:2},children:[(0,h.jsxs)(l.T,{size:14,children:["What happened: ",e.what]}),(0,h.jsxs)(l.T,{size:14,children:["Injury: ",e.injury]}),(0,h.jsxs)(l.T,{size:14,children:["First aid: ",e.firstAid]}),(0,h.jsxs)(l.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,s&&u?(0,h.jsxs)(o.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,h.jsx)(l.Banner,{kind:"danger",title:"Consider RIDDOR",children:"This may need reporting to the HSE under RIDDOR (for example a specified injury, over-7-day incapacitation, or a member of the public taken to hospital). Check the HSE\u2019s RIDDOR guidance and decide. CoverCharge never reports anything for you."}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:y,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:l.styles.input}),(0,h.jsx)(l.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>d.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,h.jsxs)(l.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1062,[873,834,31,264,128,818,1178,825,1385,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MissedBanner=T,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s,rid:i}){const[l,d]=(0,r.useState)('today'),c=(e,t)=>({id:e,label:t}),p='chef'===s?[c('today','Today'),c('units','Fridges & units'),c('record','Quick entry'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:'managers'===s?[c('today','Today'),c('units','Fridges & units'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:[c('today','Today'),c('record','Quick entry'),c('diary','Diary'),c('history','My entries')],m={me:e,meId:t,now:n,mode:s},x=(0,j.useMaySendInspectorLog)(m);x&&p.splice(p.findIndex(e=>'report'===e.id)+1,0,c('inspector','Inspector'));return p.splice(1,0,c('cooksafe','CookSafe records')),(0,v.jsxs)(u.default,{style:{gap:12},testID:"haccp-log",children:[(0,v.jsx)(o.TempSaveBanner,{}),'today'!==l?(0,v.jsx)(T,{mode:s,now:n,onPress:()=>d('today')}):null,(0,v.jsx)(b.Tabs,{value:l,onChange:d,options:p}),'today'===l?(0,v.jsx)(f.TodayView,{who:m}):null,'cooksafe'===l?(0,v.jsx)(w.CookSafeRecords,{who:m,rid:i}):null,'units'===l?(0,v.jsx)(f.UnitsView,{who:m}):null,'record'===l?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(D,{who:m}),(0,v.jsx)(P,{who:m})]}):null,'diary'===l?(0,v.jsx)(f.DiaryView,{who:m}):null,'weekly'===l?(0,v.jsx)(f.WeeklyView,{who:m}):null,'report'===l?(0,v.jsx)(f.ReportView,{who:m}):null,'inspector'===l&&x?(0,v.jsx)(j.InspectorView,{who:m}):null,'history'===l?(0,v.jsx)(R,{who:m}):null,'limits'===l?(0,v.jsx)(L,{mode:s,editable:'chef'===s}):null,'probes'===l?(0,v.jsx)(A,{mode:s,me:e,now:n}):null,(0,v.jsx)(h.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. This is your CookSafe log (Food Standards Scotland): cross-contamination and allergens, cleaning, chilled storage and cooling, cooking, reheating and hot holding, management and records. Shared with every device at the venue: a reading taken offline sends by itself when the connection is back."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=e(_r(_d[7])),c=e(_r(_d[8])),u=e(_r(_d[9])),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]),b=_r(_d[15]),f=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),C=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),S=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function T({now:e,onPress:t,mode:n="managers"}){const o=(0,s.useSafetyView)(n).points,i=(0,s.useSafetyView)(n).entries,l=(0,m.missedChecks)(o,i,e);if(!l.length)return(0,v.jsx)(u.default,{testID:"haccp-uptodate",children:(0,v.jsx)(h.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const r=(0,v.jsx)(u.default,{testID:"haccp-missed",children:(0,v.jsx)(h.Banner,{kind:"warn",title:`${l.length} food safety check${1===l.length?'':'s'} overdue`,children:l.map(e=>`${e.point.name} (due ${e.due})`).join(' \xb7 ')})});return t?(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:r}):r}function I(e,t){p.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,i.chefCanSee)(l.useOwner.getState().site,t.point)).map(t=>{const n=(0,m.isTempKind)(t.point.kind)?(0,m.inRange)(t.point,t.value):!!t.done;return{pointId:t.point.id,name:t.point.name,kind:t.point.kind,at:e.now.toISOString(),by:e.me.replace(' (example)',''),byId:e.meId,app:e.mode,value:t.value,done:t.done,ok:n,corrective:t.corrective?.trim()||void 0,note:t.note?.trim()||void 0,source:t.source,initials:(0,m.initialsOf)(e.me)}}))}function D({who:e}){const o=(0,s.useSafetyView)(e.mode).points,[d,p]=(0,r.useState)(''),[y,f]=(0,r.useState)(null),[j,w]=(0,r.useState)(''),[k,C]=(0,r.useState)(!1),[T,D]=(0,r.useState)(!1),P=(0,r.useRef)(null),R=(t,n)=>{if('chef'===e.mode&&!(0,i.chefCanSee)(l.useOwner.getState().site,t))return f(null),void w('That check is managed in the Managers app.');const s=(0,m.parseQuick)(t,o);D(n),w(''),f(s.map((e,t)=>({key:`${t}-${e.text}`,text:e.text,pointId:e.point?.id,value:null==e.value?'':String(e.value),done:!(!e.point||(0,m.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},B=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),L=(y??[]).map(e=>{const t=o.find(t=>t.id===e.pointId),n=S(e.value),s=!!t&&(0,m.isTempKind)(t.kind),i=!!t&&(s?null!=n:void 0!==e.done),l=t?s?null!=n?(0,m.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:i,ok:l,needsAction:!1===l&&!e.corrective.trim()}}),$=L.length>0&&L.every(e=>e.ready&&!e.needsAction);return(0,v.jsxs)(b.Box,{testID:"haccp-quick",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,v.jsx)(h.Muted,{children:"For example \u201cprep fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:d,onChangeText:p,placeholder:"prep fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>R(d,!1),style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void P.current?.stop();const t=new e;P.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';p(t),t&&R(t,!0)},t.onerror=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>C(!1);try{t.start(),C(!0)}catch{w("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:k?x.colours.gold:'transparent'},children:(0,v.jsx)(h.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,v.jsx)(h.Button,{label:"Check readings",disabled:!d.trim(),onPress:()=>R(d,!1)}),j?(0,v.jsx)(u.default,{testID:"haccp-quick-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:j})}):null,y?(0,v.jsxs)(u.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,v.jsxs)(h.T,{weight:"semibold",children:["Check these ",y.length," reading",1===y.length?'':'s']}),L.map(({d:e,point:s,temp:i,ok:l,needsAction:r})=>(0,v.jsxs)(u.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===l?x.colours.red:x.colours.border,backgroundColor:x.colours.surface2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(h.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,v.jsx)(n.GoldClose,{size:"sm",label:`Remove ${s?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key))})]}),s?(0,v.jsxs)(h.T,{weight:"semibold",children:[s.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 safe: ",(0,m.limitText)(s)]})]}):(0,v.jsxs)(u.default,{style:{gap:6},children:[(0,v.jsx)(h.T,{colour:x.colours.amber,children:e.problem}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(t=>(0,v.jsx)(h.Chip,{label:t.name,onPress:()=>B(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),s&&i?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${s.name}`,value:e.value,onChangeText:t=>B(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:96,fontSize:20}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===l?(0,v.jsx)(h.Badge,{kind:"amber",label:"Type the reading"}):(0,v.jsx)(h.Badge,{kind:l?'ok':'red',label:l?'OK':'OUT OF RANGE'})]}):null,s&&!i?(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===e.done,onPress:()=>B(e.key,{done:!0})}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>B(e.key,{done:!1})})]}):null,!1===l?(0,v.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${s.name}`,value:e.corrective,onChangeText:t=>B(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[h.styles.input,r&&{borderColor:x.colours.red}]}):null,r?(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:`Save ${L.length} reading${1===L.length?'':'s'}`,testID:"haccp-save-quick",disabled:!$,onPress:()=>{I(e,L.map(e=>({point:e.point,value:e.temp?e.v:void 0,done:e.temp?void 0:e.d.done,corrective:e.d.corrective,source:T?'voice':'typed'}))),w(`Saved ${L.length} reading${1===L.length?'':'s'}.`),f(null),p('')},style:{flex:1}}),(0,v.jsx)(h.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),w('Nothing saved.')}})]}),(0,v.jsx)(h.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function P({who:e}){const n=(0,s.useSafetyView)(e.mode).points,[o,i]=(0,r.useState)(n[0]?.id),[l,d]=(0,r.useState)(''),[c,u]=(0,r.useState)(),[p,y]=(0,r.useState)(''),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),C=n.find(e=>e.id===o),T=!!C&&(0,m.isTempKind)(C.kind),D=S(l),P=C?T?null==D?null:(0,m.inRange)(C,D):void 0===c?null:c:null,R=null!==P&&(P||p.trim());return(0,v.jsxs)(b.Box,{testID:"haccp-manual",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Record one check"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:n.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:e.id===o,onPress:()=>{i(e.id),d(''),u(void 0),y(''),k('')}},e.id))}),C?(0,v.jsxs)(h.Muted,{children:[m.KIND_LABEL[C.kind]," \xb7 safe: ",(0,m.limitText)(C)]}):null,T?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:l,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:110,fontSize:22}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===P?null:(0,v.jsx)(h.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===c,onPress:()=>u(!0)}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===c,onPress:()=>u(!1)})]}),!1===P?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(h.Banner,{kind:"danger",title:T?'Out of range':'Check not done',children:"Write what you did about it before saving (e.g. moved food, discarded, called the engineer, re-checked in 30 minutes)."}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:p,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:h.styles.input})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:f,onChangeText:j,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{I(e,[{point:C,value:T?D:void 0,done:T?void 0:c,corrective:p,note:f,source:'typed'}]),d(''),u(void 0),y(''),j(''),k(`Saved: ${C.name}.`)}}),w?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:w}):null]})}function R({who:e}){const t=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).allPoints,[o,i]=(0,r.useState)('7'),[l,d]=(0,r.useState)('all'),[c,p]=(0,r.useState)(!1),[y,f]=(0,r.useState)(''),j='staff'===e.mode,w=(0,r.useMemo)(()=>{const n=new Date(e.now);n.setHours(0,0,0,0);const s='today'===o?n.getTime():'all'===o?0:e.now.getTime()-864e5*Number(o);return t.filter(t=>!(j&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==l&&t.kind!==l||c&&t.ok))},[t,o,l,c,j,e.meId,e.now.getTime()]),k=Array.from(new Set(n.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,v.jsxs)(b.Box,{testID:"haccp-history",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:j?'My entries':'Food safety log'}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,v.jsx)(h.Chip,{label:t,selected:o===e,onPress:()=>i(e)},e))}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"All checks",selected:'all'===l,onPress:()=>d('all')}),k.map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:l===e,onPress:()=>d(e)},e))]}),(0,v.jsx)(h.Toggle,{label:"Out of range only",value:c,onChange:p}),(0,v.jsx)(u.default,{testID:"haccp-count",children:(0,v.jsxs)(h.Muted,{children:[w.length," entr",1===w.length?'y':'ies',w.filter(e=>!e.ok).length?` \xb7 ${w.filter(e=>!e.ok).length} out of range`:'']})}),w.length?w.slice(0,200).map(e=>(0,v.jsx)(B,{e:e},e.id)):(0,v.jsx)(h.Muted,{children:"No entries for these filters yet."}),j?null:(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,v.jsx)(h.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!w.length,onPress:()=>f((0,b.downloadText)(`food-safety-log-${C}.csv`,(0,m.toCsv)(w,n))?`CSV downloaded: ${w.length} entries.`:'Downloads work in the web app.')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!w.length,onPress:()=>f((0,b.printTable)('Food safety log (HACCP)',`${w.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,m.LOG_HEAD,(0,m.logRows)(w,n))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),y?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:y}):null]})}function B({e:e}){return(0,v.jsxs)(u.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border,gap:2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,v.jsx)(h.T,{size:17,weight:"bold",colour:e.ok?x.colours.ok:x.colours.red,children:(0,m.fmtEntryValue)(e)})]}),(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,v.jsxs)(h.Muted,{style:{flex:1},children:[C(e.at)," ",k(e.at)," \xb7 ",e.initials??(0,m.initialsOf)(e.by)," ",e.by,'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 probe':'',e.ok?'':' \xb7 OUT OF RANGE']})]}),e.corrective?(0,v.jsxs)(h.T,{size:13,colour:x.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,v.jsxs)(h.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,v.jsx)(d.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function L({editable:e,mode:t}){const n=(0,s.useSafetyView)(t).points,[o,i]=(0,r.useState)('');return(0,v.jsxs)(b.Box,{testID:"haccp-limits",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,v.jsx)(h.Muted,{children:e?'Set the limits from your own HACCP plan. Leave min or max empty if it doesn\u2019t apply. Due times are daily reminders (24 h, comma separated).':'Set by the Head Chef in CoverCharge for Head Chef.'}),n.map(t=>(0,v.jsx)($,{p:t,editable:e,onSaved:()=>i(`Saved limits for ${t.name}.`)},t.id)),e?(0,v.jsx)(z,{onAdded:e=>i(`Added ${e}.`)}):null,o?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:o}):null]})}function $({p:e,editable:n,onSaved:s}){const[o,i]=(0,r.useState)(null==e.min?'':String(e.min)),[l,d]=(0,r.useState)(null==e.max?'':String(e.max)),[c,y]=(0,r.useState)(e.due.join(', ')),b=(0,m.isTempKind)(e.kind),f=''===c.trim()||c.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),j=o!==(null==e.min?'':String(e.min))||l!==(null==e.max?'':String(e.max))||c!==e.due.join(', '),w=f&&(''===o||null!=S(o))&&(''===l||null!=S(l));return n?(0,v.jsxs)(u.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border},testID:`limit-${e.id}`,children:[(0,v.jsxs)(h.T,{weight:"medium",children:[e.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 ",m.KIND_LABEL[e.kind]]})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[b?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:i,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]}),(0,v.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:l,onChangeText:d,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:c,onChangeText:y,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:140,width:40}]}),j?(0,v.jsx)(h.Button,{small:!0,label:"Save",disabled:!w,onPress:()=>{p.useSafety.getState().setPoint(e.id,{min:''===o?void 0:S(o),max:''===l?void 0:S(l),due:c.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),f?null:(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,v.jsx)(h.T,{size:14,style:{flex:1},children:e.name}),(0,v.jsxs)(h.Muted,{children:[(0,m.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function z({onAdded:e}){const[n,s]=(0,r.useState)(''),[o,d]=(0,r.useState)('fridge');return(0,v.jsxs)(u.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsx)(h.T,{weight:"medium",children:"Add a check point"}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:s,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(m.KIND_LABEL).map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:e===o,onPress:()=>d(e)},e))}),(0,v.jsx)(h.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,i.chefCanSee)(l.useOwner.getState().site,n),onPress:()=>{if(!(0,i.chefCanSee)(l.useOwner.getState().site,n))return;const t='fridge'===o?{max:5}:'freezer'===o?{max:-18}:'cook'===o?{min:75}:'hothold'===o?{min:63}:'cool'===o||'delivery'===o?{max:8}:{};p.useSafety.getState().addPoint({name:n.trim(),kind:o,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),s('')}})]})}function A({me:e,now:n,mode:o}){const d=(0,s.useSafetyView)(o).probes??[],c=(0,s.useSafetyView)(o).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[m,y]=(0,r.useState)(!1),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),[C,S]=(0,r.useState)(null),[T,I]=(0,r.useState)(''),D=c.find(e=>e.id===w);return(0,v.jsxs)(b.Box,{testID:"haccp-probes",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,v.jsx)(h.Muted,{children:"Wireless fridge and freezer probes. Once a probe is connected, its readings go into the food safety log tagged \u201cprobe\u201d with the time they were taken. Out-of-range probe readings still need a corrective action from a person."}),d.length?d.map(e=>(0,v.jsxs)(u.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(u.default,{style:{flex:1,gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",children:e.name}),(0,v.jsx)(h.Muted,{children:e.location})]}),(0,v.jsx)(h.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>p.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,v.jsxs)(u.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Connect your probe"}),(0,v.jsxs)(h.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,v.jsx)(h.T,{size:14,children:"2. Keep this device near the probe."}),(0,v.jsx)(h.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,v.jsx)(u.default,{testID:"probes-empty",children:(0,v.jsx)(h.Muted,{children:"No probes yet."})}),T?(0,v.jsx)(u.default,{testID:"probe-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:T})}):null,m?(0,v.jsxs)(u.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:f,onChangeText:j,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[h.styles.input,{minWidth:0}]}),(0,v.jsx)(h.Muted,{children:"Where is it?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:c.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:w===e.id,onPress:()=>k(e.id)},e.id))}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:"Save probe",disabled:!f.trim()||!D,onPress:()=>{f.trim()&&D&&('chef'!==o||(0,i.chefCanSee)(l.useOwner.getState().site,D))&&(p.useSafety.getState().addProbe({name:f.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:n.toISOString()}),I(`Added \u201c${f.trim()}\u201d for ${D.name}. Next: connect your probe.`),j(''),k(''),y(!1))}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,v.jsx)(h.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,v.jsx)(h.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1063,[873,835,1482,1431,1082,861,31,197,264,128,818,1178,1185,825,994,1385,1483,1485,1487,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},1064,[31,197,123,264,128,818,994,1384,1223,825,1385,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1065,[873,31,264,128,818,825,829,5,984,807,824,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RELEASE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"nightlyEmailAllowed",{enumerable:!0,get:function(){return t}});const n={specialsSync:!0,nightlyEmail:!1,nightlyPush:!1,supportSync:!0,planPhoto:!0},t=(t,l)=>'anchorage'!==t&&l&&n.nightlyEmail},1066,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},1067,[812,18]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photosAllowed=function(){const t=a.useSync.getState();return'staff'!==t.kind||!t.venueId||'off'===t.mode||'local'===t.mode||t.perms.includes('*')},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600,n=.78){return new Promise((r,o)=>{const c=URL.createObjectURL(t),i=new Image;i.onload=()=>{const t=Math.min(1,a/Math.max(i.width,i.height)),o=document.createElement('canvas');o.width=Math.round(i.width*t),o.height=Math.round(i.height*t),o.getContext('2d').drawImage(i,0,0,o.width,o.height),URL.revokeObjectURL(c),r(o.toDataURL('image/jpeg',n))},i.onerror=()=>{URL.revokeObjectURL(c),o(new Error('not an image'))},i.src=c})}},1068,[123,871,824,1095]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_LOYALTY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"consentText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"prettyCardNo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"cleanCode",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"cardQr",{enumerable:!0,get:function(){return s}}),_e.readCardQr=function(e){const r=/^covercharge:card:[^:]+:([A-Za-z0-9-]{8,9})$/.exec(e.trim());return r?n(r[1]):null},Object.defineProperty(_e,"codeQr",{enumerable:!0,get:function(){return o}}),_e.checkSettings=function(e){return!Number.isInteger(e.stampsNeeded)||e.stampsNeeded<2||e.stampsNeeded>30?'Stamps needed must be between 2 and 30.':e.reward.trim()?e.reward.length>80?'Keep the reward under 80 letters.':e.gapMinutes<0||e.gapMinutes>1440?'Time between stamps must be 0 to 24 hours.':e.maxPerDay<1||e.maxPerDay>10?'Stamps a day must be 1 to 10.':!Number.isInteger(e.stampExpiryDays)||e.stampExpiryDays<0||e.stampExpiryDays>1095?'Stamps last 0 (never run out) to 1095 days.':!Number.isInteger(e.rewardExpiryDays)||e.rewardExpiryDays<0||e.rewardExpiryDays>1095?'Rewards last 0 (never run out) to 1095 days.':!e.referralOn||e.referralGiver.trim()&&e.referralFriend.trim()?e.referralMonthlyCap<0||e.referralMonthlyCap>50?'Friend rewards a month must be 0 to 50.':null:'Say what both people get before you switch Bring a friend on.':'Say what the reward is, for example Free dessert.'},_e.checkOffer=function(e){if(!e.title.trim())return'Give the offer a title.';if(e.title.length>80)return'Keep the title under 80 letters.';if(e.details.length>500)return'Keep the details under 500 letters.';const r=/^\d{4}-\d{2}-\d{2}$/;return e.startsOn&&!r.test(e.startsOn)?'Start date should look like 2026-11-30.':e.endsOn&&!r.test(e.endsOn)?'End date should look like 2026-11-30.':e.startsOn&&e.endsOn&&e.endsOn`I agree to ${e} keeping my name and the phone or email I give, only to run my stamp card and offers here. I can leave at any time and my details are removed.`,t=e=>e&&8===e.length?`${e.slice(0,4)}-${e.slice(4)}`:e,n=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,''),s=(e,r)=>`covercharge:card:${e}:${r}`;const o=(e,r,t)=>`${e.replace(/\/$/,'')}/customer/${r}/loyalty?code=${t}`;const l=(e,r)=>e.isOn&&(!e.startsOn||e.startsOn<=r)&&(!e.endsOn||e.endsOn>=r),p=r=>r?{saved:!!r.updated_by,cardOn:!!r.card_on,stampsNeeded:r.stamps_needed??8,reward:r.reward??'',stampExpiryDays:r.stamp_expiry_days??0,rewardExpiryDays:r.reward_expiry_days??0,gapMinutes:r.gap_minutes??60,maxPerDay:r.max_per_day??1,referralOn:!!r.referral_on,referralGiver:r.referral_giver??'',referralFriend:r.referral_friend??'',referralMonthlyCap:r.referral_monthly_cap??5}:{...e},u=e=>({card_on:e.cardOn,stamps_needed:e.stampsNeeded,reward:e.reward.trim(),stamp_expiry_days:e.stampExpiryDays,reward_expiry_days:e.rewardExpiryDays,gap_minutes:e.gapMinutes,max_per_day:e.maxPerDay,referral_on:e.referralOn,referral_giver:e.referralGiver.trim(),referral_friend:e.referralFriend.trim(),referral_monthly_cap:e.referralMonthlyCap}),y=e=>({id:String(e.id),title:e.title??'',details:e.details??'',startsOn:e.starts_on??null,endsOn:e.ends_on??null,isOn:!1!==e.is_on})},1069,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOP_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PAY_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"cleanGiftCode",{enumerable:!0,get:function(){return o}}),e.prettyGiftCode=function(t){const n=o(t);return 16===n.length?n.match(/.{4}/g).join('-'):n},e.poundsToPence=i,e.redeemKey=function(t=Math.random){const n='abcdefghijkmnpqrstuvwxyz23456789';let r='r-';for(let o=0;o<20;o++)r+=n[Math.floor(32*t())%32];return r},Object.defineProperty(e,"expiryWords",{enumerable:!0,get:function(){return c}}),e.amountsFromText=function(t){const n=t.split(/[,\s]+/).filter(Boolean).map(i);return!n.length||n.length>6||n.some(t=>null===t||t<100)?null:[...new Set(n)].sort((t,n)=>t-n)},e.basketTotal=function(t,n){return t.reduce((t,r)=>t+(n.find(t=>t.id===r.id)?.pricePence??0)*r.qty,0)},Object.defineProperty(e,"settingsFromRow",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"settingsToRow",{enumerable:!0,get:function(){return a}});const t={giftsOn:!1,shopOn:!1,expiryMonths:24,amounts:[2500,5e3,1e4],minPence:500,maxPence:25e3,terms:''},n='Gift cards are sold through your website. You can also pay at the bar or till.',r={'waiting-payment':'Waiting for payment at the till',active:'Ready to use',used:'Used up',expired:'Expired',void:'Cancelled',paid:'Paid',ready:'Ready to collect',collected:'Collected',cancelled:'Cancelled'},o=t=>(t??'').toUpperCase().replace(/[^A-Z0-9]/g,'');function i(t){const n=(t??'').trim().replace(/^\xa3/,'');return/^\d{1,4}(\.\d{1,2})?$/.test(n)?Math.round(100*Number(n)):null}const c=t=>t%12==0?`${t/12} year${12===t?'':'s'}`:`${t} months`;const s=n=>n?{giftsOn:!!n.gifts_on,shopOn:!!n.shop_on,expiryMonths:n.expiry_months??24,amounts:n.amounts??t.amounts,minPence:n.min_pence??500,maxPence:n.max_pence??25e3,terms:n.terms??''}:{...t},a=t=>({gifts_on:t.giftsOn,shop_on:t.shopOn,expiry_months:t.expiryMonths,amounts:t.amounts,min_pence:t.minPence,max_pence:t.maxPence,terms:t.terms})},1070,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shopPublic",{enumerable:!0,get:function(){return p}}),e.myShop=async function(t){return await(0,n.guestSession)()?(0,n.rpc)('guest_my_shop',{p_slug:t}):{cards:[],orders:[]}},e.buyGift=async function(t,o){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_gift_buy',{p_slug:t,p_amount:o.amount,p_recipient:o.recipient,p_from:o.from,p_message:o.message})},e.shopOrder=async function(t,o,c){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_shop_order',{p_slug:t,p_lines:o,p_name:c})},Object.defineProperty(e,"giftCheck",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"giftRedeem",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"giftActivate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"giftIssue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"giftHonourWix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"giftVoid",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"giftSummary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"shopStatus",{enumerable:!0,get:function(){return v}}),e.waitingCards=async function(){const{data:t,error:n}=await c().from('gift_cards').select('id,last4,ref,initial_pence,balance_pence,status,source,recipient_name,issued_at,expires_at').eq('venue_id',s()).order('issued_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.shopOrders=async function(){const{data:t,error:n}=await c().from('shop_orders').select('*').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.readShopSettings=async function(){const{data:t,error:n}=await c().from('shop_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return(0,o.settingsFromRow)(t)},e.saveShopSettings=async function(t){const{error:n}=await c().from('shop_settings').upsert({venue_id:s(),...(0,o.settingsToRow)(t),updated_by:u(),updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readProducts=async function(){const{data:t,error:n}=await c().from('shop_products').select('*').eq('venue_id',s()).order('sort').order('name');if(n)throw n;return t??[]},e.saveProduct=async function(t){const n={venue_id:s(),name:t.name.trim(),details:t.details.trim(),price_pence:t.pricePence,stock:t.stock,is_live:t.live,updated_by:u(),updated_at:(new Date).toISOString()},{error:o}=t.id?await c().from('shop_products').update(n).eq('id',t.id):await c().from('shop_products').insert(n);if(o)throw o},Object.defineProperty(e,"payPublic",{enumerable:!0,get:function(){return S}}),e.payStart=async function(t,o,s){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const u='undefined'!=typeof window?window.location.href.split('?')[0]:'',{data:p,error:_}=await c().functions.invoke('pay-checkout',{body:{slug:t,kind:o,target:s,successUrl:u,cancelUrl:u}});if(_||!p?.url)throw new Error(p?.error??'Card payment isn\u2019t available yet. Pay at the bar or till.');if(!/^https:\/\/checkout\.stripe\.com\//.test(p.url))throw new Error('Card payment isn\u2019t available yet. Pay at the bar or till.');return p},Object.defineProperty(e,"payStatus",{enumerable:!0,get:function(){return P}}),e.readPaySettings=async function(){const{data:t,error:n}=await c().from('payment_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return{provider:t?.provider??'none',cardOn:!!t?.card_on,account:t?.stripe_account_id??''}},Object.defineProperty(e,"savePaySettings",{enumerable:!0,get:function(){return O}}),e.recentPayments=async function(){const{data:t,error:n}=await c().from('payments').select('id,kind,amount_pence,status,provider,created_at,paid_at').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(20);if(n)throw n;return t??[]};var t=r(d[0]),n=r(d[1]),o=r(d[2]);const c=()=>(0,t.getSupabase)(),s=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},u=()=>(n.useSync.getState().staffRef??'').slice(0,80)||null,p=t=>(0,n.rpc)('shop_public',{p_slug:t});const _=t=>(0,n.rpc)('staff_gift_check',{p_venue:s(),p_code:t}),f=(t,o,c,u)=>(0,n.rpc)('staff_gift_redeem',{p_venue:s(),p_code:t,p_amount:o,p_key:c,p_by:u}),y=(t,o)=>(0,n.rpc)('staff_gift_activate',{p_card:t,p_by:o}),l=(t,o,c)=>(0,n.rpc)('staff_gift_issue',{p_venue:s(),p_amount:t,p_recipient:o,p_by:c}),b=(t,o,c)=>(0,n.rpc)('staff_gift_honour_wix',{p_venue:s(),p_code:t,p_balance:o,p_by:c}),w=(t,o,c)=>(0,n.rpc)('staff_gift_void',{p_card:t,p_reason:o,p_by:c}),h=()=>(0,n.rpc)('staff_gift_summary',{p_venue:s()}),v=(t,o,c,s)=>(0,n.rpc)('staff_shop_status',{p_order:t,p_status:o,p_reason:c,p_by:s});const S=async t=>{try{return await(0,n.rpc)('pay_public',{p_slug:t})}catch{return{provider:'none',cardOn:!1,testMode:!0}}};const P=t=>(0,n.rpc)('guest_pay_status',{p_payment:t});const O=t=>(0,n.rpc)('staff_payment_settings_save',{p_venue:s(),p_provider:t.provider,p_card_on:t.cardOn,p_account:t.account,p_by:u()})},1071,[871,824,1070]); +__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},1072,[1277,1266,1278]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.refreshCashAccess=r,e.setStaffCashUp=async function(o,c){const u=s.useSync.getState().venueId;if(!u)return{ok:!1,error:'Not connected. Try again when the app is online.'};const f=(0,t.getSupabase)();try{const{data:t}=await f.from('staff').select('id').eq('venue_id',u).eq('external_ref',o).maybeSingle();if(!t?.id)return{ok:!1,error:'This person isn\u2019t on the shared team list yet.'};const{error:s}=await f.rpc('set_staff_cash_up',{p_staff:t.id,p_on:c});return s?{ok:!1,error:/owner or manager/i.test(s.message)?'Only an owner or manager can change this.':'Could not save. Try again.'}:(n.useCashAccess.setState(t=>({byRef:{...t.byRef,[o]:c}})),r(),{ok:!0})}catch{return{ok:!1,error:'Could not save. Try again when the app is online.'}}};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]);async function r(){const r=s.useSync.getState().venueId;if(!r||'staff'!==s.useSync.getState().kind)return;const o=(0,t.getSupabase)();try{const[{data:t},{data:s},c]=await Promise.all([o.rpc('my_cash_up_access',{p_venue:r}),o.from('staff').select('external_ref, can_cash_up').eq('venue_id',r),o.rpc('my_cash_up_scope',{p_venue:r}).then(t=>t,()=>({data:null}))]),u=c?.data??null;u&&'boolean'==typeof u.takings&&n.useCashAccess.setState({takings:u.takings,tradingDate:'string'==typeof u.tradingDate?u.tradingDate:null,photos:!0===u.photos});const f={};if(Array.isArray(s))for(const t of s)t.external_ref&&(f[t.external_ref]=!!t.can_cash_up);n.useCashAccess.setState({mine:'boolean'==typeof t?t:n.useCashAccess.getState().mine,byRef:Array.isArray(s)?f:n.useCashAccess.getState().byRef,loaded:!0})}catch{}}},1073,[871,824,1045]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1074,[31,128,823,807,817,14,1420,825,818,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RID",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return d}}),_e.nextStatus=function(e){return'new'===e.status||'acknowledged'===e.status?{to:'preparing',label:'Start preparing'}:'preparing'===e.status?{to:'ready',label:'takeaway'===e.type?'Mark ready (notify customer)':'Mark ready'}:'ready'===e.status?'takeaway'===e.type?{to:'collected',label:'Collected'}:{to:'served',label:'Served'}:null},Object.defineProperty(_e,"LIVE",{enumerable:!0,get:function(){return u}}),_e.busyLevel=b,_e.restOfDayLevel=function(e,t){const r=e.hours.filter(t=>!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1075,[31,264,128,818,825,5,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return m}}),_e.BookingsDayNav=function({today:e,date:s,onDate:u,sub:c,count:y}){const[p,D]=(0,t.useState)(sb(e,6)?s:e),[w,h]=(0,t.useState)(!1),f=Array.from({length:7},(e,t)=>b(p,t)),j=e=>{u(e),f.includes(e)||D(e)},$=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':k(t);return(0,d.jsxs)(o.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,d.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${m(b(p,-7))}`,onPress:()=>{D(b(p,-7)),u(b(p,-7))}}),(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${m(b(p,7))}`,onPress:()=>{D(b(p,7)),u(b(p,7))}}),s!==e?(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${m(e)}`,onPress:()=>{D(e),u(e),h(!1)}}):null,(0,d.jsx)(n.Button,{small:!0,kind:"ghost",label:w?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>h(!0)})]}),(0,d.jsx)(l.AppDateCalendar,{visible:w,today:e,day:s,showBusy:!0,onDay:t=>{const s=t??e;j(s),D(s)},onClose:()=>h(!1),idPrefix:"bookings-cal"}),(0,d.jsx)(n.Row,{wrap:!0,gap:6,children:f.map(e=>(0,d.jsx)(n.Chip,{label:$(e),sub:c(e),selected:s===e,onPress:()=>u(e)},e))}),(0,d.jsx)(o.default,{testID:"bookings-day-title",children:(0,d.jsxs)(n.T,{size:17,weight:"semibold",colour:i.colours.goldLight,children:[m(s),sString(e).padStart(2,'0');function b(e,t){const[s,o,n]=e.split('-').map(Number),l=new Date(Date.UTC(s,o-1,n+t,12));return`${l.getUTCFullYear()}-${y(l.getUTCMonth()+1)}-${y(l.getUTCDate())}`}const p=e=>{const[t,s,o]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,o,12)).getUTCDay()+6)%7},m=e=>{const[t,s,o]=e.split('-').map(Number);return`${c[p(e)]} ${o} ${u[s-1]} ${t}`},k=e=>{const[,t,s]=e.split('-').map(Number);return`${c[p(e)].slice(0,3)} ${s} ${u[t-1].slice(0,3)}`}},1076,[31,128,818,1408,825,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1077,[31,818,823,826,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1078,[]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return n.useStore}}),_e.useNow=function(e=1e4){const r=(0,n.useStore)(e=>e.clock),[,u]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=setInterval(()=>u(e=>e+1),e);return()=>clearInterval(t)},[e]),(0,n.nowFrom)(r)},Object.defineProperty(_e,"useRestaurant",{enumerable:!0,get:function(){return a}}),_e.useRecipeCards=c,_e.useAllMenu=f,_e.useMenu=function(e){const r=f(e);return(0,t.useMemo)(()=>r.filter(e=>!e.hidden),[r])},Object.defineProperty(_e,"useCustomer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBasket",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useOrders",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"useOrderAtTable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useOrder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useBookings",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useWaitlist",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useEvents",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"useStampCard",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useGiftCards",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useRatings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"useAudit",{enumerable:!0,get:function(){return v}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),u=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]);_r(_d[7]);const a=e=>(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)),l=e=>(0,o.recipeCards)().subscribe(e),d=[];function c(e){return(0,t.useSyncExternalStore)(l,()=>e?(0,o.recipeCards)().list(e):d,()=>e?(0,o.recipeCards)().list(e):d)}function f(e){const u=(0,n.useStore)((0,r.useShallow)(t=>t.menu.filter(t=>t.restaurantId===e))),o=c(e);return(0,t.useMemo)(()=>(0,s.resolveMenu)(u),[u,o])}const b=()=>(0,n.useStore)(e=>e.customer),S=()=>(0,n.useStore)(e=>e.basket),g=(e,t)=>'table'!==t.type||(0,u.orderAtTableOn)(e.restaurants.find(e=>e.id===t.restaurantId)),m=e=>(0,n.useStore)((0,r.useShallow)(t=>t.orders.filter(r=>(!e||r.restaurantId===e)&&g(t,r)))),p=e=>(0,n.useStore)(t=>(0,u.orderAtTableOn)(t.restaurants.find(t=>t.id===e))),O=e=>(0,n.useStore)(t=>t.orders.find(t=>t.id===e)),y=e=>(0,n.useStore)((0,r.useShallow)(t=>e?t.bookings.filter(t=>t.restaurantId===e):t.bookings)),w=e=>(0,n.useStore)((0,r.useShallow)(t=>t.waitlist.filter(t=>t.restaurantId===e))),I=[],j=u=>{const s=(0,n.useStore)((0,r.useShallow)(e=>e.events.filter(e=>null===e.restaurantId||e.restaurantId===u))),o=(0,n.useStore)(e=>e.restaurants.find(e=>e.id===u)),a=o?(0,e.regularEventsOf)(o):I,l=(new Date).toISOString().slice(0,7);return(0,t.useMemo)(()=>{if(!u||!a.length)return s;const t=new Date,r=new Date(t.getFullYear(),t.getMonth()-2,1),n=new Date(t.getFullYear()+1,t.getMonth()+1,0),o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`;return[...s,...(0,e.expandEvents)(u,a,o(r),o(n))]},[s,a,u,l])},P=e=>(0,n.useStore)(t=>t.stampCards.find(r=>r.restaurantId===e&&r.customerId===t.customer.id)),h=e=>(0,n.useStore)((0,r.useShallow)(t=>t.giftCards.filter(r=>(!e||r.restaurantId===e)&&r.ownerId===t.customer.id))),M=e=>(0,n.useStore)((0,r.useShallow)(t=>t.ratings.filter(t=>t.restaurantId===e))),v=e=>(0,n.useStore)((0,r.useShallow)(t=>t.audit.filter(t=>t.restaurantId===e)))},1079,[814,31,881,878,1349,1186,839,1166]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"METHOD_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY3",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAYS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"wd",{enumerable:!0,get:function(){return i}}),e.dayRange=function(t){const n=[...new Set(t)].sort((t,n)=>t-n);if(!n.length)return'';if(7===n.length)return'every day';return n.every((t,o)=>o===0||t===n[o-1]+1)&&n.length>=3?`${o[n[0]]} to ${o[n[n.length-1]]}`:n.map(t=>o[t]).join(', ')},e.nextDelivery=a,Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return d}}),e.remindersFor=function(t,n,o={}){const d=i(n);return t.filter(t=>t.orderDays.includes(d)).flatMap(t=>{if(o[t.id]&&new Date(o[t.id]).toDateString()===n.toDateString())return[];let d=!1;if(/^\d\d:\d\d$/.test(t.cutoff)){const[o,s]=t.cutoff.split(':').map(Number),i=new Date(n);i.setHours(o,s,0,0),d=n>i}const l=a(t,n),c=t.reminder||`Order ${t.name} today${l?` for ${s[i(l)]}`:''}`;return[{supplierId:t.id,name:t.name,text:`${c}${t.cutoff?d?` (cut-off ${t.cutoff} passed)`:` by ${t.cutoff}`:''}`,tone:d?'red':'amber',cutoffPassed:d}]})},e.orderLines=function(n,o,s,i=""){const a=n.items.filter(t=>(o[t.id]??0)>0).map(n=>`${(0,t.fishInStone)(i,n)?(0,t.fishQtyText)(i,n,o[n.id]):`${l(o[n.id])} ${n.unit}`} ${n.name}`.replace(/\s+/g,' ').trim());return s.split('\n').map(t=>t.trim()).filter(Boolean).forEach(t=>a.push(t)),a},e.orderMessage=function(t,n,o,s,i,l){const c=a(t,l);return[`Hi ${t.contact||t.name.split(' (')[0]}, order from ${n}${o?`, ${o}`:''}${c?` for ${d(c)}`:''}:`,...s.map(t=>`- ${t}`),'',`Thanks, ${i}`].join('\n')},e.intlDigits=c,Object.defineProperty(e,"smsLink",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"waLink",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"telLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"sid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_SHEETS",{enumerable:!0,get:function(){return k}});var t=r(_d[0]);const n={online:'Online',phone:'Phone',text:'Text message',whatsapp:'WhatsApp',tbc:'To be decided'},o=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],s=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],i=t=>(t.getDay()+6)%7;function a(t,n){const o=null!=t.deliversOn?[t.deliversOn]:t.deliveryDays;if(!o.length)return null;for(let t=1;t<=7;t++){const s=new Date(n);if(s.setDate(s.getDate()+t),o.includes(i(s)))return s}return null}const d=t=>t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});const l=t=>Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,'');function c(t){const n=t.replace(/[^\d+]/g,'').replace(/^\+/,'');return n.startsWith('00')?n.slice(2):n.startsWith('0')?`44${n.slice(1)}`:n}const u=(t,n)=>`sms:${t.replace(/[^\d+]/g,'')}?&body=${encodeURIComponent(n)}`,m=(t,n)=>`https://wa.me/${c(t)}?text=${encodeURIComponent(n)}`,f=t=>`tel:${t.replace(/[^\d+]/g,'')}`;let p=0;const h=(t="os")=>`${t}-${Date.now().toString(36)}${(p++).toString(36)}`,y=(t,n,o)=>({id:t,name:n,unit:o}),b=t=>({number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:'',...t}),k=[b({id:'os-reids',name:'Reids',goods:'Dry goods and frozen',method:'online',urlLabel:'Open Coldweb',deliveryDays:[0,1,2,3,4],frequency:'Order on Coldweb',items:[y('rd-chips','Frozen chips','boxes'),y('rd-oil','Fryer oil','tubs'),y('rd-flour','Flour','bags'),y('rd-rice','Rice','bags'),y('rd-peas','Frozen peas','bags')],notes:'Order on their Coldweb ordering site. Add the Coldweb link in Managers \u203a Settings \u203a Supplier order sheets, or here.'}),b({id:'os-veg',name:'Veg',goods:'Fruit and veg (supplier to be added)',method:'tbc',placeholder:!0,frequency:'To be added by Gordon',notes:'Placeholder: Gordon will add the veg supplier, how to order and delivery days.'}),b({id:'os-peroni',name:'J. Pieroni & Sons',goods:'Seafood (fish merchant, Ayr)',method:'phone',url:'https://pieronis.com',urlLabel:'Open pieronis.com',deliveryDays:[0,1,2,3,4,5],frequency:'Phone order',items:[y('pa-haddock','Haddock fillets','kg'),y('pa-mussels','Mussels','kg'),y('pa-scallops','Scallops','kg'),y('pa-salmon','Salmon','kg')],notes:'Phone order. Press Call, then read the order from the screen.'}),b({id:'os-spesbona',name:'Spes Bona',goods:'Langoustines and smoked haddock',method:'text',orderDays:[2],deliversOn:4,deliveryDays:[4],frequency:'Text on Wednesday for Friday',reminder:'Text Spes Bona today for Friday\u2019s langoustines and smoked haddock',items:[y('sb-langs','Langoustines','kg'),y('sb-smoked','Smoked haddock','kg')]}),b({id:'os-tarelgin',name:'Tarelgin',goods:'Butcher',method:'text',frequency:'Text order',items:[y('tg-steak','Ribeye steaks',''),y('tg-mince','Steak mince','kg'),y('tg-chicken','Chicken breasts',''),y('tg-sausage','Sausages','kg')]}),b({id:'os-mills',name:'Mills',goods:'Milk',method:'whatsapp',frequency:'WhatsApp message',items:[y('ml-milk','Milk','litres'),y('ml-cream','Double cream','litres'),y('ml-butter','Butter','kg')]}),b({id:'os-kittyfisher',name:'Kittyfisher boat (Big Sean)',goods:'Lobsters and crabs',method:'text',contact:'Sean',frequency:'Whenever stock is low',shellfish:!0,items:[y('kf-lobster','Lobsters',''),y('kf-crab','Crabs','')],notes:'Text Big Sean whenever the lobster or crab count runs low.'}),b({id:'os-lionsmane',name:'Lion\u2019s mane mushroom',goods:'Lion\u2019s mane mushrooms',method:'online',urlLabel:'Open seller',frequency:'Weekly or fortnightly',priceCapPerKg:2500,seller:'Cheapest UK seller (to be chosen)',items:[y('lm-kg','Lion\u2019s mane mushroom','kg')],notes:'Order online from the cheapest UK seller under the price cap. Check the price per kg before you buy.'})]},1080,[1083]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1081,[1544,1097,812,31,119,257,264,152,128,823,828,829,1545,822,825,1040,818,1546,979,824,934,25]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isAnchorage",{enumerable:!0,get:function(){return r}}),e.isBarFridge=n,Object.defineProperty(e,"chefCanSee",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"demoActor",{enumerable:!0,get:function(){return s}}),e.hasRealSignature=c,Object.defineProperty(e,"PLACEHOLDER_AUTHOR",{enumerable:!0,get:function(){return f}}),e.isPlaceholderCard=u,e.isDemoCard=function(t){return!c(t)&&(['example','sample','demo'].includes(t.origin||'')||s(t.updatedBy)||u(t))},Object.defineProperty(e,"isSeedChefChat",{enumerable:!0,get:function(){return m}});const t='6349aa07-3fec-46e9-8c69-7b1b08494793',r=r=>'anchorage'===r||r===t;function n(t){if('string'==typeof t)return/\bbar[\s_-]*(?:fridge|refrigerat)|\b(?:fridge|refrigerator)[\s_-]*(?:in[\s_-]*the[\s_-]*)?bar\b|^cp-bar$/i.test(t);if(!t||'object'!=typeof t)return!1;const r=t;if(n(['name','label','kind','unit','location','storage','storageLocation'].map(t=>r[t]).filter(t=>'string'==typeof t).join(' ')))return!0;return(['name','label'].some(t=>'string'==typeof r[t]&&''!==r[t].trim())?[]:['id','key','pointId']).concat(['name','label','unit','location','storage','storageLocation','aliases']).some(t=>Array.isArray(r[t])?r[t].some(n):'string'==typeof r[t]&&n(r[t]))}const o=(t,o)=>!r(t)||!n(o),s=t=>'string'==typeof t&&/(?:\b(?:example|sample|demo)\b)/i.test(t);function c(t){return[t.signOff?.by,t.allergensConfirmed?.by].some(t=>!!t&&!s(t))}const f='CoverCharge, for Head Chef sign-off';function u(t){return!c(t)&&(t.updatedBy||'').startsWith('CoverCharge')&&(!t.createdBy||t.createdBy.startsWith('CoverCharge'))}const l={'m-seed-all':'Welcome to the team chat on CoverCharge.','m-seed-kitchen':'Kitchen channel: Head Chef, kitchen team and managers.','m-seed-foh':'Front of house channel: front of house, bar and managers.','m-seed-managers':'Managers channel: owners, managers and the supervisor only.'},m=t=>'system'===t.from&&(!!l[t.id]&&l[t.id]===t.text||'m-seed-all'===t.id&&/this phone only/.test(t.text||''))},1082,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KG_PER_STONE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"HALF_STONE_KG",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isFishName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fishInStone",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"halfStone",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toStone",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"fromStone",{enumerable:!0,get:function(){return c}}),e.stoneText=b,e.stoneSpeech=h,Object.defineProperty(e,"fishQtyText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"fishQtySpeech",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantityStep",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"stepQuantity",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"inputQuantity",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"quantityUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"displayedCost",{enumerable:!0,get:function(){return k}}),e.parseStoneAmount=function(t){if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.toLowerCase().trim();if(/\b(?:kg|kilos?|kilograms?|grams?)\b/.test(n))return;const i=n.match(/(?:^|\s)(\d+(?:[.,]\d+)?)(\xbd)?(?:\s*(?:stone|st)\b|$)/);if(i)return Number(i[1].replace(',','.'))+(i[2]?.5:0);const o=n.match(/\b(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)(?: and a half)?(?: stone| st|$)/);return o?l.indexOf(o[1])+(/and a half/.test(o[0])?.5:0):/(?:^|\s)(?:\xbd|(?:a )?half(?: a)?)(?: stone| st|$)/.test(n)?.5:void 0};var t=r(d[0]);const n=6.35029318,i=3.17514659,o=(t="")=>!/\b(?:vegan|vegetarian|banana|blossom|mushroom|sauce|stock|oil)\b|\(vg\)/i.test(t)&&/\b(?:fish|haddock|salmon|cod|hake|halibut|plaice|sole|turbot|trout|mackerel|monkfish|seabass|sea bass|seabream|sea bream|tuna|pollock|coley|whiting|sardines?|anchov(?:y|ies)|herring)\b/i.test(t),u=(n,i)=>(0,t.isAnchorage)(n)&&/^(kg|kilos?|kilograms?|st|stone)$/i.test(i.unit||'')&&o(i.name),s=t=>Math.round(2*(t+Number.EPSILON))/2,f=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t/n,c=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t*n;function b(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'\u2212':''}${n%1?`${i||''}\xbd`:i} stone`}const l=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'];function h(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'minus ':''}${n%1?i?`${l[i]||i} and a half`:'half a':l[i]||i} stone`}const y=(t,n,i)=>u(t,n)?b(f(i,n.unit)):`${i} ${n.unit||''}`.trim(),p=(t,n,i)=>u(t,n)?h(f(i,n.unit)):y(t,n,i),O=(t,n)=>u(t,n)?c(.5,n.unit):'kg'===n.unit?.5:1,v=(t,n,i,o)=>u(t,n)?c(Math.max(0,s(f(i,n.unit))+.5*o),n.unit):Math.max(0,i+o*O(t,n)),P=(t,n,i)=>u(t,n)?c(s(i),n.unit):i,j=(t,n)=>u(t,n)?'stone':n.unit||'',k=(t,n,i)=>u(t,n)?i*c(1,n.unit):i},1083,[1082]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShellStore",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"localShellfish",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"shellfish",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"useStockItems",{enumerable:!0,get:function(){return O}}),_e.venueCounts=w,_e.useShellfish=function(e,t,s,o){const a=O(e,!1,o).filter(t=>'chef'!==s||(0,n.chefCanSee)(e,t)),d=_(t=>!!t.server[e]),u=_((0,l.useShallow)(t=>{const s=t.items[e]??[],n=new Set(s.filter(e=>o?e.group!==o:!!e.group).map(e=>e.key));return t.events.filter(s=>s.rid===e&&(!t.server[e]||I(s))&&!n.has(s.kind))})),c=_((0,l.useShallow)(t=>w(t,e))),p=(0,f.lastUndoable)(u),v=e=>a.find(t=>t.key===e);return{items:a,events:u,counts:c,undoable:p,synced:d,itemOf:v,isLow:e=>(0,f.isLowItem)(v(e),c[e]??0),sell:(n,o=!1)=>{const a=v(n),d=a&&(0,i.fishInStone)(e,a)?i.HALF_STONE_KG:o?.5:1;return!((c[n]??0){i>0&&E.append({rid:e,kind:n,delta:i,reason:'delivery',by:t,app:s})},recount:(n,i)=>{const o=i-(c[n]??0);o&&E.append({rid:e,kind:n,delta:o,reason:'count',by:t,app:s})},undoLast:()=>{p&&E.append({rid:e,kind:p.kind,delta:-p.delta,reason:'undo',by:t,app:s,undoes:p.id})}}};var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),i=r(_d[3]),o=r(_d[4]),a=r(_d[5]),d=(e=a)&&e.__esModule?e:{default:e};r(_d[6]);var u=r(_d[7]),c=r(_d[8]),l=r(_d[9]),f=r(_d[10]),p=r(_d[11]),v=r(_d[12]);const S=()=>{try{return(0,v.nowFrom)(v.useStore.getState().clock)}catch{return new Date}},h='covercharge-shellfish-v1',y='anchorage',_=(0,u.create)()((0,c.persist)(e=>({events:[],items:o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))},server:{},saveItem:(t,s)=>e(e=>{const n=e.items[t]??[];return{items:{...e.items,[t]:n.some(e=>e.key===s.key)?n.map(e=>e.key===s.key?s:e):[...n,s]}}}),removeItem:(t,s)=>e(e=>({items:{...e.items,[t]:(e.items[t]??[]).filter(e=>e.key!==s)}}))}),{name:h,storage:(0,c.createJSONStorage)(()=>d.default),version:4,partialize:e=>({events:e.events,items:e.items,server:e.server}),migrate:async e=>{t.LIVE_VENUE_BUILD&&e&&await(0,s.archiveChefCache)('tracked-stock',e);const n=e??{};return{events:(i=n.events,(i??[]).filter(e=>!e.id.startsWith('sf-seed-'))),items:n.items??(o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))}),server:n.server??{}};var i}})),b={list:e=>_.getState().events.filter(t=>t.rid===e),append:e=>{const t={...e,id:(0,p.uuid)(),at:e.at??S().toISOString()};return _.setState(e=>({events:[t,...e.events].slice(0,500)})),t},subscribe:e=>_.subscribe(e)},E=b;'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===h&&_.persist.rehydrate()});const k=[],O=(e,t=!1,s)=>{const n=_(t=>t.items[e])??k;return t?n:n.filter(e=>e.active&&(s?e.group===s:!e.group)).sort((e,t)=>e.sort-t.sort)},I=e=>!e.id.startsWith('sf-');function w(e,t){const s=e.items[t]??[],n=e.server[t],i=e.events.filter(e=>e.rid===t);if(!n)return(0,f.countsOf)(i,s);const o=new Set(n.seen),a=new Date(Date.now()-2592e5).toISOString();return(0,f.countsOf)(i.filter(e=>I(e)&&!o.has(e.id)&&e.at>=a),s,n.counts)}},1084,[842,1196,1082,1083,5,1188,123,993,1189,881,1086,1097,878]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOrderSheets",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useSheets",{enumerable:!0,get:function(){return f}});var e,s=r(d[0]),t=r(d[1]),h=r(d[2]),n=r(d[3]),o=(e=n)&&e.__esModule?e:{default:e},c=r(d[4]),i=r(d[5]),u=r(d[6]);const p=()=>h.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{}:{anchorage:u.ANCHORAGE_SHEETS.filter(e=>!e.placeholder).map(e=>({...e,items:e.items.map(e=>({...e}))}))},l=(0,c.create)()((0,i.persist)(e=>({sheets:p(),opened:{},upsert:(s,t)=>e(e=>{const h=e.sheets[s]??[];return{sheets:{...e.sheets,[s]:h.some(e=>e.id===t.id)?h.map(e=>e.id===t.id?t:e):[...h,t]}}}),patch:(s,t,h)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).map(e=>e.id===t?{...e,...h}:e)}})),remove:(s,t)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).filter(e=>e.id!==t)}})),markOpened:(s,t)=>e(e=>({opened:{...e.opened,[s]:t}})),reset:s=>e(e=>({sheets:{...e.sheets,[s]:'anchorage'===s&&p().anchorage||[]}}))}),{name:'covercharge-ordersheets-v1',storage:(0,i.createJSONStorage)(()=>o.default),version:3,migrate:async e=>{const h=e;return s.LIVE_VENUE_BUILD?(await(0,t.archiveChefCache)('order-sheets',h),{...h,sheets:{...h.sheets,anchorage:(h.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}}):h}})),_=[],f=e=>l(s=>s.sheets[e])??_},1085,[842,1196,5,1188,993,1189,1080]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANCHORAGE_STOCK",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"stockKey",{enumerable:!0,get:function(){return n}}),_e.countsOf=function(e,t=[],n={}){const u={...n};for(const e of t)u[e.key]=u[e.key]??0;for(const t of e)u[t.kind]=(u[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(u).map(([e,t])=>[e,o(i.get(e),t)]))},_e.lastUndoable=function(e){const t=new Set(e.filter(e=>e.undoes).map(e=>e.undoes));return e.find(e=>'undo'!==e.reason&&'count'!==e.reason&&!t.has(e.id))},Object.defineProperty(_e,"fmtCount",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isLowItem",{enumerable:!0,get:function(){return c}}),_e.describe=function(e,t){const n=(t?.name??e.kind).toLowerCase(),o=(t?.plural??`${e.kind}s`).toLowerCase(),s=t?i(e.rid,t,Math.abs(e.delta)):u(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${s} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${s} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${s} ${n})`:`Count: ${s} ${o}`},Object.defineProperty(_e,"isRoastItem",{enumerable:!0,get:function(){return l}}),_e.isSundayIn=function(e,t="Europe/London"){try{return'Sun'===new Intl.DateTimeFormat('en-GB',{weekday:'short',timeZone:t}).format(e)}catch{return 0===e.getDay()}};var e=r(_d[0]);const t=[{key:'lobster',name:'Lobster',plural:'Lobsters',unit:'half',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd9e',sort:1,active:!0},{key:'crab',name:'Crab',plural:'Crabs',unit:'whole',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd80',sort:2,active:!0}],n=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,40)||'item',o=(e,t)=>Math.max(0,'kg'===e?.unit?t:'half'===e?.unit?Math.round(2*t)/2:Math.round(t));const u=e=>{const t=Math.floor(e);return e-t>=.5?t?`${t}\xbd`:'\xbd':String(t)},i=(t,n,o)=>'kg'===n.unit?(0,e.fishQtyText)(t,n,o):u(o),s=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):u(o),c=(e,t)=>t<=(e?.lowAt??4);const l=e=>'roast'===e.group},1086,[1083]); +__d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.useGameClock=I,_e.usePlayable=function(e,t){return(0,y.gamePlayable)(I(e,t))},Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return C}}),_e.gameBase=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return C(e?.settings?.gameUrl)??v},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,b.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=I(e,s),u=(0,y.gamePlayable)(c);return n?(0,w.jsxs)(d.Card,{children:[(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(d.T,{size:13,colour:u?x.colours.ok:x.colours.muted,children:u?'Open':'Locked'})]}),(0,w.jsx)(d.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),u?null:(0,w.jsx)(d.Muted,{testID:"break-room-locked-text",children:y.GAME_LOCKED_TEXT}),(0,w.jsx)(d.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,w.jsx)(R,{staffId:e,name:t,playable:u,clock:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return T}}),_e.BreakRoom=R;var t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),n=e(r),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),c=e(_r(_d[6])),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),m=_r(_d[10]),y=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),p=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]),x=_r(_d[17]),w=_r(_d[18]);function I(e,t){const s=(0,m.useOwner)(e=>e.attendance);return(0,y.gameClock)(s,e,t)}const v='https://lennys-kitchen-chaos-13e285.deed.page/',C=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function S(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const T=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:I,playable:R,clock:P,onClose:L,car:M}){const D=(0,m.useOwner)(e=>e.staff),O=(0,f.useAvatars)(e=>e.photos),_=(0,h.useSetup)(e=>e.looks),z=(0,r.useRef)(null),[N,U]=(0,r.useState)({}),[A,B]=(0,r.useState)(!1),[G,q]=(0,r.useState)(null),H=(0,b.useStore)(e=>C(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??v),V=(0,r.useMemo)(()=>S(H),[H]),W=V?.origin??'',$=(0,j.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),K=!(!$||!e||$===e),X=K?null:$??e??null,Y=T(I),[F,J]=(0,r.useState)(''),[Q,Z]=(0,r.useState)(null),ee=(0,r.useRef)(null),te=(0,r.useRef)(0),se=(0,r.useRef)(null),re=(0,r.useRef)(R);re.current=R;const ne=(0,r.useMemo)(()=>D.filter(e=>e.active&&!e.name.includes('(example)')),[D]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const s of ne){const r=null!=_[s.id]&&_[s.id]>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===_[s.id]):void 0;if(r){e[s.id]=r.dataUrl;continue}const n=document.getElementById(`cc-av-${s.id}`)?.querySelector('svg');n&&(e[s.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n.outerHTML.includes('xmlns')?n.outerHTML:n.outerHTML.replace('clearTimeout(e)},[ne,_]);const oe=(0,r.useMemo)(()=>ne.map(e=>{const t=O[e.id]?.dataUrl??N[e.id],s={id:e.id,name:T(e.name),role:e.job||e.level||e.role};return t&&(s.avatarUrl=t),s}),[ne,O,N]),le=(0,r.useCallback)(e=>{try{W&&z.current?.contentWindow?.postMessage(e,W)}catch{}},[W]);return(0,r.useEffect)(()=>{const e=async e=>{if(!W||e.origin!==W||e.source!==z.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return q('string'==typeof t.version?String(t.version).slice(0,12):null),void B(!0);const s=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.listScores)(s,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!X||'string'==typeof e.staffId&&e.staffId!==X)return void le({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,k.listScores)(s,10),id:null}});const r='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.submitScore)(s,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:r,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:X,name:Y})})}'lenny:roundAbandoned'===t.type&&J('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&J(''),'lenny:progress'===t.type&&X&&t.staffId===X&&(0,k.saveProgress)(X,t.progress),'lenny:gameComplete'===t.type&&X&&t.staffId===X&&J(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[le,X,Y,W]),(0,r.useEffect)(()=>{B(!1),ee.current=null,se.current=null},[V?.src]),(0,r.useEffect)(()=>{if(!A)return;const e=e=>{se.current!==e&&(se.current=e,le({type:'lenny:setPlayable',playable:e}))},t=K?null:`${X??''}|${Y}`;if(t&&ee.current===t)return void e(R);const s=++te.current;ee.current=null,se.current&&e(!1),t&&(0,k.loadProgress)(X).catch(()=>null).then(r=>{s===te.current&&(le({type:'lenny:setPlayer',name:Y,staffId:X,...r?{progress:r}:{}}),ee.current=t,e(re.current))})},[A,K,X,Y,R,le]),(0,r.useEffect)(()=>{A&&le({type:'lenny:setRoster',staff:oe})},[A,oe,le]),(0,r.useEffect)(()=>{A&&null!==Q&&le({type:'lenny:setMuted',muted:Q})},[A,Q,le]),(0,w.jsx)(o.default,{visible:!0,animationType:"slide",onRequestClose:L,children:(0,w.jsxs)(c.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,s.soutersSurface)('#000')},children:[M?(0,w.jsx)(E,{status:K?'Switching player\u2026':R?'Parked only \xb7 enjoy!':'Game locked',muted:!!Q,onPause:()=>le({type:'lenny:pause'}),onMute:()=>Z(!Q),onClose:L}):(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:x.colours.bg},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(c.default,{testID:R&&!K?'break-playable':'break-locked',accessibilityLabel:G?`Game version ${G}`:void 0,children:(0,w.jsx)(d.T,{size:13,colour:R?x.colours.ok:x.colours.gold,children:K?'Switching player\u2026':R?'off'===P?'Off shift: enjoy!':'On your break: enjoy!':'Game locked'})}),(0,w.jsxs)(d.Row,{gap:4,children:[(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:Q?'Turn sound and voice on':'Mute sound and voice',onPress:()=>Z(!Q),style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:Q?'Sound on':'Mute'})}),(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",onPress:L,style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:"Close"})})]})]}),R||K?null:(0,w.jsx)(c.default,{testID:"break-locked-text",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.text,children:y.GAME_LOCKED_TEXT})}),F?(0,w.jsx)(c.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.muted,children:F})}):null,V?n.default.createElement('iframe',{ref:z,src:V.src,key:V.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,w.jsx)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(d.Muted,{children:"The Break room opens in the web app."})}),(0,w.jsx)(c.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:ne.map(e=>(0,w.jsx)(c.default,{nativeID:`cc-av-${e.id}`,children:(0,w.jsx)(u.AvatarLook,{look:_[e.id],id:e.id,name:e.name,size:96})},e.id))})]})})}function E({status:e,muted:t,onPause:s,onMute:r,onClose:n}){const o={minHeight:72,minWidth:150,paddingHorizontal:22,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'};return(0,w.jsxs)(c.default,{testID:"car-game-bar",style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:16,paddingVertical:10,backgroundColor:x.colours.bg,borderBottomWidth:1,borderColor:x.colours.border},children:[(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",accessibilityLabel:"Close the game",onPress:n,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Close"})}),(0,w.jsx)(l.default,{testID:"car-game-pause",accessibilityRole:"button",accessibilityLabel:"Pause the game",onPress:s,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Pause"})}),(0,w.jsxs)(c.default,{style:{flex:1,alignItems:'center',minWidth:0},children:[(0,w.jsx)(d.T,{size:22,weight:"semibold",center:!0,numberOfLines:1,children:"Lenny\u2019s Kitchen Chaos"}),(0,w.jsx)(d.T,{size:15,colour:x.colours.goldLight,center:!0,numberOfLines:1,children:`${e} \xb7 touch the big buttons on the game`})]}),(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:t?'Turn sound and voice on':'Mute sound and voice',onPress:r,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:t?'Sound on':'Mute'})}),(0,w.jsx)(c.default,{testID:"car-game-parked",style:{...o,minWidth:0,borderColor:x.colours.goldMuted,backgroundColor:'rgba(201,162,74,0.12)'},children:(0,w.jsx)(d.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:"PARKED ONLY"})})]})}},1087,[1383,931,31,257,123,264,128,994,818,1223,861,1450,1094,878,5,1451,824,825,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hash",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return r}}),_e.revenueHistory=function(e,t,r=28){const s=[];if(!(0,a.examplesAllowed)())return s;for(let a=r;a>=1;a--){const r=(0,o.addMins)(t,1440*-a),i=!!e.kitchenHours[r.getDay()],d=[1.05,0,0,.6,.7,1,1.2][r.getDay()]*('anchorage'===e.id?1:.6),l=t=>.85+.3*n((0,o.ymd)(r)+t+e.id),u=i?Math.round(24e4*d*l('d')):0,c=i?Math.round(95e3*d*l('t')):0,p=i?Math.round(52e3*d*l('q')):0;s.push({date:r,label:(0,o.niceDate)(r).slice(0,6),byChannel:{'Dine-in':u,Takeaway:c,'Table QR':p},total:u+c+p,covers:i?Math.round(150*d*l('c')):0})}return s},_e.dishStats=function(e){return(0,a.examplesAllowed)()?e.filter(e=>null!=e.price).map(e=>{const t=Math.round(20+260*n(e.id+'s')),o=.24+.22*n(e.id+'c'),a=e.price??0,r=Math.round(a*(1-o));return{item:e,sold:t,revenue:t*a,costPct:o,margin:r,gp:r*t}}):[]},_e.quadrant=function(e,t,o,a){return e>=o?t>=a?'Star':'Plough horse':t>=a?'Puzzle':'Dog'},Object.defineProperty(_e,"QUADRANT_TIP",{enumerable:!0,get:function(){return s}}),_e.crmCustomers=function(){return(0,a.examplesAllowed)()?i.map((e,t)=>{const o=n(e+t);return{id:0===t?'cust-demo':`cr-${t}`,name:`${e} ${d[t]}${0===t?'':' (example)'}`,phone:`07700 900${String(100+7*t).slice(-3)}`,visits:1+Math.round(18*o),lastVisit:`${1+Math.round(27*o)} days ago`,spend:Math.round(3e3+6e4*o),allergies:0===t?['Crustaceans (anaphylaxis)','Mustard']:o>.8?['Gluten (coeliac)']:o<.1?['Peanuts']:[],stamps:0===t?5:Math.round(7*o),optIn:o>.25,channel:r[Math.floor(3*o)%3],birthday:o>.6?`${1+Math.round(27*o)} Nov`:void 0}}):[]},Object.defineProperty(_e,"STOCK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"stockList",{enumerable:!0,get:function(){return u}}),_e.insights=function(e,n,r,s,i,d,u){const p=[];if(!(0,a.examplesAllowed)())return c(e,n,r,s,i,d,u);const h=new Date(d);h.setDate(h.getDate()+((6-h.getDay()+7)%7||7)),h.setHours(0,0,0,0);const b=(0,t.forecastToday)(e,n,r,s,h),m=Math.round(b.restOfDay.covers/Math.max(1,b.multiplier)),y=Math.max(35,Math.round(100*(b.multiplier-1))+35);p.push({id:'sat',icon:'\ud83d\udcc8',tone:'gold',title:`${(0,o.niceDate)(h)} forecast +${y}%: add 1 server 6\u20139pm`,body:`Example: about ${Math.round(m*(1+y/100))} covers expected vs about ${m} on a usual Saturday (bookings pace + Halloween weekend flag).`,action:{label:'Open rota',tab:'more',sub:'rota'}});const f=(0,t.forecastToday)(e,n,r,s,d),v=l[0],w=Math.ceil((f.restOfDay.covers+2*f.restOfDay.takeaway)*v.perCover);p.push({id:'haddock',icon:'\ud83d\udc1f',tone:'red',title:`Haddock low: ${v.onHand} portions left`,body:`Tonight\u2019s forecast needs about ${w}. Call the supplier before 18:00 or mark the fish supper sold out at ${v.onHand} sold.`,action:{label:'Prep list',tab:'more',sub:'prep'}});const k=s.find(e=>/Burns/.test(e.title));if(k){const e=Math.max(1,Math.round((new Date(k.date).getTime()-d.getTime())/6048e5));p.push({id:'burns',icon:'\ud83e\udd43',tone:'blue',title:`Burns Night in ${e} weeks: open bookings?`,body:'Last year\u2019s equivalent nights sold out about 3 weeks ahead (example). Publish the set menu and push to opted-in regulars.',action:{label:'Plan campaign',tab:'more',sub:'marketing'}})}const M=n.filter(e=>e.date===(0,o.venueYmd)(d)&&'noshow'===e.status).length;p.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:M?`${M} no-show today: deposits for 6+?`:'Deposits for bigger tables (example)',body:'Deposits are set per venue in Settings \u203a Advanced \u203a Deposits. Consider them on Fri/Sat after 19:00.',action:{label:'Bookings',tab:'bookings'}});const C=i.filter(e=>e.stars<=2).length;C&&p.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${C} low rating this week: cold chips at collection`,body:'Readiness alerts now time bagging 5 min before pickup. Reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});return p.push({id:'commission',icon:'\ud83d\udcb7',tone:'ok',title:'You kept about \xa31,240 in commission this month',body:'Example: \xa34,140 of direct takeaway orders that would have cost about 30% on delivery apps.',action:{label:'Analytics',tab:'more',sub:'analytics'}}),p.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${u} covers so far today`,body:'Lobster special is the top add-on tonight. Suggest it with the scallops (example).'}),p};var e=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]);const n=e=>{let t=2166136261;for(let o=0;o>>0)/4294967295},r=['Dine-in','Takeaway','Table QR'];const s={Star:'Keep: high margin and popular. Feature it.','Plough horse':'Popular, low margin: nudge the price or trim the cost.',Puzzle:'High margin, few sales: promote it or rename it.',Dog:'Low margin, few sales: consider removing it.'},i=['Alex','Fiona','Iain','Morag','Callum','Eilidh','Ross','Kirsty','Euan','Shona','Hamish','Isla','Craig','Ailsa','Neil','Catriona'],d=['Morgan','Campbell','Fraser','McLeod','Kerr','Wallace','Boyd','Hamilton','Stewart','Murray','Paterson','Duncan','Gilmour','Reid','Ross','Grant'];const l=[{cat:'Fish & seafood',id:'haddock',name:'Haddock fillets',unit:'portions',onHand:8,perCover:.22,par:40},{cat:'Fruit & veg',id:'chips',name:'Chipping potatoes',unit:'kg',onHand:25,perCover:.18,par:40},{cat:'Fish & seafood',id:'langoustine',name:'Langoustines',unit:'kg',onHand:4,perCover:.03,par:6},{cat:'Fish & seafood',id:'mussels',name:'Mussels',unit:'kg',onHand:10,perCover:.05,par:12},{cat:'Fish & seafood',id:'scallops',name:'Scallops',unit:'portions',onHand:14,perCover:.06,par:20},{cat:'Meat',id:'beef',name:'Burger patties',unit:'each',onHand:30,perCover:.1,par:40},{cat:'Fruit & veg',id:'peas',name:'Garden peas',unit:'kg',onHand:6,perCover:.04,par:8},{cat:'Dairy',id:'tartare',name:'House tartare sauce',unit:'tubs',onHand:5,perCover:.05,par:10}],u=()=>(0,a.examplesAllowed)()?l:[];function c(a,n,r,s,i,d,l){const u=[],c=(0,t.forecastToday)(a,n,r,s,d);c.enough||u.push({id:'history',icon:'\ud83d\udcc5',tone:'gold',title:'Not enough history yet',body:c.suggestions[0]?.replace(/^Not enough history yet\. /,'')??'',action:{label:'Settings \u203a Advanced',tab:'more',sub:'advanced'}});const p=(0,o.ymd)(d),h=n.filter(e=>e.date===p&&'noshow'===e.status).length;h&&u.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:`${h} no-show${1===h?'':'s'} today`,body:'Think about a deposit for larger parties (Settings \u203a Advanced \u203a Deposits).',action:{label:'Bookings',tab:'bookings'}});const b=i.filter(e=>e.stars<=2).length;b&&u.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${b} low rating${1===b?'':'s'} to read`,body:'Read what they said, reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});const m=s.filter(e=>e.date>=p).sort((e,t)=>e.date.localeCompare(t.date))[0];return m&&u.push({id:'event',icon:'\ud83d\udcc5',tone:'blue',title:`Coming up: ${m.title}`,body:`${(0,o.niceDate)(new Date(m.date+'T12:00:00'))}. Check your rota and think about a promo.`,action:{label:'Forecast',tab:'forecast'}}),u.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${l} covers so far today`,body:`Seated bookings and walk-ins recorded in CoverCharge today. ${(0,e.laterTodayLine)((0,e.laterTodayCovers)(n,p))}`}),u}},1088,[832,876,822,1216]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useExamples",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const l=()=>(0,t.useSyncExternalStore)(n.onDataModeChange,n.examplesAllowed,n.examplesAllowed)},1089,[31,1216]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useRealHistory=function(e,t){const o=(0,c.useExamples)(),n=(0,r.useBookings)(e),l=(0,r.useOrders)(e),f=(0,u.useCashUp)(e=>e.cashUps),y=(0,k.clampWeeks)((0,h.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings.forecastMinWeeks)),b=t.toDateString();return(0,s.useMemo)(()=>o?null:(0,k.buildHistory)(e,n,l,f.map(e=>({rid:e.rid,date:e.date,takings:(0,p.takings)(e.vals)})),t,y),[o,e,n,l,f,y,b])},Object.defineProperty(_e,"ExampleBadge",{enumerable:!0,get:function(){return b}}),_e.NotEnoughHistory=function({weeks:e,booked:s,what:t="Forecasts",testID:r="not-enough-history"}){return(0,y.jsx)(n.Card,{children:(0,y.jsxs)(o.default,{testID:r,style:{gap:6},children:[(0,y.jsx)(n.T,{weight:"semibold",colour:f.colours.gold,children:"Not enough history yet"}),(0,y.jsx)(n.Muted,{children:'Forecasts'===t?(0,l.notEnoughTip)(e):`${t} start once CoverCharge has ${1===e?'1 week':`${e} weeks`} of your bookings and cash-ups.`}),s?(0,y.jsx)(o.default,{testID:`${r}-booked`,children:(0,y.jsxs)(n.T,{children:["Booked so far: ",s," Covers"]})}):null,(0,y.jsx)(n.Muted,{children:"Tip: upload or add your bookings and do the cash up each night. Managers can change how much history is needed in Settings \u203a Advanced."})]})})};var e,s=_r(d[0]),t=_r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=_r(d[2]),r=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),p=_r(d[8]),k=_r(d[9]),f=_r(d[10]),y=_r(d[11]);const b=()=>(0,y.jsx)(n.Badge,{kind:"amber",label:l.EXAMPLE_LABEL.toUpperCase()})},1090,[31,128,818,823,1046,1216,1089,878,13,1091,825,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_MIN_WEEKS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"clampWeeks",{enumerable:!0,get:function(){return o}}),e.buildHistory=function(o,a,c,u,d,f=n){const l=(0,t.ymd)(d),y=(0,t.ymd)(new Date(d.getTime()-48384e5)),h=t=>t>=y&&tt.rid===o&&h(t.date));for(const t of k)D.add(t.date);const T=[...D].sort(),w=T.length?s(T[0],l):0,j=w>=7*f&&T.length>=2*f,O=t=>{const n={},o={};for(const t of T){const n=new Date(t+'T12:00:00').getDay();o[n]=(o[n]??0)+1}for(const[o,s]of Object.entries(t)){const t=new Date(o+'T12:00:00').getDay();n[t]??={};for(const[o,a]of Object.entries(s))n[t][Number(o)]=(n[t][Number(o)]??0)+a}for(const t of Object.keys(n))for(const s of Object.keys(n[+t]))n[+t][+s]=n[+t][+s]/(o[+t]||1);return n},M=Array.from({length:7},()=>[]);for(const t of k)'number'==typeof t.takings&&t.takings>0&&M[new Date(t.date+'T12:00:00').getDay()].push(Math.round(100*t.takings));const N=M.map(t=>t.length?Math.round(t.reduce((t,n)=>t+n,0)/t.length):null),_=k.filter(t=>'number'==typeof t.takings&&t.takings>0),E=(_.length?s(_.map(t=>t.date).sort()[0],l):0)>=7*f&&_.length>=2*f;return{covers:O(b),takeaway:O(p),days:T.length,spanDays:w,enough:j,minWeeks:f,takingsByDay:N,cashUps:_.length,salesEnough:E}};var t=r(_d[0]);const n=2,o=t=>{const o=Math.round(Number(t));return Number.isFinite(o)&&o>=1&&o<=8?o:n},s=(t,n)=>Math.round((new Date(n+'T12:00:00').getTime()-new Date(t+'T12:00:00').getTime())/864e5)},1091,[822]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1092,[931,31,121,225,123,128,288,987,818,873,825,1444,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1093,[878,861,5]); +__d(function(_g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SETUP_STEPS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ACCESS_LEVELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ACCESS_ROLE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"ACCESS_APP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"accessOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PERMS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"DEFAULT_PERMS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"DEFAULT_GRADES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useSetup",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useSiteSetup",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"HOME_SETUP_NAGS_OFF",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"homeSetupNagsHidden",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"setupProgress",{enumerable:!0,get:function(){return v}});var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e},i=_r(d[2]),s=_r(d[3]);const o=[{id:'venue',title:'Venue details & logo',sub:'Name, address, phone, your logo and order at table'},{id:'hours',title:'Opening hours',sub:'When the kitchen is open each day'},{id:'plan',title:'Areas & table plan',sub:'Your areas, tables and seats'},{id:'paygrades',title:'Staff pay rates',sub:'Name, age, role and hourly rate; tap to edit'},{id:'staff',title:'Add staff',sub:'Name, role, access, pay and avatar'},{id:'permissions',title:'Permissions',sub:'What each access level can do'},{id:'email',title:'Link email',sub:'Your work email address'},{id:'website',title:'Link website',sub:'Your website and booking link'},{id:'invites',title:'Staff invite links',sub:'Personal links for each person'}],l=['Owner','Manager','Supervisor','Head Chef','Staff'],u={Owner:'owner',Manager:'manager',Supervisor:'manager','Head Chef':'staff',Staff:'staff'},c={Owner:'Managers',Manager:'Managers',Supervisor:'Managers','Head Chef':'Head Chef',Staff:'Staff'},f=(e,t)=>l.includes(e??'')?e:'owner'===t?'Owner':'manager'===t?'Manager':'Staff',b=[{id:'bookings',label:'Take and change bookings'},{id:'walkins',label:'Seat walk-ins'},{id:'block',label:'Block bookings and close the garden'},{id:'tableplan',label:'Edit the table plan'},{id:'kitchen',label:'Kitchen tickets and allergy ticks'},{id:'menu',label:'Edit the menu and allergens'},{id:'rota',label:'Make the rota'},{id:'timesheets',label:'Approve timesheets'},{id:'pay',label:'See pay and wages'},{id:'takings',label:'See takings and reports'},{id:'staff',label:'Add staff and change access'},{id:'settings',label:'Change venue settings'},{id:'billing',label:'Plan and billing'}],p=e=>Object.fromEntries(b.map(t=>[t.id,e])),g=e=>({...p(!1),...Object.fromEntries(e.map(e=>[e,!0]))}),S={Owner:p(!0),Manager:{...p(!0),staff:!1,billing:!1},Supervisor:g(['bookings','walkins','block','tableplan','kitchen','rota']),'Head Chef':g(['kitchen','menu','rota']),Staff:g(['bookings','walkins'])},h=[{id:'pg-foh',name:'Front of house',pence:1271},{id:'pg-bar',name:'Bar team',pence:1271},{id:'pg-kp',name:'Kitchen porter',pence:1271},{id:'pg-cdp',name:'Chef de partie',pence:1450},{id:'pg-sup',name:'Supervisor',pence:1400}],k=()=>({done:{},grades:h.map(e=>({...e})),staffGrade:{},perms:JSON.parse(JSON.stringify(S)),email:'',website:'',bookingUrl:'',invites:{}}),O=(0,i.create)()((0,s.persist)((e,t)=>({sites:{},looks:{},patch:(t,n)=>e(e=>({sites:{...e.sites,[t]:{...e.sites[t]??k(),...n}}})),markDone:(e,n,r=!0)=>{const i={...(t().sites[e]??k()).done};r?i[n]=(new Date).toISOString():delete i[n],t().patch(e,{done:i})},setPerm:(e,n,r,i)=>{const s=t().sites[e]??k();'Owner'!==n&&t().patch(e,{perms:{...s.perms,[n]:{...s.perms[n],[r]:i}}})},resetPerms:e=>t().patch(e,{perms:JSON.parse(JSON.stringify(S))}),setLook:(t,n)=>e(e=>{const r={...e.looks};return null==n?delete r[t]:r[t]=n,{looks:r}})}),{name:'covercharge-setup-v1',storage:(0,s.createJSONStorage)(()=>r.default),version:1})),P=e=>{const n=O(t=>t.sites[e])??y,r=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return{...n,email:r??n.email}},y=k(),E=['anchorage'],w=e=>E.includes(e),v=e=>{const t=o.filter(t=>e.done[t.id]).length;return{done:t,total:o.length,pct:t/o.length}}},1094,[878,1188,993,1189]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1095,[571,1398,1400,1399]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1096,[2,824]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"uuid",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isUuid",{enumerable:!0,get:function(){return t}});const x=()=>globalThis.crypto&&'randomUUID'in globalThis.crypto?globalThis.crypto.randomUUID():'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,x=>{const t=16*Math.random()|0;return('x'===x?t:3&t|8).toString(16)}),t=x=>'string'==typeof x&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)},1097,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"fmtH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fmtHDay",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SHIFT_MIN_START",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MAX_END",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shiftTitle",{enumerable:!0,get:function(){return f}});var t=r(d[0]);const n=t=>{const n=(Math.round(60*t)%1440+1440)%1440;return`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`},u=t=>`${n(t)}${t>=24?' (next day)':''}`,o=7,c=28,f=(n,u)=>`${n.replace(' (example)','')} \xb7 ${(0,t.niceDate)((0,t.parseYmd)(u))}`},1098,[822]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return c}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(t,s,o){const c=t.find(n=>n.id===s);return t.filter(t=>(0,n.canSwapWith)(c,t,o))};var n=r(d[0]);const t=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],s=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],o=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],c='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1099,[1100]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"deptKey",{enumerable:!0,get:function(){return n}}),e.sameDept=function(t,a){const o=n(t?.dept),s=n(a?.dept);return!!o&&o===s},Object.defineProperty(e,"teamKey",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ANCHORAGE_VENUE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_SWAP_EDGES",{enumerable:!0,get:function(){return s}}),e.isAnchorageVenue=d,e.canSwapWith=function(t,n,o){if(!t||!n||!1===t.active||!1===n.active||'owner'===t.role||'owner'===n.role)return!1;const c=l(t),f=l(n);if(!c.length||!f.length||c.some(t=>f.includes(t)))return!1;if(d(o))return s.some(([t,n])=>c.includes(t)&&f.includes(n)||c.includes(n)&&f.includes(t));const b=a(t.dept),u=a(n.dept);return!!b&&b===u},Object.defineProperty(e,"SWAP_DEPT_NOTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"ANCHORAGE_SWAP_NOTE",{enumerable:!0,get:function(){return u}}),e.teamOnDay=function(a,o,s,c){const f=o.find(t=>t.id===c),d=new Map;for(const f of a){if(f.date!==s||!0!==f.published||f.staffId===c)continue;const a=o.find(t=>t.id===f.staffId);if(!a||!1===a.active)continue;const l=String(a.dept??'').trim()||'Department not set',b=n(a.dept)||p,u=d.get(b)??{dept:l,people:[]};u.people.push({id:a.id,name:g(a.name),job:String(a.job??'').trim(),start:f.start,end:f.end,times:`${(0,t.fmtH)(f.start)}\u2013${(0,t.fmtH)(f.end)}`}),d.set(b,u)}const l=n(f?.dept);return[...d.entries()].sort(([t],[n])=>t===l?-1:n===l||t===p?1:n===p?-1:t.localeCompare(n)).map(([,t])=>({...t,people:t.people.sort((t,n)=>t.start-n.start||t.name.localeCompare(n.name))}))},e.teamOnDaySpoken=function(n,a){return a.length?`${n}, also on. `+a.map(n=>`${n.dept}: `+n.people.map(n=>`${n.name}${n.job?`, ${n.job}`:''}, ${(0,t.fmtH)(n.start)} to ${(0,t.fmtH)(n.end)}`).join('; ')).join('. ')+'.':`${n}: nobody else is on the rota.`};var t=r(_d[0]);const n=t=>String(t??'').trim().toLowerCase().replace(/\s+/g,' ');const a=t=>{const a=n(t);return'bar'===a||'foh'===a?'front of house':a},o='6349aa07-3fec-46e9-8c69-7b1b08494793',s=[['st-finn','st-agate'],['st-finn','st-eilidh'],['st-agate','st-eilidh'],['st-gabrielle','st-emily'],['st-gabrielle','st-agate'],['st-emily','st-agate'],['st-gordon','st-lenny'],['st-gordon','st-bisto'],['st-mia','st-lillie']],c={'st-finn':'0db9c5d4-f989-4ce8-838a-54c7735f83f0','st-agate':'fce268d0-63ab-42cd-a298-68e3ec5bcae4','st-eilidh':'88f41ae2-dd2f-41c2-b75d-fa735a77e703','st-gabrielle':'71174004-40de-4477-a157-04858a009baa','st-emily':'6b6f09b4-a65e-4390-b86e-b8c57eabe178','st-gordon':'456e0738-dea5-47a8-813e-7b13a0e6c10e','st-lenny':'4dfc8938-7c90-4667-92d2-410807f791f8','st-bisto':'ea2e4b54-ce06-465a-b796-4fa7cde99004','st-mia':'260f4c7b-e78a-45ba-9f8e-f6e33921762b','st-lillie':'636735ff-0d19-4c47-9bfa-3e13c261acc2','st-jack':'ce6f4391-ec69-4782-aac6-8500eb899cc2','st-cameron':'683888b9-2b3d-4225-b028-12cf577decbb','st-harvey':'3ad10d28-78c0-457d-9238-f4a27fb30170','st-james':'6ffe4ae0-2bc1-4355-b3b5-f6e79884d0dc','st-tracy':'79fbfe9e-1d64-412c-a191-42e94b35c1c7'},f=Object.fromEntries(Object.entries(c).map(([t,n])=>[n,t]));function d(t){const n=String(t??'').trim().toLowerCase();return'anchorage'===n||n===o}function l(t){if(!t)return[];const n=[t.id,t.ref,t.externalRef].map(t=>String(t??'').trim().toLowerCase()).filter(Boolean),a=new Set(n);for(const t of n){const n=c[t]?t:f[t];n&&(a.add(n),a.add(c[n]))}return[...a]}const b='Swaps and cover stay in your department. Bar counts as front of house. A manager can still move a shift on the rota.',u='You can only swap with the people named for you. A manager can still move a shift on the rota.',p='\0unset',g=t=>t.replace(/\s*\(example\)$/,'').trim()},1100,[1098]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rangeLabel",{enumerable:!0,get:function(){return h}}),_e.TimeOffSheet=b,_e.RequestTimeOff=function({meId:e,me:s,testID:l="request-time-off"}){const[d,f]=(0,t.useState)(!1),m=(0,o.ymd)(new Date),u=(0,r.useOwner)(e=>e.leave).filter(t=>t.staffId===e&&t.to>=m).sort((e,t)=>e.from.localeCompare(t.from));return(0,i.jsxs)(n.Card,{children:[(0,i.jsxs)(a.default,{testID:l,style:{gap:8,alignItems:'stretch'},children:[(0,i.jsx)(n.Button,{label:"Request time off",sub:"Holiday, appointments, days you can\u2019t work",testID:`${l}-open`,onPress:()=>f(!0)}),u.map(e=>(0,i.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:8,children:[(0,i.jsxs)(n.T,{size:14,style:{flex:1},children:[h(e.from,e.to)," \xb7 ",e.reason]}),(0,i.jsx)(n.Badge,{kind:'approved'===e.status?'ok':'declined'===e.status?'red':'amber',label:y(e.status)})]},e.id))]}),(0,i.jsx)(b,{visible:d,onClose:()=>f(!1),meId:e,me:s})]})};var t=_r(_d[0]),s=e(_r(_d[1])),a=e(_r(_d[2])),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),i=_r(_d[7]);const d=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['January','February','March','April','May','June','July','August','September','October','November','December'],m=['Holiday','Appointment','Family','Other'],u=e=>(e??'').replace(' (example)',''),c=(e,t)=>Math.round(((0,o.parseYmd)(t).getTime()-(0,o.parseYmd)(e).getTime())/864e5)+1,h=(e,t)=>e===t?(0,o.niceDateYear)((0,o.parseYmd)(e)):`${(0,o.niceDateYear)((0,o.parseYmd)(e))} to ${(0,o.niceDateYear)((0,o.parseYmd)(t))}`,y=e=>'approved'===e?'Approved':'declined'===e?'Declined':'Waiting for a manager';function p({from:e,to:r,onChange:m,today:u}){const c=(0,o.parseYmd)(e||u),[h,y]=(0,t.useState)({y:c.getFullYear(),m:c.getMonth()}),p=(new Date(h.y,h.m,1).getDay()+6)%7,b=new Date(h.y,h.m+1,0).getDate(),x=[...Array(p).fill(null),...Array.from({length:b},(e,t)=>(0,o.ymd)(new Date(h.y,h.m,t+1)))],j=(0,o.parseYmd)(u),w=h.y>j.getFullYear()||h.y===j.getFullYear()&&h.m>j.getMonth(),D=e=>y(({y:t,m:s})=>{const a=new Date(t,s+e,1);return{y:a.getFullYear(),m:a.getMonth()}}),I=t=>{!e||e&&r||tD(-1)}),(0,i.jsxs)(n.T,{weight:"semibold",testID:"time-off-month",children:[f[h.m]," ",h.y]}),(0,i.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u203a",accessibilityLabel:"Next month",testID:"time-off-next-month",onPress:()=>D(1)})]}),(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:d.map(e=>(0,i.jsx)(a.default,{style:{flex:1,alignItems:'center'},children:(0,i.jsx)(n.Muted,{children:e})},e))}),Array.from({length:Math.ceil(x.length/7)},(t,d)=>(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:Array.from({length:7},(t,f)=>{const m=x[7*d+f];if(!m)return(0,i.jsx)(a.default,{style:{flex:1,height:40}},f);const c=me&&mI(m),style:{flex:1,height:40,margin:1,borderRadius:8,alignItems:'center',justifyContent:'center',backgroundColor:h?l.colours.gold:y?'#3a3020':'transparent',opacity:c?.35:1},children:(0,i.jsx)(n.T,{size:14,weight:h?'semibold':'regular',colour:h?'#1a1407':l.colours.text,children:Number(m.slice(8))})},f)})},d))]})}function b({visible:e,onClose:s,meId:l,me:d,manager:f}){const y=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),b=(0,o.ymd)(new Date),[x,j]=(0,t.useState)(f?'':l),[w,D]=(0,t.useState)(''),[I,v]=(0,t.useState)(''),[S,Y]=(0,t.useState)('Holiday'),[C,T]=(0,t.useState)(null),M=I||w,A=!!x&&!!w&&M>=w,P=()=>{T(null),s()};return(0,i.jsx)(n.Sheet,{visible:e,onClose:P,title:f?'Add time off':'Request time off',testID:"time-off-sheet",children:C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Banner,{kind:"success",title:C}),(0,i.jsx)(n.Button,{label:"Done",testID:"time-off-done",onPress:P})]}):(0,i.jsxs)(i.Fragment,{children:[f?(0,i.jsxs)(a.default,{style:{gap:6},children:[(0,i.jsx)(n.T,{weight:"semibold",children:"Who\u2019s off?"}),(0,i.jsx)(n.Row,{wrap:!0,gap:6,children:y.filter(e=>'owner'!==e.role).map(e=>(0,i.jsx)(n.Chip,{testID:`time-off-who-${e.id}`,label:u(e.name),selected:x===e.id,onPress:()=>j(e.id)},e.id))})]}):null,(0,i.jsx)(n.Muted,{center:!0,children:w?I?'Tap a day to start again.':'Now tap your last day off (or tap Send for just that day).':'Tap your first day off.'}),(0,i.jsx)(p,{from:w,to:I,today:b,onChange:(e,t)=>{D(e),v(t)}}),w?(0,i.jsxs)(n.T,{center:!0,weight:"semibold",testID:"time-off-summary",children:[h(w,M)," \xb7 ",c(w,M)," ",1===c(w,M)?'day':'days']}):null,(0,i.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:m.map(e=>(0,i.jsx)(n.Chip,{label:e,selected:S===e,onPress:()=>Y(e)},e))}),(0,i.jsx)(n.Button,{label:f?'Add time off':'Send request',testID:"time-off-send",disabled:!A,onPress:()=>{const e=r.useOwner.getState().addLeave({staffId:x,from:w,to:M,reason:S,by:u(d),...f?{status:'approved',decidedBy:u(d)}:{}}),t=u(y.find(e=>e.id===x)?.name);T(f?`${t} is off ${h(e.from,e.to)}. It shows on the rota now.`:`Sent: ${h(e.from,e.to)}. A manager will approve it, and you\u2019ll see it here.`),D(''),v('')}}),(0,i.jsx)(n.Muted,{center:!0,children:f?'Approved straight away. The rota shows them off and Copy last week won\u2019t give them shifts on those days.':'Your manager sees it in Rota \u203a Swaps & time off and approves it. Nothing is sent by text or email.'})]})})}},1101,[31,264,128,818,861,822,825,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},1162,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.fromDisplayFlag=y,_e.displayUrlFrom=m,_e.openedFromDisplay=function(){return b},_e.BackToDisplayButton=I,_e.BackToDisplay=function(){const e=(0,p.useSession)(e=>e.meId),[n,s]=(0,t.useState)(!1),c=(0,t.useRef)(Date.now());return(0,t.useEffect)(()=>{if(!b||!(0,f.isKitchenViaDisplay)()||'undefined'==typeof window)return;const e=()=>{c.current=Date.now()};for(const t of['pointerdown','keydown','touchstart'])window.addEventListener(t,e,!0);const t=window.setInterval(()=>{Date.now()-c.current>D&&!n&&(s(!0),v())},5e3);return()=>{for(const t of['pointerdown','keydown','touchstart'])window.removeEventListener(t,e,!0);window.clearInterval(t)}},[n]),b?e?null:(0,h.jsx)(o.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,top:12,alignItems:'center',zIndex:9999},children:(0,h.jsx)(I,{})}):null};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),c=r(d[5]),l=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),h=r(d[10]);const w='cc-from-display';function y(e,t){try{const n=new URL(e),o=new URLSearchParams(n.hash.replace(/^#/,''));return'display'===n.searchParams.get('from')||'display'===o.get('from')||'1'===t}catch{return'1'===t}}function m(e){const t=new URL(e),n=t.pathname.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/);return`${t.origin}${n?n[1]:'/'}display-app/index.html`}const b=(()=>{if('undefined'==typeof window||'chef'!==s.APP_VARIANT)return!1;let e=null;try{e=window.sessionStorage.getItem(w)}catch{}const t=y(window.location.href,e);if(t)try{window.sessionStorage.setItem(w,'1')}catch{}return t})(),D=12e4;async function v(){if((0,f.isKitchenViaDisplay)()){try{await(0,u.endDisplayKitchen)()}catch{}try{p.useSession.getState().signOut()}catch{}(0,f.markKitchenViaDisplay)(!1)}try{window.sessionStorage.removeItem(w)}catch{}window.location.assign(m(window.location.href))}function I({compact:e}={}){const[o,s]=(0,t.useState)(!1);if(!b)return null;const u=e?48:56;return(0,h.jsx)(n.default,{testID:"back-to-display",accessibilityRole:"button",accessibilityLabel:"Back to Display",accessibilityHint:"Leaves the Head Chef app and opens the Display again",onPress:()=>{s(!0),v()},style:({pressed:t})=>({minHeight:u,minWidth:e?180:220,paddingHorizontal:e?16:22,borderRadius:u/2,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:t?c.colours.goldLight:c.colours.gold,borderWidth:2,borderColor:c.colours.bg}),children:(0,h.jsx)(l.T,{size:e?15:18,weight:"bold",colour:c.colours.bg,center:!0,children:o?'Opening the Display\u2026':'Back to Display'})})}},1163,[31,123,264,128,807,825,818,824,977,865,25]); +__d(function(g,r,_i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return l}}),_e.quietly=async function(e){u++;try{await e()}finally{u--;for(const e of p)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return w}}),_e.venueChannel=function(e,t,n,s){let i=o().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:o}of t)i=i.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${o??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return i.subscribe(e=>s(e)),i},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return n.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]),i=r(d[4]);const o=()=>(0,t.getSupabase)(),h=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(h).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${h(t[e])}`).join(',')}}`},c=e=>{const t=h(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},l=5;let u=0;const p=new Set;const f=()=>u>0;class w{known={};last=new Map;lastRev=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}unsubDone=null;async start(){this.known=await s.kv.get(this.kvKey,{}),this.snapshotLocal(),p.add(this),this.spec.writeBeforeRead&&this.pushUrgent(),this.unsub=this.spec.subscribe(()=>{u>0?this.snapshotLocal():this.applying||!this.reconciled&&!this.spec.writeBeforeRead||this.pushLocalChanges()}),this.unsubDone=i.mutationQueue.onDone(e=>{if(e.table!==this.spec.table||e.venueId!==this.venueId)return;const t=this.spec.list().find(t=>this.spec.key(t)===e.rowKey);t&&(this.known[this.spec.key(t)]=this.kh(t),this.saveKnown())})}pushUrgent(){const e=this.spec;if(e.writable())for(const t of e.list()){const n=e.key(t);!e.syncable(t)||e.urgent&&!e.urgent(t)||this.pending(n)||this.known[n]===this.kh(t)||this.write(t)}}unsavedKeys(){const e=this.spec;return e.list().filter(t=>e.syncable(t)&&(!e.inWindow||e.inWindow(t))&&this.known[e.key(t)]!==this.kh(t)&&!this.pending(e.key(t))).map(t=>e.key(t))}resendUnsaved(e=()=>!1){const t=this.spec;if(!t.writable())return 0;const n=new Set(this.unsavedKeys().filter(t=>!e(t)));let s=0;for(const e of t.list())n.has(t.key(e))&&(this.write(e),s++);return s}stop(){this.unsub?.(),this.unsub=null,this.unsubDone?.(),this.unsubDone=null,p.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}rev(e){return this.spec.revision?this.spec.revision(e):c(e)}kh(e){return this.spec.knownByRevision?this.rev(e):c(e)}snapshotLocal(){const e=this.spec.list();this.last=new Map(e.map(e=>[this.spec.key(e),c(e)])),this.lastRev=new Map(e.map(e=>[this.spec.key(e),this.rev(e)]))}saveKnown(){s.kv.set(this.kvKey,this.known)}pending(e){return i.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){const t=()=>{let e=o().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);return this.spec.filter&&(e=this.spec.filter(e)),e},n=['bookings','walk_ins','temp_readings','temp_units'].includes(this.spec.table)?await(0,e.readPages)(async(e,n)=>{const{data:s,error:i}=await t().order('id').range(e,n);if(i)throw i;return s??[]}):await(async()=>{const{data:e,error:n}=await t().limit(2e3);if(n)throw n;return e??[]})();this.merge(n,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(n)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],h=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),h=n.fromRow(t);if(!h)continue;i.add(e),p.push(h);const l=c(h),f=this.kh(h),w=s.get(e);if(!this.pending(e)){if(w){const t=this.kh(w);if(this.rev(w)===this.rev(h)){this.known[e]=f,c(w)!==l&&o.push(h);continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(w)){u.push(w);continue}}o.push(h),this.known[e]=f}}const f=n.authoritative?.(e)??null,w=[];for(const[e,t]of s)i.has(e)||this.pending(e)||(!f||!f(t)||n.writable()&&n.syncable(t)||n.inWindow&&!n.inWindow(t)?n.syncable(t)&&(n.inWindow&&!n.inWindow(t)||(this.known[e]?h.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t))):w.push(e));!e.length&&n.keepOnEmpty?.()&&(h.length=0,w.length=0);const v=this.massOk;if(this.massOk=!1,h.length>l&&!v)this.ev.onSuspect?.(n.name,`read would remove ${h.length} of ${s.size}`),h.length=0,u.length=0;else for(const e of h)delete this.known[e];for(const e of w)delete this.known[e],h.push(e);this.applyRemote(o,h);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=c(i);this.known[s]=this.kh(i),this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=c(s),i=this.rev(s);if(this.last.get(n)===t)continue;const o=this.lastRev.get(n);this.last.set(n,t),this.lastRev.set(n,i),void 0!==o&&o===i||(e.syncable(s)&&e.writable()&&this.known[n]!==this.kh(s)&&(!this.pending(n)||e.writeBeforeRead)?this.write(s):e.syncable(s)&&!e.writable()&&this.known[n]!==this.kh(s)&&this.ev.onSkipped?.(e.name,n))}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e),this.lastRev.delete(e);const s=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&s.length>l)return this.ev.onSuspect?.(e.name,`${s.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of s)delete this.known[t],i.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let s;try{s=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if('update'===t.mode){const e=t.venueColumn??'venue_id';i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:s,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:s,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1164,[1280,871,1277,1266,1072]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"SEED_CARD_COSTS",{enumerable:!0,get:function(){return A}}),_e.stripGpSamples=b,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return P}}),_e.useGpCalcView=function(){const e=P();return(0,i.useMemo)(()=>t.LIVE_VENUE_BUILD?{...e,...b(e)}:e,[e])},Object.defineProperty(_e,"GP_TABLES",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"GP_EPOCH",{enumerable:!0,get:function(){return E}}),_e.gpSyncItems=D,_e.gpSyncFromRow=L,_e.mergeGpItems=N,_e.gpSyncSpec=function(e,t){const i=C[e];return{name:i,table:i,deletes:!1,list:()=>D(P.getState(),e),key:e=>e.id,rowKey:t=>String('ing'===e?t.local_id:t.id),syncable:t=>'ing'===e?t.id.length>0&&t.id.length<=80:(0,u.isUuid)(t.id),writable:t,toRow:(t,i)=>({id:'ing'===e?(0,u.isUuid)(t.id)?t.id:(0,p.uuidFrom)(`gi:${i}:${t.id}`):t.id,venue_id:i,...'ing'===e?{local_id:t.id,name:String(t.doc?.name??'').slice(0,120)}:{},doc:_(t),updated_at:t.updatedAt,deleted_at:t.deletedAt??null}),fromRow:t=>L(e,t),apply:(t,i)=>P.setState(n=>N(n,e,t,i)),subscribe:t=>P.subscribe((i,n)=>{i.gone===n.gone&&('ing'===e?i.ingredients===n.ingredients:i[w[e]]===n[w[e]])||t()})}};var e,t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),d=(e=r)&&e.__esModule?e:{default:e},a=_r(_d[5]),c=_r(_d[6]),o=_r(_d[7]),p=_r(_d[8]),u=_r(_d[9]),l=_r(_d[10]),f=_r(_d[11]);let h=0;const m=e=>`${e}-${Date.now().toString(36)}${(h++).toString(36)}`,S=(e,t,i,n,s,r=0,d=[])=>({id:e,name:t,packSize:i,packUnit:n,packPrice:s,wastePct:r,allergens:d}),k=e=>new Date(Date.now()-864e5*e).toISOString(),y={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},v=[S('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),S('gi-potato','Potatoes (chipping)',25,'kg',1600,20),S('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),S('gi-oil','Rapeseed oil',20,'L',3200),S('gi-peas','Garden peas (frozen)',2.5,'kg',450),S('gi-lemon','Lemons',80,'each',1600),S('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),S('gi-capers','Capers',1,'kg',900,0,['sulphites']),S('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),S('gi-steak','Braising steak',5,'kg',6e3,10),S('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),S('gi-onion','Onions',10,'kg',1e3,10),S('gi-stock','Beef stock',1,'L',350,0,['celery']),S('gi-chicken','Chicken breast',5,'kg',4750),S('gi-leaves','Cos lettuce',12,'each',960,15),S('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),S('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),S('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),S('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),S('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),S('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs']),{...S('gi-haddock-stone','Haddock (by the stone)',1,'stone',11e3,0,['fish']),servings:30,servingName:'serving',supplier:'Local fish merchant',updatedAt:'2026-11-02T09:00:00.000Z'},{...S('gi-chicken-case','Chicken breast (5 kg case)',5,'kg',4e3),servings:25,servingName:'breast',supplier:'Butcher',updatedAt:'2026-11-02T09:00:00.000Z'}].map(e=>({...e,prices:(y[e.id]??[e.packPrice]).map((e,t,i)=>({p:e,at:k(7*(i.length-t))}))})),I=(e,t,i,n,s,r,d,a="")=>({id:e,name:t,category:i,lines:n.map(([e,t,i])=>({ingId:e,qty:t,unit:i})),portions:s,target:70,menuPrice:r,status:d,description:a,allergens:[]}),O=[I('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),I('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),I('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),I('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),I('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),I('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')],A={[(0,p.uuidFrom)('card:anchorage:a-fishsupper')]:{portions:1,lines:[{ingId:'gi-haddock-stone',qty:1,unit:'serving',recipeIngId:'a-fishsupper-i0'},{ingId:'gi-batter',qty:80,unit:'g',recipeIngId:'a-fishsupper-i1'},{ingId:'gi-potato',qty:250,unit:'g',recipeIngId:'a-fishsupper-i3'},{ingId:'gi-peas',qty:80,unit:'g',recipeIngId:'a-fishsupper-i4'},{ingId:'gi-mayo',qty:40,unit:'ml',recipeIngId:'a-fishsupper-i6'},{ingId:'gi-lemon',qty:.25,unit:'each',recipeIngId:'a-fishsupper-i7'}]}};function b(e){const t=e=>O.some(t=>t.id===e.id&&JSON.stringify(t)===JSON.stringify(e))||/\(example\)/i.test(e.name),i=new Set(e.dishes.filter(e=>!t(e)).map(e=>e.id));let n=!0;for(;n;){n=!1;for(const t of e.dishes.filter(e=>i.has(e.id)))for(const e of t.lines)e.ingId.startsWith('dish:')&&!i.has(e.ingId.slice(5))&&(i.add(e.ingId.slice(5)),n=!0)}const s=e.dishes.filter(e=>i.has(e.id)),r=new Set(s.flatMap(e=>e.lines.map(e=>e.ingId))),d=e=>{const t=v.find(t=>t.id===e.id);if(!t)return!1;const i=({prices:e,...t})=>JSON.stringify(t);return i(t)===i(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(t.prices?.map(e=>e.p)))},a=Object.fromEntries(Object.entries(e.cardCosts??{}).filter(([e,t])=>!(A[e]&&JSON.stringify(A[e])===JSON.stringify(t))));return Object.values(a).forEach(e=>e.lines.forEach(e=>r.add(e.ingId))),{dishes:s,ingredients:e.ingredients.filter(e=>r.has(e.id)||!d(e)),cardCosts:a}}const P=(0,a.create)()((0,c.persist)((e,i)=>({ingredients:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:v,dishes:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:O,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],cardCosts:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:A,gone:{},saveCardCost:(t,i)=>e(e=>{const n={...e.gone};return delete n[`card:${t}`],{cardCosts:{...e.cardCosts,[t]:{...i,updatedAt:(new Date).toISOString()}},gone:n}}),removeCardCost:t=>e(e=>{if(!e.cardCosts[t])return{};const{[t]:i,...n}=e.cardCosts;return{cardCosts:n,gone:{...e.gone,[`card:${t}`]:(new Date).toISOString()}}}),removeIngredient:t=>e(e=>({ingredients:e.ingredients.filter(e=>e.id!==t),gone:{...e.gone,[`ing:${t}`]:(new Date).toISOString()}})),saveIngredient:t=>{const n=i(),s=n.ingredients.find(e=>e.id===t.id),r=n.ingredients.map(e=>e.id===t.id?t:e);let d=n.alerts;if(s&&(s.packPrice!==t.packPrice||s.packSize!==t.packSize||s.wastePct!==t.wastePct)){const e=n.settings.vatPct,i=n.dishes.filter(e=>e.menuPrice).map(t=>{const i=(0,o.gpOf)((0,o.portionCost)(t,n.ingredients,n.dishes),t.menuPrice,e).gpPct,s=(0,o.gpOf)((0,o.portionCost)(t,r,n.dishes),t.menuPrice,e).gpPct;return{id:t.id,name:t.name,before:i,after:s,belowTarget:se.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),c=(a(t)-a(s))/a(s)*100;i.length&&(d=[{id:m('ma'),at:(new Date).toISOString(),ingredient:t.name,change:`${c>=0?'+':''}${c.toFixed(0)}%`,dishes:i},...d].slice(0,20))}const a=s&&JSON.stringify({...s,updatedAt:void 0})!==JSON.stringify({...t,updatedAt:void 0});e({ingredients:a?r.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):r,alerts:d})},addPricePaid:(e,t,n)=>{const s=i(),r=s.ingredients.find(t=>t.id===e);if(!(r&&t>0))return;const d=[...r.prices?.length?r.prices:[{p:r.packPrice,at:''}],{p:Math.round(t),at:n??(new Date).toISOString()}].slice(-20),a={...r,prices:d};i().saveIngredient({...a,packPrice:(0,o.costingPrice)(a,s.settings.priceBasis,s.settings.avgOf??5)})},addIngredient:t=>{const i=m('gi');return e(e=>({ingredients:[...e.ingredients,{updatedAt:(new Date).toISOString(),...t,id:i}]})),i},saveDish:t=>e(e=>({dishes:e.dishes.some(e=>e.id===t.id)?e.dishes.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):[{...t,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:t=>e(e=>({dishes:e.dishes.filter(e=>e.id!==t)})),setSettings:t=>{const n={...i().settings,...t};if(e({settings:n}),void 0!==t.priceBasis||void 0!==t.avgOf)for(const e of i().ingredients){const t=(0,o.costingPrice)(e,n.priceBasis,n.avgOf??5);t!==e.packPrice&&i().saveIngredient({...e,packPrice:t})}},dismissAlert:t=>e(e=>({alerts:e.alerts.filter(e=>e.id!==t)})),deliveries:{},counts:{},saveDelivery:(t,n)=>{const s=i(),r=(new Date).toISOString(),d=s.deliveries[t.id],a=n?(0,f.gpImpact)(s.ingredients,s.cardCosts??{},n,s.settings,t,d).snap:t.gp??d?.gp,{ingredients:c,lines:o}=(0,l.applyDelivery)(s.ingredients,t,s.settings,()=>m('gi'),r,d),p={...t,lines:o,updatedAt:r,...a?{gp:{...a,at:r}}:{}},u={...s.gone};return delete u[`del:${t.id}`],e({ingredients:c,deliveries:{...s.deliveries,[t.id]:p},gone:u}),p},removeDelivery:t=>e(e=>{if(!e.deliveries[t])return{};const{[t]:i,...n}=e.deliveries;return{deliveries:n,ingredients:(0,l.removeDeliveryPrices)(e.ingredients,t,e.settings,void 0,e.deliveries[t]),gone:{...e.gone,[`del:${t}`]:(new Date).toISOString()}}}),saveCount:t=>e(e=>{const i={...e.gone};return delete i[`count:${t.id}`],{counts:{...e.counts,[t.id]:{...t,updatedAt:(new Date).toISOString()}},gone:i}}),removeCount:t=>e(e=>{if(!e.counts[t])return{};const{[t]:i,...n}=e.counts;return{counts:n,gone:{...e.gone,[`count:${t}`]:(new Date).toISOString()}}})}),{name:'covercharge-gpcalc-v1',storage:(0,c.createJSONStorage)(()=>d.default),version:4,migrate:async(e,i)=>(t.LIVE_VENUE_BUILD&&e&&(await(0,n.archiveChefCache)('gpcalc',e),e={...e,...b({...e,dishes:e.dishes||[],ingredients:e.ingredients||[],cardCosts:e.cardCosts||{}})}),i<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e&&!e.cardCosts&&(e.cardCosts={}),e&&!e.gone&&(e.gone={}),e&&!e.deliveries&&(e.deliveries={}),e&&!e.counts&&(e.counts={}),e)}));'undefined'!=typeof window&&'undefined'!=typeof document&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,s.venueKey)('covercharge-gpcalc-v1')&&P.persist.rehydrate()});const w={card:'cardCosts',del:'deliveries',count:'counts'},C={ing:'ingredient_prices',card:'card_costs',del:'kitchen_deliveries',count:'kitchen_stock_counts'},E='1970-01-01T00:00:00.000Z',_=e=>JSON.parse(JSON.stringify(e));function D(e,t){const i=b(e),n='ing'===t?i.ingredients.map(e=>({id:e.id,updatedAt:e.updatedAt??E,doc:_({...e,updatedAt:e.updatedAt??E})})):Object.entries('card'===t?i.cardCosts:e[w[t]]??{}).map(([e,t])=>({id:e,updatedAt:t.updatedAt??E,doc:_({...t,updatedAt:t.updatedAt??E})})),s=new Set(n.map(e=>e.id)),r=Object.entries(e.gone??{}).filter(([e])=>e.startsWith(`${t}:`)).map(([e,i])=>({id:e.slice(t.length+1),updatedAt:i,deletedAt:i})).filter(e=>!s.has(e.id));return[...n,...r]}function L(e,t){const i=t?.doc,n=String('ing'===e?t?.local_id??'':t?.id??'');if(!i||'object'!=typeof i||i.id!==n||'string'!=typeof i.updatedAt||!n)return null;if(i.deletedAt)return'string'==typeof i.deletedAt?{id:n,updatedAt:i.updatedAt,deletedAt:i.deletedAt}:null;const s=i.doc;return s&&'object'==typeof s&&('ing'!==e||'string'==typeof s.name&&s.id===n&&Number(s.packSize)>0&&'string'==typeof s.packUnit&&Number.isFinite(Number(s.packPrice)))&&('ing'===e||Array.isArray(s.lines))&&('del'!==e&&'count'!==e||'string'==typeof s.date&&s.id===n)?{id:n,updatedAt:i.updatedAt,doc:i.doc}:null}function N(e,t,i,n){const s={...e.gone??{}},r=new Map('ing'===t?e.ingredients.map(e=>[e.id,e]):Object.entries(e[w[t]]??{})),d=[];for(const e of i){const i=`${t}:${e.id}`,n=r.get(e.id),a=n?n.updatedAt??E:void 0,c=s[i];if(e.deletedAt){if(n&&a>e.deletedAt)continue;r.delete(e.id),(!c||ce.updatedAt)continue;if(n&&a>e.updatedAt)continue;const o='ing'===t?{...e.doc,id:e.id,updatedAt:e.updatedAt}:{...e.doc,updatedAt:e.updatedAt};n?r.set(e.id,o):d.push([e.id,o]),delete s[i]}for(const e of n)r.delete(e),delete s[`${t}:${e}`];if('ing'===t){return{ingredients:[...r.values(),...d.map(([,e])=>e)],gone:s}}return{[w[t]]:Object.fromEntries([...r.entries(),...d]),gone:s}}},1165,[842,31,1196,5,1188,993,1189,1269,1177,1097,1270,1271]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCardStore",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"photoStorageFull",{enumerable:!0,get:function(){return C}}),_e.setStoragePhotoResolver=function(e){V=e},_e.cachePhotoAs=function(e,t){if(E.getState().photos[e]===t)return;E.setState(r=>({photos:{...r.photos,[e]:t}}))},Object.defineProperty(_e,"readLocalPhoto",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"localRecipeCards",{enumerable:!0,get:function(){return M}}),_e.ensureCards=F;var e,t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),s=_r(d[3]),a=_r(d[4]),o=_r(d[5]),c=(e=o)&&e.__esModule?e:{default:e};_r(d[6]);var u=_r(d[7]),l=_r(d[8]),f=_r(d[9]),m=_r(d[10]),h=_r(d[11]),p=_r(d[12]),S=_r(d[13]);const I='covercharge-recipecards-v1',y='covercharge-recipephotos-v1',O=()=>{try{return(0,S.nowFrom)(S.useStore.getState().clock)}catch{return new Date}},w=(0,u.create)()((0,l.persist)(()=>({cards:[],removed:[],log:[]}),{name:I,storage:(0,l.createJSONStorage)(()=>c.default),version:3,migrate:async e=>{const n=e;return t.LIVE_VENUE_BUILD?(await(0,r.archiveChefCache)('recipe-cards',n),{...n,cards:n.cards.filter(e=>!(0,s.isDemoCard)(e)),log:n.log.filter(e=>!(0,s.demoActor)(e.by))}):n}}));let b=!1;const v={getItem:e=>c.default.getItem(e),setItem:async(e,t)=>{try{await c.default.setItem(e,t),b=!1}catch{b=!0}},removeItem:e=>c.default.removeItem(e)},C=()=>b,E=(0,u.create)()((0,l.persist)(()=>({photos:{}}),{name:y,storage:(0,l.createJSONStorage)(()=>v),version:1})),_={lobster:_r(d[14]),skink:_r(d[15]),fishsupper:_r(d[16]),moules:_r(d[17]),stp:_r(d[18])};let A=0;const B=(e,t,r,n=t)=>{const s={id:`cl-${Date.now().toString(36)}${(A++).toString(36)}`,cardId:e.id,rid:e.restaurantId,at:O().toISOString(),by:t,text:n===t?r:`${r} (${n})`};w.setState(e=>({log:[s,...e.log].slice(0,300)}));try{S.useStore.getState().addAudit(e.restaurantId,'menu',`Recipe card: ${e.dish}: ${r} (${n})`)}catch{}},L=e=>w.setState(t=>({cards:t.cards.some(t=>t.id===e.id)?t.cards.map(t=>t.id===e.id?e:t):[...t.cards,e]}));let P=null,D=null;function U(){const e=w.getState().cards,r=t.LIVE_VENUE_BUILD?e.filter(e=>!(0,s.isDemoCard)(e)).map(e=>({...e,signOff:(0,s.demoActor)(e.signOff?.by)?null:e.signOff,allergensConfirmed:(0,s.demoActor)(e.allergensConfirmed?.by)?void 0:e.allergensConfirmed})):e;if(!D||P!==e){P=e;const t=new Map,n=new Map;for(const e of r)t.set(e.restaurantId,[...t.get(e.restaurantId)??[],e]),n.set(e.menuItemId,e);D={cards:r,byRid:t,byItem:n}}return D}const N=[];function R(e){if(!(0,f.canEditCards)(e.role))throw new Error('Only the head chef and managers can edit recipe cards.')}let V=null;const $=e=>E.getState().photos[e],M={mode:'local',list:e=>U().byRid.get(e)??N,get:e=>U().cards.find(t=>t.id===e),byMenuItem:e=>U().byItem.get(e),subscribe:e=>{const t=w.subscribe(e),r=E.subscribe(e);return()=>{t(),r()}},async create(e,t,r){R(r);const n=O().toISOString();k=!0;let s=t.menuItemId;try{s||(s=S.useStore.getState().addMenuItem({restaurantId:e,section:t.section,name:t.dish,description:t.description??'',price:t.price,dietary:[],allergens:t.allergens??{},prepMins:12,soldOut:!1,signOff:null}));const a=(0,f.cardPhotos)(t),o=t.createdBy?.trim()||r.name,c={id:t.id??(0,f.uuid)(),restaurantId:e,menuItemId:s,dish:t.dish,section:t.section,price:t.price,photo:a[0],photos:a,createdBy:o,createdByRole:t.createdByRole??(o===r.name?r.role:void 0),ingredients:t.ingredients??[],steps:t.steps??[],allergens:t.allergens??{},dismissed:t.dismissed??[],allergenNotes:t.allergenNotes,signOff:null,wasLive:!1,origin:'new',version:1,createdAt:n,updatedAt:n,updatedBy:r.name};return w.setState(e=>({cards:[...e.cards.filter(e=>e.menuItemId!==c.menuItemId),c]})),B(c,r.name,'card created, awaiting sign-off'),c}finally{k=!1}},async update(e,t,r){R(r);const n=M.get(e);if(!n)throw new Error('Card not found');const s=(0,f.editCard)(n,t,r.name,O().toISOString());return s.changed&&(L(s.card),B(s.card,r.name,s.resetSignOff?'edited, sign-off reset to Awaiting sign-off':t.confirmAllergens&&1===Object.keys(t).length?'allergens confirmed':'edited')),s.card},async signOff(e,t){const r=M.get(e);if(!r)throw new Error('Card not found');if(!(0,f.maySignOff)(t,r))throw new Error('Only the Head Chef, an owner or a manager can sign it off.');const n=(0,f.signOffBlock)(r);if(n)throw new Error(n);const s=(0,f.signOffCard)(r,t.name,O().toISOString());return L(s),B(s,t.name,'signed off',(0,f.signerLabel)(t)),s},async remove(e,t){R(t);const r=M.get(e);r&&(w.setState(t=>({cards:t.cards.filter(t=>t.id!==e),removed:[...t.removed,r.menuItemId]})),S.useStore.setState(e=>({menu:e.menu.map(e=>e.id===r.menuItemId?{...e,hidden:!0}:e)})),B(r,t.name,'card removed (dish hidden from the menu)'))},async savePhoto(e,t,r){const n=`local:${t}:${Date.now().toString(36)}`;return E.setState(e=>({photos:{...e.photos,[n]:r.dataUrl}})),n},photoSource(e){if(!e)return null;if(e.startsWith('asset:'))return _[e.slice(6)]??null;if(e.startsWith('local:')){const t=E.getState().photos[e];return t?{uri:t}:null}if(/^(https?:|data:)/.test(e))return{uri:e};const t=E.getState().photos[e];if(t)return{uri:t};const r=V?.(e);return r?{uri:r}:null}};let k=!1,j=!1;function F(){if(k)return;const e=S.useStore.getState().menu,{cards:r,removed:o}=w.getState(),c=new Set(r.map(e=>e.menuItemId)),u=e.filter(e=>!c.has(e.id)&&!o.includes(e.id)),l=O().toISOString();if(r.some(e=>(0,s.isPlaceholderCard)(e))&&w.setState(e=>({cards:e.cards.filter(e=>!(0,s.isPlaceholderCard)(e))})),!u.length)return;const f=a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD||!(0,n.examplesAllowed)()?[]:(0,p.exampleCards)(u),m=new Set(f.map(e=>e.menuItemId)),h=[...f,...u.filter(e=>!m.has(e.id)).map(e=>(0,p.importedCard)(t.LIVE_VENUE_BUILD&&(0,s.demoActor)(e.signOff?.by)?{...e,signOff:null}:e,l))];w.setState(e=>({cards:[...e.cards,...h]}))}(0,h.setMenuCardBridge)({cardFor:e=>U().byItem.get(e),menuItemAdded:e=>{if(k||!j)return;const t=O().toISOString(),r={...(0,p.importedCard)(e,t),id:(0,f.uuid)(),signOff:null,allergensConfirmed:void 0,wasLive:!1,origin:'new',updatedBy:'Added to the menu'};L(r),B(r,r.updatedBy,'card created from the menu, awaiting sign-off')},menuEdited:(e,t,r,n)=>{const s=U().byItem.get(e);if(!s)return;let a=(0,f.editCard)(s,t,r,O().toISOString()).card;n&&a.signOff&&(a={...a,signOff:null,version:a.version+1,updatedAt:O().toISOString(),updatedBy:r}),a!==s&&(L(a),B(a,r,s.signOff&&!a.signOff?'edited from the menu, sign-off reset':'edited from the menu'))},signOff:(e,t)=>{const r=U().byItem.get(e);r&&M.signOff(r.id,{name:t,role:'head-chef'}).catch(()=>{})}}),(0,m.setRecipeCardRepository)(M);const x=e=>new Promise(t=>{e.hasHydrated()?t():e.onFinishHydration(()=>t())});Promise.all([x(S.useStore.persist),x(w.persist)]).then(()=>{j=!0,F(),S.useStore.subscribe((e,t)=>{e.menu!==t.menu&&F()})}),'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===(0,a.venueKey)(I)&&w.persist.rehydrate(),e.key===(0,a.venueKey)(y)&&E.persist.rehydrate()})},1166,[842,1196,1216,1082,5,1188,123,993,1189,1177,839,1186,1217,878,1218,1219,1220,1221,1222]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SYNC_STALE_MS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"READ_GIVE_UP_MS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"FAST_GIVE_UP_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"RETRY_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"LIVE_DOWN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"SILENT_MS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REBUILD_GAP_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"HEARTBEAT_MS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"TICK_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"SLEEP_GAP_MS",{enumerable:!0,get:function(){return b}}),_e.syncStale=function(t,n,s=e){const o='string'==typeof t?Date.parse(t):t??0;return!o||!Number.isFinite(o)||n-o>s},_e.superviseSync=function(e){const t=e.now??(()=>Date.now()),d=e.setInterval??((e,t)=>setInterval(e,t)),h=e.clearInterval??(e=>clearInterval(e)),S=e.setTimeout??((e,t)=>setTimeout(e,t));let _=!1,v=!1;const y={fastReads:0,fullReads:0,rebuilds:0,wakes:0,authRefreshes:0,heartbeats:0,givenUp:0};let p=0,E=0,P=0,w=0,A=t(),M=0;const O=async t=>{try{await t()}catch(n){if(!e.isAuthError(n))throw n;y.authRefreshes++,await e.refreshAuth(),await t()}},R=()=>{if(_)return;if(p&&t()-p{e.markServer(),e.flush()},()=>{v||_||(v=!0,S(()=>{v=!1,R()},s))}).finally(()=>{p===o&&(p=0)})},j=()=>{if(E&&t()-E<6e4)return;E&&y.givenUp++;const n=E=t();y.fullReads++,O(e.readAll).then(()=>{e.flush()},()=>{}).finally(()=>{E===n&&(E=0)})},I=t=>{e.wake?.(),R(),j(),e.flush()},L=[d(R,e.fastMs),d(j,6e4),d(()=>{const n=t();n-A>b&&(y.wakes++,I()),A=n,'SUBSCRIBED'===e.realtime()?w=0:w||(w=n);const s=e.lastServerAt()?n-e.lastServerAt():0;(w&&n-w>o||s>u)&&(t()-P=f&&e.heartbeat&&(M=t(),y.heartbeats++,e.heartbeat().catch(()=>{}))},l)],T=()=>{e.doc&&'hidden'===e.doc.visibilityState||I()},U=()=>I();e.doc?.addEventListener?.('visibilitychange',T);for(const t of['online','focus','pageshow'])e.win?.addEventListener?.(t,U);return{kick:I,stats:()=>({...y}),stop:()=>{_=!0;for(const e of L)h(e);e.doc?.removeEventListener?.('visibilitychange',T);for(const t of['online','focus','pageshow'])e.win?.removeEventListener?.(t,U)}}};const e=6e4,t=3e4,n=1e4,s=2e3,o=45e3,u=9e4,c=12e4,f=6e4,l=5e3,b=2e4},1167,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPABASE_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SUPABASE_ANON_KEY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isSupabaseConfigured",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"REALTIME_TABLES",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n="https://rowdoidkftriylijobuy.supabase.co",o="sb_publishable_rPm723MQz6FwmFVHy6e1SA_ko-_-6GR",u=()=>!t.PITCH&&n.startsWith('https://')&&o.length>20,s=['bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_counts']},1168,[2]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOON_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"setVenueWords",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"getVenueWords",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"setSessionMender",{enumerable:!0,get:function(){return l}}),e.askServer=async function o(c,u,p,l,f=!0){try{const b=(0,t.getSupabase)().functions.invoke(n,{body:{app:c,text:u,tools:p,...l?{receipt:l,spoken:!0,vocab:s}:{}}}),k=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),1e4)),{data:w,error:v}=await Promise.race([b,k]);return f&&'identity'===w?.reason&&await y()?o(c,u,p,l,!1):v||!w||!0!==w.ready||w.busy?{kind:'soon'}:w.call?.name?{kind:'call',name:String(w.call.name),args:w.call.args??{}}:'string'==typeof w.text&&w.text.trim()?{kind:'text',text:w.text.trim()}:{kind:'soon'}}catch{return{kind:'soon'}}},e.transcribe=async function n(o,c,u=8e3,p=!0){try{const l=/mp4|m4a|aac/.test(c.type)?'m4a':/ogg/.test(c.type)?'ogg':/wav/.test(c.type)?'wav':'webm',b=new FormData;b.append('app',o),s.length&&b.append('keyterms',JSON.stringify(s)),b.append('file',c,`speech.${l}`);const k=(0,t.getSupabase)().functions.invoke(f,{body:b}),w=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),u)),{data:v,error:x}=await Promise.race([k,w]);return x?{ok:!1,reason:'timeout'===String(x?.message)?'timeout':'offline'}:!0===v?.ok?{ok:!0,text:String(v.text??''),receipt:'string'==typeof v.receipt?v.receipt:void 0}:p&&'identity'===v?.reason&&await y()?n(o,c,u,!1):{ok:!1,reason:String(v?.reason??'busy'),text:'string'==typeof v?.text?v.text:void 0}}catch{return{ok:!1,reason:'offline'}}};var t=r(d[0]);const n='voice-assistant',o='Voice assistant is switching on soon. Until then I can do the everyday things, for example';let s=[];const c=t=>{s=t.slice(0,100)},u=()=>s;let p=null;const l=t=>{p=t};async function y(){try{return!!p&&await p()}catch{return!1}}const f='voice-transcribe'},1169,[871]); +__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}}},1170,[1188,993,1189]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"desktopStt",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"desktopSttState",{enumerable:!0,get:function(){return u}}),_e.warmDesktopStt=function(){o()&&l()},Object.defineProperty(_e,"cleanHeard",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"tabletWithoutMic",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canRecord",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"canListen",{enumerable:!0,get:function(){return w}}),_e.micPermission=b,Object.defineProperty(_e,"RATE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PRE_ROLL_MS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"HANG_MS",{enumerable:!0,get:function(){return A}}),_e.releaseMic=O,Object.defineProperty(_e,"echoWanted",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"micConstraints",{enumerable:!0,get:function(){return j}}),_e.warmMic=async function(){try{if(o()||!y())return;if(!S&&'granted'!==await b())return;if(await D(),C){C.armedUntil=Date.now()+1500;try{C.ctx.resume?.()}catch{}}x()}catch{}},_e.disarmMic=function(){C&&!C.rec&&(C.armedUntil=0,C.ring=[],C.ringLen=0)},_e.askMic=async function(){try{return await D(),x(),!0}catch{return!1}},_e.wavOf=L,Object.defineProperty(_e,"MAX_CLIP_MS",{enumerable:!0,get:function(){return _}}),_e.listen=B,Object.defineProperty(_e,"CloudRecognition",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"speechRecognizer",{enumerable:!0,get:function(){return N}}),_e.levelMeter=async function(e){const t=n()?.navigator?.mediaDevices,r=n()?.AudioContext||n()?.webkitAudioContext;if(!t?.getUserMedia||!r)return()=>{};let o,i,a=0,c=!1;try{if(o=await t.getUserMedia({audio:!0}),c)return o.getTracks().forEach(e=>e.stop()),()=>{};i=new r;const s=i.createMediaStreamSource(o),u=i.createAnalyser();u.fftSize=512,s.connect(u);const l=new Uint8Array(u.fftSize),d=()=>{u.getByteTimeDomainData(l);let t=0;for(let e=0;e{}}return()=>{c=!0;try{n().cancelAnimationFrame(a)}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}}},_e.yesNo=function(e){const t=e.toLowerCase().trim().replace(/[.!,]/g,'');return/^(yes|yeah|yep|yup|aye|confirm|confirmed|do it|go ahead|correct|that's right|ok|okay|yes please)\b/.test(t)?'yes':/^(no|nope|cancel|stop|don't|do not|wrong|never mind)\b/.test(t)?'no':null},Object.defineProperty(_e,"buzz",{enumerable:!0,get:function(){return W}});var e=_r(_d[0]),t=_r(_d[1]);const n=()=>'undefined'==typeof window?void 0:window,r=()=>n()?.ccDesktop,o=()=>!!r()?.stt&&!!r()?.sttWorker;let i=null,a=0;const c=new Map;let s='cold';const u=()=>s;function l(){if(i)return i;const e=n()?.Worker,t=r()?.sttWorker;return e&&t?(i=new e(t,{type:'module'}),s='loading',i.onmessage=e=>{const t=e.data??{};if(t.ready)return void(s='ready');t.failed&&(s='failed');const n=c.get(t.id);n&&(c.delete(t.id),n(t))},i.onerror=()=>{s='failed',c.forEach(e=>e({error:'stt-failed'})),c.clear()},i.postMessage({warm:!0}),i):null}const d=e=>e.replace(/\[[^\]]*\]|\([^)]*\)/g,' ').replace(/\s+/g,' ').trim();function f(e,t){let o,i,s,u,f=!1,p=!1;const y=[];let w=16e3;const b=()=>{try{s?.disconnect(),u?.disconnect()}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}if(p)return;const n=y.reduce((e,t)=>e+t.length,0);if(n<.35*w)return void t('');const r=new Float32Array(n);let f=0;for(const e of y)r.set(e,f),f+=e.length;const b=16e3===w?r:h(r,w,16e3),v=l();if(!v)return void t('','stt-failed');e('Turning speech into text on this Mac\u2026');const M=++a;c.set(M,e=>t(d(e.text??''),e.error)),v.postMessage({id:M,audio:b},[b.buffer])};return(async()=>{try{if(r()?.askMic){if(!await r().askMic())return void t('','not-allowed')}if(o=await n().navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),f)return void b();const e=n().AudioContext||n().webkitAudioContext;try{i=new e({sampleRate:16e3})}catch{i=new e}w=i.sampleRate,u=i.createMediaStreamSource(o),s=i.createScriptProcessor(4096,1,1),s.onaudioprocess=e=>{f||y.push(new Float32Array(e.inputBuffer.getChannelData(0)))},u.connect(s),s.connect(i.destination),l()}catch(e){t('','NotAllowedError'===e?.name?'not-allowed':'audio-capture')}})(),{stop:()=>{f||(f=!0,b())},abort:()=>{p=!0,f=!0,b()}}}function h(e,t,n){const r=Math.round(e.length*n/t),o=new Float32Array(r),i=t/n;for(let t=0;t{const e=String(n()?.navigator?.userAgent??'');return/CoverChargeTablet\//.test(e)&&!/CoverChargeTablet\/[\d.]+ mic/.test(e)},y=()=>!p()&&!(!n()?.MediaRecorder||!n()?.navigator?.mediaDevices?.getUserMedia),w=()=>o()||y();async function b(){try{const e=n()?.navigator?.permissions?.query;if(!e)return'unknown';const t=await Promise.race([n().navigator.permissions.query({name:'microphone'}),new Promise(e=>setTimeout(()=>e(null),1500))]);return'granted'===t?.state||'denied'===t?.state||'prompt'===t?.state?t.state:'unknown'}catch{return'unknown'}}const v=16e3,M=500,A=450;let P,S=null,T=!1,k=!1,C=null;function U(){const e=C;if(C=null,e){try{e.node.disconnect(),e.src.disconnect()}catch{}try{e.ctx.close()}catch{}e.ring=[],e.rec=null}}function O(){clearTimeout(P),U();try{S?.getTracks().forEach(e=>e.stop())}catch{}S=null}const x=()=>{clearTimeout(P),P=setTimeout(O,/iPhone|iPad|iPod|Macintosh/.test(String(n()?.navigator?.userAgent??''))&&!r()?.mac?6e5:6e4)},R=()=>!1,j=(e=R())=>({audio:{channelCount:{ideal:1},sampleRate:{ideal:v},sampleSize:{ideal:16},echoCancellation:e,noiseSuppression:!0,autoGainControl:!0}});async function D(){clearTimeout(P);const e=R();if(S&&T===e&&S.getAudioTracks().some(e=>'live'===e.readyState))return S;if(S&&O(),S=await n().navigator.mediaDevices.getUserMedia(j(e)),T=e,!k){k=!0;try{n().document.addEventListener('visibilitychange',()=>{'hidden'===n().document.visibilityState&&O()})}catch{}}return E(S),S}function E(e){U();try{const t=n().AudioContext||n().webkitAudioContext;if(!t)return;let r;try{r=new t({sampleRate:v})}catch{r=new t}const o=r.createMediaStreamSource(e),i=r.createScriptProcessor(2048,1,1),a={ctx:r,node:i,src:o,rate:r.sampleRate,ring:[],ringLen:0,rec:null,frames:0,armedUntil:0,level:()=>{}},c=Math.round(.5*a.rate);i.onaudioprocess=e=>{const t=new Float32Array(e.inputBuffer.getChannelData(0));if(a.frames+=t.length,a.rec&&a.rec.push(t),!a.rec&&Date.now()>a.armedUntil)return a.ring=[],void(a.ringLen=0);for(a.ring.push(t),a.ringLen+=t.length;a.ring.length>1&&a.ringLen-a.ring[0].length>=c;)a.ringLen-=a.ring[0].length,a.ring.shift();let n=0;for(let e=0;ee+t.length,0),r=new Float32Array(n);let o=0;for(const t of e)r.set(t,o),o+=t.length;const i=t===v?r:h(r,t,v),a=new ArrayBuffer(44+2*i.length),c=new DataView(a),s=(e,t)=>{for(let n=0;n{clearTimeout(c),clearTimeout(s),S&&(S.rec=null,S.level=()=>{}),x()},k=(e,t,n)=>{h||f||(h=!0,o(e,t,n))};let U=!1;const O=async()=>{if(U)return;U=!0;const n=b,o=S?S.frames-P:0;if(T(),f)return;const i=Date.now()-y,a=!!n&&n.length>0&&o/M*1e3>.6*i?L(n,M):new Blob(w,{type:(p?.mimeType||w[0]?.type||'audio/webm').split(';')[0]});if(i<350||a.size<500)return void k('');r('Turning speech into text\u2026');const c=await(0,e.transcribe)(t,a);c.ok?k(c.text.trim(),void 0,{receipt:c.receipt}):k('',c.reason,{message:c.text})};(async()=>{try{const e=await D();if(d)return T(),void k('');if(S=C,S){try{S.ctx.resume?.()}catch{}b=[...S.ring],M=S.rate,P=S.frames-S.ringLen,S.rec=b,S.level=e=>{i?.(e),a&&!d&&(e>.12?(u=!0,l=0):u&&e<.05&&(l=l||Date.now(),Date.now()-l>1500&&j()))}}const t=F();p=new(n().MediaRecorder)(e,t?{mimeType:t,audioBitsPerSecond:48e3}:void 0),p.ondataavailable=e=>{e.data?.size&&w.push(e.data)},p.onstop=()=>{O()},p.onerror=()=>{b?.length?O():(T(),k('','audio-capture'))},p.start(),y=Date.now(),c=setTimeout(()=>{r('That\u2019s the 30-second limit. Sending now\u2026'),R()},_)}catch(e){T(),k('','NotAllowedError'===e?.name||'SecurityError'===e?.name?'not-allowed':'audio-capture')}})();const R=()=>{try{p&&'inactive'!==p.state?p.stop():O()}catch{O()}},j=()=>{d||(d=!0,p&&(s=setTimeout(R,a?0:A)))};return{stop:j,abort:()=>{f=!0,d=!0,clearTimeout(s);try{p&&'inactive'!==p.state&&p.stop()}catch{}T()}}}function B(e,t,n="owner",r,i=!1){return o()?f(e,t):y()?z(n,e,t,r,i):null}class I{lang='en-GB';interimResults=!1;continuous=!1;maxAlternatives=1;onresult=null;onerror=null;onend=null;l=null;start(){const e='customer'===t.APP_VARIANT?'owner':t.APP_VARIANT;if(this.l=B(()=>{},(e,t)=>{if(this.l=null,t)this.onerror?.({error:t});else if(e){const t=Object.assign([{transcript:e,confidence:1}],{isFinal:!0});this.onresult?.({resultIndex:0,results:[t]})}this.onend?.()},e,void 0,!0),!this.l)throw new Error('not-supported')}stop(){this.l?.stop()}abort(){const e=this.l;this.l=null,e?.abort(),e&&this.onend?.()}}const N=()=>w()?I:null;const W=(e=30)=>{try{n()?.navigator?.vibrate?.(e)}catch{}}},1171,[1169,807]); +__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.`},1172,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.currentCanChangeBookings=function(){const o=t.useSession.getState().meId;if(!o)return!0;const u=n.useOwner.getState().staff.find(n=>n.id===o&&n.active);return(0,s.canChangeBookings)(u)};var n=r(d[0]),t=r(d[1]),s=r(d[2])},1173,[861,865,990]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s}/${n}/${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1174,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const f=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),k=c(t),h=k&&(0,n.validPastDate)(o,u)?`${f}:${o}:${y}`:'',[p,v]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void v({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&v({key:h,data:t,error:''})}).catch(t=>{e&&v({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:k,data:h&&p.key===h?p.data:null,error:h&&p.key===h?p.error:''}},_e.kitchenHistoryAccess=y,_e.lookupKitchenHistory=f,_e.useKitchenHistory=function(t,o,u,c,l=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),h=y(t),p=h&&(0,n.validPastDate)(o,c)&&(0,n.validPastDate)(u,c)&&o<=u?`${k}:${o}:${u}:${l}`:'',[v,w]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!p)return void w({key:'',data:null,error:''});let e=!0;return f(t,o,u).then(t=>{e&&w({key:p,data:t,error:''})}).catch(t=>{e&&w({key:p,data:null,error:t.message})}),()=>{e=!1}},[p,t,o,u]),{allowed:h,data:p&&v.key===p?v.data:null,error:p&&v.key===p?v.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:f}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(f||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}function y(e){const t=s.useSync.getState();return'staff'===t.kind&&t.venueSlug===e&&!!t.venueId&&['*','staff.manage','recipes.signoff','recipes.edit'].some(e=>t.perms.includes(e))}async function f(e,t,n){if(!y(e))throw new Error('Booking history needs the Head Chef app signed in to the venue.');const o=(0,u.getSupabase)(),{data:c,error:l}=await o.rpc('kitchen_booking_history',{p_venue:s.useSync.getState().venueId,p_from:t,p_to:n});if(l||!c||!Array.isArray(c.days))throw new Error('Booking history could not be loaded. Check the connection and try again.');return c}},1175,[31,807,1174,822,824,871]); +__d(function(_g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.clockAction=async function(n,u){if((0,t.privateClockVenue)(u.rid)&&'in'!==n)return c(n,u,{action:n,at:u.at,inside:null,unchecked:!0});const f=(0,a.areaOf)(u.rid),k=f.on&&null!=f.lat&&null!=f.lng,l=k?await(u.fixFn??r.getFix)():'unavailable';if((0,t.privateClockVenue)(u.rid)&&'object'==typeof l&&(!Number.isFinite(l.acc)||l.acc>150))return{ok:!1,message:'Your phone\u2019s location is not accurate enough to confirm you are at the pub. Enable precise location, step near a window and try again, or ask a manager to record your clock-in with a reason.'};const g=k&&'object'!=typeof l?(0,s.locWhere)():'browser',p=(0,o.gate)(f,n,k?l:'unavailable',u.at,g);if(!p.allowed){const a='object'==typeof l?void 0:'app'===g&&'denied'===l?'settings':'app-phone-off'===g?'location':'app-old'===g&&'denied'===l?'update':void 0;return'update'===a&&(0,s.checkAppUpdate)(),{ok:!1,message:(p.message??'You need to be at the venue.')+((0,t.privateClockVenue)(u.rid)?' Ask a manager to record your clock-in with a reason using Record it for someone.':''),fix:a}}const w=c(n,u,p.geo);return w.ok&&p.warn?{...w,warn:p.warn}:w},e.managerClockAction=function(t,a,r,s){const u=(0,o.overrideGeo)(t,a.at,r,s);if(!u)return{ok:!1,message:'Type a short reason (at least 3 letters).'};const f=n.useOwner.getState().staff.find(t=>t.id===a.staffId)?.name??'staff',k=c(t,a,u,{adjusted:{by:r.name,at:a.at,reason:u.override.reason}});if(k.ok){const o={in:'clocked in',out:'clocked out',break_start:'started a break for',break_end:'ended a break for'}[t],s=`${r.name} ${o} ${f} (manager, no location check): ${u.override.reason}`;n.useOwner.setState(t=>({attLog:[{id:`al-${Date.now().toString(36)}`,at:a.at,text:s},...t.attLog]}))}return k};var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),o=_r(d[3]),r=_r(d[4]),s=_r(d[5]);function c(a,o,r,s={}){const c=(0,t.venueClockGeo)(o.rid,r),u=c?!1!==c.inside:void 0,f=n.useOwner.getState(),k=(0,n.openShiftOf)(f.attendance,o.staffId,o.at);if('in'===a){if(k)return{ok:!1,message:'You\u2019re already clocked in.'};f.clock(o.staffId,o.date,'in',o.at,u);const t=(0,n.openShiftOf)(n.useOwner.getState().attendance,o.staffId,o.at);return t&&n.useOwner.getState().patchAttendance(t.id,{...o.offRota?{offRota:!0}:{},...s},c),{ok:!0,att:t&&n.useOwner.getState().attendance.find(a=>a.id===t.id)}}if(!k)return{ok:!1,message:'You\u2019re not clocked in.'};if('out'===a){let t=o.breakMins;if(o.addedBreak&&o.addedBreak>0&&!k.breaks?.length){const a=new Date(o.at).getTime(),r=new Date(Math.max(new Date(k.in).getTime(),a-6e4*o.addedBreak)).toISOString();n.useOwner.getState().patchAttendance(k.id,{breaks:[{start:r,end:o.at}],breakAddedAtClockOut:o.addedBreak}),t=Math.round((a-new Date(r).getTime())/6e4)}return n.useOwner.getState().clock(o.staffId,o.date,'out',o.at,u,t),n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}}return n.useOwner.getState().breakToggle(o.staffId,'break_start'===a?'start':'end',o.at)?(n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}):{ok:!1,message:'break_start'===a?'You\u2019re already on a break.':'You\u2019re not on a break.'}}},1176,[868,1292,861,869,870,1411]); +__d(function(_g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canEditCards",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canSignOffCards",{enumerable:!0,get:function(){return r}}),e.maySignOff=function(t,n){return'staff'!==t.role&&('head-chef'===t.role||('head-chef'===t.actual||!('owner'!==t.role&&'manager'!==t.role||'owner'!==t.actual&&'manager'!==t.actual)||!!n.createdBy&&t.name.trim()===n.createdBy.trim()&&'head-chef'===n.createdByRole))},Object.defineProperty(e,"SIGNER_ROLE_LABEL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"signerLabel",{enumerable:!0,get:function(){return o}}),e.cardActorFor=function(t,n,r){const i=r?'Head Chef'===r.level&&'staff'===r.role?'head-chef':r.role:n;return{name:t,role:n,actual:i}},Object.defineProperty(e,"MAX_RECIPE_PHOTOS",{enumerable:!0,get:function(){return a}}),e.cardPhotos=s,e.suggestForIngredient=d,e.suggestAllergens=u,Object.defineProperty(e,"suggestedBy",{enumerable:!0,get:function(){return f}}),e.unresolved=g,e.applySuggestions=function(t){const n={...t.allergens};for(const r of g(t))n[r]='contains';return n},Object.defineProperty(e,"cardState",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"STATE_LABEL",{enumerable:!0,get:function(){return h}}),e.signOffBlock=function(t){if(!t.dish.trim())return'Give the dish a name first.';const n=g(t);return n.length?`Check the suggested allergens first: ${n.map(p).join(', ')}.`:t.allergensConfirmed?null:'Confirm the allergen list first.'},Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"CONTENT_FIELDS",{enumerable:!0,get:function(){return y}}),e.editCard=function(t,n,r,i){const{confirmAllergens:o,...a}=n,l={...a};l.photos&&_(s({photo:l.photo??t.photo,photos:l.photos}),s(t))&&(delete l.photos,void 0!==l.photo&&l.photo!==(t.photo??s(t)[0])||delete l.photo);const c=Object.keys(l).filter(n=>!_(l[n],t[n]));let d={...t};for(const t of c)d[t]=l[t];const f=c.some(t=>'allergens'===t||'dismissed'===t||'ingredients'===t);f&&!_(u(d.ingredients),u(t.ingredients))&&(d.allergensConfirmed=void 0);f&&(c.includes('allergens')||c.includes('dismissed'))&&(d.allergensConfirmed=void 0);let m=!1;!o||d.allergensConfirmed||g(d).length||(d.allergensConfirmed={by:r,at:i},m=!0);const h=c.length>0||m,p=c.length>0&&!!t.signOff;if(!h)return{card:t,changed:!1,resetSignOff:!1};c.length&&(d={...d,signOff:null,version:t.version+1});return{card:{...d,updatedAt:i,updatedBy:r},changed:h,resetSignOff:p}},e.signOffCard=function(t,n,r){return{...t,signOff:{by:n,at:r},wasLive:!0,updatedAt:r,updatedBy:n}},e.unsignedOldestFirst=function(t,n){return t.filter(t=>!t.signOff).map((t,r)=>{const i=n(t);return{item:t,card:i,at:i?.createdAt||null,order:r}}).sort((t,n)=>(t.at&&n.at?t.at.localeCompare(n.at):t.at?-1:n.at?1:0)||t.order-n.order)},e.addedLabel=function(t){const n=t?new Date(t.length<=10?`${t}T12:00:00`:t):null;return n&&!isNaN(+n)?`Added ${n.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}`:'Date not recorded'},e.allergenSentence=function(n){const r=t.ALLERGENS.filter(t=>'contains'===n[t.id]).map(t=>t.short.toLowerCase()),i=t.ALLERGENS.filter(t=>'may'===n[t.id]).map(t=>t.short.toLowerCase());return r.length||i.length?[r.length?`Contains ${r.join(', ')}.`:'',i.length?`May contain ${i.join(', ')}.`:''].filter(Boolean).join(' '):'No allergens listed yet.'},Object.defineProperty(e,"isRetiredMiniAnchors",{enumerable:!0,get:function(){return O}}),e.overlayItem=function(t,n){return n?{...t,name:n.dish,section:n.section,price:n.price,allergens:n.allergens,allergenNotes:n.allergenNotes,signOff:n.signOff?{by:n.signOff.by,at:n.signOff.at.slice(0,10)}:null,hidden:t.hidden||!n.signOff&&!n.wasLive||O(t.id)||O(n.menuItemId),recipeCardId:n.id}:O(t.id)?{...t,hidden:!0}:t},e.dishesFor=function(t,n){const r=t.filter(t=>!t.hidden),i=r.filter(t=>n.some(n=>'contains'===t.allergens[n])),o=r.filter(t=>!i.includes(t)&&n.some(n=>'may'===t.allergens[n])),a=r.filter(t=>!i.includes(t)&&!o.includes(t));return{contains:i,may:o,free:a}},e.filterCards=function(t,n,r,i="free-from"){const o=n.toLowerCase().split(/\s+/).filter(Boolean);return t.filter(t=>{const n=[t.dish,t.section,...t.ingredients.map(t=>t.name)].join(' ').toLowerCase();return!!o.every(t=>n.includes(t))&&(!r.length||('free-from'===i?r.every(n=>!t.allergens[n]):r.some(n=>!!t.allergens[n])))})},e.uuid=function(){const t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();const n=Array.from({length:16},()=>Math.floor(256*Math.random()));n[6]=15&n[6]|64,n[8]=63&n[8]|128;const r=n.map(t=>t.toString(16).padStart(2,'0')).join('');return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`},e.uuidFrom=function(t){let n='';for(let r=0;r<4;r++){let i=2166136261^2654435761*r;for(let n=0;n>>0;n+=i.toString(16).padStart(8,'0')}const r=n.slice(0,12)+'4'+n.slice(13,16)+(3&parseInt(n[16],16)|8).toString(16)+n.slice(17,32);return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`},Object.defineProperty(e,"RECIPE_CARD_EXTRA_COLUMNS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STEP_SEP",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"photoPath",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"RECIPE_PHOTO_BUCKET",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"RECIPE_CARD_TABLE",{enumerable:!0,get:function(){return S}}),e.cardToRow=function(t,n){return{row:{id:t.id,venue_id:n,dish:t.dish,ingredients:t.ingredients.map(({name:t,qty:n,unit:r,allergens:i})=>({name:t,qty:n,unit:r,...i?.length?{allergens:i}:{}})),method:t.steps.join(w),allergens:b(t.allergens,'contains'),may_contain:b(t.allergens,'may'),photo_url:!t.photo||t.photo.startsWith('local:')||t.photo.startsWith('asset:')?null:t.photo,signed_off_by:t.signOff?.by??null,signed_off_at:t.signOff?.at??null,updated_at:t.updatedAt},extra:{menu_item_id:t.menuItemId,section:t.section,price_pence:t.price,dismissed:t.dismissed,allergen_notes:t.allergenNotes??null,allergens_confirmed_by:t.allergensConfirmed?.by??null,allergens_confirmed_at:t.allergensConfirmed?.at??null,was_live:t.wasLive,origin:t.origin,version:t.version,updated_by:t.updatedBy}}},e.rowToCard=function(t,n,r={}){const i={};t.may_contain.forEach(t=>{i[t]='may'}),t.allergens.forEach(t=>{i[t]='contains'});const o=t.updated_at??(new Date).toISOString();return{id:t.id,restaurantId:n,menuItemId:r.menu_item_id??t.id,dish:t.dish,section:r.section??'Mains',price:r.price_pence??null,photo:t.photo_url??void 0,ingredients:t.ingredients.map((n,r)=>({id:`${t.id}-i${r}`,...n})),steps:t.method?t.method.split(w).filter(t=>t.trim()):[],allergens:i,dismissed:r.dismissed??[],allergenNotes:r.allergen_notes??void 0,allergensConfirmed:r.allergens_confirmed_by?{by:r.allergens_confirmed_by,at:r.allergens_confirmed_at}:void 0,signOff:t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:t.signed_off_at}:null,wasLive:r.was_live??!!t.signed_off_by,origin:r.origin??'new',version:r.version??1,createdAt:o,updatedAt:o,updatedBy:r.updated_by??''}};var t=_r(_d[0]);const n=t=>'head-chef'===t||'manager'===t||'owner'===t,r=t=>'head-chef'===t||'manager'===t||'owner'===t;const i={'head-chef':'Head Chef',manager:'Manager',owner:'Owner',staff:'Staff'},o=t=>`${t.name}, ${i[t.actual??t.role]}`;const a=5;function s(t){const n=(t.photos??[]).filter(t=>!!t);return[...t.photo&&!n.includes(t.photo)?[t.photo]:[],...n].slice(0,a)}const l=[[/\b(flour(?!y)|wheat|bread|crumb|panko|pastry|brioche|buns?\b|crouton|crostini|batter|beer|ale\b|lager|stout|barley|malt|rye|spelt|oat|couscous|semolina|pasta|penne|macaroni|spaghetti|noodle|biscuit|sponge|crumble|roux|tempura|digestive|self.raising)/i,['gluten']],[/\b(prawn|langoustine|lobster|crab|shrimp|crayfish|scampi|shellfish)/i,['crustaceans']],[/\b(mussel|scallop|clam|cockle|squid|calamari|octopus|whelk|winkle|oyster(?! mushroom)|oyster sauce)/i,['molluscs']],[/\b(egg|mayonnaise|mayo|aioli|tartare|hollandaise|meringue|custard|brioche|bearnaise)/i,['eggs']],[/\b(fish(?!er)|haddock|cod|salmon|hake|anchov|tuna|mackerel|trout|sea bass|monkfish|pollock|halibut|kipper|worcester|fish sauce|caesar)/i,['fish']],[/\b(peanut|groundnut|satay)/i,['peanuts']],[/\b(almond|hazelnut|walnut|cashew|pecan|pistachio|macadamia|brazil nut|praline|frangipane|marzipan|pesto)/i,['treenuts']],[/\b(soy|soya|tofu|edamame|miso|tamari|tempeh)/i,['soya']],[/\b(milk|butter(?!nut)|cream|cheese|cheddar|parmesan|mozzarella|brie|yoghurt|yogurt|cr[e\xe8]me|ghee|ice cream|custard|butterscotch|toffee|fudge|buttermilk|mascarpone|ricotta|whey)/i,['milk']],[/\b(celery|celeriac|stock cube|beef stock|chicken stock|veg(etable)? stock)/i,['celery']],[/\b(mustard|dijon|vinaigrette|piccalilli)/i,['mustard']],[/\b(sesame|tahini|hummus|houmous)/i,['sesame']],[/\b(wine|vinegar|dried apricot|dried fruit|sulphite|sulfite|prosecco|cider|port\b|sherry|dates?\b|raisin|sultana)/i,['sulphites']],[/\blupin/i,['lupin']]],c=[[/gluten.free|\bgf\b/i,'gluten'],[/dairy.free|vegan (butter|cheese|cream)|oat milk|plant.based/i,'milk'],[/egg.free|vegan mayo/i,'eggs']];function d(n){const r=new Set(n.allergens??[]);for(const[t,i]of l)t.test(n.name)&&i.forEach(t=>r.add(t));for(const[t,i]of c)t.test(n.name)&&!(n.allergens??[]).includes(i)&&r.delete(i);return t.ALLERGENS.map(t=>t.id).filter(t=>r.has(t))}function u(n){const r=new Set(n.flatMap(d));return t.ALLERGENS.map(t=>t.id).filter(t=>r.has(t))}const f=(t,n)=>t.filter(t=>d(t).includes(n)).map(t=>t.name);function g(t){return u(t.ingredients).filter(n=>!t.allergens[n]&&!t.dismissed.includes(n))}const m=t=>t.signOff?'signed-off':'awaiting',h={'signed-off':'Signed off',awaiting:'Awaiting sign-off'};const p=n=>t.ALLERGENS.find(t=>t.id===n)?.short??n,b=(n,r)=>t.ALLERGENS.filter(t=>r?n[t.id]===r:!!n[t.id]).map(t=>t.id),y=['dish','section','price','photo','photos','createdBy','ingredients','steps','allergens','dismissed','allergenNotes'],_=(t,n)=>JSON.stringify(t??null)===JSON.stringify(n??null);const O=t=>'a-mini'===t;const v={menu_item_id:'text',section:'text',price_pence:'integer null',dismissed:'text[]',allergen_notes:'text',allergens_confirmed_by:'text',allergens_confirmed_at:'timestamptz',was_live:'boolean',origin:'text',version:'integer',updated_by:'text'},w='\n',E=(t,n)=>`${t}/${n.id}-v${n.version}.jpg`,C='recipe-photos',S='recipe_cards'},1177,[819]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ACCIDENT_CATEGORIES",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"RIDDOR_CATEGORIES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"sid",{enumerable:!0,get:function(){return u}}),_e.isSeedAccident=S,_e.upgradeTempUnits=k,Object.defineProperty(_e,"useSafety",{enumerable:!0,get:function(){return w}});var e,t=r(_d[0]),i=r(_d[1]),n=r(_d[2]),a=r(_d[3]),s=(e=a)&&e.__esModule?e:{default:e},o=r(_d[4]),d=r(_d[5]),c=r(_d[6]);const l=['Near miss','Slip, trip or fall','Cut','Burn or scald','Manual handling','Struck by an object','Allergic reaction','Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days','Other'],p=['Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days'];let f=0;const u=e=>`${e}-${Date.now().toString(36)}${(f++).toString(36)}`,h=(e,t,i)=>({id:e,when:t,location:'',person:'',personType:'Staff',category:'Near miss',what:'',injury:'None',firstAid:'None needed',witnesses:'',reportedBy:'',reportedById:'',app:'staff',createdAt:`${t}:00`,...i});function y(){const e=new Date,t=(t,i)=>{const n=new Date(e);return n.setDate(n.getDate()-t),`${n.toISOString().slice(0,10)}T${i}`};return[h('acc-ex1',t(3,'19:40'),{location:'Kitchen pass',person:'Server (example)',category:'Near miss',what:'Example: water on the floor by the pass after the glass washer leaked. Nobody slipped.',firstAid:'None needed',witnesses:'Bar (example)',reportedBy:'Server (example)',reportedById:'st-4',app:'staff'}),h('acc-ex2',t(6,'12:15'),{location:'Kitchen: fryer section',person:'Head Chef (example)',category:'Burn or scald',what:'Example: splash of hot oil on the back of the hand while changing the basket.',injury:'Small burn, back of left hand',firstAid:'Cooled under running water for 20 minutes, sterile dressing',witnesses:'None',reportedBy:'Head Chef (example)',reportedById:'st-3',app:'chef'})]}function S(e){const t=({when:e,createdAt:t,...i})=>JSON.stringify(i);return y().some(i=>i.id===e.id&&t(i)===t(e))}function k(e){const t=Object.fromEntries(c.DEFAULT_POINTS.map(e=>[e.id,e])),i=new Set(['cp-prep','cp-bar','cp-freezer']);let n=e.map(e=>'cp-walkin'===e.id?{...e,archived:!0,due:[],aliases:[]}:i.has(e.id)?{...e,name:t[e.id].name,location:t[e.id].location,kind:t[e.id].kind,max:t[e.id].max,due:t[e.id].due,aliases:t[e.id].aliases,archived:!1}:e);const a=new Set(n.map(e=>e.id)),s=c.DEFAULT_POINTS.filter(e=>!a.has(e.id)),o=c.DEFAULT_POINTS.filter(e=>s.includes(e)&&('fridge'===e.kind||'freezer'===e.kind)),d=s.filter(e=>!o.includes(e));let l=-1;n.forEach((e,t)=>{'fridge'!==e.kind&&'freezer'!==e.kind||(l=t)}),n=[...n.slice(0,l+1),...o,...n.slice(l+1),...d];const p=n.filter(e=>'fridge'===e.kind||'freezer'===e.kind),f=[...p.filter(e=>'fridge'===e.kind),...p.filter(e=>'freezer'===e.kind)];let u=0;return n.map(e=>'fridge'===e.kind||'freezer'===e.kind?f[u++]:e)}const w=(0,o.create)()((0,d.persist)(e=>({points:c.DEFAULT_POINTS,entries:[],accidents:n.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:y(),probes:[],diary:[],daySigns:[],weekly:[],inspectorSends:[],logInspectorSend:t=>e(e=>({inspectorSends:[{...t,id:u('ins')},...e.inspectorSends??[]]})),addNote:t=>e(e=>({diary:[{...t,id:u('dn')},...e.diary??[]]})),signDay:t=>e(e=>({daySigns:[...(e.daySigns??[]).filter(e=>e.date!==t.date),t]})),signWeek:t=>e(e=>({weekly:[{...t,id:u('wk')},...(e.weekly??[]).filter(e=>e.week!==t.week)]})),addProbe:t=>e(e=>({probes:[...e.probes??[],{...t,id:u('pr'),status:'not-connected'}]})),removeProbe:t=>e(e=>({probes:(e.probes??[]).filter(e=>e.id!==t)})),addEntries:t=>e(e=>({entries:[...t.map(e=>({...e,id:`${u('hc')}${Math.random().toString(36).slice(2,7)}`})),...e.entries]})),setPoint:(t,i)=>e(e=>({points:e.points.map(e=>e.id===t?{...e,...i}:e)})),addPoint:t=>e(e=>({points:[...e.points,{...t,id:`${u('cp')}${Math.random().toString(36).slice(2,6)}`}]})),resetPoints:()=>e({points:c.DEFAULT_POINTS}),addAccident:t=>e(e=>({accidents:[{...t,id:u('acc'),createdAt:(new Date).toISOString()},...e.accidents]})),setRiddorNote:(t,i)=>e(e=>({accidents:e.accidents.map(e=>e.id===t?{...e,riddorNote:i}:e)}))}),{name:'covercharge-safety-v1',storage:(0,d.createJSONStorage)(()=>s.default),version:5,migrate:async(e,n)=>{if(t.LIVE_VENUE_BUILD&&e&&await(0,i.archiveChefCache)('safety',e),e&&n<2){const t=new Set((e.points??[]).map(e=>e.id));e.points=[...e.points??[],...c.DEFAULT_POINTS.filter(e=>!t.has(e.id))],e.diary=e.diary??[],e.daySigns=e.daySigns??[],e.weekly=e.weekly??[]}return e&&n<5&&(e.points=k(e.points??[])),t.LIVE_VENUE_BUILD&&e&&(e.accidents=(e.accidents||[]).filter(e=>!S(e))),e}}))},1178,[842,1196,5,1188,993,1189,1185]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"libraryRowId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"personRowId",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"tickId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"personKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"useDailyTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"tasksOf",{enumerable:!0,get:function(){return O}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]);const l=e=>(0,o.uuidFrom)(`daily-task-library:${e}`),y=(e,t)=>(0,o.uuidFrom)(`daily-tasks:${e}:${t}`),b=(e,t,i,s)=>(0,o.uuidFrom)(`daily-task-tick:${e}:${(0,u.tickKey)(t,i,s)}`),f=()=>(new Date).toISOString(),k=(e,t)=>`${e}|${t}`,p=e=>u.DEFAULT_LIBRARY.map((t,i)=>({id:(0,o.uuidFrom)(`daily-task-lib:${e}:${i}`),text:t})),L=(0,s.create)()((0,n.persist)((e,t)=>({library:{},people:{},ticks:[],ensure:i=>{t().library[i]||e(e=>({library:{...e.library,[i]:{items:p(i)}}}))},setLibrary:(t,i)=>e(e=>({library:{...e.library,[t]:{items:i,updatedAt:f()}}})),addLibrary:(e,i)=>{const s=(0,u.cleanTaskText)(i);if(!s)return;const n=t().library[e]?.items??p(e);n.some(e=>e.text.toLowerCase()===s.toLowerCase()&&!e.archived)||t().setLibrary(e,[...n,{id:(0,c.uuid)(),text:s}])},setTasks:(t,i,s)=>e(e=>({people:{...e.people,[k(t,i)]:{tasks:s,updatedAt:f()}}})),addTask:(e,i,s,n)=>{const o=(0,u.cleanTaskText)(s);if(!o)return;const l=t().people[k(e,i)]?.tasks??[];l.some(e=>e.text.toLowerCase()===o.toLowerCase())||t().setTasks(e,i,[...l,{id:(0,c.uuid)(),text:o,...n?{libraryId:n}:{}}])},toggleTick:(t,i,s,n,o)=>e(e=>{const u=b(t,i,s,n);if(e.ticks.some(e=>e.id===u))return{ticks:e.ticks.filter(e=>e.id!==u)};const c=new Date(Date.now()-12096e5).toISOString().slice(0,10);return{ticks:[...e.ticks.filter(e=>e.forDate>=c),{id:u,rid:t,staffRef:i,taskId:s,forDate:n,byRef:o.id,byName:o.name,at:f()}]}}),resetLibrary:e=>t().setLibrary(e,p(e))}),{name:'covercharge-daily-tasks-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)})),O=(e,t)=>L.getState().people[k(e,t)]?.tasks??[]},1179,[1188,993,1189,1177,1180,1097]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TASK_MAX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanTaskText",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"appliesOn",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tasksFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"tickKey",{enumerable:!0,get:function(){return u}}),e.progress=function(t,n,o,u,c){const s=i(t,c),f=new Set(n.filter(t=>t.staffRef===o&&t.forDate===u).map(t=>t.taskId));return{done:s.filter(t=>f.has(t.id)).length,total:s.length}},e.move=function(t,n,o){const i=n+o;if(n<0||i<0||n>=t.length||i>=t.length)return t;const u=[...t];return[u[n],u[i]]=[u[i],u[n]],u},Object.defineProperty(e,"hasTask",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_LIBRARY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TASK_DAY_NAMES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isHeadChefP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isKitchenP",{enumerable:!0,get:function(){return d}}),e.canEditTasks=function(t,n){return!!t&&('owner'===t.role||'manager'===t.role||!!l(t)&&(t.id!==n.id&&'staff'===n.role&&!l(n)&&d(n)))};const t=80,n=n=>n.replace(/\s+/g,' ').trim().slice(0,t),o=(t,n)=>!t.days||0===t.days.length||t.days.includes(n),i=(t,n)=>t.filter(t=>o(t,n)),u=(t,n,o)=>`${t}|${n}|${o}`;const c=(t,o)=>t.some(t=>t.text.toLowerCase()===n(o).toLowerCase()),s=['Restock the bar fridges','Wipe down the menus','Check the toilets','Set the tables','Polish glasses','Empty the bins','Clean the coffee machine','Take out the recycling'],f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=t=>'staff'===t.role&&('Head Chef'===t.level||/^head chef/i.test(t.job??'')),d=t=>'kitchen'===(t.dept??'').trim().toLowerCase()},1180,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LEGAL_LIMIT_MINS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_BREAK_RULES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"REMINDER_WINDOW_MINS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CHAIRS_TEXT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ANCHORAGE_CHAIRS_DAYS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultChairs",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AUDIENCE_LABEL",{enumerable:!0,get:function(){return s}}),e.clampRules=c,Object.defineProperty(e,"validTime",{enumerable:!0,get:function(){return d}}),e.ukClock=l,e.reminderDue=function(t,n){const i=l(n);if(t.paused||!d(t.time)||!t.days.includes(i.dow))return{due:!1,forDate:i.ymd};const o=f(t.time);return{due:i.mins>=o&&i.mins=t.shiftEnd))return null;const r=b(t).filter(n=>n.at<=t.now),i=r.length?r[r.length-1]:null;if(!i)return null;if(t.nowr?i:null}return i};const t=360,n={on:!0,afterMins:240,repeatMins:30,snoozeMins:15},r=180,i='Time to put the chairs up on the tables',o=[4,0],a=(t,n)=>'anchorage'===n?{id:t,text:i,days:[...o],time:'21:00',audience:'all',builtIn:'chairs',push:!0}:{id:t,text:i,days:[5,0],time:'21:00',audience:'all',builtIn:'chairs'},u=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],s={all:'Everyone on shift',foh:'Front of house',kitchen:'Kitchen'};function c(r){const i=(t,n,r,i)=>{const o=Math.round(Number(t));return Number.isFinite(o)?Math.min(i,Math.max(r,o)):n};return{on:!1!==r.on,afterMins:i(r.afterMins,n.afterMins,30,t),repeatMins:i(r.repeatMins,n.repeatMins,5,120),snoozeMins:i(r.snoozeMins,n.snoozeMins,5,60)}}const d=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t);function l(t){const n='number'==typeof t?new Date(t):t,r=Object.fromEntries(new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(n).map(t=>[t.type,t.value]));return{dow:u.indexOf(String(r.weekday).slice(0,3)),mins:60*Number(r.hour)+Number(r.minute),ymd:`${r.year}-${r.month}-${r.day}`}}const f=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));const m=(t,n)=>'all'===t||('kitchen'===t?n:!n);function b(t){const n=c(t.rules),r=t.clockIn??t.shiftStart;if(!n.on||void 0===r||t.hadBreak)return[];const i=r+216e5,o=Math.min(void 0!==t.rotaBreak&&t.rotaBreak>r?t.rotaBreak:r+6e4*n.afterMins,i),a=[{stage:1,at:o,label:void 0!==t.rotaBreak&&t.rotaBreak>r&&t.rotaBreak<=i?'Your break on the rota is now.':'Time for your break.'}],u=o+6e4*n.repeatMins;return a.push({stage:2,at:u,label:'Reminder: you haven\u2019t had your break yet.'}),i>u&&a.push({stage:3,at:i,label:'You\u2019ve worked 6 hours without a break. You need a 20-minute break (UK law).'}),a}},1181,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1182,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1183,[31,1079,1184,1390,1182]); +__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1184,[1188,993,1189]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"KIND_LABEL",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TEMP_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"isTempKind",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"SECTIONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"SECTION_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"sectionOf",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"initialsOf",{enumerable:!0,get:function(){return l}}),_e.unitAliases=u,Object.defineProperty(_e,"DEFAULT_POINTS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"limitText",{enumerable:!0,get:function(){return f}}),_e.inRange=p,_e.spokenNumber=y,_e.parseQuick=function(e,n){const r=n.filter(e=>!e.archived);return e.split(/[,;\n]+|\s+and\s+|\.\s+/i).map(e=>e.trim()).filter(Boolean).map(e=>{const n=e.toLowerCase().replace(/[\u2010\u2013]/g,'-').replace(/-(?!\d)/g,' '),o=` ${n.replace(/[^a-z0-9.\- ]/g,' ').replace(/\s+/g,' ')} `;let a,s=0,l='';for(const e of r)for(const n of[e.name.toLowerCase(),...e.aliases]){const t=n.replace(/-/g,' ').replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim();t&&o.includes(` ${t} `)&&t.length>s&&(a=e,s=t.length,l=t)}const c=y(l?n.replace(new RegExp(`(^|[^a-z0-9])${l.split(' ').map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&')).join('[^a-z0-9]+')}(?=$|[^a-z0-9])`),'$1 '):n);return/ (walk ?in|cold room) /.test(o)&&!/(walk|cold room)/.test(l)?{text:e,value:null,problem:'The walk-in is a dry store, not on the temperature log. Pick a fridge or freezer below.'}:a?t(a.kind)?null==c?{text:e,point:a,value:null,problem:'No temperature heard \u2014 type it in.'}:{text:e,point:a,value:c}:{text:e,point:a,value:null}:{text:e,value:c,problem:'Not sure which check this is \u2014 pick it below or type it.'}})},_e.missedChecks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const s of e){if(s.archived)continue;const e=s.due.filter(e=>k(e)<=o);if(!e.length)continue;const l=e[e.length-1],c=r.getTime()+6e4*k(e[0])-108e5,d=n.filter(e=>e.pointId===s.id&&new Date(e.at).getTime()>=c&&new Date(e.at).getTime()<=t.getTime()),u=e.length;d.lengthe.map(w).join(',')).join('\r\n')+'\r\n'},Object.defineProperty(_e,"SLOTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"SLOT_LABEL",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"SLOT_HINT",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"slotOf",{enumerable:!0,get:function(){return $}}),_e.todayTasks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const s of e){const e=s.archived?[]:[...s.due].sort();if(!e.length)continue;const l=r.getTime()+6e4*k(e[0])-108e5,c=n.filter(e=>e.pointId===s.id&&new Date(e.at).getTime()>=l&&new Date(e.at).getTime()<=t.getTime()).reverse().sort((e,n)=>e.at.localeCompare(n.at));e.forEach((e,n)=>{const t=c[n],r=k(e),l=t?'done':o>=r?'overdue':o>=r-60?'due':'upcoming';a.push({key:`${s.id}@${e}`,point:s,due:e,slot:$(e),status:l,entry:t})})}return a.sort((e,n)=>e.due.localeCompare(n.due)||e.point.name.localeCompare(n.point.name))},_e.unitStatus=function(e,n,t){const r=n.filter(n=>n.pointId===e.id&&null!=n.value).reverse().sort((e,n)=>e.at.localeCompare(n.at)),o=r[r.length-1];if(!o)return{rag:'none',history:r,why:'No readings yet'};const a=o.value;if(!p(e,a))return{rag:'red',latest:o,history:r,why:'Out of range'};const s=new Date(t);if(s.setHours(0,0,0,0),new Date(o.at).getTime()e.max-1||null!=e.min&&an.includes(e),r=['cross','cleaning','chilling','cooking','management'],o={cross:'Cross-contamination & allergens',cleaning:'Cleaning',chilling:'Chilled storage & cooling',cooking:'Cooking, reheating & hot holding',management:'Management & records'},a={fridge:'chilling',freezer:'chilling',cool:'chilling',delivery:'chilling',cook:'cooking',hothold:'cooking',cleaning:'cleaning',allergen:'cross',check:'management'},s=e=>e.section??a[e.kind],l=e=>e.replace(' (example)','').split(/\s+/).filter(Boolean).map(e=>e[0]).join('').slice(0,3).toUpperCase(),c={1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten'},d={1:'first',2:'second',3:'third',4:'fourth',5:'fifth',6:'sixth',7:'seventh',8:'eighth',9:'ninth',10:'tenth'};function u(e,n){const t=e.trim().toLowerCase().replace(/\s+/g,' ');if(!t)return[];const r=(n??'').trim().toLowerCase(),o=t.replace(/^(downstairs|upstairs|kitchen|cellar|basement|back|front|bar)\s+/,'').replace(r&&t.startsWith(r+' ')?new RegExp('^'+r.replace(/[.*+?^${}()|[\]\\]/g,'\\$&')+'\\s+'):/^$/,''),a=new Set([t,o]);for(const e of[t,o]){const n=e.match(/^(.*\S)\s+(\d{1,2})$/);n&&c[n[2]]&&(a.add(`${n[1]} ${c[n[2]]}`),a.add(`${n[1]} number ${n[2]}`),e!==o||/\s/.test(n[1])||a.add(`${d[n[2]]} ${n[1]}`))}return[...a].filter(Boolean)}const m=[{id:'cp-walkin',name:'Walk-in fridge',kind:'fridge',max:5,due:[],aliases:[],archived:!0},{id:'cp-prep',name:'Downstairs fridge 1',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 1')},{id:'cp-bar',name:'Downstairs fridge 2',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 2')},{id:'cp-fridge3',name:'Downstairs fridge 3',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 3')},{id:'cp-fridge4',name:'Upstairs fridge 4',location:'Upstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Upstairs fridge 4')},{id:'cp-freezer',name:'Downstairs freezer 1',location:'Downstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Downstairs freezer 1')},{id:'cp-freezer2',name:'Upstairs freezer 2',location:'Upstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Upstairs freezer 2')},{id:'cp-freezer3',name:'Upstairs freezer 3',location:'Upstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Upstairs freezer 3')},{id:'cp-cook',name:'Cooking: core temperature',kind:'cook',min:75,due:[],aliases:['core','cook','cooking','probe']},{id:'cp-cool',name:'Cooling: within 90 minutes',kind:'cool',max:8,due:[],aliases:['cooling','cool']},{id:'cp-hothold',name:'Hot hold: bain-marie',kind:'hothold',min:63,due:['18:00'],aliases:['hot hold','bain marie','bain-marie','hothold']},{id:'cp-del-chill',name:'Delivery: chilled',kind:'delivery',max:8,due:[],aliases:['chilled delivery','delivery chilled','delivery']},{id:'cp-del-frozen',name:'Delivery: frozen',kind:'delivery',max:-15,due:[],aliases:['frozen delivery','delivery frozen']},{id:'cp-clean',name:'Close-down clean signed off',kind:'cleaning',due:['23:00'],aliases:['cleaning','clean down','close down']},{id:'cp-allergen',name:'Allergen matrix checked against today\u2019s specials',kind:'allergen',due:['11:00'],aliases:['allergen','allergens']},{id:'cp-open-equip',name:'Fridges, freezers and other equipment working',kind:'check',section:'management',due:['09:00'],aliases:['equipment']},{id:'cp-open-staff',name:'Staff fit for work, in clean work clothes',kind:'check',section:'management',due:['09:00'],aliases:['staff fit']},{id:'cp-open-surfaces',name:'Prep areas, surfaces and utensils clean and disinfected',kind:'cleaning',due:['09:00'],aliases:['surfaces','prep areas']},{id:'cp-open-pests',name:'No signs of pests',kind:'check',section:'cleaning',due:['09:00'],aliases:['pests','pest']},{id:'cp-open-hands',name:'Hand-wash basins: hot water, soap and paper towels',kind:'check',section:'cross',due:['09:00'],aliases:['hand wash','handwash','soap']},{id:'cp-open-probe',name:'Probe thermometer working, probe wipes available',kind:'check',section:'management',due:['09:00'],aliases:['probe wipes','thermometer']},{id:'cp-mid-boards',name:'Raw and ready-to-eat kept apart; colour-coded boards in use',kind:'check',section:'cross',due:['12:00'],aliases:['boards','raw and ready to eat']},{id:'cp-close-stored',name:'Food covered, labelled, dated and put away',kind:'check',section:'chilling',due:['22:00'],aliases:['labelled','covered']},{id:'cp-close-useby',name:'Food past its use-by date thrown away',kind:'check',section:'chilling',due:['22:00'],aliases:['use by','use-by']},{id:'cp-close-waste',name:'Waste removed and bins relined',kind:'check',section:'cleaning',due:['22:00'],aliases:['waste','bins']}],f=e=>null!=e.min&&null!=e.max?`${e.min}\xb0C to ${e.max}\xb0C`:null!=e.max?`${e.max}\xb0C or colder`:null!=e.min?`${e.min}\xb0C or hotter`:'Done / not done';function p(e,n){return(null==e.min||n>=e.min)&&(null==e.max||n<=e.max)}const h={zero:0,nought:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90};function y(e){const n=e.toLowerCase().replace(/\u2212/g,'-').replace(/degrees?|\xb0c?|celsius|centigrade/g,' '),t=/\b(minus|negative)\b/.test(n),r=n.match(/-?\d+(?:[.,]\d+)?/);if(r){const e=Number(r[0].replace(',','.'));return t&&e>0?-e:e}const o=n.split(/[^a-z]+/).filter(Boolean);let a=null,s=null,l=!1;for(const e of o)if('point'!==e){if(e in h){if(l){s=h[e];break}a=(a??0)+h[e]}}else l=!0;if(null==a)return null;const c=null!=s?Number(`${a}.${s}`):a;return t?-c:c}const k=e=>{const[n,t]=e.split(':').map(Number);return 60*n+t};const b=e=>null!=e.value?`${e.value}\xb0C`:e.done?'Done':'Not done',w=e=>{const n=null==e?'':String(e);return/[",\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n},v=['Date','Time','Check','Type','Reading','Safe limit','Result','Corrective action','Note','Recorded by','Entry'];function D(n,t){return n.map(n=>{const r=new Date(n.at),o=t.find(e=>e.id===n.pointId);return[r.toLocaleDateString('en-GB'),r.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),n.name,e[n.kind],b(n),o?f(o):'',n.ok?'OK':'OUT OF RANGE',n.corrective??'',n.note??'',n.by,'probe'===n.source?'Wireless probe':'voice'===n.source?'Voice (confirmed)':'Typed']})}const O=['opening','midday','closing'],x={opening:'Opening',midday:'Midday',closing:'Closing'},C={opening:'until 11:00',midday:'11:00 to 16:00',closing:'from 16:00'},$=e=>{const n=k(e);return n<660?'opening':n<960?'midday':'closing'};const z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,T=['Opening and closing checks were done every day (or the reason is in the diary)','Every out-of-range reading has a corrective action','Probe thermometers checked (iced water / boiling water) this week','Allergen information is up to date for menu and special changes','Cleaning schedule followed; no signs of pests','Staff trained on any changed safe methods']},1185,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setMenuCardBridge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"menuCardBridge",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveItem",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveMenu",{enumerable:!0,get:function(){return m}}),e.sortMenu=c;var t=r(d[0]);let n=null;const o=t=>{n=t},u=()=>n,i=o=>(0,t.overlayItem)(o,n?.cardFor(o.id)),m=t=>c(t.map(i));function c(t){return t.some(t=>'number'==typeof t.sort)?t.map((t,n)=>({m:t,i:n,k:'number'==typeof t.sort?t.sort:10*n})).sort((t,n)=>t.k-n.k||t.i-n.i).map(t=>t.m):t}},1186,[1177]); +__d(function(_g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nextTablesFree=function(t,r,o,l,u=[]){const m=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,f=(0,a.lastFoodOn)(t,m),d=f?new Date(`${m}T${f.time}:00`):null,b=t=>o.filter(a=>a.date===m&&'confirmed'===a.status&&(a.table??'').split('+').map(t=>t.trim()).includes(t)).map(t=>new Date(`${t.date}T${t.time}:00`)).filter(t=>t>=s(l,-20)).sort((t,a)=>t.getTime()-a.getTime())[0],c=[],g=[];for(const o of Object.values(r)){const r=o.table.name,m=b(r);if('free'===o.status){(!m||m>s(l,60))&&c.push(r);continue}if(!n.includes(o.status)||!o.booking)continue;const f=o.booking,h=f.seatedAt?new Date(f.seatedAt):new Date(`${f.date}T${f.time}:00`),$=(0,a.dwellFor)(t,f.partySize,u);let w=s(h,$.mins),T='maybe',p=`seated ${Math.max(0,Math.round((l.getTime()-h.getTime())/6e4))} min, usual ${$.mins} min`;'bill'===o.status?(w=s(l,10),T='likely',p='bill requested'):'dessert'===o.status?(w=new Date(Math.min(w.getTime(),s(l,25).getTime())),T='likely',p='on dessert'):'mains'===o.status&&(w=new Date(Math.min(Math.max(w.getTime(),s(l,35).getTime()),s(l,60).getTime())),p='mains out'),w=d?{drinksOnly:!0}:{}})}g.sort((t,a)=>t.at.getTime()-a.at.getTime());const h=Object.values(r).filter(t=>'blocked'!==t.status).length,$=h>0&&c.length<=Math.max(1,Math.round(.1*h));return{full:$,freeNow:c,list:g,waitFor:t=>g.find(a=>a.seats>=t)??null}},Object.defineProperty(e,"hhmm",{enumerable:!0,get:function(){return r}}),e.nextFreeSentence=function(a,n){if(a.freeNow.length&&!a.full)return`There are ${a.freeNow.length} tables free now: ${a.freeNow.slice(0,4).map(t=>`table ${t}`).join(', ')}.`;const s=a.list[0];if(!s)return a.freeNow.length?`${(0,t.tableNumbers)(a.freeNow[0])} is free now.`:'No table is due to free up before the bookings that follow; check the bookings list.';const o=Math.max(5,Math.round((s.at.getTime()-n.getTime())/6e4)),l=a.waitFor(2),u=a.waitFor(4);return`Next table free about ${r(s.at)} (table ${s.table}, ${s.seats} seats), ${s.confidence}, in about ${o} minutes.${l?` A table for 2: about ${r(l.at)}.`:''}${u?` A table for 4: about ${r(u.at)}.`:''}${s.drinksOnly?' That\u2019s after last food orders, so drinks only.':''}`};var t=_r(_d[0]),a=_r(_d[1]);const n=['seated','mains','dessert','bill'],s=(t,a)=>new Date(t.getTime()+6e4*a);const r=t=>`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},1187,[812,814]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),f={getItem:e=>u.default.getItem((0,n.venueKey)(e)),setItem:(e,t)=>u.default.setItem((0,n.venueKey)(e),t),removeItem:e=>u.default.removeItem((0,n.venueKey)(e))}},1188,[1197,5]); +__d(function(g,_r,i,_a3,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"combine",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"createJSONStorage",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"devtools",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"persist",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"redux",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"subscribeWithSelector",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"unstable_ssrSafe",{enumerable:!0,get:function(){return S}});const e=(e,t)=>(n,r,o)=>(o.dispatch=t=>(n(n=>e(n,t),!1,t),t),o.dispatchFromDevtools=!0,{dispatch:(...e)=>o.dispatch(...e),...t}),t=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,n=new Map,r=e=>{const t=n.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},o=(e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const o=n.get(r.name);if(o)return{type:"tracked",store:e,...o};const s={connection:t.connect(r),stores:{}};return n.set(r.name,s),{type:"tracked",store:e,...s}},s=(e,t,r)=>{if(void 0===t)return;const o=n.get(e);(null==o?void 0:o.stores[t])===r&&(delete o.stores[t],0===Object.keys(o.stores).length&&n.delete(e))},a=/^at (?:new |async )?(.+?) \(/,l=/^([^@]+)@/;function c(e){var t,n,r;if(!e)return;const o=e.split("\n"),s=o.findIndex(e=>e.includes("api.setState"));if(s<0)return;const c=(null==(t=o[s+1])?void 0:t.trim())||"";return(null==(n=a.exec(c))?void 0:n[1])||(null==(r=l.exec(c))?void 0:r[1])}const u=(e,a={})=>(l,u,p)=>{const{enabled:f,anonymousActionType:y,store:h,...b}=a;let S;try{S=(null!=f?f:"production"!==(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0))&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!S)return e(l,u,p);const{connection:O,..._}=o(h,S,b);let w,E=!0;p.setState=(e,t,n)=>{const o=l(e,t);if(!E)return o;const s=void 0===n?{type:y||c((new Error).stack)||"anonymous"}:"string"==typeof n?{type:n}:n;return void 0===h?(null==O||O.send(s,u()),o):(null==O||O.send({...s,type:`${h}/${s.type}`},{...r(b.name),[h]:p.getState()}),o)},p.devtools={cleanup:()=>{null==w||w(),w=void 0,s(b.name,h,p),void 0!==h&&n.has(b.name)||!O||"function"!=typeof O.unsubscribe||O.unsubscribe()}};const I=(...e)=>{const t=E;E=!1,l(...e),E=t},j=e(p.setState,u,p);if("untracked"===_.type?null==O||O.init(j):(_.stores[_.store]=p,null==O||O.init(Object.fromEntries(Object.entries(_.stores).map(([e,t])=>[e,e===_.store?j:t.getState()])))),t(p)){let e=!1;const t=p.dispatch;p.dispatch=(...n)=>{"production"===(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0)||"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return w=O.subscribe(e=>{var n;const o="object"==typeof b.serialize?b.serialize.reviver:void 0;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):v(e.payload,o,e=>{if("__setState"===e.type){if(void 0===h)return void I(e.state);1!==Object.keys(e.state).length&&console.error("\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");const t=e.state[h];if(null==t)return;return void(JSON.stringify(p.getState())!==JSON.stringify(t)&&I(t))}t(p)&&p.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return I(j),void 0===h?null==O?void 0:O.init(p.getState()):null==O?void 0:O.init(r(b.name));case"COMMIT":return void 0===h?void(null==O||O.init(p.getState())):null==O?void 0:O.init(r(b.name));case"ROLLBACK":return v(e.state,o,e=>{if(void 0===h)return I(e),void(null==O||O.init(p.getState()));I(e[h]),null==O||O.init(r(b.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return v(e.state,o,e=>{void 0!==h?JSON.stringify(p.getState())!==JSON.stringify(e[h])&&I(e[h]):I(e)});case"IMPORT_STATE":{const{nextLiftedState:t}=e.payload,r=null==(n=t.computedStates.slice(-1)[0])?void 0:n.state;if(!r)return;return I(void 0===h?r:r[h]),void(null==O||O.send(null,t))}case"PAUSE_RECORDING":return E=!E}return}}),j},v=(e,t,n)=>{let r;try{r=JSON.parse(e,t)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&n(r)},p=e=>(t,n,r)=>{const o=r.subscribe;r.subscribe=(e,t,n)=>{let s=e;if(t){const o=(null==n?void 0:n.equalityFn)||Object.is;let a=e(r.getState());s=n=>{const r=e(n);if(!o(a,r)){const e=a;t(a=r,e)}},(null==n?void 0:n.fireImmediately)&&t(a,a)}return o(s)};return e(t,n,r)};function f(e,t){return(...n)=>Object.assign({},e,t(...n))}function y(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var r;const o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),s=null!=(r=n.getItem(e))?r:null;return s instanceof Promise?s.then(o):o(s)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const h=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>h(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>h(t)(e)}}},b=(e,t)=>(n,r,o)=>{let s={storage:y(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},a=!1,l=0;const c=new Set,u=new Set;let v=s.storage;if(!v)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...e)},r,o);const p=()=>{const e=s.partialize({...r()});return v.setItem(s.name,{state:e,version:s.version})},f=o.setState;o.setState=(...e)=>(f(...e),p());const b=e((...e)=>(n(...e),p()),r,o);let S;o.getInitialState=()=>b;const O=()=>{var e,t;if(!v)return;const o=++l;a=!1,c.forEach(e=>{var t;return e(null!=(t=r())?t:b)});const f=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=r())?e:b))||void 0;return h(v.getItem.bind(v))(s.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];if(s.migrate){const t=s.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(o!==l)return;const[a,c]=e;return S=s.merge(c,null!=(t=r())?t:b),n(S,!0),a?p():void 0}).then(()=>{o===l&&(null==f||f(r(),void 0),S=r(),a=!0,u.forEach(e=>e(S)))}).catch(e=>{o===l&&(null==f||f(void 0,e))})};return o.persist={setOptions:e=>{s={...s,...e},e.storage&&(v=e.storage)},clearStorage:()=>{++l,null==v||v.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>O(),hasHydrated:()=>a,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},s.skipHydration||O(),S||b};function S(e,t="undefined"==typeof window){return(n,r,o)=>{if(!t)return e(n,r,o);const s=()=>{throw new Error("Cannot set state of Zustand store in SSR")};return o.setState=s,e(s,r,o)}}},1189,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useKitchenExtra",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isManagerish",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isKitchenStaff",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"kitchenByRule",{enumerable:!0,get:function(){return l}}),_e.inKitchen=b,_e.inChannel=function(e,t){return!!t&&(e.startsWith('dm:')?e.split(':').slice(1).includes(t.id):'all'===e||('kitchen'===e?b(t):'managers'===e?o(t):'foh'===e&&(o(t)||/front|bar|server|waiting/i.test(t.job))))},Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return h}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},c=r(d[1]),a=r(d[2]);const u=(0,c.create)()((0,a.persist)(e=>({extra:{},set:(t,n)=>e(e=>{const c={...e.extra};return null==n?delete c[t]:c[t]=n,{extra:c}})}),{name:'covercharge-kitchen-chat-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default)})),o=e=>!!e&&'staff'!==e.role,s=e=>!!e&&/head chef/i.test((e.level??'')+' '+e.job),f=e=>!!e&&(/^kitchen$/i.test(e.dept??'')||/chef|kitchen|\bkp\b|porter/i.test(e.job)),l=e=>!!e&&(o(e)||s(e)||f(e));function b(e){if(!e||!e.active)return!1;return u.getState().extra[e.id]??l(e)}const h=(e,t)=>`dm:${[e,t].sort().join(':')}`},1190,[1188,993,1189]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_PALETTE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_DISPLAY",{enumerable:!0,get:function(){return o}});const t={bg:'#1A1A1A',surface:'#222222',surface2:'#292929',border:'#62675E',gold:'#7DB754',goldLight:'#AED28E',goldTint:'#25321E',goldMuted:'#A1C783',tile:'#222222',tilePressed:'#2D3428',accentBg:'rgba(125,183,84,0.13)',accentBorder:'rgba(125,183,84,0.55)',onGold:'#1A1A1A',ok:'#AED28E',okBg:'#25321E',blue:'#AED28E',blueBg:'#25321E'},o={quietBorder:'rgba(125,183,84,0.55)',quietPressed:'rgba(125,183,84,0.16)',primaryPressed:'#6D9F49'}},1191,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_LOCATION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WILDINGS_ADDRESS",{enumerable:!0,get:function(){return t}}),e.withWildingsAddress=function(r){return'wildings'===r.id?{...r,location:n,address:t}:r},e.withWildingsQuestionnaireAddress=function(n,r){return'wildings'===n&&r?{...r,venue:{...r.venue,address:t}}:r};const n='Maidens, KA26 9NR',t='Maidens Road, Maidens, KA26 9NR'},1192,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.sampleFingerprint=i,e.stripOwnerLiveSamples=function(n){const a={};for(const[s,o]of Object.entries(t.OWNER_SAMPLE_HASHES)){const t=n[s]||[];a[s]=t.filter(t=>!o.includes(i(t)))}a.chat=(n.chat||[]).filter(t=>!(0,s.isSeedChefChat)(t));const o=(n.changeRequests||[]).length-a.changeRequests.length;o&&(a.changesUsed=Math.max(0,(n.changesUsed||0)-o));return a},e.stripCoreLiveSamples=function(a){const c={...(0,n.stripCoreChefSamples)(a)};c.giftCards=(a.giftCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.giftCards.includes(i(s))),c.stampCards=(a.stampCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.stampCards.includes(i(s))),c.ratings=(a.ratings||[]).filter(t=>!(/^rt-[123]$/.test(t.id)&&(0,s.demoActor)(t.customerName))),i(a.customer)===t.LEGACY_CUSTOMER_HASH&&(c.customer={...a.customer,id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}});return c.restaurants=(a.restaurants||[]).filter(t=>!('saltmarsh'===t.id&&['The Venue','Saltmarsh Bistro'].includes(t.name))),c.menu=(c.menu||a.menu||[]).filter(t=>'saltmarsh'!==t.restaurantId).map(t=>t.signOff?t:o(t)),c};var t=r(d[0]),s=r(d[1]),n=r(d[2]);const a=t=>Array.isArray(t)?t.map(a):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([,t])=>void 0!==t&&'function'!=typeof t).sort(([t],[s])=>ts?1:0).map(([t,s])=>[t,a(s)])):t;function i(t){const s=JSON.stringify(a(t))??"null";let n=2166136261;for(let t=0;t>>0).toString(16)}const o=t=>Array.isArray(t)?t.map(o):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).map(([t,s])=>[t,'allergenNotes'===t&&'string'==typeof s&&/\(example\)/i.test(s)?'':o(s)])):t},1193,[1194,1082,1195]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"OWNER_SAMPLE_HASHES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CORE_SAMPLE_HASHES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"LEGACY_CUSTOMER_HASH",{enumerable:!0,get:function(){return b}});const c={referrals:["43f09bc0","c438fbad","96bf8c62","3399d421"],coats:["f51097ad","2f7efa3a"],merch:["ef6e14e","dbbc0999","dc233c1d"],merchOrders:["13b15512","bc27f242"],offers:["ad0fcde0","59e6c0cf"],photos:["53a60fd9","ab778a74","95de43cd"],changeRequests:["81c5be12","6819542c"],lost:["5bbf0d77","7d3aa9ed","850c049e"],campaigns:["9cdf8346","82150e7"],suppliers:["41df06e7","466e32ac","fa3d8eea","dfafa674","1e26fbd0","c195b120","5fc49e74","6aa8b0af","602fc2e4"],supplierOrders:["22636226","464d6a6a"]},f={giftCards:["b1bba36d","f029bc0e"],stampCards:["e7bedf6f","a3c8404d"]},b="4b1e9971"},1194,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.stripCoreChefSamples=function(n){return{bookings:(n.bookings||[]).filter(n=>!((0,e.isAnchorage)(n.restaurantId)&&t[n.id]===n.name)),orders:(n.orders||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('ord-seed-1'===t.id&&'R. Gilmour'===t.customerName||'ord-seed-2'===t.id&&'Table 3 guest'===t.customerName))),waitlist:(n.waitlist||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('wl-1'===t.id&&'Paterson'===t.name||'wl-2'===t.id&&'Duncan'===t.name))),menu:(n.menu||[]).map(t=>(0,e.isAnchorage)(t.restaurantId)&&(0,e.demoActor)(t.signOff?.by)?{...t,signOff:null}:t),events:(n.events||[]).filter(e=>!(e.example&&('anchorage'===e.restaurantId||null===e.restaurantId))),audit:(n.audit||[]).filter(e=>!('anchorage'===e.restaurantId&&/Example sign-off \(demo\)/i.test(e.text)))}};var e=r(d[0]);const t={'bk-101':'Campbell','bk-102':'Fraser','bk-103':'McLeod','bk-104':'Kerr','bk-105':'Wallace','bk-106':'Boyd','bk-107':'Hamilton','bk-108':'Stewart','bk-109':'Murray'}},1195,[1082]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.archiveChefCache=async function(e,t){const n=JSON.stringify(t);let o=2166136261;for(let e=0;e>>0).toString(16)}`;const c=await i.default.getItem(s);if(c){if(JSON.stringify(JSON.parse(c).rows)===n)return;s+=`:${Date.now()}`}await i.default.setItem(s,JSON.stringify({at:(new Date).toISOString(),store:e,rows:t}))};var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e}},1196,[1188]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAsyncStorage",{enumerable:!0,get:function(){return n.useAsyncStorage}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=u.default},1197,[1198,1202]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return i}});var e,t=r(d[0]);const o=((e=t)&&e.__esModule?e:{default:e}).default.bind({concatArrays:!0,ignoreUndefined:!0});function n(e,t){const n=window.localStorage.getItem(e);if(n){const l=JSON.parse(n),c=JSON.parse(t),s=JSON.stringify(o(l,c));window.localStorage.setItem(e,s)}else window.localStorage.setItem(e,t)}function l(e,t){return new Promise((o,n)=>{try{const n=e();t?.(null,n),o(n)}catch(e){t?.(e),n(e)}})}function c(e,t,o){return Promise.all(e).then(e=>{const n=o?.(e)??null;return t?.(null,n),Promise.resolve(n)},e=>(t?.(e),Promise.reject(e)))}const s={getItem:(e,t)=>l(()=>window.localStorage.getItem(e),t),setItem:(e,t,o)=>l(()=>window.localStorage.setItem(e,t),o),removeItem:(e,t)=>l(()=>window.localStorage.removeItem(e),t),mergeItem:(e,t,o)=>l(()=>n(e,t),o),clear:e=>l(()=>window.localStorage.clear(),e),getAllKeys:e=>l(()=>{const e=window.localStorage.length,t=[];for(let o=0;o{},multiGet:(e,t)=>c(e.map(e=>s.getItem(e)),t,t=>t.map((t,o)=>[e[o],t])),multiSet:(e,t)=>c(e.map(e=>s.setItem(e[0],e[1])),t),multiRemove:(e,t)=>c(e.map(e=>s.removeItem(e)),t),multiMerge:(e,t)=>c(e.map(e=>s.mergeItem(e[0],e[1])),t)};var i=s},1198,[1199]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},1199,[1200]); +__d(function(g,r,i,a,m,e,d){'use strict';const t=r(d[0]),{hasOwnProperty:n}=Object.prototype,{propertyIsEnumerable:o}=Object,c=(t,n,o)=>Object.defineProperty(t,n,{value:o,writable:!0,enumerable:!0,configurable:!0}),s=this,f={concatArrays:!1,ignoreUndefined:!1},l=t=>{const c=[];for(const o in t)n.call(t,o)&&c.push(o);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(t);for(const s of n)o.call(t,s)&&c.push(s)}return c};function u(n){return Array.isArray(n)?y(n):t(n)?p(n):n}function y(t){const n=t.slice(0,0);return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}function p(t){const n=null===Object.getPrototypeOf(t)?Object.create(null):{};return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}const b=(t,n,o,s)=>(o.forEach(o=>{void 0===n[o]&&s.ignoreUndefined||(o in t&&t[o]!==Object.getPrototypeOf(t)?c(t,o,h(t[o],n[o],s)):c(t,o,u(n[o])))}),t),O=(t,o,s)=>{let f=t.slice(0,0),y=0;return[t,o].forEach(o=>{const p=[];for(let s=0;s!p.includes(t)),s)}),f};function h(n,o,c){return c.concatArrays&&Array.isArray(n)&&Array.isArray(o)?O(n,o,c):t(o)&&t(n)?b(n,o,l(o),c):u(o)}m.exports=function(...n){const o=h(u(f),this!==s&&this||{},f);let c={_:{}};for(const s of n)if(void 0!==s){if(!t(s))throw new TypeError('`'+s+'` is not an Option Object');c=h(c,{_:s},o)}return c._}},1200,[1201]); +__d(function(g,r,i,a,m,e,d){'use strict';m.exports=t=>{if('[object Object]'!==Object.prototype.toString.call(t))return!1;const o=Object.getPrototypeOf(t);return null===o||o===Object.prototype}},1201,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAsyncStorage=function(e){return{getItem:(...t)=>u.default.getItem(e,...t),setItem:(...t)=>u.default.setItem(e,...t),mergeItem:(...t)=>u.default.mergeItem(e,...t),removeItem:(...t)=>u.default.removeItem(e,...t)}};var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1202,[1198]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"createStore",{enumerable:!0,get:function(){return n}});const t=t=>{let n;const c=new Set,o=(t,o)=>{const s="function"==typeof t?t(n):t;if(!Object.is(s,n)){const t=n;n=(null!=o?o:"object"!=typeof s||null===s)?s:Object.assign({},n,s),c.forEach(c=>c(n,t))}},s=()=>n,u={setState:o,getState:s,getInitialState:()=>l,subscribe:t=>(c.add(t),()=>c.delete(t))},l=n=t(o,s,u);return u},n=n=>n?t(n):t},1203,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"create",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=r(d[1]);const c=e=>e;function o(e,t=c){const u=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return n.default.useDebugValue(u),u}const s=e=>{const t=(0,u.createStore)(e),n=e=>o(t,e);return Object.assign(n,t),n},l=e=>e?s(e):s},1204,[31,1203]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return p}}),_e.defaultSimStart=function(e=new Date){const t=new Date(e),r=(5-t.getDay()+7)%7;return t.setDate(t.getDate()+r),t.setHours(17,30,0,0),t},_e.buildSeed=function(u){if(r.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE){const e=I(u);return{...e,restaurants:e.restaurants.filter(e=>'anchorage'===e.id),menu:c.anchorageMenu.map(e=>({...e,signOff:null})),bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:e.events.filter(e=>!e.example),ratings:[],walkIns:{},counters:{order:0,table:0,booking:0},customer:{...e.customer,id:'',referralCode:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}}}}return t.IS_ISOLATED_VENUE?{restaurants:[t.IS_QUEUED_VENUE?(0,e.queuedRestaurant)(t.VENUE_RID):t.IS_ABBOTSFORD?n.ABBOTSFORD_RESTAURANT:t.IS_KIRKTON?n.KIRKTON_RESTAURANT:t.IS_GREENSIDE?n.GREENSIDE_RESTAURANT:t.IS_WILDINGS?n.WILDINGS_RESTAURANT:t.IS_KIRKMICHAEL?n.KIRKMICHAEL_RESTAURANT:s.SOUTERS_RESTAURANT],menu:t.IS_WILDINGS?l.WILDINGS_MENU:t.IS_KIRKMICHAEL?d.KIRKMICHAEL_MENU:t.IS_SOUTERS?i.SOUTERS_MENU:[],customer:{id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}},bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:t.IS_WILDINGS?(0,o.guideCalendarEvents)(o.WILDINGS_GUIDE,'wildings'):t.IS_KIRKMICHAEL?(0,o.guideCalendarEvents)(o.KIRKMICHAEL_GUIDE,'kirkmichael'):t.IS_SOUTERS?(0,o.guideCalendarEvents)(o.SOUTERS_GUIDE,'souters'):[],ratings:[],audit:[],alertAcks:{},walkIns:{},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:0,table:0,booking:0}}:I(u)};var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),s=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),m=_r(_d[11]);const p='cust-demo';function I(e){const t=(0,m.ymd)(e),r=e=>e.toISOString(),s=n.restaurants.map(e=>'anchorage'===e.id?{...e,sections:c.ANCHORAGE_SECTIONS}:e),i={id:p,name:'Alex Morgan',email:'alex.demo@example.com',phone:'07700 900123',allergies:[{allergen:'crustaceans',severity:'anaphylaxis'},{allergen:'mustard',severity:'allergy'}],allergyConsent:!0,referralCode:'ALEX-7K2Q',marketingOptIn:{anchorage:!0}},o=(n,s,i,o,d={})=>({id:n,ref:`BK-${n.slice(-3).toUpperCase()}`,restaurantId:'anchorage',customerId:null,name:s,partySize:i,date:t,time:o,allergies:[],notes:'',status:'confirmed',security:i>=6?'deposit':'none',depositPaid:0,...i>=6?{depositDue:1e3*i}:{},createdAt:r((0,m.addMins)(e,-4320)),...d}),d=[o('bk-101','Campbell',2,'17:00',{table:'12',status:'seated',seatedAt:r((0,m.addMins)(e,-28)),tags:['Regular']}),o('bk-102','Fraser',4,'17:30',{table:'10',tags:['VIP']}),o('bk-103','McLeod',2,'18:00',{table:'11',allergies:[{allergen:'gluten',severity:'coeliac'}],notes:'Anniversary',occasion:'anniversary'}),o('bk-104','Kerr',6,'18:00',{table:'18'}),o('bk-105','Wallace',3,'18:30',{table:'13'}),o('bk-106','Boyd',8,'19:00',{table:'1+2',dog:!0,allergies:[{allergen:'peanuts',severity:'anaphylaxis'}],notes:'Birthday \u2014 bringing a dog',occasion:'birthday'}),o('bk-107','Hamilton',2,'19:00',{table:'5'}),o('bk-108','Stewart',4,'19:30',{table:'19',tags:['Regular']}),o('bk-109','Murray',2,'20:00',{table:'16'})],l=[{id:'wl-1',restaurantId:'anchorage',number:1,name:'Paterson',partySize:2,joinedAt:r((0,m.addMins)(e,-12)),status:'waiting'},{id:'wl-2',restaurantId:'anchorage',number:2,name:'Duncan',partySize:4,joinedAt:r((0,m.addMins)(e,-4)),status:'waiting'}],I=(0,m.atTime)(e,'17:45'),h=[{id:'ord-seed-1',ref:'T-1041',restaurantId:'anchorage',customerId:'cust-other',customerName:'R. Gilmour',type:'takeaway',slotTime:r(I),lines:[{itemId:'a-fishsupper',name:'Fish Supper',qty:2,unitPrice:1800,choices:['Beer-battered'],notes:'',contains:[],may:[],overridden:!1,prepMins:12},{itemId:'a-chips',name:'Triple-Cooked Chips (V)',qty:1,unitPrice:450,choices:[],notes:'Extra salt',contains:[],may:[],overridden:!1,prepMins:6}],subtotal:4050,tip:0,giftCardApplied:0,total:4050,paid:4050,status:'acknowledged',createdAt:r((0,m.addMins)(e,-50)),allergies:[],readiness:{}},{id:'ord-seed-2',ref:'Q-2017',restaurantId:'anchorage',customerId:'cust-other2',customerName:'Table 3 guest',type:'table',tableNo:'3',lines:[{itemId:'a-moules',name:'Moules Marini\xe8re',qty:1,unitPrice:2200,choices:['Main 500g with triple-cooked chips (\xa322.00)'],notes:'',contains:[],may:[],overridden:!1,prepMins:10},{itemId:'a-claymore',name:'The Claymore Burger',qty:1,unitPrice:1800,choices:[],notes:'No gherkins',contains:[],may:[],overridden:!1,prepMins:14}],subtotal:4e3,tip:0,giftCardApplied:0,total:4e3,paid:0,status:'preparing',createdAt:r((0,m.addMins)(e,-18)),allergies:[],readiness:{}}],y=[{restaurantId:'anchorage',customerId:p,stamps:5,rewardsAvailable:0,history:[{at:'2026-08-15',source:'Dine-in (staff scan)'},{at:'2026-08-29',source:'Takeaway'},{at:'2026-09-12',source:'Table QR bill'},{at:'2026-10-02',source:'Takeaway'},{at:'2026-10-16',source:'Referral \u2014 friend\u2019s first visit'}]},{restaurantId:'saltmarsh',customerId:p,stamps:2,rewardsAvailable:0,history:[{at:'2026-09-01',source:'Dine-in'},{at:'2026-10-01',source:'Dine-in'}]}],b=[{id:'gc-1',code:'ANC-G7QX-4M2P-9TRE',restaurantId:'anchorage',initial:5e3,balance:2500,ownerId:p,recipientName:'Alex',message:'Happy birthday! (example)',createdAt:'2026-09-20'},{id:'gc-2',code:'WEB-OLD-10-EXAMPLE',restaurantId:'anchorage',initial:1e3,balance:1e3,ownerId:'legacy',recipientName:'Legacy website bookings voucher (example)',message:'',createdAt:'2026-06-01',legacy:!0}],E=[...u.SCOTTISH_BANK_HOLIDAYS.map((e,t)=>({id:`bh-${t}`,restaurantId:null,date:e.date,title:e.title+(e.notes&&!/substitute/i.test(e.notes)?` (${e.notes.toLowerCase()})`:''),kind:'bank-holiday',description:'Scottish bank holiday',example:!1,source:u.BANK_HOLIDAY_SOURCE})),{id:'ev-halloween',restaurantId:'anchorage',date:(0,m.ymd)(new Date(e.getFullYear(),9,31)),title:'Halloween weekend (example)',kind:'event',description:'Example event \u2014 busy weekend flag for the forecast.',example:!0},{id:'ev-xmas-party',restaurantId:'anchorage',date:'2026-12-04',title:'Christmas party nights begin (example)',kind:'event',description:'Example: festive set menu, deposit required for parties of 8+.',example:!0},{id:'ev-hogmanay',restaurantId:null,date:'2026-12-31',title:'Hogmanay',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-burns',restaurantId:'anchorage',date:'2027-01-25',title:'Burns Night Supper (example)',kind:'event',description:'EXAMPLE event: haggis, neeps & tatties, address to the haggis, set menu \xa348pp. Booking opens via the app.',example:!0},{id:'ev-valentines',restaurantId:null,date:'2027-02-14',title:"Valentine's Day",kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-mothering',restaurantId:null,date:'2027-03-07',title:'Mothering Sunday (UK)',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-live',restaurantId:'anchorage',date:'2026-11-14',title:'Live acoustic music (example)',kind:'event',description:'EXAMPLE: local folk duo from 7pm.',example:!0},{id:'ev-school-xmas',restaurantId:null,date:'2026-12-23',title:'South Ayrshire schools close for Christmas',kind:'school-holiday',description:'23 Dec 2026 \u2013 4 Jan 2027',example:!1},{id:'ev-salt-quiz',restaurantId:'saltmarsh',date:'2026-11-05',title:'Quiz night (fictional)',kind:'event',description:'Fictional demo restaurant event.',example:!0}];return{restaurants:s,menu:[...c.anchorageMenu,...n.demoMenus],customer:i,bookings:d,waitlist:l,orders:h,stampCards:y,giftCards:b,events:E,ratings:[{id:'rt-1',restaurantId:'anchorage',customerId:'cust-x1',customerName:'Fiona (example)',stars:5,comment:'Best fish supper on the coast, and the staff were brilliant with my son\u2019s nut allergy.',createdAt:r((0,m.addMins)(e,-1560)),context:'Takeaway T-1032'},{id:'rt-2',restaurantId:'anchorage',customerId:'cust-x2',customerName:'Iain (example)',stars:4,comment:'Lovely langoustines. Bit of a wait for a table at 7.',createdAt:r((0,m.addMins)(e,-3e3)),context:'Dine-in, Table 6'},{id:'rt-3',restaurantId:'anchorage',customerId:'cust-x3',customerName:'Morag (example)',stars:2,comment:'Chips were cold by the time we collected.',createdAt:r((0,m.addMins)(e,-4320)),context:'Takeaway T-1019'}],audit:[],alertAcks:{},walkIns:{anchorage:6},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:1042,table:2018,booking:110}}}},1205,[6,5,842,3,1206,1207,932,1208,1209,1210,1211,822]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_RESTAURANT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SOUTERS_BOOKING_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SOUTERS_CONTACTS",{enumerable:!0,get:function(){return o}});const t={id:'souters',name:"Souter's Inn",tagline:'Culinary excellence meets country hospitality in Kirkoswald',location:'Kirkoswald, South Ayrshire',address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',phone:'01655 760653',website:'https://www.soutersinn.com/',fictional:!1,kitchenHours:{0:['09:00','21:00'],1:['09:00','21:00'],2:['09:00','21:00'],3:['09:00','21:00'],4:['09:00','21:00'],5:['09:00','21:00'],6:['09:00','21:00']},hoursNote:'Official menus (10 Nov 2026): breakfast daily 9\u201311.45am; \xe0 la carte, children\u2019s, vegetarian and takeaway 12 noon\u20139pm; desserts 9am\u20139pm. Official homepage: open daily from 9am. Destination South Ayrshire lists 9am\u20139pm, seven days, food all day. Christmas hours not published.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:16,stampTarget:8,stampReward:'',stampMinSpend:1e3,capacityPerHour:0,walkInShare:.35,turnMins:75,orderAtTable:!1,showTakeaway:!1,tableRequests:!0,shortName:"Souter's",deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'A general table deposit policy was not published on the official website (10 November 2026). No deposit is taken in this app.'}}},n='',o={email:'souters@southernayr.com',phone:'01655 760653'}},1206,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_MENU",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SOUTERS_MENU_COUNT",{enumerable:!0,get:function(){return t}});const s=[{id:"su-breakfast-full-breakfast",section:"Breakfast",name:"Full Breakfast",description:"Ayrshire Bacon, Link Sausage, Black Pudding, Potato Scone, Beans, Tomato, Mushrooms & Two Eggs (Poached, Scrambled or Fried) with White or Wholemeal Toast",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-benedict",section:"Breakfast",name:"Eggs Benedict",description:"Two Poached Eggs along with Ayrshire Bacon served on Toasted Muffin topped with Hollandaise Sauce",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-french-toast",section:"Breakfast",name:"French Toast",description:"Two Slices of Bloomer Eggy Bread with Ayrshire Bacon and a side of Maple Syrup",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-light-breakfast",section:"Breakfast",name:"Light Breakfast",description:"Ayrshire Bacon, Link Sausage, Beans, Tomato and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-royale",section:"Breakfast",name:"Eggs Royale",description:"Two Poached Eggs with Flaked Smoked Salmon served on Toasted Muffin topped with Hollandaise Sauce",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-fried-scottish-pancakes",section:"Breakfast",name:"Fried Scottish Pancakes",description:"Scottish Pancakes with Ayrshire Bacon and a side of Maple Syrup",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-to-fried-scottish-pancakes",section:"Breakfast add-ons",name:"Add Banana (to Fried Scottish Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-two-eggs-poached-fried-or-scrambled-",section:"Breakfast add-ons",name:"Add Two Eggs \u2013 Poached, Fried or Scrambled (to Fried Scottish Pancakes)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-vegetarian-breakfast",section:"Breakfast",name:"Vegetarian Breakfast",description:"Potato Scone, Tomato, Mushrooms, Beans and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:925,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-benedict",section:"Breakfast",name:"Smashed Avocado Benedict",description:"Smashed Avocado Guacamole, 2 Poached Eggs served on Toasted Muffin topped with Hollandaise Sauce",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-granola-bowl",section:"Breakfast",name:"Granola Bowl",description:"Almond and Raisin Granola topped with Berries, Natural Yoghurt and Honey",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-burrito",section:"Breakfast",name:"Breakfast Burrito",description:"Crispy Bacon, Two Fried Eggs, Jalape\xf1o Salsa, Guacamole, Cheddar Cheese, Salad & Sour Cream",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pancake-stack",section:"Breakfast",name:"Pancake Stack",description:"American style pancakes with Biscoff, Nutella, Chocolate Sauce & Fresh Strawberries",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-roll",section:"Breakfast",name:"Breakfast Roll",description:"with a choice of Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg; 2 Items \xa34.75 | 3 Items \xa35.50",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-breakfast",section:"Junior / Kids",name:"Kids Breakfast",description:"Pork Link Sausage, Beans, Potato Scone, served with a Slice of Toast",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-pancakes",section:"Junior / Kids",name:"Kids Pancakes",description:"American Style Pancakes served with Syrup, Nutella or Butter & Jam",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-or-strawberries-to-kids-panca",section:"Junior / Kids add-ons",name:"Add Banana or Strawberries (to Kids Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-black-pudding-add-on",section:"Add-ons",name:"Black Pudding (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-beans-add-on",section:"Add-ons",name:"Beans (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-add-on",section:"Add-ons",name:"Smashed Avocado (add-on)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pork-link-sausage-add-on",section:"Add-ons",name:"Pork Link Sausage (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-mushrooms-add-on",section:"Add-ons",name:"Mushrooms (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-tomato-add-on",section:"Add-ons",name:"Tomato (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-ayrshire-bacon-2-add-on",section:"Add-ons",name:"Ayrshire Bacon (2) (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-haggis-add-on",section:"Add-ons",name:"Haggis (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-egg-add-on",section:"Add-ons",name:"Egg (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-potato-scone-add-on",section:"Add-ons",name:"Potato Scone (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-bucket-of-chips",section:"Add-ons",name:"Bucket of Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-toasted-white-or-wholemeal-bread",section:"Add-ons",name:"Toasted White or Wholemeal Bread",description:"served with Butter and Preserve",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-freshly-baked-basket-of-bread-with-butte",section:"Starters / bread",name:"Freshly Baked Basket Of Bread With Butter",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-olive-oil-balsamic-vinegar",section:"Starters / bread",name:"Add Olive Oil & Balsamic Vinegar",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-soup-of-the-day",section:"Starters",name:"Soup of The Day",description:"served with Crusty Bread & Butter",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-a-la-carte-salad-of-poached-pear-blue-cheese",section:"Starters",name:"Salad Of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fresh-water-prawns",section:"Starters",name:"Fresh Water Prawns",description:"coated in Spicy Bang Bang Sauce, topped with Chopped Chilli, Peanuts & Coriander",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sliced-melon-fresh-fruits",section:"Starters",name:"Sliced Melon & Fresh Fruits",description:"with Coulis & Raspberry Sorbet",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-liver-p-t",section:"Starters",name:"Chicken Liver P\xe2t\xe9",description:"with Oatcakes, Plum & Apple Chutney",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-crispy-salt-pepper-calamari",section:"Starters",name:"Crispy Salt & Pepper Calamari",description:"served with Garlic Mayo & Oriental Dressing",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-mussels",section:"Starters",name:"Steamed Mussels",description:"with White Wine, Garlic, Shallots & Cream, served with Garlic Bread",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamy-baked-garlic-mushrooms",section:"Starters",name:"Creamy Baked Garlic Mushrooms",description:"with a Cheddar Cheese Gratin",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-boiled-egg-crispy-bacon-caesar-salad",section:"Starters",name:"Boiled Egg & Crispy Bacon Caesar Salad",description:"with Parmesan & Croutons",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-grilled-honey-glazed-goat-s-cheese-salad",section:"Starters",name:"Grilled Honey Glazed Goat\u2019s Cheese Salad",description:"with Roquito Peppers & Chilli Jam",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sticky-bbq-ribs-in-a-korean-gochujang-sa",section:"Starters",name:"Sticky BBQ Ribs in a Korean Gochujang Sauce",description:"with Onions, Peppers & Sesame Seeds",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cioppino-fish-soup",section:"Starters",name:"Cioppino Fish Soup",description:"fired up with Fresh Chillies & Smoked Paprika, topped with Croutons & Parmesan",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-fillet-steak",section:"From the grill",name:"8oz Fillet Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-10oz-sirloin-steak",section:"From the grill",name:"10oz Sirloin Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-rosemary-garlic-lamb-chops",section:"From the grill",name:"Rosemary & Garlic Lamb Chops",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:2750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-breaded-haggis-grill",section:"From the grill add-ons",name:"Top with Breaded Haggis (grill)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-6-garlic-buttered-prawns-grill",section:"From the grill add-ons",name:"Top with 6 Garlic Buttered Prawns (grill)",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-fillet-of-salmon-with-cheese-gla",section:"Main courses",name:"Steamed Fillet of Salmon with Cheese Glaze",description:"served with Buttered Greens & Creamed Potatoes",price:2150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breaded-haddock-chips",section:"Main courses",name:"Breaded Haddock & Chips",description:"with Homemade Tartare Sauce & Side Salad",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fish-of-the-day",section:"Main courses",name:"Fish of the Day",description:"Check Chef\u2019s Daily Specials",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,priceNote:"Ask staff",special:!0},{id:"su-a-la-carte-locally-caught-haggis-with-neeps-tatties",section:"Main courses",name:"Locally Caught Haggis with Neeps & Tatties",description:"served with Whisky Peppercorn Sauce & Greentails",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breast-of-cajun-spiced-chicken",section:"Main courses",name:"Breast Of Cajun Spiced Chicken",description:"with Capsicums, Rice Pilaf & a Curried Coconut & Mango Chutney Sauce",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-schnitzel",section:"Main courses",name:"Chicken Schnitzel",description:"Pan-Fried in Breadcrumbs, served with Crispy Bacon, Grilled Pineapple & Chips",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-beef-steak-butcher-s-sausage-pie",section:"Main courses",name:"Beef Steak & Butcher\u2019s Sausage Pie",description:"with Creamed Potatoes & Buttered Carrots",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-madras-spiced-lamb-curry",section:"Main courses",name:"Madras Spiced Lamb Curry",description:"with Chillies, Pineapple & Coriander, served with Aromatic Rice, Spiced Onions & a Poppadom",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-pan-fried-lambs-liver",section:"Main courses",name:"Pan-Fried Lambs Liver",description:"with Saut\xe9ed Onions, Smoked Bacon, Grilled Tomato, Creamed Potatoes & Red Wine Gravy",price:1750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-cheeseburger",section:"Main courses",name:"8oz Cheeseburger",description:"with Bacon, Peppered Mayo, Pickles & Tomato, served with Coleslaw & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-haggis-to-cheeseburger",section:"Main courses add-ons",name:"Add Haggis (to Cheeseburger)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-panko-breaded-chicken-burger",section:"Main courses",name:"Panko Breaded Chicken Burger",description:"in a Toasted Brioche Bun, with Curried Slaw, Katsu Sauce & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Leeks, English Mustard & Matured Cheddar, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-bacon-to-macaroni-cheese",section:"Main courses add-ons",name:"Add Bacon (to Macaroni Cheese)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-penne-pasta-arrabbiata",section:"Main courses",name:"Penne Pasta Arrabbiata",description:"with Peppers, Vine Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-melon-prawn-salad",section:"Salads",name:"Melon & Prawn Salad",description:"with Marie Rose Cocktail Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-ploughman-s-salad",section:"Salads",name:"Ploughman\u2019s Salad",description:"Souter\u2019s Sausage Roll, Matured Cheddar, Pickle, Gammon, Boiled Egg & Crusty Bread; served with a choice of Chips or Boiled Potatoes",price:1695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-spiced-fillet-of-salmon",section:"Salads",name:"Cajun Spiced Fillet Of Salmon",description:"with Curried Coleslaw, Cashew Nuts & a Chilli, Ginger & Citrus Dressing; served with a choice of Chips or Boiled Potatoes",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-chicken-caesar-salad",section:"Salads",name:"Garlic Chicken Caesar Salad",description:"with Croutons, Parmesan, Baby Gem Lettuce, Boiled Egg & Caesar Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-prawn-smoked-salmon-sandwich",section:"Sandwiches",name:"Prawn & Smoked Salmon Sandwich",description:"with Rocket & Marie Rose Sauce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-tuna-mayonnaise-sandwich",section:"Sandwiches",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-spicy-bang-bang-chicken-sandwich",section:"Sandwiches",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-basil-pesto-chicken-sandwich",section:"Sandwiches",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-egg-mayonnaise-sandwich",section:"Sandwiches",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-a-cup-of-soup-with-any-sandwich",section:"Sandwiches add-ons",name:"Add a Cup of Soup (with any Sandwich)",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chips",section:"Sides",name:"Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-chips",section:"Sides",name:"Cajun Chips",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamed-potatoes",section:"Sides",name:"Creamed Potatoes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-onion-rings",section:"Sides",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-mac-cheese-side",section:"Sides",name:"Mac & Cheese (side)",description:"",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-seasonal-mixed-vegetables",section:"Sides",name:"Seasonal Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-coleslaw",section:"Sides",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-curried-coleslaw",section:"Sides",name:"Curried Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-side-salad",section:"Sides",name:"Souter\u2019s Side Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread",section:"Sides",name:"Garlic Bread",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread-with-cheese",section:"Sides",name:"Garlic Bread with Cheese",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-fresh-fruit-salad-sorbet",section:"Starters",name:"Fresh Fruit Salad & Sorbet",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-soup-of-the-day",section:"Starters",name:"Soup of the Day",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-garlic-bread-with-or-without-cheese",section:"Starters",name:"Garlic Bread (with or without Cheese)",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-breaded-goujons-of-chicken",section:"Main courses",name:"Breaded Goujons of Chicken",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-mini-breaded-fish",section:"Main courses",name:"Mini Breaded Fish",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-roast-chicken-salad",section:"Main courses",name:"Roast Chicken Salad",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-grilled-sausages-or-chicken-with-gravy",section:"Main courses",name:"Grilled Sausages or Chicken with Gravy",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-sticky-toffee-pudding",section:"Sweet treats",name:"Sticky Toffee Pudding",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-cone-from-the-counter",section:"Sweet treats",name:"Cone from the Counter",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-ice-cream-sundae",section:"Sweet treats",name:"Kids Ice Cream Sundae",description:"Two scoops, Sprinkles, Flakes, along with a choice of Sauce \u2013 Chocolate / Strawberry",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-juice-apple-orange-pineapple",section:"Drinks",name:"Juice \u2013 Apple / Orange / Pineapple",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-simply-fruit-shoot-orange-blackcurrant",section:"Drinks",name:"Simply Fruit Shoot \u2013 Orange / Blackcurrant",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-diluting-juice-orange-blackcurrant",section:"Drinks",name:"Diluting Juice \u2013 Orange / Blackcurrant",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-milk",section:"Drinks",name:"Milk",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-coke-diet-coke-lemonade",section:"Drinks",name:"Coke / Diet Coke / Lemonade",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-milk-shake-chocolate-strawberry",section:"Drinks",name:"Kids Milk Shake \u2013 Chocolate / Strawberry",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-sticky-toffee-pudding",section:"Dessert",name:"Souter\u2019s Sticky Toffee Pudding",description:"with Butterscotch Sauce & Vanilla Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cherry-almond-tart",section:"Dessert",name:"Cherry & Almond Tart",description:"with Cr\xe8me Anglaise & Wild Cherry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-individual-banoffee-pie",section:"Dessert",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-cheesecake-of-the-day",section:"Dessert",name:"Souter\u2019s Cheesecake of the Day",description:"Please ask your Server for Today\u2019s Choice",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-warm-chocolate-fudge-cake",section:"Dessert",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-meringue-pie",section:"Dessert",name:"Lemon Meringue Pie",description:"with Raspberries & Raspberry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-fresh-fruit-salad",section:"Dessert",name:"Fresh Fruit Salad",description:"with Citrus Syrup served with Pouring Cream, Ice Cream or Sorbet",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cheeseboard",section:"Dessert",name:"Cheeseboard",description:"A Selection of British & Continental Cheeses with Grapes, Fruit Chutney & Biscuits",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-affogato",section:"Dessert",name:"Affogato",description:"Vanilla Ice Cream with a Shot of Espresso",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-ice-cream-one-scoop",section:"Ice cream",name:"Ice Cream \u2013 One Scoop",description:"Please ask your Server for Today\u2019s Flavours",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-two-scoops",section:"Ice cream",name:"Ice Cream \u2013 Two Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-three-scoops",section:"Ice cream",name:"Ice Cream \u2013 Three Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-strawberry-snowball-delight",section:"Sundaes",name:"Strawberry Snowball Delight",description:"Vanilla & Strawberry Ice cream, Crushed Meringue, Fresh Strawberries, Strawberry Sauce, topped with a Snowball & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-biscoff-sundae",section:"Sundaes",name:"Biscoff Sundae",description:"Biscoff & Toffee Fudge Ice Cream, Whipped Cream, Crushed Lotus Biscoff Biscuits, Biscoff Topping Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-kinder-bueno-sundae",section:"Sundaes",name:"Kinder Bueno Sundae",description:"Kinder Bueno & Chocolate Ice Cream, Whipped Cream, Kinder Bueno Pieces, Chocolate Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-chilled-melon-seasonal-fruits",section:"Starters",name:"Chilled Melon & Seasonal Fruits",description:"with Fruit Coulis & Sorbet",price:850,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-garlic-mushrooms",section:"Starters",name:"Creamy Garlic Mushrooms",description:"with Cheddar Cheese & Crusty Bread",price:895,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-mediterranean-tomato-chunky-vegetable-so",section:"Starters",name:"Mediterranean Tomato & Chunky Vegetable Soup",description:"with Crusty Bread",price:650,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-honey-glazed-goats-cheese",section:"Starters",name:"Honey Glazed Goats Cheese",description:"with Tomato & Rocket Salad, Basil Pesto & Balsamic Dressing",price:850,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-freshly-baked-basket-of-bread",section:"Starters",name:"Freshly Baked Basket of Bread",description:"with Butter",price:450,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-vegetarian-vegan-add-olive-oil-balsamic",section:"Starters",name:"Add Olive Oil & Balsamic",description:"",price:100,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-boiled-egg-caesar-salad",section:"Starters",name:"Boiled Egg Caesar Salad",description:"with Croutons, Garlic Dressing & Vegetarian Cheese Shavings",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-salad-of-poached-pear-candied-walnuts",section:"Starters",name:"Salad of Poached Pear & Candied Walnuts",description:"with French Vinaigrette",price:795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-stuffed-peppers",section:"Main courses",name:"Stuffed Peppers",description:"with Braised Rice, Tomatoes, Basil & Brie, served with a Side Salad & a Bucket of Chips; without Brie is vegan",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-vegetable-cashew-nut-stir-fry",section:"Main courses",name:"Vegetable & Cashew Nut Stir Fry",description:"with Hoisin, Ginger & Garlic, served with Aromatic Rice",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Coleman\u2019s Mustard, Leeks & Matured Cheddar, served with Garlic Bread",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-pasta-arrabbiata",section:"Main courses",name:"Pasta Arrabbiata",description:"with Peppers, Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-coconut-vegetable-curry",section:"Main courses",name:"Creamy Coconut Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-katsu-vegetable-curry",section:"Main courses",name:"Katsu Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-fresh-fruit-salad",section:"Desserts",name:"Fresh Fruit Salad",description:"with Sorbet",price:700,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-sticky-toffee-pudding",section:"Desserts",name:"Sticky Toffee Pudding",description:"with Hot Caramel Sauce & Vanilla Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cherry-almond-tart",section:"Desserts",name:"Cherry & Almond Tart",description:"with Wild Cherry Ripple Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-trillionaire-tart",section:"Desserts",name:"Trillionaire Tart",description:"with Chocolate Pastry, Caramel Toffee & Chocolate Style Ganache, served with Vegan Vanilla Ice Cream",price:795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-individual-banoffee-pie",section:"Desserts",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-warm-chocolate-fudge-cake",section:"Desserts",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cheeseboard",section:"Desserts",name:"Cheeseboard",description:"served with Oatcakes & Seasonal Chutney",price:995,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-affogato",section:"Desserts",name:"Affogato",description:"1 Scoop of Plain Ice Cream with a shot of Espresso Coffee",price:650,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-ayrshire-bacon",section:"Morning (9am\u201312pm)",name:"Floured Bap with Ayrshire Bacon",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-pork-link-sausage",section:"Morning (9am\u201312pm)",name:"Floured Bap with Pork Link Sausage",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-poached-scrambled-fried",section:"Morning (9am\u201312pm)",name:"Floured Bap with Poached / Scrambled / Fried Egg",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-extra-item-on-floured-bap",section:"Morning (9am\u201312pm)",name:"Extra Item (on Floured Bap)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-traybakes",section:"Sweet treats",name:"Traybakes",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-freshly-baked-cakes",section:"Sweet treats",name:"Freshly Baked Cakes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-freshly-baked-plain-fruit-scone",section:"Sweet treats",name:"Freshly Baked Plain / Fruit Scone",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-soup-of-the-day",section:"Hot food (12pm\u20139pm)",name:"Soup of the Day",description:"with Crusty Bread; available 12pm\u20139pm",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-breaded-haddock-chips",section:"Hot food (12pm\u20139pm)",name:"Breaded Haddock & Chips",description:"with Tartare Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-steak-sausage-pie",section:"Hot food (12pm\u20139pm)",name:"Steak & Sausage Pie",description:"with Chips & Gravy",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-macaroni-cheese",section:"Hot food (12pm\u20139pm)",name:"Macaroni Cheese",description:"with Leeks, Mustard & Matured Cheddar, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-8oz-burger",section:"Hot food (12pm\u20139pm)",name:"8oz Burger",description:"with Bacon & Cheese, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-katsu-chicken-burger",section:"Hot food (12pm\u20139pm)",name:"Breaded Katsu Chicken Burger",description:"with Curried Slaw, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-cajun-chicken",section:"Hot food (12pm\u20139pm)",name:"Cajun Chicken",description:"with Rice & Coconut Curry Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-goat-s-cheese",section:"Hot food (12pm\u20139pm)",name:"Breaded Goat\u2019s Cheese",description:"with Tomato Salad, Pesto & Chutney, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-basil-pesto-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-spicy-bang-bang-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches (12pm\u20135pm)",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-tuna-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-egg-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-pork-fillet-escalopes",section:"Choose your cut",name:"Pork Fillet Escalopes",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-beef-fillet",section:"Choose your cut",name:"8oz Scotch Beef Fillet",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-sirloin",section:"Choose your cut",name:"8oz Scotch Sirloin",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-10oz-scotch-ribeye",section:"Choose your cut",name:"10oz Scotch Ribeye",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-scotch-lamb-chops",section:"Choose your cut",name:"Scotch Lamb Chops",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-600gm-scotch-t-bone-steak",section:"Choose your cut",name:"600gm Scotch T-Bone Steak",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:4500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-mixed-grill",section:"Choose your cut",name:"Souter\u2019s Mixed Grill",description:"4oz Sirloin / Chicken Breast / Lamb Chop / Pork Escalope; served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-chunky-chips-included-side-choice",section:"Side (included)",name:"Chunky Chips (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-baby-boiled-potatoes-included-side-choic",section:"Side (included)",name:"Baby Boiled Potatoes (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mashed-potato-included-side-choice",section:"Side (included)",name:"Mashed Potato (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-red-wine-jus-included-sauce-choice",section:"Sauce (included)",name:"Red Wine Jus (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-peppercorn-included-sauce-choice",section:"Sauce (included)",name:"Peppercorn (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mustard-included-sauce-choice",section:"Sauce (included)",name:"Mustard (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-onion-rings",section:"Upgrade extras",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garden-salad",section:"Upgrade extras",name:"Garden Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mixed-vegetables",section:"Upgrade extras",name:"Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-haggis-cake",section:"Upgrade extras",name:"Haggis Cake",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mac-cheese",section:"Upgrade extras",name:"Mac & Cheese",description:"",price:525,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garlic-prawns",section:"Upgrade extras",name:"Garlic Prawns",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-coleslaw",section:"Upgrade extras",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-2-course-set",section:"Festive set menu",name:"2 Course Festive Menu",description:"From 1 December, Monday\u2013Sunday 12\u20139pm, only available for tables of 10 or more. Christmas crackers included.",price:2995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-3-course-set",section:"Festive set menu",name:"3 Course Festive Menu",description:"From 1 December, Monday\u2013Sunday 12\u20139pm, only available for tables of 10 or more. Christmas crackers included.",price:3595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-chilled-melon-fruits",section:"Festive \xb7 Starters",name:"Chilled Melon & Fruits",description:"with Lemon Sorbet",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-salad-of-poached-pear-blue-cheese",section:"Festive \xb7 Starters",name:"Salad of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-souters-prawn-home-smoked-salmon-cocktail",section:"Festive \xb7 Starters",name:"Souter\u2019s Prawn & Home Smoked Salmon Cocktail",description:"with Baby Gem & Marie Rose Sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-smooth-chicken-liver-parfait",section:"Festive \xb7 Starters",name:"Smooth Chicken Liver Parfait",description:"with Spiced Plum Chutney & Oatcakes",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-soup-of-the-day",section:"Festive \xb7 Starters",name:"Soup of the Day",description:"served with Freshly Baked Crusty Bread",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-salad-of-warm-breaded-goats-cheese",section:"Festive \xb7 Starters",name:"Salad of Warm Breaded Goats Cheese",description:"with Red Onion Marmalade",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-traditional-roast-turkey",section:"Festive \xb7 Main courses",name:"Traditional Roast Turkey",description:"with Stuffing, Chipolatas, Roast Potatoes, Brussel Sprouts, Fresh Cranberry Sauce & Light Turkey Jus",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-individual-vegetable-chestnut-brie-cranberry-pie",section:"Festive \xb7 Main courses",name:"Individual Vegetable, Chestnut, Brie & Cranberry Pie",description:"served with a Creamy White Wine & Leek Sauce",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-pan-fried-fish-of-the-day-with-garlic-tiger-praw",section:"Festive \xb7 Main courses",name:"Pan Fried Fish of the Day with Garlic Tiger Prawns",description:"with Buttered Greens, Baby Potatoes, Capers & Citrus Beurre Blanc",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cajun-fillet-of-salmon-salad",section:"Festive \xb7 Main courses",name:"Cajun Fillet of Salmon Salad",description:"with Curried Coleslaw, Cashew Nuts & a Ginger & Lemongrass Dressing",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-individual-beef-steak-sausage-onion-pie",section:"Festive \xb7 Main courses",name:"Individual Beef Steak, Sausage & Onion Pie",description:"served with Creamed Potatoes & Glazed Carrots",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-lightly-peppered-breast-of-chicken",section:"Festive \xb7 Main courses",name:"Lightly Peppered Breast of Chicken",description:"served with Crispy Breaded Haggis, Champ Mashed Potatoes, Root Vegetables & Whisky Cream Sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-christmas-pudding",section:"Festive \xb7 Desserts",name:"Christmas Pudding",description:"with Brandy Sauce & Scottish Tablet Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cherry-almond-tart",section:"Festive \xb7 Desserts",name:"Cherry & Almond Tart",description:"with Chilled Cr\xe8me Anglaise & Wild Cherry Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-warm-chocolate-orange-fudge-cake",section:"Festive \xb7 Desserts",name:"Warm Chocolate & Orange Fudge Cake",description:"with Girvan Gelateria Vanilla Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cheesecake-of-the-day",section:"Festive \xb7 Desserts",name:"Cheesecake of the Day",description:"with Ice Cream",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-selection-of-scottish-farmhouse-cheese",section:"Festive \xb7 Desserts",name:"Selection of Scottish Farmhouse Cheese",description:"with Chutney, Grapes & Oatcakes",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-coffee-or-tea-with-a-mince-pie",section:"Festive \xb7 To finish",name:"Freshly Ground Coffee or Tea with a Mince Pie",description:"From 1 December, tables of 10 or more",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"souters",soldOut:!1,signOff:null})),t=235},1207,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIRKMICHAEL_MENU_COUNT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"KIRKMICHAEL_MENU",{enumerable:!0,get:function(){return n}});const s=133,n=[{id:"km-main-menu-khun-mais-canteen-grilled-aubergine",section:"Menu \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-langoustine-prawn-toast",section:"Menu \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-loch-ryan-venison-empinadas",section:"Menu \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-bbq-scotch-pork-neck-moo-ping",section:"Menu \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-scallop-slow-roasted-pork-belly",section:"Menu \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Menu \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-slow-roasted-apple-orchard-tamworth-pork-belly",section:"Menu \xb7 Main Courses on the specials board",name:"Slow Roasted Apple Orchard Tamworth Pork Belly",description:"Truffle Mash-Roasted Carrot-Spring Cabbage-Apple Puree",price:2800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-char-roasted-lamb-neck-fillet",section:"Menu \xb7 Main Courses on the specials board",name:"Char Roasted Lamb Neck Fillet",description:"Autumn Cabbage, Boiled Potatoes, Roast Carrot, Red Wine Jus",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-fire-roasted-lochryan-venison-loin",section:"Menu \xb7 Main Courses on the specials board",name:"Fire Roasted Lochryan Venison Loin",description:"Celeriac Parsley Puree-Wild Leeks-Potato Terrine-Juniper Jus",price:3900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-butter-poached-lemon-sole-fillet",section:"Menu \xb7 Main Courses on the specials board",name:"Butter Poached Lemon Sole Fillet",description:"Langoustines Tails-Pernod Chive Nage-Paris Mash-Truffle",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-grilled-tranche-of-turbot",section:"Menu \xb7 Main Courses on the specials board",name:"Grilled Tranche of Turbot",description:"Lemon Scented Monk's Beard-Pink Fir Apple Potatoes-Bearnaise",price:4400,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-lunch-khun-mais-canteen-grilled-aubergine",section:"Lunch \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-langoustine-prawn-toast",section:"Lunch \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-loch-ryan-venison-empinadas",section:"Lunch \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-bbq-scotch-pork-neck-moo-ping",section:"Lunch \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-scallop-slow-roasted-pork-belly",section:"Lunch \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Lunch \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-triple-cooked-hand-cut-chips",section:"Lunch \xb7 Sides",name:"Triple Cooked Hand Cut Chips",description:"",price:600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-khun-mais-canteen-grilled-aubergine",section:"Sunday lunch \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-langoustine-prawn-toast",section:"Sunday lunch \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-loch-ryan-venison-empinadas",section:"Sunday lunch \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-bbq-scotch-pork-neck-moo-ping",section:"Sunday lunch \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-scallop-slow-roasted-pork-belly",section:"Sunday lunch \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Sunday lunch \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-maple-glazed-bacon-loin",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Maple Glazed Bacon Loin",description:"",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-roasted-sirloin-of-scotch-beef",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Roasted Sirloin of Scotch Beef",description:"Beef Fat Roast Potatoes-Yorkshire Pudding-Spring Cabbage-Carrot-Peppercorn Sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-lemon-and-thyme-corn-fed-chicken",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Lemon and Thyme Corn Fed Chicken",description:"",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-carvery-plate",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Carvery Plate",description:"Beef, Bacon Loin, Corn Fed Chicken",price:3100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-fire-roasted-lochryan-venison-loin",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Fire Roasted Lochryan Venison Loin",description:"Celeriac Parsley Puree-Wild Leeks-Potato Terrine-Juniper Jus",price:3900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-butter-poached-lemon-sole-fillet",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Butter Poached Lemon Sole Fillet",description:"Langoustines Tails-Pernod Chive Nage-Paris Mash-Truffle",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-grilled-tranche-of-turbot",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Grilled Tranche of Turbot",description:"Lemon Scented Monk's Beard-Pink Fir Apple Potatoes-Bearnaise",price:4400,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-kids-garlic-bread",section:"Kids \xb7 Starters",name:"Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-cheesy-garlic-bread",section:"Kids \xb7 Starters",name:"Cheesy Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-soup",section:"Kids \xb7 Starters",name:"Soup",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-hamburger",section:"Kids \xb7 Mains",name:"Hamburger",description:"Scotch beef burger with brioche bun, lettuce, tomato & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-cheese-burger",section:"Kids \xb7 Mains",name:"Cheese Burger",description:"Scotch beef burger with cheddar cheese, brioche bun, lettuce, tomato & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-chicken-goujons",section:"Kids \xb7 Mains",name:"Chicken Goujons",description:"Crisp fried chicken strips with tortilla wraps, grated cheddar & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-fish-n-chips",section:"Kids \xb7 Mains",name:"Fish 'n Chips",description:"Battered haddock, lemon, tartare sauce & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-mac-n-cheese",section:"Kids \xb7 Mains",name:"Mac 'n Cheese",description:"Creamy Macaroni with cheddar cheese sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-strawberry-ice-cream",section:"Kids \xb7 Desserts",name:"Strawberry Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-chocolate-ice-cream",section:"Kids \xb7 Desserts",name:"Chocolate Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-vanilla-ice-cream",section:"Kids \xb7 Desserts",name:"Vanilla Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-sticky-toffee-pudding",section:"Kids \xb7 Desserts",name:"Sticky Toffee Pudding",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-whisky-whyte-macay",section:"Whisky \xb7 Blended Whisky",name:"Whyte & Macay",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-johnnie-walker-black-label",section:"Whisky \xb7 Blended Whisky",name:"Johnnie Walker Black Label",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-canadian-club",section:"Whisky \xb7 Blended Whisky",name:"Canadian Club",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jack-daniels-tennessee",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Jack Daniel's Tennessee",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-southern-comfort",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Southern Comfort",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-makers-mark-classic",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Maker's Mark Classic",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bulleit",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Bulleit",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bulleit-rye",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Bulleit Rye",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jim-beam-white-label",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Jim Beam White Label",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-woodford-reserve",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Woodford Reserve",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jameson",section:"Whisky \xb7 Irish Whiskey",name:"Jameson",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-hibiki-harmony-masters-masters-select",section:"Whisky \xb7 Japanese Whisky",name:"Hibiki Harmony Masters Masters Select",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenfiddich-12-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Glenfiddich 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenrothes-12-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Glenrothes 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-macallan-12-year-old-double-cask",section:"Whisky \xb7 Single Malt - Speyside",name:"Macallan 12 Year Old Double Cask",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-benrinnes-flora-fauna-15",section:"Whisky \xb7 Single Malt - Speyside",name:"Benrinnes Flora & Fauna 15",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-benrinnes-1997-maltman-18-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Benrinnes 1997 Maltman 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-balvenie-18-year-old-pedro-ximenez",section:"Whisky \xb7 Single Malt - Speyside",name:"Balvenie 18 Year Old Pedro Ximenez",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-macallan-18-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Macallan 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-aberlour-abunadh-cask-strength",section:"Whisky \xb7 Single Malt - Speyside",name:"Aberlour Abunadh Cask Strength",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-mortlach-16yo",section:"Whisky \xb7 Single Malt - Speyside",name:"Mortlach 16yo",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-dalmore-12-year-old",section:"Whisky \xb7 Single Malt - Highland",name:"Dalmore 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-oban-14-year-old",section:"Whisky \xb7 Single Malt - Highland",name:"Oban 14 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glencadam-10",section:"Whisky \xb7 Single Malt - Highland",name:"Glencadam 10",description:"",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-tomatin-legacy",section:"Whisky \xb7 Single Malt - Highland",name:"Tomatin Legacy",description:"",price:675,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-tomatin-14",section:"Whisky \xb7 Single Malt - Highland",name:"Tomatin 14",description:"",price:800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glendronach-15",section:"Whisky \xb7 Single Malt - Highland",name:"Glendronach 15",description:"",price:900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glenfarclas-21",section:"Whisky \xb7 Single Malt - Highland",name:"Glenfarclas 21",description:"",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glendronach-sherry-cask-18",section:"Whisky \xb7 Single Malt - Highland",name:"Glendronach Sherry Cask 18",description:"",price:2250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-bowmore-15-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Bowmore 15 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lagavulin-16-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Lagavulin 16 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-caol-ila-12-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Caol Ila 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-caol-ila-moch",section:"Whisky \xb7 Single Malt - Islay",name:"Caol Ila Moch",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-ardbeg-10",section:"Whisky \xb7 Single Malt - Islay",name:"Ardbeg 10",description:"",price:575,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-highland-park-12-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Highland Park 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-talisker-10-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Talisker 10 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-10-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Arran 10 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-port-cask-finish",section:"Whisky \xb7 Single Malt - Islands",name:"Arran Port Cask Finish",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-machrie-moor-cask-strength",section:"Whisky \xb7 Single Malt - Islands",name:"Machrie Moor Cask Strength",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-amarone-cask",section:"Whisky \xb7 Single Malt - Islands",name:"Arran Amarone Cask",description:"",price:725,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-hearach-oloroso-harris",section:"Whisky \xb7 Single Malt - Islands",name:"Hearach Oloroso, Harris",description:"",price:900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-ledaig-1974-mull",section:"Whisky \xb7 Single Malt - Islands",name:"Ledaig 1974, Mull",description:"",price:2250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-auchentoshan-three-wood",section:"Whisky \xb7 Single Malt - Lowlands",name:"Auchentoshan Three Wood",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-ailsa-bay",section:"Whisky \xb7 Single Malt - Lowlands",name:"Ailsa Bay",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenkinchie-12-year-old",section:"Whisky \xb7 Single Malt - Lowlands",name:"Glenkinchie 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-our-barley",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Our Barley\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-fallow-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Fallow Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-ploughing-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Ploughing Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-5",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"5\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-cask-strength-2nd-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Cask Strength 2nd Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-spirit-drink",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch Spirit Drink",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-vinaya",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch Vinaya",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-22-year-old-vintage-release",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch 22 Year Old Vintage Release",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-springbank-15-year-old",section:"Whisky \xb7 Single Malt - Campbeltown",name:"Springbank 15 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-springbank-18-year-old",section:"Whisky \xb7 Single Malt - Campbeltown",name:"Springbank 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-greyfriars-cuvee-brut",section:"Wine \xb7 Champagne/Sparkling",name:"Greyfriars Cuvee Brut",description:"England",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-greyfriars-rose-reserve",section:"Wine \xb7 Champagne/Sparkling",name:"Greyfriars Rose Reserve",description:"England",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ruinart-blank-de-blank",section:"Wine \xb7 Champagne/Sparkling",name:"Ruinart Blank De Blank",description:"",price:19e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-sanziana-pinot-noir-rose",section:"Wine \xb7 Rose",name:"Sanziana, Pinot Noir, Rose",description:"Romania",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-rose-organic",section:"Wine \xb7 Rose",name:"Art de Vivre Rose Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-orange-gold-white-organic",section:"Wine \xb7 Orange",name:"Orange Gold White Organic",description:"Gerard Bertrand Organic, France",price:6800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-les-lys-de-leon-sauvignon-blanc",section:"Wine \xb7 White",name:"Les Lys De Leon - Sauvignon Blanc",description:"Loir, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-fetele-feteasca-regala-recas-cramele",section:"Wine \xb7 White",name:"Fetele Feteasca Regala Recas Cramele",description:"Bannat, Romania",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-adam-who-riesling",section:"Wine \xb7 White",name:"Adam Who, Riesling",description:"Eden Valley, Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-rare-vineyards-marsanne-viognier",section:"Wine \xb7 White",name:"Rare Vineyards Marsanne-Viognier",description:"Languedoc France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-la-bergerie-chardonnay-francois-carillon",section:"Wine \xb7 White",name:"La Bergerie Chardonnay, Francois Carillon",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-blanc-organic",section:"Wine \xb7 White",name:"Art de Vivre Blanc Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-acrobat-pinot-gris",section:"Wine \xb7 White",name:"Acrobat Pinot Gris",description:"Oregon, U.S.A",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-dashwood-sauvignon-blanc",section:"Wine \xb7 White",name:"Dashwood Sauvignon Blanc",description:"Marlborough New Zealand",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-sancerre-la-graveli-re",section:"Wine \xb7 White",name:"Sancerre La Graveli\xe8re",description:"Joseph Mellot, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-petaluma-hanlin-hill-riesling",section:"Wine \xb7 White",name:"Petaluma Hanlin Hill Riesling",description:"Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-louis-jadot-puligny-montrachet",section:"Wine \xb7 White",name:"Louis Jadot Puligny Montrachet",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-vinvua-organic-nero-davola-doc",section:"Wine \xb7 Red",name:"Vinvua Organic Nero d'Avola DOC",description:"Sicilia Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-les-lys-de-leon-pinot-grigio",section:"Wine \xb7 Red",name:"Les Lys De Leon, Pinot Grigio",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-tres-priors-trepat-merlot",section:"Wine \xb7 Red",name:"Tres Priors Trepat Merlot",description:"Catalonia, Spain",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-alma-mora-malbec",section:"Wine \xb7 Red",name:"Alma Mora Malbec",description:"San Juan, Argentina",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-drifting-old-vine-zinfandel-lodi",section:"Wine \xb7 Red",name:"Drifting Old Vine Zinfandel Lodi",description:"California, U.S.A",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ch-teau-caz-au-maret-organic",section:"Wine \xb7 Red",name:"Ch\xe2teau Caz\xe9au Maret Organic",description:"Bordeaux, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-inzuzo-red-blend",section:"Wine \xb7 Red",name:"Inzuzo Red Blend",description:"Western Cape South Africa",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-languedoc-organic",section:"Wine \xb7 Red",name:"Art de Vivre LangueDOC Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-journeys-end-v4-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Journeys End V4 Cabernet Sauvignon",description:"South Africa",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-mucchietto-primitivo",section:"Wine \xb7 Red",name:"Mucchietto Primitivo",description:"Puglia, Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-yalumba-the-cigar-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Yalumba The Cigar Cabernet Sauvignon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-black-angus-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Black Angus Cabernet Sauvignon",description:"Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ch-teauneuf-du-pape-le-mioc-ne",section:"Wine \xb7 Red",name:"Ch\xe2teauneuf du Pape 'Le Mioc\xe8ne'",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-catena-zapata-malbec-argentino",section:"Wine \xb7 Red",name:"Catena Zapata Malbec Argentino",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-amarone-della-valpolicella-classico-reserva",section:"Wine \xb7 Red",name:"Amarone della Valpolicella Classico Reserva",description:"Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-psi-bodegas-ribera-del-duero",section:"Wine \xb7 Red",name:"Psi Bodegas Ribera Del Duero",description:"Spain",price:10600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-brunelo-di-mortlachino-ridolfi",section:"Wine \xb7 Red",name:"Brunelo Di Mortlachino Ridolfi",description:"Italy",price:16e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-flor-de-pingus-domain-de-pingus",section:"Wine \xb7 Red",name:"Flor De Pingus, Domain De Pingus",description:"Spain",price:29500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"kirkmichael",soldOut:!1,signOff:null}))},1208,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_MENU_COUNT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"WILDINGS_MENU",{enumerable:!0,get:function(){return n}});const s=83,n=[{id:"wi-lunch-smoked-haddock-gratin-with-creamed-potatoes",section:"Lunch \xb7 Starters",name:"Smoked Haddock Gratin with Creamed Potatoes",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-pear-poached-in-grenadine-with-prawns-marie-rose",section:"Lunch \xb7 Starters",name:"Pear Poached in Grenadine with Prawns Marie Rose",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chefs-pate-with-grape-chutney-toast",section:"Lunch \xb7 Starters",name:"Chefs Pate with Grape Chutney & Toast",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Lunch \xb7 Starters",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-melon-fan-with-sorbet-fruit-coulis",section:"Lunch \xb7 Starters",name:"Melon Fan with Sorbet & Fruit Coulis",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-spiced-chicken-salad-with-caesar-dressing-parmes",section:"Lunch \xb7 Starters",name:"Spiced Chicken Salad with Caesar Dressing & Parmesan",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-mushrooms-baked-in-a-cream-cheese-sauce-with-toa",section:"Lunch \xb7 Starters",name:"Mushrooms Baked in a Cream & Cheese Sauce with Toasted Ciabatta",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-smoked-haddock-salmon-chowder",section:"Lunch \xb7 Starters",name:"Smoked Haddock & Salmon Chowder",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Lunch \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-blackened-salmon-warm-potato-salad-a-pepper-must",section:"Lunch \xb7 Mains",name:"Blackened Salmon, Warm Potato Salad & a Pepper & Mustard Seed Dressing",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chicken-breast-coated-in-panko-crumb-with-a-ligh",section:"Lunch \xb7 Mains",name:"Chicken Breast Coated in Panko Crumb with a Lightly Spiced Sweet & Sour Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-fillet-of-pork-topped-with-banana-finished-with",section:"Lunch \xb7 Mains",name:"Fillet of Pork Topped with Banana Finished with a Creamy Coconut & Mango Curry Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-haddock-mornay-or-a-lemon-butter",section:"Lunch \xb7 Mains",name:"Haddock \u201cMornay\u201d or a Lemon Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chicken-piri-piri-szechuan-peppers-spices-served",section:"Lunch \xb7 Mains",name:"Chicken \u2018Piri-Piri\u2019 Szechuan Peppers & Spices served with a Yoghurt & Spring Onion Mayonnaise",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-lamb-fillet-with-a-cracked-black-pepper-cream-br",section:"Lunch \xb7 Mains",name:"Lamb Fillet with a Cracked Black Pepper Cream & Brandy Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00 \xb7 \xa32.00 supplement"},{id:"wi-lunch-pan-fried-fillet-of-hake-with-a-lobster-glaze",section:"Lunch \xb7 Mains",name:"Pan Fried Fillet of Hake with a Lobster Glaze",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-supreme-of-chicken-suedoise-white-wine-swiss-che",section:"Lunch \xb7 Mains",name:"Supreme of Chicken \u2018Suedoise\u2019 White Wine, Swiss Cheese, Cream & Mushrooms",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-spicy-chilli-with-rice-topped-with-onions-cheese",section:"Lunch \xb7 Mains",name:"Spicy Chilli with Rice Topped with Onions & Cheese",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-haddock-in-breadcrumbs-or-tempura-served-with-ta",section:"Lunch \xb7 Mains",name:"Haddock in Breadcrumbs or Tempura served with Tartar Sauce & Lemon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-lambs-liver-bacon",section:"Lunch \xb7 Mains",name:"Lambs Liver & Bacon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-any-extra-servings",section:"Lunch \xb7 Mains",name:"Any Extra Servings",description:"Each extra serving",price:395,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-dinner-tiger-prawns-tempura-with-a-sweet-chilli-dip",section:"Dinner \xb7 Starters",name:"Tiger Prawns Tempura with a Sweet Chilli Dip",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-smoked-haddock-bacon-gratin-with-braised-rice",section:"Dinner \xb7 Starters",name:"Smoked Haddock & Bacon Gratin with Braised Rice",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Dinner \xb7 Starters",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-spiced-chicken-salad-with-caesar-dressing-parmes",section:"Dinner \xb7 Starters",name:"Spiced Chicken Salad with Caesar Dressing & Parmesan",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-chefs-pate-with-grape-chutney-toast",section:"Dinner \xb7 Starters",name:"Chefs Pate with Grape Chutney & Toast",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-melon-fan-with-fresh-fruits-sorbet-mango-coulis",section:"Dinner \xb7 Starters",name:"Melon Fan with Fresh Fruits, Sorbet & Mango Coulis",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-smoked-haddock-salmon-chowder",section:"Dinner \xb7 Starters",name:"Smoked Haddock & Salmon Chowder",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Dinner \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-pear-poached-in-grenadine-with-prawns-marie-rose",section:"Dinner \xb7 Starters",name:"Pear Poached in Grenadine with Prawns Marie Rose",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-crayfish-avocado-melon-cocktail",section:"Dinner \xb7 Starters",name:"Crayfish, Avocado & Melon Cocktail",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-blackened-sea-bass-served-with-mixed-salad-a-swe",section:"Dinner \xb7 Mains",name:"Blackened Sea Bass served with Mixed Salad & a Sweet Pepper Vinaigrette",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-roast-rack-of-lamb-minted-peas-pan-juices",section:"Dinner \xb7 Mains",name:"Roast Rack of Lamb, Minted Peas & Pan Juices",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa32.50 supplement"},{id:"wi-dinner-roast-breast-of-duck-with-a-pink-peppercorn-bran",section:"Dinner \xb7 Mains",name:"Roast Breast of Duck with a Pink Peppercorn & Brandy Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-supreme-of-chicken-suedoise-white-wine-swiss-che",section:"Dinner \xb7 Mains",name:"Supreme of Chicken \u2018Suedoise\u2019 White Wine, Swiss Cheese, Cream & Mushrooms",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-lambs-liver-bacon-with-a-red-wine-jus",section:"Dinner \xb7 Mains",name:"Lambs Liver & Bacon with a Red Wine Jus",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-haddock-mornay-or-a-lemon-butter",section:"Dinner \xb7 Mains",name:"Haddock \u201cMornay\u201d or a Lemon Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-entrecote-steak-with-large-onion-rings-a-choice",section:"Dinner \xb7 Mains",name:"Entrecote Steak with Large Onion Rings & a Choice of Sauces",description:"Diane, Pepper or Caf\xe9 de Paris",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa38.00 supplement"},{id:"wi-dinner-haddock-in-breadcrumbs-or-tempura-served-with-ta",section:"Dinner \xb7 Mains",name:"Haddock in Breadcrumbs or Tempura served with Tartar Sauce & Lemon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-fillet-of-salmon-chicken-with-two-sauces-lobster",section:"Dinner \xb7 Mains",name:"Fillet of Salmon & Chicken with Two Sauces - \u2018Lobster\u2019 & White Wine Cream & Mushroom",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-fillet-steak-with-a-cracked-black-pepper-cream-s",section:"Dinner \xb7 Mains",name:"Fillet Steak with a Cracked Black Pepper & Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa312.00 supplement"},{id:"wi-dinner-fillet-of-pork-on-a-haggis-cake-with-a-mustard-g",section:"Dinner \xb7 Mains",name:"Fillet of Pork on a Haggis Cake with a Mustard Grain Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-wildings-chicken-schnitzel-topped-with-garlic-he",section:"Dinner \xb7 Mains",name:"Wildings Chicken Schnitzel Topped with Garlic & Herb Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-spicy-chilli-with-rice-topped-with-onions-cheese",section:"Dinner \xb7 Mains",name:"Spicy Chilli with Rice Topped with Onions & Cheese",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-any-extra-servings",section:"Dinner \xb7 Mains",name:"Any Extra Servings",description:"Each extra serving",price:395,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-vegetarian-roast-red-pepper-tomato-soup",section:"Vegetarian \xb7 Starters",name:"Roast Red Pepper & Tomato Soup",description:"",price:null,dietary:["GF option"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Vegetarian \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-melon-fan-with-sorbet-fruit-coulis",section:"Vegetarian \xb7 Starters",name:"Melon Fan with Sorbet & Fruit Coulis",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-mushrooms-baked-in-a-cream-cheese-sauce-with-toa",section:"Vegetarian \xb7 Starters",name:"Mushrooms Baked in a Cream & Cheese Sauce with Toasted Ciabatta",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Vegetarian \xb7 Mains",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-cajun-vegetables-crepe-glazed-in-a-cream-sauce",section:"Vegetarian \xb7 Mains",name:"Cajun Vegetables Crepe Glazed in a Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-vegan-curried-chickpea-with-cherry-tomatoes-wilt",section:"Vegetarian \xb7 Mains",name:"Vegan Curried Chickpea with Cherry Tomatoes & Wilted Spinach",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-vegetable-tempura",section:"Vegetarian \xb7 Mains",name:"Vegetable Tempura",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-mushroom-stroganoff-with-rice",section:"Vegetarian \xb7 Mains",name:"Mushroom Stroganoff with Rice",description:"",price:null,dietary:["GF option"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-sundried-tomato-feta-olive-tartlet-finished-with",section:"Vegetarian \xb7 Mains",name:"Sundried Tomato, Feta & Olive Tartlet, Finished with a Tomato Concasse & a Basil Dressing",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-sweets-trio-of-homemade-ice-creams",section:"Sweets \xb7 Desserts",name:"Trio of Homemade Ice Creams",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-cr-me-caramel-with-passion-fruit-ice-cream",section:"Sweets \xb7 Desserts",name:"Cr\xe8me Caramel with Passion Fruit Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-vanilla-cheesecake-with-strawberry-coulis-fresh",section:"Sweets \xb7 Desserts",name:"Vanilla Cheesecake with Strawberry Coulis & Fresh Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-sticky-toffee-pudding",section:"Sweets \xb7 Desserts",name:"Sticky Toffee Pudding",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-affogato",section:"Sweets \xb7 Desserts",name:"\u2018Affogato\u2019",description:"Wildings Ice Cream with a Shot of Espresso",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-chocolate-and-orange-liqueur-pot",section:"Sweets \xb7 Desserts",name:"Chocolate and Orange Liqueur Pot",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-rice-pudding-with-an-apple-compote",section:"Sweets \xb7 Desserts",name:"Rice Pudding with an Apple Compote",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-crepes-filled-with-bananas-and-maple-syrup",section:"Sweets \xb7 Desserts",name:"Crepes filled with Bananas and Maple Syrup",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-meringue-vacherin-with-a-berry-liqueur-compote",section:"Sweets \xb7 Desserts",name:"Meringue Vacherin with a Berry Liqueur Compote",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-bread-butter-pudding-with-pouring-cream",section:"Sweets \xb7 Desserts",name:"Bread & Butter Pudding with Pouring Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-selection-of-cheese-with-biscuits-grapes-chutney",section:"Sweets \xb7 Desserts",name:"Selection of Cheese with Biscuits, Grapes & Chutney",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"\xa33.00 supplement"},{id:"wi-sweets-tea",section:"Sweets \xb7 Hot drinks",name:"Tea",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-decaf-tea",section:"Sweets \xb7 Hot drinks",name:"Decaf Tea",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-espresso",section:"Sweets \xb7 Hot drinks",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-americano",section:"Sweets \xb7 Hot drinks",name:"Americano",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-latte",section:"Sweets \xb7 Hot drinks",name:"Latte",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-flat-white",section:"Sweets \xb7 Hot drinks",name:"Flat White",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-cappuccino",section:"Sweets \xb7 Hot drinks",name:"Cappuccino",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-mocha",section:"Sweets \xb7 Hot drinks",name:"Mocha",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-irish-coffee",section:"Sweets \xb7 Hot drinks",name:"Irish Coffee",description:"",price:775,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-kids-cheesy-garlic-bread",section:"Kids \xb7 Starters",name:"Cheesy Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-melon-sorbet",section:"Kids \xb7 Starters",name:"Melon & Sorbet",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-soup-of-the-day",section:"Kids \xb7 Starters",name:"Soup of the Day",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-breaded-haddock",section:"Kids \xb7 Mains",name:"Breaded Haddock",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-pasta-with-a-cheese-sauce-or-tomato-sauce",section:"Kids \xb7 Mains",name:"Pasta with a Cheese Sauce or Tomato Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-fish-pie",section:"Kids \xb7 Mains",name:"Fish Pie",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-tempura-chicken-goujons",section:"Kids \xb7 Mains",name:"Tempura Chicken Goujons",description:"All can be served with Fries and a choice of Beans or Vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-homemade-ice-cream",section:"Kids \xb7 Dessert",name:"Homemade Ice Cream",description:"Please ask Staff for Our Ice Cream Selection",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"}].map(s=>({...s,restaurantId:"wildings",soldOut:!1,signOff:null}))},1209,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SECTIONS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anchorageMenu",{enumerable:!0,get:function(){return o}});const i=i=>({id:i,name:'Served with',required:!0,multi:!1,choices:[{id:`${i}-custard`,label:'Custard',priceDelta:0,allergens:{}},{id:`${i}-icecream`,label:'Ice cream',priceDelta:0,allergens:{}},{id:`${i}-cream`,label:'Cream',priceDelta:0,allergens:{}},{id:`${i}-vegan`,label:'Vegan ice cream (ask server)',priceDelta:0,allergens:{}}]}),s=(i,s,n)=>({id:i,name:'Portion',required:!0,multi:!1,choices:[{id:`${i}-starter`,label:'Starter',priceDelta:0},{id:`${i}-main`,label:n,priceDelta:s}]}),n=[{id:'a-soup',section:'Starters',name:"Chef's Soup of the Day",description:'A heartwarming bowl of seasonal homemade soup, served with warm crusty bread and butter.',price:600,dietary:[],allergens:{},allergenNotes:'Recipe changes daily \u2014 check the day\u2019s soup.',prepMins:0},{id:'a-skink',section:'Starters',name:'Cullen Skink',description:'Traditional creamy soup made with locally smoked haddock, potatoes and leeks, served with warm crusty bread and butter.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-salmon',section:'Starters',name:'Scottish Smoked Salmon Roulade',description:'Delicate Scottish smoked salmon rolled with herb-infused cream cheese, served with garlic & herb crostini and dressed salad.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-haggis',section:'Starters',name:'Haggis Bon Bons',description:'Crisp golden panko-fried haggis balls, finished with a velvety Scotch whisky sauce and caramelised apple gel.',price:800,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-crabcakes',section:'Starters',name:'Spiced Crab Cakes',description:'Golden crab cakes, delicately seasoned with herbs and spices, served with crisp seasonal salad and house-made Marie Rose sauce.',price:900,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-tempura',section:'Starters',name:'Deluxe Mixed Tempura',description:"King prawns, chicken and lion's mane mushrooms in a light, crispy tempura batter, served with a dressed seasonal salad and house dipping sauce.",price:1e3,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[s('tempura',900,'Main with triple-cooked chips (\xa319.00)')]},{id:'a-kingoyster',section:'Starters',name:"Pan-Seared King Oyster Mushroom 'Scallops' (VG)",description:"King oyster mushroom 'scallops' prepared with the chef's special recipe of the day. Ask your server or see our specials board for today's garnish and accompaniments.",price:1e3,dietary:['VG'],allergens:{},allergenNotes:'Garnish changes daily \u2014 sign-off needed for each version.',prepMins:0,special:!0,unsigned:!0,optionGroups:[s('kingoyster',800,'Main (\xa318.00)')]},{id:'a-fishsupper',section:'Mains',name:'Fish Supper',description:'Locally landed haddock, available beer-battered or breaded, served with buttered peas, triple-cooked chips and homemade tartare sauce.',price:1800,dietary:['GF option'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'fs-coat',name:'Coating',required:!0,multi:!1,choices:[{id:'fs-batter',label:'Beer-battered',priceDelta:0},{id:'fs-bread',label:'Breaded',priceDelta:0}]}]},{id:'a-lionsmane',section:'Mains',name:"Southern Fried Lion's Mane Burger (VG)",description:"Crispy southern fried lion's mane mushroom, layered with vegan cheese and garlic aioli, served with triple-cooked chips and golden onion rings.",price:1800,dietary:['VG'],allergens:{},prepMins:0},{id:'a-pie',section:'Mains',name:'Steak & Ale Pie',description:'Slow-braised beef in a rich ale jus beneath golden all-butter puff pastry, served with buttered seasonal vegetables.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'pie-side',name:'Served with',required:!0,multi:!1,choices:[{id:'chips',label:'Triple-cooked chips',priceDelta:0},{id:'creamed',label:'Creamed potatoes',priceDelta:0,allergens:{}}]}]},{id:'a-bananablossom',section:'Mains',name:"Beer-Battered Banana Blossom 'Fish' Goujons (VG)",description:'Crisp beer-battered banana blossom goujons, dusted with locally foraged truffle seaweed seasoning, served with triple-cooked chips, garden peas and vegan tartare sauce.',price:1700,dietary:['VG'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-chicken',section:'Mains',name:'Roasted Breast of Chicken',description:'Golden pan-roasted chicken breast, served with creamed potatoes, buttered seasonal primaryBtns, and a fragrant lemon & thyme bouillon.',price:1900,dietary:[],allergens:{},prepMins:0},{id:'a-maccheese',section:'Mains',name:'Macaroni Cheese (V)',description:'Rich mature Cheddar macaroni finished with a golden cheese glaze, served with two slices of garlic bread.',price:1700,dietary:['V'],allergens:{},prepMins:0},{id:'a-penne',section:'Mains',name:'Cajun Chicken & Chorizo Penne Pasta',description:'Tender Cajun-spiced chicken strips, mixed peppers, red onion and smoky chorizo, tossed in a bold, creamy Cajun sauce, served with two slices of garlic bread.',price:1700,dietary:[],allergens:{},prepMins:0},{id:'a-caesar',section:'Mains',name:'Chicken Caesar Salad',description:'Tender pan-roasted chicken breast served on a bed of baby gem lettuce with golden garlic croutons, Parmesan and a classic Caesar dressing.',price:1800,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'caesar-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'caesar-bacon',label:'Add smoked Ayrshire bacon',priceDelta:150}]}]},{id:'a-moules',section:'Mains',name:'Moules Marini\xe8re',description:'Fresh Scottish mussels, steamed to perfection in a rich, creamy white wine and garlic sauce.',price:1200,dietary:[],allergens:{},prepMins:0,optionGroups:[s('moules',1e3,'Main 500g with triple-cooked chips (\xa322.00)')]},{id:'a-fillet',section:'From the Grill',name:'8oz Fillet Steak',description:'Prime 8oz fillet steak served with truffled woodland mushrooms, seasonal primaryBtns, golden onion rings and triple-cooked chips.',price:3800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'steak-sauce',name:'Sauce',required:!1,multi:!1,choices:[{id:'sauce-pepper',label:'Peppercorn sauce',priceDelta:0,allergens:{}},{id:'sauce-garlic',label:'Garlic butter',priceDelta:0,allergens:{}}]},{id:'steak-surf',name:'Surf & turf add-on',required:!1,multi:!1,choices:[{id:'surf-prawns',label:'Garlic prawns',priceDelta:800,allergens:{}},{id:'surf-scallops',label:'Scottish West Coast scallops',priceDelta:1e3,allergens:{}}]}]},{id:'a-claymore',section:'From the Grill',name:'The Claymore Burger',description:'One juicy 6oz homemade Scottish beef burger in a brioche bun with baby gem lettuce, tomato and gherkins, topped with cheese, smoked Ayrshire bacon and onion rings. Served with triple-cooked chips.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'claymore-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'claymore-haggis',label:'Add haggis and whisky sauce',priceDelta:150,allergens:{}}]}]},{id:'a-langoustines',section:"Captain's Table",name:'Whole Scottish Grilled Langoustines',description:'Locally caught whole Scottish langoustines grilled in garlic butter, served with a vibrant side salad and burnt lemon.',price:1700,dietary:[],allergens:{},prepMins:0,optionGroups:[s('lang',1200,'Main 500g with triple-cooked chips (\xa329.00)')]},{id:'a-scallops',section:"Captain's Table",name:'Pan-Seared West Coast Scallops',description:"Scottish West Coast scallops prepared to the chef's recipe of the day. Starter and main portions \u2014 see price on Specials Board.",price:null,priceNote:'See specials board',dietary:[],allergens:{},prepMins:0,special:!0,unsigned:!0},{id:'a-lobster',section:"Captain's Table",name:'Grilled Dunure Lobster',description:'Fresh Dunure lobster, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:3500,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'lobster-size',name:'Size',required:!0,multi:!1,choices:[{id:'lob-half',label:'Half',priceDelta:0},{id:'lob-whole',label:'Whole (\xa365.00)',priceDelta:3e3}]}]},{id:'a-crab',section:"Captain's Table",name:'Grilled Dunure Crab',description:'Freshly landed Dunure brown crab, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:4e3,dietary:[],allergens:{},prepMins:0},{id:'a-smorgasbord',section:'Platters',name:'Seafood Smorgasbord (serves one)',description:"250g langoustines, 3 pan-seared West Coast scallops, 250g fresh mussels, 6 garlic prawns and a roll of Scottish smoked salmon, with dressed side salad and warm crusty bread.",price:5e3,dietary:[],allergens:{},prepMins:0},{id:'a-deluxe',section:'Platters',name:'Deluxe Seafood Platter (serves two)',description:'One whole Dunure lobster, one whole Dunure crab, 500g whole langoustines, 500g moules marini\xe8re, pan-seared scallops, Scottish smoked salmon and 6 garlic prawns, with two portions of chips, side salad and warm crusty bread.',price:16500,dietary:[],allergens:{},prepMins:0},{id:'a-onionrings',section:'Sides',name:'House Beer-Battered Onion Rings (V)',description:'Crisp house beer-battered onion rings, served golden and crunchy.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-garlicbread',section:'Sides',name:'Garlic Bread (V)',description:'Warm toasted garlic bread, finished with garlic & parsley butter.',price:450,dietary:['V'],allergens:{},prepMins:0,optionGroups:[{id:'gb-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'gb-cheese',label:'Add cheese',priceDelta:100}]}]},{id:'a-chips',section:'Sides',name:'Triple-Cooked Chips (V)',description:'Golden triple-cooked chips, lightly tossed in Maldon sea salt.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'chips-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'chips-cajun',label:'Add Cajun seasoning',priceDelta:0,allergens:{}}]}]},{id:'a-truffle',section:'Sides',name:'Parmesan & Truffle Fries (V)',description:'Crispy fries topped with finely grated parmesan and tossed in a winter truffle infused oil.',price:500,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-salad',section:'Sides',name:'Side Salad (VG)',description:'Seasonal mixed leaves with cucumber, red onion and mixed peppers, finished with a light vinaigrette.',price:450,dietary:['VG'],allergens:{},prepMins:0},{id:'a-brulee',section:'Desserts',name:"Chef's Cr\xe8me Br\xfbl\xe9e of the Day (V)",description:"Smooth Madagascan custard with a delicately caramelised sugar crust. Ask your server or see our specials board for today's flavour.",price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-crumble',section:'Desserts',name:'Seasonal Fruit Crumble (V)',description:'Slow-cooked seasonal fruit topped with a golden buttery crumble.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('crumble')]},{id:'a-stp',section:'Desserts',name:'Sticky Toffee Pudding (V)',description:'A rich, homemade steamed date pudding, drenched in our signature homemade butterscotch sauce.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('stp')]},{id:'a-cheesecake',section:'Desserts',name:'Cheesecake of the Day (V)',description:'A smooth, creamy cheesecake on a buttery biscuit base. Gluten-free and vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('cheesecake')]},{id:'a-affogato',section:'Desserts',name:'Affogato (V)',description:'Two scoops of creamy vanilla ice cream with a freshly brewed shot of Italian espresso poured over. Vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0}],t=['Starters','Mains','From the Grill',"Captain's Table",'Platters','Sides','Desserts','Mini Anchors (under 12s)'],o=n.map(({unsigned:i,soldOut:s,...n})=>({...n,allergens:{},allergenNotes:'',prepMins:0,optionGroups:n.optionGroups?.map(i=>({...i,choices:i.choices.map(i=>({...i,allergens:{}}))})),restaurantId:"anchorage",soldOut:!!s,signOff:null}))},1210,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SCOTTISH_BANK_HOLIDAYS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"BANK_HOLIDAY_SOURCE",{enumerable:!0,get:function(){return n}});const t=[{date:"2026-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2026-12-25",title:"Christmas Day",notes:""},{date:"2026-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2027-01-01",title:"New Year\u2019s Day",notes:""},{date:"2027-01-04",title:"2nd January",notes:"Substitute day"},{date:"2027-03-26",title:"Good Friday",notes:""},{date:"2027-05-03",title:"Early May bank holiday",notes:""},{date:"2027-05-31",title:"Spring bank holiday",notes:""},{date:"2027-08-02",title:"Summer bank holiday",notes:""},{date:"2027-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2027-12-27",title:"Christmas Day",notes:"Substitute day"},{date:"2027-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2028-01-03",title:"New Year\u2019s Day",notes:"Substitute day"},{date:"2028-01-04",title:"2nd January",notes:"Substitute day"},{date:"2028-04-14",title:"Good Friday",notes:""},{date:"2028-05-01",title:"Early May bank holiday",notes:""},{date:"2028-05-29",title:"Spring bank holiday",notes:""},{date:"2028-08-07",title:"Summer bank holiday",notes:""},{date:"2028-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2028-12-25",title:"Christmas Day",notes:""},{date:"2028-12-26",title:"Boxing Day",notes:""}],n='gov.uk/bank-holidays.json (Scotland)'},1211,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MESSAGING_CONFIG",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"previewProvider",{enumerable:!0,get:function(){return t}}),_e.relayProvider=n,Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"activeProvider",{enumerable:!0,get:function(){return s}});const e={mode:'preview',endpoint:'',smsService:'Twilio',emailService:'Postmark',smsSenderId:'ANCHORAGE',fromEmail:'bookings@your-venue.co.uk'},t={id:'preview',label:'Preview mode (nothing is sent)',live:!1,deliver:async()=>({ok:!0})};function n(e){return{id:'relay',label:'Your messaging server',live:!0,deliver:async t=>{try{const n=await fetch(e,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({channel:t.channel,to:t.to,subject:t.subject,body:t.body,html:t.html,ref:t.ref,kind:t.kind,restaurantId:t.restaurantId})});if(!n.ok)return{ok:!1,error:`Server said ${n.status}`};return{ok:!0,providerId:(await n.json().catch(()=>({}))).id}}catch(e){return{ok:!1,error:e?.message??'Network error'}}}}}const o=()=>'live'===e.mode&&!!e.endpoint,s=()=>o()?n(e.endpoint):t},1212,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"DEFAULT_TEMPLATES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PLACEHOLDERS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"teamName",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"longDate",{enumerable:!0,get:function(){return u}}),e.bookingVars=function(n,r){const o=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen).toLowerCase()}`).join(', '),a=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),i=`${n.partySize} ${1===n.partySize?'person':'people'}`,s={...c(r),first:l(n.name),name:n.name.trim(),date:u(n.date),time:n.time,covers:i,ref:n.ref};return{sms:{...s,allergy:n.allergies.length?` We\u2019ve noted the allergy (${o}) and the team will check it with you when you arrive.`:'',note:'',details:''},email:{...s,allergy:n.allergies.length?`Thank you for telling us about: ${a}. Our team will go through this with you when you arrive, and every dish for your table is checked at each step, from the kitchen to your table.`:'',note:n.notes.trim()?`Your note to us: "${n.notes.trim()}". We\u2019ll make sure the team sees it.`:'',details:[`Date: ${u(n.date)}`,`Time: ${n.time}`,`Table for: ${i}`,`Reference: ${n.ref}`].join('\n')}}},e.orderVars=function(r,o){const a=r.lines.reduce((t,n)=>t+n.qty,0),i=r.readyBy??r.slotTime,s=i?`at ${m(i)}`:'time to be confirmed',d=r.allergies.map(n=>(0,t.allergenLabel)(n.allergen).toLowerCase()).join(', '),u=r.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),y={...c(o),first:l(r.customerName),name:r.customerName,ref:r.ref,items:`${a} ${1===a?'item':'items'}`,total:(0,n.gbp)(r.total),collect:s,date:'',time:i?m(i):'',covers:''};return{sms:{...y,allergy:r.allergies.length?` We\u2019ve noted your allergy (${d}); the kitchen checks every item.`:'',itemList:'',details:'',note:''},email:{...y,allergy:r.allergies.length?`You told us about: ${u}. The kitchen signs off every item against it before your order leaves the pass.`:'',itemList:r.lines.map(t=>`${t.qty} \xd7 ${t.name}${t.choices.length?` (${t.choices.join(', ')})`:''}`).join('\n'),details:[`Order: ${r.ref}`,`Collection: ${i?m(i):'time to be confirmed'}`,`Items: ${a}`,`Total: ${(0,n.gbp)(r.total)}`].join('\n'),note:''}}},e.fill=y,Object.defineProperty(e,"fillEmailText",{enumerable:!0,get:function(){return h}}),e.emailHtml=function(t,n){const r=n.accent??'#B8893E',o=t.split(/\n{2,}/).map(t=>{const n=t.split('\n');return n.length>1&&n.every(t=>/^[^:]{2,22}:\s.+/.test(t))?`${n.map(t=>{const n=t.indexOf(':');return``}).join('')}
${p(t.slice(0,n))}${p(t.slice(n+1).trim())}
`:n.length>1&&n.every(t=>/^\d+ \xd7/.test(t))?`
    ${n.map(t=>`
  • ${p(t)}
  • `).join('')}
`:`

${n.map(p).join('
')}

`}).join('');return`${p(n.preheader??'')}
${p(n.venue.toUpperCase())}
${o}
You\u2019re getting this because you made a booking or order with ${p(n.venue)}. It\u2019s about your booking only, not marketing.
`},e.smsParts=function(t){const n=b(t),r=!f.test(n),o=n.length,a=r?o<=70?1:Math.ceil(o/67):o<=160?1:Math.ceil(o/153);return{chars:o,parts:a,unicode:r}},Object.defineProperty(e,"toGsm",{enumerable:!0,get:function(){return b}});var t=_r(_d[0]),n=_r(_d[1]);const r={booking:{title:'Booking confirmed',when:'Every booking: online, phone or in person (and when you confirm a request)'},request:{title:'Booking request received',when:'Online bookings that need you to confirm them first'},declined:{title:'Booking request declined',when:'When you decline a booking request'},order:{title:'Takeaway order confirmed',when:'Every takeaway order from the app (and phone orders with a number)'}},o={booking:{sms:'Hi {first}, you\u2019re booked in at {venue}: {date} at {time}, {covers}. Ref {ref}.{allergy} Need to change or cancel? Just call {venuePhone}. See you soon, {team}',subject:'You\u2019re booked in at {venue}: {date} at {time}',body:'Hi {first},\n\nThank you for booking with us. We\u2019re really looking forward to welcoming you.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf your plans change, just give us a ring on {venuePhone} and we\u2019ll happily move or cancel it for you. Please quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nWarm wishes,\n{team}'},request:{sms:'Hi {first}, thanks for your booking request at {venue} for {date} at {time}, {covers}. We\u2019ll text you shortly to confirm. Ref {ref}. Questions? Call {venuePhone}. {team}',subject:'We\u2019ve got your booking request for {date}',body:'Hi {first},\n\nThank you for your booking request. A member of the team will look at it and confirm with you very shortly.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf you have any questions in the meantime, call us on {venuePhone} and quote {ref}.\n\nWarm wishes,\n{team}'},declined:{sms:'Hi {first}, we\u2019re so sorry, we can\u2019t fit {covers} in on {date} at {time}. Please call {venuePhone} and we\u2019ll do our best to find another time. {team}',subject:'About your booking request for {date}',body:'Hi {first},\n\nThank you for asking to book with us. We\u2019re really sorry, but we can\u2019t fit your party in on {date} at {time}.\n\nWe\u2019d love to find another time that works. Give us a ring on {venuePhone} and we\u2019ll do our best.\n\nWith apologies and warm wishes,\n{team}'},order:{sms:'Hi {first}, thanks for your order {ref} from {venue}: {items}, {total}. Collection {collect}.{allergy} Questions? Call {venuePhone}. {team}',subject:'Your {venue} order {ref}',body:'Hi {first},\n\nThank you for your order. The kitchen has it and we\u2019ll have it ready for you.\n\n{details}\n\n{itemList}\n\n{allergy}\n\nAny questions, or need to change something? Call us on {venuePhone} and quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nEnjoy!\n{team}'}},a=[{key:'first',what:'Guest\u2019s first name'},{key:'name',what:'Name on the booking'},{key:'venue',what:'Venue name'},{key:'date',what:'Day and date'},{key:'time',what:'Time'},{key:'covers',what:'e.g. 4 people'},{key:'ref',what:'Reference'},{key:'venuePhone',what:'Venue phone'},{key:'address',what:'Venue address'},{key:'team',what:'e.g. The Anchorage team'},{key:'allergy',what:'Allergy reassurance (only if one was noted)'},{key:'note',what:'Their note (email only)'},{key:'details',what:'Details box (email only)'},{key:'items',what:'Orders: e.g. 3 items'},{key:'total',what:'Orders: total'},{key:'collect',what:'Orders: collection time'},{key:'itemList',what:'Orders: list of items (email)'}],i=t=>/^the\s/i.test(t.trim())?`${t.trim()} team`:`The ${t.trim()} team`,l=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||'there',s=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=['January','February','March','April','May','June','July','August','September','October','November','December'],u=t=>{const[n,r,o]=t.split('-').map(Number),a=new Date(n,r-1,o,12);return`${s[a.getDay()]} ${o} ${d[r-1]}`},m=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`};function c(t){return{venue:t.name,venuePhone:t.phone||'the restaurant',address:t.address||t.location,team:i(t.name)}}function y(t,n){return t.replace(/\{(\w+)\}/g,(t,r)=>r in n?n[r]:t).replace(/[ \t]{2,}/g,' ').replace(/ +([.,])/g,'$1').trim()}const h=(t,n)=>y(t,n).split(/\n{2,}/).map(t=>t.trim()).filter(Boolean).join('\n\n'),p=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"');const f=/^[A-Za-z0-9 \r\n@\xa3$\xa5\xe8\xe9\xf9\xec\xf2\xc7\xd8\xf8\xc5\xe5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\xc6\xe6\xdf\xc9!"#\xa4%&'()*+,\-./:;<=>?\xa1\xc4\xd6\xd1\xdc\xa7\xbf\xe4\xf6\xf1\xfc\xe0^{}\\[~\]|\u20ac]*$/;const b=t=>t.replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').replace(/[\u2013\u2014]/g,'-').replace(/\u2026/g,'...').replace(/\xd7/g,'x')},1213,[819,820]); +__d(function(g,_r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PHONE_ERROR",{enumerable:!0,get:function(){return s}}),e.ukPhone=function(s){if(!(s??'').trim())return{ok:!1,error:t};const o=n(r(s));return'bad'in o?{ok:!1,error:'chars'===o.bad?'Please use numbers only, for example 07700 900123.':'That doesn\u2019t look like a UK mobile or landline. For example 07700 900123 or 01292 502826.'}:o},e.guestPhone=function(o){if(!(o??'').trim())return{ok:!1,error:t};const u=r(o);if(/^(\+44|0044)/.test(u)||/^44\d{10}$/.test(u)||!/^(\+|00)/.test(u)){const t=n(u);return'bad'in t?{ok:!1,error:s}:t}const d=u.replace(/^(\+|00)/,'');if(!/^[1-9]\d+$/.test(d))return{ok:!1,error:s};const h=d.slice(0,l(d));let $=d.slice(h.length);$.startsWith('0')&&'39'!==h&&($=$.slice(1));return $.length<7||$.length>15||h.length+$.length>15?{ok:!1,error:s}:{ok:!0,e164:`+${h}${$}`,pretty:`+${h} ${c($)}`,kind:'international'}},e.emailOk=function(t){const s=(t??'').trim();return!s||/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s)};const t='A phone number is needed so we can send the confirmation.',s='That doesn\u2019t look like a phone number. For example 07700 900123 or +971 56 411 2017.';function n(t){if(t.startsWith('+44')?t='0'+t.slice(3):t.startsWith('0044')?t='0'+t.slice(4):/^44\d{10}$/.test(t)&&(t='0'+t.slice(2)),t.startsWith('0(0)')&&(t=t.replace('0(0)','0')),t.startsWith('00')&&(t=t.slice(1)),!/^0\d+$/.test(t))return{bad:'chars'};const s=/^07\d{9}$/.test(t),n=/^0[1238]\d{8,9}$/.test(t);if(!s&&!n)return{bad:'shape'};const r=s?`${t.slice(0,5)} ${t.slice(5)}`:/^02/.test(t)?`${t.slice(0,3)} ${t.slice(3,7)} ${t.slice(7)}`:/^0(3|8)/.test(t)?`${t.slice(0,4)} ${t.slice(4,7)} ${t.slice(7)}`:`${t.slice(0,5)} ${t.slice(5)}`;return{ok:!0,e164:'+44'+t.slice(1),pretty:r,kind:s?'mobile':'landline'}}const r=t=>(t??'').trim().replace(/[\s\-().]/g,'');const o=new Set('20 27 30 31 32 33 34 36 39 40 41 43 44 45 46 47 48 49 51 52 53 54 55 56 57 58 60 61 62 63 64 65 66 81 82 84 86 90 91 92 93 94 95 98'.split(' ')),l=t=>/^[17]/.test(t)?1:o.has(t.slice(0,2))?2:3;function c(t){const s=[t.slice(-4)];let n=t.slice(0,-4);for(;n.length>3;)s.unshift(n.slice(-3)),n=n.slice(0,-3);return n&&s.unshift(n),s.join(' ')}},1214,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shallow",{enumerable:!0,get:function(){return c}});const t=t=>Symbol.iterator in t,n=t=>"entries"in t,o=(t,n)=>{const o=t instanceof Map?t:new Map(t.entries()),s=n instanceof Map?n:new Map(n.entries());if(o.size!==s.size)return!1;for(const[t,n]of o)if(!s.has(t)||!Object.is(n,s.get(t)))return!1;return!0},s=(t,n)=>{const o=t[Symbol.iterator](),s=n[Symbol.iterator]();let c=o.next(),u=s.next();for(;!c.done&&!u.done;){if(!Object.is(c.value,u.value))return!1;c=o.next(),u=s.next()}return!!c.done&&!!u.done};function c(c,u){return!!Object.is(c,u)||"object"==typeof c&&null!==c&&"object"==typeof u&&null!==u&&(Object.getPrototypeOf(c)===Object.getPrototypeOf(u)&&(t(c)&&t(u)?n(c)&&n(u)?o(c,u):s(c,u):o({entries:()=>Object.entries(c)},{entries:()=>Object.entries(u)})))}},1215,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setLiveData=c,e.requireRealData=function(){t=!0,c(!0)},Object.defineProperty(e,"liveData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"examplesAllowed",{enumerable:!0,get:function(){return l}}),e.onDataModeChange=function(n){return s.add(n),()=>{s.delete(n)}},Object.defineProperty(e,"EXAMPLE_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"notEnoughTip",{enumerable:!0,get:function(){return b}});const n=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("abbotsford");let t=n,o=n;const s=new Set;function c(n){o!==(n=t||n)&&(o=n,s.forEach(n=>n()))}const u=()=>o,l=()=>!o;const f='Example figures',b=n=>`Forecasts start once CoverCharge has ${1===n?'1 week':`${n} weeks`} of your bookings and cash-ups.`},1216,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EXAMPLE_TAG",{enumerable:!0,get:function(){return t}}),_e.exampleCards=function(t){return l.flatMap(l=>{const h=t.find(e=>e.id===l.menuItemId);if(!h)return[];return[{id:(0,e.uuidFrom)(`card:${h.restaurantId}:${h.id}`),restaurantId:h.restaurantId,menuItemId:h.id,dish:h.name,section:h.section,price:h.price,photo:l.photo,ingredients:o(l.menuItemId,l.ings),steps:l.steps,allergens:l.allergens,dismissed:l.dismissed??[],allergenNotes:l.notes,allergensConfirmed:{by:s.by,at:s.at},signOff:l.awaiting?null:s,wasLive:!0,origin:'example',version:l.awaiting?2:1,createdAt:n,updatedAt:l.awaiting?'2026-10-28T15:20:00.000Z':n,updatedBy:l.awaiting?'Example edit (demo)':s.by}]})},_e.importedCard=function(t,s){return{id:(0,e.uuidFrom)(`card:${t.restaurantId}:${t.id}`),restaurantId:t.restaurantId,menuItemId:t.id,dish:t.name,section:t.section,price:t.price,ingredients:[],steps:[],allergens:{...t.allergens},dismissed:[],allergenNotes:t.allergenNotes,allergensConfirmed:t.signOff?{by:t.signOff.by,at:t.signOff.at}:void 0,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at}:null,wasLive:!t.hidden||!!t.signOff,origin:'imported',version:1,createdAt:s,updatedAt:s,updatedBy:'Imported from the menu'}};var e=r(d[0]);const t='Example data',s={by:'Example sign-off (demo)',at:'2026-10-26T10:00:00.000Z'},n='2026-10-26T09:00:00.000Z',o=(e,t)=>t.map(([t,s,n],o)=>({id:`${e}-i${o}`,qty:t,unit:s,name:n})),l=[{menuItemId:'a-lobster',photo:'asset:lobster',ings:[['1','whole','Live Dunure lobster (c. 600 g, Kitty Fisher)'],['60','g','Garlic butter'],['\xbd','','Lemon, charred'],['60','g','Mixed leaves, cucumber and red onion'],['15','ml','House vinaigrette (Dijon mustard)'],['200','g','Triple-cooked chips']],steps:['Chill the lobster for 20 minutes, then dispatch humanely and split lengthways. Remove the stomach sac and the intestinal tract.','Crack the claws. Season the flesh and spoon over half the garlic butter.','Grill flesh side up for 6\u20138 minutes until just opaque; baste with the rest of the butter.','Char the lemon on the grill. Dress the salad at the pass.','Plate on the long board: lobster, claws alongside, salad, chips in the cone, lemon and a pot of the pan butter.'],allergens:{crustaceans:'contains',milk:'contains',mustard:'contains',gluten:'may',fish:'may'},notes:'Chips are cooked in a shared fryer (gluten, fish, crustaceans may be present).'},{menuItemId:'a-skink',photo:'asset:skink',ings:[['120','g','Smoked haddock, undyed'],['200','ml','Whole milk'],['20','g','Butter'],['60','g','Leek, sliced'],['40','g','Onion, diced'],['120','g','Floury potato, diced'],['1','tbsp','Parsley, chopped'],['1','slice','Crusty bread'],['10','g','Butter (portion)']],steps:['Poach the haddock in the milk for 5 minutes. Lift out, flake and keep the milk.','Sweat the leek and onion in the butter until soft, with no colour.','Add the potato and the poaching milk; simmer for 15 minutes until the potato breaks down.','Crush a third of the potato for body, return the haddock and season with pepper.','Serve in the warm bowl, parsley on top, bread and butter on the side.'],allergens:{fish:'contains',milk:'contains',gluten:'contains'}},{menuItemId:'a-fishsupper',photo:'asset:fishsupper',ings:[['200','g','Haddock fillet, locally landed'],['80','g','Self-raising flour'],['100','ml','Beer (lager)'],['250','g','Triple-cooked chips'],['80','g','Garden peas'],['10','g','Butter'],['40','g','Tartare sauce (mayonnaise, capers, gherkins)'],['\xbc','','Lemon']],steps:['Whisk the flour and cold beer to a thick batter; rest for 10 minutes.','Dust the haddock in flour, dip in the batter and lower into the fryer at 180 \xb0C for 5\u20136 minutes.','Fry the chips at 190 \xb0C until golden.','Warm the peas with the butter.','Plate the fish on the chips, peas in the ramekin, tartare and lemon on the side.'],allergens:{fish:'contains',gluten:'contains',eggs:'contains',milk:'contains',mustard:'may',crustaceans:'may',sulphites:'may'},notes:'Shared fryer. Tartare is made with mayonnaise (egg, may contain mustard). The beer in the batter may contain sulphites.'},{menuItemId:'a-moules',photo:'asset:moules',ings:[['500','g','Scottish rope mussels, cleaned'],['30','g','Butter'],['1','','Shallot, finely diced'],['2','cloves','Garlic, sliced'],['100','ml','Dry white wine'],['60','ml','Double cream'],['1','tbsp','Parsley, chopped'],['2','slices','Crusty bread']],steps:['Check every mussel: discard any that are cracked or stay open when tapped.','Sweat the shallot and garlic in the butter for 2 minutes.','Add the mussels and wine, cover and steam on a high heat for 3\u20134 minutes until they open.','Discard any that stay shut. Stir in the cream and parsley.','Serve in the deep bowl with the bread and an empty-shell bowl.'],allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',gluten:'contains'}},{menuItemId:'a-stp',photo:'asset:stp',awaiting:!0,ings:[['30','g','Medjool dates, chopped'],['40','ml','Boiling water'],['25','g','Butter'],['30','g','Dark muscovado sugar'],['1','','Egg (\xbd per portion)'],['35','g','Self-raising flour'],['60','ml','Butterscotch sauce (butter, cream, brown sugar)']],steps:['Soak the dates in the boiling water for 10 minutes, then blitz.','Cream the butter and sugar, beat in the egg, fold in the flour and the dates.','Steam in buttered moulds for 35 minutes.','Warm the butterscotch sauce.','Turn out, pour over the sauce and serve with the guest\u2019s choice of custard, ice cream or cream.'],allergens:{gluten:'contains',milk:'contains',eggs:'contains',sulphites:'may'},notes:'Dried dates may contain sulphites. Accompaniments are chosen at order (see the dish options).'}]},1217,[1177]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg",width:800,height:600,toString(){return this.uri}}},1218,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg",width:800,height:600,toString(){return this.uri}}},1219,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},1220,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},1221,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},1222,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAvatars",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),o=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]);const l=(0,s.create)()((0,n.persist)((e,t)=>({photos:{},log:[],clears:{},doneClear:t=>e(e=>{if(!e.clears?.[t])return e;const o={...e.clears};return delete o[t],{clears:o}}),setOwn:(t,o,s,n)=>{if(!t||t!==o||!s.startsWith('data:image/'))return!1;const l=(new Date).toISOString();return e(e=>({clears:Object.fromEntries(Object.entries(e.clears??{}).filter(([e])=>e!==o)),photos:{...e.photos,[o]:{dataUrl:s,at:l}},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'made',by:n,at:l},...e.log].slice(0,100)})),!0},reset:(o,s)=>{if(s.id!==o&&'staff'===s.role)return!1;if(!t().photos[o])return!1;const n={...t().photos};return delete n[o],e(e=>({photos:n,clears:{...e.clears??{},[o]:(new Date).toISOString()},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'reset',by:s.name,at:(new Date).toISOString()},...e.log].slice(0,100)})),!0}}),{name:'covercharge-avatars-v1',storage:(0,n.createJSONStorage)(()=>o.default),version:1}))},1223,[1188,993,1189]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FunctionRegion",{enumerable:!0,get:function(){return e.FunctionRegion}}),Object.defineProperty(_e,"FunctionsError",{enumerable:!0,get:function(){return e.FunctionsError}}),Object.defineProperty(_e,"FunctionsFetchError",{enumerable:!0,get:function(){return e.FunctionsFetchError}}),Object.defineProperty(_e,"FunctionsHttpError",{enumerable:!0,get:function(){return e.FunctionsHttpError}}),Object.defineProperty(_e,"FunctionsRelayError",{enumerable:!0,get:function(){return e.FunctionsRelayError}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return t.PostgrestError}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return r.StorageApiError}}),Object.defineProperty(_e,"SupabaseClient",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"createClient",{enumerable:!0,get:function(){return N}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]);Object.keys(n).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return n[e]}})});var r=_r(d[3]),s=_r(d[4]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});let o,i="";var c;if("undefined"!=typeof Deno)i="deno",o=null===(c=Deno.version)||void 0===c?void 0:c.deno;else if("undefined"!=typeof document)i="web";else if("undefined"!=typeof navigator&&"ReactNative"===navigator.product)i="react-native";else{var u;i="node",o="undefined"!=typeof process?null===(u=process.version)||void 0===u?void 0:u.replace(/^v/,""):void 0}const l=[`runtime=${i}`];o&&l.push(`runtime-version=${o}`);const h={headers:{"X-Client-Info":`supabase-js/2.109.0; ${l.join("; ")}`}},f={schema:"public"},p={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},b={},v={enabled:!1,respectSamplingDecision:!0};let y=null;function w(){return e=this,t=void 0,r=function*(){try{const e=yield(null===y&&(y=import("@opentelemetry/api").catch(()=>null)),y);if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch(e){return null}},new((n=void 0)||(n=Promise))(function(s,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function c(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,c)}u((r=r.apply(e,t||[])).next())});var e,t,n,r}function k(e){if(!e||"string"!=typeof e)return null;const t=e.split("-");if(4!==t.length)return null;const[n,r,s,o]=t;if(2!==n.length||32!==r.length||16!==s.length||2!==o.length)return null;const i=/^[0-9a-f]+$/i;return i.test(n)&&i.test(r)&&i.test(s)&&i.test(o)?"00000000000000000000000000000000"===r||"0000000000000000"===s?null:{version:n,traceId:r,parentId:s,traceFlags:o,isSampled:!(1&~parseInt(o,16))}:null}function O(e,t){if(!e||!t||0===t.length)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch(e){return!1}for(const e of t)try{if("string"==typeof e){if(T(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if("function"==typeof e&&e(n))return!0}catch(e){continue}return!1}function T(e,t){if(t===e)return!0;if(t.startsWith("*.")){const n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith("."+n)))return!0}return!1}function P(e){const t=[];try{const n=new URL(e);t.push(n.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=j(e,"string");return"symbol"==S(t)?t:t+""}function U(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;te?(...t)=>e(...t):(...e)=>fetch(...e),F=(e,t,n,r,s)=>{const o=C(r),i=Headers,c=!0===(null==s?void 0:s.enabled),u=!1!==(null==s?void 0:s.respectSamplingDecision),l=c?P(t):null;return async(t,r)=>{var s;const c=null!==(s=await n())&&void 0!==s?s:e;let h=new i(null==r?void 0:r.headers);if(h.has("apikey")||h.set("apikey",e),h.has("Authorization")||h.set("Authorization",`Bearer ${c}`),l){const e=await _(t,l,u);e&&(e.traceparent&&!h.has("traceparent")&&h.set("traceparent",e.traceparent),e.tracestate&&!h.has("tracestate")&&h.set("tracestate",e.tracestate),e.baggage&&!h.has("baggage")&&h.set("baggage",e.baggage))}return o(t,R(R({},r),{},{headers:h}))}};async function _(e,t,n){if(!O("string"==typeof e||e instanceof URL?e:e.url,t))return null;const r=await w();if(!r||!r.traceparent)return null;if(n){const e=k(r.traceparent);if(e&&!e.isSampled)return null}return r}function L(e){return"boolean"==typeof e?{enabled:e}:e}function I(e,t){var n,r,s,o,i,c;const{db:u,auth:l,realtime:h,global:f}=e,{db:p,auth:b,realtime:v,global:y}=t,w=L(e.tracePropagation),k=L(t.tracePropagation),O={db:R(R({},p),u),auth:R(R({},b),l),realtime:R(R({},v),h),storage:{},global:R(R(R({},y),f),{},{headers:R(R({},null!==(n=null==y?void 0:y.headers)&&void 0!==n?n:{}),null!==(r=null==f?void 0:f.headers)&&void 0!==r?r:{})}),tracePropagation:{enabled:null!==(s=null!==(o=null==w?void 0:w.enabled)&&void 0!==o?o:null==k?void 0:k.enabled)&&void 0!==s&&s,respectSamplingDecision:null===(i=null!==(c=null==w?void 0:w.respectSamplingDecision)&&void 0!==c?c:null==k?void 0:k.respectSamplingDecision)||void 0===i||i},accessToken:async()=>""};return e.accessToken?O.accessToken=e.accessToken:delete O.accessToken,O}function D(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((n=t).endsWith("/")?n:n+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var n}var K=class extends s.AuthClient{constructor(e){super(e)}},x=class{constructor(e,n,s){var o,i;this.supabaseUrl=e,this.supabaseKey=n;const c=D(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,l=I(null!=s?s:{},{db:f,realtime:b,auth:R(R({},p),{},{storageKey:u}),global:h,tracePropagation:v});var y;(this.settings=l,this.storageKey=null!==(o=l.auth.storageKey)&&void 0!==o?o:"",this.headers=null!==(i=l.global.headers)&&void 0!==i?i:{},l.accessToken)?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!==(y=l.auth)&&void 0!==y?y:{},this.headers,l.global.fetch);this.fetch=F(n,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(R({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new t.PostgrestClient(new URL("rest/v1",c).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new r.StorageClient(this.storageUrl.href,this.headers,this.fetch,null==s?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new e.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t,n=this;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return null!==(e=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:o,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,lockAcquireTimeout:f,skipAutoInitialize:p},b,v){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K({url:this.authUrl.href,headers:R(R({},y),b),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,fetch:v,lockAcquireTimeout:f,skipAutoInitialize:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new n.RealtimeClient(this.realtimeUrl.href,R(R({},e),{},{params:R(R({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,n){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===n?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=n,this.realtime.setAuth(n))}};const N=(e,t,n)=>new x(e,t,n);(function(){if("undefined"!=typeof window)return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(null==t)return!1;const n=t.match(/^v(\d+)\./);return!!n&&parseInt(n[1],10)<=18})()&&console.warn("\u26a0\ufe0f Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")},1224,[1225,1230,1231,1246,1248]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return n.FunctionsClient}}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t.FunctionsError}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return t.FunctionsFetchError}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return t.FunctionsHttpError}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return t.FunctionsRelayError}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return t.FunctionRegion}});var n=r(d[0]),t=r(d[1])},1225,[1226,1229]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]),o=r(d[2]);class s{constructor(t,{headers:s={},customFetch:c,region:l=o.FunctionRegion.Any}={}){this.url=t,this.headers=s,this.region=l,this.fetch=(0,n.resolveFetch)(c)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(n){return(0,t.__awaiter)(this,arguments,void 0,function*(t,n={}){var s;let c,l;try{const{headers:u,method:f,body:h,signal:p,timeout:y}=n;let b={},{region:F}=n;F||(F=this.region);const v=new URL(`${this.url}/${t}`);let w;F&&'any'!==F&&(b['x-region']=F,v.searchParams.set('forceFunctionRegion',F));const j=!!u&&Object.keys(u).some(t=>'content-type'===t.toLowerCase());h&&!j?'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer?(b['Content-Type']='application/octet-stream',w=h):'string'==typeof h?(b['Content-Type']='text/plain',w=h):'undefined'!=typeof FormData&&h instanceof FormData?w=h:(b['Content-Type']='application/json',w=JSON.stringify(h)):w=!h||'string'==typeof h||'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer||'undefined'!=typeof FormData&&h instanceof FormData?h:JSON.stringify(h);let O=p;y&&(l=new AbortController,c=setTimeout(()=>l.abort(),y),p?(O=l.signal,p.addEventListener('abort',()=>l.abort())):O=l.signal);const x=yield this.fetch(v.toString(),{method:f||'POST',headers:Object.assign(Object.assign(Object.assign({},b),this.headers),u),body:w,signal:O}).catch(t=>{throw new o.FunctionsFetchError(t)}),B=x.headers.get('x-relay-error');if(B&&'true'===B)throw new o.FunctionsRelayError(x);if(!x.ok)throw new o.FunctionsHttpError(x);let C,T=(null!==(s=x.headers.get('Content-Type'))&&void 0!==s?s:'text/plain').split(';')[0].trim();return C='application/json'===T?yield x.json():'application/octet-stream'===T||'application/pdf'===T?yield x.blob():'text/event-stream'===T?x:'multipart/form-data'===T?yield x.formData():yield x.text(),{data:C,error:null,response:x}}catch(t){return{data:null,error:t,response:t instanceof o.FunctionsHttpError||t instanceof o.FunctionsRelayError?t.context:void 0}}finally{c&&clearTimeout(c)}})}}},1226,[1227,1228,1229]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return G}}),_e.__extends=t,Object.defineProperty(_e,"__assign",{enumerable:!0,get:function(){return r}}),_e.__rest=n,_e.__decorate=o,_e.__param=a,_e.__esDecorate=i,_e.__runInitializers=c,_e.__propKey=u,_e.__setFunctionName=s,_e.__metadata=f,_e.__awaiter=l,_e.__generator=p,Object.defineProperty(_e,"__createBinding",{enumerable:!0,get:function(){return y}}),_e.__exportStar=_,_e.__values=d,_e.__read=h,_e.__spread=b,_e.__spreadArrays=v,_e.__spreadArray=w,_e.__await=m,_e.__asyncGenerator=g,_e.__asyncDelegator=O,_e.__asyncValues=j,_e.__makeTemplateObject=P,_e.__importStar=x,_e.__importDefault=T,_e.__classPrivateFieldGet=I,_e.__classPrivateFieldSet=D,_e.__classPrivateFieldIn=R,_e.__addDisposableResource=k,_e.__disposeResources=F,_e.__rewriteRelativeImportExtension=C;var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){return function(r,n){t(r,n,e)}}function i(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,s="getter"===u?"get":"setter"===u?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,y=r.length-1;y>=0;y--){var _={};for(var d in n)_[d]="access"===d?{}:n[d];for(var d in n.access)_.access[d]=n.access[d];_.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[y])("accessor"===u?{get:l.get,set:l.set}:l[s],_);if("accessor"===u){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(c=i(h.get))&&(l.get=c),(c=i(h.set))&&(l.set=c),(c=i(h.init))&&o.unshift(c)}else(c=i(h))&&("field"===u?o.unshift(c):l[s]=c)}f&&Object.defineProperty(f,n.name,l),p=!0}function c(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function b(){for(var e=[],t=0;t1||c(e,t)})},t&&(n[e]=t(n[e])))}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,s):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:!1}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=d(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){o(n,a,(t=e[r](t)).done,t.value)})}}function o(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},E=function(e){return E=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},E(e)};function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=E(e),n=0;nt?(...n)=>t(...n):(...t)=>fetch(...t)},1228,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return u}});class t extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class n extends t{constructor(t){super('Failed to send a request to the Edge Function','FunctionsFetchError',t)}}class s extends t{constructor(t){super('Relay Error invoking the Edge Function','FunctionsRelayError',t)}}class o extends t{constructor(t){super('Edge Function returned a non-2xx status code','FunctionsHttpError',t)}}var u;!(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(u||(u={}))},1229,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PostgrestBuilder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"PostgrestClient",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"PostgrestFilterBuilder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"PostgrestQueryBuilder",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PostgrestTransformBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});const e=e=>Math.min(1e3*2**e,3e4),t=[520,503],r=["GET","HEAD","OPTIONS"];var s=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function n(e,t){return new Promise(r=>{if(null==t?void 0:t.aborted)return void r();const s=setTimeout(()=>{null==t||t.removeEventListener("abort",n),r()},e);function n(){clearTimeout(s),r()}null==t||t.addEventListener("abort",n)})}function i(e,s,n,i){return!(!i||n>=3)&&(!!r.includes(e)&&!!t.includes(s))}var l=class{constructor(e){var t,r,s,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,this.shouldStripNulls=null!==(s=e.shouldStripNulls)&&void 0!==s&&s,this.urlLengthLimit=null!==(n=e.urlLengthLimit)&&void 0!==n?n:8e3,this.retryEnabled=null===(i=e.retry)||void 0===i||i,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if("text/csv"===this.headers.get("Accept"))throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(t,s){var l=this;if(void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const e=this.headers.get("Accept");"application/vnd.pgrst.object+json"===e?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):e&&"application/json"!==e||this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const o=this.fetch;let h=(async()=>{let t=0;for(;;){const u={};let c;l.headers.forEach((e,t)=>{u[t]=e}),t>0&&(u["X-Retry-Count"]=String(t));try{c=await o(l.url.toString(),{method:l.method,headers:u,body:JSON.stringify(l.body,(e,t)=>"bigint"==typeof t?t.toString():t),signal:l.signal})}catch(s){if("AbortError"===(null==s?void 0:s.name)||"ABORT_ERR"===(null==s?void 0:s.code))throw s;if(!r.includes(l.method))throw s;if(l.retryEnabled&&t<3){const r=e(t);t++,await n(r,l.signal);continue}throw s}if(i(l.method,c.status,t,l.retryEnabled)){var s,h;const r=null!==(s=null===(h=c.headers)||void 0===h?void 0:h.get("Retry-After"))&&void 0!==s?s:null,i=null!==r?1e3*Math.max(0,parseInt(r,10)||0):e(t);await c.text(),t++,await n(i,l.signal);continue}return await l.processResponse(c)}})();return this.shouldThrowOnError||(h=h.catch(e=>{var t;let r="",s="",n="";const i=null==e?void 0:e.cause;if(i){var l,o,h,u;const t=null!==(l=null==i?void 0:i.message)&&void 0!==l?l:"",s=null!==(o=null==i?void 0:i.code)&&void 0!==o?o:"";r=`${null!==(h=null==e?void 0:e.name)&&void 0!==h?h:"FetchError"}: ${null==e?void 0:e.message}`,r+=`\n\nCaused by: ${null!==(u=null==i?void 0:i.name)&&void 0!==u?u:"Error"}: ${t}`,s&&(r+=` (${s})`),(null==i?void 0:i.stack)&&(r+=`\n${i.stack}`)}else{var c;r=null!==(c=null==e?void 0:e.stack)&&void 0!==c?c:""}const p=this.url.toString().length;return"AbortError"===(null==e?void 0:e.name)||"ABORT_ERR"===(null==e?void 0:e.code)?(n="",s="Request was aborted (timeout or manual cancellation)",p>this.urlLengthLimit&&(s+=`. Note: Your request URL is ${p} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):"HeadersOverflowError"!==(null==i?void 0:i.name)&&"UND_ERR_HEADERS_OVERFLOW"!==(null==i?void 0:i.code)||(n="",s="HTTP headers exceeded server limits (typically 16KB)",p>this.urlLengthLimit&&(s+=`. Your request URL is ${p} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:r,hint:s,code:n},data:null,count:null,status:0,statusText:""}})),h.then(t,s)}async processResponse(e){var t=this;let r=null,n=null,i=null,l=e.status,o=e.statusText;if(e.ok){var h,u;if("HEAD"!==t.method){var c;const i=await e.text();if(""===i);else if("text/csv"===t.headers.get("Accept"))n=i;else if(t.headers.get("Accept")&&(null===(c=t.headers.get("Accept"))||void 0===c?void 0:c.includes("application/vnd.pgrst.plan+text")))n=i;else try{n=JSON.parse(i)}catch(e){if(r={message:i},n=null,t.shouldThrowOnError)throw new s({message:i,details:"",hint:"",code:""})}}const p=null===(h=t.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),f=null===(u=e.headers.get("content-range"))||void 0===u?void 0:u.split("/");p&&f&&f.length>1&&(i=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,i=null,l=406,o="Not Acceptable"):n=1===n.length?n[0]:null)}else{const i=await e.text();try{r=JSON.parse(i),Array.isArray(r)&&404===e.status&&(n=[],r=null,l=200,o="OK")}catch(t){404===e.status&&""===i?(l=204,o="No Content"):r={message:i}}if(r&&t.shouldThrowOnError)throw new s(r)}return{success:null===r,error:r,data:n,count:i,status:l,statusText:o}}returns(){return this}overrideTypes(){return this}},o=class extends l{throwOnError(){return super.throwOnError()}select(e){let t=!1;const r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":("\""===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.order`:"order",l=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const n=void 0===s?"offset":`${s}.offset`,i=void 0===s?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(i,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:n=!1,format:i="text"}={}){var l;const o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,n?"wal":null].filter(Boolean).join("|"),h=null!==(l=this.headers.get("Accept"))&&void 0!==l?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${h}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const h=new RegExp("[,()]");var u=class extends o{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let n="";"plain"===s?n="pl":"phrase"===s?n="ph":"websearch"===s&&(n="w");const i=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${n}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>void 0!==t).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},c=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=null!=t?t:{},n=r?"HEAD":"GET";let i=!1;const l=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":("\""===e&&(i=!i),e)).join(""),{url:o,headers:h}=this.cloneRequestState();return o.searchParams.set("select",l),s&&h.append("Prefer",`count=${s}`),new u({method:n,url:o,headers:h,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const{url:n,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),r||i.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);n.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:n,headers:i,schema:this.schema,body:e,fetch:null!==(s=this.fetch)&&void 0!==s?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!0}={}){var i;const{url:l,headers:o}=this.cloneRequestState();if(o.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&l.searchParams.set("on_conflict",t),s&&o.append("Prefer",`count=${s}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);l.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:l,headers:o,schema:this.schema,body:e,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const{url:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new u({method:"PATCH",url:s,headers:n,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new u({method:"DELETE",url:r,headers:s,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=p(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=f(e,"string");return"symbol"==p(t)?t:t+""}function v(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function P(e){for(var t=1;t0?(e,t)=>{const r=new AbortController,s=setTimeout(()=>r.abort(),n),i=null==t?void 0:t.signal;if(i){if(i.aborted)return clearTimeout(s),o(e,t);const n=()=>{clearTimeout(s),r.abort()};return i.addEventListener("abort",n,{once:!0}),o(e,P(P({},t),{},{signal:r.signal})).finally(()=>{clearTimeout(s),i.removeEventListener("abort",n)})}return o(e,P(P({},t),{},{signal:r.signal})).finally(()=>clearTimeout(s))}:o,this.retry=l}from(e){if(!e||"string"!=typeof e||""===e.trim())throw new Error("Invalid relation name: relation must be a non-empty string.");return new c(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:s=!1,count:n}={}){var i;let l;const o=new URL(`${this.url}/rpc/${e}`);let h;const c=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(c)),p=r&&Object.values(t).some(c);p?(l="POST",h=t):r||s?(l=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{o.searchParams.append(e,t)})):(l="POST",h=t);const f=new Headers(this.headers);return p?f.set("Prefer",n?`count=${n},return=minimal`:"return=minimal"):n&&f.set("Prefer",`count=${n}`),new u({method:l,url:o,headers:f,schema:this.schemaName,body:h,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},w={PostgrestClient:$,PostgrestQueryBuilder:c,PostgrestFilterBuilder:u,PostgrestTransformBuilder:o,PostgrestBuilder:l,PostgrestError:s}},1230,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RealtimePresence",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"RealtimeChannel",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(_e,"RealtimeClient",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return n.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e,"postgresChangesFilter",{enumerable:!0,get:function(){return n.postgresChangesFilter}}),Object.defineProperty(_e,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n.REALTIME_LISTEN_TYPES}}),Object.defineProperty(_e,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return n.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return u.REALTIME_PRESENCE_LISTEN_EVENTS}}),Object.defineProperty(_e,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return n.REALTIME_SUBSCRIBE_STATES}}),Object.defineProperty(_e,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return n.REALTIME_CHANNEL_STATES}}),Object.defineProperty(_e,"WebSocketFactory",{enumerable:!0,get:function(){return l.default}});var t=e(r(d[0])),n=r(d[1]),E=e(n),u=r(d[2]),o=e(u),l=e(r(d[3]))},1231,[1232,1238,1239,1233]); +__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,"default",{enumerable:!0,get:function(){return f}});var t=e(r(d[0])),n=r(d[1]),s=e(r(d[2])),o=r(d[3]),c=e(r(d[4])),l=e(r(d[5]));const h=25e3,u=[1e3,2e3,5e3,1e4];function k(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem:t=>e.has(t)?e.get(t):null,key(t){var n;return null!==(n=Array.from(e.keys())[t])&&void 0!==n?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function p(){try{if('undefined'!=typeof globalThis&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(e){}return k()}class f{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint='',this.headers={},this.params={},this.ref=0,this.serializer=new s.default,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey))throw new Error('API key is required to connect to Realtime');this.apiKey=t.params.apikey;const c=this._initializeOptions(t);this.socketAdapter=new l.default(e,c),this.httpEndpoint=(0,o.httpEndpointURL)(e),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely('connect'),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const t=e.message;if(t.includes('Node.js'))throw new Error(`${t}\n\nTo use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n npm install ws\n\n import ws from "ws"\n const client = new RealtimeClient(url, {\n ...options,\n transport: ws\n })`);throw new Error(`WebSocket not available: ${t}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return this._cancelPendingDisconnect(),this.isDisconnecting()?'ok':await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return'ok'===t&&e.teardown(),t}async removeAllChannels(){const e=this.channels.map(async e=>{const t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,n){this.socketAdapter.log(e,t,n)}connectionState(){return this.socketAdapter.connectionState()||n.CONNECTION_STATE.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(e=>e.topic===n);if(s)return s;{const n=new c.default(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(n),n}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),0===this.channels.length&&(this.log('transport','no channels remaining, scheduling disconnect'),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),0===this._disconnectOnEmptyChannelsAfterMs)return this.log('transport','disconnecting immediately - no channels'),void this.disconnect();this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,0===this.channels.length&&(this.log('transport','deferred disconnect fired - no channels, disconnecting'),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log('transport',`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){null!==this._pendingDisconnectTimer&&(this.log('transport','pending disconnect cancelled - channel activity detected'),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let t,s=!1;if(e)t=e,s=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(e){this.log('error','Error fetching access token from callback',e),t=this.accessTokenValue}else t=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{const s={access_token:t,version:n.DEFAULT_VERSION};t&&e.updateJoinPayload(s),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(n.CHANNEL_EVENTS.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log('error',`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log('error','error waiting for auth on connect',e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,n)=>{'sent'==t&&this._setAuthSafely(),e&&e(t,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log('worker',`starting worker for from ${this.workerUrl}`):this.log('worker',"starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log('worker','worker error',e.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=e=>{'keepAlive'===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:'start',interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log('worker','terminating worker'),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{const e=new Blob(["\n addEventListener(\"message\", (e) => {\n if (e.data.event === \"start\") {\n setInterval(() => postMessage({ event: \"keepAlive\" }), e.data.interval);\n }\n });"],{type:'application/javascript'});t=URL.createObjectURL(e)}return t}_initializeOptions(e){var s,o,c,l,k,f,_,v,w,b,A,T;this.worker=null!==(s=null==e?void 0:e.worker)&&void 0!==s&&s,this.accessToken=null!==(o=null==e?void 0:e.accessToken)&&void 0!==o?o:null;const y={};let C,R;y.timeout=null!==(c=null==e?void 0:e.timeout)&&void 0!==c?c:n.DEFAULT_TIMEOUT,y.heartbeatIntervalMs=null!==(l=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==l?l:h,this._disconnectOnEmptyChannelsAfterMs=null!==(k=null==e?void 0:e.disconnectOnEmptyChannelsAfterMs)&&void 0!==k?k:2*(null!==(f=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==f?f:h),y.transport=null!==(_=null==e?void 0:e.transport)&&void 0!==_?_:t.default.getWebSocketConstructor(),y.params=null==e?void 0:e.params,y.logger=null==e?void 0:e.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(null==e?void 0:e.heartbeatCallback),y.sessionStorage=null!==(v=null==e?void 0:e.sessionStorage)&&void 0!==v?v:p(),y.reconnectAfterMs=null!==(w=null==e?void 0:e.reconnectAfterMs)&&void 0!==w?w:e=>u[e-1]||1e4;const E=null!==(b=null==e?void 0:e.vsn)&&void 0!==b?b:n.DEFAULT_VSN;switch(E){case n.VSN_1_0_0:C=(e,t)=>t(JSON.stringify(e)),R=(e,t)=>t(JSON.parse(e));break;case n.VSN_2_0_0:C=this.serializer.encode.bind(this.serializer),R=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=E,y.encode=null!==(A=null==e?void 0:e.encode)&&void 0!==A?A:C,y.decode=null!==(T=null==e?void 0:e.decode)&&void 0!==T?T:R,y.beforeReconnect=this._reconnectAuth.bind(this),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if('undefined'!=typeof window&&!window.Worker)throw new Error('Web Worker is not supported');this.workerUrl=null==e?void 0:e.workerUrl,y.autoSendHeartbeat=!this.worker}return y}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}},1232,[1233,1234,1236,1237,1238,1245]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebSocketFactory",{enumerable:!0,get:function(){return t}});class t{constructor(){}static detectEnvironment(){var t;if('undefined'!=typeof WebSocket)return{type:'native',wsConstructor:WebSocket};const o=globalThis;if('undefined'!=typeof globalThis&&void 0!==o.WebSocket)return{type:'native',wsConstructor:o.WebSocket};const n=void 0!==g?g:void 0;if(n&&void 0!==n.WebSocket)return{type:'native',wsConstructor:n.WebSocket};if('undefined'!=typeof globalThis&&void 0!==o.WebSocketPair&&void 0===globalThis.WebSocket)return{type:'cloudflare',error:'Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.',workaround:'Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.'};if('undefined'!=typeof globalThis&&o.EdgeRuntime||'undefined'!=typeof navigator&&(null===(t=navigator.userAgent)||void 0===t?void 0:t.includes('Vercel-Edge')))return{type:'unsupported',error:'Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.',workaround:'Use serverless functions or a different deployment target for WebSocket functionality.'};const s=globalThis.process;if(s){const t=s.versions;if(t&&t.node){const o=t.node,n=parseInt(o.replace(/^v/,'').split('.')[0]);return n>=22?void 0!==globalThis.WebSocket?{type:'native',wsConstructor:globalThis.WebSocket}:{type:'unsupported',error:`Node.js ${n} detected but native WebSocket not found.`,workaround:'Provide a WebSocket implementation via the transport option.'}:{type:'unsupported',error:`Node.js ${n} detected without native WebSocket support.`,workaround:"For Node.js < 22, install \"ws\" package and provide it via the transport option:\nimport ws from \"ws\"\nnew RealtimeClient(url, { transport: ws })"}}}return{type:'unsupported',error:'Unknown JavaScript runtime without WebSocket support.',workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let o=t.error||'WebSocket not supported in this environment.';throw t.workaround&&(o+=`\n\nSuggested solution: ${t.workaround}`),new Error(o)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return'native'===t.type||'ws'===t.type}catch(t){return!1}}}var o=t},1233,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_VERSION",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VSN_1_0_0",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"VSN_2_0_0",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_VSN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEFAULT_TIMEOUT",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"WS_CLOSE_NORMAL",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"MAX_PUSH_BUFFER_SIZE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SOCKET_STATES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"CHANNEL_STATES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"CHANNEL_EVENTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TRANSPORTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"CONNECTION_STATE",{enumerable:!0,get:function(){return E}});var n=r(d[0]);const t=`realtime-js/${n.version}`,o='1.0.0',c='2.0.0',u=c,l=n.version,b=1e4,_=1e3,f=100,p={connecting:0,open:1,closing:2,closed:3},s={closed:'closed',errored:'errored',joined:'joined',joining:'joining',leaving:'leaving'},O={close:'phx_close',error:'phx_error',join:'phx_join',reply:'phx_reply',leave:'phx_leave',access_token:'access_token'},j={websocket:'websocket'},E={connecting:'connecting',open:'open',closing:'closing',closed:'closed'}},1234,[1235]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1235,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});class t{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT='broadcast',this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=t?t:[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&'string'==typeof t.payload.event)return n(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer(null===(n=t.payload)||void 0===n?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:{},c=(new TextEncoder).encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,c)}_encodeUserBroadcastPush(t,n,s){var o,c;const l=t.topic,h=null!==(o=t.ref)&&void 0!==o?o:'',u=null!==(c=t.join_ref)&&void 0!==c?c:'',f=t.payload.event,y=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},_=0===Object.keys(y).length?'':JSON.stringify(y);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`ref length ${h.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`topic length ${l.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const A=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+h.length+l.length+f.length+_.length,E=new ArrayBuffer(this.HEADER_LENGTH+A);let U=new DataView(E),B=0;U.setUint8(B++,this.KINDS.userBroadcastPush),U.setUint8(B++,u.length),U.setUint8(B++,h.length),U.setUint8(B++,l.length),U.setUint8(B++,f.length),U.setUint8(B++,_.length),U.setUint8(B++,n),Array.from(u,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(h,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(l,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(f,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(_,t=>U.setUint8(B++,t.charCodeAt(0)));var N=new Uint8Array(E.byteLength+s.byteLength);return N.set(new Uint8Array(E),0),N.set(new Uint8Array(s),E.byteLength),N.buffer}decode(t,n){if(this._isArrayBuffer(t)){return n(this._binaryDecode(t))}if('string'==typeof t){const s=JSON.parse(t),[o,c,l,h,u]=s;return n({join_ref:o,ref:c,topic:l,event:h,payload:u})}return n({})}_binaryDecode(t){const n=new DataView(t),s=n.getUint8(0),o=new TextDecoder;if(s===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,o)}_decodeUserBroadcast(t,n,s){const o=n.getUint8(1),c=n.getUint8(2),l=n.getUint8(3),h=n.getUint8(4);let u=this.HEADER_LENGTH+4;const f=s.decode(t.slice(u,u+o));u+=o;const y=s.decode(t.slice(u,u+c));u+=c;const _=s.decode(t.slice(u,u+l));u+=l;const A=t.slice(u,t.byteLength),E=h===this.JSON_ENCODING?JSON.parse(s.decode(A)):A,U={type:this.BROADCAST_EVENT,event:y,payload:E};return l>0&&(U.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:f,event:this.BROADCAST_EVENT,payload:U}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||'ArrayBuffer'===(null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)}_pick(t,n){return t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([t])=>n.includes(t))):{}}}},1236,[]); +__d(function(g,r,i,a,m,e,d){"use strict";var t;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PostgresTypes",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"convertChangeData",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"convertColumn",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"convertCell",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toBoolean",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toNumber",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"toJson",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toTimestampString",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"httpEndpointURL",{enumerable:!0,get:function(){return y}}),(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(t||(t={}));const n=(t,n,o={})=>{var s;const u=null!==(s=o.skipTypes)&&void 0!==s?s:[];return n?Object.keys(n).reduce((o,s)=>(o[s]=c(s,t,n,u),o),{}):{}},c=(t,n,c,u)=>{const p=n.find(n=>n.name===t),l=null==p?void 0:p.type,f=c[t];return l&&!u.includes(l)?o(l,f):s(f)},o=(n,c)=>{if('_'===n.charAt(0)){const t=n.slice(1,n.length);return f(c,t)}switch(n){case t.bool:return u(c);case t.float4:case t.float8:case t.int2:case t.int4:case t.int8:case t.numeric:case t.oid:return p(c);case t.json:case t.jsonb:return l(c);case t.timestamp:return b(c);case t.abstime:case t.date:case t.daterange:case t.int4range:case t.int8range:case t.money:case t.reltime:case t.text:case t.time:case t.timestamptz:case t.timetz:case t.tsrange:case t.tstzrange:default:return s(c)}},s=t=>t,u=t=>{switch(t){case't':return!0;case'f':return!1;default:return t}},p=t=>{if('string'==typeof t){const n=parseFloat(t);if(!Number.isNaN(n))return n}return t},l=t=>{if('string'==typeof t)try{return JSON.parse(t)}catch(n){return t}return t},f=(t,n)=>{if('string'!=typeof t)return t;const c=t.length-1,s=t[c];if('{'===t[0]&&'}'===s){let s;const u=t.slice(1,c);try{s=JSON.parse('['+u+']')}catch(t){s=u?u.split(','):[]}return s.map(t=>o(n,t))}return t},b=t=>'string'==typeof t?t.replace(' ','T'):t,y=t=>{const n=new URL(t);return n.protocol=n.protocol.replace(/^ws/i,'http'),n.pathname=n.pathname.replace(/\/+$/,'').replace(/\/socket\/websocket$/i,'').replace(/\/socket$/i,'').replace(/\/websocket$/i,''),''===n.pathname||'/'===n.pathname?n.pathname='/api/broadcast':n.pathname=n.pathname+'/api/broadcast',n.href}},1237,[]); +__d(function(g,_r,_i,a,m,_e2,_d2){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return d.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e2,"postgresChangesFilter",{enumerable:!0,get:function(){return d.postgresChangesFilter}}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e2,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e2,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e2,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e2,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return h}});var t,n,i,s=_r(_d2[0]),r=e(_r(_d2[1])),o=_r(_d2[2]),c=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(o),l=_r(_d2[3]),u=e(_r(_d2[4])),d=_r(_d2[5]);!(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(t||(t={})),(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(n||(n={})),(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(i||(i={}));const h=s.CHANNEL_STATES;class p{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){var i,s;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,''),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},t.config),this.channelAdapter=new u.default(this.socket.socketAdapter,e,this.params),this.presence=new r.default(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=(0,o.httpEndpointURL)(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(null===(s=null===(i=this.params.config)||void 0===i?void 0:i.broadcast)||void 0===s?void 0:s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,o,c;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:h}}=this.params,p=null!==(o=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==o?o:[],E=!!this.bindings[n.PRESENCE]&&this.bindings[n.PRESENCE].length>0||!0===(null===(c=this.params.config.presence)||void 0===c?void 0:c.enabled),b={},f={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:E}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(t=>{null==e||e(i.CHANNEL_ERROR,(0,l.normalizeChannelError)(t))}),this._onClose(()=>null==e?void 0:e(i.CLOSED)),this.updateJoinPayload(Object.assign({config:f},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive('ok',async({postgres_changes:t})=>{this.socket._isManualToken()||this.socket.setAuth(),void 0!==t?this._updatePostgresBindings(t,e):null==e||e(i.SUBSCRIBED)}).receive('error',t=>{this.state=s.CHANNEL_STATES.errored;const n=Object.values(t).join(', ')||'error';null==e||e(i.CHANNEL_ERROR,new Error(n,{cause:t}))}).receive('timeout',()=>{null==e||e(i.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var n;const r=this.bindings.postgres_changes,o=null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0,c=[];for(let n=0;n{var i,s,r;const o=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);'broadcast'!==e.type||(null===(r=null===(s=null===(i=this.params)||void 0===i?void 0:i.config)||void 0===s?void 0:s.broadcast)||void 0===r?void 0:r.ack)||n('ok'),o.receive('ok',()=>n('ok')),o.receive('error',()=>n('error')),o.receive('timeout',()=>n('timed out'))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:r}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:'','Content-Type':'application/json'};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:'POST',headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:r,private:this.private}]})};try{const e=await this._fetchWithTimeout(this.broadcastEndpointURL,c,null!==(n=t.timeout)&&void 0!==n?n:this.timeout);return await(null===(i=e.body)||void 0===i?void 0:i.cancel()),e.ok?'ok':'error'}catch(e){return e instanceof Error&&'AbortError'===e.name?'timed out':'error'}}}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive('ok',()=>t('ok')).receive('timeout',()=>t('timed out')).receive('error',()=>t('error'))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){const i=new AbortController,s=setTimeout(()=>i.abort(),n),r=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(s),r}_on(e,t,n){const i=e.toLocaleLowerCase(),s=null==t?void 0:t.filter;(s instanceof d.RealtimePostgresFilterBuilder||'object'==typeof s&&null!==s&&'function'==typeof s.build)&&(t=Object.assign(Object.assign({},t),{filter:s.build()}));const r={type:i,filter:t,callback:n,ref:this.channelAdapter.on(e,n)};return this.bindings[i]?this.bindings[i].push(r):this.bindings[i]=[r],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{var i,s,r,o,c,l,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=null===(i=this.bindings[d])||void 0===i?void 0:i.find(t=>t.ref===e.ref);if(!h)return!0;if(['broadcast','presence','postgres_changes'].includes(d)){if('id'in h){const e=h.id,n=null===(s=h.filter)||void 0===s?void 0:s.event;return e&&(null===(r=t.ids)||void 0===r?void 0:r.includes(e))&&('*'===n||(null==n?void 0:n.toLocaleLowerCase())===(null===(o=t.data)||void 0===o?void 0:o.type.toLocaleLowerCase()))}{const e=null===(l=null===(c=null==h?void 0:h.filter)||void 0===c?void 0:c.event)||void 0===l?void 0:l.toLocaleLowerCase();return'*'===e||e===(null===(u=null==t?void 0:t.event)||void 0===u?void 0:u.toLocaleLowerCase())}}return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){const{close:n,error:i,leave:r,join:o}=s.CHANNEL_EVENTS;return t&&[n,i,r,o].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if('object'==typeof t&&'ids'in t){const e=t.data,{schema:n,table:i,commit_timestamp:s,type:r,errors:o}=e,c={schema:n,table:i,commit_timestamp:s,eventType:r,new:{},old:{},errors:o};return Object.assign(Object.assign({},c),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw new Error('cannot copy bindings into joined channel');for(const t in e.bindings)for(const n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_getPayloadRecords(e){const t={new:{},old:{}};return'INSERT'!==e.type&&'UPDATE'!==e.type||(t.new=c.convertChangeData(e.columns,e.record)),'UPDATE'!==e.type&&'DELETE'!==e.type||(t.old=c.convertChangeData(e.columns,e.old_record)),t}}},1238,[1234,1239,1237,1242,1243,1244]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return t}});var e,t,n=r(d[0]),c=(e=n)&&e.__esModule?e:{default:e};!(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(t||(t={}));class u{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new c.default(this.channel.channelAdapter,t)}}},1239,[1240]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(s,c){const u=o(c);this.presence=new n.Presence(s.getChannel(),u),this.presence.onJoin((n,c,o)=>{const u=t.onJoinPayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onLeave((n,c,o)=>{const u=t.onLeavePayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onSync(()=>{s.getChannel().trigger('presence',{event:'sync'})})}get state(){return t.transformState(this.presence.state)}static transformState(n){return n=c(n),Object.getOwnPropertyNames(n).reduce((t,c)=>{const o=n[c];return t[c]=s(o),t},{})}static onJoinPayload(n,t,c){return{event:'join',key:n,currentPresences:u(t),newPresences:s(c)}}static onLeavePayload(n,t,c){return{event:'leave',key:n,currentPresences:u(t),leftPresences:s(c)}}}function s(n){return n.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function c(n){return JSON.parse(JSON.stringify(n))}function o(n){return(null==n?void 0:n.events)&&{events:n.events}}function u(n){return(null==n?void 0:n.metas)?s(n):[]}},1240,[1241]); +__d(function(g,r,_i,a,_m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"Channel",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e2,"LongPoll",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e2,"Presence",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e2,"Push",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e2,"Serializer",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e2,"Socket",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e2,"Timer",{enumerable:!0,get:function(){return w}});var e=e=>{if("function"==typeof e)return e;return function(){return e}},t="undefined"!=typeof self?self:null,s="undefined"!=typeof window?window:null,i=t||s||globalThis,n=0,o=1,h=2,c=3,l="closed",u="errored",f="joined",p="joining",m="leaving",b="phx_close",k="phx_error",T="phx_join",y="phx_reply",C="phx_leave",v="longpoll",R="websocket",j=4,E="base64url.bearer.phx.",S=class{constructor(e,t,s,i){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},w=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},A=class{constructor(t,s,i){this.state=l,this.topic=t,this.params=e(s||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new S(this,T,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new w(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=f,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",e=>{this.state=u,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=l,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=u,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new S(this,C,e({}),this.timeout).send(),this.state=u,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(y,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=l,this.bindings=[]}onClose(e){this.on(b,e)}onError(e){return this.on(k,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(void 0===t||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new S(this,e,function(){return t},s);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=m;let s=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(b,"leave")},i=new S(this,C,e({}),t);return i.receive("ok",()=>s()).receive("timeout",()=>s()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,i){return this.topic===e&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=p,this.joinPush.resend(e))}trigger(e,t,s,i){let n=this.onMessage(e,t,s,i);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(i=>i.event===e&&this.filterBindings(i,t,s));for(let e=0;eu.abort(),o);l.signal=u.signal}return i.fetch(t,l).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>c&&c(e)).catch(e=>{"AbortError"===e.name&&h?h():c&&c(null)}),u}static xdomainRequest(e,t,s,i,n,o,h){return e.timeout=n,e.open(t,s),e.onload=()=>{let t=this.parseJSON(e.responseText);h&&h(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,s,i,n,o,h,c){e.open(t,s,!0),e.timeout=o;for(let[t,s]of Object.entries(i))e.setRequestHeader(t,s);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{if(e.readyState===j&&c){let t=this.parseJSON(e.responseText);c(t)}},h&&(e.ontimeout=h),e.send(n),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let s=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let n=t?`${t}[${i}]`:i,o=e[i];"object"==typeof o?s.push(this.serialize(o,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(o))}return s.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},L=e=>{let t="",s=new Uint8Array(e),i=s.byteLength;for(let e=0;ethis.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R),"$1/"+v)}endpointURL(){return H.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=n}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===o||this.readyState===n}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:s,messages:i}=e;if(410===t&&null!==this.token)return this.onerror(410),void this.closeAndRetry(3410,"session_gone",!1);this.token=s}else t=0;switch(t){case 200:i.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=o,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=L(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join("\n"),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,s){for(let e of this.reqs)e.abort();this.readyState=c;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,s,i,n){let o;o=H.request(e,this.endpointURL(),t,s,this.timeout,()=>{this.reqs.delete(o),i()},e=>{this.reqs.delete(o),this.isActive()&&n(e)}),this.reqs.add(o)}},B=class e{constructor(t,s={}){let i=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(i.state,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,s,i),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,s,i)}),this.pendingDiffs=[],n()}),this.channel.on(i.diff,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,s,i),n())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,s,i){let n=this.clone(e),o={},h={};return this.map(n,(e,s)=>{t[e]||(h[e]=s)}),this.map(t,(e,t)=>{let s=n[e];if(s){let i=t.metas.map(e=>e.phx_ref),n=s.metas.map(e=>e.phx_ref),c=t.metas.filter(e=>n.indexOf(e.phx_ref)<0),l=s.metas.filter(e=>i.indexOf(e.phx_ref)<0);c.length>0&&(o[e]=t,o[e].metas=c),l.length>0&&(h[e]=this.clone(s),h[e].metas=l)}else o[e]=t}),this.syncDiff(n,{joins:o,leaves:h},s,i)}static syncDiff(e,t,s,i){let{joins:n,leaves:o}=this.clone(t);return s||(s=function(){}),i||(i=function(){}),this.map(n,(t,i)=>{let n=e[t];if(e[t]=this.clone(i),n){let s=e[t].metas.map(e=>e.phx_ref),i=n.metas.filter(e=>s.indexOf(e.phx_ref)<0);e[t].metas.unshift(...i)}s(t,n,i)}),this.map(o,(t,s)=>{let n=e[t];if(!n)return;let o=s.metas.map(e=>e.phx_ref);n.metas=n.metas.filter(e=>o.indexOf(e.phx_ref)<0),i(t,n,s),0===n.metas.length&&delete e[t]}),e}static list(e,t){return t||(t=function(e,t){return t}),this.map(e,(e,s)=>t(e,s))}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static clone(e){return JSON.parse(JSON.stringify(e))}},O={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,i,n,o,h]=JSON.parse(e);return t({join_ref:s,ref:i,topic:n,event:o,payload:h})}},binaryEncode(e){let{join_ref:t,ref:s,event:i,topic:n,payload:o}=e,h=this.META_LENGTH+t.length+s.length+n.length+i.length,c=new ArrayBuffer(this.HEADER_LENGTH+h),l=new DataView(c),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,s.length),l.setUint8(u++,n.length),l.setUint8(u++,i.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(s,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(i,e=>l.setUint8(u++,e.charCodeAt(0)));var f=new Uint8Array(c.byteLength+o.byteLength);return f.set(new Uint8Array(c),0),f.set(new Uint8Array(o),c.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,c=s.decode(e.slice(h,h+i));h+=i;let l=s.decode(e.slice(h,h+n));h+=n;let u=s.decode(e.slice(h,h+o));return h+=o,{join_ref:c,ref:null,topic:l,event:u,payload:e.slice(h,e.byteLength)}},decodeReply(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(c,c+i));c+=i;let u=s.decode(e.slice(c,c+n));c+=n;let f=s.decode(e.slice(c,c+o));c+=o;let p=s.decode(e.slice(c,c+h));c+=h;let m=e.slice(c,e.byteLength);return{join_ref:l,ref:u,topic:f,event:y,payload:{status:p,response:m}}},decodeBroadcast(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=this.HEADER_LENGTH+2,h=s.decode(e.slice(o,o+i));o+=i;let c=s.decode(e.slice(o,o+n));return o+=n,{join_ref:null,ref:null,topic:h,event:c,payload:e.slice(o,e.byteLength)}}},$=class{constructor(t,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||1e4,this.transport=n.transport||i.WebSocket||P,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let o=null;try{o=i&&i.sessionStorage}catch{}this.sessionStore=n.sessionStorage||o,this.establishedConnections=0,this.defaultEncoder=O.encode.bind(O),this.defaultDecoder=O.decode.bind(O),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==P?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let h=null;s&&s.addEventListener&&(s.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),h=this.connectClock)}),s.addEventListener("pageshow",e=>{h===this.connectClock&&(h=null,this.connect())}),s.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>n.rejoinAfterMs?n.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>n.reconnectAfterMs?n.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(e,t,s)=>{console.log(`${e}: ${t}`,s)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=e(n.params||{}),this.endPoint=`${t}/${R}`,this.vsn=n.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new w(()=>{if(this.pageHidden)return this.log("Not reconnecting as page is hidden!"),void this.teardown();this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return P}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=H.appendParams(H.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=e(t)),this.conn&&!this.disconnecting||(this.longPollFallbackMs&&this.transport!==P?this.connectWithFallback(P,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(n=>{n.ref===t&&(this.off([i]),e(Date.now()-s))});return!0}transportName(e){return e===P?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${E}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let s,i=!1,n=!0,o=this.transportName(e),h=t=>{this.log("transport",`falling back to ${o}...`,t),this.off([void 0,s]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),s=this.onError(e=>{this.log("transport","error",e),n&&!i&&(clearTimeout(this.fallbackTimer),h(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!n){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const i=this.conn;this.waitForBufferDone(i,()=>{t?i.close(t,s||""):i.close(),this.waitForSocketClosed(i,()=>{this.conn===i&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){5!==s&&e.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s):t()}waitForSocketClosed(e,t,s=1){5!==s&&e.readyState!==c?setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s):t()}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(k,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case n:return"connecting";case o:return"open";case h:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let s=new A(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;this.log("push",`${t} ${s} (${o}, ${n})`,i)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(this.isConnected())if(this.pendingHeartbeatRef)this.heartbeatTimeout();else{this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}else try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;if(n&&n===this.pendingHeartbeatRef){const e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback("ok"===i.status?"ok":"error",e)}catch(e){this.log("error","error in heartbeat callback",e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${t} ${s} ${n&&"("+n+")"||""}`.trim(),i);for(let e=0;e{try{i(...t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}},1241,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeChannelError=function(n){if(n instanceof Error)return n;if('string'==typeof n)return new Error(n);if(n&&'object'==typeof n){const o=n;if('number'==typeof o.code){const t='string'==typeof o.reason&&o.reason?` (${o.reason})`:'';return new Error(`socket closed: ${o.code}${t}`,{cause:n})}return new Error('channel error: transport failure',{cause:n})}return new Error('channel error: connection lost')}},1242,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(n,t,s){const h=(o=s,{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},o.config)});var o;this.channel=n.getSocket().channel(t,h),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,t){return this.channel.on(n,t)}off(n,t){this.channel.off(n,t)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(t,s,h){let o;try{o=this.channel.push(t,s,h)}catch(n){throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>n.MAX_PUSH_BUFFER_SIZE){const n=this.channel.pushBuffer.shift();n.cancelTimeout(),this.socket.log('channel',`discarded push due to buffer overflow: ${n.event}`,n.payload())}return o}updateJoinPayload(n){const t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),n)}canPush(){return this.socket.isConnected()&&this.state===n.CHANNEL_STATES.joined}isJoined(){return this.state===n.CHANNEL_STATES.joined}isJoining(){return this.state===n.CHANNEL_STATES.joining}isClosed(){return this.state===n.CHANNEL_STATES.closed}isLeaving(){return this.state===n.CHANNEL_STATES.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}},1243,[1234]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"postgresChangesFilter",{enumerable:!0,get:function(){return c}});const t=/[,()"\\]/,n=n=>t.test(n)||n!==n.trim(),s=t=>`"${t.replace(/\\/g,'\\\\').replace(/"/g,'\\"')}"`,u=t=>{const u=null===t?'null':String(t);return n(u)?s(u):u},l=t=>null===t?'null':String(t),h=(t,n)=>{if('in'===t){const t=Array.isArray(n)?n:[n];if(0===t.length)throw new Error('Realtime `in` filter requires at least one value.');return`in.(${Array.from(new Set(t)).map(t=>u(t)).join(',')})`}return'is'===t?`is.${l(n)}`:`${t}.${u(n)}`};class o{constructor(){this.filters=[]}add(t,n,s,u=!1){const l=u?'not.':'';return this.filters.push(`${t}=${l}${h(n,s)}`),this}eq(t,n){return this.add(t,'eq',n)}neq(t,n){return this.add(t,'neq',n)}gt(t,n){return this.add(t,'gt',n)}gte(t,n){return this.add(t,'gte',n)}lt(t,n){return this.add(t,'lt',n)}lte(t,n){return this.add(t,'lte',n)}in(t,n){return this.add(t,'in',n)}like(t,n){return this.add(t,'like',n)}ilike(t,n){return this.add(t,'ilike',n)}match(t,n){return this.add(t,'match',n)}imatch(t,n){return this.add(t,'imatch',n)}is(t,n){return this.add(t,'is',n)}isDistinct(t,n){return this.add(t,'isdistinct',n)}not(t,n,s){return this.add(t,n,s,!0)}build(){return this.filters.join(',')}toString(){return this.build()}}const c=()=>new o},1244,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]);class s{constructor(n,s){this.socket=new t.Socket(n,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,s,o=1e4){return new Promise(c=>{setTimeout(()=>c('timeout'),o),this.socket.disconnect(()=>{t(),c('ok')},n,s)})}push(t){this.socket.push(t)}log(t,n,s){this.socket.log(t,n,s)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.connecting}isDisconnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}},1245,[1241,1234]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"StorageAnalyticsClient",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StorageClient",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(_e,"StorageError",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"StorageUnknownError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"StorageVectorsApiError",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"StorageVectorsClient",{enumerable:!0,get:function(){return X}}),Object.defineProperty(_e,"StorageVectorsError",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"VectorBucketApi",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"VectorBucketScope",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(_e,"VectorDataApi",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"VectorIndexApi",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(_e,"VectorIndexScope",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(_e,"isStorageError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isStorageVectorsError",{enumerable:!0,get:function(){return f}});var e=_r(d[0]);function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function n(e){var n=r(e,"string");return"symbol"==t(n)?n:n+""}function o(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},k=e=>{if(Array.isArray(e))return e.map(e=>k(e));if("function"==typeof e||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([e,r])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));t[n]=k(r)}),t},x=e=>!(!e||"string"!=typeof e)&&(!(0===e.length||e.length>100)&&(e.trim()===e&&(!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e)))),$=e=>{if("object"==typeof e&&null!==e){const t=e;if("string"==typeof t.msg)return t.msg;if("string"==typeof t.message)return t.message;if("string"==typeof t.error_description)return t.error_description;if("string"==typeof t.error)return t.error;if("object"==typeof t.error&&null!==t.error){const e=t.error;if("string"==typeof e.message)return e.message}}return JSON.stringify(e)},j=async(e,t,r,n)=>{if(null!==e&&"object"==typeof e&&"json"in e&&"function"==typeof e.json){const r=e;let o=parseInt(String(r.status),10);Number.isFinite(o)||(o=500),r.json().then(e=>{const r=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||o+"";t(new l($(e),o,r,n))}).catch(()=>{const e=o+"";t(new l(r.statusText||`HTTP ${o} error`,o,e,n))})}else t(new h($(e),e,n))},B=(e,t,r,n)=>{const o={method:e,headers:(null==t?void 0:t.headers)||{}};if("GET"===e||"HEAD"===e||!n)return c(c({},o),r);if(S(n)){var s;const e=(null==t?void 0:t.headers)||{};let r;for(const[t,n]of Object.entries(e))"content-type"===t.toLowerCase()&&(r=n);o.headers=w(e,"Content-Type",null!==(s=r)&&void 0!==s?s:"application/json"),o.body=JSON.stringify(n)}else o.body=n;return(null==t?void 0:t.duplex)&&(o.duplex=t.duplex),c(c({},o),r)};async function P(e,t,r,n,o,s,c){return new Promise((i,u)=>{e(r,B(t,n,o,s)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;if("vectors"===c){const t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status)return{};if(!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>i(e)).catch(e=>j(e,u,0,c))})}function N(e="storage"){return{get:async(t,r,n,o)=>P(t,"GET",r,n,o,void 0,e),post:async(t,r,n,o,s)=>P(t,"POST",r,o,s,n,e),put:async(t,r,n,o,s)=>P(t,"PUT",r,o,s,n,e),head:async(t,r,n,o)=>P(t,"HEAD",r,c(c({},n),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,n,o,s)=>P(t,"DELETE",r,o,s,n,e)}}const E=N("storage"),{get:C,post:V,put:I,head:T,remove:U}=E,_=N("vectors");var F=class{constructor(e,t={},r,n="storage"){var o;this.shouldThrowOnError=!1,this.url=e,this.headers=O(t),this.fetch=(o=r)?(...e)=>o(...e):(...e)=>fetch(...e),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=w(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let R;R=Symbol.toStringTag;var L=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[R]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let D;D=Symbol.toStringTag;var A=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[D]="BlobDownloadBuilder",this.promise=null}asStream(){return new L(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};const M={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},z={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J=class extends F{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var o=this;return o.handleOperation(async()=>{let s;const i=c(c({},z),n);let u=c(c({},o.headers),"POST"===e&&{"x-upsert":String(i.upsert)});const l=i.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(s=new FormData,s.append("cacheControl",i.cacheControl),l&&s.append("metadata",o.encodeMetadata(l)),s.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",i.cacheControl),l&&!s.has("metadata")&&s.append("metadata",o.encodeMetadata(l))):(s=r,u["cache-control"]=`max-age=${i.cacheControl}`,u["content-type"]=i.contentType,l&&(u["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&s instanceof ReadableStream||s&&"object"==typeof s&&"pipe"in s&&"function"==typeof s.pipe)&&!i.duplex&&(i.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))u=w(u,e,t);const h=o._removeEmptyFolders(t),p=o._getFinalPath(h),f=await("PUT"==e?I:V)(o.fetch,`${o.url}/object/${p}`,s,c({headers:u},(null==i?void 0:i.duplex)?{duplex:i.duplex}:{}));return{path:h,id:f.Id,fullPath:f.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var o=this;const s=o._removeEmptyFolders(e),i=o._getFinalPath(s),u=new URL(o.url+`/object/upload/sign/${i}`);return u.searchParams.set("token",t),o.handleOperation(async()=>{let e;const t=c(c({},z),n);let i=c(c({},o.headers),{"x-upsert":String(t.upsert)});const l=t.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),l&&e.append("metadata",o.encodeMetadata(l)),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.has("cacheControl")||e.append("cacheControl",t.cacheControl),l&&!e.has("metadata")&&e.append("metadata",o.encodeMetadata(l))):(e=r,i["cache-control"]=`max-age=${t.cacheControl}`,i["content-type"]=t.contentType,l&&(i["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&e instanceof ReadableStream||e&&"object"==typeof e&&"pipe"in e&&"function"==typeof e.pipe)&&!t.duplex&&(t.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))i=w(i,e,t);return{path:s,fullPath:(await I(o.fetch,u.toString(),e,c({headers:i},(null==t?void 0:t.duplex)?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const o=c({},r.headers);(null==t?void 0:t.upsert)&&(o["x-upsert"]="true");const s=await V(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:o}),u=new URL(r.url+s.url),l=u.searchParams.get("token");if(!l)throw new i("No token returned by API");return{signedUrl:u.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await V(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await V(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let o=n._getFinalPath(e);const s="object"==typeof(null==r?void 0:r.transform)&&null!==r.transform&&Object.keys(r.transform).length>0;let i=await V(n.fetch,`${n.url}/object/sign/${o}`,c({expiresIn:t},s?{transform:r.transform}:{}),{headers:n.headers});const u=new URLSearchParams;(null==r?void 0:r.download)&&u.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&u.set("cacheNonce",String(r.cacheNonce));const l=u.toString();return{signedUrl:encodeURI(`${n.url}${i.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const o=await V(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),s=new URLSearchParams;(null==r?void 0:r.download)&&s.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&s.set("cacheNonce",String(r.cacheNonce));const i=s.toString();return o.map(e=>c(c({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${i?`&${i}`:""}`):null}))})}download(e,t,r){const n="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(o,t.transform),null!=(null==t?void 0:t.cacheNonce)&&o.set("cacheNonce",String(t.cacheNonce));const s=o.toString(),c=this._getFinalPath(e);return new A(()=>C(this.fetch,`${this.url}/${n}/${c}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},r),this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>k(await C(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await T(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(u(e)){var n;const t=e instanceof l?e.status:e instanceof h?null===(n=e.originalError)||void 0===n?void 0:n.status:void 0;if(void 0!==t&&[400,404].includes(t))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;(null==t?void 0:t.download)&&n.set("download",!0===t.download?"":t.download),(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(n,t.transform),null!=(null==t?void 0:t.cacheNonce)&&n.set("cacheNonce",String(t.cacheNonce));const o=n.toString(),s="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=n._getFinalPath(e),s=new URLSearchParams;(null==t?void 0:t.transformations)&&s.set("transformations","true");const c=s.toString();return await U(n.fetch,`${n.url}/cdn/${o}${c?`?${c}`:""}`,{},{headers:n.headers},r)})}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const o=(null==t?void 0:t.sortBy)?c(c({},M.sortBy),t.sortBy):M.sortBy,s=c(c(c({},M),t),{},{sortBy:o,prefix:e||""});return await V(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=c({},e);return await V(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const K={"X-Client-Info":"storage-js/2.109.0"};var q=class extends F{constructor(e,t={},r,n){const o=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));super(o.href.replace(/\/$/,""),c(c({},K),t),r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await C(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await C(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await V(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await I(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=new URLSearchParams;(null==t?void 0:t.transformations)&&o.set("transformations","true");const s=o.toString();return await U(n.fetch,`${n.url}/cdn/${e}${s?`?${s}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},H=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),t),r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&r.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);const n=r.toString(),o=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await C(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(t){var r=this;if(!x(t))throw new i("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new e.IcebergRestCatalog({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>r.headers},fetch:this.fetch}),o=this.shouldThrowOnError;return new Proxy(n,{get(e,t){const r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(e){if(o)throw e;return{data:null,error:e}}}}})}},Q=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},G=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},W=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},X=class extends W{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Y(this.url,this.headers,e,this.fetch)}async createBucket(e){return(()=>super.createBucket)().call(this,e)}async getBucket(e){return(()=>super.getBucket)().call(this,e)}async listBuckets(e={}){return(()=>super.listBuckets)().call(this,e)}async deleteBucket(e){return(()=>super.deleteBucket)().call(this,e)}},Y=class extends Q{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return(()=>super.createIndex)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return(()=>super.listIndexes)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return(()=>super.getIndex)().call(this,this.vectorBucketName,e)}async deleteIndex(e){return(()=>super.deleteIndex)().call(this,this.vectorBucketName,e)}index(e){return new Z(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Z=class extends G{constructor(e,t,r,n,o){super(e,t,o),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=this;return(()=>super.putVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(e){var t=this;return(()=>super.getVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(e={}){var t=this;return(()=>super.listVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(e){var t=this;return(()=>super.queryVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(e){var t=this;return(()=>super.deleteVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},ee=class extends q{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new J(this.url,this.headers,e,this.fetch)}get vectors(){return new X(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new H(this.url+"/iceberg",this.headers,this.fetch)}}},1246,[1247]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IcebergError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"IcebergRestCatalog",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"getCurrentSchema",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isDecimalType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isFixedType",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseDecimalType",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"parseFixedType",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"typesEqual",{enumerable:!0,get:function(){return x}});var t=class extends Error{constructor(t,a){super(t),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown="CommitStateUnknownException"===a.icebergType||[500,502,504].includes(a.status)&&!0===a.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function a(t,a,s){const n=new URL(a,t);if(s)for(const[t,a]of Object.entries(s))void 0!==a&&n.searchParams.set(t,a);return n.toString()}async function s(t){return t&&"none"!==t.type?"bearer"===t.type?{Authorization:`Bearer ${t.token}`}:"header"===t.type?{[t.name]:t.value}:"custom"===t.type?await t.getHeaders():{}:{}}function n(n){const c=n.fetchImpl??globalThis.fetch;return{async request({method:o,path:p,query:u,body:l,headers:h}){const b=a(n.baseUrl,p,u),f=await s(n.auth),y=await c(b,{method:o,headers:{...l?{"Content-Type":"application/json"}:{},...f,...h},body:l?JSON.stringify(l):void 0}),T=await y.text(),w=(y.headers.get("content-type")||"").includes("application/json"),x=w&&T?JSON.parse(T):T;if(!y.ok){const a=w?x:void 0,s=a?.error;throw new t(s?.message??`Request failed with status ${y.status}`,{status:y.status,icebergType:s?.type,icebergCode:s?.code,details:a})}return{status:y.status,headers:y.headers,data:x}}}}function c(t){return t.join("\x1f")}var o=class{constructor(t,a=""){this.client=t,this.prefix=a}async listNamespaces(t){const a=t?{parent:c(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(t=>({namespace:t}))}async createNamespace(t,a){const s={namespace:t.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${c(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${c(t.namespace)}`})).data.properties}}async namespaceExists(a){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${c(a.namespace)}`}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createNamespaceIfNotExists(a,s){try{return await this.createNamespace(a,s)}catch(a){if(a instanceof t&&409===a.status)return;throw a}}};function p(t){return t.join("\x1f")}var u=class{constructor(t,a="",s){this.client=t,this.prefix=a,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`})).data.identifiers}async createTable(t,a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`,body:a,headers:s})).data.metadata}async updateTable(t,a){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,body:a});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(t){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,headers:a})).data.metadata}async tableExists(a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${p(a.namespace)}/tables/${a.name}`,headers:s}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createTableIfNotExists(a,s){try{return await this.createTable(a,s)}catch(n){if(n instanceof t&&409===n.status)return await this.loadTable({namespace:a.namespace,name:s.name});throw n}}},l=class{constructor(t){let a="v1";t.catalogName&&(a+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=n({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new o(this.client,a),this.tableOps=new u(this.client,a,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,a){return this.namespaceOps.createNamespace(t,a)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,a){return this.tableOps.createTable(t,a)}async updateTable(t,a){return this.tableOps.updateTable(t,a)}async dropTable(t,a){await this.tableOps.dropTable(t,a)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,a){return this.namespaceOps.createNamespaceIfNotExists(t,a)}async createTableIfNotExists(t,a){return this.tableOps.createTableIfNotExists(t,a)}},h=/^decimal\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)$/,b=/^fixed\s*\[\s*(\d+)\s*\]$/;function f(t){const a=t.match(h);return a?{precision:parseInt(a[1],10),scale:parseInt(a[2],10)}:null}function y(t){const a=t.match(b);return a?{length:parseInt(a[1],10)}:null}function T(t){return h.test(t)}function w(t){return b.test(t)}function x(t,a){const s=f(t),n=f(a);if(s&&n)return s.precision===n.precision&&s.scale===n.scale;const c=y(t),o=y(a);return c&&o?c.length===o.length:t===a}function O(t){return t.schemas.find(a=>a["schema-id"]===t["current-schema-id"])}},1247,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"navigatorLock",{enumerable:!0,get:function(){return l.navigatorLock}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return l.NavigatorLockAcquireTimeoutError}}),Object.defineProperty(_e,"lockInternals",{enumerable:!0,get:function(){return l.internals}}),Object.defineProperty(_e,"processLock",{enumerable:!0,get:function(){return l.processLock}}),Object.defineProperty(_e,"GoTrueAdminApi",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"GoTrueClient",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(_e,"AuthAdminApi",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"AuthClient",{enumerable:!0,get:function(){return u.default}});var t=e(r(d[0])),n=e(r(d[1])),o=e(r(d[2])),u=e(r(d[3])),c=r(d[4]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(d[5]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var l=r(d[6])},1248,[1249,1257,1264,1265,1256,1254,1259]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]),s=r(d[1]),n=r(d[2]),o=r(d[3]),h=r(d[4]);class u{constructor({url:t="",headers:s={},fetch:o,experimental:h}){this.url=t,this.headers=s,this.fetch=(0,n.resolveFetch)(o),this.experimental=null!=h?h:{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=o.SIGN_OUT_SCOPES[0]){if(o.SIGN_OUT_SCOPES.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${o.SIGN_OUT_SCOPES.join(', ')}`);try{return await(0,s._request)(this.fetch,'POST',`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async inviteUserByEmail(t,n={}){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async generateLink(n){try{const{options:o}=n,h=(0,t.__rest)(n,["options"]),u=Object.assign(Object.assign({},h),o);return'newEmail'in h&&(u.new_email=null==h?void 0:h.newEmail,delete u.newEmail),await(0,s._request)(this.fetch,'POST',`${this.url}/admin/generate_link`,{body:u,headers:this.headers,xform:s._generateLinkResponse,redirectTo:null==o?void 0:o.redirectTo})}catch(t){if((0,h.isAuthError)(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/users`,{body:t,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async listUsers(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{users:[]},error:t};throw t}}async getUserById(t){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t}`,{headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async updateUserById(t,o){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/users/${t}`,{body:o,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async deleteUser(t,o=!1){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:o},xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async _listFactors(t){(0,n.validateUUID)(t.userId);try{const{data:n,error:o}=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:t=>({data:{factors:t},error:null})});return{data:n,error:o}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteFactor(t){(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.id);try{return{data:await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listOAuthClients(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{clients:[]},error:t};throw t}}async _createOAuthClient(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getOAuthClient(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateOAuthClient(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteOAuthClient(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listCustomProviders(t){try{const n={};return(null==t?void 0:t.type)&&(n.type=t.type),await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:t=>{var s;return{data:{providers:null!==(s=null==t?void 0:t.providers)&&void 0!==s?s:[]},error:null}}})}catch(t){if((0,h.isAuthError)(t))return{data:{providers:[]},error:t};throw t}}async _createCustomProvider(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getCustomProvider(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateCustomProvider(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteCustomProvider(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminListPasskeys(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminDeletePasskey(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.passkeyId);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}}},1249,[1227,1250,1253,1256,1254]); +__d(function(g,r,_i,_a2,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.handleError=i,_e._request=async function(e,o,t,n){var a;const i=Object.assign({},null==n?void 0:n.headers);i[s.API_VERSION_HEADER_NAME]||(i[s.API_VERSION_HEADER_NAME]=s.API_VERSIONS['2024-01-01'].name);(null==n?void 0:n.jwt)&&(i.Authorization=`Bearer ${n.jwt}`);const u=null!==(a=null==n?void 0:n.query)&&void 0!==a?a:{};(null==n?void 0:n.redirectTo)&&(u.redirect_to=n.redirectTo);const l=Object.keys(u).length?'?'+new URLSearchParams(u).toString():'',_=await c(e,o,t+l,{headers:i,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(_):{data:Object.assign({},_),error:null}},_e._sessionResponse=l,_e._sessionResponsePassword=function(e){const s=l(e);!s.error&&e.weak_password&&'object'==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&'string'==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0)&&(s.data.weak_password=e.weak_password);return s},_e._userResponse=function(e){var s;return{data:{user:null!==(s=e.user)&&void 0!==s?s:e},error:null}},_e._ssoResponse=function(e){return{data:e,error:null}},_e._generateLinkResponse=function(s){const{action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i}=s,u=(0,e.__rest)(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i},l=Object.assign({},u);return{data:{properties:c,user:l},error:null}},_e._noResolveJsonResponse=function(e){return e};var e=r(d[0]),s=r(d[1]),o=r(d[2]),t=r(d[3]);const n=e=>{if('object'==typeof e&&null!==e){const s=e;if('string'==typeof s.msg)return s.msg;if('string'==typeof s.message)return s.message;if('string'==typeof s.error_description)return s.error_description;if('string'==typeof s.error)return s.error}return JSON.stringify(e)},a=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function i(e){var i;if(!(0,o.looksLikeFetchResponse)(e))throw new t.AuthRetryableFetchError(n(e),0);if(a.includes(e.status))throw new t.AuthRetryableFetchError(n(e),e.status);let u,c;try{u=await e.json()}catch(e){throw new t.AuthUnknownError(n(e),e)}const l=(0,o.parseResponseAPIVersion)(e);if(l&&l.getTime()>=s.API_VERSIONS['2024-01-01'].timestamp&&'object'==typeof u&&u&&'string'==typeof u.code?c=u.code:'object'==typeof u&&u&&'string'==typeof u.error_code&&(c=u.error_code),c){if('weak_password'===c)throw new t.AuthWeakPasswordError(n(u),e.status,(null===(i=u.weak_password)||void 0===i?void 0:i.reasons)||[]);if('session_not_found'===c)throw new t.AuthSessionMissingError}else if('object'==typeof u&&u&&'object'==typeof u.weak_password&&u.weak_password&&Array.isArray(u.weak_password.reasons)&&u.weak_password.reasons.length&&u.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0))throw new t.AuthWeakPasswordError(n(u),e.status,u.weak_password.reasons);throw new t.AuthApiError(n(u),e.status||500,c)}const u=(e,s,o,t)=>{const n={method:e,headers:(null==s?void 0:s.headers)||{}};return'GET'===e?n:(n.headers=Object.assign({'Content-Type':'application/json;charset=UTF-8'},null==s?void 0:s.headers),n.body=JSON.stringify(t),Object.assign(Object.assign({},n),o))};async function c(e,s,o,a,c,l){const _=u(s,a,c,l);let p;try{p=await e(o,Object.assign({},_))}catch(e){throw console.error(e),new t.AuthRetryableFetchError(n(e),0)}if(p.ok||await i(p),null==a?void 0:a.noResolveJson)return p;try{return await p.json()}catch(e){await i(e)}}function l(e){var s;let t=null;_(e)&&(t=Object.assign({},e),e.expires_at||(t.expires_at=(0,o.expiresAt)(e.expires_in)));return{data:{session:t,user:null!==(s=e.user)&&void 0!==s?s:'string'==typeof(null==e?void 0:e.id)?e:null},error:null}}function _(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}},1250,[1227,1251,1253,1254]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AUTO_REFRESH_TICK_DURATION_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AUTO_REFRESH_TICK_THRESHOLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"EXPIRY_MARGIN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REFRESH_FAILURE_COOLDOWN_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"GOTRUE_URL",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"STORAGE_KEY",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"AUDIENCE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DEFAULT_HEADERS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NETWORK_FAILURE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"API_VERSION_HEADER_NAME",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"API_VERSIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BASE64URL_REGEX",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"JWKS_TTL",{enumerable:!0,get:function(){return A}});var t=r(d[0]);const n=3e4,u=3,o=9e4,c=6e4,E='http://localhost:9999',_='supabase.auth.token',b='',f={'X-Client-Info':`gotrue-js/${t.version}`},R={MAX_RETRIES:10,RETRY_INTERVAL:2},O='X-Supabase-Api-Version',p={'2024-01-01':{timestamp:Date.parse('2024-01-01T00:00:00.0Z'),name:'2024-01-01'}},l=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,A=6e5},1251,[1252]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1252,[]); +__d(function(g,r,_i,a,m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),_e2.expiresAt=function(e){return Math.round(Date.now()/1e3)+e},_e2.generateCallbackId=function(){return Symbol('auth-callback')},Object.defineProperty(_e2,"isBrowser",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e2,"supportsLocalStorage",{enumerable:!0,get:function(){return i}}),_e2.parseParametersFromURL=function(e){const t={},n=new URL(e);if(n.hash&&'#'===n.hash[0])try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch(e){}return n.searchParams.forEach((e,n)=>{t[n]=e}),t},Object.defineProperty(_e2,"resolveFetch",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e2,"looksLikeFetchResponse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e2,"setItemAsync",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e2,"getItemAsync",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e2,"removeItemAsync",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e2,"Deferred",{enumerable:!0,get:function(){return p}}),_e2.decodeJWT=function(o){const s=o.split('.');if(3!==s.length)throw new t.AuthInvalidJwtError('Invalid JWT structure');for(let n=0;n{setTimeout(()=>t(null),e)})},_e2.retryable=function(e,t){return new Promise((n,o)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await e(s);if(!t(s,null,o))return void n(o)}catch(e){if(!t(s,e))return void o(e)}})()})},_e2.generatePKCEVerifier=b,_e2.generatePKCEChallenge=S,_e2.getCodeChallengeAndMethod=async function(e,t,n=!1){const o=b();let s=o;n&&(s+='/recovery');await l(e,`${t}-code-verifier`,s);const i=await S(o);return[i,o===i?'plain':'s256']},_e2.parseResponseAPIVersion=function(t){const n=t.headers.get(e.API_VERSION_HEADER_NAME);if(!n)return null;if(!n.match(P))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch(e){return null}},_e2.validateExp=function(e){if(!e)throw new Error('Missing exp claim');const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error('JWT has expired')},_e2.getAlgorithm=function(e){switch(e){case'RS256':return{name:'RSASSA-PKCS1-v1_5',hash:{name:'SHA-256'}};case'ES256':return{name:'ECDSA',namedCurve:'P-256',hash:{name:'SHA-256'}};default:throw new Error('Invalid alg claim')}},_e2.validateUUID=function(e){if(!A.test(e))throw new Error('@supabase/auth-js: Expected parameter to be UUID but is not')},_e2.assertPasskeyExperimentalEnabled=function(e){if(!e.passkey)throw new Error('@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).')},_e2.userNotAvailableProxy=function(){return new Proxy({},{get:(e,t)=>{if('__isUserNotAvailableProxy'===t)return!0;if('symbol'==typeof t){const e=t.toString();if('Symbol(Symbol.toPrimitive)'===e||'Symbol(Symbol.toStringTag)'===e||'Symbol(util.inspect.custom)'===e)return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})},_e2.insecureUserWarningProxy=function(e,t){return new Proxy(e,{get:(e,n,o)=>{if('__isInsecureUserWarningProxy'===n)return!0;if('symbol'==typeof n){const t=n.toString();if('Symbol(Symbol.toPrimitive)'===t||'Symbol(Symbol.toStringTag)'===t||'Symbol(util.inspect.custom)'===t||'Symbol(nodejs.util.inspect.custom)'===t)return Reflect.get(e,n,o)}return t.value||'string'!=typeof n||(console.warn('Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server.'),t.value=!0),Reflect.get(e,n,o)}})},_e2.deepClone=function(e){return JSON.parse(JSON.stringify(e))};var e=r(d[0]),t=r(d[1]),n=r(d[2]);const o=()=>'undefined'!=typeof window&&'undefined'!=typeof document,s={tested:!1,writable:!1},i=()=>{if(!o())return!1;try{if('object'!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(s.tested)return s.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),s.tested=!0,s.writable=!0}catch(e){s.tested=!0,s.writable=!1}return s.writable};const u=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),c=e=>'object'==typeof e&&null!==e&&'status'in e&&'ok'in e&&'json'in e&&'function'==typeof e.json,l=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},f=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return null}},h=async(e,t)=>{await e.removeItem(t)};class p{constructor(){this.promise=new p.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function y(e){return('0'+e.toString(16)).substr(-2)}function b(){const e=new Uint32Array(56);if('undefined'==typeof crypto){const e='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~',t=e.length;let n='';for(let o=0;o<56;o++)n+=e.charAt(Math.floor(Math.random()*t));return n}return crypto.getRandomValues(e),Array.from(e,y).join('')}async function w(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest('SHA-256',t),o=new Uint8Array(n);return Array.from(o).map(e=>String.fromCharCode(e)).join('')}async function S(e){if(!('undefined'!=typeof crypto&&void 0!==crypto.subtle&&'undefined'!=typeof TextEncoder))return console.warn('WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256.'),e;const t=await w(e);return btoa(t).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'')}p.promiseConstructor=Promise;const P=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;const A=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/},1253,[1251,1254,1255]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AuthError",{enumerable:!0,get:function(){return t}}),e.isAuthError=s,Object.defineProperty(e,"AuthApiError",{enumerable:!0,get:function(){return n}}),e.isAuthApiError=function(t){return s(t)&&'AuthApiError'===t.name},Object.defineProperty(e,"AuthUnknownError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CustomAuthError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AuthSessionMissingError",{enumerable:!0,get:function(){return c}}),e.isAuthSessionMissingError=function(t){return s(t)&&'AuthSessionMissingError'===t.name},Object.defineProperty(e,"AuthInvalidTokenResponseError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"AuthInvalidCredentialsError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AuthImplicitGrantRedirectError",{enumerable:!0,get:function(){return f}}),e.isAuthImplicitGrantRedirectError=function(t){return s(t)&&'AuthImplicitGrantRedirectError'===t.name},Object.defineProperty(e,"AuthPKCEGrantCodeExchangeError",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AuthPKCECodeVerifierMissingError",{enumerable:!0,get:function(){return A}}),e.isAuthPKCECodeVerifierMissingError=function(t){return s(t)&&'AuthPKCECodeVerifierMissingError'===t.name},Object.defineProperty(e,"AuthRetryableFetchError",{enumerable:!0,get:function(){return p}}),e.isAuthRetryableFetchError=function(t){return s(t)&&'AuthRetryableFetchError'===t.name},Object.defineProperty(e,"AuthRefreshDiscardedError",{enumerable:!0,get:function(){return b}}),e.isAuthRefreshDiscardedError=function(t){return s(t)&&'AuthRefreshDiscardedError'===t.name},Object.defineProperty(e,"AuthWeakPasswordError",{enumerable:!0,get:function(){return O}}),e.isAuthWeakPasswordError=function(t){return s(t)&&'AuthWeakPasswordError'===t.name},Object.defineProperty(e,"AuthInvalidJwtError",{enumerable:!0,get:function(){return P}});class t extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name='AuthError',this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function s(t){return'object'==typeof t&&null!==t&&'__isAuthError'in t}class n extends t{constructor(t,s,n){super(t,s,n),this.name='AuthApiError',this.status=s,this.code=n}}class o extends t{constructor(t,s){super(t),this.name='AuthUnknownError',this.originalError=s}}class u extends t{constructor(t,s,n,o){super(t,n,o),this.name=s,this.status=n}}class c extends u{constructor(){super('Auth session missing!','AuthSessionMissingError',400,void 0)}}class h extends u{constructor(){super('Auth session or user missing','AuthInvalidTokenResponseError',500,void 0)}}class l extends u{constructor(t){super(t,'AuthInvalidCredentialsError',400,void 0)}}class f extends u{constructor(t,s=null){super(t,'AuthImplicitGrantRedirectError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class E extends u{constructor(t,s=null){super(t,'AuthPKCEGrantCodeExchangeError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class A extends u{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.",'AuthPKCECodeVerifierMissingError',400,'pkce_code_verifier_not_found')}}class p extends u{constructor(t,s){super(t,'AuthRetryableFetchError',s,void 0)}}class b extends u{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,'AuthRefreshDiscardedError',409,void 0)}}class O extends u{constructor(t,s,n){super(t,'AuthWeakPasswordError',s,'weak_password'),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class P extends u{constructor(t){super(t,'AuthInvalidJwtError',400,'invalid_jwt')}}},1254,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.byteToBase64URL=o,e.byteFromBase64URL=i,e.stringToBase64URL=function(t){const u=[],n=t=>{u.push(t)},i={queue:0,queuedBits:0};return f(t,t=>{o(t,i,n)}),o(null,i,n),u.join('')},e.stringFromBase64URL=function(t){const u=[],n=t=>{u.push(String.fromCodePoint(t))},o={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},f=t=>{c(t,o,n)};for(let u=0;u{u.push(t)};for(let u=0;uu.push(t)),new Uint8Array(u)},e.bytesToBase64URL=function(t){const u=[],n={queue:0,queuedBits:0},i=t=>{u.push(t)};return t.forEach(t=>o(t,n,i)),o(null,n,i),u.join('')};const t='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'.split(''),u=' \t\n\r='.split(''),n=(()=>{const n=new Array(128);for(let t=0;t=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}}function i(t,u,o){const i=n[t];if(!(i>-1)){if(-2===i)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}for(u.queue=u.queue<<6|i,u.queuedBits+=6;u.queuedBits>=8;)o(u.queue>>u.queuedBits-8&255),u.queuedBits-=8}function s(t,u){if(!(t<=127)){if(t<=2047)return u(192|t>>6),void u(128|63&t);if(t<=65535)return u(224|t>>12),u(128|t>>6&63),void u(128|63&t);if(t<=1114111)return u(240|t>>18),u(128|t>>12&63),u(128|t>>6&63),void u(128|63&t);throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}u(t)}function f(t,u){for(let n=0;n55295&&o<=56319){const u=1024*(o-55296)&65535;o=65536+(t.charCodeAt(n+1)-56320&65535|u),n+=1}s(o,u)}}function c(t,u,n){if(0===u.utf8seq){if(t<=127)return void n(t);for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){u.utf8seq=n;break}if(2===u.utf8seq)u.codepoint=31&t;else if(3===u.utf8seq)u.codepoint=15&t;else{if(4!==u.utf8seq)throw new Error('Invalid UTF-8 sequence');u.codepoint=7&t}u.utf8seq-=1}else if(u.utf8seq>0){if(t<=127)throw new Error('Invalid UTF-8 sequence');u.codepoint=u.codepoint<<6|63&t,u.utf8seq-=1,0===u.utf8seq&&n(u.codepoint)}}},1255,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SIGN_OUT_SCOPES",{enumerable:!0,get:function(){return t}});const t=['global','local','others']},1256,[]); +__d(function(e,t,s,r,i,n,a){"use strict";Object.defineProperty(n,'__esModule',{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return A}});var o,l=t(a[0]),u=(o=l)&&o.__esModule?o:{default:o},h=t(a[1]),c=t(a[2]),d=t(a[3]),_=t(a[4]),g=t(a[5]),w=t(a[6]),y=t(a[7]),f=t(a[8]),p=t(a[9]),v=t(a[10]),b=t(a[11]);(0,y.polyfillGlobalThis)();const k={url:h.GOTRUE_URL,storageKey:h.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:h.DEFAULT_HEADERS,flowType:'implicit',debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},m={};class R{get jwks(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{cachedAt:e})}constructor(e){var t,s,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},k),e);if(this.storageKey=i.storageKey,this.instanceID=null!==(t=R.nextInstanceID[this.storageKey])&&void 0!==t?t:0,R.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,'function'==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&(0,_.isBrowser)()){const e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=null!==(s=i.experimental)&&void 0!==s?s:{},this.admin=new u.default({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=(0,_.resolveFetch)(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,null!=i.lock&&(this.lock=i.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new b.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,_.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),(0,_.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error('Failed to create a new BroadcastChannel, multi-tab state changes will not be available',e)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener('message',async e=>{this._debug('received broadcast notification from other tab or client',e),'TOKEN_REFRESHED'!==e.data.event&&'SIGNED_IN'!==e.data.event||(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug('#broadcastChannel','error',e)}})}i.skipAutoInitialize||this.initialize().catch(e=>{this._debug('#initialize()','error',e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${f.version}) ${(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())()),await this.initializePromise}async _initialize(){var e;try{let t={},s='none';if((0,_.isBrowser)()&&(t=(0,_.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(t)?s='implicit':await this._isPKCECallback(t)&&(s='pkce')),(0,_.isBrowser)()&&this.detectSessionInUrl&&'none'!==s){const{data:r,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug('#_initialize()','error detecting session from URL',i),(0,c.isAuthImplicitGrantRedirectError)(i)){const t=null===(e=i.details)||void 0===e?void 0:e.code;if('identity_already_exists'===t||'identity_not_found'===t||'single_identity_not_deletable'===t)return{error:i}}return{error:i}}const{session:n,redirectType:a}=r;return this._debug('#_initialize()','detected session in URL',n,'redirect type',a),await this._saveSession(n),setTimeout(async()=>{'recovery'===a?await this._notifyAllSubscribers('PASSWORD_RECOVERY',n):await this._notifyAllSubscribers('SIGNED_IN',n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return(0,c.isAuthError)(e)?this._returnResult({error:e}):this._returnResult({error:new c.AuthUnknownError('Unexpected error during initialization',e)})}finally{await this._handleVisibilityChange(),this._debug('#_initialize()','end')}}async signInAnonymously(e){var t,s,r;try{const i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{data:null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==s?s:{},gotrue_meta_security:{captcha_token:null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken}},xform:d._sessionResponse}),{data:n,error:a}=i;if(a||!n)return this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,s,r;try{let i;if('email'in e){const{email:s,password:r,options:n}=e;let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey)),i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:d._sessionResponse})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:t,password:n,options:a}=e;i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null==a?void 0:a.data)&&void 0!==s?s:{},channel:null!==(r=null==a?void 0:a.channel)&&void 0!==r?r:'sms',gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:d._sessionResponse})}}const{data:n,error:a}=i;if(a||!n)return await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if('email'in e){const{email:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}}const{data:s,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!s||!s.session||!s.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers('SIGNED_IN',s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,null!=this.lock?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:t}=e;switch(t){case'ethereum':return await this.signInWithEthereum(e);case'solana':return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,s,r,i,n,a,o,l,u,h,g;let w,y;if('message'in e)w=e.message,y=e.signature;else{const{chain:h,wallet:c,statement:d,options:g}=e;let f;if((0,_.isBrowser)())if('object'==typeof c)f=c;else{const e=window;if(!('ethereum'in e)||'object'!=typeof e.ethereum||!('request'in e.ethereum)||'function'!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");f=e.ethereum}else{if('object'!=typeof c||!(null==g?void 0:g.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');f=c}const p=new URL(null!==(t=null==g?void 0:g.url)&&void 0!==t?t:window.location.href),b=await f.request({method:'eth_requestAccounts'}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=(0,v.getAddress)(b[0]);let m=null===(s=null==g?void 0:g.signInWithEthereum)||void 0===s?void 0:s.chainId;if(!m){const e=await f.request({method:'eth_chainId'});m=(0,v.fromHex)(e)}const R={domain:p.host,address:k,statement:d,uri:p.href,version:'1',chainId:m,nonce:null===(r=null==g?void 0:g.signInWithEthereum)||void 0===r?void 0:r.nonce,issuedAt:null!==(n=null===(i=null==g?void 0:g.signInWithEthereum)||void 0===i?void 0:i.issuedAt)&&void 0!==n?n:new Date,expirationTime:null===(a=null==g?void 0:g.signInWithEthereum)||void 0===a?void 0:a.expirationTime,notBefore:null===(o=null==g?void 0:g.signInWithEthereum)||void 0===o?void 0:o.notBefore,requestId:null===(l=null==g?void 0:g.signInWithEthereum)||void 0===l?void 0:l.requestId,resources:null===(u=null==g?void 0:g.signInWithEthereum)||void 0===u?void 0:u.resources};w=(0,v.createSiweMessage)(R),y=await f.request({method:'personal_sign',params:[(0,v.toHex)(w),k]})}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'ethereum',message:w,signature:y},(null===(h=e.options)||void 0===h?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null===(g=e.options)||void 0===g?void 0:g.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,s,r,i,n,a,o,l,u,h,g,w;let y,f;if('message'in e)y=e.message,f=e.signature;else{const{chain:c,wallet:d,statement:g,options:w}=e;let p;if((0,_.isBrowser)())if('object'==typeof d)p=d;else{const e=window;if(!('solana'in e)||'object'!=typeof e.solana||!('signIn'in e.solana&&'function'==typeof e.solana.signIn||'signMessage'in e.solana&&'function'==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");p=e.solana}else{if('object'!=typeof d||!(null==w?void 0:w.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');p=d}const v=new URL(null!==(t=null==w?void 0:w.url)&&void 0!==t?t:window.location.href);if('signIn'in p&&p.signIn){const e=await p.signIn(Object.assign(Object.assign(Object.assign({issuedAt:(new Date).toISOString()},null==w?void 0:w.signInWithSolana),{version:'1',domain:v.host,uri:v.href}),g?{statement:g}:null));let t;if(Array.isArray(e)&&e[0]&&'object'==typeof e[0])t=e[0];else{if(!(e&&'object'==typeof e&&'signedMessage'in e&&'signature'in e))throw new Error('@supabase/auth-js: Wallet method signIn() returned unrecognized value');t=e}if(!('signedMessage'in t&&'signature'in t&&('string'==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields');y='string'==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),f=t.signature}else{if(!('signMessage'in p&&'function'==typeof p.signMessage&&'publicKey'in p&&'object'==typeof p&&p.publicKey&&'toBase58'in p.publicKey&&'function'==typeof p.publicKey.toBase58))throw new Error('@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API');y=[`${v.host} wants you to sign in with your Solana account:`,p.publicKey.toBase58(),...g?['',g,'']:[''],'Version: 1',`URI: ${v.href}`,`Issued At: ${null!==(r=null===(s=null==w?void 0:w.signInWithSolana)||void 0===s?void 0:s.issuedAt)&&void 0!==r?r:(new Date).toISOString()}`,...(null===(i=null==w?void 0:w.signInWithSolana)||void 0===i?void 0:i.notBefore)?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...(null===(n=null==w?void 0:w.signInWithSolana)||void 0===n?void 0:n.expirationTime)?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...(null===(a=null==w?void 0:w.signInWithSolana)||void 0===a?void 0:a.chainId)?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...(null===(o=null==w?void 0:w.signInWithSolana)||void 0===o?void 0:o.nonce)?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...(null===(l=null==w?void 0:w.signInWithSolana)||void 0===l?void 0:l.requestId)?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...(null===(h=null===(u=null==w?void 0:w.signInWithSolana)||void 0===u?void 0:u.resources)||void 0===h?void 0:h.length)?['Resources',...w.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join('\n');const e=await p.signMessage((new TextEncoder).encode(y),'utf8');if(!(e&&e instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet signMessage() API returned an recognized value');f=e}}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'solana',message:y,signature:(0,p.bytesToBase64URL)(f)},(null===(g=e.options)||void 0===g?void 0:g.captchaToken)?{gotrue_meta_security:{captcha_token:null===(w=e.options)||void 0===w?void 0:w.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!=t?t:'').split('/');try{if(!s&&'pkce'===this.flowType)throw new c.AuthPKCECodeVerifierMissingError;const{data:t,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:d._sessionResponse});if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('recovery'===r?'PASSWORD_RECOVERY':'SIGNED_IN',t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=r?r:null}),error:i})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,a=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:d._sessionResponse}),{data:o,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o||!o.session||!o.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers('SIGNED_IN',o.session)),this._returnResult({data:o,error:l})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if('email'in e){const{email:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null==i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:t,options:s}=e,{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null==s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null==s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},channel:null!==(n=null==s?void 0:s.channel)&&void 0!==n?n:'sms'}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number.')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,s;try{let r,i;'options'in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:a}=await(0,d._request)(this.fetch,'POST',`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:d._sessionResponse});if(a)throw a;if(!n){throw new Error('An error occurred on token verification.')}const o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers('recovery'==e.type?'PASSWORD_RECOVERY':'SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,s,r,i,n;try{let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const l=await(0,d._request)(this.fetch,'POST',`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},'providerId'in e?{provider_id:e.providerId}:null),'domain'in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:o}),headers:this.headers,xform:d._ssoResponse});return(null===(i=l.data)||void 0===i?void 0:i.url)&&(0,_.isBrowser)()&&!(null===(n=e.options)||void 0===n?void 0:n.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new c.AuthSessionMissingError;const{error:r}=await(0,d._request)(this.fetch,'GET',`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if('email'in e){const{email:s,type:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return o&&await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:s,type:r,options:i}=e,{data:n,error:a}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a type')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,t){this._debug('#_acquireLock','begin',e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug('#_acquireLock','lock acquired for storage key',this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug('#_acquireLock','lock released for storage key',this.storageKey),this.lockAcquired=!1}})}finally{this._debug('#_acquireLock','end')}}async _useSession(e){this._debug('#_useSession','begin');try{const t=await this.__loadSession();return await e(t)}finally{this._debug('#_useSession','end')}}async __loadSession(){this._debug('#__loadSession()','begin'),null==this.lock||this.lockAcquired||this._debug('#__loadSession()','used outside of an acquired lock!',(new Error).stack);try{let e=null;const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(this._debug('#getSession()','session from storage',t),null!==t&&(this._isValidSession(t)?e=t:(this._debug('#getSession()','session from storage is not valid'),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&1e3*e.expires_at-Date.now()Date.now())){const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(t&&t.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:r},error:null})}finally{this._debug('#__loadSession()','end')}}async getUser(e){if(e)return await this._getUser(e);let t;return await this.initializePromise,t=null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):await this._getUser(),t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:e,xform:d._userResponse}):await this._useSession(async e=>{var t,s,r;const{data:i,error:n}=e;if(n)throw n;return(null===(t=i.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0,xform:d._userResponse}):{data:{user:null},error:new c.AuthSessionMissingError}})}catch(e){if((0,c.isAuthError)(e))return(0,c.isAuthSessionMissingError)(e)&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t)):await this._updateUser(e,t)}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new c.AuthSessionMissingError;const n=r.session;let a=null,o=null;'pkce'===this.flowType&&null!=e.email&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{data:l,error:u}=await(0,d._request)(this.fetch,'PUT',`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:d._userResponse});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers('USER_UPDATED',n),this._returnResult({data:{user:n.user},error:null})})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new c.AuthSessionMissingError;const t=Date.now()/1e3;let s=t,r=!0,i=null;const{payload:n}=(0,_.decodeJWT)(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{data:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:'bearer',expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers('SIGNED_IN',i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null==e?void 0:e.refresh_token))throw new c.AuthSessionMissingError;const{data:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var s;try{if(!(0,_.isBrowser)())throw new c.AuthImplicitGrantRedirectError('No browser detected.');if(e.error||e.error_description||e.error_code)throw new c.AuthImplicitGrantRedirectError(e.error_description||'Error in URL with unspecified error_description',{error:e.error||'unspecified_error',code:e.error_code||'unspecified_code'});switch(t){case'implicit':if('pkce'===this.flowType)throw new c.AuthPKCEGrantCodeExchangeError('Not a valid PKCE flow url.');break;case'pkce':if('implicit'===this.flowType)throw new c.AuthImplicitGrantRedirectError('Not a valid implicit grant flow url.')}if('pkce'===t){if(this._debug('#_initialize()','begin','is PKCE flow',!0),!e.code)throw new c.AuthPKCEGrantCodeExchangeError('No code detected.');const{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;const i=new URL(window.location.href);return i.searchParams.delete('code'),window.history.replaceState(window.history.state,'',i.toString()),{data:{session:t.session,redirectType:null!==(s=t.redirectType)&&void 0!==s?s:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:n,refresh_token:a,expires_in:o,expires_at:l,token_type:u}=e;if(!(n&&o&&a&&u))throw new c.AuthImplicitGrantRedirectError('No session defined in URL');const d=Math.round(Date.now()/1e3),g=parseInt(o);let w=d+g;l&&(w=parseInt(l));const y=w-d;1e3*y<=h.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${g}s`);const f=w-g;d-f>=120?console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale',f,w,d):d-f<0&&console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew',f,w,d);const{data:p,error:v}=await this._getUser(n);if(v)throw v;const b={provider_token:r,provider_refresh_token:i,access_token:n,expires_in:g,expires_at:w,refresh_token:a,token_type:u,user:p.user};return window.location.hash='',this._debug('#_getSessionFromURL()','clearing window.location.hash'),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return'function'==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:'global'}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:'global'}){return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i&&!(0,c.isAuthSessionMissingError)(i))return this._returnResult({error:i});const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!(0,c.isAuthApiError)(t)||404!==t.status&&401!==t.status&&403!==t.status)&&!(0,c.isAuthSessionMissingError)(t))return this._returnResult({error:t})}return'others'!==e&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=(0,_.generateCallbackId)(),s={id:t,callback:e,unsubscribe:()=>{this._debug('#unsubscribe()','state change callback with id removed',t),this.stateChangeEmitters.delete(t)}};return this._debug('#onAuthStateChange()','registered callback with id',t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)}):await this._emitInitialSession(t)})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback('INITIAL_SESSION',r)),this._debug('INITIAL_SESSION','callback id',e,'session',r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback('INITIAL_SESSION',null)),this._debug('INITIAL_SESSION','callback id',e,'error',t),(0,c.isAuthSessionMissingError)(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let s=null,r=null;'pkce'===this.flowType&&([s,r]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,d._request)(this.fetch,'POST',`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return'token'in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:s,error:r}=await this._useSession(async t=>{var s,r,i,n,a;const{data:o,error:l}=t;if(l)throw l;const u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await(0,d._request)(this.fetch,'GET',u,{headers:this.headers,jwt:null!==(a=null===(n=o.session)||void 0===n?void 0:n.access_token)&&void 0!==a?a:void 0})});if(r)throw r;return(0,_.isBrowser)()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==s?void 0:s.url),this._returnResult({data:{provider:e.provider,url:null==s?void 0:s.url},error:null})}catch(t){if((0,c.isAuthError)(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var s;try{const{error:r,data:{session:i}}=t;if(r)throw r;const{options:n,provider:a,token:o,access_token:l,nonce:u}=e,h=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(s=null==i?void 0:i.access_token)&&void 0!==s?s:void 0,body:{provider:a,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:d._sessionResponse}),{data:_,error:g}=h;return g?this._returnResult({data:{user:null,session:null},error:g}):_&&_.session&&_.user?(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers('USER_UPDATED',_.session)),this._returnResult({data:_,error:g})):this._returnResult({data:{user:null,session:null},error:new c.AuthInvalidTokenResponseError})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){const t="#_refreshAccessToken()";this._debug(t,'begin');try{const s=Date.now();return await(0,_.retryable)(async s=>(s>0&&await(0,_.sleep)(200*Math.pow(2,s-1)),this._debug(t,'refreshing attempt',s),await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:d._sessionResponse})),(e,t)=>{const r=200*Math.pow(2,e);return t&&(0,c.isAuthRetryableFetchError)(t)&&Date.now()+r-sDate.now())?this._debug(r,'proactive refresh failed, access token still valid \u2014 preserving session'):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:s,expiresAt:Date.now()+h.REFRESH_FAILURE_COOLDOWN_MS},null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,'end')}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,'begin',t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map(async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(i),r.length>0){for(let e=0;ethis._autoRefreshTokenTick(),h.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&'object'==typeof e&&'function'==typeof e.unref?e.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&'object'==typeof t&&'function'==typeof t.unref?t.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug('#_stopAutoRefresh()');const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),null===(e=this.broadcastChannel)||void 0===e||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug('#_autoRefreshTokenTick()','begin'),null==this.lock)if(null===this.refreshingDeferred)try{const e=Date.now();try{await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}else this._debug('#_autoRefreshTokenTick()','refresh already in flight, skipping');else try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}})}catch(e){if(!(e instanceof w.LockAcquireTimeoutError))throw e;this._debug('auto refresh token tick lock not available')}}async _handleVisibilityChange(){if(this._debug('#_handleVisibilityChange()'),!(0,_.isBrowser)()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug('#visibilityChangedCallback','error',e)}},null===window||void 0===window||window.addEventListener('visibilitychange',this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error('_handleVisibilityChange',e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;if(this._debug(t,'visibilityState',document.visibilityState),'visible'===document.visibilityState){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,null!=this.lock)await this._acquireLock(this.lockAcquireTimeout,async()=>{'visible'===document.visibilityState?await this._recoverAndRefresh():this._debug(t,'acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting')});else{if('visible'!==document.visibilityState)return void this._debug(t,'visibilityState is no longer visible, skipping recovery');await this._recoverAndRefresh()}}else'hidden'===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null==s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null==s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),'pkce'===this.flowType){const[e,t]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey),s=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(s.toString())}if(null==s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null==s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join('&')}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;return i?this._returnResult({data:null,error:i}):await(0,d._request)(this.fetch,'DELETE',`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)return this._returnResult({data:null,error:n});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},'phone'===e.factorType?{phone:e.phone}:'totp'===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors`,{body:a,headers:this.headers,jwt:null===(s=null==i?void 0:i.session)||void 0===s?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):('totp'===e.factorType&&'totp'===o.type&&(null===(r=null==o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=Object.assign({challenge_id:e.challengeId},'webauthn'in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:'create'===e.webauthn.type?(0,b.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,b.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/verify`,{body:n,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers('MFA_CHALLENGE_VERIFIED',a),this._returnResult({data:a,error:o}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challenge(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});if(n.error)return n;const{data:a}=n;if('webauthn'!==a.type)return{data:a,error:null};switch(a.webauthn.type){case'create':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case'request':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:s}=await this.getUser();if(s)return{data:null,error:s};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])r.all.push(s),'verified'===s.status&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,s,r,i;if(e)try{const{payload:r}=(0,_.decodeJWT)(e);let i=null;r.aal&&(i=r.aal);let n=i;const{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!==(s=null===(t=null==a?void 0:a.factors)||void 0===t?void 0:t.filter(e=>'verified'===e.status))&&void 0!==s?s:[]).length>0&&(n='aal2');return{data:{currentLevel:i,nextLevel:n,currentAuthenticationMethods:r.amr||[]},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}const{data:{session:n},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=(0,_.decodeJWT)(n.access_token);let l=null;o.aal&&(l=o.aal);let u=l;(null!==(i=null===(r=n.user.factors)||void 0===r?void 0:r.filter(e=>'verified'===e.status))&&void 0!==i?i:[]).length>0&&(u='aal2');return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?await(0,d._request)(this.fetch,'GET',`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'approve'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'deny'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;return s?this._returnResult({data:null,error:s}):t?await(0,d._request)(this.fetch,'GET',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?(await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let s=t.keys.find(t=>t.kid===e);if(s)return s;const r=Date.now();if(s=this.jwks.keys.find(t=>t.kid===e),s&&this.jwks_cached_at+h.JWKS_TTL>r)return s;const{data:i,error:n}=await(0,d._request)(this.fetch,'GET',`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(n)throw n;return i.keys&&0!==i.keys.length?(this.jwks=i,this.jwks_cached_at=r,s=i.keys.find(t=>t.kid===e),s||null):null}async getClaims(e,t={}){try{let s=e;if(!s){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}const{header:r,payload:i,signature:n,raw:{header:a,payload:o}}=(0,_.decodeJWT)(s);if(!(null==t?void 0:t.allowExpired))try{(0,_.validateExp)(i.exp)}catch(e){throw new c.AuthInvalidJwtError(e instanceof Error?e.message:'JWT validation failed')}const l=r.alg&&!r.alg.startsWith('HS')&&r.kid&&'crypto'in globalThis&&'subtle'in globalThis.crypto?await this.fetchJwk(r.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!l){const{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:i,header:r,signature:n},error:null}}const u=(0,_.getAlgorithm)(r.alg),h=await crypto.subtle.importKey('jwk',l,u,!0,['verify']);if(!await crypto.subtle.verify(u,h,n,(0,p.stringToUint8Array)(`${a}.${o}`)))throw new c.AuthInvalidJwtError('Invalid JWT signature');return{data:{claims:i,header:r,signature:n},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,s,r;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:i,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}});if(n||!i)return this._returnResult({data:null,error:n});const a=(0,b.deserializeCredentialRequestOptions)(i.options),o=null!==(r=null===(s=null==e?void 0:e.options)||void 0===s?void 0:s.signal)&&void 0!==r?r:b.webAuthnAbortService.createNewAbortSignal(),{data:l,error:u}=await(0,b.getCredential)({publicKey:a,signal:o});if(u||!l)return this._returnResult({data:null,error:null!=u?u:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const h=(0,b.serializeCredentialRequestResponse)(l);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,s;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const n=(0,b.deserializeCredentialCreationOptions)(r.options),a=null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.signal)&&void 0!==s?s:b.webAuthnAbortService.createNewAbortSignal(),{data:o,error:l}=await(0,b.createCredential)({publicKey:n,signal:a});if(l||!o)return this._returnResult({data:null,error:null!=l?l:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const u=(0,b.serializeCredentialCreationResponse)(o);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:s,error:r}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:s,error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:d._sessionResponse});return s?this._returnResult({data:null,error:s}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:t,error:null}))}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'GET',`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'PATCH',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:e.friendlyName}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{error:i}=await(0,d._request)(this.fetch,'DELETE',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}}R.nextInstanceID={};var A=R},1257,[1249,1251,1254,1250,1253,1258,1259,1260,1252,1255,1261,1262]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.memoryLocalStorageAdapter=function(t={}){return{getItem:o=>t[o]||null,setItem:(o,n)=>{t[o]=n},removeItem:o=>{delete t[o]}}}},1258,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"internals",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"LockAcquireTimeoutError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"ProcessLockAcquireTimeoutError",{enumerable:!0,get:function(){return s}}),_e.navigatorLock=async function(e,t,s){o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire lock',e,t);const c=new globalThis.AbortController;let l;t>0&&(l=setTimeout(()=>{c.abort(),o.debug&&console.log('@supabase/gotrue-js: navigatorLock acquire timed out',e)},t));await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:'exclusive',ifAvailable:!0}:{mode:'exclusive',signal:c.signal},async c=>{if(!c){if(0===t)throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: not immediately available',e),new n(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(o.debug)try{const e=await globalThis.navigator.locks.query();console.log('@supabase/gotrue-js: Navigator LockManager state',JSON.stringify(e,null,' '))}catch(e){console.warn('@supabase/gotrue-js: Error when querying Navigator LockManager state',e)}return console.warn('@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request'),clearTimeout(l),await s()}clearTimeout(l),o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquired',e,c.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released',e,c.name)}})}catch(u){if(t>0&&clearTimeout(l),null!==u&&'object'==typeof u&&'name'in u&&'AbortError'===u.name&&t>0){if(c.signal.aborted)return o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock',e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:'exclusive',steal:!0},async t=>{if(!t)return console.warn('@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true'),await s();o.debug&&console.log('@supabase/gotrue-js: navigatorLock: recovered (stolen)',e,t.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released (stolen)',e,t.name)}}));throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: lock was stolen by another request',e),new n(`Lock "${e}" was released because another request stole it`)}throw u}},_e.processLock=async function(e,o,n){var l;const u=null!==(l=c[e])&&void 0!==l?l:Promise.resolve(),b=(async()=>{try{return await u,null}catch(e){return null}})(),k=(async()=>{let c=null;try{const t=o>=0?new Promise((t,n)=>{c=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${e}" acquisition timed out after ${o}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),n(new s(`Acquiring process lock with name "${e}" timed out`))},o)}):null;await Promise.race([b,t].filter(e=>e)),null!==c&&clearTimeout(c)}catch(e){if(null!==c&&clearTimeout(c),e instanceof t)throw e}return await n()})();return c[e]=(async()=>{try{return await k}catch(e){if(e instanceof t){try{await u}catch(e){}return null}throw e}})(),await k};var e=r(d[0]);const o={debug:!!(globalThis&&(0,e.supportsLocalStorage)()&&globalThis.localStorage&&'true'===globalThis.localStorage.getItem('supabase.gotrue-js.locks.debug'))};class t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class n extends t{}class s extends t{}const c={}},1259,[1253]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.polyfillGlobalThis=function(){if('object'==typeof globalThis)return;try{Object.defineProperty(Object.prototype,'__magic__',{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){'undefined'!=typeof self&&(self.globalThis=self)}}},1260,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}Object.defineProperty(e,'__esModule',{value:!0}),e.getAddress=t,e.fromHex=function(t){return parseInt(t,16)},e.toHex=function(t){const n=(new TextEncoder).encode(t);return'0x'+Array.from(n,t=>t.toString(16).padStart(2,'0')).join('')},e.createSiweMessage=function(n){var s;const{chainId:o,domain:u,expirationTime:c,issuedAt:l=new Date,nonce:f,notBefore:I,requestId:v,resources:h,scheme:$,uri:w,version:E}=n;if(!Number.isInteger(o))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${o}`);if(!u)throw new Error("@supabase/auth-js: Invalid SIWE message field \"domain\". Domain must be provided.");if(f&&f.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${f}`);if(!w)throw new Error("@supabase/auth-js: Invalid SIWE message field \"uri\". URI must be provided.");if('1'!==E)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${E}`);if(null===(s=n.statement)||void 0===s?void 0:s.includes('\n'))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`);const S=t(n.address),b=$?`${$}://${u}`:u,p=n.statement?`${n.statement}\n`:'',j=`${b} wants you to sign in with your Ethereum account:\n${S}\n\n${p}`;let x=`URI: ${w}\nVersion: ${E}\nChain ID: ${o}${f?`\nNonce: ${f}`:''}\nIssued At: ${l.toISOString()}`;c&&(x+=`\nExpiration Time: ${c.toISOString()}`);I&&(x+=`\nNot Before: ${I.toISOString()}`);v&&(x+=`\nRequest ID: ${v}`);if(h){let t='\nResources:';for(const n of h){if(!n||'string'!=typeof n)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${n}`);t+=`\n- ${n}`}x+=t}return`${j}\n${x}`}},1261,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return l.WebAuthnError}}),Object.defineProperty(e,"isWebAuthnError",{enumerable:!0,get:function(){return l.isWebAuthnError}}),Object.defineProperty(e,"identifyRegistrationError",{enumerable:!0,get:function(){return l.identifyRegistrationError}}),Object.defineProperty(e,"identifyAuthenticationError",{enumerable:!0,get:function(){return l.identifyAuthenticationError}}),Object.defineProperty(e,"WebAuthnAbortService",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"webAuthnAbortService",{enumerable:!0,get:function(){return u}}),e.deserializeCredentialCreationOptions=function(i){if(!i)throw new Error('Credential creation options are required');if('undefined'!=typeof PublicKeyCredential&&'parseCreationOptionsFromJSON'in PublicKeyCredential&&'function'==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:o,user:l,excludeCredentials:s}=i,u=(0,t.__rest)(i,["challenge","user","excludeCredentials"]),c=(0,n.base64UrlToUint8Array)(o).buffer,f=Object.assign(Object.assign({},l),{id:(0,n.base64UrlToUint8Array)(l.id).buffer}),h=Object.assign(Object.assign({},u),{challenge:c,user:f});if(s&&s.length>0){h.excludeCredentials=new Array(s.length);for(let t=0;t0){c.allowCredentials=new Array(l.length);for(let t=0;tnull!==t&&'object'==typeof t&&!Array.isArray(t),i=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),o={};for(const l of t)if(l)for(const t in l){const s=l[t];if(void 0!==s)if(Array.isArray(s))o[t]=s;else if(i(s))o[t]=s;else if(n(s)){const i=o[t];n(i)?o[t]=p(i,s):o[t]=p(s)}else o[t]=s}return o}function w(t,n){return p(b,t,n||{})}function A(t,n){return p(y,t,n||{})}class O{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:'webauthn'}))}async _challenge({factorId:t,webauthn:n,friendlyName:o,signal:l},s){var c;try{const{data:i,error:b}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!i)return{data:null,error:b};const y=null!=l?l:u.createNewAbortSignal();if('create'===i.webauthn.type){const{user:t}=i.webauthn.credential_options.publicKey;if(!t.name){const n=o;if(n)t.name=`${t.id}:${n}`;else{const n=(await this.client.getUser()).data.user,i=(null===(c=null==n?void 0:n.user_metadata)||void 0===c?void 0:c.name)||(null==n?void 0:n.email)||(null==n?void 0:n.id)||'User';t.name=`${t.id}:${i}`}}t.displayName||(t.displayName=t.name)}switch(i.webauthn.type){case'create':{const n=w(i.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:o,error:l}=await f({publicKey:n,signal:y});return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}case'request':{const n=A(i.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:o,error:l}=await h(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:n,signal:y}));return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in challenge',t)}}}async _verify({challengeId:t,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:i})}async _authenticate({factorId:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn authentication')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:o},signal:l},{request:s});if(!u)return{data:null,error:f};const{webauthn:h}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:o,credential_response:h.credential_response}})}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in authenticate',t)}}}async _register({friendlyName:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn registration')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(n=>{var i;return null===(i=n.data)||void 0===i?void 0:i.all.find(n=>'webauthn'===n.factor_type&&n.friendly_name===t&&'unverified'!==n.status)}).then(t=>t?this.client.mfa.unenroll({factorId:null==t?void 0:t.id}):void 0),{data:null,error:f};const{data:h,error:b}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:o},signal:l},{create:s});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:o,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:b}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in register',t)}}}}},1262,[1227,1255,1254,1253,1263]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebAuthnUnknownError",{enumerable:!0,get:function(){return t}}),e.isWebAuthnError=function(n){return'object'==typeof n&&null!==n&&'__isWebAuthnError'in n},e.identifyRegistrationError=function({error:t,options:s}){var u,c,R;const{publicKey:E}=s;if(!E)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Registration ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else if('ConstraintError'===t.name){if(!0===(null===(u=E.authenticatorSelection)||void 0===u?void 0:u.requireResidentKey))return new o({message:'Discoverable credentials were required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',cause:t});if('conditional'===s.mediation&&'required'===(null===(c=E.authenticatorSelection)||void 0===c?void 0:c.userVerification))return new o({message:'User verification was required during automatic registration but it could not be performed',code:'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',cause:t});if('required'===(null===(R=E.authenticatorSelection)||void 0===R?void 0:R.userVerification))return new o({message:'User verification was required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',cause:t})}else{if('InvalidStateError'===t.name)return new o({message:'The authenticator was previously registered',code:'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',cause:t});if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('NotSupportedError'===t.name){return 0===E.pubKeyCredParams.filter(n=>'public-key'===n.type).length?new o({message:'No entry in pubKeyCredParams was of type "public-key"',code:'ERROR_MALFORMED_PUBKEYCREDPARAMS',cause:t}):new o({message:'No available authenticator supported any of the specified pubKeyCredParams algorithms',code:'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',cause:t})}if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(E.rp.id!==s)return new o({message:`The RP ID "${E.rp.id}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('TypeError'===t.name){if(E.user.id.byteLength<1||E.user.id.byteLength>64)return new o({message:'User ID was not between 1 and 64 characters',code:'ERROR_INVALID_USER_ID_LENGTH',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new credential',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})},e.identifyAuthenticationError=function({error:t,options:s}){const{publicKey:u}=s;if(!u)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Authentication ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else{if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(u.rpId!==s)return new o({message:`The RP ID "${u.rpId}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new assertion signature',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})};var n=r(d[0]);class o extends Error{constructor({message:n,code:o,cause:t,name:s}){var u;super(n,{cause:t}),this.__isWebAuthnError=!0,this.name=null!==(u=null!=s?s:t instanceof Error?t.name:void 0)&&void 0!==u?u:'Unknown Error',this.code=o}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class t extends o{constructor(n,o){super({code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:o,message:n}),this.name='WebAuthnUnknownError',this.originalError=o}}},1263,[1262]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1264,[1249]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1265,[1257]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.setSyncNamespace=function(e){s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:${e}:`:`cc-sync:${e}:`},Object.defineProperty(_e,"syncNamespace",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"kv",{enumerable:!0,get:function(){return i}}),_e.uuid=function(){const e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();const t=new Uint8Array(16);if(e?.getRandomValues)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,'0')).join('');return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`};var e,t=r(d[0]),n=r(d[1]),c=(e=n)&&e.__esModule?e:{default:e};let s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:`:'cc-sync:';const o=()=>s,i={async get(e,t){try{const n=await c.default.getItem(s+e);return null==n?t:JSON.parse(n)}catch{return t}},async set(e,t){try{await c.default.setItem(s+e,JSON.stringify(t))}catch{}},async remove(e){try{await c.default.removeItem(s+e)}catch{}}}},1266,[5,1188]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UK14",{enumerable:!0,get:function(){return t}}),e.cardAllergenMap=n,e.applyServerCard=function(t,s){const i=s.updated_at?new Date(String(s.updated_at)).toISOString():t.updatedAt,o=s.doc?.item?.allergenNotes;return{...t,allergens:n(s.allergens,s.may_contain),allergenNotes:'string'==typeof o&&o?o:void 0,dish:'string'==typeof s.dish&&s.dish?s.dish:t.dish,section:'string'==typeof s.section&&s.section?s.section:t.section,price:'number'==typeof s.price_pence?s.price_pence:t.price,signOff:t.signOff??{by:'Head chef',at:i}}},e.serverItem=function(t,s){const i=t.doc?.item;return i&&i.id?{...i,restaurantId:s,allergens:n(t.allergens,t.may_contain)}:null},Object.defineProperty(e,"noAllergenWords",{enumerable:!0,get:function(){return s}});const t=['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'];function n(n,s){const i=n=>Array.isArray(n)?n.map(String).filter(n=>t.includes(n)):[],o={};for(const t of i(s))o[t]='may';for(const t of i(n))o[t]='contains';return o}const s=t=>t?'No listed allergens':'Allergens not confirmed yet: ask staff'},1267,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isKitchenTeam",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canEditKitchenRota",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"kitchenTeam",{enumerable:!0,get:function(){return c}}),e.kitchenPending=function(t,n,c,s){return t.filter(t=>n.has(t.staffId)&&!!t.date&&t.date>=c&&t.date<=s&&(!t.published||t.changed))},e.publishKitchen=function(t,n,c,s){let u=0;return{shifts:t.map(t=>!n.has(t.staffId)||!t.date||t.dates||t.published&&!t.changed?t:(u++,{...t,published:!0,changed:!1})),n:u}},Object.defineProperty(e,"clashes",{enumerable:!0,get:function(){return s}});const t=t=>'kitchen'===String(t.dept??'').trim().toLowerCase()&&'owner'!==t.role&&'manager'!==t.role&&!t.managerAccess&&!t.ownerAccess,n=t=>t.includes('*')||t.includes('rota.kitchen')||t.includes('rota.manage'),c=n=>n.filter(n=>!1!==n.active&&t(n));const s=(t,n,c,s,u,o)=>t.some(t=>t.staffId===n&&t.date===c&&t.id!==o&&t.startt.category===n&&t.menuPrice&&t.id!==r).map(t=>t.menuPrice);return i.length?{avg:Math.round(i.reduce((t,n)=>t+n,0)/i.length),count:i.length}:null},Object.defineProperty(e,"GRAMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"PACK_UNITS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"unitName",{enumerable:!0,get:function(){return u}}),e.convert=function(t,n,r){const i=a[n],o=a[r];return i&&o&&i.dim===o.dim?t*i.f/o.f:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"perServing",{enumerable:!0,get:function(){return f}}),e.perBaseUnit=d,Object.defineProperty(e,"servingWord",{enumerable:!0,get:function(){return p}}),e.lineCost=g,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return m}}),e.suggestAllergens=function t(n,r,i=[],o=0){const c=new Set;for(const a of n.lines)if(a.ingId.startsWith('dish:')){const n=i.find(t=>t.id===a.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>c.add(t)),t(n,r,i,o+1).forEach(t=>c.add(t)))}else r.find(t=>t.id===a.ingId)?.allergens?.forEach(t=>c.add(t));return[...c]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return h}}),e.gpOf=P,e.toPricePoint=b,e.suggestPrice=y,Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return O}}),e.multipleOf=function(t,n,r,i="inc"){return t<=0?0:('inc'===i?n:h(n,r))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return x}}),e.suggestForMultiple=function(t,n,r,i,o){const c=t*Math.max(0,n)*('ex'===i?1+r/100:1);return o?b(Math.ceil(c)):Math.ceil(c)},e.amountLabel=S,e.cardCostSummary=function(t,n,r,i){const o=(t?.lines??[]).map(t=>{const r=n.find(n=>n.id===t.ingId);return{line:t,name:r?.name??'Removed ingredient',cost:g(t,n),label:S(t,r)}}),c=o.reduce((t,n)=>t+n.cost,0),a=Math.max(1,t?.portions||1),s=c/a,u=t?.target??r.defaultTarget??70,l=s>0?y(s,u,r.vatPct,r.pricePoints):null,f=t?.menuPrice&&t.menuPrice>0?t.menuPrice:null,d=f??(i&&i>0?i:l),p=d&&s>0?P(s,d,r.vatPct):null;return{lines:o,batch:c,perPortion:s,target:u,suggested:l,price:d,priceIsSuggested:!(f||i&&i>0),gp:p?p.gpPct:null,cashGp:p?p.cashGp:null,foodCostPct:p?p.foodCostPct:null,tone:p?v(p.gpPct,u):null,missing:o.filter(t=>t.cost<=0).length}},Object.defineProperty(e,"foodCostTargetOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"targetGpForFoodCost",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"foodCostTone",{enumerable:!0,get:function(){return C}}),e.lineRates=function(t,n,r){const i=Math.max(1,n||1),o=r?d(r):null;return{perPortion:t/i,perKilo:o?o.pence:null,per:o?o.per:null}},e.lineRatesText=function(t){return`${M(t.perPortion)} a portion${null!=t.perKilo?` \xb7 ${M(t.perKilo)} a ${'item'===t.per?'item':t.per}`:''}`},e.vatAwareGp=function(t,n,r){const i=P(t,n,r),o=n>0?(n-t)/n*100:0;return{...i,vatPence:n-i.ex,naiveGpPct:o}},e.menuOverview=function(t){return[...t].sort((t,n)=>(null==t.gp?1:0)-(null==n.gp?1:0)||(t.gp??0)-(n.gp??0)||(n.foodCostPct??0)-(t.foodCostPct??0)||t.name.localeCompare(n.name))},e.marginDrops=function(t,n){const r=new Set,i=[];for(const o of[...t].filter(t=>t.gp&&t.date>=n).sort((t,n)=>(n.gp.at||n.date).localeCompare(t.gp.at||t.date)))for(const t of o.gp.dishes)null==t.before||null==t.after||r.has(t.id)||t.aftert.prices?.length?t.prices:[{p:t.packPrice,at:''}];function i(t,n=5){const i=r(t),o=i.slice(-Math.max(1,n)),c=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:i[i.length-1].p,avg:c,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const o=(t,n="latest",r=5)=>'average'===n?i(t,r).avg:i(t,r).latest;const c={g:1,kg:1e3,oz:28.349523125,lb:453.59237,stone:1e3*t.KG_PER_STONE},a={kg:{dim:'mass',f:c.kg},g:{dim:'mass',f:c.g},oz:{dim:'mass',f:c.oz},lb:{dim:'mass',f:c.lb},stone:{dim:'mass',f:c.stone},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},s=['kg','g','stone','lb','oz','L','ml','each'],u=(t,n=1)=>'L'===t?1===n?'litre':'litres':'stone'===t?'stone':'each'===t?'each':t;const l=(t,n)=>[...'mass'===a[t].dim?['g','kg','oz','lb']:'vol'===a[t].dim?['ml','L']:['each'],...n&&n>0?['serving']:[]],f=t=>t.servings&&t.servings>0?t.packPrice/t.servings:null;function d(t){const n=a[t.packUnit];if(!(n&&t.packSize>0))return null;const r=t.packSize*n.f;return'mass'===n.dim?{pence:t.packPrice/r*1e3,per:'kg'}:'vol'===n.dim?{pence:t.packPrice/r*1e3,per:'litre'}:{pence:t.packPrice/r,per:'item'}}const p=(t,n)=>{const r=(t?.servingName||'serving').trim().toLowerCase();return 1===n?r:/(s|sh|ch|x)$/.test(r)?`${r}es`:`${r}s`};function g(t,n,r=[],i=0){if(t.ingId.startsWith('dish:')){const o=r.find(n=>n.id===t.ingId.slice(5));return o&&i<4?m(o,n,r,i+1)*t.qty:0}const o=n.find(n=>n.id===t.ingId);if(!o||!o.packSize)return 0;if('serving'===t.unit){const n=f(o);return null==n?0:t.qty*n}const c=a[o.packUnit],s=a[t.unit];if(!s||c.dim!==s.dim)return 0;const u=o.packPrice/(o.packSize*c.f),l=Math.min(95,Math.max(0,t.wastePct??o.wastePct??0));return t.qty*s.f*u/(1-l/100)}const m=(t,n,r=[],i=0)=>t.lines.reduce((t,o)=>t+g(o,n,r,i),0)/Math.max(1,t.portions||1);const h=(t,n)=>t/(1+n/100);function P(t,n,r){const i=h(n,r);return{ex:i,gpPct:i>0?(i-t)/i*100:0,cashGp:i-t,foodCostPct:i>0?t/i*100:0}}function b(t){const n=Math.floor(t/100),r=t-100*n;return r<=50?100*n+50:r<=95?100*n+95:100*(n+1)+50}function y(t,n,r,i){const o=t/(1-Math.min(95,Math.max(0,n))/100)*(1+r/100);return i?b(Math.ceil(o)):Math.ceil(o)}const v=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',M=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,O=t=>`${t.toFixed(1)}%`;const x=t=>`${t.toFixed(1)}x`;function S(t,n){const r=Number.isInteger(t.qty)?String(t.qty):String(Math.round(1e3*t.qty)/1e3);return'serving'===t.unit?`${r} ${p(n,t.qty)}`:'each'===t.unit?`${r} ${1===t.qty?'item':'items'}`:`${r} ${u(t.unit,t.qty)}`}const k=t=>Math.round(10*(100-t))/10,j=t=>Math.round(10*(100-Math.min(60,Math.max(5,t))))/10,C=(t,n)=>t<=n+.05?'ok':t<=n+5?'amber':'red'},1269,[1083]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"piecesPerPack",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pieceName",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"lineTotal",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"deliveryTotal",{enumerable:!0,get:function(){return l}}),e.countPacks=a,Object.defineProperty(e,"countLineValue",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"countValue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"countUnitsFor",{enumerable:!0,get:function(){return p}}),e.applyDelivery=function(i,c,l,a,u=(new Date).toISOString(),o){let p=f(i,c.id,l,u,o);const v=`${c.date}T12:00:00.000Z`,h=c.lines.map(i=>{const o=i.name.trim();let f=p.find(n=>n.id===i.ingId)??p.find(n=>n.name.trim().toLowerCase()===o.toLowerCase());const h={p:Math.round(i.packPrice),at:v,src:c.id},k=t(i),b=k?{servings:Math.round(1e3*k)/1e3,servingName:s(i)}:{};if(!f){const n=a();return f={id:n,name:o,packSize:i.packSize,packUnit:i.packUnit,packPrice:h.p,wastePct:0,prices:[h],...b,...c.supplier.trim()?{supplier:c.supplier.trim()}:{},updatedAt:u},p=[...p,f],{...i,ingId:n,name:o,...k?{prevServings:null,prevServingName:null}:{}}}const P=d([...f.prices?.length?f.prices:[{p:f.packPrice,at:''}],h]).slice(-20),y=k?{prevServings:f.servings??null,prevServingName:f.servingName??null}:{},S={...f,packSize:i.packSize,packUnit:i.packUnit,prices:P,...b,...c.supplier.trim()?{supplier:c.supplier.trim()}:{},updatedAt:u};return S.packPrice=(0,n.costingPrice)(S,l.priceBasis,l.avgOf??5),p=p.map(n=>n.id===f.id?S:n),{...i,ingId:f.id,name:f.name,...y}});return{ingredients:p,lines:h}},e.removeDeliveryPrices=f,e.matchIngredient=function(n,t){const i=k(n);if(!i.length)return null;let s=null,c=0;for(const l of t){if(h(n)!==h(l.name))continue;const t=k(l.name),a=(n,t)=>n===t||Math.min(n.length,t.length)>=5&&(n.startsWith(t)||t.startsWith(n)),u=i.filter(n=>t.some(t=>a(n,t))).length,o=u?u/Math.max(i.length,t.length)+(l.name.trim().toLowerCase()===n.trim().toLowerCase()?1:0):0;o>c&&(c=o,s=l)}return c>=.5?s:null},e.cardUnit=b,e.suggestAmount=function(t,i,s){const c=(0,n.unitsFor)(s.packUnit,s.servings),l=Number(String(t).replace(',','.').trim()),a=b(i);if(Number.isFinite(l)&&l>0&&a){if('each'===a&&!c.includes('each')&&c.includes('serving'))return{qty:l,unit:'serving'};if(c.includes(a))return{qty:l,unit:a}}return{qty:0,unit:c[0]}};var n=r(_d[0]);const t=n=>n.count&&n.count>0&&n.packs>0?n.count/n.packs:null,i=n=>{const t=n.trim().toLowerCase();return t.length>3&&/ies$/.test(t)?`${t.slice(0,-3)}y`:t.length>3&&/(sh|ch|x)es$/.test(t)?t.slice(0,-2):t.length>3&&/s$/.test(t)&&!/ss$/.test(t)?t.slice(0,-1):t},s=n=>i(n.countName||'piece')||'piece',c=n=>Math.round((n.packs||0)*(n.packPrice||0)),l=n=>n.lines.reduce((n,t)=>n+c(t),0);function a(t){if(!(t.qty>=0))return null;if('pack'===t.unit)return t.qty;if('serving'===t.unit)return t.servings&&t.servings>0?t.qty/t.servings:null;const i=(0,n.convert)(t.qty,t.unit,t.packUnit);return null!=i&&t.packSize>0?i/t.packSize:null}const u=n=>{const t=a(n);return null==t?0:Math.round(t*n.packPrice)},o=n=>n.lines.reduce((n,t)=>n+u(t),0),p=t=>['pack',...(0,n.unitsFor)(t.packUnit,t.servings)],d=n=>[...n].sort((n,t)=>(n.at||'').localeCompare(t.at||''));function f(t,i,s,c=(new Date).toISOString(),l){return t.map(t=>{if(!t.prices?.some(n=>n.src===i))return t;const a=t.prices.filter(n=>n.src!==i),u=l?.lines.find(n=>n.ingId===t.id&&void 0!==n.prevServings),o=u?{servings:u.prevServings??void 0,servingName:u.prevServingName??void 0}:{},p={...t,...o,prices:a.length?a:[{p:t.packPrice,at:''}],updatedAt:c};return u&&null==u.prevServings&&(delete p.servings,delete p.servingName),p.packPrice=(0,n.costingPrice)(p,s.priceBasis,s.avgOf??5),p})}const v=n=>n.toLowerCase().replace(/\b(pea|bean|broccoli|radish|sunflower)\s*-?\s*(shoots?|sprouts?)\b/g,'$1$2'),h=n=>(v(n).match(/[a-z]*(shoot|sprout|cress)[a-z]*/g)||[]).map(n=>n.replace(/s$/,'')).sort().join(','),k=n=>v(n).replace(/\([^)]*\)/g,' ').replace(/[^a-z\s]/g,' ').split(/\s+/).filter(n=>n.length>2&&!['the','and','with','cooked','fresh','chopped','diced','sliced','cleaned','whole'].includes(n)).map(n=>n.replace(/(es|s)$/,''));function b(n){const t=n.trim().toLowerCase().replace(/\.$/,'');return['g','gram','grams','gr'].includes(t)?'g':['kg','kilo','kilos','kgs'].includes(t)?'kg':['ml','mls'].includes(t)?'ml':['l','litre','litres','liter','liters','ltr'].includes(t)?'L':['oz','ounce','ounces'].includes(t)?'oz':['lb','lbs','pound','pounds'].includes(t)?'lb':['','whole','each','single','singles','piece','pieces','slice','slices','sliced','portion','portions','wedge','wedges','x'].includes(t)?'each':null}},1270,[1269]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"normRead",{enumerable:!0,get:function(){return r}}),e.rememberedMatch=i,e.matchLine=function(t,r,a,s,c){const o=i(t,a,s,c);if(o)return{ing:o,how:'remembered'};const l=r.trim().toLowerCase(),u=c.find(t=>t.name.trim().toLowerCase()===l);if(u)return{ing:u,how:'exact'};const p=(0,n.matchIngredient)(r,c)??(0,n.matchIngredient)(t,c);return p?{ing:p,how:'close'}:{ing:null,how:'new'}},e.packUnitOf=s,e.lineFlags=function(t,n){const r=[];t.sure||r.push('Not sure it read this line right');t.item||r.push('Item name not read');t.packs&&t.packs>0||r.push('Quantity not read');t.packSize&&t.packSize>0&&s(t.packUnit)||r.push('Pack size not read');null==t.unitPrice&&r.push('Price not read');null!=t.unitPrice&&t.packs&&null!=t.lineTotal&&Math.abs(t.packs*t.unitPrice-t.lineTotal)>Math.max(2,.01*t.lineTotal)&&r.push('Quantity times price does not match the line total');'new'===n&&r.push('New item: not on your price list yet');'close'===n&&r.push('Matched to a similar name: check it is the same item');return r},e.costView=c,e.lineCostChange=function(r,a,i){const s=(0,n.piecesPerPack)(a),o=s?{servings:s,servingName:(a.countName||'piece').replace(/s$/i,'')}:{},l=r?{...r,packSize:a.packSize,packUnit:a.packUnit,...o,prices:[...r.prices?.length?r.prices:[{p:r.packPrice,at:''}],{p:a.packPrice,at:'z'}]}:{id:'',name:'',packSize:a.packSize,packUnit:a.packUnit,packPrice:a.packPrice,wastePct:0,...o};l.packPrice=r?(0,t.costingPrice)(l,i.priceBasis,i.avgOf??5):a.packPrice;const u=c(r),p=c(l),d=u?.base&&p?.base&&u.base.per===p.base.per&&u.base.pence>0?(p.base.pence-u.base.pence)/u.base.pence*100:null;return{before:u,after:p,changePct:d}},e.menuGp=o,Object.defineProperty(e,"NOTICEABLE_DROP",{enumerable:!0,get:function(){return l}}),e.gpImpact=function(t,r,a,i,s,c){const u=o(t,r,a,i),{ingredients:p}=(0,n.applyDelivery)(t,s,i,()=>`tmp-${Math.random()}`,void 0,c),d=o(p,r,a,i),m=d.dishes.map(t=>{const n=u.dishes.find(n=>n.id===t.id),r=n?.gp??t.gp,a=r-t.gp;return{id:t.id,name:t.name,before:r,after:t.gp,target:t.target,drop:a,flagged:a>=l||r>=t.target-.05&&t.gpMath.abs(t.before-t.after)>=.05).sort((t,n)=>n.drop-t.drop);return{snap:{at:`${s.date}T12:00:00.000Z`,before:u.menu,after:d.menu,dishes:d.dishes.map(t=>({id:t.id,name:t.name,before:u.dishes.find(n=>n.id===t.id)?.gp??null,after:t.gp}))},dishes:m,after:p}},Object.defineProperty(e,"RANGE_WEEKS",{enumerable:!0,get:function(){return u}}),e.mondayOf=m,e.gpHistory=function(t,n,r,a=d(new Date)){const i=[],s=m(a),[c,o,l]=s.split('-').map(Number);for(let t=u[r]-1;t>=0;t--)i.push(d(new Date(c,o-1,l-7*t)));const p=[...t].sort((t,n)=>t.date.localeCompare(n.date)||(t.createdAt??'').localeCompare(n.createdAt??'')),f={};let h=null;for(const t of p)t.datenull!=t.after).map(t=>[t.id,t.after]))});const b=[],k=[];for(const t of i){const r=d(new Date(Number(t.slice(0,4)),Number(t.slice(5,7))-1,Number(t.slice(8,10))+7)),a=p.filter(n=>n.date>=t&&n.datenull!=t.after).map(t=>[t.id,t.after]))},n.gp.dishes.forEach(t=>{f[t.id]=t.name}));const r=n.gp&&null!=n.gp.before&&null!=n.gp.after?n.gp.after-n.gp.before:null;(!n.gp||null==r||Math.abs(r)>=.05)&&k.push({week:t,date:n.date,id:n.id,supplier:n.supplier,change:r})}t!==s?b.push(h?{...h,week:t}:{week:t,menu:null,dishes:{}}):b.push({week:t,menu:n.menu,dishes:Object.fromEntries(n.dishes.map(t=>[t.id,t.gp]))})}return{points:b,markers:k,names:f}},Object.defineProperty(e,"RANGE_SAID",{enumerable:!0,get:function(){return f}}),e.gpSummary=function(t,n){const r=t.filter(t=>null!=t.menu);if(!r.length)return'No GP history yet. It starts with the first delivery that changes a cost.';const a=r[r.length-1].menu,i=t=>Math.abs(t)<.05?'steady':`${t>0?'up':'down'} ${Math.abs(t).toFixed(1)} points`,s=r.length>1?r[r.length-2].menu:null,c=r[0].menu;return null==s?`Menu GP now ${a.toFixed(1)} percent. Not enough history to compare yet.`:`Menu GP now ${a.toFixed(1)} percent, ${i(a-s)} on the week before, ${i(a-c)} over ${f[n]}.`};var t=_r(_d[0]),n=_r(_d[1]);const r=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,' ').replace(/\s+/g,' ').trim(),a=(t,n)=>r(t)===r(n)&&!!r(t);function i(t,n,i,s){const c=r(t);if(!c)return null;const o=(Array.isArray(i)?i:Object.values(i)).filter(t=>a(t.supplier,n)).sort((t,n)=>(n.updatedAt??n.createdAt).localeCompare(t.updatedAt??t.createdAt));for(const t of o)for(const n of t.lines)if(n.read&&r(n.read)===c){const t=s.find(t=>t.id===n.ingId);if(t)return t}return null}function s(n){const r=(n??'').trim().toLowerCase().replace(/\.$/,'');return r?['kg','kgs','kilo','kilos','kilogram','kilograms'].includes(r)?'kg':['g','gr','gram','grams','gm','gms'].includes(r)?'g':['l','lt','ltr','litre','litres','liter','liters'].includes(r)?'L':['ml','mls'].includes(r)?'ml':['lb','lbs','pound','pounds'].includes(r)?'lb':['oz','ounce','ounces'].includes(r)?'oz':['st','stone'].includes(r)?'stone':['each','ea','x','unit','units','pc','pcs','piece','pieces','item','items','case','cases','box','boxes','tray','trays','pack','packs','bottle','bottles','can','cans','tin','tins','jar','jars','tub','tubs','bag','bags','dozen','doz'].includes(r)?'each':t.PACK_UNITS.includes(r)?r:null:null}function c(n){if(!n)return null;const r=(0,t.perServing)(n);return{base:(0,t.perBaseUnit)(n),piece:null!=r?{pence:r,name:(n.servingName||'piece').toLowerCase()}:null}}function o(n,r,a,i){const s=a.map(a=>{const s=(0,t.cardCostSummary)(r[a.id],n,i,a.price);return{id:a.id,name:a.dish,gp:s.gp,target:s.target}}).filter(t=>null!=t.gp);return{menu:s.length?s.reduce((t,n)=>t+n.gp,0)/s.length:null,dishes:s}}const l=2;const u={'4w':4,'3m':13,'12m':52},p=t=>String(t).padStart(2,'0'),d=t=>`${t.getFullYear()}-${p(t.getMonth()+1)}-${p(t.getDate())}`;function m(t){const[n,r,a]=t.split('-').map(Number),i=new Date(n,r-1,a);return i.setDate(i.getDate()-(i.getDay()+6)%7),d(i)}const f={'4w':'4 weeks','3m':'3 months','12m':'12 months'}},1271,[1269,1270]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteFromLocation=function(n,t){const o=new URLSearchParams(n).get('invite');if(o)return o;const s=(t||'').match(/[#&]invite=([A-Za-z0-9_-]{10,})/);return s?s[1]:null},e.addressWithoutInvite=function(n){try{const t=new URL(n);t.searchParams.delete('invite');const o=t.hash.replace(/^#/,'').split('&').filter(n=>n&&!n.startsWith('invite=')&&!n.startsWith('ccchrome=')&&!n.startsWith('cckitchen=')).join('&');return t.hash=o?`#${o}`:'',t.toString()}catch{return n}},Object.defineProperty(e,"PHONE_LINKED_TEXT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isPhoneLinked",{enumerable:!0,get:function(){return t}}),e.inviteRefusal=function(t){return/already linked to another phone/i.test(t)?n:/update the app/i.test(t)?'Update the app: close it, then open your personal link again.':/already been used/i.test(t)?'This link has already been used on another device. Ask your manager for a new one.':/expired/i.test(t)?'This link has expired. Ask your manager for a new one.':/replaced|switched off|not valid|invalid|unknown invite/i.test(t)?'This link has been replaced or switched off. Ask your manager for a new one.':/personal app link is incomplete/i.test(t)?'Open the complete personal iPhone link your manager sent.':/no longer active/i.test(t)?'This person is no longer on the team. Ask your manager if this is wrong.':null},Object.defineProperty(e,"WIPE_PREFIXES",{enumerable:!0,get:function(){return o}}),e.keysToWipe=function(n){return n.filter(n=>o.some(t=>n.startsWith(t)))},e.handoverFromHash=function(n){const t=(n||'').match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|$)/);return t?t[1]:null};const n='This link is already linked to another phone. Ask a manager to reset it or send you a new link.',t=n=>!!n&&/already linked to another phone/i.test(n);const o=['covercharge-','cc-sync:','cc-','sb-']},1272,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.persistedSessionSlice=function(n,o){return n?{welcomed:o.welcomed}:{meId:o.meId,signedInAt:o.signedInAt,welcomed:o.welcomed}},e.migrateCarSession=function(n){return{meId:null,signedInAt:void 0,welcomed:(n&&'object'==typeof n?n:{}).welcomed??{}}},e.carResetsSessionOnLoad=function(n,o){return n&&!o}},1273,[]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hrRemote",{enumerable:!0,get:function(){return y}}),_e.exampleHr=f,_e.stripHrSamples=m,Object.defineProperty(_e,"useHr",{enumerable:!0,get:function(){return q}});var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),i=r(_d[4]),u=(e=i)&&e.__esModule?e:{default:e},d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const y={live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null},v=(e,t,s)=>(0,c.oneWayToken)(e,`shift:${t}:${s}`),p=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function f(e,t){const s=[];for(let n=14;n>=1;n--){const o=p(t,-n),i=4===n?2:4+7*n%4;for(let t=0;t!((0,s.isAnchorage)(e.venue)&&e.example)),questions:e.questions.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrq-ex-[123]$/.test(e.id))),shouts:e.shouts.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrs-ex-[123]$/.test(e.id)))}}const q=(0,d.create)()((0,l.persist)((e,t)=>({secret:(0,c.newSecret)(),answered:[],voted:{},checkins:[],questions:[],shouts:[],log:[],seeded:{},ensure:(s,i)=>{if(n.LIVE_VENUE_BUILD||o.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(s)||t().seeded[s]||y.live)return;const u=f(s,i);e(e=>({seeded:{...e.seeded,[s]:!0},checkins:[...e.checkins,...u.checkins],questions:[...e.questions,...u.questions],shouts:[...e.shouts,...u.shouts]}))},hasAnswered:(e,s)=>t().answered.includes(v(t().secret,e,s)),submit:s=>{const n=t(),o=v(n.secret,s.rid,s.shiftKey);if(n.answered.includes(o))return'already';const i=(0,c.checkInPayload)({venue:s.rid,day:s.day,token:o,morale:s.morale,staffing:s.staffing}),u=s.question?(0,c.cleanQuestion)(s.question):null,d=s.shoutTo?.trim().slice(0,80)||void 0,l=s.shoutBody?.trim().slice(0,280)||void 0;return e({answered:[...n.answered,o].slice(-300)}),y.live&&y.checkout?(y.checkout({rid:s.rid,shiftKey:'',day:i.day,morale:i.morale,staffing:i.staffing,question:u??void 0,kind:s.kind??'up',shoutTo:d,shoutBody:l,token:o}),'queued'):(e(e=>({checkins:[...e.checkins,{venue:i.venue,day:i.day,morale:i.morale,staffing:i.staffing}],questions:u?[...e.questions,{id:(0,h.uuid)(),venue:s.rid,body:u,kind:s.kind??'up',up:0,yes:0,no:0,hidden:!1,postedOn:s.day}]:e.questions,shouts:d?[...e.shouts,{id:(0,h.uuid)(),venue:s.rid,day:s.day,to:d,body:l}]:e.shouts})),'ok')},skip:(s,n)=>{const o=t(),i=v(o.secret,s,n);o.answered.includes(i)||e({answered:[...o.answered,i].slice(-300)})},post:(t,s,n,o)=>{const i=(0,c.cleanQuestion)(s);if(!i)return null;const u=(0,h.uuid)();return e(e=>({questions:[...e.questions,{id:u,venue:t,body:i,kind:n,up:0,yes:0,no:0,hidden:!1,postedOn:o}]})),y.live&&y.post&&y.post(t,u,i,n),u},vote:(s,n)=>{const o=t();if(o.voted[s])return!1;const i=o.questions.find(e=>e.id===s);if(!i||i.hidden)return!1;const u='up'===i.kind?1:n;return e({voted:{...o.voted,[s]:u},questions:o.questions.map(e=>e.id===s?(0,c.applyVote)(e,u):e)}),y.live&&y.vote&&y.vote(s,(0,c.oneWayToken)(o.secret,`vote:${s}`),u),!0},moderate:(s,n,o,i)=>{const u=t().questions.find(e=>e.id===s);u&&(e(e=>({questions:e.questions.map(e=>e.id===s?{...e,hidden:'hide'===n}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:n,reason:o.trim()||void 0,by:i,at:(new Date).toISOString()},...e.log].slice(0,500)})),y.live&&y.moderate&&y.moderate(s,n,o.trim()))},reply:(s,n,o)=>{const i=n.trim().slice(0,600),u=t().questions.find(e=>e.id===s);if(!u)return;const d=(new Date).toISOString();e(e=>({questions:e.questions.map(e=>e.id===s?{...e,reply:i||void 0,replyAt:i?d:void 0}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:'reply',by:o,at:d},...e.log].slice(0,500)})),y.live&&y.reply&&y.reply(s,i)},setRemoteBoard:(t,s)=>e(e=>({questions:[...e.questions.filter(e=>e.venue!==t),...s]})),upsertRemote:t=>e(e=>({questions:e.questions.some(e=>e.id===t.id)?e.questions.map(e=>e.id===t.id?t:e):[...e.questions,t]}))}),{name:'covercharge-hr-v1',version:3,storage:(0,l.createJSONStorage)(()=>u.default),migrate:async e=>n.LIVE_VENUE_BUILD&&e?(await(0,t.archiveChefCache)('hr',e),{...e,...m(e)}):e}))},1274,[1196,1082,842,5,1188,993,1189,1275,1097]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_ANSWERS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_WORDING",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_HR",{enumerable:!0,get:function(){return r}}),e.hrSettingsOf=function(t){const n=t??{},r=n.wording??{},s=Object.fromEntries(Object.entries(o).map(([t,n])=>[t,a(r[t],'intro'===t||'staffing'===t||'question'===t?160:60,n)]));return{on:!1!==n.on,askQuestion:!1!==n.askQuestion,askShout:!1!==n.askShout,board:!1!==n.board,wording:s}},Object.defineProperty(e,"MORALE_STEPS",{enumerable:!0,get:function(){return s}}),e.moraleWord=function(t,n=o){return t<=1?n.moraleLow:t>=5?n.moraleHigh:2===t?'Fairly low':3===t?'OK':'Good'},Object.defineProperty(e,"STAFF_STOPS",{enumerable:!0,get:function(){return u}}),e.snapStaffing=i,e.staffingWord=function(t,n=o){const r=i(t);return r<=12?n.staffLow:r<45?"A bit short":r<=55?n.staffMid:r<88?"A bit over":n.staffHigh},e.oneWayToken=function(n,o){return(0,t.sha256HexSync)(`cc-hr:${n}:${o}`).slice(0,40)},e.newSecret=function(){let t='';const n=globalThis.crypto;if(n?.getRandomValues){return n.getRandomValues(new Uint8Array(24)).forEach(n=>{t+=n.toString(16).padStart(2,'0')}),t}for(let n=0;n<48;n++)t+=Math.floor(16*Math.random()).toString(16);return t},e.checkInPayload=function(t){const n=Math.max(1,Math.min(5,Math.round(t.morale)));return{venue:t.venue,day:t.day,token:t.token,morale:n,staffing:null==t.staffing?null:i(t.staffing)}},e.dayResults=function(t,o=n){const r=new Map;for(const n of t){const t=r.get(n.day)??[];t.push(n),r.set(n.day,t)}const a=[];let s=0;for(const[t,n]of[...r.entries()].sort(([t],[n])=>t.localeCompare(n))){if(n.lengtht.staffing).filter(t=>null!=t);a.push({day:t,answers:n.length,morale:Math.round(n.reduce((t,n)=>t+n.morale,0)/n.length*10)/10,staffing:r.length?Math.round(r.reduce((t,n)=>t+n,0)/r.length):null,short:r.filter(t=>t<45).length,perfect:r.filter(t=>t>=45&&t<=55).length,over:r.filter(t=>t>55).length})}return{shown:a,held:s}},Object.defineProperty(e,"QUESTION_MAX",{enumerable:!0,get:function(){return f}}),e.cleanQuestion=function(t){const n=t.replace(/\s+/g,' ').trim().slice(0,f);return n.length>=3?n:null},e.boardOrder=function(t,n){const o=t=>'up'===t.kind?t.up:t.yes+t.no;return t.filter(t=>n||!t.hidden).sort((t,n)=>Number(t.hidden)-Number(n.hidden)||o(n)-o(t)||n.postedOn.localeCompare(t.postedOn)||t.id.localeCompare(n.id))},e.applyVote=function(t,n){return'up'===t.kind?{...t,up:t.up+1}:1===n?{...t,yes:t.yes+1}:{...t,no:t.no+1}};var t=_r(d[0]);const n=3,o={intro:'Before you go: 3 quick taps, about 15 seconds. Your name is never saved with your answers.',morale:'How was team morale today?',moraleLow:'Low',moraleHigh:'High',staffing:'Was there enough staff on today for the number of customers?',staffLow:'Not enough',staffMid:'Perfect',staffHigh:'Overstaffed',question:'Got a question you\u2019d like to post anonymously for the team to vote on?',shout:'Shout out a teammate?'},r={on:!0,askQuestion:!0,askShout:!0,board:!0,wording:o},a=(t,n,o)=>('string'==typeof t?t.trim().slice(0,n):'')||o;const s=[1,2,3,4,5];const u=[0,12.5,25,37.5,50,62.5,75,87.5,100].map(t=>Math.round(t));function i(t){const n=Math.max(0,Math.min(100,Number.isFinite(t)?t:50));return u.reduce((t,o)=>Math.abs(o-n)>>0;o.push(c>>>24&255,c>>>16&255,c>>>8&255,255&c,h>>>24&255,h>>>16&255,h>>>8&255,255&h);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64),f=(t,n)=>t>>>n|t<<32-n;for(let n=0;n>>3,e=f(u[t-2],17)^f(u[t-2],19)^u[t-2]>>>10;u[t]=u[t-16]+n+u[t-7]+e>>>0}let e=l[0],s=l[1],c=l[2],h=l[3],a=l[4],i=l[5],p=l[6],d=l[7];for(let n=0;n<64;n++){const o=d+(f(a,6)^f(a,11)^f(a,25))+(a&i^~a&p)+t[n]+u[n]>>>0,l=(f(e,2)^f(e,13)^f(e,22))+(e&s^e&c^s&c)>>>0;d=p,p=i,i=a,a=h+o>>>0,h=c,c=s,s=e,e=o+l>>>0}l[0]=l[0]+e>>>0,l[1]=l[1]+s>>>0,l[2]=l[2]+c>>>0,l[3]=l[3]+h>>>0,l[4]=l[4]+a>>>0,l[5]=l[5]+i>>>0,l[6]=l[6]+p>>>0,l[7]=l[7]+d>>>0}return Array.from(l).map(t=>t.toString(16).padStart(8,'0')).join('')};const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t){const n=[];for(let e=0;e=55296&&o<=56319&&e+1=56320&&n<=57343&&(o=65536+(o-55296<<10)+(n-56320),e++)}o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<65536?n.push(224|o>>12,128|o>>6&63,128|63&o):n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}return n}},1276,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isOnline",{enumerable:!0,get:function(){return t}}),_e.setOnline=o,_e.onConnectivity=function(e){return n.add(e),()=>{n.delete(e)}},_e.isNetworkError=function(e){if(!e)return!1;const n=String(e.message??e).toLowerCase();return 0===e.status||/network|fetch failed|failed to fetch|timeout|timed out|offline|econn|enotfound|socket/.test(n)};let e=!0;const n=new Set,t=()=>e;function o(t){t!==e&&(e=t,n.forEach(n=>n(e)))}const s=globalThis.window;s?.addEventListener&&('boolean'==typeof s.navigator?.onLine&&(e=s.navigator.onLine),s.addEventListener('online',()=>o(!0)),s.addEventListener('offline',()=>o(!1)))},1277,[]); +__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'}},1278,[1277]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1279,[1280,1281,871,1266,1072]); +__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())}}}},1281,[1266]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.staffNickname=t,_e.staffDate=l,_e.staffSyncItem=c,_e.staffRevision=o,_e.staffEdited=function(e,n,t){return o(e,t)!==o(n,t)},_e.staffRow=function(e,t,l,o){const s=c(e,l),m={venue_id:t,external_ref:s.id,display_name:s.name||'Staff',job_title:s.job||null,department:s.dept||null,active:!1!==s.active};l.nickname&&(m.nickname=s.nickname??null);l.display&&(m.display_clock=!0===s.displayClock,m.temp=!0===s.temp,m.temp_until=s.temp?s.tempUntil??null:null);o&&n.test(o)&&!s.ownerAccess&&!s.managerAccess&&(m.role_id=o);return m};const e=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function t(e){if('string'!=typeof e)return null;return e.trim().slice(0,40)||null}function l(n){return'string'==typeof n&&e.test(n)?n:null}function c(e,n={nickname:!0,display:!0}){const c='owner'===e.role||'manager'===e.role||'staff'===e.role?e.role:'staff',o=!0===e.temp,s={id:e.id,name:(e.name??'').trim(),role:c,level:(e.level??'').trim(),job:(e.job??'').trim(),dept:(e.dept??'').trim(),active:!1!==e.active,managerAccess:!0===e.managerAccess,ownerAccess:!0===e.ownerAccess};return'boolean'==typeof e.bookingWrite&&(s.bookingWrite=e.bookingWrite),n.nickname&&(s.nickname=t(e.nickname)),n.display&&(s.displayClock=!0===e.displayClock,s.temp=o,s.tempUntil=o?l(e.tempUntil):null),s}function o(e,n={nickname:!0,display:!0}){const t=c(e,n);return JSON.stringify({name:t.name??'',job:t.job??'',dept:t.dept??'',active:!1!==t.active,...n.nickname?{nickname:t.nickname??null}:{},...n.display?{displayClock:!0===t.displayClock,temp:!0===t.temp,tempUntil:t.tempUntil??null}:{}})}},1282,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBookingSaves",{enumerable:!0,get:function(){return s}}),_e.notSavedWhat=u,Object.defineProperty(_e,"notSavedLine",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),n=r(d[1]),o=r(d[2]),l=(e=o)&&e.__esModule?e:{default:e};const s=(0,t.create)()((0,n.persist)((e,t)=>({count:()=>Object.keys(t().notSaved).length,notSaved:{},mark:t=>e(e=>({notSaved:{...e.notSaved,[t.id]:{...t,at:(new Date).toISOString()}}})),clear:t=>e(e=>{if(!e.notSaved[t])return e;const n={...e.notSaved};return delete n[t],{notSaved:n}}),clearAll:()=>e({notSaved:{}})}),{name:'covercharge-booking-saves-v1',storage:(0,n.createJSONStorage)(()=>l.default),version:1,partialize:e=>({notSaved:e.notSaved})})),c=e=>{const t=(e??'').split('+').map(e=>e.trim()).filter(Boolean);return t.length?`${t.length>1?'Tables':'Table'} ${t.join(' + ')}`:''};function u(e){const t=c(e.table);if(e.walkIn)return`Walk-in of ${e.partySize}${t?` on ${t}`:''}`;const n=(e.name||'Guest').trim();return t?`${t} for ${n}`:`Booking for ${n} at ${e.time}`}const v=e=>`${u(e)} did not save. Tap to try again.`},1283,[993,1189,1188]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useTempSaves",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"tempKey",{enumerable:!0,get:function(){return l}}),_e.tempNotSavedLine=function(e,t){const n=[];e&&n.push(1===e?'1 temperature reading':`${e} temperature readings`);t.length&&n.push(1===t.length?`the change to ${t[0]}`:`${t.length} unit changes`);const o=n.join(' and ');return`${o.charAt(0).toUpperCase()}${o.slice(1)} did not save. Tap to try again.`},_e.tempWaitingLine=function(e){return`${1===e?'1 temperature reading is':`${e} temperature readings are`} waiting to send. ${1===e?'It sends':'They send'} by itself when the connection is back.`.replace('They send by itself','They send by themselves')};var e,t=r(d[0]),n=r(d[1]),o=r(d[2]),s=(e=o)&&e.__esModule?e:{default:e};const c=(e,t)=>`${e}:${t}`,u=(0,t.create)()((0,n.persist)((e,t)=>({notSaved:{},count:()=>Object.keys(t().notSaved).length,mark:t=>e(e=>({notSaved:{...e.notSaved,[c(t.table,t.id)]:{...t,at:(new Date).toISOString()}}})),clear:t=>e(e=>{if(!e.notSaved[t])return e;const n={...e.notSaved};return delete n[t],{notSaved:n}})}),{name:'covercharge-temp-saves-v1',storage:(0,n.createJSONStorage)(()=>s.default),version:1,partialize:e=>({notSaved:e.notSaved})})),l=c},1284,[993,1189,1188]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.pointFromRow=i,_e.pointToRow=n,_e.readingFromRow=r,_e.readingToRow=o,Object.defineProperty(_e,"sameReading",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"readingRev",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"pointRev",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"TEMP_WINDOW_DAYS",{enumerable:!0,get:function(){return l}}),_e.tempUnitsSpec=function(e,t){return{name:'temp_units',table:'temp_units',conflict:'venue_id,id',deletes:!1,list:()=>e.getState().points??[],key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>/^[A-Za-z0-9_.:-]{1,64}$/.test(e.id),writable:t,matchKey:e=>({id:e}),revision:s,knownByRevision:!0,filter:e=>e.order('sort',{ascending:!0}),toRow:(t,i)=>n(t,i,10*Math.max(0,(e.getState().points??[]).findIndex(e=>e.id===t.id))),fromRow:e=>i(e),apply:t=>e.setState(e=>{const i=new Map(t.map(e=>[e.id,e])),n=(e.points??[]).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{points:[...n,...t.filter(e=>!r.has(e.id))]}}),afterRead:t=>{const i=new Map(t.map((e,t)=>[String(e.id),Number(e.sort??t)]));e.setState(e=>{const t=e.points??[],n=[...t.filter(e=>i.has(e.id)).sort((e,t)=>i.get(e.id)-i.get(t.id)),...t.filter(e=>!i.has(e.id))];return n.every((e,i)=>e===t[i])?e:{points:n}})},subscribe:t=>e.subscribe((e,i)=>{e.points!==i.points&&t()})}},_e.tempReadingsSpec=function(e,t){const i=()=>new Date(Date.now()-6912e7).toISOString();return{name:'temp_readings',table:'temp_readings',mode:'insert',conflict:'venue_id,id',deletes:!1,protect:!0,list:()=>e.getState().entries??[],key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>/^[A-Za-z0-9_.:-]{1,64}$/.test(e.id)&&!!e.pointId&&!!e.at,writable:t,matchKey:e=>({id:e}),revision:c,knownByRevision:!0,filter:e=>e.gte('taken_at',i()),inWindow:e=>e.at>=i(),toRow:(e,t)=>o(e,t),fromRow:e=>r(e),supersededBy:(e,t)=>t.some(t=>t.id!==e.id&&a(t,e)),apply:(t,i)=>e.setState(e=>{const n=new Map(t.map(e=>[e.id,e])),r=new Set(i),o=e.entries??[],c=o.filter(e=>n.has(e.id)||!t.some(t=>t.id!==e.id&&a(t,e))).filter(e=>!r.has(e.id)||!o.some(t=>t.id!==e.id&&!r.has(t.id)&&a(t,e))).map(e=>{const t=n.get(e.id);return t?e.photo?{...t,photo:e.photo}:t:e}),s=new Set(c.map(e=>e.id));return{entries:[...t.filter(e=>!s.has(e.id)),...c].sort((e,t)=>t.at.localeCompare(e.at))}}),subscribe:t=>e.subscribe((e,i)=>{e.entries!==i.entries&&t()})}};var e=_r(d[0]);const t=e=>null==e||''===e?void 0:Number(e);function i(e){const i={id:String(e.id),name:String(e.name),kind:e.kind,due:Array.isArray(e.due)?e.due.map(String):[],aliases:Array.isArray(e.aliases)?e.aliases.map(String):[]},n=t(e.min_c),r=t(e.max_c);return void 0!==n&&(i.min=n),void 0!==r&&(i.max=r),e.section&&(i.section=e.section),e.location&&(i.location=String(e.location)),e.archived&&(i.archived=!0),i}function n(e,t,i){return{venue_id:t,id:e.id,name:e.name.slice(0,80),kind:e.kind,location:e.location?.trim()||null,min_c:e.min??null,max_c:e.max??null,due:e.due??[],aliases:e.aliases??[],section:e.section??null,archived:!!e.archived,sort:i}}function r(e){const i={id:String(e.id),pointId:String(e.point_id),name:String(e.point_name),kind:e.kind,at:new Date(e.taken_at).toISOString(),by:String(e.by_name??''),byId:String(e.by_ref??''),app:e.app??'chef',ok:!!e.ok,source:e.source??'typed'},n=t(e.value);void 0!==n&&(i.value=n),null!==e.done&&void 0!==e.done&&(i.done=!!e.done),e.corrective&&(i.corrective=String(e.corrective)),e.note&&(i.note=String(e.note)),e.initials&&(i.initials=String(e.initials)),e.probe_id&&(i.probeId=String(e.probe_id)),e.archived&&(i.archived=!0);const r=t(e.corrected_value);return void 0!==r&&(i.correctedValue=r),e.correction_note&&(i.correctionNote=String(e.correction_note)),e.corrected_by&&(i.correctedBy=String(e.corrected_by)),i}function o(e,t){return{venue_id:t,id:e.id,point_id:e.pointId,point_name:(e.name||'Check').slice(0,200),kind:e.kind,taken_at:e.at,value:e.value??null,done:e.done??null,ok:!!e.ok,by_name:(e.by??'').slice(0,120),by_ref:e.byId||null,app:e.app??null,source:e.source??null,corrective:e.corrective?.slice(0,1e3)||null,note:e.note?.slice(0,1e3)||null,initials:e.initials||null,probe_id:e.probeId||null}}const a=(e,t)=>e.pointId===t.pointId&&e.at===t.at&&(e.value??null)===(t.value??null)&&(e.done??null)===(t.done??null),c=t=>(0,e.hashOf)(r({...o(t,''),archived:t.archived??!1,corrected_value:t.correctedValue??null,correction_note:t.correctionNote??null,corrected_by:t.correctedBy??null})),s=t=>(0,e.hashOf)(i(n(t,'',0))),l=800},1285,[1164]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.mirrorRecords=o,_e.csToRow=i,_e.csFromRow=r,Object.defineProperty(_e,"csRev",{enumerable:!0,get:function(){return c}}),_e.applyRecords=s,_e.cooksafeSpec=function(t,n,d,a){return{name:'cooksafe_records',table:'cooksafe_records',conflict:'venue_id,id',deletes:!1,protect:!0,list:()=>o(t.getState(),n.getState().records??[],d),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,e.csIdOk)(t.id)&&e.CS_KINDS.includes(t.kind)&&!!t.at,writable:a,matchKey:e=>({id:e}),revision:c,knownByRevision:!0,toRow:(e,t)=>i(e,t),fromRow:e=>r(e),apply:e=>s(e,t,n),subscribe:e=>{const d=t.subscribe((t,n)=>{t.diary===n.diary&&t.daySigns===n.daySigns&&t.weekly===n.weekly&&t.inspectorSends===n.inspectorSends&&t.accidents===n.accidents&&t.entries===n.entries||e()}),o=n.subscribe((t,n)=>{t.records!==n.records&&e()});return()=>{d(),o()}}}};var e=_r(_d[0]),t=_r(_d[1]);const n=e=>`photo-${e}`.slice(0,64),d=e=>JSON.parse(JSON.stringify(e));function o(e,t,o){const i=[...t];for(const t of e.diary??[])i.push({id:t.id,kind:'diary',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.daySigns??[])i.push({id:`day-${t.date}`,kind:'daysign',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.weekly??[])i.push({id:`week-${t.week}`,kind:'weekly',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.inspectorSends??[])i.push({id:t.id,kind:'inspector',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.accidents??[])o(t)||i.push({id:t.id,kind:'accident',at:t.createdAt,by:t.reportedBy,byId:t.reportedById,doc:d(t)});for(const t of e.entries??[])t.photo&&i.push({id:n(t.id),kind:'photo',at:t.at,by:t.by,byId:t.byId,doc:{entryId:t.id,photo:t.photo}});return i}function i(e,t){return{venue_id:t,id:e.id,kind:e.kind,at:e.at,by_name:(e.by??'').slice(0,120),doc:{...e.doc,...e.byId?{_byId:e.byId}:{}},archived:!!e.archived}}function r(t){if(!e.CS_KINDS.includes(t.kind))return null;const n={...t.doc??{}},d=n._byId?String(n._byId):void 0;delete n._byId;const o={id:String(t.id),kind:t.kind,at:new Date(t.at).toISOString(),by:String(t.by_name??''),doc:n};return d&&(o.byId=d),t.archived&&(o.archived=!0),o}const c=e=>(0,t.hashOf)(r({...i(e,''),at:e.at}));function s(t,n,d){if(!t.length)return;const o=t.filter(t=>e.CS_OWN.includes(t.kind));o.length&&d.setState(e=>{const t=new Map(o.map(e=>[e.id,e])),n=e.records.map(e=>t.get(e.id)??e),d=new Set(n.map(e=>e.id));return{records:[...o.filter(e=>!d.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at))}});const i=e=>t.filter(t=>t.kind===e).map(e=>e.doc),r=(e,t,n,d=!0)=>{if(!t.length)return e??[];const o=new Map(t.map(e=>[n(e),e])),i=(e??[]).map(e=>o.get(n(e))??e),r=new Set(i.map(n)),c=[...t.filter(e=>!r.has(n(e))),...i];return d?c:c.reverse()},c=t.filter(e=>'photo'===e.kind);n.setState(e=>{const t={},n=i('diary');n.length&&(t.diary=r(e.diary,n,e=>e.id).sort((e,t)=>t.at.localeCompare(e.at)));const d=i('daysign');d.length&&(t.daySigns=r(e.daySigns,d,e=>e.date));const o=i('weekly');o.length&&(t.weekly=r(e.weekly,o,e=>e.week).sort((e,t)=>t.at.localeCompare(e.at)));const s=i('inspector');s.length&&(t.inspectorSends=r(e.inspectorSends,s,e=>e.id).sort((e,t)=>t.at.localeCompare(e.at)));const a=i('accident');if(a.length&&(t.accidents=r(e.accidents,a,e=>e.id).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))),c.length){const n=new Map(c.map(e=>[String(e.doc.entryId),String(e.doc.photo??'')]));let d=!1;const o=(e.entries??[]).map(e=>{const t=n.get(e.id);return t&&e.photo!==t?(d=!0,{...e,photo:t}):e});d&&(t.entries=o)}return t})}},1286,[1287,1164]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CS_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CS_PRIVATE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CS_OWN",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"csIdOk",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"csId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CS_SECTION_LABEL",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"REHEAT_MIN_C",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"reheatOk",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"ICE_RANGE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"BOIL_RANGE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"iceOk",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"boilOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"calibrationOk",{enumerable:!0,get:function(){return b}}),e.offsiteOk=function(t,n){return!!Number.isFinite(n)&&('chilled'===t?n<=8:'frozen'===t?n<=-15:n>=63)},e.deliveryOk=function(t,n){return'ambient'===t||!(null===n||!Number.isFinite(n))&&('chilled'===t?n<=8:n<=-15)},Object.defineProperty(e,"tempWords",{enumerable:!0,get:function(){return y}}),e.calibrationDue=function(t,n){const r=k(t,'calibration');return!r||n.getTime()-new Date(r).getTime()>26784e5},e.reviewDue=function(t,n){const r=k(t,'review');return!r||n.getTime()-new Date(r).getTime()>157248e5},Object.defineProperty(e,"REVIEW_QUESTIONS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"EXCLUSION_HOURS",{enumerable:!0,get:function(){return v}}),e.returnFrom=C,e.mayReturn=function(t,n){return!!t&&n.getTime()>=C(t).getTime()},Object.defineProperty(e,"HOUSE_RULES",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"FLOW_STEPS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"CLEANING_DEFAULT",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"FREQ_LABEL",{enumerable:!0,get:function(){return x}}),e.cleaningDue=function(t,n,r){const i=t=>{const n=new Date(t);return Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())},o=i(r.toISOString());return t.filter(t=>{const r=n.filter(n=>'cleaning'===n.kind&&!n.archived&&n.doc.taskId===t.id).map(t=>t.at).sort().pop();return!r||(o-i(r))/w>=P[t.freq]})},e.allergenMatrix=function(n){const r=n.filter(t=>!!t.signOff);return{rows:r.map(n=>({id:n.id,dish:n.dish,section:n.section??'',cells:t.ALLERGENS.map(t=>n.allergens?.[t.id]??'')})).sort((t,n)=>t.section.localeCompare(n.section)||t.dish.localeCompare(n.dish)),left:n.length-r.length}},Object.defineProperty(e,"MATRIX_HEAD",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"matrixCell",{enumerable:!0,get:function(){return D}}),e.matrixSpoken=function(n){const r=t.ALLERGENS.filter((t,r)=>'contains'===n.cells[r]).map(t=>t.short),i=t.ALLERGENS.filter((t,r)=>'may'===n.cells[r]).map(t=>t.short);return`${n.dish}: ${r.length?`contains ${r.join(', ')}`:'none of the 14 allergens'}${i.length?`; may contain ${i.join(', ')}`:''}.`},Object.defineProperty(e,"CS_KIND_LABEL",{enumerable:!0,get:function(){return A}}),e.recordSummary=_,e.csCsv=function(t){return['Date and time,Record,By,Details',...t.filter(t=>i.includes(t.kind)&&!t.archived).sort((t,n)=>t.at.localeCompare(n.at)).map(t=>[new Date(t.at).toLocaleString('en-GB'),A[t.kind],t.by,_(t)].map(N).join(','))].join('\n')};var t=_r(_d[0]);const n=['diary','daysign','weekly','inspector','accident','photo','reheat','calibration','review','offsite','delivery','training','exclusion','houserule','cleaning','pest','maintenance'],r=['accident','training','exclusion'],i=['reheat','calibration','review','offsite','delivery','training','exclusion','houserule','cleaning','pest','maintenance'],o=t=>/^[A-Za-z0-9_.:-]{1,64}$/.test(t);let a=0;const l=t=>`cs-${t.slice(0,6)}-${Date.now().toString(36)}${(a++).toString(36)}`,s={cross:'Cross-contamination & allergens',cleaning:'Cleaning',chilling:'Chilled storage & cooling',cooking:'Cooking, reheating & hot holding',management:'Management & records'},c=82,d=t=>Number.isFinite(t)&&t>=c,u=[-1,1],f=[99,101],h=t=>Number.isFinite(t)&&t>=u[0]&&t<=u[1],p=t=>Number.isFinite(t)&&t>=f[0]&&t<=f[1],b=(t,n)=>h(t)&&p(n);const y=t=>`${t<0?'minus ':''}${Math.abs(t)} degrees`,w=864e5,k=(t,n)=>t.filter(t=>t.kind===n&&!t.archived).map(t=>t.at).sort().pop()??null;const $=['New dishes, suppliers or equipment are covered by the CookSafe safe methods','Critical limits (cooking 75\xb0C, reheating 82\xb0C, chilling 8\xb0C or below, hot holding 63\xb0C or above) still right','Records were kept every day, with corrective actions written down','Every member of the team has training and induction records','House Rules read and still followed','Allergen information matches the signed-off recipe cards'],v=48;function C(t){return new Date(new Date(t).getTime()+1728e5)}const O=[{id:'hr-personal',title:'Personal hygiene',text:'Clean work clothes and aprons; hair tied back and covered; no jewellery except a plain band; cuts covered with a blue waterproof dressing; no smoking, eating or vaping in food areas.'},{id:'hr-fitness',title:'Fitness to work',text:'Anyone with sickness, diarrhoea, skin infections or infected cuts tells the person in charge before starting work. Food handlers with sickness or diarrhoea stay off until 48 hours after the symptoms stop.'},{id:'hr-hands',title:'Handwashing',text:'Wash hands with soap and warm water and dry with paper towels: before handling food, after raw food, after breaks, the toilet, bins, cleaning and touching face or phone.'},{id:'hr-cross',title:'Cross-contamination',text:'Raw and ready-to-eat food kept apart in storage, preparation and display; separate colour-coded boards, knives and equipment; raw meat on the bottom shelf; separate complex equipment for raw and ready-to-eat food.'},{id:'hr-allergens',title:'Allergen management',text:'Allergen information comes only from signed-off recipe cards; any change to a recipe or supplier is checked before serving; orders with an allergy are made separately with clean equipment.'},{id:'hr-cleaning',title:'Cleaning',text:'Clean as you go; follow the cleaning schedule; use the right chemical at the right dilution and contact time; food contact surfaces disinfected with a product meeting BS EN 1276 or 13697.'},{id:'hr-pests',title:'Pest control',text:'Doors and windows proofed or screened; food stored off the floor and covered; any sign of pests reported straight away and written in the pest control log.'},{id:'hr-maintenance',title:'Maintenance',text:'Equipment, fridges and the building kept in good repair; faults reported, written in the maintenance log and fixed before the equipment is used for food.'},{id:'hr-waste',title:'Waste management',text:'Bins lidded and emptied regularly; waste never left in food rooms overnight; outside bins kept closed and the area clean.'},{id:'hr-stock',title:'Stock control',text:'Deliveries checked and put away straight away; first in, first out; food labelled and dated; nothing used past its use-by date.'},{id:'hr-water',title:'Water supply',text:'Mains drinking water used for food, ice and cleaning; ice machines cleaned to the schedule.'},{id:'hr-physical',title:'Physical and chemical contamination',text:'No glass in food areas where avoidable; breakages cleared and recorded; chemicals stored away from food and clearly labelled.'},{id:'hr-training',title:'Training and supervision',text:'Every food handler has induction before starting and training for their job, recorded in the training records; the person in charge supervises and checks the daily records.'}],S=[{id:'purchase',title:'Purchase',limit:'Approved suppliers only'},{id:'delivery',title:'Delivery',limit:'Chilled 8\xb0C or below \xb7 Frozen \u221215\xb0C or below'},{id:'storage',title:'Storage',limit:'Fridges 5\xb0C or below (8\xb0C legal limit) \xb7 Freezers \u221218\xb0C or below'},{id:'prep',title:'Preparation',limit:'Raw and ready-to-eat kept apart \xb7 Allergens checked'},{id:'cooking',title:'Cooking',limit:'Core 75\xb0C or above'},{id:'cooling',title:'Cooling',limit:'Cooled within 90 minutes, then chilled'},{id:'reheating',title:'Reheating',limit:'Core 82\xb0C or above (Scotland)'},{id:'hothold',title:'Hot holding',limit:'63\xb0C or above'},{id:'service',title:'Service',limit:'Allergen information from signed-off cards'}],E=[{id:'cl-surfaces',task:'Work surfaces and chopping boards',freq:'daily'},{id:'cl-handbasins',task:'Hand-wash basins and taps',freq:'daily'},{id:'cl-floors',task:'Kitchen floors',freq:'daily'},{id:'cl-bins',task:'Bins emptied and cleaned',freq:'daily'},{id:'cl-handles',task:'Door, fridge and freezer handles',freq:'daily'},{id:'cl-fridges',task:'Inside fridges and seals',freq:'weekly'},{id:'cl-ovens',task:'Ovens, grill and fryer',freq:'weekly'},{id:'cl-filters',task:'Extraction canopy filters',freq:'weekly'},{id:'cl-freezers',task:'Freezers defrosted and cleaned',freq:'monthly'},{id:'cl-walls',task:'Walls, shelves and behind equipment',freq:'monthly'}],P={daily:1,weekly:7,monthly:31},x={daily:'Daily',weekly:'Weekly',monthly:'Monthly'};const j=['Dish',...t.ALLERGENS.map(t=>t.short)],D=t=>'contains'===t?'Yes':'may'===t?'May':'';const A={diary:'Diary',daysign:'Daily sign-off',weekly:'Weekly sign-off',inspector:'Sent to inspector',accident:'Accident book',photo:'Check photo',reheat:'Reheating',calibration:'Probe calibration',review:'Six-monthly review',offsite:'Off-site temperature',delivery:'Delivery',training:'Training',exclusion:'Exclusion / return to work',houserule:'House Rule',cleaning:'Cleaning',pest:'Pest control',maintenance:'Maintenance'},N=t=>`"${String(t??'').replace(/"/g,'""')}"`;function _(t){const n=t.doc;switch(t.kind){case'reheat':return`${n.food??''}: ${n.value}\xb0C${n.ok?'':' (below 82\xb0C)'}${n.action?`; action: ${n.action}`:''}`;case'calibration':return`${n.probe??'Probe'}: iced water ${n.ice}\xb0C, boiling ${n.boil}\xb0C${n.ok?'':' (out of range)'}${n.action?`; action: ${n.action}`:''}`;case'offsite':return`${n.food??''} at ${n.place??''}: ${n.value}\xb0C (${n.type})${n.ok?'':' (out of range)'}${n.action?`; action: ${n.action}`:''}`;case'delivery':return`${n.supplier??''}: ${n.items??''}${null!==n.value&&void 0!==n.value?`, ${n.value}\xb0C`:''} (${n.type})${!1===n.accepted?', rejected':''}${n.note?`; ${n.note}`:''}`;case'training':return`${n.person??''}: ${n.course??''}${n.expires?`, renew ${n.expires}`:''}`;case'exclusion':return`${n.person??''}: off from ${n.from??''}${n.stopped?`, symptoms stopped ${n.stopped}`:''}${n.returned?`, back ${n.returned}`:''}`;case'houserule':return`${n.title??''}: ${n.inPlace?'in place':'not ticked'}${n.text?` \u2014 ${n.text}`:''}`;case'cleaning':return`${n.task??''}${n.note?`; ${n.note}`:''}`;case'pest':case'maintenance':return`${n.what??''}${n.action?`; action: ${n.action}`:''}${n.contractor?` (${n.contractor})`:''}`;case'review':return`${n.answers?.filter(Boolean).length??0} of ${$.length} confirmed${n.note?`; ${n.note}`:''}`;default:return String(n.text??n.note??'')}}},1287,[819]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCookSafe",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"SCHEDULE_ID",{enumerable:!0,get:function(){return u}}),_e.scheduleOf=function(e){const r=e.find(e=>e.id===u),t=r?.doc.schedule;return Array.isArray(t)&&t.length?t:n.CLEANING_DEFAULT},Object.defineProperty(_e,"ruleRecordId",{enumerable:!0,get:function(){return l}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},c=_r(d[1]),o=_r(d[2]),n=_r(d[3]);const s=(0,c.create)()((0,o.persist)(e=>({records:[],add:(r,t,c,o,s)=>{const u={id:s??(0,n.csId)(r),kind:r,at:o??(new Date).toISOString(),by:c.by.replace(' (example)',''),byId:c.byId,doc:t};return e(e=>({records:[u,...e.records.filter(e=>e.id!==u.id)]})),u},update:(r,t)=>e(e=>({records:e.records.map(e=>e.id===r?{...e,doc:{...e.doc,...t}}:e)})),archive:r=>e(e=>({records:e.records.map(e=>e.id===r?{...e,archived:!0}:e)}))}),{name:'covercharge-cooksafe-v1',storage:(0,o.createJSONStorage)(()=>t.default),version:1})),u='cs-cleaning-schedule';const l=e=>`houserule-${e}`},1288,[1188,993,1189,1287]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEED_INGREDIENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SEED_RECIPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"WASTE_REASONS",{enumerable:!0,get:function(){return f}}),_e.stripKitchenExamples=S,Object.defineProperty(_e,"useKitchen",{enumerable:!0,get:function(){return w}});var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[6]),p=_r(_d[7]);const c=(e,t,s,i,n,r,o,d=[],l)=>({id:e,name:t,unit:s,cost:i,supplierId:n,par:r,onHand:o,allergens:d,prevCost:l}),u=[c('haddock','Haddock fillet','kg',1848,'sup-1',14,9.5,['fish'],1650),c('smk-haddock','Smoked haddock','kg',1500,'sup-1',4,3.2,['fish']),c('smk-salmon','Smoked salmon','kg',2800,'sup-1',3,1.1,['fish']),c('crab','White and brown crab meat','kg',3800,'sup-1',3,2.4,['crustaceans']),c('mussels','Rope mussels','kg',450,'sup-1',12,0,['molluscs']),c('langoustine','Langoustines','kg',2600,'sup-1',6,4.5,['crustaceans']),c('lobster','Lobster (whole)','each',1800,'sup-1',6,4,['crustaceans']),c('prawns','Prawns (cooked, peeled)','kg',1400,'sup-1',3,2.6,['crustaceans']),c('beef-fillet','Beef fillet','kg',4800,'sup-2',4,2.9),c('steak','Braising steak','kg',1200,'sup-2',8,6.2),c('patty','Burger patty 6 oz','each',160,'sup-2',40,18),c('chicken','Chicken breast','kg',950,'sup-2',10,7.5),c('chorizo','Chorizo','kg',1400,'sup-2',2,1.6,['sulphites']),c('haggis','Haggis','kg',900,'sup-2',4,3.5,['gluten','celery']),c('potatoes','Potatoes (chipping)','kg',90,'sup-3',75,40),c('onions','Onions','kg',110,'sup-3',15,11),c('leaves','Salad leaves','kg',700,'sup-3',3,.8),c('lemons','Lemons','each',25,'sup-3',60,44),c('milk','Whole milk','L',110,'sup-4',20,14,['milk']),c('cream','Double cream','L',380,'sup-4',12,9,['milk']),c('butter','Butter','kg',850,'sup-4',6,4.5,['milk']),c('cheddar','Mature cheddar','kg',900,'sup-4',5,3.8,['milk']),c('parmesan','Parmesan','kg',1800,'sup-4',2,1.4,['milk']),c('eggs','Free-range eggs','each',28,'sup-4',120,90,['eggs']),c('ice-cream','Vanilla ice cream','L',450,'sup-4',10,7,['milk','eggs']),c('flour','Plain flour','kg',90,'sup-5',16,12,['gluten']),c('batter','Beer batter mix','kg',220,'sup-5',12,3.5,['gluten']),c('pastry','Puff pastry','kg',450,'sup-5',6,4.2,['gluten','milk']),c('macaroni','Macaroni','kg',180,'sup-5',6,5,['gluten']),c('penne','Penne','kg',180,'sup-5',6,4.5,['gluten']),c('buns','Brioche buns','each',45,'sup-5',40,30,['gluten','eggs','milk','sesame']),c('baguette','Garlic baguette','each',90,'sup-5',24,16,['gluten','milk']),c('oil','Rapeseed oil (fryer)','L',200,'sup-5',60,32),c('sponge','Sticky toffee sponge (portion)','each',95,'sup-5',30,22,['gluten','eggs','milk']),c('truffle-oil','Truffle oil','L',3e3,'sup-5',1,.6)],k=(e,t,s)=>({dishId:e,yield:t,lines:s.map(([e,t])=>({ing:e,qty:t}))}),h=[k('a-fishsupper','1 portion (220 g fillet)',[['haddock',.22],['batter',.06],['potatoes',.35],['oil',.05],['lemons',1]]),k('a-skink','1 bowl',[['smk-haddock',.08],['potatoes',.1],['milk',.15],['cream',.05],['onions',.03],['butter',.01]]),k('a-salmon','1 plate',[['smk-salmon',.07],['cream',.03],['leaves',.02],['lemons',1]]),k('a-haggis','1 plate',[['haggis',.1],['flour',.02],['eggs',1],['oil',.03]]),k('a-crabcakes','2 cakes',[['crab',.08],['potatoes',.06],['flour',.02],['eggs',1],['leaves',.02]]),k('a-tempura','1 plate',[['haddock',.07],['prawns',.05],['onions',.05],['batter',.06],['oil',.04],['lemons',1]]),k('a-mini-fish-goujons','Fish Goujons & Chips',[['haddock',.1],['potatoes',.2],['batter',.03],['oil',.03]]),k('a-pie','1 pie',[['steak',.22],['pastry',.08],['onions',.05],['potatoes',.3],['oil',.03]]),k('a-chicken','1 plate',[['chicken',.22],['potatoes',.25],['cream',.05],['butter',.02]]),k('a-maccheese','1 bowl',[['macaroni',.12],['cheddar',.08],['milk',.2],['butter',.02],['flour',.015]]),k('a-penne','1 bowl',[['penne',.12],['chicken',.15],['chorizo',.04],['cream',.08],['parmesan',.01]]),k('a-caesar','1 plate',[['chicken',.16],['leaves',.08],['parmesan',.015],['eggs',1],['baguette',.25]]),k('a-moules','1 pot',[['mussels',.5],['cream',.08],['onions',.03],['baguette',.5]]),k('a-fillet','8 oz steak',[['beef-fillet',.227],['potatoes',.35],['onions',.05],['oil',.05],['butter',.02]]),k('a-claymore','1 burger',[['patty',1],['buns',1],['cheddar',.03],['potatoes',.3],['onions',.06],['batter',.03],['oil',.05]]),k('a-langoustines','1 plate',[['langoustine',.35],['butter',.03],['baguette',.5],['leaves',.03],['lemons',1]]),k('a-lobster','1 lobster',[['lobster',1],['butter',.04],['potatoes',.3],['oil',.04],['leaves',.03],['lemons',1]]),k('a-smorgasbord','Serves one',[['langoustine',.3],['mussels',.3],['crab',.08],['prawns',.1],['smk-salmon',.06],['leaves',.05],['lemons',2]]),k('a-deluxe','Serves two',[['lobster',1],['langoustine',.5],['crab',.15],['mussels',.5],['prawns',.15],['smk-salmon',.1],['leaves',.1],['lemons',3],['baguette',1]]),k('a-chips','1 side',[['potatoes',.35],['oil',.05]]),k('a-onionrings','1 side',[['onions',.15],['batter',.06],['oil',.04]]),k('a-garlicbread','1 side',[['baguette',.5],['butter',.02]]),k('a-truffle','1 side',[['potatoes',.35],['oil',.05],['parmesan',.015],['truffle-oil',.005]]),k('a-salad','1 side',[['leaves',.06],['lemons',.5]]),k('a-stp','1 portion',[['sponge',1],['cream',.05],['butter',.02],['ice-cream',.08]])],f=['Out of date','Spoiled','Over-production','Dropped / burnt','Returned by customer','Prep trim'],b=(e,t=10)=>{const s=new Date;return s.setDate(s.getDate()-e),s.setHours(t,0,0,0),s.toISOString()},y=e=>`${e}-${Math.random().toString(36).slice(2,8)}`;function v(){return{ingredients:u.map(e=>({...e})),recipes:h,targetGp:70,deliveries:[{id:'dl-today-fish',supplierId:'sup-1',due:'today',status:'expected',lines:[{ing:'haddock',ordered:10,received:8,price:1848},{ing:'mussels',ordered:12,received:12,price:450},{ing:'langoustine',ordered:3,received:3,price:2750},{ing:'smk-salmon',ordered:2,received:2,price:2800}]},{id:'dl-today-veg',supplierId:'sup-3',due:'today',status:'expected',lines:[{ing:'potatoes',ordered:50,received:50,price:90},{ing:'leaves',ordered:3,received:2,price:700},{ing:'lemons',ordered:30,received:30,price:25}]}],stockTakes:[{id:'stk-1',at:b(7,22),by:'Head Chef (example)',lines:[{ing:'haddock',expected:6,counted:5.4,cost:1650},{ing:'potatoes',expected:30,counted:28,cost:90},{ing:'cream',expected:8,counted:8,cost:380},{ing:'beef-fillet',expected:3.2,counted:3,cost:4800}]}],waste:[{id:'w1',at:b(1,21),by:'Head Chef (example)',item:'Haddock fillet',ing:'haddock',qty:.6,unit:'kg',reason:'Over-production',cost:1109},{id:'w2',at:b(2,15),by:'Head Chef (example)',item:'Salad leaves',ing:'leaves',qty:.5,unit:'kg',reason:'Spoiled',cost:350},{id:'w3',at:b(3,20),by:'Head Chef (example)',item:'Fish supper',qty:1,unit:'portion',reason:'Dropped / burnt',cost:517},{id:'w4',at:b(4,11),by:'Head Chef (example)',item:'Double cream',ing:'cream',qty:1,unit:'L',reason:'Out of date',cost:380},{id:'w5',at:b(5,22),by:'Head Chef (example)',item:'Chips',ing:'potatoes',qty:3,unit:'kg',reason:'Over-production',cost:270}],orders:[{id:'po-1',supplierId:'sup-1',at:b(1,13),by:'Head Chef (example)',status:'placed (by phone)',lines:[{ing:'haddock',qty:10,cost:1848},{ing:'mussels',qty:12,cost:450},{ing:'langoustine',qty:3,cost:2600},{ing:'smk-salmon',qty:2,cost:2800}],total:30520},{id:'po-2',supplierId:'sup-3',at:b(1,18),by:'Head Chef (example)',status:'placed (on website)',lines:[{ing:'potatoes',qty:50,cost:90},{ing:'leaves',qty:3,cost:700},{ing:'lemons',qty:30,cost:25}],total:7350}],prepTicks:{},temps:[{id:'t1',at:b(0,9),by:'Head Chef (example)',kind:'fridge',unit:'Walk-in fridge',temp:3},{id:'t2',at:b(0,9),by:'Head Chef (example)',kind:'freezer',unit:'Chest freezer',temp:-20}]}}function S(e){const t=v(),s=(e,t)=>t.some(t=>JSON.stringify(t)===JSON.stringify(e)),i=e.recipes.filter(e=>!s(e,t.recipes)),r=e.deliveries.filter(e=>!t.deliveries.some(t=>t.id===e.id&&t.supplierId===e.supplierId&&t.due===e.due&&'expected'===e.status&&!e.checkedBy&&!e.note&&JSON.stringify(t.lines)===JSON.stringify(e.lines))),o=e.stockTakes.filter(e=>!(0,n.demoActor)(e.by)),d=e.waste.filter(e=>!(0,n.demoActor)(e.by)),l=e.orders.filter(e=>!(0,n.demoActor)(e.by)),p=e.temps.filter(e=>!(0,n.demoActor)(e.by)),c=new Set([...i,...r,...o,...l].flatMap(e=>e.lines.map(e=>e.ing)));return d.forEach(e=>{e.ing&&c.add(e.ing)}),{ingredients:e.ingredients.filter(e=>c.has(e.id)||!s(e,t.ingredients)),recipes:i,deliveries:r,stockTakes:o,waste:d,orders:l,temps:p}}const w=(0,l.create)()((0,p.persist)(e=>({...r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v(),setTarget:t=>e({targetGp:Math.max(40,Math.min(90,Math.round(t)))}),setIngredient:(t,s)=>e(e=>({ingredients:e.ingredients.map(e=>e.id===t?{...e,...s}:e)})),setRecipeQty:(t,s,i)=>e(e=>({recipes:e.recipes.map(e=>e.dishId!==t?e:{...e,lines:i>0?e.lines.some(e=>e.ing===s)?e.lines.map(e=>e.ing===s?{...e,qty:i}:e):[...e.lines,{ing:s,qty:i}]:e.lines.filter(e=>e.ing!==s)})})),acceptDelivery:(t,i,n,o)=>e(e=>({deliveries:e.deliveries.map(e=>e.id===t?{...e,lines:i,status:'accepted',checkedBy:n,at:(new Date).toISOString(),note:o}:e),ingredients:e.ingredients.map(e=>{const t=i.find(t=>t.ing===e.id);return t?{...e,onHand:(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand+t.received:Math.round(100*(e.onHand+t.received))/100,...t.price!==e.cost?{prevCost:e.cost,cost:t.price}:{}}:e})})),saveStockTake:(t,s)=>e(e=>({stockTakes:[{id:y('stk'),at:(new Date).toISOString(),by:s,lines:Object.entries(t).map(([t,s])=>{const i=e.ingredients.find(e=>e.id===t);return{ing:t,expected:i.onHand,counted:s,cost:i.cost}})},...e.stockTakes],ingredients:e.ingredients.map(e=>e.id in t?{...e,onHand:t[e.id]}:e)})),addWaste:t=>e(e=>({waste:[{...t,id:y('w'),at:(new Date).toISOString()},...e.waste],ingredients:t.ing?e.ingredients.map(e=>e.id===t.ing?{...e,onHand:Math.max(0,(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand-t.qty:Math.round(100*(e.onHand-t.qty))/100)}:e):e.ingredients})),addOrder:t=>{const s=y('po');return e(e=>({orders:[{...t,id:s,at:(new Date).toISOString()},...e.orders]})),s},setOrderStatus:(t,s)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,status:s}:e)})),tickPrep:(t,s)=>e(e=>{const i={...e.prepTicks};return s?i[t]={by:s,at:(new Date).toISOString()}:delete i[t],{prepTicks:i}}),addTemp:t=>e(e=>({temps:[{...t,id:y('t'),at:(new Date).toISOString()},...e.temps]})),reset:()=>e(r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v())}),{name:'covercharge-kitchen-v1',version:3,storage:(0,p.createJSONStorage)(()=>d.default),migrate:async e=>{const s=e;return t.LIVE_VENUE_BUILD?(await(0,i.archiveChefCache)('kitchen',s),{...s,...S(s)}):s}}))},1289,[842,1083,1196,1082,5,1188,993,1189]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fixSupplierNames=function(b){return b?s.reduce((s,[b,n])=>s.replace(b,n),b):b};const s=[[/\bAl{2}sons?'?s?\b|\bAlson's\b/g,'Alsons'],[/\bSpe[zs] ?[Bb]ona\b|\bSpezbona\b/g,'Spes Bona'],[/\bReeds\b/gi,'Reids']]},1290,[]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_ORDER_LIST_SETTINGS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"UNITS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY_FULL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"normName",{enumerable:!0,get:function(){return a}}),e.findDuplicate=function(t,n,i,s){return t.find(t=>t.listId===n&&!t.removed&&'open'===t.status&&a(t.name)===a(i)&&u(t.unit)===u(s))},e.bumpQty=function(t,n,i,a,u){return{...t,qty:Math.round(100*(t.qty+n))/100,bumps:[...t.bumps??[],{by:i,name:a,qty:n,at:u}],updatedAt:u}},Object.defineProperty(e,"qtyText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"validQty",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"liveItems",{enumerable:!0,get:function(){return d}}),e.finishOrder=function(t,n,i,a,u,s){const o=d(n,t.id),l=o.filter(t=>'got'!==t.status),c={id:s(),listId:t.id,listName:t.name,finishedAt:u,finishedBy:a.id,finishedByName:a.name,items:o.map(t=>({name:t.name,qty:t.qty,unit:t.unit,note:t.note,status:t.status,addedByName:t.addedByName})),carried:i?l.length:0},p=i?l.map(t=>({...t,status:'open',carried:'missing'===t.status?'missing':'not-got',statusBy:void 0,statusAt:void 0,updatedAt:u})):[],m=new Set(p.map(t=>t.id));return{round:c,drop:o.filter(t=>!m.has(t.id)).map(t=>t.id),carriedOver:p}},e.nextTripDate=p,e.tripText=function(t,n,a){const u=p(t,n,a);if(!u)return'Running list';const[,s,o]=u.split('-').map(Number);return"Next trip "+(u===n?'today':u===l(n,1)?'tomorrow':`${i[c(u)]} ${o} ${['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][s-1]}`)},e.initials=function(t){const n=t.replace(/\(.*?\)/g,' ').split(/[^A-Za-z0-9]+/).filter(t=>t&&!['and','the','of','&'].includes(t.toLowerCase()));return n.length?(1===n.length?n[0].slice(0,2):n[0][0]+n[1][0]).toUpperCase():'?'},e.telHref=function(t){if(!t)return null;const n=t.trim().replace(/[^\d+]/g,'').replace(/(?!^)\+/g,'');return n.replace(/\D/g,'').length>=6?`tel:${n}`:null};const t={allowStaff:!0,defaultTripDay:5},n=['','cases','bottles','kegs','boxes','bags','packs','kg','litres','each'],i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],a=t=>t.trim().toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').replace(/s$/,''),u=t=>t.trim().toLowerCase().replace(/s$/,'');const s=t=>`${Number.isInteger(t.qty)?t.qty:t.qty.toFixed(2).replace(/0$/,'')}${t.unit?` ${t.unit}`:''}`,o=t=>Number.isFinite(t)&&t>0&&t<=9999,d=(t,n)=>t.filter(t=>t.listId===n&&!t.removed).sort((t,n)=>('open'===t.status?0:1)-('open'===n.status?0:1)||t.addedAt.localeCompare(n.addedAt));const l=(t,n)=>{const[i,a,u]=t.split('-').map(Number);return new Date(Date.UTC(i,a-1,u+n)).toISOString().slice(0,10)},c=t=>{const[n,i,a]=t.split('-').map(Number);return new Date(Date.UTC(n,i-1,a)).getUTCDay()};function p(n,i,a=t.defaultTripDay){if('trip'!==n.kind)return null;if(n.nextTrip&&n.nextTrip>=i)return n.nextTrip;const u=n.tripDay??a;return l(i,(u-c(i)+7)%7)}},1291,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useClockArea",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"areaOf",{enumerable:!0,get:function(){return _}});var e,t=r(d[0]),n=r(d[1]),s=r(d[2]),u=(e=s)&&e.__esModule?e:{default:e},c=r(d[3]),l=r(d[4]),E=r(d[5]);const o=(0,c.create)()((0,l.persist)(e=>({areas:(0,n.privateClockVenue)(t.VENUE_RID)?{[t.VENUE_RID]:(0,n.venueClockArea)(t.VENUE_RID)}:{},visiting:{},set:(s,u,c)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{...e.areas[s]??{},...u}),updatedAt:(new Date).toISOString(),updatedBy:c}}}),reset:(s,u)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{lat:e.areas[s]?.lat??null,lng:e.areas[s]?.lng??null}),updatedAt:(new Date).toISOString(),updatedBy:u}}}),setVisiting:t=>e(e=>({visiting:Object.fromEntries([...Object.entries(e.visiting).slice(-60),[t,!0]])}))}),{name:'covercharge-clock-area-v1',version:1,storage:(0,l.createJSONStorage)(()=>u.default)})),_=e=>t.IS_ISOLATED_VENUE&&e!==t.VENUE_RID?(0,E.cleanArea)(E.DEFAULT_CLOCK_AREA):(0,n.venueClockArea)(e,o.getState().areas[e]??{})},1292,[5,868,1188,993,1189,869]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteStatus=function(){return{'st-tracy':{state:'used',usedAt:s(3e3),devices:2},'st-gordon':{state:'used',usedAt:s(2940),devices:2},'st-bisto':{state:'used',usedAt:s(1800),devices:1},'st-agate':{state:'used',usedAt:s(1680),devices:1},'st-lenny':{state:'used',usedAt:s(1560),devices:1},'st-finn':{state:'unused',expiresAt:n(52),devices:0},'st-eilidh':{state:'used',usedAt:s(1200),devices:1},'st-emily':{state:'expired',devices:0},'st-lillie':{state:'used',usedAt:s(480),devices:1},'st-jack':{state:'unused',expiresAt:n(70),devices:0}}},e.linkPhones=async function(){return{...a}},e.resetPhone=async function(t){const s=a[t]?.phones??0;return delete a[t],s},e.reissueInvite=async function(t){const s='st-bisto'===t?'chef':['st-tracy','st-gordon','st-agate'].includes(t)?'owner':'staff';return{ok:!0,token:'DEMO-link-not-real-0000',expiresAt:n(72),app:s}},e.unlockCashUp=async function(s,n,a){const c=new Date(Date.now()+18e5).toISOString();'cashup'===s?t.useCashUp.setState(t=>({cashUps:t.cashUps.map(t=>t.id===n?{...t,unlockedUntil:c}:t)})):t.useCashUp.setState(t=>({sales:t.sales.map(t=>t.id===n?{...t,unlockedUntil:c}:t)}));return{ok:!0,until:c}},e.cashAudit=async function(t){return[{at:s(780),action:'unlocked',by:'Morgan',tbl:'cash_ups',reason:'Card total keyed as 1,284 not 1,248',changed:[]},{at:s(768),action:'changed',by:'Alex',tbl:'cash_ups',changed:['card']},{at:s(840),action:'created',by:'Alex',tbl:'cash_ups',changed:[]}]},e.pitchRpc=function(t,s){switch(t){case'list_displays':return c;case'create_display_code':case'new_code_for_display':return[{code:'DEMO7K2QX',expires_at:n(24*Number(s.p_hours?Number(s.p_hours)/24:7))}];default:return[]}};var t=r(d[0]);const s=t=>new Date(Date.now()-6e4*t).toISOString(),n=t=>new Date(Date.now()+36e5*t).toISOString();const a={'st-tracy':{phones:1,since:s(4445)},'st-bisto':{phones:1,since:s(2920)},'st-agate':{phones:1,since:s(1680)},'st-lenny':{phones:1,since:s(1560)},'st-eilidh':{phones:1,since:s(1200)}};const c=[{id:'pd-1',label:'Front desk tablet',can_write:!0,created_at:s(17280),last_seen_at:s(2),revoked_at:null,sessions:1,open_codes:0},{id:'pd-2',label:'Kitchen pass tablet',can_write:!1,created_at:s(12960),last_seen_at:s(5),revoked_at:null,sessions:1,open_codes:0}]},1293,[1046]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useChatSync",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"chatSynced",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({synced:!1,checked:!1})),n=()=>t.getState().synced},1294,[993]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.specialsBoardSpec=function(r,s){return{name:'specials_boards',table:'specials_boards',conflict:'venue_id',deletes:!1,list:()=>[{id:r,board:t.useSpecials.getState().current[r]??null}],key:()=>r,rowKey:()=>r,syncable:t=>!t.board||!String(t.board.id).startsWith('sb-seed'),writable:s,toRow:(t,s)=>({venue_id:s,doc:{board:t.board?{...t.board,restaurantId:r}:null},updated_at:(new Date).toISOString()}),fromRow:t=>({id:r,board:t.doc?.board??null}),apply:s=>{const n=s[0];if(!n)return;const o=n.board;o&&o.restaurantId&&o.restaurantId!==r||t.useSpecials.setState(t=>({current:{...t.current,[r]:o}}))},subscribe:r=>t.useSpecials.subscribe((t,s)=>{t.current!==s.current&&r()})}},Object.defineProperty(e,"specialsSyncOn",{enumerable:!0,get:function(){return c}}),e.watchGuestSpecials=function(c,l=()=>{}){if(!r.RELEASE.specialsSync||!(0,n.isSupabaseConfigured)())return()=>{};let u=!1;const p=async()=>{const r=t.useSpecials.getState().current[c]??null;let n;try{const t=(0,o.getSupabase)(),{data:r,error:l}=await t.rpc('guest_specials',{p_slug:c});if(l)n={ok:!1,message:s.GUEST_SPECIALS_OFFLINE};else if(r&&'object'==typeof r){const t=r,s='string'==typeof t.postedAt?t.postedAt:'',o=Array.isArray(t.items)?t.items:[],l=t.photo??null;n=s||l||o.length?{ok:!0,board:{id:`sb-sync-${c}`,restaurantId:c,photo:l,items:o,postedAt:s||new Date(0).toISOString(),postedBy:'',app:'managers',allergenCheck:null}}:{ok:!0,board:null}}else n={ok:!0,board:null}}catch{n={ok:!1,message:s.GUEST_SPECIALS_OFFLINE}}if(u)return;const p=(0,s.guestSpecialsAfter)(t.useSpecials.getState().current[c]??null,n);p.board!==r&&t.useSpecials.setState(t=>({current:{...t.current,[c]:p.board}})),l(p.note)};p();const S=setInterval(()=>{p()},6e4);return()=>{u=!0,clearInterval(S)}};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]),o=_r(d[4]);const c=()=>r.RELEASE.specialsSync},1295,[863,1066,1296,1168,871]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestSpecialsAfter=function(t,n){return n.ok?n.board?t&&t.postedAt>n.board.postedAt?{board:t,note:''}:{board:n.board,note:''}:{board:null,note:''}:{board:t,note:n.message}},Object.defineProperty(e,"GUEST_SPECIALS_OFFLINE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SUPPORT_NOT_SENT",{enumerable:!0,get:function(){return n}}),e.supportAfterWrite=function(t,o){return t.trim()?o.ok?{text:t,sent:!0,note:''}:{text:t,sent:!1,note:o.message||n}:{text:t,sent:!1,note:''}};const t='The specials board could not be loaded. What is already on this phone is unchanged.',n='Saved on this phone. It was not sent.'},1296,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1297,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get Badge(){return x.Badge},get DarkTheme(){return y.DarkTheme},get DefaultTheme(){return _.DefaultTheme},get ErrorBoundary(){return v.ErrorBoundary},get ExperimentalStack(){return U.ExperimentalStack},get ExpoRoot(){return c.ExpoRoot},get Icon(){return x.Icon},get IsWithinNativeNavigator(){return B.IsWithinNativeNavigator},get Label(){return x.Label},get LocaleProvider(){return I.LocaleProvider},get NativeStackView(){return E.NativeStackView},get NavigationAwareActivity(){return R.NavigationAwareActivity},get Navigator(){return t.Navigator},get RouterActionHandling(){return C.RouterActionHandling},get Sitemap(){return b.Sitemap},get Slot(){return t.Slot},get SplashScreen(){return S},get StackRouter(){return C.StackRouter},get SuspenseFallback(){return f.SuspenseFallback},get TabRouter(){return C.TabRouter},get Tabs(){return M.Tabs},get ThemeProvider(){return T.ThemeProvider},get Unmatched(){return l.Unmatched},get VectorIcon(){return x.VectorIcon},get attachRouteState(){return C.attachRouteState},get createBaseStackProps(){return j.createBaseStackProps},get createBaseTabProps(){return D.createBaseTabProps},get createNativeStackProps(){return W.createNativeStackProps},get createStandardRouterNavigator(){return B.createStandardRouterNavigator},get enableLegacyHeaderAppearance(){return F.enableLegacyHeaderAppearance},get extendRouter(){return C.extendRouter},get extendRouterActions(){return C.extendRouterActions},get integrateWithRouter(){return B.integrateWithRouter},get isActionHandled(){return C.isActionHandled},get router(){return u.router},get unstable_PerformanceObserver(){return G.unstable_PerformanceObserver},get unstable_createStandardRouterNavigator(){return B.unstable_createStandardRouterNavigator},get unstable_enablePerformanceIntegration(){return G.unstable_enablePerformanceIntegration},get unstable_integrateWithRouter(){return B.unstable_integrateWithRouter},get unstable_performance(){return G.unstable_performance},get unstable_useIsNavigating(){return o.useIsNavigating},get unstable_useReconcileTabHistory(){return H.useReconcileTabHistory},get useCanGoBack(){return n.useCanGoBack},get useCurrentRouteInfo(){return n.useCurrentRouteInfo},get useFocusEffect(){return h.useFocusEffect},get useGlobalSearchParams(){return n.useGlobalSearchParams},get useIsFocused(){return N.useIsFocused},get useLoaderData(){return n.useLoaderData},get useLocalSearchParams(){return n.useLocalSearchParams},get useNavigation(){return P.useNavigation},get useNavigationContainerRef(){return n.useNavigationContainerRef},get usePathname(){return n.usePathname},get usePreventRemove(){return L.usePreventRemove},get useRootNavigation(){return n.useRootNavigation},get useRootNavigationState(){return n.useRootNavigationState},get useRoute(){return A.useRoute},get useRoutePath(){return O.useRoutePath},get useRouter(){return n.useRouter},get useScrollToTop(){return w.useScrollToTop},get useSegments(){return n.useSegments},get useSitemap(){return p.useSitemap},get useTheme(){return k.useTheme},get useUnstableGlobalHref(){return n.useUnstableGlobalHref},get withLayoutContext(){return s.withLayoutContext}});const t=r(d[0]),n=r(d[1]),u=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),l=r(d[6]),b=r(d[7]),p=r(d[8]),v=r(d[9]),f=r(d[10]),R=r(d[11]),S=q(r(d[12])),P=r(d[13]),h=r(d[14]),N=r(d[15]),y=r(d[16]),_=r(d[17]),T=r(d[18]),k=r(d[19]),I=r(d[20]),O=r(d[21]),w=r(d[22]),A=r(d[23]),L=r(d[24]),x=r(d[25]),B=r(d[26]),H=r(d[27]),j=r(d[28]),D=r(d[29]),W=r(d[30]),C=r(d[31]),E=r(d[32]),F=r(d[33]),G=r(d[34]),M=r(d[35]),U=r(d[36]);function V(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(V=function(t){return t?u:n})(t)}function q(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=V(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=s?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(o,c,l):o[c]=t[c]}return o.default=t,u&&u.set(t,o),o}},1298,[695,420,513,1299,713,33,767,758,761,1300,665,663,668,534,538,543,482,484,448,449,1301,489,490,479,477,525,712,658,726,1302,725,359,704,709,379,1303,1306]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useIsNavigating",{enumerable:!0,get:function(){return u}});const t=r(d[1]);function u(){return(0,n().use)(t.NavigationPendingContext)}},1299,[31,376]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}function n(){const t=r(d[2]);return n=function(){return t},t}function l(){const t=r(d[3]);return l=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ErrorBoundary",{enumerable:!0,get:function(){return f}});r(d[4]);const s=r(d[5]),c=r(d[6]),u=r(d[7]);function h({error:o}){return(0,t().jsxs)(n().View,{style:{marginBottom:12,gap:4,flexWrap:'wrap'},children:[(0,t().jsx)(n().Text,{role:"heading","aria-level":1,style:y.title,children:"Something went wrong"}),(0,t().jsxs)(n().Text,{testID:"router_error_message",role:"heading","aria-level":2,style:y.errorMessage,children:["Error: ",o.message]})]})}function f({error:f,retry:x}){const w=(0,o().use)(s.BottomTabBarHeightContext)?n().View:l().SafeAreaView,S=f instanceof c.ReactServerError;return(0,t().jsx)(n().View,{style:y.container,children:(0,t().jsxs)(w,{style:{flex:1,gap:8,maxWidth:720,marginHorizontal:'auto'},children:[S?(0,t().jsx)(b,{error:f}):(0,t().jsx)(h,{error:f}),(0,t().jsx)(n().View,{style:{flex:1}}),!1,(0,t().jsx)(u.Pressable,{testID:"router_error_retry",onPress:x,children:({hovered:o,pressed:l})=>(0,t().jsx)(n().View,{style:[y.buttonInner,(o||l)&&{backgroundColor:'white'}],children:(0,t().jsx)(n().Text,{style:[y.buttonText,{color:o||l?'black':'white'}],children:"Retry"})})})]})})}const x={404:'NOT_FOUND',500:'INTERNAL_SERVER_ERROR',503:'SERVICE_UNAVAILABLE',504:'GATEWAY_TIMEOUT'};function b({error:o}){let l=String(o.statusCode);l+=': '+(x[o.statusCode]??'Server Error');const s=o.headers.get('cf-ray'),c=o.headers.get('Date');return(0,t().jsxs)(n().View,{style:{padding:12,gap:8},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:n().Platform.select({web:24,default:16}),fontWeight:'bold',marginBottom:4,color:'white'},children:l}),(0,t().jsx)(n().ScrollView,{style:{borderColor:'rgba(255,255,255,0.5)',borderTopWidth:n().StyleSheet.hairlineWidth,borderBottomWidth:n().StyleSheet.hairlineWidth,maxHeight:150},contentContainerStyle:{paddingVertical:4},children:(0,t().jsx)(n().Text,{testID:"router_error_message",selectable:!0,allowFontScaling:!0,style:{color:'white'},children:o.message})}),(0,t().jsx)(w,{title:"Code",right:o.statusCode}),s&&(0,t().jsx)(w,{title:"ID",right:s}),c&&(0,t().jsx)(w,{title:"Date",right:c}),o.url&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:14,opacity:.5,color:'white'},children:o.url})]})}function w({title:o,right:l}){const s={fontSize:16,color:'white'};return(0,t().jsxs)(n().View,{style:{flexDirection:'row',justifyContent:'space-between'},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:s,children:o}),l&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:[s,y.code],children:l})]})}const y=n().StyleSheet.create({container:{flex:1,backgroundColor:'black',padding:24,alignItems:'stretch',justifyContent:'center'},title:{color:'white',fontSize:n().Platform.select({web:32,default:24}),fontWeight:'bold'},buttonText:{fontSize:18,fontWeight:'bold',color:'black',...n().Platform.select({web:{transitionDuration:'100ms'}})},buttonInner:{...n().Platform.select({web:{transitionDuration:'100ms'}}),paddingVertical:12,paddingHorizontal:24,borderColor:'white',borderWidth:2,marginLeft:8,justifyContent:'center',alignItems:'center'},code:{fontFamily:n().Platform.select({default:'Courier',ios:'Courier New',android:'monospace'}),fontWeight:'500'},errorMessage:{color:'white',fontSize:16},subtitle:{color:'white',fontSize:14,marginBottom:12},link:{color:'rgba(255,255,255,0.4)',textDecorationStyle:'solid',textDecorationLine:'underline',fontSize:14,textAlign:'center'}})},1300,[25,31,34,290,509,546,667,760]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LocaleProvider",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o({direction:o,children:c}){return(0,n().jsx)(t.LocaleDirContext.Provider,{value:o,children:c})}},1301,[25,430]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({dispatch:t,isPreloaded:o,isRemovalPrevented:n,state:s}){return{isPreloaded:o,isRemovalPrevented:n,routeNames:s.routeNames,preload:o=>t({type:'PRELOAD',payload:{name:o}})}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createBaseTabProps",{enumerable:!0,get:function(){return t}})},1302,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get BottomTabBar(){return n.BottomTabBar},get BottomTabBarHeightCallbackContext(){return n.BottomTabBarHeightCallbackContext},get BottomTabBarHeightContext(){return n.BottomTabBarHeightContext},get BottomTabView(){return n.BottomTabView},get SceneStyleInterpolators(){return u},get Tabs(){return n.default},get TransitionPresets(){return c},get TransitionSpecs(){return f},get createJSTabsProps(){return n.createJSTabsProps},get createStandardBottomTabNavigator(){return n.createStandardBottomTabNavigator},get default(){return s},get useBottomTabBarHeight(){return n.useBottomTabBarHeight}});const t=r(d[0]),o=r(d[1]),n=b(r(d[2])),u=b(r(d[3])),c=b(r(d[4])),f=b(r(d[5]));function l(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,n=new WeakMap;return(l=function(t){return t?n:o})(t)}function b(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=l(o);if(n&&n.has(t))return n.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var b=c?Object.getOwnPropertyDescriptor(t,f):null;b&&(b.get||b.set)?Object.defineProperty(u,f,b):u[f]=t[f]}return u.default=t,n&&n.set(t,u),u}n.default.Screen=o.Screen,n.default.Protected=t.Protected;const s=n.default},1303,[719,720,1304,547,548,549]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get createJSTabsProps(){return h},get default(){return y}});const o=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),f=r(d[7]);var l,b;function h(t){const{dispatch:n,state:o}=t;return{...(0,f.createBaseTabProps)(t),popNestedStackToTop:t=>{const s=o.routes.find(n=>n.key===t)?.state;s?.key&&n({...c.StackActions.popToTop(),target:s.key})}}}l=r(d[8]),b=e,Object.keys(l).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(b,t)||Object.defineProperty(b,t,{enumerable:!0,get:function(){return l[t]}})});const y=(0,u.integrateWithRouter)(s.createStandardBottomTabNavigator,c.TabRouter,{activityDefaultThreshold:1,processDescriptors:p.appendMissingPlaceholderTabDescriptors,processState:p.appendMissingPlaceholderTabRoutes,createProps:h,processScreens:s=>s.map(s=>{if('function'!=typeof s.options&&void 0!==s.options?.href){const{href:c,...u}=s.options;if(u.tabBarButton)throw new Error('Cannot use `href` and `tabBarButton` together.');return null===c?{...s,options:{...u,hidden:!0}}:{...s,options:{...u,tabBarButton:s=>{const u='web'===n().Platform.OS?s.children:(0,t().jsx)(n().Pressable,{children:s.children});return(0,t().jsx)(o.Link,{...s,style:[{display:'flex'},s.style],href:c,asChild:'web'!==n().Platform.OS,children:u})}}}}return s})})},1304,[25,34,509,653,428,712,1305,1302,546]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){const s=n.routeNames.filter(t=>!n.routes.some(n=>n.name===t));if(0===s.length)return t;const u=s.reduce((t,n)=>(t[n]=o({key:void 0,name:n}),t),{});return{...t,...u}}function n(t,n){if(!t.routeNames.some(n=>!t.routes.some(t=>t.name===n)))return t;const s=t.routes[t.index]?.key,u=t.routeNames.map(s=>{const u=t.routes.find(t=>t.name===s);return u||o(s,n)}),c=Math.max(0,u.findIndex(t=>t.key===s));return{...t,index:c,routes:u}}function o(t,n){const o=n[t];if(!o)throw new Error(`Could not find a descriptor for route "${t}". This is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.`);return{...o.route,key:t,name:t}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get appendMissingPlaceholderTabDescriptors(){return t},get appendMissingPlaceholderTabRoutes(){return n}})},1305,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get ExperimentalStack(){return c},get default(){return o}});const n=u(r(d[1]));function u(t){return t&&t.__esModule?t:{default:t}}const c=Object.assign(u=>(0,t().jsx)(n.default,{...u}),{Screen:n.default.Screen,Protected:n.default.Protected}),o=c},1306,[25,1307]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,u){for(var n in u)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(u,n).get})})(e,{get Stack(){return t.default},get default(){return l}});const t=c(r(d[0])),u=r(d[1]),n=r(d[2]);function c(t){return t&&t.__esModule?t:{default:t}}t.default.Screen=u.StackScreen,t.default.Header=u.StackHeader,t.default.Title=u.StackTitle,t.default.Toolbar=n.StackToolbar;const l=t.default},1307,[696,729,734]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.default}});const t=o((n=r(d[0]),u=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(u,t)||Object.defineProperty(u,t,{enumerable:!0,get:function(){return n[t]}})}),n));var n,u;function o(t){return t&&t.__esModule?t:{default:t}}},1308,[1307]); +__d(function(g,r,i,a,m,e,d){"use strict";var t,n;Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get useIsPreview(){return s.useIsPreview},get usePreventZoomTransitionDismissal(){return o.usePreventZoomTransitionDismissal}}),t=r(d[0]),n=e,Object.keys(t).forEach(function(o){"default"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return t[o]}})});const o=r(d[1]),s=r(d[2])},1309,[509,1310,422]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreventZoomTransitionDismissal",{enumerable:!0,get:function(){return n}})},1310,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Color",{enumerable:!0,get:function(){return y}});r(d[0]);function t(t,n){return Object.keys(t).forEach(function(u){"default"===u||Object.prototype.hasOwnProperty.call(n,u)||Object.defineProperty(n,u,{enumerable:!0,get:function(){return t[u]}})}),t}t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e),t(r(d[5]),e);const n=new Proxy({},{get:(t,n)=>null}),u=new Proxy({},{get:(t,n)=>null}),o=new Proxy({},{get:(t,n)=>null}),l=new Proxy({},{get:(t,n)=>null}),c=new Proxy({get attr(){return u},get material(){return o},get dynamic(){return l}},{get:(t,n)=>n in t?t[n]:null}),y={get ios(){return n},get android(){return c}}},1311,[1312,1313,1314,1315,1316,1317]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return null}function n(t){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Material3Color(){return n},get Material3DynamicColor(){return t}})},1312,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1313,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1314,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1315,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1316,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1317,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inlineStyles",{enumerable:!0,get:function(){return n.inlineStyles}}),Object.defineProperty(_e,"loadLocalRawResource",{enumerable:!0,get:function(){return n.loadLocalRawResource}}),Object.defineProperty(_e,"LocalSvg",{enumerable:!0,get:function(){return n.LocalSvg}}),Object.defineProperty(_e,"SvgCss",{enumerable:!0,get:function(){return n.SvgCss}}),Object.defineProperty(_e,"SvgCssUri",{enumerable:!0,get:function(){return n.SvgCssUri}}),Object.defineProperty(_e,"SvgWithCss",{enumerable:!0,get:function(){return n.SvgWithCss}}),Object.defineProperty(_e,"SvgWithCssUri",{enumerable:!0,get:function(){return n.SvgWithCssUri}}),Object.defineProperty(_e,"WithLocalSvg",{enumerable:!0,get:function(){return n.WithLocalSvg}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return e.camelCase}}),Object.defineProperty(_e,"fetchText",{enumerable:!0,get:function(){return t.fetchText}}),Object.defineProperty(_e,"parse",{enumerable:!0,get:function(){return e.parse}}),Object.defineProperty(_e,"SvgAst",{enumerable:!0,get:function(){return e.SvgAst}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return e.SvgFromUri}}),Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return e.SvgFromXml}}),Object.defineProperty(_e,"SvgUri",{enumerable:!0,get:function(){return e.SvgUri}}),Object.defineProperty(_e,"SvgXml",{enumerable:!0,get:function(){return e.SvgXml}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),u=r(d[3]);Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});var o=r(d[4]);Object.keys(o).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return o[e]}})});var c,f=(c=o)&&c.__esModule?c:{default:c}},1318,[1319,1320,1339,1340,1322]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SvgAst=c,_e.SvgXml=l,_e.SvgUri=function(r){const{onError:o=i,uri:s,onLoad:c,fallback:u}=r,[f,p]=(0,t.useState)(null),[d,h]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s?(0,n.fetchText)(s).then(t=>{p(t),d&&h(!1),c?.()}).catch(t=>{o(t),h(!0)}):p(null)},[o,s,c]),d)return u??null;return e.createElement(l,{xml:f,override:r,fallback:u})},Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return d}}),_e.getStyle=h,_e.astToReact=x,_e.parse=j,Object.defineProperty(_e,"tags",{enumerable:!0,get:function(){return r.tags}});var t=_r(_d[0]),e=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e})(t),n=_r(_d[1]),r=_r(_d[2]);function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;enull!==o?j(o):null,[o]);return e.createElement(c,{ast:r,override:s||n})}catch(t){return r(t),l??null}}class u extends t.Component{state={ast:null};componentDidMount(){this.parse(this.props.xml)}componentDidUpdate(t){const{xml:e}=this.props;e!==t.xml&&this.parse(e)}parse(t){const{onError:e=i}=this.props;try{this.setState({ast:t?j(t):null})}catch(t){const n=t;e({...n,message:`[RNSVG] Couldn't parse SVG, reason: ${n.message}`})}}render(){const{props:t,state:{ast:n}}=this;return e.createElement(c,{ast:n,override:t.override||t})}}class f extends t.Component{state={xml:null};componentDidMount(){this.fetch(this.props.uri)}componentDidUpdate(t){const{uri:e}=this.props;e!==t.uri&&this.fetch(e)}async fetch(t){try{this.setState({xml:t?await(0,n.fetchText)(t):null})}catch(t){console.error(t)}}render(){const{props:t,state:{xml:n}}=this;return e.createElement(u,{xml:n,override:t,onError:t.onError})}}const p=(t,e)=>e.toUpperCase(),d=t=>t.replace(/[:-]([a-z])/g,p);function h(t){const e={},n=t.split(';').filter(t=>t.trim()),{length:r}=n;for(let t=0;tb(' ',t.length);function v(t,e){const n=t.split('\n'),r=n.length;let o=e,s=0;for(;s=t))break;o-=t}const c=t.slice(0,e).replace(/^\t+/,y),i=/(^|\n).*$/.exec(c),l=i&&i[0]||'',u=t.slice(e),f=/.*(\n|$)/.exec(u);return{line:s,column:o,snippet:`${l}${f&&f[0]}\n${b(' ',l.length)}^`}}const E=/[a-zA-Z0-9:_-]/,O=/
The Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

- + diff --git a/abbotsford/chef-app/kitchen.html b/abbotsford/chef-app/kitchen.html index ebabf6ccc0b7868d4c0ae852833745d7b038bc0d..c6e9421ef750343d9a6eb03d3daf6e57479b034c 100644 --- a/abbotsford/chef-app/kitchen.html +++ b/abbotsford/chef-app/kitchen.html @@ -30,6 +30,6 @@
The Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

- + diff --git a/abbotsford/chef-app/sw.js b/abbotsford/chef-app/sw.js index f05514b3334ae03b9b72cdb8a1e23a2ac7318fa2..900d753443387d14e3e766f39ebc62ffdf603038 100644 --- a/abbotsford/chef-app/sw.js +++ b/abbotsford/chef-app/sw.js @@ -1,4 +1,4 @@ -const V="cc-abbotsford-chef-bafa96ad70c2d3f4",B="/abbotsford/chef-app/",P=["/abbotsford/chef-app/apple-touch-icon.png", "/abbotsford/chef-app/favicon.ico", "/abbotsford/chef-app/icon-192.png", "/abbotsford/chef-app/icon-512.png", "/abbotsford/chef-app/brand-logo.png", "/abbotsford/chef-app/index.html", "/abbotsford/chef-app/manifest.webmanifest", "/abbotsford/chef-app/brand-hero.png", "/abbotsford/chef-app/kitchen.html", "/abbotsford/chef-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/abbotsford/chef-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/abbotsford/chef-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/abbotsford/chef-app/_expo/static/js/web/index-22ab313389266900b67350334e3d7a33.js", "/abbotsford/chef-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/abbotsford/chef-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/abbotsford/chef-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js", "/abbotsford/chef-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/abbotsford/chef-app/_expo/static/js/web/index-7fc09fb9e425fe86489cd7f975b72892.js", "/abbotsford/chef-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/abbotsford/chef-app/_expo/static/js/web/index-572239673a2eda40ce1d7171531ee6dc.js", "/abbotsford/chef-app/_expo/static/js/web/book-7c4c90140093809a35e48a974143bb55.js", "/abbotsford/chef-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/abbotsford/chef-app/_expo/static/js/web/_layout-56fe98b075405db708171d6d13d135d3.js", "/abbotsford/chef-app/_expo/static/js/web/__common-0425404e400a21b23676d48bb03fc623.js", "/abbotsford/chef-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/abbotsford/chef-app/_expo/static/js/web/index-3907adcde835a3ea4b369b11444932ca.js", "/abbotsford/chef-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js", "/abbotsford/chef-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js", "/abbotsford/chef-app/_expo/static/js/web/whatson-dd3d796ea1e77876d5803d9ecd8c1109.js", "/abbotsford/chef-app/_expo/static/js/web/basket-39cdf98ed8418bbc1a1ff3b2f269cbcb.js", "/abbotsford/chef-app/_expo/static/js/web/index-ec4a702c34ea762b0b3ef33b63506ae5.js", "/abbotsford/chef-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js", "/abbotsford/chef-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/abbotsford/chef-app/_expo/static/js/web/waitlist-5949dfe032d315503649cf449ffe870a.js", "/abbotsford/chef-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js", "/abbotsford/chef-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/abbotsford/chef-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/abbotsford/chef-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js", "/abbotsford/chef-app/_expo/static/js/web/historicalBookingApi-bfa4e54c4063e9fc2635ab60c034b3f8.js", "/abbotsford/chef-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/abbotsford/chef-app/_expo/static/js/web/index-fb16c776fdd291d3aa642c194ec798bc.js", "/abbotsford/chef-app/_expo/static/js/web/[token]-bee6add88cca58f03680987578d45fcf.js", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/abbotsford/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/abbotsford/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/abbotsford/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/abbotsford/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/abbotsford/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/abbotsford/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/abbotsford/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/abbotsford/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/abbotsford/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/abbotsford/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/abbotsford/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/abbotsford/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/abbotsford/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/abbotsford/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/abbotsford/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/abbotsford/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/abbotsford/chef-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/abbotsford/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/abbotsford/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/abbotsford/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/abbotsford/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/abbotsford/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/abbotsford/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/abbotsford/chef-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/abbotsford/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/abbotsford/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/abbotsford/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/abbotsford/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/abbotsford/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/abbotsford/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/abbotsford/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/abbotsford/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/abbotsford/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/abbotsford/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/abbotsford/chef-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/abbotsford/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/abbotsford/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/abbotsford/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/abbotsford/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/abbotsford/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/abbotsford/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png"]; +const V="cc-abbotsford-chef-b76c3ce3e746e674",B="/abbotsford/chef-app/",P=["/abbotsford/chef-app/index.html", "/abbotsford/chef-app/icon-192.png", "/abbotsford/chef-app/brand-logo.png", "/abbotsford/chef-app/kitchen.html", "/abbotsford/chef-app/favicon.ico", "/abbotsford/chef-app/brand-hero.png", "/abbotsford/chef-app/icon-512.png", "/abbotsford/chef-app/apple-touch-icon.png", "/abbotsford/chef-app/manifest.webmanifest", "/abbotsford/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/abbotsford/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/abbotsford/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/abbotsford/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/abbotsford/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/abbotsford/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/abbotsford/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/abbotsford/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/abbotsford/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/abbotsford/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/abbotsford/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/abbotsford/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/abbotsford/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/abbotsford/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/abbotsford/chef-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/abbotsford/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/abbotsford/chef-app/assets/assets/brand/smokinggoat.fff2a9a694b41fed68c80a2c9bfe65da.png", "/abbotsford/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/abbotsford/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/abbotsford/chef-app/assets/assets/brand/drunkencoo.272f746bf13376f503acd81a524a7998.png", "/abbotsford/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/abbotsford/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/abbotsford/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/abbotsford/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/abbotsford/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/abbotsford/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/abbotsford/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/abbotsford/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/chef-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/abbotsford/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/abbotsford/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/abbotsford/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/abbotsford/chef-app/assets/assets/brand/3idiots-hero.77d66ccb53ec1835c3b8a838e9bcfb5a.png", "/abbotsford/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/abbotsford/chef-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/abbotsford/chef-app/assets/assets/brand/drunkencoo-hero.7c01fed6cb075a3a8e4f969bff1cf103.png", "/abbotsford/chef-app/assets/assets/brand/smokinggoat-hero.b2ae48c4a1fcf2521ae9ff58435a6649.png", "/abbotsford/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/abbotsford/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/abbotsford/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/abbotsford/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/abbotsford/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/abbotsford/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/abbotsford/chef-app/_expo/static/js/web/index-ba5aea4e23e402619315d92ef1e4fc6c.js", "/abbotsford/chef-app/_expo/static/js/web/gift-791c64f5dbcb5e9b9629af9241dde456.js", "/abbotsford/chef-app/_expo/static/js/web/index-708cc108b14a03d1e55d135c08408edf.js", "/abbotsford/chef-app/_expo/static/js/web/[oid]-0ef90855abb82d22ac5def655ebb19b6.js", "/abbotsford/chef-app/_expo/static/js/web/merch-77ea1815cef4942701820887c797ac92.js", "/abbotsford/chef-app/_expo/static/js/web/index-d72f0e09722c49318a402489e965ec4a.js", "/abbotsford/chef-app/_expo/static/js/web/feedback-e234bfa389c6fd89a2e9f35bd3515c4d.js", "/abbotsford/chef-app/_expo/static/js/web/index-0d5420913a09234192e03fb64f496fd4.js", "/abbotsford/chef-app/_expo/static/js/web/index-b2fb0e8ee9c9e5267d8b0725148d8bf3.js", "/abbotsford/chef-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/abbotsford/chef-app/_expo/static/js/web/index-4caab44ee144794fe5f1c5f3fbaed93d.js", "/abbotsford/chef-app/_expo/static/js/web/_layout-28f52c5d547984f57d779d2d1595deac.js", "/abbotsford/chef-app/_expo/static/js/web/__common-d92ed2b513b48a7e75fdf07ee4f937c8.js", "/abbotsford/chef-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js", "/abbotsford/chef-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js", "/abbotsford/chef-app/_expo/static/js/web/profile-94f3e7175fc7efdfa4351ecc255fb11b.js", "/abbotsford/chef-app/_expo/static/js/web/basket-c05ffa92d4d6d13484ce78275193c02c.js", "/abbotsford/chef-app/_expo/static/js/web/index-18a42003614e46ed29f029ff3e81efd8.js", "/abbotsford/chef-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js", "/abbotsford/chef-app/_expo/static/js/web/offers-31ec634ef9aa42a8856b1215ab24e6f3.js", "/abbotsford/chef-app/_expo/static/js/web/refer-281b0170b80b5db0e1402a8c4d823a68.js", "/abbotsford/chef-app/_expo/static/js/web/book-34e99aaf0197899dc09c20d6bb54139f.js", "/abbotsford/chef-app/_expo/static/js/web/index-0a34312c3724df867c229ae4363d5bf9.js", "/abbotsford/chef-app/_expo/static/js/web/waitlist-0820a9a3f8a549bf0d6f432f6a7ad617.js", "/abbotsford/chef-app/_expo/static/js/web/[token]-060d0a0e0a07c4da23ca6d5b04c35e87.js", "/abbotsford/chef-app/_expo/static/js/web/loyalty-bb43e2009908082ac56ab35a52b228ca.js", "/abbotsford/chef-app/_expo/static/js/web/index-e9112f8ce9e859f928720bf6bff6ea9e.js", "/abbotsford/chef-app/_expo/static/js/web/demo-bb0072f641fdd92aa99cba5bc91fc36d.js", "/abbotsford/chef-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js", "/abbotsford/chef-app/_expo/static/js/web/whatson-6498b8821e66bd4aa1639b57afb933a3.js", "/abbotsford/chef-app/_expo/static/js/web/index-a7e511353fde4e4907f278d874667ffb.js", "/abbotsford/chef-app/_expo/static/js/web/lost-cceda4c454fce783fcc4c1cdf454f0cd.js"]; self.addEventListener('install',e=>e.waitUntil(caches.open(V).then(c=>Promise.all(P.map(u=>fetch(u).then(r=>{if(!r.ok)throw Error('cache');return c.put(u,r)})))).then(()=>self.skipWaiting()))); self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-abbotsford-chef-')&&k!==V).map(k=>caches.delete(k)))).then(()=>self.clients.claim()))); self.addEventListener('fetch',e=>{const u=new URL(e.request.url);if(e.request.method!=='GET'||u.origin!==location.origin||!u.pathname.startsWith(B))return;if(e.request.mode==='navigate'){e.respondWith(fetch(e.request).then(r=>r.ok?r:caches.match(B+'index.html')).catch(()=>caches.match(B+'index.html')));return;}e.respondWith(caches.match(e.request).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/abbotsford/customer-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js b/abbotsford/customer-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js new file mode 100644 index 0000000000000000000000000000000000000000..8039fc81f8fac85dbe1964b30e03ea44f335ea65 --- /dev/null +++ b/abbotsford/customer-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},802,[805,31,807,25]); \ No newline at end of file diff --git a/abbotsford/customer-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js b/abbotsford/customer-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js new file mode 100644 index 0000000000000000000000000000000000000000..283d584fafbdddc8e5e6b0b5633e099144c8d6ba --- /dev/null +++ b/abbotsford/customer-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js @@ -0,0 +1 @@ +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return b}});var n=_r(_d[0]),t=_r(_d[1]),s=_r(_d[2]),a=e(_r(_d[3])),l=e(_r(_d[4])),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]);function b(){const{rid:e,did:b}=(0,t.useLocalSearchParams)(),j=(0,h.useRestaurant)(e),x=(0,h.useMenu)(e).find(e=>e.id===b),y=(0,h.useCustomer)(),m=(0,h.useRecipeCards)(e).find(e=>e.id===x?.recipeCardId),k=m?.signOff&&m.photo?(0,g.recipeCards)().photoSource(m.photo):null,v=(0,h.useStore)(e=>e.addLine),w=(0,n.useTakeawayMenu)(n=>n.byVenue[e]),S=(0,h.useStore)(n=>n.basket.restaurantId===e&&'table'===n.basket.mode),[C,B]=(0,s.useState)(()=>(x?.optionGroups??[]).filter(e=>e.required).map(e=>e.choices[0].id)),[$,I]=(0,s.useState)(1),[P,T]=(0,s.useState)(''),[L,O]=(0,s.useState)(!1),[D,A]=(0,s.useState)(!1),[M,R]=(0,s.useState)(!1),[q,_]=(0,s.useState)(!1),N=(0,s.useMemo)(()=>x?(0,c.effectiveAllergens)(x,C):{},[x,C]);if(!j||!x)return(0,f.jsx)(d.Screen,{title:"Not found",children:(0,f.jsx)(d.T,{children:"Dish not found."})});const G=(0,c.conflictsFor)(N,y.allergies),Y=(x.price??0)+(x.optionGroups??[]).flatMap(e=>e.choices).filter(e=>C.includes(e.id)).reduce((e,n)=>e+n.priceDelta,0),z=S||j.fictional?'on':(0,n.takeawayAvail)(x,w),F=x.soldOut||!x.signOff||null===x.price||'on'!==z,Q=(e,n)=>{const t=x.optionGroups.find(n=>n.id===e);B(e=>{const s=t.choices.map(e=>e.id);return t.multi?e.includes(n)?e.filter(e=>e!==n):[...e,n]:e.includes(n)&&!t.required?e.filter(e=>e!==n):[...e.filter(e=>!s.includes(e)),n]})},V=e=>{h.useStore.getState().basket.restaurantId!==j.id&&h.useStore.getState().startBasket(j.id,'takeaway'),v({itemId:x.id,qty:$,choiceIds:C,notes:P,override:e?{allergens:G.contains,at:(new Date).toISOString()}:void 0}),O(!1),_(!0)};return(0,f.jsxs)(d.Screen,{title:x.name,subtitle:j.name,right:(0,f.jsx)(o.BasketButton,{}),children:[k?(0,f.jsx)(a.default,{testID:"dish-photo",source:k,accessibilityLabel:`${x.name}${'example'===m?.origin?' (example photo)':''}`,style:{width:'100%',height:200,borderRadius:12},resizeMode:"cover"}):null,(0,f.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(d.T,{weight:"bold",size:20,colour:p.colours.gold,children:null===x.price?x.priceNote:(0,u.gbp)(Y)}),x.dietary.map(e=>(0,f.jsx)(d.Badge,{kind:"ok",label:e},e))]}),(0,f.jsx)(d.T,{children:x.description}),G.contains.length?(0,f.jsx)(d.Banner,{kind:"danger",title:`Blocked: contains ${G.contains.map(c.allergenLabel).join(', ')}`,children:`You\u2019ve told us: ${y.allergies.filter(e=>G.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`).join('; ')}. This dish can\u2019t be added unless you deliberately override (for example, ordering for someone else).`}):null,G.may.length?(0,f.jsx)(d.Banner,{kind:"warn",title:`Warning: may contain ${G.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact is possible (e.g. shared fryer). Please speak to staff before ordering."}):null,(x.optionGroups??[]).map(e=>(0,f.jsxs)(d.Card,{children:[(0,f.jsxs)(d.T,{weight:"semibold",children:[e.name,e.required?' (required)':' (optional)']}),(0,f.jsx)(d.Row,{wrap:!0,gap:6,children:e.choices.map(n=>(0,f.jsx)(d.Chip,{label:n.label,sub:n.priceDelta?`+${(0,u.gbp)(n.priceDelta)}`:void 0,selected:C.includes(n.id),onPress:()=>Q(e.id,n.id)},n.id))})]},e.id)),(0,f.jsx)(d.Card,{children:(0,f.jsx)(r.AllergenPanel,{item:x,map:N,declared:y.allergies})}),j.fictional?null:(0,f.jsx)(d.AllergenNotice,{phone:j.phone}),(0,f.jsx)(d.Field,{label:"Notes for the kitchen (optional)",placeholder:"e.g. no gherkins",value:P,onChangeText:T}),(0,f.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(d.T,{weight:"semibold",children:"Quantity"}),(0,f.jsx)(d.Stepper,{value:$,onChange:I,label:"quantity"})]}),q?(0,f.jsx)(d.Banner,{kind:"success",title:"Added to basket",children:G.contains.length?'Allergy override recorded \u2014 the kitchen will see a large allergy alert.':'Carry on browsing or go to your basket.'}):null,F?(0,f.jsx)(d.Banner,{kind:"warn",children:x.soldOut||'sold-out'===z?'Sold out today.':'off'===z&&x.signOff&&null!==x.price?'This dish isn\u2019t on the takeaway menu. You can have it when you eat in.':x.signOff?'Price on the specials board \u2014 ask staff.':'Not available to order online until the head chef signs off its allergens.'}):G.contains.length?(0,f.jsxs)(l.default,{style:{gap:8},children:[(0,f.jsx)(d.Button,{kind:"secondary",label:"Choose something else",onPress:()=>t.router.back()}),(0,f.jsx)(d.Button,{kind:"danger",label:"Override and add anyway\u2026",onPress:()=>{A(!1),R(!1),O(!0)},testID:"override-open"})]}):(0,f.jsxs)(d.Row,{gap:8,children:[(0,f.jsx)(d.Button,{style:{flex:1},label:`Add ${$} to basket \xb7 ${(0,u.gbp)(Y*$)}`,onPress:()=>V(!1),testID:"add-to-basket"}),q?(0,f.jsx)(d.Button,{kind:"secondary",label:"Basket",onPress:()=>t.router.push('/customer/basket')}):null]}),(0,f.jsxs)(d.Sheet,{visible:L,onClose:()=>O(!1),title:"Allergy override",children:[(0,f.jsx)(d.Banner,{kind:"danger",title:`${x.name} contains ${G.contains.map(c.allergenLabel).join(', ')}`,children:`Your profile says: ${y.allergies.filter(e=>G.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`).join('; ')}.`}),(0,f.jsx)(d.Toggle,{label:"I understand this dish contains an allergen I have declared",value:D,onChange:A}),(0,f.jsx)(d.Toggle,{label:"It is for someone without this allergy, or I have spoken to staff",value:M,onChange:R}),(0,f.jsx)(d.Muted,{children:"The override is logged and shown to the kitchen as an allergy alert that must be acknowledged."}),(0,f.jsx)(d.Button,{kind:"danger",disabled:!D||!M,label:"Confirm override and add",onPress:()=>V(!0),testID:"override-confirm"})]})]})}},779,[836,805,31,197,128,837,838,818,819,820,823,839,825,25]); \ No newline at end of file diff --git a/abbotsford/customer-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js b/abbotsford/customer-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js new file mode 100644 index 0000000000000000000000000000000000000000..1bcd14167edfb4176466ea1f3be5800f7b8a603b --- /dev/null +++ b/abbotsford/customer-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),u=_r(d[4]),c=_r(d[5]),s=_r(d[6]),l=_r(d[7]);function f(){const{n:f,r:b}=(0,r.useLocalSearchParams)(),E=(0,u.useStore)(t=>t.startBasket),[_,h]=(0,n.useState)(!1),S=b??c.VENUE_RID,j=(0,u.useOrderAtTable)(S),I=(0,s.guestServer)();return(0,n.useEffect)(()=>{t.LIVE_VENUE_BUILD||I||(j&&E(S,'table',String(f)),h(!0))},[S,f,j,I]),t.LIVE_VENUE_BUILD||I?(0,l.jsx)(o.Screen,{title:"Order at the table",children:(0,l.jsx)(o.Banner,{kind:"demo",title:"Scan the code on your table",children:"To order from your table, scan the QR code printed on it. Or order at the bar."})}):_?(0,l.jsx)(r.Redirect,{href:`/customer/${S}`}):null}},795,[842,805,31,818,823,5,845,25]); \ No newline at end of file diff --git a/abbotsford/customer-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js b/abbotsford/customer-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js new file mode 100644 index 0000000000000000000000000000000000000000..ff5510d14e2cb246f1f5b3730dd146368851dce4 --- /dev/null +++ b/abbotsford/customer-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js @@ -0,0 +1,3 @@ +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=_r(d[0]),l=_r(d[1]),s=_r(d[2]),r=_r(d[3]),n=(e=r)&&e.__esModule?e:{default:e},o=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),y=_r(d[10]),b=_r(d[11]),j=_r(d[12]);const x=[['new','Placed'],['acknowledged','Accepted'],['preparing','Cooking'],['ready','Ready to collect'],['collected','Collected']],w=[['new','Sent'],['acknowledged','Accepted'],['preparing','Cooking'],['served','Food out'],['closed','Paid']];function f(){const{oid:e}=(0,l.useLocalSearchParams)(),r=(0,p.useOrder)(e),f=(0,p.useRestaurant)(r?.restaurantId),[k,T]=(0,s.useState)(0),[S,C]=(0,s.useState)(''),[v,M]=(0,s.useState)(!1),[P,A]=(0,s.useState)(0),[R,$]=(0,s.useState)(r?.split?.ways??1);if(!r||!f)return(0,j.jsx)(i.Screen,{title:"Order",children:(0,j.jsx)(i.T,{children:"Order not found."})});const O='takeaway'===r.type?x:w,I=Math.max(0,O.findIndex(([e])=>e===r.status)),N=Math.round(r.subtotal*P/100),B='table'===r.type?r.subtotal+(r.split?r.tip:N):r.total,_=B-r.paid,H=r.split?.ways??R,D=r.split?.paidShares??0,F=Math.ceil(B/H),q='collected'===r.status||'closed'===r.status;return(0,j.jsxs)(i.Screen,{title:`Order ${r.ref}`,subtitle:`${f.name} \xb7 ${'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Collection at ${r.slotTime?(0,h.hm)(new Date(r.slotTime)):'\u2014'}`}`,children:['takeaway'===r.type?(0,j.jsx)(b.TakeawayPayCard,{o:r,phone:f.phone}):null,'takeaway'===r.type&&'awaiting_payment'!==r.status&&'cancelled'!==r.status?(0,j.jsx)(i.Banner,{kind:"success",title:'ready'===r.status?'Your order is ready!':'Order placed',children:'ready'===r.status?'Head to the bar and give your order number. Staff will check allergies with you at handover.':`Show order number ${r.ref} at the bar when you arrive.`}):null,'awaiting_payment'===r.status||'cancelled'===r.status?null:(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.H2,{children:"Status"}),O.map(([e,t],l)=>(0,j.jsxs)(i.Row,{gap:10,children:[(0,j.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:l<=I?y.colours.gold:y.colours.surface2,borderWidth:1,borderColor:y.colours.gold}}),(0,j.jsx)(i.T,{weight:l===I?'semibold':'regular',colour:l<=I?y.colours.text:y.colours.muted,children:t})]},e)),r.allergyAck?(0,j.jsxs)(i.Muted,{children:["Kitchen signed off your allergies (",r.allergyAck.by,", ",(0,h.hm)(new Date(r.allergyAck.at)),")"]}):r.allergies.length?(0,j.jsx)(i.Muted,{children:"Waiting for the kitchen to sign off your allergies\u2026"}):null,'takeaway'!==r.type||q?null:(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.Button,{small:!0,kind:'on-my-way'===r.customerSignal?'primary':'secondary',label:"On my way",onPress:()=>p.repo.orders.customerSignal(r.id,'on-my-way')}),(0,j.jsx)(i.Button,{small:!0,kind:'here'===r.customerSignal?'primary':'secondary',label:"I\u2019m here",onPress:()=>p.repo.orders.customerSignal(r.id,'here')})]})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.H2,{children:"Items"}),r.lines.map((e,t)=>(0,j.jsxs)(n.default,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{style:{flex:1},children:[e.qty,"\xd7 ",e.name]}),(0,j.jsx)(i.T,{children:(0,u.gbp)(e.unitPrice*e.qty)})]}),e.choices.length?(0,j.jsx)(i.Muted,{children:e.choices.join(' \xb7 ')}):null,e.overridden?(0,j.jsx)(i.Badge,{kind:"red",label:`Allergy override: ${e.contains.map(c.allergenLabel).join(', ')}`}):null]},t)),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Subtotal"}),(0,j.jsx)(i.T,{children:(0,u.gbp)(r.subtotal)})]}),r.giftCardApplied?(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Of which gift card"}),(0,j.jsxs)(i.T,{colour:y.colours.ok,children:["\u2212",(0,u.gbp)(r.giftCardApplied)]})]}):null,r.tip?(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Tip"}),(0,j.jsx)(i.T,{children:(0,u.gbp)(r.tip)})]}):null,(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Paid (test, no real money)"}),(0,j.jsx)(i.T,{weight:"semibold",colour:y.colours.gold,children:(0,u.gbp)(r.paid)})]})]}),'table'===r.type&&'closed'!==r.status&&'cancelled'!==r.status?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsxs)(i.H2,{children:["Your bill \u2014 ",(0,t.tableNumbers)(r.tableNo)]}),r.split?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(i.T,{children:["Total ",(0,u.gbp)(B)," \xb7 split ",H," way",H>1?'s':''," \xb7 ",(0,u.gbp)(F)," each"]}),(0,j.jsxs)(i.T,{children:["Shares paid: ",D," of ",H," \xb7 remaining ",(0,u.gbp)(_)]}),(0,j.jsx)(i.Muted,{children:"Pay with a member of staff at your table. Online card payment for the table bill isn\u2019t set up."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Add a tip?"}),(0,j.jsx)(i.Row,{wrap:!0,children:[0,10,12.5,15].map(e=>(0,j.jsx)(i.Chip,{label:e?`${e}%`:'No tip',selected:P===e,onPress:()=>A(e)},e))}),(0,j.jsx)(i.Muted,{children:"Tips go to staff under the restaurant\u2019s tipping policy (Employment (Allocation of Tips) Act 2023)."}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Split evenly between"}),(0,j.jsx)(i.Stepper,{value:R,onChange:$,min:1,max:8,label:"people"})]}),(0,j.jsxs)(i.T,{children:["Total ",(0,u.gbp)(r.subtotal+N),R>1?` \xb7 ${(0,u.gbp)(Math.ceil((r.subtotal+N)/R))} each`:'']}),(0,j.jsx)(i.Button,{label:"Get the bill",onPress:()=>p.repo.orders.setSplit(r.id,R,N),testID:"get-bill"})]})]}):null,!q||r.rated||v?null:(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.H2,{children:"How was everything?"}),(0,j.jsxs)(i.Muted,{children:["One tap \u2014 this goes privately to ",f.name," only, never published."]}),(0,j.jsx)(o.Stars,{value:k,onChange:T}),k?(0,j.jsx)(i.Field,{label:"Anything to add? (optional)",value:S,onChangeText:C}):null,(0,j.jsx)(i.Button,{label:"Send feedback",disabled:!k,onPress:()=>{p.repo.feedback.add({restaurantId:f.id,orderId:r.id,customerId:r.customerId,customerName:r.customerName,stars:k,comment:S,context:'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Takeaway ${r.ref}`}),M(!0)},testID:"send-rating"})]}),v||r.rated?(0,j.jsx)(i.Banner,{kind:"success",children:"Thanks \u2014 your feedback went privately to the restaurant."}):null,q?(0,j.jsx)(i.Button,{kind:"secondary",label:"View stamp card",onPress:()=>l.router.push(`/customer/${f.id}/loyalty`)}):null]})}},792,[812,805,31,128,840,818,819,820,822,823,825,882,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPayCard=function({o:e,phone:y}){const[f,k]=(0,n.useState)(Date.now()),[w,x]=(0,n.useState)(!1),[j,b]=(0,n.useState)(''),[P,v]=(0,n.useState)(null),_=(0,n.useRef)(!1),B=(0,c.payView)(e,f);(0,n.useEffect)(()=>{const e=setInterval(()=>k(Date.now()),1e3);return()=>clearInterval(e)},[]);const T='pay'===B.kind||'expired'===B.kind&&_.current&&'awaiting_payment'===e.status;(0,n.useEffect)(()=>{if(!T||!_.current)return;const n=setInterval(()=>{(0,h.checkPaid)(e.id)},1e4),r=t.default.addEventListener('change',n=>{'active'===n&&(0,h.checkPaid)(e.id)});return()=>{clearInterval(n),r.remove()}},[T,e.id]);if('none'===B.kind)return null;if('sending'===B.kind)return(0,p.jsx)(s.Banner,{kind:"warn",title:"Saving your order\u2026",children:"Sending it to the restaurant. Card payment opens in a moment."});if('refused'===B.kind)return(0,p.jsxs)(s.Banner,{kind:"danger",title:"The restaurant couldn\u2019t take this order",children:[(0,p.jsx)(s.T,{size:14,colour:"#FFE3DF",children:`${B.reason} Nothing has been charged.`}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to the menu",onPress:()=>o.router.replace(`/customer/${e.restaurantId}`)})]});if('paid'===B.kind)return(0,p.jsx)(s.Banner,{kind:"success",title:`Paid ${(0,l.gbp)(B.amount)} by card`,children:B.late?'Your payment came in after the time ran out. The restaurant has your order and will contact you if the collection time needs to change.':'Your order has gone to the kitchen.'});if('expired'===B.kind)return(0,p.jsxs)(s.Banner,{kind:"warn",title:'awaiting_payment'===e.status?'Checking your payment\u2026':'Time ran out: order not sent',children:[(0,p.jsx)(s.T,{size:14,children:'awaiting_payment'===e.status?'We\u2019re checking with the payment page. If you paid, your order will show as paid shortly.':`Nothing has been charged. You can order again${y?` or ring ${y}`:''}.`}),'awaiting_payment'!==e.status?(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Order again",onPress:()=>o.router.replace(`/customer/${e.restaurantId}`)}):null]});return(0,p.jsxs)(s.Card,{highlight:u.colours.gold,children:[(0,p.jsx)(s.H2,{children:"Pay to send your order"}),(0,p.jsxs)(s.T,{children:["Your order goes to the kitchen once it\u2019s paid. Time left to pay: ",(0,p.jsx)(s.T,{weight:"bold",colour:B.secondsLeft<120?u.colours.red:u.colours.gold,children:(0,c.mmss)(B.secondsLeft)})]}),(0,p.jsx)(s.Button,{label:w?'Opening the payment page\u2026':`Pay ${(0,l.gbp)(e.total)} by card`,disabled:w||B.secondsLeft<120,onPress:async()=>{x(!0),b('');const n='undefined'!=typeof window?window.open('','_blank'):null,t=await(0,h.getPayLink)(e.id);if(x(!1),!t.ok)return n?.close(),void b(t.message);if(v(t.url),_.current=!0,n)try{return void(n.location.href=t.url)}catch{}},testID:"pay-card"}),B.secondsLeft<120?(0,p.jsx)(s.Muted,{children:"Not enough time left to pay. Wait for this order to expire, then order again."}):null,P?(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Open the payment page again",onPress:()=>{'undefined'!=typeof window?window.open(P,'_blank'):r.default.openURL(P)}}):null,P?(0,p.jsx)(s.Button,{small:!0,kind:"ghost",label:"I\u2019ve paid: check now",onPress:()=>{(0,h.checkPaid)(e.id)}}):null,j?(0,p.jsx)(s.T,{size:14,colour:u.colours.red,children:j}):null,(0,p.jsx)(s.Muted,{children:"Secure card payment on the restaurant\u2019s website. Apple Pay and Google Pay may be offered there."})]})};var n=_r(d[0]),t=e(_r(d[1])),r=e(_r(d[2]));_r(d[3]);var o=_r(d[4]),s=_r(d[5]),l=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10])},882,[31,232,240,123,805,818,820,825,836,883,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_OFF",{enumerable:!0,get:function(){return o}}),e.getPayLink=async function(u){try{if(!await(0,n.guestSession)())return{ok:!1,message:'Can\u2019t reach the restaurant. Check your signal and try again.'};const{data:c,error:y}=await(0,t.getSupabase)().functions.invoke('takeaway-pay',{body:{order_id:u}}),f=await s(c,y);return f&&'string'==typeof f.url&&f.url.startsWith('https://')?{ok:!0,url:f.url,expiresAt:String(f.expiresAt??''),amountPence:Number(f.amountPence??0)}:{ok:!1,message:'string'==typeof f?.error?f.error:o}}catch{return{ok:!1,message:o}}},e.checkPaid=async function(o){try{const{data:u,error:c}=await(0,t.getSupabase)().functions.invoke('takeaway-pay-check',{body:{order_id:o}}),y=await s(u,c);return(0,n.nudgeGuestSync)(),y?.off?'off':String(y?.state??'unknown')}catch{return'unknown'}};var t=r(d[0]),n=r(d[1]);const o='Card payment isn\u2019t available right now. Nothing has been charged. Please ring the restaurant.';async function s(t,n){if(t&&'object'==typeof t)return t;const o=n?.context;try{const t=o?.json?await o.json():null;return t&&'object'==typeof t?t:null}catch{return null}}},883,[872,824]); \ No newline at end of file diff --git a/abbotsford/customer-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js b/abbotsford/customer-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js new file mode 100644 index 0000000000000000000000000000000000000000..aa5686de2b7746d4738fdfd057a3991ab57eb798 --- /dev/null +++ b/abbotsford/customer-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);r(d[1]);var n=r(d[2]),c=r(d[3]),o=r(d[4]),f=r(d[5]);function s(){const{section:s}=(0,t.useLocalSearchParams)();return(0,c.canShow)('chef')?s&&(0,o.chefSectionAllowed)(String(s))?(0,f.jsx)(n.ChefApp,{section:String(s)},String(s)):(0,f.jsx)(t.Redirect,{href:"/kitchen"}):(0,f.jsx)(t.Redirect,{href:c.ENTRY[c.APP_VARIANT]})}},776,[805,31,806,807,808,25]); \ No newline at end of file diff --git a/abbotsford/customer-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js b/abbotsford/customer-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js new file mode 100644 index 0000000000000000000000000000000000000000..4ab9c83ccd4d5db63de5f806f1ae8fc169929c85 --- /dev/null +++ b/abbotsford/customer-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js @@ -0,0 +1,3 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]);function u(){const{token:u}=(0,t.useLocalSearchParams)(),h=(0,c.cleanToken)(u);return h?(0,s.guestServer)()?(0,l.jsx)(o.TableOrderLive,{token:h}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"demo",title:"Not connected",children:"This preview isn't connected to a venue, so table orders can't be sent from here."})}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"warn",title:"This code isn't working",children:"Please scan the QR code on your table again, or ask a member of staff."})})}},796,[805,31,818,885,887,845,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},885,[874,812,31,128,818,819,820,887,886,823,825,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})},886,[872,824,887]); \ No newline at end of file diff --git a/abbotsford/customer-app/_expo/static/js/web/__common-62dc618bc7e7f7ce3382df95eac3e0c0.js b/abbotsford/customer-app/_expo/static/js/web/__common-62dc618bc7e7f7ce3382df95eac3e0c0.js new file mode 100644 index 0000000000000000000000000000000000000000..04cde5e0b5a079c8ff5b1f060c50cfd5a216dfe6 --- /dev/null +++ b/abbotsford/customer-app/_expo/static/js/web/__common-62dc618bc7e7f7ce3382df95eac3e0c0.js @@ -0,0 +1,573 @@ +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}Object.defineProperty(e,"__esModule",{value:!0}),r(d[0]),t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e)},805,[1271,1272,1282,1283,1285]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:K}=(0,z.useChef)(3e4);(0,we.useReviewAlerts)(i);const V=(0,_.useSignedIn)(),X=V?.id??z.CHEF_ID,Z=V?.ownerAccess&&'owner'!==V.role?'owner privileges':V?.managerAccess&&'staff'===V.role?'manager privileges':'',Ce=(0,Se.useSync)(e=>e.perms),Pe=Ce.includes('*')||Ce.includes('takings.view');(0,o.useSoldOutLink)(!0,(V?.name??n).replace(' (example)',''));const Oe=e?Be[e]:void 0,[Ee,Le]=(0,A.useState)(Oe?.tab??'home'),[Ne,We]=(0,A.useState)(Oe?.k??null),[Fe,Ge]=(0,A.useState)(Oe?.stock??'levels'),[Ke,Me]=(0,A.useState)(void 0),[Ve,ze]=(0,A.useState)(Oe?.gp??'dishes'),Ue=(0,A.useRef)(null),qe=(0,y.ymd)(K),Qe=(0,y.ymd)(new Date(K.getTime()+864e5));(0,p.useTipsPosted)(i,qe);const Ye=(0,ie.useTravelDay)('chef',qe),Je='home'===Ee&&!Ye;(0,S.useKitchenTodoChime)(i,qe,()=>tt('kitchen','bookings')),(0,me.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,_.ensureAttendance)((new Date).toISOString().slice(0,10),K)},[]);const Xe=(0,A.useRef)({t:'home',k:null});Xe.current={t:Ee,k:Ne};const Ze=(0,A.useRef)([]),et=(0,r.useScrollMemory)(Ue),tt=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Pe||(t=null);const s=Xe.current;s.t===e&&s.k===t||(Ze.current=[...Ze.current,{...s,y:et.leave()}].slice(-30),et.restore(0)),Le(e),We(t)},[Pe]),st=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Xe.current;let t=Ze.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ze.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return et.leave(),Le(s.t),We(s.k),et.restore(s.y??0),!0},[]);(0,l.useWebBack)(st);const it=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ge(s),'gp'===e&&s&&ze(s),tt(e,t)})},[tt]),(0,b.useShiftReminders)({rid:i,staffId:X,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:V?.id??'',name:n,onOpen:e=>{'orderlists'===e&&tt('kitchen','orderlists'),'chat'===e&&tt('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:V?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',st);return()=>e.remove()},[st]),(0,A.useEffect)(()=>{'takings'!==Ne||Pe||(We(null),Le('kitchen'))},[Ne,Pe]),(0,Se.useSync)(e=>e.perms.join(','));const at=(0,H.kitchenHistoryAccess)(i),ot=Ae.filter(e=>('takings'!==e.id||Pe)&&('bookinghistory'!==e.id||at)&&('kitchensetup'!==e.id||at)),nt=Ne&&('takings'!==Ne||Pe)?Ae.find(e=>e.id===Ne):null,rt=((0,E.default)().width,nt?nt.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:ge.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[Ee]);return(0,Re.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:M.colours.bg},edges:['top','bottom'],children:[(0,Re.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:M.colours.border,gap:6},children:[(0,Re.jsx)(L.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,Re.jsx)(F.VoiceSlot,{size:44})}),(0,Re.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'80%',paddingRight:8},children:[(0,Re.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${Z?`, ${Z}`:''}`,style:{borderWidth:1,borderColor:M.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Re.jsxs)(G.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Re.jsx)(ue.StaffAvatar,{id:z.CHEF_ID,size:24,ring:!1}),(0,Re.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Re.jsxs)(G.T,{size:13,weight:"semibold",colour:M.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),Z?(0,Re.jsx)(G.Muted,{center:!1,size:10,numberOfLines:1,children:Z}):null]})]})}),(0,f.openedFromDisplay)()?(0,Re.jsx)(f.BackToDisplayButton,{compact:!0}):null]}),(0,Re.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Re.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,he.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:M.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Re.jsx)(G.T,{size:13,colour:M.colours.gold,children:"Staff app \u203a"})})]}),(0,Re.jsxs)(O.default,{ref:Ue,...et.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Ee?(0,Re.jsx)(ce.AlertsBanner,{}):null,'home'===Ee?(0,Re.jsx)(de.WhosOnShift,{}):null,(0,Re.jsx)(l.BackTitleRow,{back:!('home'===Ee&&!Ne||it),onBack:st,title:rt}),'home'===Ee?(0,Re.jsx)(ie.DayBar,{app:"chef",today:qe}):null,'home'===Ee&&Ye?(0,Re.jsx)(ie.DayView,{rid:i,day:Ye,today:qe,app:"chef"}):null,'home'===Ee?(0,Re.jsx)(le.WhoBar,{}):null,Je&&V?(0,Re.jsx)(h.MyTasksToday,{rid:i,staffId:V.id,name:V.name,onShift:(0,b.shiftNow)(V.id,K.getTime()).on}):null,Je&&(0,k.isKitchenViaDisplay)()?(0,Re.jsx)($e,{go:(e,t)=>{'stock'===e&&t&&Ge(t),'gp'===e&&t&&ze(t),'orders'===e&&Me(t),tt(e,'kitchen'===e?t??null:null)}}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(p.TodaysTipsCard,{rid:i,today:qe}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(p.TipsPotCard,{rid:i,today:qe}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(x.CoversToday,{rid:i,onPress:()=>tt('kitchen','bookings')}):null,Je?(0,Re.jsx)(j.LastFoodBanner,{rid:i,now:K}):null,Je?(0,Re.jsx)(w.NextTableFreeCard,{rid:i,now:K}):null,Je?(0,Re.jsx)(v.KitchenSignoffs,{rid:i,today:qe,by:n,app:"chef"}):null,Je?(0,Re.jsxs)(L.default,{style:{gap:4},children:[(0,Re.jsx)(v.PlattersBooked,{rid:i,date:qe,label:"Platters booked today"}),(0,Re.jsx)(v.PlattersBooked,{rid:i,date:Qe,label:"Platters booked tomorrow"})]}):null,Je?(0,Re.jsx)(Te.ChefAssistantButton,{}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)($e,{go:(e,t)=>{'stock'===e&&t&&Ge(t),'gp'===e&&t&&ze(t),'orders'===e&&Me(t),tt(e,'kitchen'===e?t??null:null)}}):null,'stock'!==Ee||c.PITCH?null:(0,Re.jsx)(te.KitchenCosts,{rid:i,me:(V?.name??n).replace(' (example)',''),actor:{name:(V?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Fe?'deliveries':'take'===Fe?'count':'deliveries'},`s-${Fe}`),'gp'!==Ee||c.PITCH?null:(0,Re.jsx)(te.KitchenCosts,{rid:i,me:(V?.name??n).replace(' (example)',''),actor:{name:(V?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ve}`),'stock'===Ee&&c.PITCH?(0,Re.jsx)(ee.StockScreen,{initial:Fe},Fe):null,'gp'===Ee&&c.PITCH?(0,Re.jsx)(U.GpScreen,{initial:Ve},Ve):null,'creator'===Ee?(0,Re.jsx)(ge.DishCreator,{rid:i,canPublish:!1}):null,'orders'===Ee?(0,Re.jsx)(Y.OrdersScreen,{focus:Ke},Ke??'all'):null,'rota'===Ee?(0,Re.jsx)(G.Card,{children:(0,Re.jsx)(J.KitchenRotaTab,{today:qe})}):null,'kitchen'!==Ee||nt?null:(0,Re.jsxs)(L.default,{style:{gap:10},children:[(0,Re.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:M.colours.border,backgroundColor:M.colours.surface,overflow:'hidden'},children:[He.map(e=>(0,Re.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>tt(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Re.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Re.jsxs)(L.default,{style:{flex:1},children:[(0,Re.jsx)(G.T,{weight:"medium",children:e.title}),(0,Re.jsx)(G.Muted,{children:e.sub})]}),(0,Re.jsx)(G.T,{colour:M.colours.muted,children:"\u203a"})]})},e.id)),ot.map(e=>(0,Re.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>tt(Ee,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:M.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Re.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Re.jsxs)(L.default,{style:{flex:1},children:[(0,Re.jsx)(G.T,{weight:"medium",children:e.title}),(0,Re.jsx)(G.Muted,{children:e.sub})]}),(0,Re.jsx)(G.T,{colour:M.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Re.jsx)(G.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Re.jsxs)(G.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Se.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ne&&X?(0,Re.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Re.jsx)(ne.ClockInOut,{}),(0,Re.jsx)(re.MyUpcomingShifts,{staffId:X,team:!0})]}):null,'mypay'===Ne?(0,Re.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Re.jsx)(ae.MyPeriods,{staffId:X}),(0,Re.jsx)(se.MyHoursPay,{staffId:X}),(0,Re.jsx)(oe.MyTips,{staffId:X}),(0,Re.jsx)(G.Card,{children:(0,Re.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ne?(0,Re.jsx)(L.default,{testID:"chef-alerts",children:(0,Re.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ne?(0,Re.jsx)(t.AvatarMaker,{meId:V?.id??z.CHEF_ID,me:n}):null,'reviews'===Ne?(0,Re.jsx)(je.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ne?(0,Re.jsx)(R.BookingHistory,{rid:i,today:qe}):null,'bookings'===Ne?(0,Re.jsx)(I.TodaysBookings,{rid:i,today:qe,by:n,app:"chef"}):null,'specials'===Ne?(0,Re.jsx)(fe.SpecialsEditor,{rid:i,me:n,app:"chef",now:K}):null,'forecast'===Ne?(0,Re.jsx)(q.ChefForecast,{openPrep:()=>tt('kitchen','prep')}):null,'prep'===Ne?(0,Re.jsx)(Q.PrepScreen,{}):null,'live'===Ne?(0,Re.jsx)(Q.TeamScreen,{}):null,'waste'===Ne?(0,Re.jsx)(Q.WasteScreen,{}):null,'recipes'===Ne?(0,Re.jsx)(xe.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ne?(0,Re.jsx)(Q.AllergenScreen,{openCards:()=>tt('kitchen','recipes')}):null,'takings'===Ne&&Pe?(0,Re.jsx)(p.CashUpScreen,{rid:i,today:qe,canEdit:!1,chartsOnly:!0,who:{id:X,name:n.replace(' (example)','')}}):null,'board'===Ne?(0,Re.jsx)(ve.QuestionBoard,{rid:i,today:qe,manager:!1,by:""}):null,'teamtasks'===Ne?(0,Re.jsx)(h.KitchenTeamTasks,{rid:i,actor:V}):null,'orderlists'===Ne?(0,Re.jsx)(C.OrderListsScreen,{rid:i,today:qe,editor:!0,who:{id:X,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ne?at?(0,Re.jsx)(D.TempUnitsSetup,{}):(0,Re.jsx)(G.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ne||'compliance'===Ne||'foodsafety'===Ne?(0,Re.jsx)(ke.HaccpLog,{mode:"chef",me:n,meId:z.CHEF_ID,now:K,rid:i}):null,'accidents'===Ne?(0,Re.jsx)(pe.AccidentBook,{app:"chef",me:n,meId:z.CHEF_ID,now:K,seeAll:!1}):null]}),(0,Re.jsx)(Ie.BottomTabs,{tablist:!0,background:M.colours.surface,active:'orders'===Ee?'kitchen':Ee,onPress:e=>tt(e),tabs:De.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Re.jsx)(Te.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Me(t),tt('orders')):'gp'===e?tt('gp'):tt('kitchen',e)}}),(0,Re.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Re.jsx)(ye.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),fe=_r(_d[67]),be=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]),Ie=_r(_d[79]),Re=_r(_d[80]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const De=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:ge.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],He=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],Ae=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],Be={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function $e({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,z.useChef)(3e4),d=(0,X.useSheetReminders)(),u=(0,z.useWeek)(),{covers:h,label:p,enough:k,booked:f}=(0,z.useForecast)(),b=(0,Y.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,z.isLow)(e.onHand,e.par)),x=b.filter(e=>e.ordersToday&&!e.placedToday),j=(0,V.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,Ce.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,te.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Re.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Re.jsx)(ke.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Re.jsxs)(G.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Re.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Re.jsxs)(G.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Re.jsx)(Z.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Re.jsx)(G.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Re.jsxs)(G.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,z.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,z.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,z.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Re.jsx)(z.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,K.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Re.jsx)(z.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,K.gbp)((0,z.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Re.jsx)(z.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Re.jsx)(z.Tile,{label:"Waste this week",value:t.waste.length?(0,K.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,z.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Re.jsx)(z.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Re.jsx)(z.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${f}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Re.jsx)(z.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Re.jsxs)(G.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Re.jsx)(G.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Re.jsxs)(G.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Re.jsx)(G.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[ge.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Re.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:M.colours.gold,backgroundColor:M.colours.surface},children:(0,Re.jsxs)(G.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Re.jsx)(G.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Re.jsx)(Pe.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},806,[1068,1361,1183,942,1362,1043,1044,1045,2,1058,1047,1048,979,1148,1000,822,944,1394,1395,993,1057,1055,1056,947,1400,1410,1412,1389,31,234,123,264,152,288,128,290,868,948,818,820,825,953,1423,1425,1426,1427,1429,1437,1436,1438,974,1440,1441,1062,945,1063,1065,1064,1458,1041,940,1042,996,866,1066,1432,1067,1460,961,1468,963,1052,841,950,1053,823,1472,941,824,1061,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"IS_OWNER_DESKTOP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"IS_CAR",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"APP_VARIANT",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"ENTRY",{enumerable:!0,get:function(){return l}}),_e.isAllowedPath=function(e,n=f){return!(t.IS_ISOLATED_VENUE&&/^\/(customer|table)(\/|$)/.test(e)&&![`/customer/${t.VENUE_RID}`,`/customer/${t.VENUE_RID}/`].includes(e))&&('/'===e||''===e||_[n].test(e))},_e.canShow=function(e,t=f){return t===e||'owner'===t&&'customer'===e};var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};const u=o.default.expoConfig?.extra?.appVariant??void 0??'owner',c=!1,s=!1,f=['owner','staff','customer','display','chef'].includes(u)?u:'owner',l={owner:'/owner',staff:'/team',customer:`/customer/${t.VENUE_RID}`,display:'/display',chef:'/kitchen'},_={owner:/^\/(owner|customer|table)(\/|$)/,customer:/^\/(customer|table)(\/|$)/,staff:/^\/team(\/|$)/,display:/^\/display(\/|$)/,chef:/^\/kitchen(\/|$)/}},807,[5,409]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PERMISSIONS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"CHEF_SECTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"chefSectionAllowed",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"rotaView",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"chatView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ticketView",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"supplierView",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"auditView",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"CARD_ROLE_APP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"cardCostsVisible",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"ownJobSeesCosts",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"costsAllowedFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ownJobManagesLinks",{enumerable:!0,get:function(){return h}});const e={owner:'all',manager:'all',staff:new Set(['rota-shifts','tickets','eighty-six','allergens']),chef:new Set(['stock','costing','gp','waste','dish-sales','prep','ordering','allergens','compliance','rota-shifts','kitchen-chat','tickets','eighty-six','specials'])},t=(t,n)=>{const a=e[t];return'all'===a||a.has(n)},n={stock:'stock','stock-take':'stock',deliveries:'stock',gp:'gp','price-changes':'gp','gp-week':'gp','menu-engineering':'dish-sales',orders:'ordering',forecast:'prep',prep:'prep',live:'tickets',waste:'waste',allergens:'allergens',compliance:'compliance',haccp:'compliance',accidents:'compliance','new-dish':'gp',specials:'specials',recipes:'allergens','recipe-cards':'allergens'},a=e=>e in n&&t('chef',n[e]),s=(e,n,a)=>t(e,'staff-personal')?{staff:n,shifts:a}:{staff:n.filter(e=>e.active).map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},job:e.job})),shifts:a.filter(e=>e.published).map(({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l})=>({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l}))},c=(e,t)=>'chef'===e?t.filter(e=>'kitchen'===e.ch&&!e.removed):t,l=(e,n)=>t(e,'customer-personal')?n:n.map(({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),f=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text)),u={'head-chef':'chef',manager:'manager',owner:'owner',staff:'staff'},p=(e,n="edit")=>'edit'===n&&t(u[e]??'staff','costing'),b=e=>'owner'===e.role||'manager'===e.role||'Head Chef'===e.level,m=e=>!e||b(e),h=e=>'owner'===e.role||'manager'===e.role},808,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},812,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},813,[31,264,274,128,1403,825,818,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_DWELL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"dwellBands",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"bandLabel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fmtMins",{enumerable:!0,get:function(){return o}}),_e.dwellFor=function(e,t,r=[]){const o=n(e),i=Math.max(0,o.findIndex(e=>t<=e.upTo)),s=o[i]??o[o.length-1];if(!1===e?.settings.dwellLearn)return{mins:s.mins,learned:!1,samples:0};const a=0===i?1:o[i-1].upTo+1,u=r.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt&&e.partySize>=a&&e.partySize<=s.upTo).map(e=>(new Date(e.finishedAt).getTime()-new Date(e.seatedAt).getTime())/6e4).filter(e=>e>=20&&e<=360).sort((e,t)=>e-t);if(u.length<8)return{mins:s.mins,learned:!1,samples:u.length};const l=u[Math.floor(u.length/2)];return{mins:5*Math.round((s.mins+l)/2/5),learned:!0,samples:u.length}},Object.defineProperty(_e,"DAYS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ruleText",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"ANCHORAGE_EVENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"regularEventsOf",{enumerable:!0,get:function(){return l}}),_e.occursOn=m,_e.nextOccurrence=function(e,t){const n=f(t);for(let t=0;t<400;t++){const r=c(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t));if(m(e,r))return r}return null},_e.expandEvents=function(e,t,n,r){const o=[];if(!t.some(e=>e.active))return o;const i=f(n),s=f(r);for(let n=i;n<=s;n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)){const r=c(n);for(const n of t)m(n,r)&&o.push({id:`${n.id}:${r}`,restaurantId:e,date:r,title:n.name,kind:'event',example:!1,source:'regular',description:[n.time?`from ${n.time}`:'',n.lastFood?`last food orders ${n.lastFood}`:'',n.notes??''].filter(Boolean).join(' \xb7 '),busier:n.busier,lastFood:n.lastFood,time:n.time})}return o},_e.lastFoodOn=function(t,n){if(!t)return null;const r=f(n).getDay(),o=t.settings.lastFoodByDay?.[r],s=(0,e.kitchenHoursOn)(t,f(n));let a=s?{time:s[1],reason:'kitchen closes'}:null;o&&(!a||oe?.settings.dwellBands?.length?e.settings.dwellBands:t,r=(e,t)=>{const n=0===t?1:e[t-1].upTo+1,r=e[t].upTo;return r>=9999?`${n} or more covers`:n===r?`${n} cover${1===n?'':'s'}`:`${n}\u2013${r} covers`},o=e=>e%60==0?`${e/60} hour${60===e?'':'s'}`:e>60?`${Math.floor(e/60)} h ${e%60} min`:`${e} min`;const i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],s=['','first','second','third','fourth'],a=e=>'last'===e.kind?`Last ${i[e.weekday]} of every month`:'nth'===e.kind?`${s[e.n][0].toUpperCase()}${s[e.n].slice(1)} ${i[e.weekday]} of every month`:'weekly'===e.kind?`Every ${i[e.weekday]}`:`One-off: ${e.date}`,u=[{id:'ev-music-night',name:'Open Mic Night',rule:{kind:'last',weekday:0},time:'20:00',notes:'Live music from 8pm.',busier:!0,lastFood:'19:00',active:!0}],l=e=>e?.settings.regularEvents??('anchorage'===e?.id?u:[]),d=e=>String(e).padStart(2,'0'),c=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`,f=e=>new Date(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)));function m(e,t){if(!e.active)return!1;const n=e.rule;if('once'===n.kind)return n.date===t;const r=f(t);return r.getDay()===n.weekday&&('weekly'===n.kind||('nth'===n.kind?Math.ceil(r.getDate()/7)===n.n:new Date(r.getFullYear(),r.getMonth(),r.getDate()+7).getMonth()!==r.getMonth()))}const b=e=>e?.settings.afterLastFood??'drinks',p=e=>{const[t,n]=e.split(':').map(Number);return`${t%12||12}${n?`:${d(n)}`:''}${t<12?'am':'pm'}`},y=e=>e?.settings.showTakeaway??'anchorage'!==e?.id,h=e=>!1!==e?.settings.coversCounter,O=e=>!1!==e?.settings.nextTableFree,$=e=>!1!==e?.settings.dogQuestion,w=e=>!1!==e?.settings.dietQuestion,F=e=>!1!==e?.settings.accessQuestion,k=(e,t)=>e?.settings.holidayFullNames?t:t.replace(/\s*\(substitute day\)/gi,'').trim()},814,[833]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},815,[874,31,123,128,25]); +__d(function(_g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.startForm=function(t=Date.now()){return{openedAt:t,hp:''}},e.guardFor=function(t,n=Date.now()){return{hp:t.hp,formMs:Math.max(0,Math.round(n-t.openedAt))}},e.rememberGuard=function(n,o){t.set(n,o)},e.takeGuard=function(n){const o=t.get(n);return o?(t.delete(n),o):{}};const t=new Map},816,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedFields=W,_e.historyText=D,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=W(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:D(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${A(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!W(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return E}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: 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.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],h=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],u=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],w=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),k=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return k(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){const i=y(e);return l.filter(e=>M(e,i)!==M(e,t))}const j=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,A=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function D(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${j(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${j(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${j(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${h.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=w(o.holds),i=w(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${A(s)}`}const E=e=>e.map(e=>f[e]).join(', ')},817,[832,1403,1401,960]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return A}}),_e.BrandBar=z,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,B.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,B.jsx)(v,{}):null]});return(0,B.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,B.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,B.jsx)(z,{title:t,subtitle:r,back:o,right:l})}),c?(0,B.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,B.jsx)(p.default,{style:{flex:1},children:u}),s?(0,B.jsx)(p.default,{style:N.footer,children:(0,B.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=F,_e.Card=H,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,B.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:D?'center':'flex-start'}],children:(0,B.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=E,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return $}}),_e.Row=O,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return _}}),_e.Field=function({label:e,...t}){return(0,B.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,B.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,B.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t,style:[N.input,t.multiline&&{minHeight:70,textAlignVertical:'top'},t.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,B.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,B.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,B.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,B.jsxs)(O,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,B.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,B.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,B.jsxs)(O,{gap:10,children:[(0,B.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,B.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,B.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,B.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,B.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,B.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w}){const{height:W}=(0,x.default)(),k=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},S=(0,r.useTyping)(),I=(0,r.useVisibleArea)(),D=S&&I&&I.height({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,B.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,R?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,B.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,B.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,B.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,B.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,B.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]);const R=['kirkton','abbotsford'].includes(k.VENUE_RID),D='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(D&&('semibold'===l||'bold'===l)&&!j);return(0,B.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,B.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,B.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),A=e=>(0,B.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??D});function z({title:e,back:t=!0,right:r,subtitle:o}){return(0,B.jsxs)(p.default,{style:N.brandBar,children:[(0,B.jsxs)(p.default,{style:N.row,children:[(0,B.jsx)(p.default,{style:N.brandSide,children:t?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,B.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,B.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,B.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,B.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,B.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,B.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,B.jsx)(A,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function v(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,B.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,B.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function F({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,B.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,B.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,B.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function H({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,B.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,B.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function E({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,B.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,B.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,B.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}A.statusLine=!0,F.centreRow=!0;const V=({phone:e})=>(0,B.jsx)(E,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),$=()=>(0,B.jsx)(E,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function O({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===H?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(D&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,B.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=D&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,B.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const _=()=>(0,B.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},818,[1147,835,1320,874,805,881,31,240,257,123,264,152,47,272,128,288,290,825,1318,1321,5,807,868,25]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ALLERGENS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"allergenLabel",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEVERITIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"severityLabel",{enumerable:!0,get:function(){return s}}),e.effectiveAllergens=function(l,n=[]){const t={...l.allergens};for(const s of l.optionGroups??[])for(const l of s.choices)if(n.includes(l.id)&&l.allergens)for(const[n,s]of Object.entries(l.allergens))'contains'!==t[n]&&(t[n]=s);return t},e.conflictsFor=function(l,n){const t=[],s=[];for(const a of n)'contains'===l[a.allergen]?t.push(a.allergen):'may'===l[a.allergen]&&s.push(a.allergen);return{contains:t,may:s}},Object.defineProperty(e,"hasConflict",{enumerable:!0,get:function(){return a}});const l=[{id:'gluten',label:'Cereals containing gluten',short:'Gluten'},{id:'crustaceans',label:'Crustaceans',short:'Crustaceans'},{id:'molluscs',label:'Molluscs',short:'Molluscs'},{id:'eggs',label:'Eggs',short:'Eggs'},{id:'fish',label:'Fish',short:'Fish'},{id:'peanuts',label:'Peanuts',short:'Peanuts'},{id:'treenuts',label:'Tree nuts',short:'Tree nuts'},{id:'soya',label:'Soya',short:'Soya'},{id:'milk',label:'Milk',short:'Milk'},{id:'celery',label:'Celery',short:'Celery'},{id:'mustard',label:'Mustard',short:'Mustard'},{id:'sesame',label:'Sesame',short:'Sesame'},{id:'sulphites',label:'Sulphur dioxide / sulphites',short:'Sulphites'},{id:'lupin',label:'Lupin',short:'Lupin'}],n=n=>l.find(l=>l.id===n)?.short??n,t=[{id:'intolerance',label:'Intolerance'},{id:'allergy',label:'Allergy'},{id:'coeliac',label:'Coeliac disease'},{id:'anaphylaxis',label:'Severe \u2014 anaphylaxis risk'}],s=l=>t.find(n=>n.id===l)?.label??l;const a=l=>l.contains.length>0||l.may.length>0},819,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"gbp",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return n}});const t=t=>`\xa3${(t/100).toFixed(2)}`,n=t=>Math.round(100*t)},820,[]); +__d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSlotMinutesOf=s,e.bookingNoticeMinsOf=r,e.bookingCoversPerStartOf=u,e.bookingPartiesPerStartOf=l,e.onlinePartyBounds=c,Object.defineProperty(e,"COVERS_WINDOW_MINS",{enumerable:!0,get:function(){return f}}),e.coversInHalfHour=m,e.countInStartSlot=p,e.bookingLimitsHint=function(t){const n=s(t),o=u(t),f=l(t),m=r(t),p=c(t);if(null!=o||null!=f){const t=[];return null!=o&&null!=f?t.push(`up to ${o} people and ${f} bookings at each start time`):null!=o?t.push(`up to ${o} people at each start time`):t.push(`up to ${f} bookings at each start time`),(p.max<100||p.min>1)&&t.push(`parties of ${p.min} to ${p.max}`),t.push(`from ${m} minutes ahead`),t.push('table rules still apply'),`Times are every ${n} minutes: ${t.join(', ')}.`}return`Times are every ${n} minutes. Covers per slot (${t.settings.bookingCoversPerSlot} per half hour) and table rules still apply.`},e.takeawaySlots=function(o,s,r){const u=(0,t.hoursFor)(o,r);if(!u)return[];const l=o.settings.slotMinutes,c=(0,n.addMins)(r,o.settings.leadMins),f=[];for(let t=new Date(u.open);t<=u.close;t=(0,n.addMins)(t,l)){if(tn.restaurantId===o.id&&'takeaway'===n.type&&'cancelled'!==n.status&&n.slotTime&&new Date(n.slotTime).getTime()===t.getTime()).length;f.push({time:new Date(t),label:(0,n.hm)(t),taken:r,cap:o.settings.slotCap,full:r>=o.settings.slotCap})}return f},e.bookingSlots=function(c,f,d,h,k,M=()=>0){const y=(0,t.hoursFor)(c,f);if(!y)return[];const S=[],$=y.close,P=(0,o.lastFoodOn)(c,b(f)),v=P?(0,n.atTime)(f,P.time):$,I='drinks'===(0,o.afterLastFood)(c),O=s(c),C=r(c),N=u(c),T=l(c);for(let t=new Date(y.open);t<=$;t=(0,n.addMins)(t,O)){const o=(0,n.hm)(t),s=t>v;if(s&&!I)continue;const r=null!=N?p(d,o,O):m(d,o),u=(N??c.settings.bookingCoversPerSlot)-r,l=null!=T?p(M,o,O):0,f=null!=T?T-l:void 0,b=t.getTime()=1;S.push({time:o,left:u,available:!b&&u>=h&&y,past:b,...s?{drinksOnly:!0}:{},...null!=f?{partiesLeft:f,partiesCap:T}:{}})}return S};var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]);function s(t){const n=t.settings.bookingSlotMinutes;return 5===n||10===n||15===n||20===n||30===n?n:15}function r(t){const n=t.settings.bookingNoticeMins;return'number'==typeof n&&Number.isInteger(n)&&n>=0&&n<=1440?n:30}function u(t){const n=t.settings.bookingCoversPerStart;return'number'==typeof n&&Number.isInteger(n)&&n>0&&n<=200?n:null}function l(t){const n=t.settings.bookingPartiesPerStart;return'number'==typeof n&&Number.isInteger(n)&&n>0&&n<=50?n:null}function c(t){const n=t.settings.onlinePartyMin,o=t.settings.onlinePartyMax,s='number'==typeof n&&Number.isInteger(n)&&n>=1&&n<=100?n:1;return{min:s,max:'number'==typeof o&&Number.isInteger(o)&&o>=s&&o<=100?o:100}}const f=30;function m(t,o){const s=Math.floor((0,n.toMins)(o)/f)*f;let r=0;for(let o=0;o`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},821,[833,822,814]); +__d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"pad",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return n}}),e.venueYmd=function(t,u="Europe/London"){try{const n=new Intl.DateTimeFormat('en-CA',{timeZone:u,year:'numeric',month:'2-digit',day:'2-digit'}).format(t);if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n}catch{}return n(t)},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseYmd",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toMins",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fromMins",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"atTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"addMins",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"dayShort",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"dayLong",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"monthLong",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"niceDate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"niceDateYear",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"minsBetween",{enumerable:!0,get:function(){return P}});const t=t=>String(t).padStart(2,'0'),n=n=>`${n.getFullYear()}-${t(n.getMonth()+1)}-${t(n.getDate())}`;const u=n=>`${t(n.getHours())}:${t(n.getMinutes())}`,a=t=>{const[n,u,a]=t.split('-').map(Number);return new Date(n,u-1,a)},o=t=>{const[n,u]=t.split(':').map(Number);return 60*n+u},c=n=>`${t(Math.floor(n/60))}:${t(n%60)}`,d=(t,n)=>{const u=new Date(t);return u.setHours(0,0,0,0),u.setMinutes(o(n)),u},m=(t,n)=>new Date(t.getTime()+6e4*n),b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],y=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],f=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],l=['January','February','March','April','May','June','July','August','September','October','November','December'],p=t=>b[t.getDay()],s=t=>y[t.getDay()],O=t=>l[t],M=t=>`${b[t.getDay()]} ${t.getDate()} ${f[t.getMonth()]}`,j=t=>`${M(t)} ${t.getFullYear()}`,P=(t,n)=>Math.round((n.getTime()-t.getTime())/6e4)},822,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"repo",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=t.localRepositories},823,[1322,1082]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return Q.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return Q.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return Q.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return Q.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return Q.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return et}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ct}}),i.rotaReconcile=Dt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();de.useOwner.getState().chatMarkRead(e,{[t]:a});const s=de.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>de.useOwner.getState().chatSeen(t,e)),Qt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await De().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(de.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await De().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(de.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await De().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return de.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...vt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(me.PITCH)return Se.unlockCashUp(e,t,a);const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await De().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?le.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):le.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})),{ok:!0,until:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.readCashAudit=async function(e){if(me.PITCH)return Se.cashAudit(e);const t=Ue.getState().venueId;if(!t)return[];let a=De().from('cash_up_audit').select('at, action, changed_by_name, tbl, for_date, reason, old_row, new_row').eq('venue_id',t).order('at',{ascending:!1}).limit(50);e&&(a=a.eq('row_id',e));const{data:s,error:n}=await a;return n||!Array.isArray(s)?[]:s.map(e=>({at:String(e.at),action:String(e.action),by:String(e.changed_by_name??'\u2014'),tbl:String(e.tbl),forDate:e.for_date??void 0,reason:e.reason??void 0,changed:(0,A.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=Ue.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await De().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(ya.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=_a,i.readAccessLog=async function(){const e=Ue.getState().venueId;if(!e)return[];try{const{data:t}=await De().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ue.getState().venueId;if(!e)return[];const{data:t,error:a}=await De().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await De().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=ha.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await De().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return ha.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await De().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return ya}}),i.claimInvite=Na,i.makeChromeHandover=async function(){const e=Ue.getState();if(me.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await De().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Ke});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(me.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await De().rpc('claim_chrome_handover',{p_code:e,p_app:Ke});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),Le&&ja(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(me.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{Me();const{data:t,error:a}=await De().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(me.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await De().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),Le&&ja(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{Me(),await De().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Aa)}catch{}},i.signedInHereAs=async function(e){Me();const t=await L.kv.get(Aa,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return Me(),await L.kv.get(Ca,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ue.getState();if(!u.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==u.VENUE_UUID||e.staffRef!==C.useSession.getState().meId)return null;Me();const t=await L.kv.get(Ca,null);return t?(0,C.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ue.getState();if(!u.IS_WILDINGS||'staff'!==e.kind||e.venueId!==u.VENUE_UUID||e.staffRef!==C.useSession.getState().meId)return null;Me();const t=await L.kv.get(Ca,null);return t?(0,C.appUrl)('staff',t):null},i.forgetSignInHere=async function(){Me(),await L.kv.remove(Aa),await L.kv.remove(Ca),Ee({mode:'signin',perms:[]});try{await Ba()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ue.getState().venueId;if(me.PITCH||!s||'staff'!==Ue.getState().kind)return{ok:!0};if(!(0,ue.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await qa('approve_shift_swap',{p_venue:s,p_shift:e,p_to_ref:t,p_kind:a}),{ok:!0}}catch(e){return{ok:!1,message:String(e?.message??e).replace(/^.*?:\s*/,'')||'Not allowed'}}},i.claimInviteForSync=async function(e){const t=await Na(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(me.PITCH)return Se.reissueInvite(e);const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await De().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.currentStaffAppLinks=async function(e){const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return qa('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return qa('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return qa('staff_app_link_history',{p_venue:Ue.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await qa('revoke_staff_app_link',{p_venue:Ue.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(me.PITCH)return Se.linkPhones();const e=Ue.getState().venueId;if(!e||'staff'!==Ue.getState().kind)return{};try{const t=await qa('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(me.PITCH)return Se.resetPhone(e);const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return Number(await qa('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(me.PITCH)return Se.inviteStatus();const e=Ue.getState().venueId;if(!e)return{};const{data:t,error:a}=await De().rpc('invite_status',{p_venue:e});if(a||!Array.isArray(t))return{};const s={};for(const e of t)s[String(e.staff_ref)]={state:e.state,expiresAt:e.expires_at??void 0,usedAt:e.used_at??void 0,devices:Number(e.devices??0)};return s},i.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Ta();const{data:t,error:a}=await De().rpc(u.IS_QUEUED_VENUE?'claim_'+u.VENUE_RID+'_pairing_code':u.IS_GREENSIDE?'claim_greenside_pairing_code':u.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':u.IS_KIRKTON?'claim_kirkton_pairing_code':u.IS_WILDINGS?'claim_wildings_pairing_code':u.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':u.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)return{ok:!1,error:'That code was not accepted. It may have expired. Ask a manager for a new one.'};const n={kind:'device',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await L.kv.set(Oa,n),ja(),{ok:!0,venueName:s.venue_name}}catch(e){const t=String(e?.message??e);return/fetch|network/i.test(t)?{ok:!1,error:'No connection. Check the tablet\u2019s Wi-Fi and try again.'}:/rate|too many/i.test(t)?{ok:!1,error:'Too many tries from this network. Wait a little and try again.'}:{ok:!1,error:/valid|switched off/i.test(t)?t:`Couldn\u2019t pair: ${t}`}}},i.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Ta();const{data:e,error:t}=await De().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ka,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:Pa(e)}}},i.carPairPoll=async function(e){try{Me();const t=e??await L.kv.get(Ka,null);if(!t)return'unknown';const{data:a,error:s}=await De().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,Y.carPairApproved)(n)){const e=(0,Y.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Oa,null);await L.kv.set(Oa,e),await L.kv.remove(Aa),C.useSession.getState().meId&&C.useSession.getState().signOut(),de.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||ja()}return'revoked'!==i&&'unknown'!==i||await Ma(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{Me(),await De().rpc('car_sign_out')}catch{}await Ma(),await Ba();try{await De().auth.signOut({scope:'local'})}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await qa('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:Pa(e)}}},i.carList=async function(){const e=Ue.getState().venueId;if(!e)return[];return(await qa('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=Ue.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await qa('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:Pa(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Oa),await Ba();try{await De().auth.signOut()}catch{}Ee({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Aa),await L.kv.remove(Ca),await Ba();try{await De().auth.signOut()}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'Disconnected. Open your personal invite link to connect again.'})},i.wipeThisDevice=async function(e={}){try{await Ba()}catch{}try{(0,K.isSupabaseConfigured)()&&await De().auth.signOut({scope:'local'})}catch{}let t=0;try{const e='undefined'!=typeof navigator?navigator:null,t=await(e?.serviceWorker?.getRegistration?.()),a=await(t?.pushManager?.getSubscription?.());a&&await a.unsubscribe()}catch{}for(const e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${u.VENUE_RID}:`)):(0,O.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!u.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This device has been wiped.'}),!1!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=xa,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return qa}}),i.mendSession=Fa,i.startAppSync=async function(e=u.VENUE_RID){if(u.IS_ISOLATED_VENUE&&e!==u.VENUE_RID)return;if(Le)return;Le=!0,$a=e,'customer'===Ke&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(Me(),'customer'!==Ke){const t=e=>new Promise(t=>{try{if(!e?.persist||e.persist.hasHydrated())return t();const a=e.persist.onFinishHydration(()=>{a?.(),t()});setTimeout(t,3e3)}catch{t()}}),a='chef'===Ke&&(0,w.isAnchorage)(e)?[z.useStore,de.useOwner,re.useKitchen,oe.useSafety,ae.useCardStore,S.useGpCalc,se.useOrderSheets,y.useSpecials,D.useHr]:[z.useStore,de.useOwner,re.useKitchen];if(await Promise.all(a.map(t)),'chef'===Ke&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ee({mode:'offline',message:'Saved kitchen data could not be backed up. Nothing was cleared. Free some device storage, then reopen.',lastError:'Legacy kitchen archive not ready'});try{await Cs(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ee({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ee({mode:'off'});$.mutationQueue.subscribe(()=>{const e=$.mutationQueue.waiting,t=e[0];Ee({pending:$.mutationQueue.pending.length,failed:$.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,j.describeWrite)(t)}: ${(0,j.plainReason)({...t.lastErr},'retry')}`:void 0})}),$.mutationQueue.onFailed(e=>Ee({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:$.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,j.describeWrite)(e),why:'conflict'===e.reason?(0,j.plainReason)({code:'conflict'},'refused'):(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),qe.push((0,P.onConnectivity)(e=>Ee({mode:e?Ue.getState().venueId?'live':Ue.getState().mode:Ue.getState().venueId?'offline':Ue.getState().mode}))),await Wa()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return Ga}}),i.serverOrder=es,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ts}}),i.nudgeGuestSync=function(){as?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return ss}}),i.stockSaveBlocker=ns,i.stockEventStatus=function(e){if(et(e))return{state:'saved'};const t=$.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,j.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=is,i.saveStockEventsNow=rs,i.bookingSaveBlocker=ds,i.resendUnsavedBookings=ls,i.saveBookingsNow=fs,i.waitForBookingSave=function(e,t=12e3){if(!Ne())return Promise.resolve({state:'local'});const a=ds();if(a)return Promise.resolve({state:'refused',why:a});const s=us()[0]?.venueId??'',n=()=>os.some(t=>$.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,P.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push($.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push($.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||us().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||us().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=Ss,i.tempLogState=function(){const e=hs()[0]?.venueId??'',t=hs().find(e=>'temp_readings'===e.spec.table),a=$.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!$.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(H.useTempSaves.getState().notSaved),i=oe.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ys,i.waitForTempSave=function(e,t,a=1e4){if(!Ne()||!hs().length)return Promise.resolve({state:'local'});const s=Ss(e);if(s)return Promise.resolve({state:'refused',why:s});const n=hs()[0]?.venueId??'',i=hs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>H.useTempSaves.getState().notSaved[(0,H.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>$.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=ks,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Ls}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=qs.get(a);if('customer'!==Ke||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():qs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),qa('public_day',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:Fe(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:Fe(a.from_time),to:Fe(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),qs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Ls.setState(e=>({n:e.n+1}))}).catch(()=>{const e=qs.get(a);e&&!e.ok&&qs.delete(a)}));const n=qs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ue.getState().venueId;if(!n||'staff'!==Ue.getState().kind)throw new Error('Connect to your venue first.');const i=await qa('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ue.getState().venueId;if(!e||'staff'!==Ue.getState().kind)return null;return(await qa('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');await qa('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),S=t(r[10]),h=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),K=t(r[27]),P=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),L=t(r[32]),B=t(r[33]),j=t(r[34]),F=t(r[35]),$=t(r[36]),W=t(r[37]),H=t(r[38]),Q=t(r[39]),V=t(r[40]),G=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),Se=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(a){if('default'!==a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,t})(_e),he=t(r[64]),ye=t(r[65]),we=t(r[66]),ve=t(r[67]),be=t(r[68]),ke=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]);const De=()=>(0,N.getSupabase)();$.mutationQueue.setExecutor(B.executeMutation),(0,x.setClockServer)(()=>'staff'===Ue.getState().kind);const Ue=(0,T.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ee=e=>Ue.setState(e),Te=e=>{const t=Ue.getState().perms;return t.includes('*')||t.includes(e)},Ne=()=>{const e=Ue.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ue.subscribe(()=>(0,Re.setLiveData)(Ne()));let Ke=Z.IS_CAR?'car':Z.APP_VARIANT,Pe=!1;const Me=()=>{Pe||((0,L.setSyncNamespace)(Ke),Pe=!0)};let xe=[],qe=[],Le=!1;const Be=()=>(new Date).toISOString().slice(0,10),je=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),Fe=e=>e?e.slice(0,5):'',$e=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],We=e=>JSON.parse(JSON.stringify(e));function He(e,t){const a=je(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write')),filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=We(e);if(t)return{id:e.id,venue_id:a,walk_date:e.date,arrived_at:e.seatedAt??e.createdAt,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:$e(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,ue.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:$e(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Qe(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>'guest'!==Ue.getState().kind,filter:e=>e.gte('created_at',t),inWindow:e=>e.createdAt>=t,toRow:(e,t)=>({id:e.id,venue_id:t,ref:e.ref,customer_id:(0,ue.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:We(e.lines??[]),allergies:$e(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:We(e.allergyChain??{}),readiness:We(e.readiness??{}),allergy_ticks:We(e.allergyTicks??{}),handover_check:e.handoverCheck?We(e.handoverCheck):null,accepted:e.accepted?We(e.accepted):null,doc:We(e)}),fromRow:t=>t.doc&&'object'==typeof t.doc?{...t.doc,id:String(t.id),restaurantId:e,status:t.status??t.doc.status}:null,apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Ve(e){const t=je(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...X.useBlocks.getState().blocks,...X.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==Ue.getState().kind,filter:e=>e.gte('block_date',t),inWindow:e=>e.date>=t,toRow:(e,t)=>({id:e.id,venue_id:t,block_date:e.date,from_time:e.from,to_time:e.to,reason:e.reason??null,note:e.note??null,area_id:e.areaId??null,area_name:e.areaName??null,created_by:e.by,created_at:e.createdAt,doc:We(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,X.blockClock)(t.from_time)??a?.from,n=(0,X.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>X.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>X.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ge=null,Je='Main plan';function ze(e){const t=e=>We({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ee.useFloor.getState().plans[e]??(0,ee.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Te('floor.manage')||Te('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ge??(0,Oe.uuidFrom)(`plan:${a}`),venue_id:a,name:Je||'Main plan',is_active:!0,...t(e),updated_by:(0,Y.actorStamp)({isCar:Z.IS_CAR,kind:Ue.getState().kind,staffRef:Ue.getState().staffRef,fallback:Ke})}),fromRow:e=>(Ge=String(e.id),Je=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,Ae.withSeedBest)(e,t[0]):void 0;a&&ee.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ee.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Ze(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>te.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Te('stock.manage'),matchKey:e=>({key:e}),toRow:(e,t)=>({venue_id:t,key:e.key,name:e.name,plural:e.plural,unit:e.unit,low_at:e.lowAt,supplier_id:e.supplierId?(0,ue.isUuid)(e.supplierId)?e.supplierId:(0,Oe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),fromRow:e=>{return{key:e.key,name:e.name,plural:e.plural,unit:e.unit,lowAt:Number(e.low_at),icon:e.icon??'\u2022',sort:e.sort??0,active:!1!==e.active,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),lt.get(t)??t)}:{}};var t},apply:(t,a)=>te.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.get(e.key)??e),o=new Set(r.map(e=>e.key));return{items:{...s.items,[e]:[...r,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>te.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Ye=new Set,Xe=new Set;$.mutationQueue.onDone(e=>{'stock_events'===e.table&&Xe.add(e.rowKey)});const et=e=>Xe.has(e)||Ye.has(e),tt=()=>Te('*')||Te('staff.manage')||Te('recipes.edit')||Te('recipes.signoff'),at=()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write'));function st(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>te.useShellStore.getState().events.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,ue.isUuid)(t.id)&&!!(te.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write')),filter:e=>e.gte('at',t).order('at',{ascending:!1}),inWindow:e=>e.at>=t,toRow:(e,t)=>({id:e.id,venue_id:t,item:e.kind,delta:e.delta,reason:e.reason,undoes:e.undoes&&(0,ue.isUuid)(e.undoes)&&(et(e.undoes)||$.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Ye.add(String(t.id)),{id:String(t.id),rid:e,kind:t.item,delta:Number(t.delta),reason:t.reason,by:t.by_name??'',app:t.app??'',at:new Date(t.at).toISOString(),...t.undoes?{undoes:String(t.undoes)}:{}}),apply:(e,t)=>te.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>te.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function nt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(te.useShellStore.getState().server[e]?.counts??{}).map(([e,t])=>({item:e,quantity:t})),key:e=>e.item,rowKey:e=>String(e.item),syncable:()=>!1,writable:()=>!1,toRow:()=>({}),fromRow:e=>({item:String(e.item),quantity:Number(e.quantity)}),apply:(a,s)=>{t={...te.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;te.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Ye]}}}))},afterRead:()=>{te.useShellStore.getState().server[e]||te.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Ye]}}}))},subscribe:()=>()=>{}}}const it=new Set;function rt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ae.useCardStore.getState().cards.filter(t=>t.restaurantId===e).map(e=>({card:e,item:t.find(t=>t.id===e.menuItemId)}))},key:e=>e.card.id,rowKey:e=>String(e.id),syncable:t=>(0,ue.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Te('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Oe.photoPath)(a,s),t=ot(s.photo);t&&((0,ae.cachePhotoAs)(e,t),dt(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Oe.cardToRow)(s,a);return{...i,...r,doc:We({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(a.card))return null;const s=t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:new Date(t.signed_off_at).toISOString()}:null;return{card:{...a.card,id:String(t.id),restaurantId:e,signOff:s&&a.card.signOff?a.card.signOff:s,...t.photo_url?{photo:t.photo_url}:{}},item:a.item?{...a.item,restaurantId:e,signOff:(0,w.isAnchorage)(e)&&(0,w.demoActor)(a.item.signOff?.by)?null:a.item.signOff}:void 0}},supersededBy:(e,t)=>t.some(t=>t.card.menuItemId===e.card.menuItemId&&t.card.id!==e.card.id),apply:(e,t)=>{if(!Te('recipes.edit')&&t.length){const e=new Set(t);ae.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ae.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),r=t.cards.filter(e=>!a.has(e.id)&&(s.has(e.id)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=ae.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ot=e=>(0,ae.readLocalPhoto)(e);async function dt(e,t){if(!it.has(e)){it.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await De().storage.from(Oe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){it.delete(e),Ee({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const ut=new Map,ct=(0,T.create)(()=>({n:0}));(0,ae.setStoragePhotoResolver)(e=>{const t=ut.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ue.getState().mode?(t||(ut.set(e,{url:'',at:Date.now()}),De().storage.from(Oe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(ut.set(e,{url:t.signedUrl,at:Date.now()}),ct.setState(e=>({n:e.n+1})),ae.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const lt=new Map;const ft=(e,t)=>{const a=(0,ue.isUuid)(t)?t:(0,Oe.uuidFrom)(`sup:${e}:${t}`);return lt.set(a,t),a};function pt(e){return{name:'order_sheets',table:'suppliers',list:()=>se.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Te('suppliers.manage'),toRow:(e,t)=>({id:ft(t,e.id),venue_id:t,name:e.name||'Supplier',category:e.goods||null,contact:e.contact??null,phones:e.number?[e.number]:[],website:e.url||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,notes:e.notes||null,doc:{kind:'sheet',localId:e.id,sheet:We(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(lt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>se.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.get(e.id)??e),o=new Set(r.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...r,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>se.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,ue.isUuid)(e)?e:(0,Oe.uuidFrom)(`sup:${Ue.getState().venueId}:${e}`)})}}let gt=!1,mt=!1;const _t=new Map,St=new Map,ht=new Map,yt=new Map,wt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',vt=e=>'owner'===e?{role:'owner',level:'Owner'}:'manager'===e?{role:'manager',level:'Manager'}:'supervisor'===e?{role:'manager',level:'Supervisor'}:'head_chef'===e?{role:'staff',level:'Head Chef'}:{role:'staff',level:'Staff'},bt=(e,t)=>({...e,managerAccess:t}),kt=()=>({nickname:gt,display:mt}),It=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=bt({role:e.role,level:e.level??vt(wt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},kt())};const Rt=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ot=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},At=e=>{const t=de.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,c.isKitchenTeam)(t)},Ct=2e3;function Dt(e,t){return t||!e.length||e.length>=Ct?null:e=>(0,ue.isUuid)(e.id)}function Ut(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Dt(t,Te('rota.manage')):null,keepOnEmpty:()=>e&&!Te('rota.manage'),list:()=>de.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&_t.has(e.staffId)&&(Te('rota.manage')||At(e.staffId)),writable:()=>Te('rota.manage')||Te('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(Rt());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ot(e.start),end_time:Ot(e.end),published:!!e.published,doc:We(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Et(){const e=je(62),t=e=>Te('rota.manage')||e.staffId===Ue.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>de.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ue.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=je(2)&&e.staffId===Ue.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:We(e.breaks??[]),break_mins:e.breakMins??0,doc:We((0,v.privateAttendance)(u.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(u.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Tt(){const e=je(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>de.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&e.staffId===Ue.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ue.getState().kind,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,ue.isUuid)(e.attendanceId)?e.attendanceId:null,kind:e.kind,suggested_in:e.suggestedIn??null,suggested_out:e.suggestedOut??null,note:(e.note??'').slice(0,300)||null,status:'open',doc:We({...e,status:'open'})}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),date:String(e.work_date).slice(0,10),attendanceId:e.attendance_id?String(e.attendance_id):t.attendanceId,kind:e.kind,suggestedIn:e.suggested_in?new Date(e.suggested_in).toISOString():void 0,suggestedOut:e.suggested_out?new Date(e.suggested_out).toISOString():void 0,note:e.note??'',at:t.at??new Date(e.created_at).toISOString(),status:e.status,resolvedBy:e.resolved_by_name??void 0,resolvedAt:e.resolved_at?new Date(e.resolved_at).toISOString():void 0}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Nt(e){de.leaveRemote.decide=t=>!(!Te('rota.manage')||!(0,ue.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&($.mutationQueue.enqueue({table:'staff_leave',venueId:e,kind:'rpc',fn:'staff_leave_decide',rowKey:t.id,values:{p_id:t.id,p_status:t.status}}),!0),qe.push(()=>{de.leaveRemote.decide=null})}function Kt(e){de.timesheetRemote.send=(t,a)=>{if(!Te('rota.manage')||!(0,ue.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return $.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:We(s)}}),!0}const s=a;if('attendance_void'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&($.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:We(s.breaks??[]),p_reason:n,p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0},qe.push(()=>{de.timesheetRemote.send=null})}function Pt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('created_at',new Date(Date.now()-2592e6).toISOString()),inWindow:()=>!1,toRow:(e,t)=>{return{id:(a=e.id,(0,ue.isUuid)(a)?a:(0,Oe.uuidFrom)(`outbox:${a}`)),local_id:e.id,venue_id:t,channel:e.channel,kind:e.kind,to_address:e.to||'',to_name:e.toName||null,subject:e.subject??null,body:e.body,html:e.html??null,ref_type:e.refType,ref_id:(0,ue.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:We(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.useStore.setState(t=>{const a=new Set(t.outbox.map(e=>e.id));return{outbox:[...e.filter(e=>!a.has(e.id)),...t.outbox].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,300)}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const Mt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function xt(e,t){if(!Array.isArray(t))return;const a=t.filter(e=>e&&'string'==typeof e.id&&'string'==typeof e.date&&'string'==typeof e.title).map(t=>({...t,restaurantId:e,example:!1}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function qt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[We({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ee.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:Mt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Te('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...Bt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...Bt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...Bt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Lt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Lt=t.feature_flags??{},Bt=t.settings??{};const a=t.settings?.app?.restaurant;if(!a)return null;const s='string'==typeof t.settings?.whatsapp?t.settings.whatsapp:void 0;return s&&!a.settings?.whatsapp&&(a.settings={...a.settings,whatsapp:s}),We({restaurant:{...a,id:e},msgTemplates:t.settings?.ops?.msgTemplates??{},display:t.settings?.ops?.display??{},games:!1!==t.feature_flags?.games,...Array.isArray(t.settings?.app?.events)?{events:t.settings.app.events}:{}})},apply:t=>{const a=t[0];a&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,p.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&ee.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&xt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ee.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Lt=null,Bt=null;const jt=()=>new Date(Date.now()-2592e6).toISOString(),Ft=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>_t.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},$t=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,ve.dmId)(t[0],t[1]):null},Wt=()=>Ue.getState().perms.includes('*');function Ht(){const e=()=>Ue.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>de.useOwner.getState().chat.filter(e=>(0,ue.isUuid)(e.id)).map(e=>We({id:e.id,ch:e.ch,from:e.from,text:e.text,photo:e.photo,at:e.at,removed:!!e.removed})),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>!!Ft(t.ch)&&(t.from===e()||Wt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('created_at',jt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=jt(),toRow:(e,t)=>{const a=Ft(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:_t.get(e.from)??null;return{id:e.id,venue_id:t,channel:a,from_staff:s,body:e.text??null,photo:e.photo??null,removed:e.removed,created_at:e.at}},fromRow:e=>{const t=$t(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?We({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>de.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=$t(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=de.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,ve.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,be.soundAllowed)())try{(0,be.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Qt(e,t,a){const s=Ue.getState();if(!we.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=_t.get(e),i='*'===t?'*':Ft(t);if(n&&i)try{await De().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Vt(e){const t=Ue.getState().staffRef,a=t?_t.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await De().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':$t(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&de.useOwner.getState().chatMarkRead(t,i)}catch{}}function Gt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=U.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:We(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:We(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'break_rules'===e.kind?'break_rules':'reminder',doc:e.doc??{}}),apply:(t,a)=>U.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[e];const o=new Map(t.filter(e=>'reminder'===e.kind).map(t=>[t.id,{...t.doc,id:t.id,rid:e}])),d=s.reminders.filter(e=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>U.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function Jt(e){const t=je(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>U.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.reminderId)&&e.staffRef===Ue.getState().staffRef,writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('for_date',t).order('done_at',{ascending:!1}),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,reminder_id:e.reminderId,for_date:e.forDate,staff_ref:e.staffRef,staff_name:e.staffName.slice(0,80),done_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,reminderId:String(t.reminder_id),forDate:String(t.for_date).slice(0,10),staffRef:t.staff_ref??'',staffName:t.staff_name??'Team',at:new Date(t.done_at).toISOString()}),apply:(e,t)=>U.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>U.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function zt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Zt=e=>null==e||''===e?null:Number(e),Yt=e=>e.filter(e=>!e.startsWith('data:')),Xt=()=>Te('takings.view');function ea(e){const t=!Xt();return{name:'cash_ups',table:'cash_ups',list:()=>le.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,k.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,k.tradingDay)()&&!e.onServer),writable:()=>Te('wages.manage')||(0,b.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,k.tradingDay)()):e.gte('for_date',je(400)),...t?{inWindow:e=>e.date===(0,k.tradingDay)()}:{},toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:We(e.vals),cash_tips:'number'==typeof e.vals.cashTips?e.vals.cashTips:null,card_tips:'number'==typeof e.vals.cardTips?e.vals.cardTips:null,photos:Yt(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,date:String(t.for_date),vals:t.vals??{},photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>le.useCashUp.setState(s=>({cashUps:zt(s.cashUps,t.map(e=>{const t=s.cashUps.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function ta(e){return{name:'sales_reports',table:'sales_reports',list:()=>le.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Te('wages.manage')||(0,b.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:We(e.vals),categories:e.categories,photos:Yt(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,weekStart:String(t.week_start),vals:t.vals??{},categories:t.categories??[],photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>le.useCashUp.setState(s=>({sales:zt(s.sales,t.map(e=>{const t=s.sales.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function aa(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=le.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,le.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Te('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:We({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,le.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>le.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function sa(e){return{name:'day_tips',table:'day_tips',list:()=>le.useCashUp.getState().tips.filter(t=>t.rid===e).map(e=>({...e,id:e.date})),key:e=>e.id,rowKey:e=>String(e.for_date),syncable:()=>!1,writable:()=>!1,deletes:!1,filter:e=>e.gte('for_date',je(120)),toRow:()=>({}),fromRow:t=>({id:String(t.for_date),rid:e,date:String(t.for_date),total:Number(t.total),postedAt:String(t.posted_at),postedBy:t.posted_by??void 0}),apply:t=>le.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function na(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>le.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('wages.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,for_date:e.forDate??null,through_date:e.throughDate??null,amount:e.amount,reason:e.reason??null,by_name:e.by,at:e.at}),fromRow:t=>({id:String(t.id),rid:e,kind:'payout'===t.kind?'payout':'correction',forDate:t.for_date??void 0,throughDate:t.through_date??void 0,amount:Zt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>le.useCashUp.setState(s=>({pot:zt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function ia(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=le.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Te('wages.manage'),toRow:(e,t)=>({venue_id:t,show_today:e.showToday,show_pot:e.showPot,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'show',showToday:!1!==e.show_today,showPot:!1!==e.show_pot}),apply:t=>le.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function ra(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>ce.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:We(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ce.useNotifs.setState(s=>({items:zt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ce.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function oa(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=fe.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:We(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:We(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings')||Te('suppliers.order'),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'settings'===e.kind?'settings':'list',doc:e.doc??{}}),apply:(t,a)=>fe.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...pe.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:zt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function da(e){const t=()=>Te('venue.settings')||Te('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>fe.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,ue.isUuid)(a.id)&&(0,ue.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,fe.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ue.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:Ue.getState().staffRef)||null,doc:We(n),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),listId:String(t.list_id),status:t.status??'open',rid:e}),apply:(t,a)=>fe.useOrderLists.setState(s=>({items:zt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){const t=je(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>fe.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings')||Te('suppliers.order'),filter:e=>e.gte('finished_at',t).order('finished_at',{ascending:!1}).limit(300),toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,list_id:e.listId,finished_at:e.finishedAt,finished_by:e.finishedByName.slice(0,80),doc:We(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useOrderLists.setState(s=>({history:zt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function ca(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=ge.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:We(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Te('venue.settings'),toRow:(e,t)=>({venue_id:t,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'area',doc:e.doc??{}}),apply:t=>{const a=t[0];a&&ge.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>ge.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function la(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=he.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,he.libraryRowId)(e),kind:'library',doc:We({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,he.personRowId)(e,i),kind:'person',staffRef:i,doc:We({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=de.useOwner.getState().staff.find(e=>e.id===Ue.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=de.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ye.canEditTasks)(t,a)},writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,staff_ref:e.staffRef??null,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'library'===e.kind?'library':'person',staffRef:e.staff_ref??void 0,doc:e.doc??{}}),apply:t=>he.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,he.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>he.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function fa(e){const t=je(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>he.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ue.getState();return e.byRef===t.staffRef||Te('staff.manage')},writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('for_date',t),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffRef,task_id:e.taskId,for_date:e.forDate,ticked_by_ref:e.byRef,ticked_by_name:e.byName.slice(0,80),ticked_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,staffRef:String(t.staff_ref),taskId:String(t.task_id),forDate:String(t.for_date).slice(0,10),byRef:String(t.ticked_by_ref??''),byName:String(t.ticked_by_name??''),at:String(t.ticked_at)}),apply:(t,a)=>he.useDailyTasks.setState(s=>({ticks:zt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>he.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function pa(e,t=!1){const a=je(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ke.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ue.getState().kind||Te('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Oe.uuidFrom)(`soldout:${a}:${e.itemId}`),venue_id:a,item_id:e.itemId.slice(0,80),name:e.name.slice(0,120),is_on:e.on,marked_at:e.at,by_name:(e.by||'Staff').slice(0,80),clear_after:e.clearAfter??null,...t?{auto:!!e.auto,kept:!!e.kept}:{}}),fromRow:a=>({rid:e,itemId:String(a.item_id),name:String(a.name??''),on:!0===a.is_on,at:String(a.marked_at),by:String(a.by_name??''),clearAfter:a.clear_after?String(a.clear_after):void 0,...t?{auto:!0===a.auto,kept:!0===a.kept}:{}}),apply:(t,a)=>ke.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ke.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Ie.autoSync.soldOutRead.add(e)}}}function ga(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Ie.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:(0,Oe.uuidFrom)(`soldoutlink:${t}:${e.itemId}`),venue_id:t,item_id:e.itemId.slice(0,80),uses:e.uses.slice(0,10).map(e=>({key:String(e.key).slice(0,40),qty:Math.max(0,Math.min(99,Number(e.qty)||0))})),auto:!!e.auto,updated_at:e.at,updated_by:(e.by||'Staff').slice(0,80)}),fromRow:t=>({rid:e,itemId:String(t.item_id),uses:(Array.isArray(t.uses)?t.uses:[]).map(e=>({key:String(e.key??''),qty:Number(e.qty)||0})).filter(e=>e.key&&e.qty>0),at:String(t.updated_at??''),by:String(t.updated_by??''),...!0===t.auto?{auto:!0}:{}}),apply:(t,a)=>Ie.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>Ie.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Ie.autoSync.linksRead.add(e)}}}async function ma(e,t="*"){const a='*'===t?`table:${e}`:`table:${e}.${t}`;try{const s=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:n}=await Promise.race([De().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function _a(){const e=Ue.getState().venueId;if(e)try{const{data:t}=await De().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();ya.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const ha=new Map;const ya=(0,T.create)(()=>({live:!1,known:!1}));async function wa(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([De().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function va(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([De().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const ba=(e,t)=>We({id:String(e.id),venue:t,body:String(e.body??''),kind:'yesno'===e.kind?'yesno':'up',up:Number(e.up_count??0),yes:Number(e.yes_count??0),no:Number(e.no_count??0),hidden:!!e.hidden,reply:e.reply??void 0,replyAt:e.reply_at??void 0,postedOn:String(e.posted_on??'').slice(0,10)}),ka='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Ia(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>D.useHr.getState().questions.filter(t=>t.venue===e&&(0,ue.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>ba(t,e),filter:e=>e.gte('posted_on',new Date(Date.now()-10368e6).toISOString().slice(0,10)),apply:(e,t)=>{const a=new Set(t);D.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>D.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Ra(e,t){const a=(t,a,s)=>{$.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(D.hrRemote,{live:!0,checkout:t=>a('hr_checkout',t.token,{p_venue:e,p_day:t.day,p_token:t.token,p_morale:t.morale,p_staffing:t.staffing,p_question:t.question??null,p_kind:t.kind??'up',p_shout_to:t.shoutTo??null,p_shout_body:t.shoutBody??null}),post:(t,s,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),vote:(e,t,s)=>a('hr_vote',e,{p_question:e,p_token:t,p_vote:s}),moderate:(e,t,s)=>a('hr_moderate',e,{p_question:e,p_action:t,p_reason:s}),reply:(e,t)=>a('hr_reply',e,{p_question:e,p_reply:t}),trend:async(t,a,s)=>{try{const{data:t,error:n}=await De().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?null:(t??[]).map(e=>({day:String(e.day).slice(0,10),answers:Number(e.answers),morale:Number(e.morale),staffing:null==e.staffing?null:Number(e.staffing),short:Number(e.short),perfect:Number(e.perfect),over:Number(e.over)}))}catch{return null}},shouts:async(a,s)=>{try{const{data:a,error:n}=await De().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?null:(a??[]).map(e=>({id:String(e.id),venue:t,day:String(e.day).slice(0,10),to:String(e.to_name),body:e.body??void 0}))}catch{return null}},log:async()=>{try{const{data:a,error:s}=await De().from('hr_mod_log').select('id,question_id,action,reason,by_name,at').eq('venue_id',e).order('at',{ascending:!1}).limit(30);return s?null:(a??[]).map(e=>({id:String(e.id),venue:t,questionId:String(e.question_id??''),action:e.action,reason:e.reason??void 0,by:String(e.by_name??'A manager'),at:String(e.at)}))}catch{return null}},refresh:async()=>{try{const{data:a,error:s}=await De().from('hr_questions').select(ka).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||D.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>ba(e,t)))}catch{}}}),qe.push(()=>{Object.assign(D.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Oa='pair:v1',Aa='staff:v1',Ca='staff:rejoin:v1';async function Da(e){const t=u.IS_QUEUED_VENUE?'claim_'+u.VENUE_RID+'_invite':u.IS_GREENSIDE?'claim_greenside_invite':u.IS_ABBOTSFORD?'claim_abbotsford_invite':u.IS_KIRKTON?'claim_kirkton_invite':u.IS_WILDINGS?'claim_wildings_invite':u.IS_KIRKMICHAEL?'claim_kirkmichael_invite':u.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:Ke,p_device:(0,C.deviceId)()},s=await De().rpc(t,{...a,p_phone:(0,C.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?De().rpc(t,a):s}async function Ua(){if('display'===Ke||'customer'===Ke||me.PITCH)return'none';const e=await L.kv.get(Ca,null);if(!e)return'none';try{await Ta();const{data:t,error:a}=await Da(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ca),await L.kv.remove(Aa),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Aa,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await L.kv.remove(Ca),'refused')}catch{return'offline'}}const Ea=e=>/jwt|refresh|token|401|not authenticated|invalid claim|session/i.test(String(e?.message??e))&&!/fetch|network/i.test(String(e?.message??e));async function Ta(){Me();const{data:e}=await De().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await De().auth.signInAnonymously();if(!t)return;const a=429===t.status||/rate|too many/i.test(t.message);if(!a||e>=2){if(a)throw new Error('Too many people are connecting from this network right now. Wait a few minutes, or switch to mobile data, and open the link again.');throw t}Ee({message:'Lots of people are connecting at once. Trying again in a moment\u2026'}),await new Promise(t=>setTimeout(t,0===e?15e3:45e3))}}async function Na(e){if(me.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await Da(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,u.venueKey)(`cc-pending-invite:${Ke}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),await L.kv.set(Ca,e),Le&&ja(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ee({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ka='car:request:v1',Pa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function Ma(){await L.kv.remove(Oa),await L.kv.remove(Aa),await L.kv.remove(Ka),C.useSession.getState().meId&&C.useSession.getState().signOut()}async function xa(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Ta(),!0}catch{return!1}}const qa=async(e,t={})=>{if(me.PITCH)return(0,_e.pitchRpc)(e,t);const{data:a,error:s}=await De().rpc(e,t);if(s)throw s;return a};let La=null;async function Ba(){for(const e of qe)try{e()}catch{}qe=[],xe.forEach(e=>e.stop()),xe=[],La&&(clearInterval(La),La=null)}async function ja(){await Ba(),await Wa()}async function Fa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Ke||me.PITCH)return!1;try{Me();const{data:e}=await De().auth.getSession();if(e.session){const{error:e}=await De().auth.refreshSession();if(!e)return!0}if('display'===Ke)return!1;if(!await L.kv.get(Ca,null))return!1;if(e.session)try{await De().auth.signOut({scope:'local'})}catch{}return'ok'===await Ua()&&(ja(),!0)}catch{return!1}}(0,l.setSessionMender)(Fa);let $a=u.VENUE_RID;async function Wa(){try{const e='undefined'!=typeof navigator?navigator.storage:null;e?.persist&&e.persist()}catch{}try{const e='undefined'!=typeof window?window.CoverChargeNative:null;e&&'function'==typeof e.checkUpdate&&/CoverChargePhone\//.test(navigator.userAgent)&&e.checkUpdate()}catch{}const e=$a;try{if(Ee({mode:'connecting'}),await $.mutationQueue.load(),'customer'===Ke)return void await za(e);let t=await L.kv.get(Oa,null),a=await L.kv.get(Aa,null);if(Z.IS_CAR&&!t&&a){const e=(0,Y.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Oa,t)),await L.kv.remove(Aa),a=null,C.useSession.getState().meId&&C.useSession.getState().signOut()}if(u.IS_ISOLATED_VENUE&&(t&&!(0,u.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,u.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ee({mode:'display'===Ke?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await De().auth.getSession();if('display'!==Ke&&!Z.IS_CAR&&a&&!s.session){const t=await Ua();if('offline'===t)return Ee({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{$a===e&&ja()},6e4);'refused'===t&&a.staffRef&&C.useSession.getState().meId===a.staffRef&&C.useSession.getState().signOut(),a=await L.kv.get(Aa,null),({data:s}=await De().auth.getSession())}const n='display'===Ke||Z.IS_CAR?t:a;if(!s.session||!n)return void Ee({mode:'display'===Ke||Z.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await qa('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Ke||Z.IS_CAR?await L.kv.remove(Oa):(await L.kv.remove(Aa),await L.kv.remove(Ca)),'staff'===n.kind&&n.staffRef&&C.useSession.getState().meId===n.staffRef&&C.useSession.getState().signOut(),void Ee({mode:'display'===Ke||Z.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Ke?'This display was unpaired by a manager.':Z.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,P.isOnline)()||/fetch|network/i.test(String(t?.message)))Ee({mode:'offline'});else if(Ea(t)&&'display'!==Ke){const{error:t}=await De().auth.refreshSession();t&&'ok'===await Ua()&&setTimeout(()=>{$a===e&&ja()},500)}i=Ue.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ee({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Z.IS_CAR&&'staff'===n.kind&&n.staffRef&&C.useSession.getState().meId!==n.staffRef&&(C.useSession.getState().signIn(n.staffRef),de.useOwner.setState({staffAs:n.staffRef})),Z.IS_CAR&&(C.useSession.getState().meId&&C.useSession.getState().signOut(),de.useOwner.setState({previewRole:'owner'})),await Qa(n.venueId,e,n.kind)}catch(e){Ee({mode:'local',lastError:String(e?.message??e)})}}const Ha=new Set(['venues','staff','bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_items','stock_events','stock_counts','recipe_cards','suppliers','supplier_orders','rota_shifts','attendance','time_requests','game_scores','floor_live','chat_messages','venue_reminders','reminder_done']);async function Qa(e,a,s){if(!(0,u.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Z.IS_CAR&&'device'===s;await ks(a),qe.push(xs(e));try{const{data:t}=await De().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])ht.set(e.key,e.id),yt.set(e.id,e.key)}catch{}const i=[qt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>de.useOwner.getState().staff.map(It),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Te('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,kt()),toRow:(e,t)=>(0,F.staffRow)(e,t,kt(),e.managerAccess||e.ownerAccess?null:ht.get(wt(e))),fromRow:e=>{if(!e.external_ref)return null;_t.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ns.set(String(e.external_ref),e.avatar_path??null);const t=bt(vt(yt.get(String(e.role_id))),!0===e.manager_access);return(0,F.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},kt())},apply:e=>de.useOwner.setState(t=>{const a=new Map(e.map(e=>[e.id,e])),s=t.staff.map(e=>a.has(e.id)?{...e,...a.get(e.id)}:e),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ms()},onRemote:()=>{Ms()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=de.useOwner.getState(),t=ie.useSetup.getState().sites[$a]?.staffGrade??{};return e.staff.filter(e=>_t.has(e.id)).map(a=>We({id:a.id,hourly:e.hourly[a.id]??null,salaried:!!a.salaried,noTax:!!a.noTax,grade:t[a.id]||void 0}))},key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>_t.has(e.id),writable:()=>Te('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:_t.get(e.id),venue_id:t,hourly_rate:null==e.hourly?null:e.hourly/100,salaried:e.salaried,no_tax:e.noTax,pay_grade:e.grade??null}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?We({id:t,hourly:null==e.hourly_rate?null:Math.round(100*Number(e.hourly_rate)),salaried:!!e.salaried,noTax:!!e.no_tax,grade:e.pay_grade||void 0}):null},apply:e=>de.useOwner.setState(t=>{const a={...t.hourly},s=new Map(e.map(e=>[e.id,e]));for(const t of e)null==t.hourly?delete a[t.id]:a[t.id]=t.hourly;if(e.length){const t=ie.useSetup.getState().sites[$a],a={...t?.staffGrade??{}};let s=!1;for(const t of e)(a[t.id]||void 0)!==t.grade&&(s=!0,t.grade?a[t.id]=t.grade:delete a[t.id]);s&&ie.useSetup.getState().patch($a,{staffGrade:a})}return{hourly:a,staff:t.staff.map(e=>s.has(e.id)?{...e,salaried:s.get(e.id).salaried,noTax:s.get(e.id).noTax}:e)}}),subscribe:e=>{const t=de.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=ie.useSetup.subscribe((t,a)=>{t.sites[$a]?.staffGrade!==a.sites[$a]?.staffGrade&&e()});return()=>{t(),a()}}},He(a,!1),He(a,!0),Ve(a),ze(a),Qe(a),Ze(a),st(a),nt(a),pt(a),{name:'supplier_directory',table:'suppliers',list:()=>de.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,name:e.name||'Supplier',category:e.category,contact:e.contact||null,phones:e.phones.filter(Boolean),email:e.email||null,website:e.website||null,account_ref:e.account||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,doc:{kind:'directory',localId:e.id,supplier:We(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>de.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.supplierId),writable:()=>Te('suppliers.order')||Te('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Be(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:We(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},rt(a),Us(a)];Te('wages.view')&&i.push(Es(a)),n&&(i.push(Ut(!0),Et(),Tt(),Pt(a)),Kt(e)),n&&await ma('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>de.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&/^\d{4}-\d{2}-\d{2}$/.test(e.from)&&/^\d{4}-\d{2}-\d{2}$/.test(e.to)&&e.to>=e.from&&(e.staffId===Ue.getState().staffRef&&'pending'===e.status||Te('rota.manage')),writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffId,from_date:e.from,to_date:e.to,reason:(e.reason??'').slice(0,200)||null,status:e.status,doc:We(e)}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),from:String(e.from_date).slice(0,10),to:String(e.to_date).slice(0,10),reason:e.reason??t.reason??'Holiday',status:e.status,by:e.requested_by_name??t.by,decidedBy:e.decided_by_name??void 0}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{leave:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ha.add('staff_leave'),Nt(e));const o=n&&await va();if(we.useChatSync.setState({synced:o,checked:!0}),qe.push(()=>we.useChatSync.setState({synced:!1})),o&&i.push(Ht(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(ve.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>_t.has(e.id),writable:()=>Te('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:_t.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:_t.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>ve.useKitchenExtra.setState(a=>{const s={...a.extra};return t.forEach(e=>{delete s[e]}),e.forEach(e=>{s[e.id]=e.include}),{extra:s}}),subscribe:e=>ve.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ma('hr_questions')&&(i.push(Ia(a)),Ha.add('hr_questions'),Ra(e,a)),'guest'!==s&&'customer'!==Ke&&await ma('temp_readings')&&(i.push((0,Q.tempUnitsSpec)(oe.useSafety,tt),(0,Q.tempReadingsSpec)(oe.useSafety,at)),Ha.add('temp_units'),Ha.add('temp_readings')),'guest'!==s&&'customer'!==Ke&&await ma('cooksafe_records')&&(i.push((0,V.cooksafeSpec)(oe.useSafety,G.useCookSafe,oe.isSeedAccident,at)),Ha.add('cooksafe_records')),'guest'!==s&&await ma('sold_out_items')?(i.push(pa(a,await ma('sold_out_items','auto'))),Ha.add('sold_out_items')):Ie.autoSync.soldOutRead.add(a),'guest'!==s&&await ma('sold_out_links')?(i.push(ga(a)),Ha.add('sold_out_links')):Ie.autoSync.linksRead.add(a),U.useReminders.getState().ensure(a),'guest'!==s&&await wa()&&(i.push(Gt(a)),n&&i.push(Jt(a))),ce.useNotifs.getState().ensure(a),fe.useOrderLists.getState().ensure(a),n){gt=await ma('staff','nickname'),mt=await ma('staff','display_clock');const[e,t,s,n]=await Promise.all([ma('scheduled_notifications'),ma('order_lists'),ma('venue_clock_area'),ma('daily_tasks')]);he.useDailyTasks.getState().ensure(a),n&&(i.push(la(a),fa(a)),Ha.add('daily_tasks'),Ha.add('daily_task_ticks')),e&&(i.push(ra(a)),_a()),t&&i.push(oa(a),da(a),ua(a)),s&&i.push(ca(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&Ha.add(n)}if('guest'!==s&&await ma('day_tips')){i.push(sa(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ha.add(e);await ma('tips_pot_events')&&i.push(na(a),ia(a)),n&&(Xt()||(0,le.forgetPastTakings)(a,(0,k.tradingDay)()),i.push(ea(a),aa(a)),Ha.add('cash_ups'),Xt()&&(i.push(ta(a)),Ha.add('sales_reports')),t(r[76])(r[75],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Ut(),Et()),await ma('scheduled_notifications')&&i.push(ra(a)));let d=!1;const c=()=>{if(Z.IS_CAR&&n&&Te('recipes.edit'))return!0;const e=de.useOwner.getState().staff.find(e=>e.id===Ue.getState().staffRef);return!!e&&e.active&&Te('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&c()&&await ma('ingredient_prices')&&(i.push((0,S.gpSyncSpec)('ing',c)),Ha.add('ingredient_prices'),await ma('card_costs')&&(i.push((0,S.gpSyncSpec)('card',c)),Ha.add('card_costs')),await ma('kitchen_deliveries')&&(i.push((0,S.gpSyncSpec)('del',c)),Ha.add('kitchen_deliveries')),await ma('kitchen_stock_counts')&&(i.push((0,S.gpSyncSpec)('count',c)),Ha.add('kitchen_stock_counts'))),(0,Ce.specialsSyncOn)()&&'guest'!==s&&await ma('specials_boards')&&(i.push((0,Ce.specialsBoardSpec)(a,()=>Te('recipes.edit')||Te('floor.manage')||Te('*'))),Ha.add('specials_boards'));const l={onActivity:()=>Ee({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ee({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ee({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await qa('whoami')??[]).some(t=>t.venue_id===e))return void($a===a&&ja());for(const a of xe){if(a.spec.name!==t)continue;const{count:s,error:n}=await De().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ds()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||H.useTempSaves.getState().mark({id:t,table:e,why:Ss(e)??'this screen could not send it'})}};xe=i.map(t=>new J.EntityBridge(t,e,l)),await Promise.all(xe.map(e=>e.start()));let f=0;const p=async()=>{if(!(f&&Date.now()-f<6e4)){f=Date.now();try{await g()}finally{f=0}}},g=async()=>{if(n&&(0,P.isOnline)())try{const t=await qa('whoami');if(!t?.some(t=>t.venue_id===e))return void($a===a&&ja())}catch(e){if(Ea(e)){if(Z.IS_CAR)return void($a===a&&ja());const e=await Ua();return void('ok'!==e&&'refused'!==e||$a===a&&ja())}}let t=0;for(const[a,s]of xe.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(we.useChatSync.getState().error&&we.useChatSync.setState({error:void 0}),await Vt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&we.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,P.setOnline)(!0),Ee({mode:'live',lastSyncAt:e,lastServerAt:e}),$.mutationQueue.flush()}else Ee({mode:'offline'});if(!Te('wages.view')){const e=Ue.getState().staffRef;de.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([p(),new Promise(e=>setTimeout(e,3e4))]);const m=new Map;for(const e of xe)m.set(e.spec.table,[...m.get(e.spec.table)??[],e]);const _=[...m.keys()].filter(e=>Ha.has(e)).map(e=>({table:e,venueColumn:m.get(e)[0].spec.venueColumn}));let y=!1;const w=(0,J.venueChannel)(e,_,(e,t,a)=>{for(const s of m.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ee({lastSyncAt:s,lastServerAt:s})},e=>{Ee({realtime:e}),'SUBSCRIBED'===e?(y&&p(),y=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(y=!0)});qe.push(()=>{De().removeChannel(w)}),qe.push((0,P.onConnectivity)(e=>{e&&p()}));const v=xe.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),b=(0,M.superviseSync)({fastMs:Ga(Ke),readFast:async()=>{for(const e of v)await e.read()},readAll:p,flush:()=>{$.mutationQueue.flush()},wake:()=>{$.mutationQueue.retryNow()},restart:()=>{$a===a&&ja()},realtime:()=>Ue.getState().realtime,lastServerAt:()=>{const e=Ue.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,P.setOnline)(!0),Ee({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Ea,refreshAuth:async()=>{await De().auth.refreshSession()},heartbeat:()=>Va(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});qe.push(b.stop)}async function Va(e){const t=Ue.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await qa('sync_heartbeat',{p_venue:e,p_device:(0,C.deviceId)()??'unknown',p_app:Ke,p_version:q.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const Ga=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ue.getState(),queue:$.mutationQueue.pending.map(e=>e.table),failedTables:$.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),me.PITCH&&(window.__ccSyncPreview=e=>Ee(e)));const Ja='guest:sent:v1';async function za(e){Ee({kind:'guest',venueSlug:e,perms:[]});try{const t=(await qa('public_venue',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!u.IS_ISOLATED_VENUE||t.id===u.VENUE_UUID)){Ee({venueId:t.id,venueName:t.name}),await ks(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,p.withWildingsAddress)({...a,id:e}):t)})),xt(e,t.app?.events)}await Za(e),Ee({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ee({mode:(0,P.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Za(e).catch(()=>{})},6e4);qe.push(()=>clearInterval(t)),u.IS_ISOLATED_VENUE||await Ya(e)}async function Za(e){const t=await qa('public_menu',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ae.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}});try{const t=await qa('public_takeaway_menu',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function Ya(e){let t=await L.kv.get(Ja,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,ue.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,ue.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await xa())return;for(const a of n)try{const s=(await qa('guest_create_booking',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_booking:{...We(a),...(0,R.takeGuard)(a.id),allergies:$e(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&z.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Ee({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await qa('guest_create_takeaway',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_order:{...We(a),...(0,R.takeGuard)(a.id),allergies:$e(a.allergies)}}))?.[0];t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?es(e,s):e)}))}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ee({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ts(s)}}:e)})))}await L.kv.set(Ja,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await qa('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ja,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await qa('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.useStore.setState(e=>({bookings:e.bookings.map(e=>{const a=t.get(e.id);return a&&a.status&&a.status!==e.status&&'declined'!==a.status?{...e,status:a.status}:'declined'===a?.status&&'cancelled'!==e.status?{...e,status:'cancelled'}:e}),orders:e.orders.map(e=>{const a=t.get(e.id);if(!a)return e;const s=es(e,a);return Xa(s)===Xa(e)?e:s})})),Ee({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ee({mode:(0,P.isOnline)()?Ue.getState().mode:'offline'})}finally{a=!1}}};qe.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),La=setInterval(()=>{n()},15e3),as=()=>{n()},n()}const Xa=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function es(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ts=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let as=null;const ss={bridges:()=>xe,restart:ja};function ns(){const e=Ue.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Te('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function is(){const e=xe.find(e=>'stock_events'===e.spec.table);if(!e||ns())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&($.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function rs(){const e=xe.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}is();try{await $.mutationQueue.retryNow()}catch{}}Ue.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{rs()},3e3)});const os=['bookings','walk_ins'];function ds(){const e=Ue.getState();return Ne()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Te('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const us=()=>xe.filter(e=>os.includes(e.spec.table)),cs=e=>$.mutationQueue.failed.some(t=>os.includes(t.table)&&t.rowKey===e);function ls(e=!1){return ds()?0:us().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&cs(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function fs(e=!1){const t=ds();if(t)return t;for(const e of us())try{await e.read()}catch{}ls(e);try{await $.mutationQueue.retryNow()}catch{}return e&&ps(),null}function ps(){const e=us()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(us().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||cs(s)||os.some(t=>$.mutationQueue.hasPending(t,e,s))||t.clear(s)}$.mutationQueue.onFailed(e=>{os.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),$.mutationQueue.onDone(e=>{os.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let gs=null;const ms=(e=2500)=>{gs&&clearTimeout(gs),gs=setTimeout(()=>{gs=null,fs(!1)},e)};(0,P.onConnectivity)(e=>{e&&ms()}),Ue.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Te('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&ms(3e3)});const _s=['temp_readings','temp_units'];function Ss(e="temp_readings"){const t=Ue.getState();return Ne()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||tt()?'device'!==t.kind||Te('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const hs=()=>xe.filter(e=>_s.includes(e.spec.table));async function ys(e=!1){const t=Ss();if(t)return t;for(const e of hs())try{await e.read()}catch{}const a=hs()[0]?.venueId??'';for(const t of hs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,$.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await $.mutationQueue.retryNow()}catch{}if(e){const e=H.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=hs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||$.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,H.tempKey)(t.table,t.id))}}return null}$.mutationQueue.onFailed(e=>{_s.includes(e.table)&&H.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),$.mutationQueue.onDone(e=>{_s.includes(e.table)&&H.useTempSaves.getState().clear((0,H.tempKey)(e.table,e.rowKey))});let ws=null;const vs=(e=3e3)=>{ws&&clearTimeout(ws),ws=setTimeout(()=>{ws=null,ys(!1)},e)};(0,P.onConnectivity)(e=>{e&&vs()}),Ue.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Te('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&vs(3500)});const bs='golive:v1:';async function ks(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Cs(e):(await L.kv.get(bs+e,!1)||await Cs(e),await L.kv.get(Os+e,!1)||(As(e),await L.kv.set(Os+e,!0)),await L.kv.get(Is+e,!1)||(Rs(),await L.kv.set(Is+e,!0)))}const Is='golive:v3:';function Rs(){const e=e=>JSON.stringify(e).includes('(example)');try{re.useKitchen.setState(t=>({waste:t.waste.filter(t=>!e(t)),stockTakes:t.stockTakes.filter(t=>!e(t)),deliveries:t.deliveries.filter(e=>'dl-today-fish'!==e.id&&'dl-today-veg'!==e.id)}))}catch{}}const Os='golive:v2:';function As(e){const t=e=>JSON.stringify(e).includes('(example)');z.useStore.setState(t=>({customer:{...t.customer,name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}},stampCards:t.stampCards.filter(t=>t.restaurantId!==e),giftCards:t.giftCards.filter(t=>t.restaurantId!==e),ratings:t.ratings.filter(t=>t.restaurantId!==e),events:t.events.filter(t=>!(t.example&&(t.restaurantId===e||null===t.restaurantId)))})),de.useOwner.setState(e=>({referrals:[],coats:[],merchOrders:[],lost:[],customerTags:{},offers:e.offers.filter(e=>!t(e)),changeRequests:e.changeRequests.filter(e=>!t(e)),campaigns:e.campaigns.filter(e=>!t(e)),supplierOrders:e.supplierOrders.filter(e=>!t(e)),chat:e.chat.filter(e=>e.id.startsWith('m-seed-')).map((e,t)=>({...e,at:new Date(Date.now()-6e4*(5-t)).toISOString()}))}))}async function Cs(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,re.stripKitchenExamples)(re.useKitchen.getState()),s=de.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:oe.useSafety.getState().accidents.filter(e=>!(0,oe.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(re.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',re.useKitchen.getState()),re.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),de.useOwner.setState(n)),r(oe.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',oe.useSafety.getState()),oe.useSafety.setState(i));const o=(0,D.stripHrSamples)(D.useHr.getState());r(D.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',D.useHr.getState()),D.useHr.setState(o));const d=(0,S.stripGpSamples)(S.useGpCalc.getState());r(S.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',S.useGpCalc.getState()),S.useGpCalc.setState(d));const u=se.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),se.useOrderSheets.setState(c));const l=ae.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ae.useCardStore.setState(f)),void await L.kv.set(bs+e,!0)}const t=t=>t.restaurantId===e&&!(0,ue.isUuid)(t.id);z.useStore.setState(a=>({bookings:a.bookings.filter(e=>!t(e)),orders:a.orders.filter(e=>!t(e)),waitlist:a.waitlist.filter(t=>t.restaurantId!==e),walkIns:Object.fromEntries(Object.entries(a.walkIns).filter(([t])=>!t.includes(e)))})),X.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,ue.isUuid)(t.id))})),ee.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),de.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,ue.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,ue.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,ue.isUuid)(e.id)),leave:e.leave.filter(e=>(0,ue.isUuid)(e.id)),swaps:[]}));try{re.useKitchen.setState(e=>(0,re.stripKitchenExamples)(e))}catch{}de.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,ue.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.supplierId))}));try{oe.useSafety.setState(e=>({accidents:e.accidents.filter(e=>{return!String(e.id).startsWith('acc-ex')&&(t=e,!JSON.stringify(t).includes('(example)'));var t})}))}catch{}await L.kv.set(bs+e,!0)}const Ds=(e,t)=>We({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Us(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ee.useFloor.getState().live[e]??{}).map(([e,t])=>Ds(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ue.getState().kind||Te('device.write'),deletes:!1,matchKey:e=>({table_name:e}),toRow:(e,t)=>({venue_id:t,table_name:e.name,stage:e.stage??null,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note?e.note.slice(0,200):null,updated_by:(0,Y.actorStamp)({isCar:Z.IS_CAR,kind:Ue.getState().kind,staffRef:Ue.getState().staffRef,fallback:Ke})}),fromRow:e=>Ds(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ee.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>ee.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Es(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(ie.useSetup.getState().sites[e]?.grades??ie.DEFAULT_GRADES).map((e,t)=>({id:e.id,name:e.name,pence:e.pence,sort:t})),key:e=>e.id,rowKey:e=>String(e.grade_id),syncable:e=>!!e.id&&!!e.name,writable:()=>Te('wages.manage'),matchKey:e=>({grade_id:e}),toRow:(e,t)=>({venue_id:t,grade_id:e.id,name:e.name.slice(0,60),pence:Math.max(0,Math.min(1e5,Math.round(e.pence))),sort:e.sort}),fromRow:e=>({id:String(e.grade_id),name:String(e.name),pence:Number(e.pence),sort:Number(e.sort??0)}),apply:(t,a)=>{if(!t.length&&!a.length)return;const s=ie.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));ie.useSetup.getState().patch(e,{grades:i})},subscribe:t=>ie.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ts='staff-avatars',Ns=new Map;let Ks=!1;const Ps=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ms(){if(!Ks){Ks=!0;try{for(const[e,t]of Ns){const a=ne.useAvatars.getState().photos[e];if(!t){a?.path&&ne.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ue.getState().staffRef)continue;const{data:s,error:n}=await De().storage.from(Ts).download(t);if(n||!s)continue;const i=await Ps(s);i.startsWith('data:image/')&&ne.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ks=!1}}}function xs(e){const t=async()=>{const t=Ue.getState().staffRef,a=t?_t.get(t)??Ue.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ue.getState().kind)return;const s=ne.useAvatars.getState().photos[t];try{const n=Ns.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&De().storage.from(Ts).remove([t]).catch(()=>{})};if(!s){const e=!!ne.useAvatars.getState().clears?.[t];return e&&n&&(await qa('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ns.set(t,null),i(n)),void(e&&ne.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ee({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===r.type?'jpg':'image/webp'===r.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await De().storage.from(Ts).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await qa('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ns.set(t,d),n!==d&&i(n),ne.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ee({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ne.useAvatars.getState().photos},s=ne.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Te('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ue.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ns.set(t,null),ne.useAvatars.getState().doneClear(t),qa('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>De().storage.from(Ts).remove([e])).catch(()=>{})}});return t(),s}const qs=new Map,Ls=(0,T.create)(()=>({n:0}))},824,{"0":836,"1":1235,"2":5,"3":1236,"4":1191,"5":6,"6":1155,"7":842,"8":1156,"9":1159,"10":1150,"11":808,"12":864,"13":1085,"14":869,"15":1049,"16":1051,"17":980,"18":816,"19":1240,"20":13,"21":866,"22":1242,"23":998,"24":1245,"25":995,"26":872,"27":1153,"28":1246,"29":1152,"30":1046,"31":1045,"32":1234,"33":1248,"34":1247,"35":1251,"36":1076,"37":1252,"38":1253,"39":1254,"40":1255,"41":1257,"42":1149,"43":881,"44":807,"45":977,"46":828,"47":829,"48":1087,"49":1151,"50":1088,"51":1190,"52":1096,"53":1259,"54":1260,"55":863,"56":1099,"57":997,"58":1050,"59":1059,"60":1263,"61":1264,"62":2,"63":1265,"64":1266,"65":1267,"66":1268,"67":1269,"68":946,"69":942,"70":982,"71":1183,"72":1178,"73":1071,"74":877,"75":1077,"76":29,"paths":{}}); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"colours",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"font",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return A}}),e.brandColour=function(I,S=F.gold){const r=/^#([0-9a-f]{6})$/i.exec(I??'');if(!r)return S;const _=parseInt(r[1],16),t=(_>>16)/255,E=(_>>8&255)/255,n=(255&_)/255,o=Math.max(t,E,n),A=Math.min(t,E,n),l=o-A;if(l<.12)return I;const D=o===t?((E-n)/l+6)%6*60:o===E?60*((n-t)/l+2):60*((t-E)/l+4);return D>65&&D<320?S:I};var I=_r(_d[0]),S=_r(_d[1]),r=_r(_d[2]),_=_r(_d[3]),t=_r(_d[4]),E=_r(_d[5]);const F={bg:I.IS_SOUTERS?'#56152A':I.IS_WILDINGS?'#272A2F':'#0B0B0B',surface:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#141414',surface2:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#363A42':'#1D1C1A',border:I.IS_SOUTERS?'#87435B':I.IS_WILDINGS?'#50545C':'#34302A',gold:I.IS_WILDINGS?'#FFE3A5':I.IS_KIRKMICHAEL?'#B87754':I.IS_SOUTERS?'#A4622E':'#CFA45F',goldLight:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',goldTint:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',goldMuted:I.IS_WILDINGS?'#DDC694':I.IS_KIRKMICHAEL?'#C2937A':I.IS_SOUTERS?'#C18F67':'#BFA06C',hairline:'rgba(255,255,255,0.09)',tile:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#18171A',tilePressed:I.IS_SOUTERS?'#64223B':I.IS_WILDINGS?'#393D45':'#211F1C',accentBg:I.IS_WILDINGS?'rgba(255,227,165,0.13)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.13)':I.IS_SOUTERS?'rgba(164,98,46,0.13)':'rgba(207,164,95,0.13)',accentBorder:I.IS_WILDINGS?'rgba(255,227,165,0.38)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.38)':I.IS_SOUTERS?'rgba(164,98,46,0.38)':'rgba(207,164,95,0.38)',text:'#F5F1E8',muted:'#B8B0A0',onGold:I.IS_WILDINGS?'#272A2F':I.IS_KIRKMICHAEL?'#0B0B0B':I.IS_SOUTERS?'#FFFFFF':'#0B0B0B',red:'#FF6B5E',redBg:'#4A1310',redSolid:'#C62F22',amber:'#FFB547',amberBg:'#3F2C05',shellfishFree:'#6EC470',ok:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',okBg:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',blue:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',blueBg:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#39352C':'#1E1A12',...I.IS_GREENSIDE?r.GREENSIDE_PALETTE:{},...I.IS_QUEUED_VENUE?S.QUEUED_PALETTE:{},...I.IS_KIRKTON?t.KIRKTON_PALETTE:{},...I.IS_ABBOTSFORD?_.ABBOTSFORD_PALETTE:{}},n={regular:'Poppins_400Regular',medium:'Poppins_500Medium',semibold:'Poppins_600SemiBold',bold:'Poppins_700Bold'},o={small:E.type.small,body:E.type.body,large:E.type.large,title:E.type.title,hero:E.type.hero},A={s:E.radii.s,m:E.radii.m,l:E.radii.l}},825,[5,1315,1154,1316,1317,1318]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},826,[240]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.templatesFor=function(t){const n={...r.DEFAULT_TEMPLATES};for(const o of Object.keys(r.DEFAULT_TEMPLATES))n[o]={...r.DEFAULT_TEMPLATES[o],...t?.[o]??{}};return n},e.composeBooking=function(t,n,o,c,u){if(n.walkIn)return[];return s(t,'booking-confirmation'===t?'booking':'booking-request'===t?'request':'declined',(0,r.bookingVars)(n,o),{phone:n.phone,email:n.email,name:n.name},{refType:'booking',refId:n.id,ref:n.ref},o,c,u)},e.composeOrder=function(t,n,o,c){return'takeaway'!==t.type?[]:s('order-confirmation','order',(0,r.orderVars)(t,n),{phone:t.phone,email:t.email,name:t.customerName},{refType:'order',refId:t.id,ref:t.ref},n,o,c)},e.deliverQueued=async function(r,n){if(!(0,t.isLive)())return;const o=(0,t.activeProvider)();for(const t of r){const r=await o.deliver(t);n(t.id,r.ok?{status:'sent'}:{status:'failed',error:r.error})}},e.statusLabel=function(t){const r='sms'===t.channel?'Text':'Email';return'preview'===t.status?`${r}: Ready (preview mode)`:'queued'===t.status?`${r}: Sending\u2026`:'sent'===t.status?`${r} sent`:`${r}: Not sent (failed)`},Object.defineProperty(e,"PREVIEW_BANNER",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);Object.keys(t).forEach(function(r){'default'===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})});var r=_r(d[1]);Object.keys(r).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var n=_r(d[2]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=()=>`msg-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-4)}`;function s(s,c,u,l,f,m,p,b){const y=[],v=(0,t.isLive)()?'queued':'preview',h=(0,t.activeProvider)().id,E=(0,n.guestPhone)(l.phone);if(E.ok&&y.push({id:o(),restaurantId:m.id,at:b,channel:'sms',kind:s,to:E.pretty,toName:l.name,body:(0,r.toGsm)((0,r.fill)(p[c].sms,u.sms)),...f,status:v,provider:h}),l.email?.trim()){const t=(0,r.fillEmailText)(p[c].body,u.email),n=(0,r.fill)(p[c].subject,u.email);y.push({id:o(),restaurantId:m.id,at:b,channel:'email',kind:s,to:l.email.trim(),toName:l.name,subject:n,body:t,html:(0,r.emailHtml)(t,{venue:m.name,preheader:n}),...f,status:v,provider:h})}return y}const c='Preview mode, not sent yet. Connect a text and email service to go live.'},827,[1179,1180,1181]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCK_REASONS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return m}}),_e.blockClock=function(e){if('string'==typeof e){const t=/(\d{1,2}):(\d{2})/.exec(e);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}return e instanceof Date&&!Number.isNaN(e.getTime())?`${String(e.getHours()).padStart(2,'0')}:${String(e.getMinutes()).padStart(2,'0')}`:void 0},Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return k}}),_e.blockedTablesAt=v,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return M}}),_e.closedAreasAt=function(e,t,o,n){const a=(0,u.toMins)(n),s=p(e,t,o).filter(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).map(e=>e.areaId);return new Set([...s,...[...v(e,t,o,n)].map(M)])},_e.blockAt=S,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,u.toMins)(e.to)>(0,u.toMins)(n))).sort((e,t)=>e.date===t.date?(0,u.toMins)(e.from)-(0,u.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o={...t,id:(0,a.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,a.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)}))},remove:(t,o)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>{const n=e.blocks.find(e=>e.id===t);return n?{blocks:e.blocks.filter(e=>e.id!==t),removed:[...e.removed,{...n,removedAt:(new Date).toISOString(),removedBy:o??n.by}]}:e})},put:t=>e(e=>{const o=e.blocks.filter(e=>e.id!==t.id),n=e.removed.filter(e=>e.id!==t.id);return t.removedAt?{blocks:o,removed:[...n,t]}:{blocks:[...o,t],removed:n}})}),{name:'covercharge-blocks-v1',storage:(0,c.createJSONStorage)(()=>n.default),version:2,migrate:e=>{const t=e??{};return{blocks:t.blocks??[],removed:t.removed??[]}}}));const k=e=>!e.areaId&&!e.tables?.length;function v(e,t,o,n){const a=(0,u.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).flatMap(e=>e.tables))}const O=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&k(e)).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),p=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),M=e=>`tbl:${e}`;function S(e,t,o,n){const a=(0,u.toMins)(n);return O(e,t,o).find(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to))}const $=(e,t,o,n)=>S(e,t,o,n),h=e=>e.privateFunction?`${e.privateFunction.title} \xb7 ${e.privateFunction.covers} Covers \xb7 ${e.areaName??'Whole venue'} \xb7 until ${e.to}`:e.tables?.length?`${e.tables.map(t.tableNumbers).join(', ')} blocked until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:e.areaId?`${e.areaName??'Area'} closed until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:`Bookings paused until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`,y=(e,t)=>{const o=m(e=>e.blocks);return O(o,e,t)}},828,[812,1160,1099,995,1169,822,992,1258]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SETTINGS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"seedPlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useFloor",{enumerable:!0,get:function(){return p}}),_e.hashOldPins=f,Object.defineProperty(_e,"usePlan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useDisplaySettings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"planOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j}}),_e.tablesLabel=v,_e.tableCardLabel=function(e){return(0,t.withTableWord)(v(e))},Object.defineProperty(_e,"joinTables",{enumerable:!0,get:function(){return S}});var e,n=r(d[0]),t=r(d[1]),a=r(d[2]),s=(e=a)&&e.__esModule?e:{default:e},i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});const u={privacy:!0,idleMins:2,pinOn:!1,...i.DEFAULT_WAKE,tonightCards:!0},b=e=>'souters'===e||n.IS_ISOLATED_VENUE&&'souters'===n.VENUE_RID?{areas:[{id:'su-restaurant',name:'Restaurant'},{id:'su-bar',name:'Bar'},{id:'su-mezzanine',name:'Mezzanine / private dining'},{id:'su-garden',name:'Beer garden',outdoor:!0},{id:'su-icecream',name:'Ice cream & cake corner'}],tables:[],joins:[],sections:[],fixtures:[]}:'kirkmichael'===e||n.IS_ISOLATED_VENUE&&'kirkmichael'===n.VENUE_RID?{areas:[{id:'km-restaurant',name:'Restaurant'},{id:'km-bar',name:'Bar'},{id:'km-private',name:'Private dining',label:'The Room (about 18 covers) \u2014 table plan to confirm'}],tables:[],joins:[],sections:[],fixtures:[]}:['wildings','greenside'].includes(e)||n.IS_ISOLATED_VENUE?{areas:[],tables:[],joins:[],sections:[],fixtures:[]}:'anchorage'===e?(0,c.anchoragePlan)():(0,c.starterPlan)(),p=(0,l.create)()((0,o.persist)((e,t)=>{const a=e=>t().plans[e]??b(e);return{plans:n.IS_ISOLATED_VENUE?{[n.VENUE_RID]:b(n.VENUE_RID)}:{anchorage:(0,c.anchoragePlan)()},live:{},settings:{},smsLog:[],setPlan:(n,t)=>e(e=>({plans:{...e.plans,[n]:t}})),updateTable:(n,t,s)=>{const i=a(n);e(e=>({plans:{...e.plans,[n]:{...i,tables:i.tables.map(e=>e.id===t?{...e,...s}:e)}}}))},addTable:(n,t)=>{const s=a(n);e(e=>({plans:{...e.plans,[n]:{...s,tables:[...s.tables,t]}}}))},removeTable:(n,t)=>{const s=a(n),i=s.tables.find(e=>e.id===t);e(e=>({plans:{...e.plans,[n]:{...s,tables:s.tables.filter(e=>e.id!==t),joins:s.joins.filter(e=>!i||!e.tables.includes(i.name))}}}))},setLive:(n,t,a)=>e(e=>({live:{...e.live,[n]:{...e.live[n]??{},[t]:{...e.live[n]?.[t]??{},...a}}}})),setSettings:(n,t)=>e(e=>({settings:{...e.settings,[n]:{...u,...e.settings[n]??{},...t}}})),logSms:(n,t,a)=>e(e=>{return{smsLog:[{id:(s='sms',`${s}-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`),rid:n,at:t,text:a},...e.smsLog].slice(0,50)};var s}),resetPlan:n=>e(e=>({plans:{...e.plans,[n]:b(n)}}))}},{name:'covercharge-floor-v1',version:6,storage:(0,o.createJSONStorage)(()=>s.default),migrate:(e,n)=>{const t=e??{};let a=t;if(n<2){const e={};for(const[n,a]of Object.entries(t.plans??{}))e[n]='anchorage'===n?(0,c.anchoragePlan)():(0,c.normalisePlan)(a);e.anchorage=(0,c.anchoragePlan)(),a={...t,plans:e,live:{}}}else if(n<3)a={...t,plans:{...t.plans??{},anchorage:(0,c.anchoragePlan)()}};else if(n<4){const e=t.plans?.anchorage;e&&(a={...t,plans:{...t.plans,anchorage:{...e,joins:(e.joins??[]).filter(e=>!(2===e.tables.length&&e.tables.includes('1')&&e.tables.includes('2')))}}})}return n<5&&(a={...a,settings:f(a.settings)}),n<6&&a.plans?.anchorage&&(a={...a,plans:{...a.plans,anchorage:(0,c.withSeedBest)('anchorage',a.plans.anchorage)}}),a}}));function f(e){const n={};for(const[t,a]of Object.entries(e??{})){const{pin:e,...s}=a??{};n[t]={...u,...s,...'pinHash'in s?{}:(0,i.fromOldPin)(e)}}return n}const h=e=>p(n=>n.plans[e])??E(e),N={};function E(e){return N[e]??=b(e)}const O=e=>{const n=p(n=>n.settings[e]);return n?{...u,...n}:u},P=e=>p.getState().plans[e]??E(e),j=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[];function v(e){const n=j((0,t.tableNumbers)(e));if(!n.length)return'';if(1===n.length)return n[0];const a=n.map(e=>/^\d+$/.test(e)?Number(e):NaN),s=a.every(e=>!Number.isNaN(e))?[...n].sort((e,n)=>Number(e)-Number(n)):n;return a.every(e=>!Number.isNaN(e))&&s.length>=3&&s.every((e,n)=>0===n||Number(e)===Number(s[n-1])+1)?`${s[0]}\u2013${s[s.length-1]}`:s.join(' + ')}const S=e=>[...new Set(e)].sort((e,n)=>/^\d+$/.test(e)&&/^\d+$/.test(n)?Number(e)-Number(n):e.localeCompare(n)).join('+')},829,[5,812,1160,986,995,1169,1071]); +__d(function(_g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STATUS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"STAGE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"turnFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"startOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"durOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"endOf",{enumerable:!0,get:function(){return f}}),e.clashes=function(a,s=90){const n=new Set,l=a.filter(t=>g(t)&&t.table);for(let a=0;a(0,t.tablesOf)(d.table).includes(a))&&(u(o)t.date===n&&!['cancelled','noshow'].includes(t.status)).sort((t,a)=>t.time.localeCompare(a.time));for(const s of a.tables){const a=i.filter(a=>(0,t.tablesOf)(a.table).includes(s.name)),n=a[0],o=(0,t.tablesOf)(n?.table);l[s.name]={table:s,status:n?'soon':'free',next:n,covers:n?.partySize??0,dayBookings:a.length?a:void 0,group:o.length>1?o:void 0,allergy:!(!n?.allergies?.length&&!n?.allergyNote),vip:n?.tags?.find(t=>'VIP'===t)??n?.tags?.find(t=>'Regular'===t),occasion:n?.occasion??h(n?.notes)}}return l},e.floorView=function(a,n,l,i,o,d=90,c){const b={},g=n.filter(t=>t.date===S(o));for(const n of a.tables){const a=i[n.name]??{},y=g.filter(a=>(0,t.tablesOf)(a.table).includes(n.name)),S=y.find(t=>'seated'===(0,s.shownStatus)(t)),v=y.filter(t=>'confirmed'===t.status).sort((t,a)=>t.time.localeCompare(a.time)).find(t=>O(o,t)>=-20),T=v?Math.round(O(o,v)):void 0,w=S?void 0:p(y,o,d),F=l.find(t=>'table'===t.type&&t.tableNo===n.name&&!['closed','cancelled','collected'].includes(t.status));let j='free';a.blocked?j='blocked':S?j=a.stage??'seated':!c?.has(n.areaId)&&!c?.has(`tbl:${n.name}`)||F?a.dirty?j='dirty':F?j=a.stage??'seated':v&&(j='soon'):j='blocked';const A=S,P=A?.tags?.find(t=>'VIP'===t)??A?.tags?.find(t=>'Regular'===t)??(A?void 0:v?.tags?.[0]);b[n.name]={table:n,status:j,booking:A,next:v,due:w,nextIn:T,covers:A?.partySize??0,group:(()=>{const a=(0,t.tablesOf)((A??('soon'===j?v:void 0))?.table);return a.length>1?a:void 0})(),orderOnly:!A&&!!F,note:a.note,seatedMins:A?Math.max(0,Math.round((o.getTime()-u(A).getTime())/6e4)):void 0,freeAt:A?f(A,d):void 0,allergy:!!(A?.allergies?.length||A?.allergyNote||!A&&(v?.allergies?.length||v?.allergyNote)||F?.allergies?.length),vip:P,occasion:A?.occasion??(A?void 0:v?.occasion??h(v?.notes))??h(A?.notes)}}return b},e.dueOnTable=p,Object.defineProperty(e,"OCCASION_ICON",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"tableAllowed",{enumerable:!0,get:function(){return v}}),e.suggestTable=function(s,n,l,i,o,d,c=90,b,p){const h=[...s.tables.map(t=>({name:t.name,seats:t.maxSeats,min:t.minSeats,parts:[t.name]})),...s.joins.map(t=>{const a=s.tables.filter(a=>t.tables.includes(a.name));return{name:t.tables.join('+'),seats:a.reduce((t,a)=>t+a.maxSeats,0),min:a.reduce((t,a)=>t+a.minSeats,0),parts:t.tables}})].filter(t=>t.parts.every(t=>v(s,t,p))),y=o.getTime()+6e4*d,O=new Set((0,a.bestTables)(s));let S=null;for(const a of h){if(a.seats['blocked'].includes(l[t]?.status)))continue;const s=!!l&&a.parts.some(t=>['seated','mains','dessert','bill','dirty'].includes(l[t]?.status)),d=n.filter(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()o.getTime()).length,p=1===a.parts.length&&O.has(a.parts[0])?12:0,h=(s?1e3:0)+100*d+10*(a.seats-i)+(i({name:t.name,seats:t.maxSeats,parts:[t.name]})),...s.joins.map(t=>({name:t.tables.join('+'),seats:s.tables.filter(a=>t.tables.includes(a.name)).reduce((t,a)=>t+a.maxSeats,0),parts:t.tables}))].filter(t=>t.seats>=l&&t.parts.every(t=>v(s,t,c))).filter(a=>!n.some(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()i.getTime())),y=new Set((0,a.bestTables)(s)),O=t=>1===t.parts.length&&y.has(t.parts[0])?0:1;return h.sort((t,a)=>t.seats-a.seats||t.parts.length-a.parts.length||O(t)-O(a)).map(t=>({table:t.name,seats:t.seats,area:s.areas.find(a=>a.id===s.tables.find(a=>a.name===t.parts[0])?.areaId)?.name??''}))},e.seatedPartiesAt=function(a,s,n){return s.filter(s=>s.date===n&&'seated'===s.status&&(0,t.tablesOf)(s.table).includes(a))},Object.defineProperty(e,"unseatStatus",{enumerable:!0,get:function(){return T}});var t=r(_d[0]),a=r(_d[1]),s=r(_d[2]);const n={colour:'#3A2F1E',fg:'#F1DDB0'},l={colour:'#CFA45F',fg:'#0B0B0B'},i={free:{label:'Free',...n},soon:{label:'Booked later',colour:'#9A3050',fg:'#FFF6F0'},seated:{label:'Seated',...l},mains:{label:'Seated',...l},dessert:{label:'Seated',...l},bill:{label:'Seated',...l},dirty:{label:'Needs clearing',colour:'#6E6555',fg:'#FFFFFF'},blocked:{label:'Blocked',...n}},o={seated:'Seated',mains:'Mains',dessert:'Dessert',bill:'Bill requested'},d=['seated','mains','dessert','bill'],c=(t,a=90)=>Math.min(a+60,a+15*Math.max(0,Math.ceil((t-2)/2))),u=t=>'seated'===(0,s.shownStatus)(t)&&t.seatedAt?new Date(t.seatedAt):new Date(`${t.date}T${t.time}:00`),b=(t,a=90)=>t.durationMins??c(t.partySize,a),f=(t,a=90)=>new Date(u(t).getTime()+6e4*b(t,a)),g=t=>!['cancelled','noshow','finished'].includes(t.status);function p(t,a,s=90){return t.filter(t=>'confirmed'===t.status&&O(a,t)<=45&&-O(a,t)t.time.localeCompare(a.time))[0]}const h=t=>t?/birthday/i.test(t)?'birthday':/anniversary/i.test(t)?'anniversary':void 0:void 0,y={birthday:'\ud83c\udf82',anniversary:'\ud83d\udc9d',celebration:'\ud83e\udd42'},O=(t,a)=>(new Date(`${a.date}T${a.time}:00`).getTime()-t.getTime())/6e4,S=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,v=(t,a,s)=>{const n=t.tables.find(t=>t.name===a);if(!n)return!1;const l=t.areas.find(t=>t.id===n.areaId);return!(s?.dog&&!(void 0!==n.dogOk?n.dogOk:l?.dogs))&&(!s?.closed?.has(n.areaId)&&!s?.closed?.has(`tbl:${n.name}`))};const T=t=>t.walkIn?'cancelled':'confirmed'},830,[829,1071,832]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"emptyNeeds",{enumerable:!0,get:function(){return w}}),_e.needsMissing=function(e,l=[]){const s=[];null===e.allergy?s.push('Answer the allergy question first'):'yes'!==e.allergy||e.allergens.length||l.length||e.allergyNote.trim()||s.push('Pick the allergens or describe them');null===e.dog&&s.push('Say whether a dog is coming');return s},_e.needsPatch=function(e,l=[]){const s='yes'===e.allergy?e.allergens.filter(e=>!l.some(l=>l.allergen===e)).map(l=>({allergen:l,severity:e.severity})):[],t=Object.entries(e.holds).filter(([,e])=>e>0).map(([e,l])=>{const s=e.indexOf(':');return{kind:e.startsWith('item:')?'item':'stock',id:s>=0?e.slice(s+1):e,qty:l}}),a=e.dog?Math.max(1,e.dogs):0,n={...e.wheelchair?{wheelchair:e.wheelchair}:{},...e.stepFree?{stepFree:!0}:{},...e.toilet?{toilet:!0}:{},...e.assistDog?{assistDog:!0}:{},...e.accessNote.trim()?{note:e.accessNote.trim()}:{}},r={...e.vegan?{vegan:e.vegan}:{},...e.vegetarian?{vegetarian:e.vegetarian}:{}};return{allergies:[...l,...s],allergyNone:'none'===e.allergy&&!l.length||void 0,allergyPeople:'yes'===e.allergy?e.allergyPeople:void 0,allergyNote:'yes'===e.allergy&&e.allergyNote.trim()?e.allergyNote.trim():void 0,dog:a>0,dogs:a||void 0,access:Object.keys(n).length?n:void 0,diet:Object.keys(r).length?r:void 0,holds:t.length?t:void 0,tableReq:e.tableReq.length?e.tableReq:void 0}},_e.FirstQuestions=function({rid:e,value:l,onChange:a,party:r,audience:i,profile:o=[]}){const y=e=>a({...l,...e}),b=(0,p.usePlan)(e),[x,j]=(0,t.useState)(!1),k=(0,s.dogQuestionOn)((0,u.useRestaurant)(e));(0,t.useEffect)(()=>{k||null!==l.dog||a({...l,dog:!1})},[k,l.dog]);const w=x?m.ALLERGENS:m.ALLERGENS.filter(e=>['gluten','milk','peanuts','treenuts','crustaceans','molluscs','fish','eggs','sesame'].includes(e.id)||l.allergens.includes(e.id)),q=[...o.map(e=>e.allergen),...l.allergens],M=(0,f.dogSetUp)(b);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(R,{tone:"red",testID:"q-allergens",children:[(0,v.jsx)(C,{sub:'guest'===i?'We ask everyone first, so the kitchen can keep you safe.':'Ask every guest first. It goes to the kitchen in red.',children:"\u26a0\ufe0f Does anyone in the party have a food allergy?"}),o.length?(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(e=>(0,v.jsx)(h.Badge,{kind:"red",label:`${m.ALLERGENS.find(l=>l.id===e.allergen)?.short} (from your profile)`},e.allergen))}):null,(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No allergies",selected:'none'===l.allergy,onPress:()=>y({allergy:'none',allergens:[]})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes, allergies",selected:'yes'===l.allergy,onPress:()=>y({allergy:'yes'})})})]}),'none'===l.allergy&&o.length?(0,v.jsx)(h.Muted,{children:"Your profile allergies above are still shared with the kitchen."}):null,'yes'===l.allergy?(0,v.jsxs)(n.default,{style:{gap:10},testID:"allergen-picker",children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"Which allergens? (the 14 UK allergens)"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[w.map(e=>(0,v.jsx)(h.Chip,{label:e.short,selected:l.allergens.includes(e.id)||o.some(l=>l.allergen===e.id),disabled:o.some(l=>l.allergen===e.id),onPress:()=>y({allergens:l.allergens.includes(e.id)?l.allergens.filter(l=>l!==e.id):[...l.allergens,e.id]})},e.id)),x?null:(0,v.jsx)(h.Chip,{label:"All 14\u2026",onPress:()=>j(!0)})]}),(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"How serious?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:m.SEVERITIES.map(e=>(0,v.jsx)(h.Chip,{label:e.label,selected:l.severity===e.id,onPress:()=>y({severity:e.id})},e.id))}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many people with allergies?"}),(0,v.jsx)(h.Stepper,{value:Math.min(l.allergyPeople,r),onChange:e=>y({allergyPeople:e}),min:1,max:Math.max(1,r),label:"people with allergies"})]}),(0,v.jsx)(h.Field,{label:"Anything else the kitchen should know? (optional)",value:l.allergyNote,onChangeText:e=>y({allergyNote:e}),placeholder:"e.g. traces of sesame, one child with coeliac disease",testID:"allergy-note"}),q.length?(0,v.jsx)(c.MenuAllergyCheck,{rid:e,allergens:q,audience:i}):null]}):null]}),k?(0,v.jsxs)(R,{tone:"gold",testID:"q-dogs",children:[(0,v.jsx)(C,{sub:M?'Well-behaved dogs are welcome at our dog-friendly tables.':'staff'===i?'Dog-friendly tables aren\u2019t marked yet (Managers \u203a Booking options), so any table is offered for now.':void 0,children:"\ud83d\udc15 Are you bringing a dog?"}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No",selected:!1===l.dog,onPress:()=>y({dog:!1})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes",selected:!0===l.dog,onPress:()=>y({dog:!0,dogs:Math.max(1,l.dogs)})})})]}),l.dog?(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many dogs?"}),(0,v.jsx)(h.Stepper,{value:l.dogs,onChange:e=>y({dogs:e}),min:1,max:4,label:"dogs"})]}):null]}):null]})},_e.useReserveAvailability=q,_e.MoreQuestions=function({rid:e,r:l,value:a,onChange:r,party:i,date:o,time:c,today:y,bookings:m,audience:b,showTables:x}){const j=e=>r({...a,...e}),w=l.settings,S=(0,u.useMenu)(e),P=(0,t.useMemo)(()=>S.filter(e=>/\((V|VG|Ve)\)|vegan|vegetarian/i.test(`${e.name} ${e.tags?.join(' ')??''}`)).slice(0,4),[S.length]),N=q(e,l,o,y,m,b),T=e=>a.holds[e]??0,D=(0,f.stockNeed)({holds:Object.entries(a.holds).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.indexOf(':')>=0?e.slice(e.indexOf(':')+1):e,qty:l}))},N.items),$=(e,l)=>Math.min(10,...e.map(e=>{const s=(D[e.key]??0)-T(l)*e.qty;return Math.floor(((N.free[e.key]??0)-s)/e.qty)})),I=(e,l,s,t)=>{const r=T(e),i=t<=0&&0===r;return(0,v.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'center',gap:10,opacity:i?.55:1},testID:`reserve-${e.replace(':','-')}`,children:[(0,v.jsxs)(n.default,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(h.T,{weight:"semibold",children:l}),(0,v.jsx)(h.Muted,{children:i?'Unavailable \u2014 none left for this day':s})]}),i?(0,v.jsx)(h.Badge,{kind:"neutral",label:"Unavailable"}):(0,v.jsx)(h.Stepper,{value:r,onChange:l=>j({holds:{...a.holds,[e]:Math.max(0,Math.min(l,Math.max(r,t)))}}),min:0,max:Math.max(r,Math.min(10,t)),label:l})]},e)},O=N.items.length>0||!1!==w.reserveStock&&N.stock.length>0,A=(0,p.usePlan)(e);return(0,v.jsxs)(v.Fragment,{children:[(0,s.accessQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-access",children:[(0,v.jsx)(C,{sub:"Optional. Tell us and we\u2019ll have the right table ready.",children:"\u267f Access needs"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Wheelchair users"}),(0,v.jsx)(h.Stepper,{value:a.wheelchair,onChange:e=>j({wheelchair:e}),min:0,max:Math.max(1,i),label:"wheelchair users"})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"Step-free access",selected:a.stepFree,onPress:()=>j({stepFree:!a.stepFree})}),(0,v.jsx)(h.Chip,{label:"Accessible toilet",selected:a.toilet,onPress:()=>j({toilet:!a.toilet})}),(0,v.jsx)(h.Chip,{label:"Assistance dog",selected:a.assistDog,onPress:()=>j({assistDog:!a.assistDog})})]}),(0,v.jsx)(h.Field,{label:"Anything else? (optional)",value:a.accessNote,onChangeText:e=>j({accessNote:e}),placeholder:"e.g. needs a chair with arms"}),w.accessStatement?.trim()?(0,v.jsx)(h.Muted,{children:w.accessStatement.trim()}):null]}):null,(0,s.dietQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-veg",children:[(0,v.jsx)(C,{sub:"We\u2019d love to look after you. Optional.",children:"\u24cb Any vegans or vegetarians?"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegan"}),(0,v.jsx)(h.Stepper,{value:a.vegan,onChange:e=>j({vegan:e}),min:0,max:Math.max(1,i),label:"vegans"})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegetarian"}),(0,v.jsx)(h.Stepper,{value:a.vegetarian,onChange:e=>j({vegetarian:e}),min:0,max:Math.max(1,i),label:"vegetarians"})]}),!1!==w.vegTeaser&&P.length&&(a.vegan||a.vegetarian)?(0,v.jsxs)(h.Muted,{children:["On the menu: ",P.map(e=>e.name).join(' \xb7 ')]}):null]}):null,O?(0,v.jsxs)(R,{tone:"gold",testID:"q-reserve",children:[(0,v.jsx)(C,{sub:N.known?'Held for you from today\u2019s count.':o>y||'guest'===b?'Held for you; the kitchen confirms and orders in.':void 0,children:"\ud83e\udd9e Reserve with your table"}),N.items.map(e=>I(`item:${e.id}`,`${e.name}${k(e.price)}`,e.description||e.uses.map(e=>`${e.qty} ${N.stock.find(l=>l.key===e.key)?.name.toLowerCase()??e.key}`).join(' + '),$(e.uses,`item:${e.id}`))),!1!==w.reserveStock?N.stock.map(e=>I(`stock:${e.key}`,`Reserve ${e.name.toLowerCase()}`,N.known?`${N.free[e.key]} available today`:'Held for the kitchen to order',$([{key:e.key,qty:1}],`stock:${e.key}`))):null,'staff'===b&&N.known?(0,v.jsxs)(h.Muted,{children:["Today: ",N.stock.map(e=>`${N.free[e.key]} ${e.plural.toLowerCase()} free (${N.reserved[e.key]??0} reserved)`).join(' \xb7 ')]}):null]}):null,x&&!1!==w.tableRequests&&A.tables.length?(0,v.jsx)(M,{rid:e,value:a,onChange:r,party:i,hide:w.tableRequestHide??[]}):null]})},_e.dogTimeOk=function(e,l,s,t,a){if(!a)return!0;const n=e.settings.maxDogsPerSlot;return!n||(0,f.dogsAt)(l,s,t)+a<=n},Object.defineProperty(_e,"accessibleSetUp",{enumerable:!0,get:function(){return f.accessibleSetUp}});var e,l=_r(d[0]),s=_r(d[1]),t=_r(d[2]),a=_r(d[3]),n=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),i=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),p=_r(d[10]),y=_r(d[11]),m=_r(d[12]),b=_r(d[13]),x=_r(d[14]),f=_r(d[15]),j=_r(d[16]),v=_r(d[17]);const k=e=>'display'===x.APP_VARIANT?'':` \xb7 ${(0,b.gbp)(e)}`,w=()=>({allergy:null,allergens:[],severity:'allergy',allergyPeople:1,allergyNote:'',dog:null,dogs:1,wheelchair:0,stepFree:!1,toilet:!1,assistDog:!1,accessNote:'',vegan:0,vegetarian:0,holds:{},tableReq:[]});const R=({children:e,tone:l,testID:s})=>(0,v.jsx)(n.default,{testID:s,style:{gap:10,padding:16,borderRadius:16,borderWidth:'plain'===l?1:1.5,borderColor:'red'===l?j.colours.red:'gold'===l?j.colours.accentBorder:j.colours.hairline,backgroundColor:'red'===l?'#1E1110':j.colours.surface},children:e}),C=({children:e,sub:l})=>(0,v.jsxs)(n.default,{style:{gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:e}),l?(0,v.jsx)(h.Muted,{children:l}):null]});function q(e,l,s,t,a,n,i){const o=(0,f.reservablesOf)(l),c=(0,y.useStockItems)(e),h=(0,y.useShellStore)((0,r.useShallow)(l=>(0,y.venueCounts)(l,e))),u=(0,y.useShellStore)(l=>!!l.server[e]),p=(0,f.reservedOn)(a,s,o,i),m=s===t&&('staff'===n||u),b={};for(const e of c)b[e.key]=m?Math.max(0,Math.floor((h[e.key]??0)-(p[e.key]??0))):1/0;return{items:o,stock:c,free:b,reserved:p,known:m}}function M({rid:e,value:s,onChange:a,party:r,hide:c}){const u=(0,p.usePlan)(e),y=u.areas.filter(e=>u.tables.some(l=>l.areaId===e.id&&!c.includes(l.name))),[m,b]=(0,t.useState)(y[0]?.id??''),x=s.dog?s.dogs:0,k=e=>c.includes(e)?'Not bookable':(0,f.tableBlockReason)(u,e,r,x,s.wheelchair>0||s.stepFree),w=Object.fromEntries(u.tables.map(e=>[e.name,{table:e,status:k(e.name)?'blocked':'free',covers:0,allergy:!1}])),q=e=>{if(k(e))return;const l=s.tableReq.includes(e)?s.tableReq.filter(l=>l!==e):[...s.tableReq,e].slice(-2);a({...s,tableReq:l})},M=u.tables.filter(e=>e.areaId===m&&!c.includes(e.name));return(0,v.jsxs)(R,{tone:"plain",testID:"q-table",children:[(0,v.jsx)(C,{sub:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best.",children:"\ud83e\ude91 Request a table (optional)"}),y.length>1?(0,v.jsx)(i.AreaTabs,{plan:u,area:m,onPick:b}):null,(0,v.jsx)(n.default,{testID:"q-table-plan",style:{height:240,borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:j.colours.hairline},children:(0,v.jsx)(o.FloorCanvas,{plan:u,areaId:m,mode:"live",view:w,privacy:!0,fit:"contain",crop:!0,maxH:260,highlight:s.tableReq,onTap:e=>q(e.name)})}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>{const t=k(e.name),a=s.tableReq.indexOf(e.name);return(0,v.jsx)(h.Chip,{label:`${(0,l.tableNumbers)(e.name)}`,sub:t||(0===a?'1st choice':1===a?'2nd choice':`${e.maxSeats} seats`),selected:a>=0,disabled:!!t,onPress:()=>q(e.name)},e.name)})}),s.tableReq.length?(0,v.jsxs)(h.T,{size:14,colour:j.colours.goldLight,children:["Requested: ",s.tableReq.map((e,s)=>`${(0,l.tableNumbers)(e)}${s?' (2nd choice)':''}`).join(', ')]}):(0,v.jsx)(h.Muted,{children:"Tap a table; tap another for a second choice."})]})}},831,[812,814,31,128,884,955,954,1408,818,823,829,1087,819,820,807,832,825,25]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ACTIVE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ANCHORAGE_RESERVABLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"reservablesOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"holdId",{enumerable:!0,get:function(){return s}}),e.stockNeed=a,e.reservedBookingsOn=function(t,r,o,i){return t.filter(t=>t.date===r&&n(t)&&'finished'!==t.status).map(t=>({booking:t,qty:a(t,o)[i]??0})).filter(t=>t.qty>0).sort((t,r)=>t.booking.time.localeCompare(r.booking.time))},e.reservedOn=c,e.usedOn=function(t,r,n){const o={};for(const i of t)if(i.date===r)for(const t of i.holds??[])if(t.served)for(const[r,s]of Object.entries(a({...i,holds:[{...t,served:void 0}]},n)))o[r]=(o[r]??0)+s;return o},e.heldSummary=function(t,r,o){const i={},a={};for(const o of t)if(o.date===r&&n(o))for(const t of o.holds??[])if(!t.served){const r=s(t.id);'item'===t.kind?i[r]=(i[r]??0)+t.qty:a[r]=(a[r]??0)+t.qty}return{platters:Object.values(i).reduce((t,r)=>t+r,0),byItem:i,single:a,stock:c(t,r,o)}},e.holdsText=function(t,r,n){return(t.holds??[]).filter(t=>t.qty>0).map(t=>{const o=s(t.id);return`${'item'===t.kind?l(r.find(t=>t.id===o)?.name??'Reserved item'):n.find(t=>t.key===o)?.name??o} x${t.qty}${t.served?' (served)':''}`}).join(', ')},Object.defineProperty(e,"shortItem",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"needsAllergenSeen",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"needsHoldOk",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"hasAllergens",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"allergenText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"dogCount",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"hasAccess",{enumerable:!0,get:function(){return p}}),e.accessText=function(t){const r=t.access;return r?[r.wheelchair?`${r.wheelchair} wheelchair user${1===r.wheelchair?'':'s'}`:'',r.stepFree?'step-free access':'',r.toilet?'accessible toilet':'',r.assistDog?'assistance dog':'',r.note?.trim()??''].filter(Boolean).join(', '):''},Object.defineProperty(e,"dietText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"accessibleSetUp",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"dogSetUp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"isAccessible",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isDogOk",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dogsAt",{enumerable:!0,get:function(){return P}}),e.tableBlockReason=function(t,n,o,i,s){const a=t.tables.find(t=>t.name===n);return a?a.maxSeats0&&k(t)&&!(0,r.tableDogOk)(t,a)?'No dogs here':s&&O(t)&&!a.accessible?'Not step-free':'':'Not available'},Object.defineProperty(e,"holidayName",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"coverDone",{enumerable:!0,get:function(){return w}}),e.shownStatus=$,e.seatedCoversOn=function(t,r){return t.filter(t=>t.date===r&&['seated','finished'].includes($(t))).reduce((t,r)=>t+(r.partySize||0),0)},e.laterTodayCovers=function(t,r){return t.filter(t=>t.date===r&&!t.walkIn&&'walk-in'!==t.source&&['confirmed','pending'].includes($(t))).reduce((t,r)=>t+(r.partySize||0),0)},Object.defineProperty(e,"laterTodayLine",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"isWalkInBooking",{enumerable:!0,get:function(){return q}}),e.partiesLine=function(t){const r=t.filter(n),o=r.filter(t=>!q(t)).length,i=r.length-o;return`${o} ${1===o?'booking':'bookings'} \xb7 ${i} ${1===i?'walk-in':'walk-ins'}`},Object.defineProperty(e,"COVERS_FOUR_LABELS",{enumerable:!0,get:function(){return N}}),e.coversFour=T,e.coversCard=function(t,r,o){const i=t.filter(t=>t.date===r&&n(t)),s=t=>t.reduce((t,r)=>t+(r.partySize||0),0);return{...T(t,r),booked:s(i.filter(t=>!q(t))),walkIns:s(i.filter(q))}},e.coversToday=function(t,r){return T(t,r)};var t=_r(_d[0]),r=_r(_d[1]);const n=t=>!['cancelled','noshow'].includes(t.status),o=[{id:'seafood-platter-2',name:'Seafood Platter for 2',price:16e3,description:'Whole crab and lobster with all the trimmings, for two to share.',uses:[{key:'crab',qty:1},{key:'lobster',qty:1}],active:!0}],i=t=>(t?.settings.reservables??('anchorage'===t?.id?o:[])).filter(t=>t.active),s=t=>t.startsWith(':')?t.slice(1):t;function a(t,r,n=!1){const o={};for(const i of t.holds??[]){if(i.served&&!n)continue;const t=s(i.id);if('stock'===i.kind)o[t]=(o[t]??0)+i.qty;else for(const n of r.find(r=>r.id===t)?.uses??[])o[n.key]=(o[n.key]??0)+n.qty*i.qty}return o}function c(t,r,o,i){const s={};for(const c of t)if(c.date===r&&n(c)&&'finished'!==c.status&&c.id!==i)for(const[t,r]of Object.entries(a(c,o)))s[t]=(s[t]??0)+r;return s}const l=t=>/platter/i.test(t)?'Platter':t.replace(/ for \d+$/i,''),d=t=>n(t)&&(t.allergies.length>0||!!t.allergyNote?.trim())&&!t.allergyAck,u=t=>n(t)&&(t.holds??[]).some(t=>t.qty>0&&!t.served)&&!t.holdOk,f=t=>t.allergies.length>0||!!t.allergyNote?.trim(),b=r=>[r.allergies.map(r=>(0,t.allergenLabel)(r.allergen)).join(', '),r.allergyNote?.trim()].filter(Boolean).join(' \xb7 ')+(r.allergyPeople?` (${r.allergyPeople} ${1===r.allergyPeople?'person':'people'})`:''),y=t=>t.dogs??(t.dog?1:0),p=t=>!(!t.access||!(t.access.wheelchair||t.access.stepFree||t.access.toilet||t.access.assistDog||t.access.note?.trim()));const h=t=>[t.diet?.vegan?`${t.diet.vegan} vegan`:'',t.diet?.vegetarian?`${t.diet.vegetarian} vegetarian`:''].filter(Boolean).join(', '),O=t=>t.tables.some(t=>t.accessible),k=t=>t.tables.some(t=>void 0!==t.dogOk)||t.areas.some(t=>t.dogs),v=(t,r)=>r.split('+').every(r=>!!t.tables.find(t=>t.name===r.trim())?.accessible),j=(t,n)=>n.split('+').every(n=>{const o=t.tables.find(t=>t.name===n.trim());return!!o&&(0,r.tableDogOk)(t,o)}),P=(t,r,o,i)=>t.filter(t=>t.id!==i&&t.date===r&&t.time===o&&n(t)).reduce((t,r)=>t+y(r),0);const S=t=>t.replace(/\s*\(substitute day\)/gi,'').trim(),w=t=>'finished'===t.status;function $(t){if('seated'===t.status&&t.seatedAt){const r=new Date(t.seatedAt);if((isNaN(r.getTime())?t.date:r.toLocaleDateString('en-CA',{timeZone:'Europe/London'}))t>0?`${t} more ${1===t?'cover':'covers'} booked for later today.`:'No more bookings for later today.',q=t=>!!t.walkIn||'walk-in'===t.source;const N=['Done','Seated','To come','Total'];function T(t,r){const o=t.filter(t=>t.date===r&&n(t)),i=t=>t.reduce((t,r)=>t+(r.partySize||0),0),s=i(o.filter(w)),a=i(o.filter(t=>!w(t)&&'seated'===$(t))),c=i(o.filter(t=>!q(t)&&['confirmed','pending'].includes($(t))));return{done:s,seated:a,toCome:c,total:s+a+c}}},832,[819,1071]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SEASONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hourSetsOf",{enumerable:!0,get:function(){return n}}),e.seasonOn=s,e.kitchenHoursOn=l,e.hoursFor=function(r,n){const u=l(r,n);return u?{open:(0,t.atTime)(n,u[0]),close:(0,t.atTime)(n,u[1])}:null};var t=_r(_d[0]);const r=[{id:'winter',name:'Winter',hours:{0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']}},{id:'summer',name:'Summer',hours:null}],n=t=>t.settings.hourSets??('anchorage'===t.id?r:[]),u=t=>`${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,o=t=>`${t.getFullYear()}-${u(t)}`;function s(t,r){const o=n(t).filter(t=>t.hours);if(!o.length)return null;const s=o.filter(t=>t.start).sort((t,r)=>t.start.localeCompare(r.start));if(s.length<2)return s[0]??o[0];const l=u(r);return[...s].reverse().find(t=>t.start<=l)??s[s.length-1]}function l(t,r){const n=(t.settings.hourOverrides??[]).find(t=>t.date===o(r));if(n)return n.hours;const u=s(t,r);return u?.hours?u.hours[r.getDay()]??null:t.kitchenHours[r.getDay()]??null}},833,[822]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},834,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GoldX=h,_e.GoldClose=j,Object.defineProperty(_e,"TEXT_ONLY_CLOSE",{enumerable:!0,get:function(){return x}}),_e.ToastClose=function({onPress:e,label:o="Close",testID:s,size:l="md",style:c,colour:h}){return x?(0,b.jsx)(t.default,{testID:s,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:[{minWidth:64,minHeight:48,alignItems:'center',justifyContent:'center',paddingHorizontal:8},c],children:(0,b.jsx)(u.Text,{style:{fontSize:16,color:h??n.colours.text},children:"Close"})}):(0,b.jsx)(j,{onPress:e,label:o,testID:s,size:l,style:c})},r(d[0]);var t=e(r(d[1])),o=e(r(d[2])),s=r(d[3]),l=e(s),n=r(d[4]),c=r(d[5]),u=r(d[6]),b=r(d[7]);function h({size:e=16,colour:t=n.colours.gold,stroke:o}){const c=o??(e>=20?2.4:2.2);return(0,b.jsx)(l.default,{width:e,height:e,viewBox:"0 0 24 24",accessible:!1,focusable:!1,pointerEvents:"none",children:(0,b.jsx)(s.Path,{d:"M6 6 L18 18 M18 6 L6 18",stroke:t,strokeWidth:Math.min(4,c*(24/e)),strokeLinecap:"round",fill:"none"})})}const f={sm:32,md:38,lg:46},y={sm:13,md:15,lg:18};function j({onPress:e,label:s="Close",testID:l,size:c="md",style:u,disabled:j,hint:x}){const C=f[c],I=Math.max(44,C+8);return(0,b.jsx)(t.default,{testID:l,accessibilityRole:"button",accessibilityLabel:s,accessibilityHint:x,disabled:j,onPress:e,dataSet:{goldClose:'1'},style:[{width:I,height:I,alignItems:'center',justifyContent:'center',flexShrink:0,opacity:j?.4:1},u],children:({pressed:e,hovered:t})=>(0,b.jsx)(o.default,{style:{width:C,height:C,borderRadius:C/2,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:e||t?n.colours.gold:n.colours.accentBorder,backgroundColor:e?n.colours.goldTint:t?n.colours.accentBg:'rgba(0,0,0,0.18)'},children:(0,b.jsx)(h,{size:y[c],colour:e?n.colours.goldLight:n.colours.gold})})})}const x=['kirkton','abbotsford'].includes(c.VENUE_RID)},835,[31,264,128,989,825,5,874,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return l}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,l=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},836,[995]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:l,declared:s}){return(0,c.jsxs)(a.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,c.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(d.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,n.isLiveVenue)()?null:(0,c.jsx)(d.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,c.jsx)(a.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:t.ALLERGENS.map(e=>{const n=l[e.id],u=s.find(l=>l.allergen===e.id),f='contains'===n?o.colours.redBg:'may'===n?o.colours.amberBg:o.colours.surface2,h='contains'===n?'#FFD9D4':'may'===n?'#FFE2A8':o.colours.muted;return(0,c.jsxs)(a.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:u?2:1,borderColor:u?o.colours.red:o.colours.border},children:[(0,c.jsx)(d.T,{size:14,weight:"medium",colour:n?h:o.colours.text,children:e.label}),(0,c.jsxs)(d.T,{size:13,colour:h,children:['contains'===n?'Contains':'may'===n?'May contain':'Not listed',u?` \xb7 YOUR ALLERGY (${(0,t.severityLabel)(u.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,c.jsxs)(d.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,c.jsx)(a.default,{testID:"allergen-signoff",children:(0,c.jsx)(d.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${u(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,c.jsx)(d.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:l,declared:n,signedOff:s}){const a=Object.entries(l);return a.length?(0,c.jsx)(d.Row,{wrap:!0,gap:5,children:a.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,l])=>{const s=n.some(l=>l.allergen===e);return(0,c.jsx)(d.Badge,{label:`${s?'\u26a0 ':''}${(0,t.allergenLabel)(e)}${'may'===l?' (may)':''}`,kind:s?'contains'===l?'red':'amber':'neutral'},e)})}):(0,c.jsx)(d.Muted,{children:(0,e.noAllergenWords)(s)})};var e=r(_d[0]);r(_d[1]);var l,n=r(_d[2]),s=r(_d[3]),a=(l=s)&&l.__esModule?l:{default:l},t=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]);const u=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},837,[1235,31,1098,128,819,825,818,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BasketButton=function(){const s=(0,l.useBasket)().lines.reduce((e,s)=>e+s.qty,0);return s?(0,c.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Basket, ${s} items`,onPress:()=>e.router.push('/customer/basket'),style:{backgroundColor:u.colours.gold,borderRadius:999,paddingHorizontal:12,paddingVertical:6},children:(0,c.jsxs)(n.T,{weight:"semibold",colour:u.colours.onGold,size:14,children:["Basket \xb7 ",s]})}):null};var e=r(d[0]);r(d[1]);var s,t=r(d[2]),o=(s=t)&&s.__esModule?s:{default:s},l=r(d[3]),u=r(d[4]),n=r(d[5]),c=r(d[6])},838,[805,31,264,823,825,818,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setRecipeCardRepository=function(n){t=n,r.forEach(t=>t())},e.recipeCards=function(){if(!t)throw new Error('Recipe card repository not set up');return t},Object.defineProperty(e,"hasRecipeCards",{enumerable:!0,get:function(){return n}}),e.onRepositorySwap=function(t){return r.add(t),()=>{r.delete(t)}};let t=null;const r=new Set;const n=()=>!!t},839,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Stars=function({value:e,onChange:s,size:n=36}){return(0,c.jsx)(t.Row,{gap:6,children:[1,2,3,4,5].map(u=>(0,c.jsx)(l.default,{disabled:!s,accessibilityRole:"button",accessibilityLabel:`${u} star${u>1?'s':''}`,onPress:()=>s?.(u),hitSlop:4,children:(0,c.jsx)(t.T,{size:n,colour:u<=e?o.colours.gold:'#555',children:"\u2605"})},u))})},r(d[0]);var e,s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),c=r(d[4])},840,[31,264,825,818,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},841,[31,123,264,128,884,818,825,980,1469,1470,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_VENUE_SLUGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LIVE_VENUE_BUILD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return n}});var c=r(d[0]);const b=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"],f=b.includes(c.VENUE_RID),n=c=>b.includes(c)||['6349aa07-3fec-46e9-8c69-7b1b08494793','41ce63ca-ae46-432d-a5ba-25e1b801e64d','43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6','47f86b36-4c99-466a-be9c-30eb3d79f1e1','e0afad1d-cbc1-414a-add6-92e47d302139','24624ea5-d1e3-4182-b0d1-73402b8a1532','1bc2a056-2ef6-4585-abfd-b7d21c84f215',"59766322-119e-4036-a18a-f6909f60a8d2","596c6f7e-9797-4e16-84fe-db4a99fa1bdc","5d500571-e205-4ead-bb58-60e986b6f40e","f43f20ad-55d0-4008-88c8-7738dc1698df","6abc2793-93ab-4e23-a705-b4011a5cc011","78bff97d-5f07-440a-bb99-f6a6118da7a3","cd985ff5-2443-458d-ac8b-342d553628cf","35f870fc-772c-4aad-bb9e-09a9a16bc925","f500ef12-b405-438b-9671-e54289bec5dd"].includes(c)},842,[5]); +__d(function(_g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MockPay=function({visible:e,onClose:h,amount:p,restaurantId:j,allowGiftCard:b=!0,onPaid:x,title:f="Pay"}){const y=(0,o.useRestaurant)(j),g=(0,o.useGiftCards)(j).filter(e=>e.balance>0),[m,w]=(0,s.useState)(),[P,C]=(0,s.useState)('Test card \u2022\u2022\u2022\u2022 4242'),[T,v]=(0,s.useState)(!1),M=g.find(e=>e.code===m),R=M?Math.min(M.balance,p):0,_=p-R;if(!y?.fictional)return(0,u.jsxs)(c.Sheet,{visible:e,onClose:h,title:f,children:[(0,u.jsxs)(c.T,{children:["Online card payment isn\u2019t set up for this yet, so nothing can be paid here. Please ask at the restaurant",y?.phone?` or phone ${y.phone}`:'',"."]}),(0,u.jsx)(c.Button,{kind:"secondary",label:"Close",onPress:h})]});return(0,u.jsxs)(c.Sheet,{visible:e,onClose:h,title:f,children:[(0,u.jsx)(c.DemoPaymentNotice,{}),b&&g.length>0?(0,u.jsxs)(l.default,{style:{gap:6},children:[(0,u.jsx)(c.T,{weight:"semibold",children:"Use a gift card"}),(0,u.jsxs)(c.Row,{wrap:!0,children:[(0,u.jsx)(c.Chip,{label:"None",selected:!m,onPress:()=>w(void 0)}),g.map(e=>(0,u.jsx)(c.Chip,{label:`${e.code.slice(0,8)}\u2026`,sub:`${(0,n.gbp)(e.balance)} left`,selected:m===e.code,onPress:()=>w(e.code)},e.id))]})]}):null,(0,u.jsx)(c.T,{weight:"semibold",children:"Payment method"}),(0,u.jsx)(c.Row,{wrap:!0,children:['Test card \u2022\u2022\u2022\u2022 4242','Apple Pay (test)','Google Pay (test)'].map(e=>(0,u.jsx)(c.Chip,{label:e,selected:P===e,onPress:()=>C(e)},e))}),(0,u.jsxs)(l.default,{style:{gap:2},children:[(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.Muted,{children:"Amount"}),(0,u.jsx)(c.T,{children:(0,n.gbp)(p)})]}),R?(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.Muted,{children:"Gift card"}),(0,u.jsxs)(c.T,{colour:r.colours.ok,children:["\u2212",(0,n.gbp)(R)]})]}):null,(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.T,{weight:"semibold",children:"To pay now"}),(0,u.jsx)(c.T,{weight:"bold",size:20,colour:r.colours.gold,children:(0,n.gbp)(_)})]})]}),T?(0,u.jsx)(t.default,{color:r.colours.gold}):(0,u.jsx)(c.Button,{label:`Pay ${(0,n.gbp)(_)} \u2014 demo`,onPress:()=>{v(!0),setTimeout(()=>{v(!1),x({giftCardCode:m,giftApplied:R,method:P})},700)},testID:"mock-pay-confirm"})]})};var s=_r(d[0]),t=e(_r(d[1])),l=e(_r(d[2])),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7])},843,[31,247,128,823,820,825,818,25]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftLive=function({slug:e,venue:n}){const{info:x,mine:b,err:S,load:w,pay:k}=j(e),[T,P]=(0,t.useState)(null),[D,C]=(0,t.useState)(''),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(''),[I,M]=(0,t.useState)(''),[E,L]=(0,t.useState)(!1),[R,A]=(0,t.useState)(''),[_,H]=(0,t.useState)(null),F=f(e);if(!x)return(0,h.jsx)(a.Screen,{title:"Gift cards",subtitle:n,children:S?(0,h.jsx)(a.Banner,{kind:"warn",title:S}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const N=D?(0,o.poundsToPence)(D)??0:T??x.amounts[1]??x.amounts[0]??0;return(0,h.jsxs)(a.Screen,{title:"Gift cards",subtitle:`${n}: used only at ${n}`,children:[_?(0,h.jsx)(s.default,{testID:"gift-made",children:(0,h.jsx)(a.Card,{highlight:u.colours.gold,children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift card code"}),(0,h.jsx)(a.T,{size:26,weight:"bold",colour:u.colours.gold,center:!0,children:_.code}),(0,h.jsxs)(a.Muted,{center:!0,children:["Shown once and kept on this phone. Write it down or take a screenshot to give it to ",O||'them',"."]}),(0,h.jsxs)(a.Banner,{kind:"warn",title:`Pay ${(0,l.gbp)(_.pence)} at the bar or till`,children:["Show reference ",_.ref,". The card works once staff mark it paid.",k.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"gift",id:_.id,pay:k})]})})}):null,(0,h.jsx)(g,{onDone:w}),(0,h.jsx)(s.default,{testID:"gift-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift cards"}),b.cards.length?b.cards.map(t=>(0,h.jsxs)(s.default,{style:{gap:2},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{style:{flex:1},children:F[t.id]??`\u2022\u2022\u2022\u2022 ${t.last4}`}),(0,h.jsxs)(a.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balancePence)," of ",(0,l.gbp)(t.initialPence)]})]}),(0,h.jsxs)(a.Muted,{size:12,children:[o.STATUS_WORDS[t.status]??t.status,t.expiresAt?` \xb7 use by ${p(t.expiresAt)}`:'','waiting-payment'===t.status?` \xb7 reference ${t.ref}`:'']}),'waiting-payment'===t.status&&_?.id!==t.id?(0,h.jsx)(m,{slug:e,kind:"gift",id:t.id,pay:k}):null]},t.id)):(0,h.jsx)(a.Muted,{children:"None yet."})]})})}),x.giftsOn?(0,h.jsx)(s.default,{testID:"gift-buy",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:8},children:[(0,h.jsx)(a.H2,{children:"Buy a gift card"}),(0,h.jsx)(a.Row,{wrap:!0,children:x.amounts.map(e=>(0,h.jsx)(a.Chip,{label:(0,l.gbp)(e),selected:!D&&N===e,onPress:()=>{C(''),P(e)}},e))}),(0,h.jsx)(a.Field,{label:`Or another amount (\xa3${x.minPence/100} to \xa3${x.maxPence/100})`,keyboardType:"decimal-pad",value:D,onChangeText:C,placeholder:"e.g. 40",testID:"gift-custom"}),(0,h.jsx)(a.Field,{label:"Who it\u2019s for",value:O,onChangeText:$,testID:"gift-recipient"}),(0,h.jsx)(a.Field,{label:"From",value:v,onChangeText:B}),(0,h.jsx)(a.Field,{label:"Message",value:I,onChangeText:M,multiline:!0,placeholder:"Happy birthday!"}),(0,h.jsxs)(a.Muted,{size:12,children:["Use within ",(0,o.expiryWords)(x.expiryMonths)," of paying. Part-use leaves a balance.",x.terms?` ${x.terms}`:'']}),(0,h.jsx)(s.default,{testID:"gift-pay-placeholder",children:(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER})}),R?(0,h.jsx)(a.Banner,{kind:"warn",title:R}):null,(0,h.jsx)(a.Button,{label:E?'Saving\u2026':`Get a ${(0,l.gbp)(N)} gift card, pay at the till`,testID:"gift-buy-btn",disabled:E||Nx.maxPence,onPress:async()=>{L(!0),A('');try{const t=await(0,c.buyGift)(e,{amount:N,recipient:O,from:v,message:I});t.code&&y(e,t.id,t.code),H({id:t.id,code:t.code??'',ref:t.ref,pence:t.initialPence}),w()}catch(e){A((0,r.plainError)(e))}finally{L(!1)}}})]})})}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n} isn\u2019t selling gift cards in the app yet`,children:"Ask at the bar."})]})},_e.ShopLive=function({slug:e,venue:n,guestName:p}){const{info:x,mine:f,err:y,load:b,pay:S}=j(e),[w,k]=(0,t.useState)({}),[T,P]=(0,t.useState)(p),[D,C]=(0,t.useState)(!1),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(null);if(!x)return(0,h.jsx)(a.Screen,{title:"Shop",subtitle:n,children:y?(0,h.jsx)(a.Banner,{kind:"warn",title:y}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const I=Object.entries(w).filter(([,e])=>e>0).map(([e,t])=>({id:e,qty:t})),M=(0,o.basketTotal)(I,x.products);return(0,h.jsxs)(a.Screen,{title:"Shop",subtitle:`${n}: collect at the venue`,children:[v?(0,h.jsxs)(s.default,{testID:"shop-done",children:[(0,h.jsxs)(a.Banner,{kind:"warn",title:`Order ${v.ref}: pay ${(0,l.gbp)(v.total)} at the bar or till`,children:["Staff will have it ready to collect once it\u2019s paid.",S.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"shop",id:v.id,pay:S})]}):null,(0,h.jsx)(g,{onDone:b}),x.shopOn?(0,h.jsxs)(h.Fragment,{children:[x.products.length?x.products.map(e=>(0,h.jsx)(s.default,{testID:`shop-item-${e.id}`,children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,h.jsx)(a.T,{colour:u.colours.gold,children:(0,l.gbp)(e.pricePence)})]}),e.details?(0,h.jsx)(a.Muted,{children:e.details}):null,e.soldOut?(0,h.jsx)(a.Badge,{kind:"amber",label:"Sold out"}):(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(a.Muted,{children:"How many"}),(0,h.jsx)(a.Stepper,{value:w[e.id]??0,min:0,max:20,label:`${e.name} quantity`,onChange:t=>k({...w,[e.id]:t})})]})]})})},e.id)):(0,h.jsx)(a.Muted,{children:"Nothing in the shop yet."}),I.length?(0,h.jsx)(s.default,{testID:"shop-basket",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",children:"Total"}),(0,h.jsx)(a.T,{weight:"semibold",colour:u.colours.gold,children:(0,l.gbp)(M)})]}),(0,h.jsx)(a.Field,{label:"Name for collection",value:T,onChangeText:P,testID:"shop-name"}),(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER}),O?(0,h.jsx)(a.Banner,{kind:"warn",title:O}):null,(0,h.jsx)(a.Button,{label:D?'Sending\u2026':'Order, pay at the till',testID:"shop-order-btn",disabled:D||!T.trim(),onPress:async()=>{C(!0),$('');try{const t=await(0,c.shopOrder)(e,I,T);B({id:t.id,ref:t.ref,total:t.totalPence}),k({}),b()}catch(e){$((0,r.plainError)(e))}finally{C(!1)}}})]})})}):null]}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n}\u2019s shop isn\u2019t open in the app yet`,children:"Ask at the bar."}),f.orders.length?(0,h.jsx)(s.default,{testID:"shop-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsx)(a.H2,{children:"Your shop orders"}),f.orders.map(e=>(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(a.T,{style:{flex:1},children:[e.ref," \xb7 ",e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')]}),(0,h.jsx)(a.Muted,{children:o.STATUS_WORDS[e.status]??e.status})]},e.ref))]})})}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},a=_r(d[2]),l=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]);const p=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},x=e=>`cc-gift-codes:${e}:v1`;function f(e){try{return JSON.parse(globalThis.localStorage?.getItem(x(e))||'{}')}catch{return{}}}function y(e,t,n){try{const s=f(e);s[t]=n,globalThis.localStorage?.setItem(x(e),JSON.stringify(s))}catch{}}function j(e){const[n,s]=(0,t.useState)(null),[a,l]=(0,t.useState)({cards:[],orders:[]}),[o,u]=(0,t.useState)(''),[h,p]=(0,t.useState)({provider:'none',cardOn:!1,testMode:!0}),x=(0,t.useCallback)(()=>{u(''),(0,c.shopPublic)(e).then(s).catch(e=>u((0,r.plainError)(e))),(0,c.myShop)(e).then(l).catch(()=>{}),(0,c.payPublic)(e).then(p)},[e]);return(0,t.useEffect)(()=>{x()},[x]),{info:n,mine:a,err:o,load:x,pay:h}}function g({onDone:e}){const[n,l]=(0,t.useState)('');return(0,t.useEffect)(()=>{const t='undefined'!=typeof window?new URLSearchParams(window.location.search).get('paid'):null;if(!t||!/^[0-9a-f-]{36}$/.test(t))return;let n=0;const s=()=>(0,c.payStatus)(t).then(t=>{l(t.status),'paid'===t.status?e():n++<10&&setTimeout(s,2e3)}).catch(()=>{});s()},[e]),n?(0,h.jsx)(s.default,{testID:"pay-back",children:(0,h.jsx)(a.Banner,{kind:'paid'===n?'success':'warn',title:'paid'===n?'Paid by card (TEST MODE: no real money)':'expired'===n?'The card payment timed out. Pay at the bar or till.':'Checking the card payment\u2026'})}):null}function m({slug:e,kind:n,id:l,pay:o}){const[u,p]=(0,t.useState)(!1),[x,f]=(0,t.useState)('');return o.cardOn?(0,h.jsxs)(s.default,{testID:`pay-card-${n}`,style:{gap:4},children:[(0,h.jsx)(a.Button,{label:u?'Opening card payment\u2026':'Pay by card (TEST MODE)',kind:"secondary",disabled:u,onPress:async()=>{p(!0),f('');try{const t=await(0,c.payStart)(e,n,l);window.location.assign(t.url)}catch(e){f((0,r.plainError)(e))}finally{p(!1)}}}),(0,h.jsx)(a.Muted,{size:12,children:"Test mode: use a Stripe test card. No real money is taken."}),x?(0,h.jsx)(a.Banner,{kind:"warn",title:x}):null]}):null}},844,[31,128,818,820,1073,1074,1075,825,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"guestServer",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"useGuestLoyalty",{enumerable:!0,get:function(){return _}}),e.refreshGuest=async function(t){if(!c())return;_.setState(n=>({loading:{...n.loading,[t]:!0}}));try{const n=await(0,o.rpc)('loyalty_public',{p_venue_slug:t});if(_.setState(r=>({info:{...r.info,[t]:n}})),await(0,o.guestSession)()){const n=await(0,o.rpc)('loyalty_my_card',{p_venue_slug:t});_.setState(r=>({card:{...r.card,[t]:n??null}}))}}finally{_.setState(n=>({loading:{...n.loading,[t]:!1}}))}},e.guestJoin=async function(t,n){if(!await(0,o.guestSession)())throw new Error('No connection. Try again when you are back online.');const r=await(0,o.rpc)('loyalty_guest_join',{p_venue_slug:t,p_name:n.name.trim(),p_phone:n.phone.trim()||null,p_email:n.email.trim()||null,p_consent:n.consent,p_consent_text:n.consentText,p_referral:n.referral?(0,l.cleanCode)(n.referral):null});return p(t,r),r},e.guestClaim=async function(t,n){if(!await(0,o.guestSession)())return{ok:!1,error:'No connection. Try again when you are back online.'};const r=await(0,o.rpc)('loyalty_guest_claim',{p_venue_slug:t,p_code:(0,l.cleanCode)(n)});return r?.error?{ok:!1,error:String(r.error)}:(p(t,r),{ok:!0,card:r,linked:!!r.linked})},e.guestLinkCode=async function(t){return(0,o.rpc)('loyalty_guest_link_code',{p_venue_slug:t})},e.guestLeave=async function(t){await(0,o.rpc)('loyalty_guest_leave',{p_venue_slug:t}),p(t,null)},Object.defineProperty(e,"staffFind",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"staffCard",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"staffStamp",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"staffRedeem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"staffJoin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"staffCode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"staffRemove",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"loyaltySummary",{enumerable:!0,get:function(){return P}}),e.readSettings=async function(){const{data:t,error:n}=await u().from('loyalty_settings').select('*').eq('venue_id',y()).maybeSingle();if(n)throw n;return(0,l.settingsFromRow)(t)},e.saveSettings=async function(t){const{error:n}=await u().from('loyalty_settings').upsert({venue_id:y(),...(0,l.settingsToRow)(t),updated_by:(o.useSync.getState().staffRef??'').slice(0,80)||'manager',updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readOffers=k,e.saveOffer=C,e.watchLoyalty=function(t){if(!f())return()=>{};const n=y();let r=u().channel(`cc-loyalty:${n}:${Math.random().toString(36).slice(2,8)}`);for(const o of['loyalty_settings','loyalty_offers','loyalty_guests','loyalty_stamps','loyalty_rewards','loyalty_referrals'])r=r.on('postgres_changes',{event:'*',schema:'public',table:o,filter:`venue_id=eq.${n}`},()=>t());return r.subscribe(),()=>{try{u().removeChannel(r)}catch{}}},e.migrateLocalOnce=async function(t,n,r){if(!f())return 0;const o=`loyalty:migrated:${y()}`;if(await n(o))return 0;let s=0;if(!(await k()).length)for(const n of t.offers.filter(t=>'offer'===t.kind&&!JSON.stringify(t).includes('(example)')))await C({title:n.title.slice(0,80),details:(n.body??'').slice(0,500),startsOn:null,endsOn:n.until??null,isOn:!!n.live}),s++;return await r(o),s};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=_r(d[3]),s=_r(d[4]),l=_r(d[5]);const u=()=>(0,n.getSupabase)(),c=()=>(0,r.isSupabaseConfigured)()&&!s.PITCH,f=()=>c()&&'staff'===o.useSync.getState().kind&&!!o.useSync.getState().venueId,y=()=>{const t=o.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},_=(0,t.create)(()=>({info:{},card:{},loading:{}}));const p=(t,n)=>_.setState(r=>({card:{...r.card,[t]:n}}));const b=t=>(0,o.rpc)('loyalty_staff_find',{p_venue:y(),p_q:t}),w=t=>(0,o.rpc)('loyalty_staff_card',{p_guest:t}),v=t=>(0,o.rpc)('loyalty_staff_stamp',{p_guest:t}),S=t=>(0,o.rpc)('loyalty_staff_redeem',{p_reward:t}),O=t=>(0,o.rpc)('loyalty_staff_join',{p_venue:y(),p_name:t.name.trim(),p_phone:t.phone.trim()||null,p_email:t.email.trim()||null,p_consent:t.consent,p_consent_text:t.consentText}),h=(t,n)=>(0,o.rpc)('loyalty_staff_code',{p_venue:y(),p_kind:t,p_guest:n??null}),j=t=>(0,o.rpc)('loyalty_staff_remove',{p_guest:t}),P=()=>(0,o.rpc)('loyalty_summary',{p_venue:y()});async function k(){const{data:t,error:n}=await u().from('loyalty_offers').select('*').eq('venue_id',y()).order('created_at');if(n)throw n;return(t??[]).map(l.offerFromRow)}async function C(t){const n={venue_id:y(),title:t.title.trim(),details:t.details.trim(),starts_on:t.startsOn||null,ends_on:t.endsOn||null,is_on:t.isOn,updated_at:(new Date).toISOString()},{error:r}=t.id?await u().from('loyalty_offers').update(n).eq('id',t.id):await u().from('loyalty_offers').insert(n);if(r)throw r}},845,[995,872,1153,824,2,1073]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},862,[31,264,128,288,818,825,1444,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"leaveOn",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"leaveRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return b}}),_e.liveAttendance=function(e){const t=y.get(e);if(t)return t;const n=e.some(e=>e.voided)?e.filter(e=>!e.voided):e;return y.set(e,n),n},Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return P}}),_e.openShiftOf=A,_e.loggedBreakMins=M,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return F}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),n=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,n)=>t&&n.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${n} (${t})`:n},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return Q}});var e,t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),i=_r(_d[3]),s=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=(e=d)&&e.__esModule?e:{default:e},f=_r(_d[8]),u=_r(_d[9]),l=_r(_d[10]),p=_r(_d[11]);const m=(e,t,n)=>e.find(e=>e.staffId===t&&'approved'===e.status&&e.from<=n&&n<=e.to),h={decide:null},g=e=>e.out?e.signOff?'confirmed':'awaiting':'open',b=e=>!!e.out&&!!e.signOff,y=new WeakMap;const k={send:null},I=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,w=e=>{const[t,n,a]=e.split('-').map(Number);return(new Date(t,n-1,a).getDay()+6)%7},E=(e,t)=>{const[n,a,i]=e.split('-').map(Number);return I(new Date(n,a-1,i+t))},S=e=>E(e,-w(e)),O=(e,t)=>e.filter(e=>e.date===t),v=(e,t,n)=>e.find(e=>e.staffId===t&&e.date===n),R=(e,t)=>t?e:e.filter(e=>e.published),_=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],$=1271,L=6,D=['ql-wix-view','ql-wix-edit'],T=e=>D.includes(e.id)||'Website bookings'===e.group,P=[{id:'ql-gmail',label:'Work email (Gmail)',url:'',icon:'\u2709\ufe0f',kind:'gmail',staff:!1,builtIn:!0},{id:'ql-wix-view',label:'View site',url:'https://www.anchoragedunure.com',icon:'\ud83c\udf10',kind:'link',group:'Website bookings',staff:!1,builtIn:!0},{id:'ql-wix-edit',label:'Edit site',url:'https://manage.wix.com',icon:'\ud83d\udd8a\ufe0f',kind:'link',group:'Website bookings',staff:!1,builtIn:!0}];function A(e,t,n){const a=new Date(n).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&a-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function M(e,t=new Date){const n=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():n)-new Date(t.start).getTime()),0)/6e4)}const j=e=>!!e?.breaks?.some(e=>!e.end),N=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,C=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function B(){return l.ROSTER.map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},role:e.role,job:e.job,active:!0,level:e.level,dept:e.dept,salaried:e.salaried,noTax:e.noTax,...U.includes(e.id)?{displayClock:!0}:{}}))}const U=['st-jack'];function V(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const q=()=>{const e={tronc:{method:'hours',points:{FOH:1,Bar:1,Kitchen:.8,KP:.6,Manager:1},includeManagers:!0,includeOwner:!1,custom:{},text:'The Anchorage tipping policy (template)\n\n1. 100% of tips paid by card and cash tips put in the tip jar go to staff. Nothing is deducted.\n2. Tips are pooled and shared by paid hours worked in each pay period (breaks excluded).\n3. The owner does not take a share. Managers share only for hours worked on the floor or in the kitchen.\n4. Tips are paid with wages, no later than the end of the month after the tip was paid.\n5. Tip records are kept for 3 years. Ask a manager for your records at any time.'},troncCash:{},troncHistory:[],troncLog:[],chat:[],chatMuted:{},chatRead:{},referral:{giverReward:'Free dessert',friendReward:'\xa35 off first order',active:!0},referrals:[],reminders:{h24:!0,h2:!0,confirmText:!0},coats:[],merch:[],merchOrders:[],marketingDraft:void 0,socialAccounts:{facebook:!0,instagram:!0,tiktok:!0,youtube:!0},socialPosts:[],socialDraft:void 0,quickLinks:P.map(e=>({...e})),workEmail:'',staff:B(),rosterVersion:l.ROSTER_VERSION,previewRole:'owner',staffAs:l.ROSTER.find(e=>'staff'===e.app)?.id??l.ROSTER[0]?.id??'',offers:[],photos:[],changeRequests:[],changesUsed:2,site:t.VENUE_RID,branding:{},checks:{},lost:[],lostReports:[],campaigns:[],shifts:[],rotaPublished:void 0,leave:[],swaps:[],availability:{},attendance:[],attLog:[],timeRequests:[],geofence:{lat:55.4047,lng:-4.7606,radius:100},simLocation:'venue',consent:{},hourly:V(),payPeriod:'weekly',suppliers:[],supplierOrders:[],staffCanViewSuppliers:!1,readNotes:{},customerTags:{'cust-demo':['Allergy','Regular'],'cr-2':['VIP'],'cr-5':['Takeaway']}};if(s.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE)return{...e,changesUsed:0,customerTags:{},socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1}};if(!t.IS_ISOLATED_VENUE)return e;for(const t of Object.keys(e))Array.isArray(e[t])&&(e[t]=[]);return{...e,site:t.VENUE_RID,staffAs:'',hourly:{},customerTags:{},geofence:{lat:0,lng:0,radius:100},tronc:{...e.tronc,text:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].name+' tipping policy \u2014 to confirm.':t.IS_ABBOTSFORD?'The Abbotsford Hotel tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKTON?'The Kirkton Inn tipping policy \u2014 awaiting venue confirmation.':t.IS_GREENSIDE?'The Greenside Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_WILDINGS?'Wildings Hotel & Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKMICHAEL?"The Kirkmichael Arms tipping policy \u2014 awaiting venue confirmation.":"Souter's Inn tipping policy \u2014 awaiting venue confirmation."},changesUsed:0,socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1},quickLinks:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?[]:t.IS_GREENSIDE?[{id:'greenside-phone',label:'Call 01655 889685',url:'tel:01655889685',icon:'',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_WILDINGS?[{id:'wildings-phone',label:'Call to book',url:'tel:01655331401',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0},{id:'wildings-email',label:'Email to book',url:'mailto:bookings@wildingsrestaurant-hotel.co.uk',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_KIRKMICHAEL?[{id:'kirkmichael-site',label:'Venue website',url:'https://www.kirkmichaelarms.co.uk/',icon:'\ud83c\udf10',kind:'link',group:'Website',staff:!0,builtIn:!0}]:[{id:'souters-book',label:'Guest table requests',url:'https://covercharge-apps.static.hf.space/souters/customer-app/',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}],branding:{[t.VENUE_RID]:{accent:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?a.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},x=(0,f.create)()((0,u.persist)((e,n)=>({...q(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,n,a)=>e(e=>({staff:[...e.staff,{id:N('st'),name:t,role:n,job:a,active:!0,level:W[n]}]})),saveSupplier:t=>e(e=>({suppliers:e.suppliers.some(e=>e.id===t.id)?e.suppliers.map(e=>e.id===t.id?t:e):[...e.suppliers,t]})),setRate:(t,n)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(n))}})),clearRate:t=>e(e=>{const n={...e.hourly};return delete n[t],{hourly:n}}),updateStaff:(t,n)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...n}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:N('of')},...e.offers]})),updateOffer:(t,n)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...n}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:N('ph'),caption:t,tone:C[e.photos.length%C.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,n)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:N('cr'),text:t,at:n,status:'requested'},...e.changeRequests]}),setSite:n=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:n}),setBranding:(t,n)=>e(e=>{const a={...e.branding};return n?a[t]={...a[t],...n}:delete a[t],{branding:a}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:N('sp')},...e.socialPosts]})),setSocialPost:(t,n)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...n}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,n,a)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[n]??[];return{...e,reactions:{...e.reactions,[n]:i.includes(a)?i.filter(e=>e!==a):[...i,a]}}})})),chatSeen:(t,n)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(n))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(n)?e:{...e,seenBy:[...e.seenBy,n]})}:e),chatMarkRead:(t,n)=>e(e=>{const a={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(n))(!a[e]||Date.parse(t)>Date.parse(a[e]))&&(a[e]=t);const i=e=>Math.max(Date.parse(a['*']??'')||0,Date.parse(a[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:a},chat:s}}),chatPatch:(t,n)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...n}:e)})),chatMute:(t,n)=>e(e=>{const a=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),sys:(t,n,a)=>e(e=>({chat:[...e.chat,{id:N('m'),ch:t,from:'system',text:n,at:a,reactions:{},seenBy:[]}]})),tick:(t,n,a,i)=>e(e=>({checks:{...e.checks,[t]:{by:n,at:a,value:i}}})),untick:t=>e(e=>{const n={...e.checks};return delete n[t],{checks:n}}),addLost:t=>e(e=>({lost:[{...t,id:N('lp'),status:'held'},...e.lost]})),setLost:(t,n)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...n}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:N('cp')},...e.campaigns]})),setCampaign:(t,n)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...n}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:w(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:w(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,a)=>{const i=n(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const n=E(t,e),o=E(a,e);i.shifts.filter(e=>e.date===n&&s.has(e.staffId)&&!m(i.leave,e.staffId,o)&&!i.shifts.some(t=>t.staffId===e.staffId&&t.date===o)&&!r.some(t=>t.staffId===e.staffId&&t.date===o)).forEach(e=>r.push({id:(0,p.uuid)(),staffId:e.staffId,date:o,day:w(o),start:e.start,end:e.end,note:e.note,published:!1}))}return r.length&&e({shifts:[...i.shifts,...r]}),r.length},publishWeek:t=>{const n=E(t,6);let a=0;return e(e=>({shifts:e.shifts.map(e=>e.daten||e.published&&!e.changed?e:(a++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),a},removeShift:t=>e(e=>({shifts:e.shifts.filter(e=>e.id!==t)})),markRead:t=>e(e=>({readNotes:{...e.readNotes,...Object.fromEntries(t.map(e=>[e,!0]))}})),toggleTag:(t,n)=>e(e=>{const a=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>{const n={...t,id:(0,p.uuid)(),status:t.status??'pending'};return e(e=>({leave:[n,...e.leave]})),n},setLeave:(t,a)=>{e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:a}:e)}));const i=n().leave.find(e=>e.id===t);i&&h.decide?.(i)},addSwap:t=>e(e=>({swaps:[{...t,id:N('sw'),status:'open'},...e.swaps]})),setSwap:(t,n)=>e(e=>{const a=e.swaps.find(e=>e.id===t);return{shifts:'approved'===n&&a?.toId?e.shifts.map(e=>e.id===a.shiftId?{...e,staffId:a.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:n}:e)}}),toggleAvail:(t,n)=>e(e=>{const a=e.availability[t]??[];return{availability:{...e.availability,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),clock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.filter(e=>e.staffId===t&&e.in&&!e.out&&new Date(i).getTime()-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0];if('in'===a)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:n,in:i,inSite:s}]};const d=e=>e?.map(e=>e.end?e:{...e,end:i});return o?{attendance:e.attendance.map(e=>e.id===o.id?{...e,out:i,outSite:s,breakMins:r??M({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.find(e=>e.id===t),d=e.staff.find(e=>e.id===o?.staffId),c=o?.[n]?new Date(o[n]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[n]:a,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:N('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${n} from ${c} to ${new Date(a).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,n,a)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...n,geo:a?[...e.geo??[],a].slice(-20):e.geo}:e)})),breakToggle:(t,a,i)=>{const s=n(),r=A(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===a?d:!d)return!1;const c='start'===a?[...o,{start:i}]:o.map(e=>e.end?e:{...e,end:i});return e({attendance:s.attendance.map(e=>e.id===r.id?{...e,breaks:c,breakMins:M({breaks:c})}:e)}),!0},adjustBreak:(t,n,a,i,s)=>e(e=>{const r=e.attendance.find(e=>e.id===t),o=e.staff.find(e=>e.id===r?.staffId);return{attendance:e.attendance.map(e=>e.id===t?{...e,breakMins:n,adjusted:{by:a,at:s,reason:i}}:e),attLog:[{id:N('al'),at:s,text:`${a} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${n}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const a=n(),i=t.id?a.attendance.find(e=>e.id===t.id):void 0,s=t.reason.trim();if(s.length<3)return null;if(t.out&&t.out<=t.in)return null;const r=e=>e?new Date(e).toTimeString().slice(0,5):'none',o=(e,n,a)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:n,to:a,reason:s}),d=a.staff.find(e=>e.id===t.staffId)?.name??'staff';let c;const f=[];if(i){const e=[...i.audit??[]];if(i.signOff&&(e.push(o('reopened','Confirmed','Awaiting sign-off')),f.push(`${t.by} reopened ${d}'s confirmed ${i.date} entry`)),i.in!==t.in&&(e.push(o('clock_in',r(i.in),r(t.in))),f.push(`${t.by} changed ${d} clock-in from ${r(i.in)} to ${r(t.in)}: ${s}`)),(i.out??'')!==(t.out??'')&&(e.push(o('clock_out',r(i.out),r(t.out))),f.push(`${t.by} changed ${d} clock-out from ${r(i.out)} to ${r(t.out)}: ${s}`)),(i.breakMins??0)!==t.breakMins&&(e.push(o('break',`${i.breakMins??0}m`,`${t.breakMins}m`)),f.push(`${t.by} changed ${d} break from ${i.breakMins??0}m to ${t.breakMins}m: ${s}`)),e.length===(i.audit??[]).length)return i;const n=t.out?i.breaks?.map(e=>e.end?e:{...e,end:t.out}):i.breaks;c={...i,in:t.in,out:t.out,breakMins:t.breakMins,breaks:n,signOff:void 0,adjusted:{by:t.by,at:t.now,reason:s},audit:e}}else c={id:t.id??(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:s},audit:[o('added',void 0,`${r(t.in)}\u2013${t.out?r(t.out):'open'}, break ${t.breakMins}m`)]},f.push(`${t.by} added ${d}'s ${t.date} entry ${r(t.in)}\u2013${t.out?r(t.out):'open'} (break ${t.breakMins}m): ${s}`);return t.request&&(c={...c,audit:[...c.audit??[],o('request_applied')]}),k.send?.('attendance_override',c,{reason:s}),e(e=>({attendance:i?e.attendance.map(e=>e.id===i.id?c:e):[...e.attendance,c],attLog:[...f.reverse().map(e=>({id:N('al'),at:t.now,text:e})),...e.attLog]})),c},voidEntry:(t,a,i,s,r)=>{const o=n(),d=o.attendance.find(e=>e.id===t);if(!d||d.voided||d.signOff||s.trim().length<3)return!1;const c={...d,voided:{by:a,at:r,reason:s.trim()},audit:[...d.audit??[],{at:r,by:a,byId:i,action:'voided',from:'In hours',to:'Removed',reason:s.trim()}]};k.send?.('attendance_void',c,{reason:s.trim()});const f=o.staff.find(e=>e.id===d.staffId)?.name??'staff';return e({attendance:o.attendance.map(e=>e.id===t?c:e),attLog:[{id:N('al'),at:r,text:`${a} removed ${f}'s ${d.date} shift (kept in the history): ${s.trim()}`},...o.attLog]}),!0},deleteEntry:(t,a,i,s)=>{const r=n(),o=r.attendance.find(e=>e.id===t);if(!o)return{ok:!1,message:'Not found.'};if(o.signOff)return{ok:!1,message:"This shift has been signed off and can't be deleted."};const d={...o,audit:[...o.audit??[],{at:s,by:a,byId:i,action:'voided',from:'In hours',to:'Deleted'}]};k.send?.('attendance_delete',d);const c=r.staff.find(e=>e.id===o.staffId)?.name??'staff';return e({attendance:r.attendance.filter(e=>e.id!==t),attLog:[{id:N('al'),at:s,text:`${a} deleted ${c}'s ${o.date} shift`},...r.attLog]}),{ok:!0}},addPastShift:t=>{if(!t.staffId||!t.in||!t.out||t.out<=t.in)return null;const a=(t.note??'').trim()||'Past shift (historical entry)',i={id:(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:a},signOff:{by:t.by,byId:t.byId,at:t.now},audit:[{at:t.now,by:t.by,byId:t.byId,action:'added',to:`${t.in}\u2013${t.out}, break ${t.breakMins}m`,reason:a},{at:t.now,by:t.by,byId:t.byId,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed',reason:'Historical entry'}]};k.send?.('attendance_add_past',i,{reason:a});const s=n().staff.find(e=>e.id===t.staffId)?.name??'staff';return e(e=>({attendance:[...e.attendance,i],attLog:[{id:N('al'),at:t.now,text:`${t.by} entered ${s}'s past shift on ${t.date}`},...e.attLog]})),i},confirmEntries:(t,a,i,s)=>{const r=n(),o=new Set(t),d=[],c=r.attendance.map(e=>{if(!o.has(e.id)||!e.out||e.signOff)return e;const t={...e,signOff:{by:a,byId:i,at:s},audit:[...e.audit??[],{at:s,by:a,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>k.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:N('al'),at:s,text:`${a} confirmed ${d.length} ${1===d.length?'entry':'entries'} (${[...new Set(d.map(e=>e.date))].join(', ')})`},...r.attLog]}),d.length):0},addTimeRequest:t=>e(e=>({timeRequests:[{...t,id:(0,p.uuid)(),status:'open'},...e.timeRequests]})),resolveTimeRequest:(t,a,i,s)=>{const r=n().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:a,resolvedBy:i,resolvedAt:s};k.send?.('time_request_resolve',o),e(e=>({timeRequests:e.timeRequests.map(e=>e.id===t?o:e)}))},setGeofence:t=>e(e=>({geofence:{...e.geofence,...t}})),setSimLocation:t=>e({simLocation:t}),giveConsent:(t,n)=>e(e=>({consent:{...e.consent,[t]:n}})),resetOwner:()=>e(q()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const n=new Set(e.staff.map(e=>e.id)),a=B().filter(e=>!n.has(e.id));return{staff:a.length?[...e.staff,...a]:e.staff,hourly:{...e.hourly,...V()},rosterVersion:l.ROSTER_VERSION}})}),{name:'covercharge-owner-v1',version:6,storage:(0,u.createJSONStorage)(()=>c.default),migrate:async(e,t)=>{if(s.LIVE_VENUE_BUILD&&e)return await(0,o.archiveChefCache)('owner',e),{...e,...(0,i.stripOwnerLiveSamples)(e)};if(e&&t<2&&Array.isArray(e.quickLinks)&&(e.quickLinks=e.quickLinks.map(e=>D.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=q();Object.assign(e,{staff:t.staff,hourly:t.hourly,shifts:t.shifts,leave:t.leave,swaps:t.swaps,availability:t.availability,attendance:[],attLog:[],consent:{},chat:[],chatMuted:{},troncHistory:[],staffAs:t.staffAs,previewRole:'owner',rosterVersion:l.ROSTER_VERSION,rotaPublished:void 0})}if(e&&t<4){const t=S(I(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:E(t,e.day??0),published:!0}),e.timeRequests=e.timeRequests??[]}return s.LIVE_VENUE_BUILD&&e&&(Object.assign(e,(0,i.stripOwnerLiveSamples)(e)),e.chat=(e.chat||[]).filter(e=>!(0,r.isSeedChefChat)(e)),e.suppliers=(e.suppliers||[]).filter(e=>!/^sup-[1-9]$/.test(e.id)||!/^(Example|Sample)\b/.test(e.name)),e.supplierOrders=(e.supplierOrders||[]).filter(e=>!/\(example\)/i.test(e.by||''))),e}})),K=(e,t,n)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${n(t)}/h`,W={owner:'Owner',manager:'Manager',staff:'Staff'},F={forecasts:e=>'staff'!==e,manage:e=>'staff'!==e,staffAdmin:e=>'owner'===e,billing:e=>'owner'===e,takings:e=>'staff'!==e,publishSocial:e=>'staff'!==e};const G=e=>[e.name.replace(/\s*\([^)]*\)\s*$/,'').replace(' (example)',''),e.nickname??''].map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>[e,e.split(' ')[0]]).filter((e,t,n)=>n.indexOf(e)===t),H=(e,t)=>{const n=t.trim().toLowerCase();if(!n)return!1;const a=G(e);return a.includes(n)||a.includes(n.split(' ')[0])},Q=(e,t)=>{const n=t.trim().toLowerCase();return!n||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(n))}},863,[5,6,1154,1156,842,1085,1159,1160,995,1169,15,1099]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSpecials",{enumerable:!0,get:function(){return _}});var e,t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),n=r(_d[3]),o=r(_d[4]),c=(e=o)&&e.__esModule?e:{default:e},l=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),y=r(_d[9]);const p=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock)}catch{return new Date}};let S=0;const f=()=>`sb-${Date.now().toString(36)}${(S++).toString(36)}`,b=(e,t)=>u.useStore.setState(s=>({audit:[{id:`au-${f()}`,restaurantId:e,at:p().toISOString(),kind:'allergy',text:t},...s.audit].slice(0,300)})),_=(0,l.create)()((0,d.persist)((e,t)=>({...n.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{current:{},history:[]}:(0,h.seedSpecials)(p()),post:(t,s,i,n)=>{e(e=>(0,h.postBoard)(e,t,s,i,n,p(),f())),s.items.length&&b(t,`Specials board: allergens for ${s.items.length} typed special${1===s.items.length?'':'s'} checked and signed off by ${i}`)},clear:(t,s)=>{e(e=>(0,h.clearBoard)(e,t)),b(t,`Specials board cleared by ${s}`)},reuse:(s,i,n,o)=>{const c=t().history.find(e=>e.id===i);e(e=>(0,h.reuseBoard)(e,s,i,n,o,p(),f())),c?.items.length&&b(s,`Specials board re-used: ${c.items.length} typed special${1===c.items.length?'':'s'}, allergens as previously checked, signed off by ${n}`)},remove:t=>e(e=>(0,h.deleteFromHistory)(e,t))}),{name:'covercharge-specials-v1',storage:(0,d.createJSONStorage)(()=>c.default),version:1,partialize:e=>({current:e.current,history:e.history})})),E=async()=>{if(!(0,y.liveData)())return;const e=_.getState(),n=e=>String(e.id).startsWith('sb-seed')&&(!s.LIVE_VENUE_BUILD||(0,t.demoActor)(e.postedBy)&&(!e.allergenCheck||(0,t.demoActor)(e.allergenCheck.by))&&(!e.photo||e.photo===h.SAMPLE_PHOTO)&&e.items.every(e=>/\(sample\)/i.test(e.name))),o=Object.fromEntries(Object.entries(e.current).filter(([,e])=>!(e&&n(e)))),c=e.history.filter(e=>!n(e));Object.keys(o).length===Object.keys(e.current).length&&c.length===e.history.length||(s.LIVE_VENUE_BUILD&&await(0,i.archiveChefCache)('specials',{current:e.current,history:e.history}),_.setState({current:o,history:c}))};(0,y.onDataModeChange)(E);try{_.persist?.onFinishHydration?.(E)}catch{}E()},864,[1085,842,1159,5,1160,995,1169,865,881,1183]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAMPLE_PHOTO",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_MAX",{enumerable:!0,get:function(){return n}}),e.parsePrice=function(t){const n=t.trim().replace(/^\xa3\s*/,'');return n?/^\d{1,3}(\.\d{1,2})?$/.test(n)?Math.round(100*parseFloat(n)):NaN:null},Object.defineProperty(e,"priceText",{enumerable:!0,get:function(){return s}}),e.itemProblems=a,e.draftProblems=i,e.cycleAllergen=function(t,n){const s={...t};s[n]?'contains'===s[n]?s[n]='may':delete s[n]:s[n]='contains';return s},e.postBoard=function(t,n,s,a,l,c,d){const u=i(s);if(u.length)throw new Error(u[0]);const p={id:d,restaurantId:n,photo:s.photo,app:l,postedBy:a,postedAt:c.toISOString(),items:s.items.map(t=>({...t,name:t.name.trim(),description:t.description.trim()})),allergenCheck:s.items.length?{by:a,at:c.toISOString()}:null};return{current:{...t.current,[n]:p},history:o(t.history,t.current[n],n)}},e.clearBoard=function(t,n){return{current:{...t.current,[n]:null},history:o(t.history,t.current[n],n)}},e.reuseBoard=function(t,n,s,a,i,l,c){const d=t.history.find(t=>t.id===s&&t.restaurantId===n);if(!d)return t;const u={...d,id:c,app:i,postedBy:a,postedAt:l.toISOString(),reusedFrom:d.id,allergenCheck:d.items.length?{by:a,at:l.toISOString()}:null},p={...t,history:t.history.filter(t=>t.id!==s)};return{current:{...t.current,[n]:u},history:o(p.history,t.current[n],n)}},e.deleteFromHistory=function(t,n){return{...t,history:t.history.filter(t=>t.id!==n)}},Object.defineProperty(e,"historyFor",{enumerable:!0,get:function(){return l}}),e.whenText=h,Object.defineProperty(e,"isToday",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"freshness",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"lastUpdated",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"boardSummary",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SAMPLE_ITEMS",{enumerable:!0,get:function(){return k}}),e.seedSpecials=function(n){const s=60*n.getHours()+n.getMinutes()>=702?S(n,0,11,42):new Date(n.getTime()-6e5),a=S(n,1,11,20),i=S(n,3,12,5);return{current:{anchorage:{id:'sb-seed-today',restaurantId:'anchorage',photo:null,items:k,postedAt:s.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:{by:'Head Chef (example)',at:s.toISOString()}}},history:[{id:'sb-seed-yday',restaurantId:'anchorage',photo:null,postedAt:a.toISOString(),postedBy:'Duty Manager (example)',app:'managers',allergenCheck:{by:'Duty Manager (example)',at:a.toISOString()},items:[{id:'sp-y1',name:'Pan-fried sea bass, samphire, brown shrimp butter (sample)',description:'Sample dish.',price:2100,allergens:{fish:'contains',crustaceans:'contains',milk:'contains'}},{id:'sp-y2',name:'Smoked haddock fishcake, poached egg (sample)',description:'Sample dish: with wholegrain mustard sauce.',price:1250,allergens:{fish:'contains',eggs:'contains',gluten:'contains',milk:'contains',mustard:'contains'}},{id:'sp-y3',name:'Lemon posset, shortbread (sample)',description:'Sample pudding.',price:750,allergens:{milk:'contains',gluten:'contains'}}]},{id:'sb-seed-photo',restaurantId:'anchorage',photo:t,items:[],postedAt:i.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:null}]}};const t='sample:chalkboard',n=8;const s=t=>null===t?'Ask your server':`\xa3${(t/100).toFixed(2)}`;function a(t){const n=[];t.name.trim().length<3&&n.push('Add a dish name'),null!==t.price&&(!Number.isFinite(t.price)||t.price<=0||t.price>5e4)&&n.push('Check the price');const s=Object.keys(t.allergens).length;return s||t.noAllergens||n.push('Choose its allergens, or tick \u201cNone of the 14\u201d'),s&&t.noAllergens&&n.push('Allergens chosen and \u201cNone of the 14\u201d both ticked'),n}function i(t){const n=[];return t.photo||t.items.length||n.push('Add a photo of the board or type at least one special'),t.items.forEach((t,s)=>a(t).forEach(t=>n.push(`Special ${s+1}: ${t}`))),t.items.length&&!t.allergensChecked&&n.push('Confirm you have checked the allergens'),n}const o=(t,s,a)=>{if(!s)return t;return[...[s,...t.filter(t=>t.restaurantId===a&&t.id!==s.id)].slice(0,n),...t.filter(t=>t.restaurantId!==a)]};const l=(t,n)=>t.history.filter(t=>t.restaurantId===n),c=t=>String(t).padStart(2,'0'),d=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],p=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate();function h(t,n){const s=new Date(t),a=`${c(s.getHours())}:${c(s.getMinutes())}`;if(p(s,n))return`today at ${a}`;const i=new Date(n);return i.setDate(i.getDate()-1),p(s,i)?`yesterday at ${a}`:`${d[s.getDay()]} ${s.getDate()} ${u[s.getMonth()]} at ${a}`}const m=(t,n)=>p(new Date(t),n),y=(t,n)=>`Updated ${h(t.postedAt,n)}`,f=(t,n)=>`Last updated ${h(t.postedAt,n)} by ${t.postedBy}`,b=t=>[t.photo?'Photo':'',t.items.length?`${t.items.length} typed special${1===t.items.length?'':'s'}`:''].filter(Boolean).join(' + '),S=(t,n,s,a)=>{const i=new Date(t);return i.setDate(i.getDate()-n),i.setHours(s,a,0,0),i},k=[{id:'sp-hake',name:'Grilled hake, crushed new potatoes, salsa verde (sample)',description:'Sample dish: day-boat hake, lemon and caper salsa verde.',price:1950,allergens:{fish:'contains',mustard:'contains',sulphites:'may'}},{id:'sp-scallops',name:'Half-shell scallops, garlic and herb butter (sample)',description:'Sample dish: three scallops grilled in the shell, crusty bread.',price:1400,allergens:{molluscs:'contains',milk:'contains',gluten:'contains'}},{id:'sp-crab',name:'Crab and chilli linguine (sample)',description:'Sample dish: brown and white crab meat, chilli, parsley, lemon.',price:1850,allergens:{crustaceans:'contains',gluten:'contains',eggs:'contains',molluscs:'may'}},{id:'sp-mussels',name:'Mussels in cider and leek cream (sample)',description:'Sample dish: rope-grown mussels, dry cider, leeks, cream. Main with chips.',price:1300,allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',celery:'may'}}]},865,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addressWithoutInvite",{enumerable:!0,get:function(){return u.addressWithoutInvite}}),Object.defineProperty(_e,"inviteFromLocation",{enumerable:!0,get:function(){return u.inviteFromLocation}}),Object.defineProperty(_e,"useSession",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"rosterPerson",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"APP_NAME",{enumerable:!0,get:function(){return S}}),_e.sha256Hex=y,_e.inviteFromText=function(e){const t=e.trim(),n=t.match(/[?&#](?:invite|i)=([A-Za-z0-9_-]{10,})/);return n?n[1]:/^[A-Za-z0-9_-]{10,}$/.test(t)?t:null},_e.personForInvite=async function(e){if(a.IS_ISOLATED_VENUE)return;const t=await y(e);return t?l.ROSTER.find(e=>e.tokenHash===t):void 0},Object.defineProperty(_e,"DEVICE_KEY",{enumerable:!0,get:function(){return p}}),_e.deviceId=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(p);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(p,e)}return e}catch{return null}},Object.defineProperty(_e,"PHONE_KEY",{enumerable:!0,get:function(){return I}}),_e.phoneKey=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(I);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(I,e)}return e}catch{return null}},Object.defineProperty(_e,"START_INVITE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"START_HANDOVER",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"START_KITCHEN",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"START_GO",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"START_LOYALTY_CODE",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"START_TABLE_TOKEN",{enumerable:!0,get:function(){return O}}),_e.appUrl=function(e,t){if('undefined'==typeof window||!window.location)return null;const{origin:n,pathname:o}=window.location,i=o.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/),a=i?i[1]:'/';return`${n}${a}${e}-app/index.html${t?`#invite=${encodeURIComponent(t)}`:''}`},_e.levelJob=function(e,t){const n=(e??'').trim(),o=(t??'').trim();return n?!o||o.toLowerCase().startsWith(n.toLowerCase())?o||n:`${n} \xb7 ${o}`:o};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]),a=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]),u=r(d[7]),f=r(d[8]);const w={getItem:e=>{try{if((0,f.isKitchenViaDisplay)())return Promise.resolve('undefined'!=typeof sessionStorage?sessionStorage.getItem((0,f.kitchenSessionStoreName)()):null)}catch{}return n.default.getItem(e)},setItem:(e,t)=>{try{if((0,f.isKitchenViaDisplay)())return sessionStorage.setItem((0,f.kitchenSessionStoreName)(),t),Promise.resolve()}catch{}return n.default.setItem(e,t)},removeItem:e=>{try{(0,f.isKitchenViaDisplay)()&&sessionStorage.removeItem((0,f.kitchenSessionStoreName)())}catch{}return n.default.removeItem(e)}},h=(0,o.create)()((0,i.persist)(e=>({meId:null,welcomed:{},signIn:t=>e({meId:t,signedInAt:(new Date).toISOString()}),signOut:()=>e({meId:null,signedInAt:void 0}),markWelcomed:t=>e(e=>({welcomed:{...e.welcomed,[t]:(new Date).toISOString()}}))}),{name:c.IS_CAR?'covercharge-car-session-v1':'covercharge-session-v1',storage:(0,i.createJSONStorage)(()=>w),version:c.IS_CAR?2:1,partialize:e=>(0,s.persistedSessionSlice)(c.IS_CAR,e),migrate:e=>c.IS_CAR?(0,s.migrateCarSession)(e):e})),m=e=>!a.IS_ISOLATED_VENUE&&e?l.ROSTER.find(t=>t.id===e):void 0,S={owner:'CoverCharge for Managers',staff:'CoverCharge for Staff',chef:'CoverCharge for Head Chef'};async function y(e){const t=globalThis.crypto?.subtle;if(!t)return null;const n=await t.digest('SHA-256',(new TextEncoder).encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,'0')).join('')}const p=(0,a.venueKey)('covercharge-device-id');const I=(0,a.venueKey)('covercharge-phone-key');const v=(()=>{try{if('undefined'==typeof window||!window.location)return null;if(c.IS_CAR){try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(null,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}return null}const e=(0,a.venueKey)(`cc-pending-invite:${c.APP_VARIANT}`);let t=(0,u.inviteFromLocation)(window.location.search,window.location.hash);try{t?localStorage.setItem(e,t):t=localStorage.getItem(e)}catch{}if(t&&!/^[A-Za-z0-9_-]{10,64}$/.test(t)&&(t=null),t&&window.history?.replaceState){const e=()=>{try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};e();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[?&#]invite=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const t of[300,1e3,2500,5e3,1e4,2e4])setTimeout(e,t)}return t}catch{return null}})(),A=(()=>{try{if('undefined'==typeof window||!window.location||c.IS_CAR)return null;const e=(0,u.handoverFromHash)(window.location.hash);if(!e)return null;const t=()=>{try{/[#&]ccchrome=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};t();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[#&]ccchrome=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const e of[300,1e3,2500,5e3])setTimeout(t,e);return e}catch{return null}})(),b=(()=>{try{if('undefined'==typeof window||!window.location||c.IS_CAR)return null;const e=(0,f.kitchenTicketFromHash)(window.location.hash);if(!e)return null;const t=()=>{try{/[#&]cckitchen=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};t();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[#&]cckitchen=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const e of[300,1e3,2500,5e3])setTimeout(t,e);return e}catch{return null}})(),_=(()=>{try{return'undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('go'):null}catch{return null}})(),T=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('loyalty'):null;return e&&/^[A-Za-z0-9-]{4,12}$/.test(e)?e.toUpperCase():null}catch{return null}})(),O=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('table'):null;return e&&/^[A-Za-z2-9]{16}$/.test(e)?e.toUpperCase():null}catch{return null}})()},866,[1160,995,1169,5,807,1241,15,1240,979]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},867,[31,128,878,818,823,866,1073,845,825,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BUILTIN_LOGOS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HERO_LOGOS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"HEADER_LOGO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACCENTS",{enumerable:!0,get:function(){return z}}),_e.useBrandRid=k,_e.useBrand=A,_e.PoweredBy=H,_e.RestaurantLogo=L,_e.RestaurantHero=function({rid:e,size:r=200,showPlace:o=!0}){const c=A(e),u='wildings'===c.rid||'greenside'===c.rid||'kirkton'===c.rid||'abbotsford'===c.rid||(0,t.isQueuedVenue)(c.rid),x='yasmins'===c.rid?c.logo:u?S[c.rid]:c.custom?c.logo:S[c.rid]??c.logo;return(0,p.jsxs)(s.default,{testID:"restaurant-hero",style:{alignItems:'center',gap:6},children:[x?(0,p.jsx)(l.default,{source:x,accessibilityLabel:`${c.name} logo`,style:{width:r,height:r,borderRadius:!u&&c.custom?r/2:0},resizeMode:"contain"}):(0,p.jsx)(L,{rid:c.rid,size:r}),u?null:(0,p.jsx)(n.Text,{testID:"restaurant-hero-name",style:[{fontFamily:f.fonts.semibold,fontSize:26,lineHeight:34,color:f.colours.text,textAlign:'center'},(0,h.webLine)({lineHeight:34},26)],children:c.name}),o&&c.place?(0,p.jsx)(n.Text,{style:[{fontFamily:f.fonts.regular,fontSize:14,lineHeight:20,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:20},14)],children:c.place}):null]})},_e.VenueName=I,_e.RestaurantBrand=function({rid:e,sub:t,size:r=T,nameSuffix:o,beside:l}){const c=A(e);if('display'===x.APP_VARIANT||l)return(0,p.jsx)(s.default,{style:{gap:2,flexShrink:1},children:(0,p.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,p.jsx)(L,{rid:c.rid,size:r}),(0,p.jsxs)(s.default,{style:{flexShrink:1,flex:1,minWidth:0},children:[(0,p.jsx)(I,{name:c.name+(o??''),lines:2,bold:!0}),(0,p.jsx)(s.default,{testID:"display-powered-by",style:{marginLeft:14,marginTop:-1},children:(0,p.jsx)(H,{})}),t?(0,p.jsx)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:c.accentText},(0,h.webLine)({lineHeight:16},12)],children:t}):null]})]})});return(0,p.jsxs)(s.default,{testID:"venue-header-block",dataSet:{centre:'heading'},style:{gap:4,alignItems:'center',alignSelf:'center',maxWidth:420,width:'100%'},children:[(0,p.jsx)(L,{rid:c.rid,size:r}),(0,p.jsx)(I,{name:c.name+(o??'')}),t?(0,p.jsx)(n.Text,{numberOfLines:2,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:16},12)],children:t}):null,(0,p.jsx)(H,{})]})},_e.VenueHeaderBlock=function({rid:e,name:t,badge:r,place:o}){return(0,p.jsxs)(s.default,{testID:"venue-header-block",dataSet:{centre:'heading'},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',alignSelf:'center',gap:12,maxWidth:420,width:'100%'},children:[(0,p.jsx)(L,{rid:e,size:44}),(0,p.jsxs)(s.default,{style:{flexShrink:1,minWidth:0,alignItems:'center',gap:2},children:[(0,p.jsx)(I,{name:t}),(0,p.jsx)(s.default,{testID:"app-badge",accessibilityLabel:`${r} app`,style:{borderWidth:1,borderColor:f.colours.gold,borderRadius:6,paddingHorizontal:6,paddingVertical:1},children:(0,p.jsx)(n.Text,{style:[{fontFamily:f.fonts.bold,fontSize:10,lineHeight:14,color:f.colours.gold,textAlign:'center'},(0,h.webLine)({lineHeight:14},10)],children:r})}),o?(0,p.jsx)(n.Text,{testID:"venue-header-place",dataSet:{centre:'heading'},style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:f.colours.muted,textAlign:'center'},(0,h.webLine)({lineHeight:16},12)],children:o}):null,(0,p.jsx)(H,{})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=e(_r(d[3])),l=e(_r(d[4]));_r(d[5]);var s=e(_r(d[6])),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),x=_r(d[11]),b=_r(d[12]),y=_r(d[13]),j=_r(d[14]),p=_r(d[15]);const w={"3idiots":_r(d[16]),cecchinis:_r(d[17]),mrbasrais:_r(d[18]),yasmins:_r(d[19]),williewastles:_r(d[20]),rupeeroom:_r(d[21]),smokinggoat:_r(d[22]),pizzaioli:_r(d[23]),drunkencoo:_r(d[24]),abbotsford:_r(d[25]),kirkton:_r(d[26]),greenside:_r(d[27]),wildings:_r(d[28]),kirkmichael:_r(d[29]),souters:_r(d[30]),anchorage:_r(d[31]),saltmarsh:_r(d[32]),brae:_r(d[33])},S={"3idiots":_r(d[34]),cecchinis:_r(d[35]),mrbasrais:_r(d[36]),yasmins:_r(d[37]),williewastles:_r(d[38]),rupeeroom:_r(d[39]),smokinggoat:_r(d[40]),pizzaioli:_r(d[41]),drunkencoo:_r(d[42]),abbotsford:_r(d[43]),kirkton:_r(d[44]),greenside:_r(d[45]),wildings:_r(d[46]),kirkmichael:_r(d[47]),souters:_r(d[30]),anchorage:_r(d[48])};y.PITCH&&!y.PITCH_ANCHORAGE&&(delete w.anchorage,delete S.anchorage);const T=48,z=['#CFA45F','#D4AF61','#C9A24A','#E2C489','#F2EDE4','#A88B5A','#B08D57','#D9774B'];function k(e){const t=(0,r.useGlobalSearchParams)(),n=(0,u.useOwner)(e=>e.site),o='string'==typeof t.rid?t.rid:void 0;return b.IS_ISOLATED_VENUE?b.VENUE_RID:e??o??n??b.VENUE_RID}function A(e){const t=k(e),n=(0,c.useStore)(e=>e.restaurants.find(e=>e.id===t)),r=(0,u.useOwner)(e=>e.branding[t]),l=r?.logoUri?{uri:r.logoUri}:w[t],s=r?.accent??f.colours.gold,h=o.default.useMemo(()=>(0,j.checkAccent)(s,f.colours.bg,f.colours.onGold,f.colours.text),[s]);return{rid:t,name:n?.name??'Restaurant',place:n?.location??'',logo:l,accent:s,accentText:h.accentText,onAccent:h.onAccent,custom:!!r?.logoUri}}function H({size:e=10}){return(0,p.jsxs)(n.Text,{accessibilityLabel:"powered by CoverCharge",style:[{fontFamily:f.fonts.regular,fontSize:e,lineHeight:Math.round(1.35*e),color:f.colours.muted,textAlign:'center'},(0,h.webLine)({lineHeight:Math.round(1.35*e)},e)],children:["powered by ",(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.text},children:"Cover"}),(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.gold},children:"Charge"})]})}function L({rid:e,size:t=T}){const r=A(e);if(r.logo)return(0,p.jsx)(l.default,{source:r.logo,accessibilityLabel:`${r.name} logo`,style:{width:t,height:t,borderRadius:r.custom?t/2:0},resizeMode:"contain"});const o=r.name.replace(/^The /,'').split(/\s+/).map(e=>e[0]).join('').slice(0,2).toUpperCase();return(0,p.jsx)(s.default,{accessibilityLabel:`${r.name} logo`,style:{width:t,height:t,borderRadius:t/2,borderWidth:2,borderColor:r.accentText,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.bold,color:r.accentText,fontSize:.36*t},children:o})})}function I({name:e,size:t=17,lines:r,bold:o}){return(0,p.jsx)(n.Text,{testID:"venue-header-name",accessibilityRole:"header",accessibilityLabel:e,numberOfLines:r,style:[{fontFamily:o?f.fonts.bold:f.fonts.semibold,fontSize:t,lineHeight:Math.ceil(1.35*t),color:f.colours.text,textAlign:'center',flexShrink:1,minWidth:0},(0,h.webLine)({lineHeight:Math.ceil(1.35*t)},t),{overflowWrap:'normal',wordBreak:'keep-all'}],children:e})}},868,[6,874,805,31,197,123,128,823,863,825,1321,807,5,2,1319,25,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PUB_LOCATIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"privateClockVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"pubLocation",{enumerable:!0,get:function(){return s}}),e.venueClockArea=function(a,o={}){if((0,t.isQueuedVenue)(a)&&!t.queuedVenues[a].clockArea.on)return(0,n.cleanArea)({...o,on:!0===o.on&&'number'==typeof o.lat&&'number'==typeof o.lng,offRotaPrompt:!1});const l=s(a);if(!l)return(0,n.cleanArea)(o);const c=(0,n.cleanArea)({lat:l.lat,lng:l.lng,radius:150,...o});return{...c,lat:c.lat??l.lat,lng:c.lng??l.lng,on:!0,offRotaPrompt:!1}},e.venueClockGeo=l,e.privateAttendance=function(n,a){if(!o(n)&&!(0,t.isQueuedVenue)(n))return a;const s={...a};for(const t of['lat','lng','latitude','longitude','coords','position','location','acc','dist','accuracy','distance','outSite'])delete s[t];a.geo&&(s.geo=a.geo.map(t=>l(n,t)).filter(t=>!!t));return s};var t=r(d[0]),n=r(d[1]);const a={"3idiots":{name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",lat:55.4650286,lng:-4.6283062,source:"Verified exact-address venue pack"},cecchinis:{name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",lat:55.461505,lng:-4.6345736,source:"Verified exact-address venue pack"},williewastles:{name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",lat:55.4646261,lng:-4.6323929,source:"Verified exact-address venue pack"},smokinggoat:{name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",lat:55.464226,lng:-4.6326035,source:"Verified exact-address venue pack"},drunkencoo:{name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",lat:55.4570308,lng:-4.6294663,source:"Verified exact-address venue pack"},abbotsford:{name:'The Abbotsford Hotel',address:'14 Corsehill Road, Ayr KA7 2ST',lat:55.4488797,lng:-4.6314856,source:'Official FSA1696388, exact address match verified6 Nov2026'},kirkton:{name:'The Kirkton Inn',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',lat:55.3971215,lng:-4.5920177,source:'Public FSA establishment1955433 verified6 November2026'},greenside:{name:'The Greenside Restaurant',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',lat:55.3542369,lng:-4.6851418,source:'Official Find us Google Maps link, place point, verified 6 November 2026'},kirkmichael:{name:'The Kirkmichael Arms',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',lat:55.3458202,lng:-4.6180793,source:'venue-profile.json geo, matched to the venue address'},souters:{name:"Souter\u2019s Inn",address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',lat:55.3297218,lng:-4.7772979,source:'Food Standards Agency establishment 1863840, address matched'}},o=t=>Object.prototype.hasOwnProperty.call(a,t),s=t=>o(t)?a[t]:void 0;function l(n,a){return o(n)||(0,t.isQueuedVenue)(n)?'in'===a.action?{action:'in',at:a.at,inside:a.inside,...a.override?{override:{by:a.override.by,byId:a.override.byId,reason:a.override.reason}}:{}}:void 0:a}},869,[6,870]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_RADIUS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_RADIUS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ACCURACY_CAP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_BREAK_OPTIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_CLOCK_AREA",{enumerable:!0,get:function(){return r}}),e.distanceM=s,Object.defineProperty(e,"validLat",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validLng",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"areaSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"clampRadius",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"accuracyAllowance",{enumerable:!0,get:function(){return p}}),e.isInside=h,e.cleanArea=function(t){const n=(t.breakOptions??a).map(t=>Math.round(Number(t))).filter(t=>Number.isFinite(t)&&t>0&&t<=180);return{...r,...t,lat:c(t.lat)?t.lat:null,lng:l(t.lng)?t.lng:null,radius:f(t.radius??r.radius),on:!1!==t.on,offRotaPrompt:!1!==t.offRotaPrompt,breakOptions:[...new Set(n)].sort((t,n)=>t-n).slice(0,12),offRotaTitle:(t.offRotaTitle??'').trim().slice(0,80)||r.offRotaTitle,offRotaBody:(t.offRotaBody??'').trim().slice(0,160)||r.offRotaBody}},Object.defineProperty(e,"ACTION_WORD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DENIED_TEXT",{enumerable:!0,get:function(){return m}}),e.gate=function(t,n,o,a,r="browser"){if(!t.on||!d(t)){const r={action:n,at:a,inside:null,unchecked:!0};return'object'==typeof o&&Object.assign(r,{lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc)}),{allowed:!0,geo:r,warn:t.on?'The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':void 0}}if('object'!=typeof o){const t='app-phone-off'===r?m['app-phone-off']:'denied'===o?m[r]:'timeout'===o?'Your phone couldn\u2019t find your location in time. Step outside or near a window and try again.':'unsupported'===o?'This phone or browser can\u2019t share its location. Ask a manager to record it for you.':'Your phone couldn\u2019t find your location. Check Location is on, then try again.';return{allowed:!1,message:`You need to be at the venue to ${b[n]}. ${t}`,geo:{action:n,at:a,inside:!1}}}const u=h(t,o),s={action:n,at:a,lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc),dist:u.dist,inside:u.inside};if(u.inside)return{allowed:!0,geo:s};const c=u.dist>=1e3?`${(u.dist/1e3).toFixed(1)} km`:`${u.dist} m`;return{allowed:!1,geo:s,message:`You need to be at the venue to ${b[n]}. You look to be about ${c} away (allowed ${u.limit} m). If you\u2019re at the venue, try again in a moment or ask a manager to record it for you.`}},e.overrideGeo=function(t,n,o,a){const r=a.trim();return r.length<3?null:{action:t,at:n,inside:null,override:{by:o.name,byId:o.id,reason:r.slice(0,200)}}},e.offRotaDue=function(t){return!(!(t.area.offRotaPrompt&&d(t.area)&&t.inside)||t.clockedIn||t.dismissedToday)&&!t.shifts.some(n=>t.nowHours>=n.start-1&&t.nowHours<(n.end<=n.start?n.end+24:n.end))},Object.defineProperty(e,"breakLabel",{enumerable:!0,get:function(){return O}});const t=50,n=2e3,o=50,a=[5,10,15,20,30,45,60],r={lat:null,lng:null,radius:100,on:!0,breakOptions:[...a],offRotaPrompt:!0,offRotaTitle:'Do you want to sign in?',offRotaBody:'Should you be on the rota?'},u=t=>t*Math.PI/180;function s(t,n){const o=u(n.lat-t.lat),a=u(n.lng-t.lng),r=Math.sin(o/2)**2+Math.cos(u(t.lat))*Math.cos(u(n.lat))*Math.sin(a/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(r)))}const c=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-90&&t<=90,l=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-180&&t<=180,d=t=>c(t.lat)&&l(t.lng),f=o=>Number.isFinite(o)?Math.min(n,Math.max(t,Math.round(o))):r.radius,p=t=>Number.isFinite(t)&&t>0?Math.min(t,o):0;function h(t,n){const o=s({lat:t.lat,lng:t.lng},n),a=f(t.radius)+p(n.acc);return{inside:o<=a,dist:Math.round(o),limit:Math.round(a)}}const b={in:'clock in',out:'clock out',break_start:'start a break',break_end:'end your break'},m={browser:'Location is turned off for this browser. Turn it on in your phone\u2019s settings (Location \u203a allow for this browser), then try again.',iphone:'Location is turned off for this app. On your iPhone open Settings \u203a Privacy & Security \u203a Location Services \u203a Safari Websites and choose While Using the App, then try again.',app:'Location is turned off for this app. Tap Open app settings, then Permissions \u203a Location \u203a Allow only while using the app. Then come back and try again.','app-old':'This version of the app can\u2019t use location. Tap Update the app at the bottom of the screen, then tap Allow when your phone asks.','app-phone-off':'Location is switched off on your phone. Tap Open location settings, turn on Use location, then come back and try again.'};const y=t=>Math.round(1e6*t)/1e6;const O=t=>60===t?'1 hour':t%60==0?t/60+" hours":t>60?`${Math.floor(t/60)} h ${t%60} min`:`${t} min`},870,[]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},871,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FETCH_TIMEOUT_MS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"READER_TIMEOUT_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"fetchLimitMs",{enumerable:!0,get:function(){return _}}),_e.fetchWithTimeout=S,_e.getSupabase=function(){if(c)return c;if(!(0,s.isSupabaseConfigured)())throw new Error('Supabase is not configured: set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in .env.local');return c=(0,o.createClient)(s.SUPABASE_URL,s.SUPABASE_ANON_KEY,{auth:{storage:n.default,persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!1,storageKey:`${(0,u.syncNamespace)()}auth`},realtime:{params:{eventsPerSecond:10}},global:{fetch:S}}),c},_e.setSupabaseClient=function(e){c=e};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),u=r(d[3]);let c=null;const f=2e4,l=15e4,b=/\/functions\/v1\/(delivery-read|plan-photo-read)(\?|$)/,_=e=>b.test(e)?l:/\/storage\/v1\//.test(e)?12e4:f;function S(e,t){const n='string'==typeof e?e:e instanceof URL?e.href:e.url,o=_(n);if('undefined'==typeof AbortController)return fetch(e,t);const s=new AbortController,u=t?.signal;u&&(u.aborted?s.abort():u.addEventListener('abort',()=>s.abort(),{once:!0}));const c=setTimeout(()=>s.abort(),o);return fetch(e,{...t,signal:s.signal}).catch(e=>{if(s.signal.aborted&&!u?.aborted)throw new TypeError(`Failed to fetch (network timeout after ${o/1e3} s)`);throw e}).finally(()=>clearTimeout(c))}},872,[1160,1192,1153,1234]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedSessions=o,e.queuedRequestSlots=u,e.queuedRequestError=function(t,o,s,a=new Date){if(o.name.trim().length<2||o.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(o.phone)||!/^[0-9]{7,15}$/.test(o.phone.replace(/\D/g,''))||o.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email))return'Enter your name, phone number and email.';if(o.notes.length>2e3)return'Keep notes under 2000 characters.';const c=(0,n.localDate)(a),d=(0,n.localDate)(new Date(+a+63072e6));if(!o.date||o.dated||!u(t,o.date,s).includes(o.time||''))return'Choose a future date and a time within confirmed kitchen service hours.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return o.date===c&&(o.time||'')<=l?'Choose a future time.':!Number.isInteger(o.covers)||o.covers<1||o.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]),n=r(_d[1]);function o(n){const o=t.queuedVenues[n];return o?.kitchenSessionsByDay??o?.hours.sessionsByDay??void 0}const s=t=>60*+t.slice(0,2)+ +t.slice(3);function u(n,u,a){if(!/^\d{4}-\d{2}-\d{2}$/.test(u))return[];const c=new Date(u+'T12:00:00Z');if(!Number.isFinite(+c)||c.toISOString().slice(0,10)!==u)return[];const d=(a??o(n))?.[c.getUTCDay()];if(!Array.isArray(d))return[];const l=[],f=t.queuedVenues[n]?.booking.lastSittingMinutesBeforeClose??0;for(const t of d){if(!Array.isArray(t)||2!==t.length||!t.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))continue;const n=s(t[0]),o=s(t[1]);if(!(n>=o))for(let t=n;t(0,t.getSupabase)();const s=e=>{const t=String(e?.message||'');return/^(Requests are not enabled|Too many|Please complete|Enter your|Choose |This request|Only this venue)/.test(t)?t:'Unable to send or load requests. Check your connection and try again, or call the hotel.'}},875,[6,872]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_BG",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SOUTERS_SURFACE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_TYPE_SCALE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"soutersFont",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"soutersSurface",{enumerable:!0,get:function(){return f}}),e.soutersInk=function(o){if(!t.IS_SOUTERS)return o;const c=(0,n.normaliseHex)(o);return c?'#A4622E'===c?'#D9AD8A':(0,n.contrast)(c,u)<4.5?'#FFFFFF':o:o};var t=r(d[0]),n=r(d[1]);const u='#56152A',o='#43122F',c=.88,S=n=>t.IS_SOUTERS?Math.round(n*c*100)/100:n,f=n=>t.IS_SOUTERS?o:n},876,[5,1319]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.specialsBoardSpec=function(r,s){return{name:'specials_boards',table:'specials_boards',conflict:'venue_id',deletes:!1,list:()=>[{id:r,board:t.useSpecials.getState().current[r]??null}],key:()=>r,rowKey:()=>r,syncable:t=>!t.board||!String(t.board.id).startsWith('sb-seed'),writable:s,toRow:(t,s)=>({venue_id:s,doc:{board:t.board?{...t.board,restaurantId:r}:null},updated_at:(new Date).toISOString()}),fromRow:t=>({id:r,board:t.doc?.board??null}),apply:s=>{const n=s[0];if(!n)return;const o=n.board;o&&o.restaurantId&&o.restaurantId!==r||t.useSpecials.setState(t=>({current:{...t.current,[r]:o}}))},subscribe:r=>t.useSpecials.subscribe((t,s)=>{t.current!==s.current&&r()})}},Object.defineProperty(e,"specialsSyncOn",{enumerable:!0,get:function(){return c}}),e.watchGuestSpecials=function(c,l=()=>{}){if(!r.RELEASE.specialsSync||!(0,n.isSupabaseConfigured)())return()=>{};let u=!1;const p=async()=>{const r=t.useSpecials.getState().current[c]??null;let n;try{const t=(0,o.getSupabase)(),{data:r,error:l}=await t.rpc('guest_specials',{p_slug:c});if(l)n={ok:!1,message:s.GUEST_SPECIALS_OFFLINE};else if(r&&'object'==typeof r){const t=r,s='string'==typeof t.postedAt?t.postedAt:'',o=Array.isArray(t.items)?t.items:[],l=t.photo??null;n=s||l||o.length?{ok:!0,board:{id:`sb-sync-${c}`,restaurantId:c,photo:l,items:o,postedAt:s||new Date(0).toISOString(),postedBy:'',app:'managers',allergenCheck:null}}:{ok:!0,board:null}}else n={ok:!0,board:null}}catch{n={ok:!1,message:s.GUEST_SPECIALS_OFFLINE}}if(u)return;const p=(0,s.guestSpecialsAfter)(t.useSpecials.getState().current[c]??null,n);p.board!==r&&t.useSpecials.setState(t=>({current:{...t.current,[c]:p.board}})),l(p.note)};p();const S=setInterval(()=>{p()},6e4);return()=>{u=!0,clearInterval(S)}};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]),o=_r(d[4]);const c=()=>r.RELEASE.specialsSync},877,[864,1070,1270,1153,872]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},878,[31,128,1474,825,25]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.forecastToday=function(u,c,h,f,p,v){const k=(0,e.venueBusy)(u,c,p),M=(0,a.examplesAllowed)(),b=(0,n.clampWeeks)(u.settings.forecastMinWeeks),w=M?null:v??(0,n.buildHistory)(u.id,c,h,[],p,b),H=M||!!w?.enough,O=(0,r.hoursFor)(u,p),S=[],C=(0,s.ymd)(p);let I=1;for(const e of f.filter(e=>e.date===C&&(null===e.restaurantId||e.restaurantId===u.id)))S.push(e.title.replace(/\s*\(substitute day\)/gi,'')),!1!==e.busier&&(I*='bank-holiday'===e.kind?1.25:'event'===e.kind?1.15:1.1);if(!O)return{busy:k,open:!1,hours:[],restOfDay:{covers:0,low:0,high:0,takeaway:0,booked:0},flags:S,suggestions:['Kitchen closed today (per listed hours).'],multiplier:I,example:M,enough:H,minWeeks:b};const x=M?o.EXAMPLE_HISTORY[u.id]??o.EXAMPLE_HISTORY.default:H&&w?w:{covers:{},takeaway:{}},E=p.getDay(),N=l(u,p),$=(0,t.lastFoodOn)(u,C);let _=O.close.getMinutes()>0?O.close.getHours():O.close.getHours()-1;if($){const[e,t]=$.time.split(':').map(Number);_=Math.min(_,t>0?e:e-1),'kitchen closes'!==$.reason&&S.push(`Last food orders ${$.time} (${$.reason})`)}const P=c.filter(e=>e.restaurantId===u.id&&e.date===C&&['confirmed','seated','finished'].includes(e.status)),T=P.filter(e=>!e.walkIn&&'finished'!==e.status).map(e=>Number(e.time.slice(0,2))),A=Math.min(N[0],O.open.getHours(),...T),L=Math.max(N[1],_,...T),R=[];for(let e=A;e<=L;e++){const t=e>=O.open.getHours()&&e<=_,o=x.covers[E]?.[e]??0,r=x.takeaway[E]?.[e]??0,a=P.filter(t=>!t.walkIn&&'finished'!==t.status&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),n=P.filter(t=>t.walkIn&&['seated','finished'].includes(t.status)&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),i=t?Math.round(o*u.settings.walkInShare*I):0,c=H&&t?Math.max(0,Math.round(o*I*(1-u.settings.walkInShare))-a):0,l=Math.max(n,i)+c,f=a+l,p=h.filter(t=>t.restaurantId===u.id&&'takeaway'===t.type&&'cancelled'!==t.status&&t.slotTime&&new Date(t.slotTime).getHours()===e&&(0,s.ymd)(new Date(t.slotTime))===C).length,y=t?Math.max(p,Math.round(r*I)):p;R.push({hour:e,booked:a,walkIns:l,covers:f,coversLow:H?Math.round(.8*f):f,coversHigh:H?Math.round(1.2*f):f,takeawayPlaced:p,takeaway:y,historicalCovers:o})}const D=y(u,E);if(H&&D){const e=D-R.reduce((e,t)=>e+t.covers,0),t=R.filter(e=>e.hour>=O.open.getHours()&&e.hour<=_);if(e>0&&t.length){const o=t.map(e=>e.historicalCovers),r=i(e,o.reduce((e,t)=>e+t,0)>0?o:t.map(()=>1));t.forEach((e,t)=>{const o=r[t];o&&(e.floorAdded=o,e.walkIns+=o,e.covers+=o,e.coversHigh=Math.max(e.coversHigh,Math.round(1.2*e.covers)))})}const o=R.reduce((e,t)=>e+t.coversLow,0);if(oMath.max(1,e.covers)));t.forEach((t,o)=>{t.coversLow=Math.min(t.covers,t.coversLow+e[o])})}}const j=p.getHours()+(p.getMinutes()>=30?1:0),W=R.filter(e=>e.hour>=j),F=W[0],B=e=>W.reduce((t,o)=>t+e(o),0),G={covers:B(e=>e.covers),low:B(e=>e.coversLow),high:B(e=>e.coversHigh),takeaway:B(e=>e.takeaway),booked:B(e=>e.booked)},z=[],V=u.settings.capacityPerHour,X=W.reduce((e,t)=>!e||t.covers>e.covers?t:e,void 0);X&&X.covers>=.85*V&&z.push(`Dining room near capacity around ${String(X.hour).padStart(2,'0')}:00 (about ${X.covers} of ${V} covers) \u2014 consider pausing or capping takeaway slots then.`);const Y=W.find(e=>e.historicalCovers>0&&e.covers>1.1*e.historicalCovers);Y&&z.push(`Busier than a usual ${['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][E]} from ${String(Y.hour).padStart(2,'0')}:00 \u2014 consider one more on the floor.`);G.takeaway>=10&&z.push(`About ${G.takeaway} takeaway orders expected \u2014 prep extra haddock and chips.`);H||z.unshift(`Not enough history yet. ${(0,a.notEnoughTip)(b)}`);z.length||z.push('Looks like a normal service \u2014 no action suggested.');return{busy:k,open:!0,nextHour:F,hours:R,restOfDay:G,flags:S,suggestions:z,multiplier:I,example:M,enough:H,minWeeks:b,minCovers:D??void 0}},_e.spread=i,Object.defineProperty(_e,"ANCHORAGE_FORECAST_HOURS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"forecastHoursOf",{enumerable:!0,get:function(){return c}}),_e.forecastWindow=l,Object.defineProperty(_e,"ANCHORAGE_MIN_COVERS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"MIN_COVERS_NOTE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"minCoversOf",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"minCoversOn",{enumerable:!0,get:function(){return y}}),_e.coversRange=function(e,t,o=!0){const r=Math.min(e,t),s=Math.max(e,t),a=r===s?String(r):`${r} to ${s}`;return o?`${a} ${1===s?'Cover':'Covers'}`:a};var e=_r(d[0]),t=_r(d[1]),o=_r(d[2]),r=_r(d[3]),s=_r(d[4]),a=_r(d[5]),n=_r(d[6]);function i(e,t){const o=t.reduce((e,t)=>e+t,0)||1,r=t.map(t=>e*t/o),s=r.map(Math.floor);let a=e-s.reduce((e,t)=>e+t,0);return r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]).forEach(([,e])=>{a>0&&(s[e]++,a--)}),s}const u={0:['12:00','22:00'],1:null,2:null,3:['12:00','22:00'],4:['12:00','22:00'],5:['12:00','22:00'],6:['12:00','22:00']},c=e=>e.settings.forecastHours??('anchorage'===e.id?u:{});function l(e,t){const o=(0,r.hoursFor)(e,t),s=o.close.getMinutes()>0?o.close.getHours():o.close.getHours()-1,a=c(e)[t.getDay()];if(!a)return[o.open.getHours(),s];const[n]=a[0].split(':').map(Number),[i,u]=a[1].split(':').map(Number);return[Math.min(n,o.open.getHours()),Math.max(u>0?i:i-1,s)]}const h={0:50,6:50},f='Gordon, 4 Nov 2026',p=e=>e.settings.minCoversByDay??('anchorage'===e.id?h:{}),y=(e,t)=>{const o=p(e)[t];return o&&o>0?Math.round(o):null}},879,[933,814,1424,833,822,1183,1094]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.estimateWait=function(t,n,u){const o=Math.max(6,Math.round(n/6*u));return t*o}},880,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return y.uuid}}),_e.nowFrom=S,_e.linesFromBasket=w,Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return u.DEMO_CUSTOMER_ID}});var e,t=_r(d[0]),a=_r(d[1]),r=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),o=(e=i)&&e.__esModule?e:{default:e},l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),g=_r(d[9]),m=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),k=_r(d[14]),y=_r(d[15]);const $=(e,t,a)=>e.reduce((e,a)=>a.startsWith(t)?Math.max(e,Number(a.slice(t.length))||0):e,a)+1,I=e=>`${e}-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-3)}`;function S(e){return'live'===e.mode?new Date:new Date(e.simStartMs+(Date.now()-e.anchorRealMs))}function h(){const e=(0,u.defaultSimStart)();return{clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},...(0,u.buildSeed)(e),outbox:[],msgTemplates:{}}}function w(e,t,a){return e.lines.flatMap(e=>{const r=t.find(t=>t.id===e.itemId);if(!r)return[];const n=(0,b.resolveItem)(r),s=(n.optionGroups??[]).flatMap(t=>t.choices.filter(t=>e.choiceIds.includes(t.id))),i=(n.price??0)+s.reduce((e,t)=>e+t.priceDelta,0),o=(0,p.conflictsFor)((0,p.effectiveAllergens)(n,e.choiceIds),a);return[{itemId:n.id,name:n.name,qty:e.qty,unitPrice:i,choices:s.map(e=>e.label),notes:e.notes,contains:o.contains,may:o.may,overridden:!!e.override&&o.contains.every(t=>e.override.allergens.includes(t)),prepMins:n.prepMins,choiceIds:s.map(e=>e.id)}]})}const O=e=>{const t='ABCDEFGHJKLMNPQRSTUVWXYZ23456789',a=()=>Array.from({length:4},()=>t[Math.floor(32*Math.random())]).join('');return`${e}-${a()}-${a()}-${a()}`},C=(0,l.create)()((0,c.persist)((e,t)=>{const a=()=>S(t().clock),r=(t,r,n)=>e(e=>({audit:[{id:I('au'),restaurantId:t,at:a().toISOString(),kind:r,text:n},...e.audit].slice(0,300)})),n=(a,n,s)=>{if(!a||s<=0)return 0;const i=t().giftCards.find(e=>e.code===a&&e.restaurantId===n);if(!i||i.balance<=0)return 0;const o=Math.min(i.balance,s);return e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-o}:e)})),r(n,'giftcard',`Gift card ${a.slice(0,8)}\u2026 redeemed \xa3${(o/100).toFixed(2)} (balance \xa3${((i.balance-o)/100).toFixed(2)})`),o},s=e=>{const a=t().restaurants.find(t=>t.id===e.restaurantId);a&&e.customerId===t().customer.id&&e.subtotal>=a.settings.stampMinSpend&&t().addStamp(e.restaurantId,e.customerId,'takeaway'===e.type?'Takeaway (auto on collection)':'Table QR bill (auto on payment)')},i=e=>(0,f.templatesFor)(t().msgTemplates[e]),o=a=>{a.length&&(e(e=>({outbox:[...a,...e.outbox].slice(0,300)})),(0,f.deliverQueued)(a.filter(e=>'queued'===e.status),(e,a)=>t().updateOutbox(e,a)))},l=(e,r)=>{const n=t().restaurants.find(e=>e.id===r.restaurantId);n&&o((0,f.composeBooking)(e,r,n,i(n.id),a().toISOString()))},c=e=>{const r=t().restaurants.find(t=>t.id===e.restaurantId);r&&o((0,f.composeOrder)(e,r,i(r.id),a().toISOString()))};return{...h(),resetDemo:()=>e(h()),setClockMode:()=>e({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),skipMinutes:()=>{},updateCustomer:t=>e(e=>({customer:{...e.customer,...t}})),setAllergy:(t,a)=>e(e=>{const r=e.customer.allergies.filter(e=>e.allergen!==t);return{customer:{...e.customer,allergies:a?[...r,{allergen:t,severity:a}]:r}}}),startBasket:(t,a,r)=>e(e=>{const n=e.basket.restaurantId===t&&e.basket.mode===a&&e.basket.tableNo===r;return{basket:{restaurantId:t,mode:a,tableNo:r,lines:n?e.basket.lines:[]}}}),addLine:t=>e(e=>({basket:{...e.basket,lines:[...e.basket.lines,{...t,key:I('ln')}]}})),setLineQty:(t,a)=>e(e=>({basket:{...e.basket,lines:a<=0?e.basket.lines.filter(e=>e.key!==t):e.basket.lines.map(e=>e.key===t?{...e,qty:a}:e)}})),overrideLine:(t,r)=>e(e=>({basket:{...e.basket,lines:e.basket.lines.map(e=>e.key===t?{...e,override:{allergens:r,at:a().toISOString()}}:e)}})),clearBasket:()=>e(e=>({basket:{...e.basket,lines:[]}})),placeOrder:({slotTime:n,tip:s,notes:i,phone:o,email:l,customerName:u})=>{const g=t(),m=g.basket,p=m.restaurantId,b=w(m,g.menu,g.customer.allergies),f=b.reduce((e,t)=>e+t.unitPrice*t.qty,0),k='table'===m.mode,I=$(g.orders.filter(e=>e.restaurantId===p).map(e=>e.ref),k?'Q-':'T-',k?g.counters.table:g.counters.order),S=!k,h=f+(S?0:s),O=(u??'').trim()||g.customer.name,C={id:(0,y.uuid)(),ref:`${k?'Q':'T'}-${I}`,restaurantId:p,customerId:g.customer.id,customerName:O,type:m.mode,tableNo:m.tableNo,slotTime:n,lines:b,subtotal:f,tip:S?0:s,giftCardApplied:0,giftCardCode:void 0,total:h,paid:0,status:S?'awaiting_payment':'new',createdAt:a().toISOString(),allergies:g.customer.allergies,readiness:{},notes:i,channel:'app',...'takeaway'===m.mode?{phone:o??g.customer.phone,email:l??g.customer.email}:{}};e(e=>({orders:[C,...e.orders],basket:{...e.basket,lines:[]},counters:k?{...e.counters,table:I}:{...e.counters,order:I}}));const v=b.filter(e=>e.overridden);return r(p,'order',`Order ${C.ref} placed (${k?`Table ${m.tableNo}`:'takeaway'})${v.length?` \u2014 ALLERGY OVERRIDE on ${v.map(e=>e.name).join(', ')}`:''}`),C.allergies.length&&r(p,'allergy',`Allergies declared and confirmed by customer on ${C.ref}: ${C.allergies.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),'awaiting_payment'!==C.status&&c(C),C},setOrderStatus:(a,n,i)=>{const o=t().orders.find(e=>e.id===a);o&&((0,k.statusBlock)(o,n,(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===a?{...e,status:n}:e)})),r(o.restaurantId,'order',`${o.ref} \u2192 ${n}${i?` by ${i}`:''}`),'collected'===n&&'takeaway'===o.type&&s(o)))},ackOrderAllergy:(n,s)=>{const i=t().orders.find(e=>e.id===n);if(!i||!(0,k.canSign)(i,'kitchen',(0,k.linkedBooking)(i,t().bookings)))return;const o={by:s,at:a().toISOString()};e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyAck:o,status:'new'===e.status?'acknowledged':e.status}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 3/5 Kitchen on ${i.ref}: ${s} (chef signed off before cooking)`)},tickOrderAllergy:(n,s,i,o=!0)=>{const l=t().orders.find(e=>e.id===n);if(!l)return;const c={...l.allergyTicks??{}};o?c[s]={by:i,at:a().toISOString()}:delete c[s],e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyTicks:c}:e)})),r(l.restaurantId,'allergy',`${l.ref}: kitchen ${o?'confirmed':'unticked'} ${s} (${i})`)},ackReadiness:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);o&&('cook'===s&&(0,k.statusBlock)(o,'preparing',(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,readiness:{...e.readiness,[s]:{by:i,at:a().toISOString()}},status:'cook'===s&&['new','acknowledged'].includes(e.status)?'preparing':e.status}:e)})),r(o.restaurantId,'order',`${o.ref}: ${'cook'===s?'started cooking':'bagged'} (${i})`)))},handoverCheck:(n,s)=>{const i=t().orders.find(e=>e.id===n);i&&(0,k.canSign)(i,'table',(0,k.linkedBooking)(i,t().bookings))&&(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,handoverCheck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 5/5 Table on ${i.ref}: ${s} (served and checked with the guest; chain complete)`))},signAllergyStep:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o||!i.trim())return!1;const l=(0,k.linkedBooking)(o,t().bookings);if(!(0,k.canSign)(o,s,l))return!1;if('kitchen'===s)return t().ackOrderAllergy(n,i),!0;if('table'===s)return t().handoverCheck(n,i),!0;const c={by:i,at:a().toISOString()};'booked'===s&&l&&l.allergies.length&&!l.allergyAck?e(e=>({bookings:e.bookings.map(e=>e.id===l.id?{...e,allergyAck:c}:e)})):e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyChain:{...e.allergyChain,[s]:c}}:e)}));const u=(0,k.stepInfo)(s);return r(o.restaurantId,'allergy',`Allergen sign-off ${u.n}/5 ${u.label} on ${o.ref}: ${i} (${u.what.toLowerCase()})`),!0},customerSignal:(t,a)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,customerSignal:a}:e)})),setSplit:(t,a,r)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,tip:r,total:e.subtotal+r,split:{ways:a,paidShares:e.split?.paidShares??0}}:e)})),payTable:(a,{shares:i,giftCardCode:o})=>{const l=t().orders.find(e=>e.id===a);if(!l)return;const c=l.split?.ways??1,u=Math.ceil(l.total/c),g=Math.min(c,(l.split?.paidShares??0)+i),m=g>=c,p=m?l.total-l.paid:Math.min(l.total-l.paid,u*i),b=n(o,l.restaurantId,p),f={...l,giftCardApplied:l.giftCardApplied+b,giftCardCode:b?o:l.giftCardCode,paid:l.paid+p,split:{ways:c,paidShares:g},status:m?'closed':l.status};e(e=>({orders:e.orders.map(e=>e.id===a?f:e)})),r(l.restaurantId,'order',`${l.ref} (Table ${l.tableNo}) ${m?'bill paid in full':`share ${g}/${c} paid`} (paid at the till)`),m&&s(f)},createBooking:n=>{const s=$(t().bookings.filter(e=>e.restaurantId===n.restaurantId).map(e=>e.ref),'BK-',t().counters.booking),i=t().restaurants.find(e=>e.id===n.restaurantId)?.settings,o='online'===n.source&&!!i&&(n.partySize>(i.autoAcceptUpTo??7)||!!i.reviewRequests&&!!n.notes.trim()),c={...n,id:(0,y.uuid)(),ref:`BK-${s}`,status:o?'pending':'confirmed',createdAt:a().toISOString()};return e(e=>({bookings:[...e.bookings,c],counters:{...e.counters,booking:s}})),r(c.restaurantId,'booking',`Booking ${o?'request ':''}${c.ref}: ${c.name}, ${c.partySize} on ${c.date} ${c.time}${c.source?` (${c.source})`:''}${c.allergies.length?' \u2014 allergies declared':''}`),l(o?'booking-request':'booking-confirmation',c),c},decideBooking:(n,s,i)=>{const o=t().bookings.find(e=>e.id===n);if(!o||'pending'!==o.status)return;const c={by:i,at:a().toISOString(),outcome:s},u='confirmed'===s?'confirmed':'cancelled';e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:u,decided:c}:e)})),r(o.restaurantId,'booking',`Booking request ${o.ref} (${o.name}, ${o.partySize}) ${s} by ${i}`),l('confirmed'===s?'booking-confirmation':'booking-declined',{...o,status:u})},addOutbox:t=>e(e=>({outbox:[...t,...e.outbox].slice(0,300)})),updateOutbox:(t,a)=>e(e=>({outbox:e.outbox.map(e=>e.id===t?{...e,...a}:e)})),clearOutbox:t=>e(e=>({outbox:e.outbox.filter(e=>e.restaurantId!==t)})),setTemplate:(t,a,r)=>e(e=>{const n={...e.msgTemplates[t]??{}};return null===r?delete n[a]:n[a]={...n[a]??{},...r},{msgTemplates:{...e.msgTemplates,[t]:n}}}),acceptOrder:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o)return!1;const l='new'===o.status&&!!(0,k.statusBlock)(o,'acknowledged',(0,k.linkedBooking)(o,t().bookings)),c=a(),u=i?new Date(c.getTime()+6e4*i).toISOString():o.readyBy;return e(e=>({orders:e.orders.map(e=>e.id===n?{...e,status:'new'!==e.status||l?e.status:'acknowledged',accepted:e.accepted??{by:s,at:c.toISOString()},readyBy:u}:e)})),r(o.restaurantId,'order',`${o.ref} accepted by ${s}${i?`, ready by ${String(new Date(u).getHours()).padStart(2,'0')}:${String(new Date(u).getMinutes()).padStart(2,'0')}`:''}`),!l},setBookingStatus:(n,s)=>{const i=t().bookings.find(e=>e.id===n),o=a().toISOString();e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:s,...'seated'===s?{seatedAt:o}:'finished'===s?{finishedAt:o,table:void 0}:{}}:e)})),i&&r(i.restaurantId,'booking',`${i.ref} ${i.name} \u2192 ${s}`)},seatWalkIn:(n,s,i,o)=>{const l=a(),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,u=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,g=t().bookings.filter(e=>e.restaurantId===n&&e.walkIn&&e.date===c).reduce((e,t)=>Math.max(e,Number(t.ref.slice(2))||0),0)+1,m={id:(0,y.uuid)(),ref:`W-${g}`,restaurantId:n,customerId:null,name:'Walk-in',partySize:s,date:c,time:u,table:i||void 0,allergies:[],notes:(o??'').trim(),status:'seated',security:'none',depositPaid:0,createdAt:l.toISOString(),seatedAt:l.toISOString(),walkIn:!0,source:'walk-in'};return e(e=>({bookings:[...e.bookings,m]})),r(n,'walkin',`Walk-in ${m.ref} seated: ${s} cover(s)${i?`, Table ${i}`:', table to assign'}`),m},setBookingTable:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,table:n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.name} \u2192 ${n?n.includes('+')?`Tables ${n.split('+').join(' + ')}`:`Table ${n}`:'no table'}`)},updateBooking:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,...n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.walkIn?'Walk-in':s.name} moved/updated${n.table?` \u2192 Table ${n.table}`:''}${n.time?` at ${n.time}`:''}${n.durationMins?` for ${n.durationMins} min`:''}`)},undoWalkIn:a=>{const n=t().bookings.find(e=>e.id===a);n&&n.walkIn&&(e(e=>({bookings:e.bookings.filter(e=>e.id!==a)})),r(n.restaurantId,'walkin',`Walk-in ${n.ref} undone`))},ackBookingAllergy:(n,s)=>{const i=t().bookings.find(e=>e.id===n);i&&!i.allergyAck&&(e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,allergyAck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 1/5 Booked on ${i.ref} (${i.name}): ${s} (allergy recorded)`))},joinWaitlist:(n,s,i,o)=>{const l=t().waitlist.filter(e=>e.restaurantId===n).reduce((e,t)=>Math.max(e,t.number),0)+1,c={id:I('wl'),restaurantId:n,number:l,name:s,partySize:i,joinedAt:a().toISOString(),status:'waiting',customerId:o};return e(e=>({waitlist:[...e.waitlist,c]})),r(n,'waitlist',`${s} (${i}) joined the waitlist as #${l}`),c},setWaitlistStatus:(a,n)=>{const s=t().waitlist.find(e=>e.id===a);e(e=>({waitlist:e.waitlist.map(e=>e.id===a?{...e,status:n}:e)})),s&&(r(s.restaurantId,'waitlist',`Waitlist #${s.number} ${s.name} \u2192 ${n}`),'seated'===n&&t().addWalkIn(s.restaurantId,s.partySize))},addWalkIn:(t,a)=>{e(e=>({walkIns:{...e.walkIns,[t]:(e.walkIns[t]??0)+a}})),r(t,'walkin',`Walk-in seated: ${a} cover(s)`)},addStamp:(n,s,i)=>{const o=t().restaurants.find(e=>e.id===n);o&&(e(e=>{const t=e.stampCards.find(e=>e.restaurantId===n&&e.customerId===s),r=t??{restaurantId:n,customerId:s,stamps:0,rewardsAvailable:0,history:[]};let l=r.stamps+1,c=r.rewardsAvailable;l>=o.settings.stampTarget&&(l=0,c+=1);const u={...r,stamps:l,rewardsAvailable:c,history:[{at:a().toISOString(),source:i},...r.history]};return{stampCards:t?e.stampCards.map(e=>e===t?u:e):[...e.stampCards,u]}}),r(n,'stamp',`Stamp added (${i})`))},redeemReward:(t,a)=>{e(e=>({stampCards:e.stampCards.map(e=>e.restaurantId===t&&e.customerId===a&&e.rewardsAvailable>0?{...e,rewardsAvailable:e.rewardsAvailable-1}:e)})),r(t,'stamp','Loyalty reward redeemed')},buyGiftCard:(n,s,i,o)=>{const l=n.slice(0,3).toUpperCase(),c={id:I('gc'),code:O(l),restaurantId:n,initial:s,balance:s,ownerId:t().customer.id,recipientName:i,message:o,createdAt:a().toISOString()};return e(e=>({giftCards:[c,...e.giftCards]})),r(n,'giftcard',`Gift card sold \xa3${(s/100).toFixed(2)} (demo payment)`),c},redeemGiftCard:(a,n,s)=>{const i=t().giftCards.find(e=>e.code.toUpperCase()===a.trim().toUpperCase());return!(!i||n<=0||n>i.balance)&&(e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-n}:e)})),r(i.restaurantId,'giftcard',`Gift card ${i.code} redeemed \xa3${(n/100).toFixed(2)} by ${s}`),!0)},honourLegacyCard:(t,n,s,i)=>{const o={id:I('gc'),code:n.trim().toUpperCase(),restaurantId:t,initial:s,balance:s,ownerId:'legacy',recipientName:'Legacy website bookings gift card',message:`Honoured by ${i}`,createdAt:a().toISOString().slice(0,10),legacy:!0};return e(e=>({giftCards:[o,...e.giftCards]})),r(t,'giftcard',`Legacy website bookings gift card ${o.code} honoured (\xa3${(s/100).toFixed(2)}) by ${i}`),o},addEvent:t=>e(e=>({events:[...e.events,{...t,id:I('ev')}]})),addRating:t=>{e(e=>({ratings:[{...t,id:I('rt'),createdAt:a().toISOString()},...e.ratings],orders:t.orderId?e.orders.map(e=>e.id===t.orderId?{...e,rated:!0}:e):e.orders})),r(t.restaurantId,'rating',`Private rating ${t.stars}/5 from ${t.customerName}`)},updateMenuItem:(a,n)=>{const{name:s,section:i,price:o,allergens:l,allergenNotes:c,...u}=n,g={};void 0!==s&&(g.dish=s),void 0!==i&&(g.section=i),'price'in n&&(g.price=o??null),void 0!==l&&(g.allergens=l),'allergenNotes'in n&&(g.allergenNotes=c);const m='optionGroups'in n,p=(0,b.menuCardBridge)();p&&(Object.keys(g).length||m)&&p.menuEdited(a,g,'CoverCharge for Managers',m);const f=p?u:n;Object.keys(f).length&&e(e=>({menu:e.menu.map(e=>e.id===a?{...e,...f}:e)}));const k=t().menu.find(e=>e.id===a);k&&Object.keys(f).length&&r(k.restaurantId,'menu',`Menu: ${(0,b.resolveItem)(k).name} updated`)},setSignOff:(t,r)=>{const n=(0,b.menuCardBridge)();n?r?n.signOff(t,r):n.menuEdited(t,{},'CoverCharge for Managers',!0):e(e=>({menu:e.menu.map(e=>e.id===t?{...e,signOff:r?{by:r,at:a().toISOString().slice(0,10)}:null}:e)}))},addAudit:(e,t,a)=>r(e,t,a),updateSettings:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,settings:{...e.settings,...a}}:e)})),'takeawayPaused'in a&&r(t,'order',"Takeaway slots "+(a.takeawayPaused?'PAUSED':'resumed'))},addMenuItem:t=>{const a=I('m');return e(e=>({menu:[...e.menu,{...t,id:a}]})),(0,b.menuCardBridge)()?.menuItemAdded({...t,id:a}),r(t.restaurantId,'menu',`Menu: ${t.name} added (recipe card awaiting head chef sign-off)`),a},updateRestaurant:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,...a}:e)})),r(t,'menu',`Restaurant info updated (${Object.keys(a).join(', ')})`)},placeManualOrder:({restaurantId:n,type:s,channel:i,customerName:o,phone:l,email:u,tableNo:g,slotTime:m,lines:f,allergies:k,notes:I,by:S})=>{const h=t(),w=f.flatMap(({itemId:e,qty:t})=>{const a=h.menu.find(t=>t.id===e);if(!a||t<=0)return[];const r=(0,b.resolveItem)(a),n=(0,p.conflictsFor)((0,p.effectiveAllergens)(r),k);return[{itemId:e,name:r.name,qty:t,unitPrice:r.price??0,choices:[],notes:'',contains:n.contains,may:n.may,overridden:!1,prepMins:r.prepMins}]}),O=w.reduce((e,t)=>e+t.unitPrice*t.qty,0),C='table'===s,v=$(h.orders.filter(e=>e.restaurantId===n).map(e=>e.ref),C?'Q-':'T-',C?h.counters.table:h.counters.order),A={id:(0,y.uuid)(),ref:`${C?'Q':'T'}-${v}`,restaurantId:n,customerId:`manual-${i}`,customerName:o||(C?`Table ${g}`:'Walk-in'),type:s,tableNo:g,slotTime:m,lines:w,subtotal:O,tip:0,giftCardApplied:0,total:O,paid:0,status:'new',createdAt:a().toISOString(),allergies:k,readiness:{},notes:I,channel:i,...l?{phone:l}:{},...u?{email:u}:{},...k.length?{allergyChain:{booked:{by:S,at:a().toISOString()}}}:{}};return e(e=>({orders:[A,...e.orders],counters:C?{...e.counters,table:v}:{...e.counters,order:v}})),r(n,'order',`Order ${A.ref} taken by ${S} (${'phone'===i?'phone':'walk-in'===i?'walk-in takeaway':`Table ${g}`})`),k.length&&r(n,'allergy',`Allergen sign-off 1/5 Booked on ${A.ref}: ${S} recorded ${k.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),(l||u)&&c(A),A},ackAlert:(t,r)=>e(e=>({alertAcks:{...e.alertAcks,[t]:{by:r,at:a().toISOString()}}}))}},{name:'covercharge-demo-v1',version:9,migrate:async(e,t)=>{if(!e)return e;if(n.LIVE_VENUE_BUILD)return await(0,s.archiveChefCache)('core',e),Object.assign(e,(0,r.stripCoreLiveSamples)(e)),e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},e;if(e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},t<6){try{e.restaurants=(e.restaurants??[]).map(e=>'saltmarsh'===e?.id?{...e,name:'The Venue'}:e)}catch{}try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e?.id&&JSON.stringify(e.kitchenHours)===JSON.stringify(g.ANCHORAGE_KITCHEN_OLD)?{...e,kitchenHours:g.ANCHORAGE_KITCHEN,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.'}:e)}catch{}}if(t<5)try{e.events=(e.events??[]).map(e=>'string'==typeof e?.title&&/\(substitute day\)/i.test(e.title)?{...e,title:e.title.replace(/\s*\(substitute day\)/gi,'').trim()}:e)}catch{}if(t<4)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id&&e.settings&&!e.settings.pay?{...e,settings:{...e.settings,pay:g.ANCHORAGE_PAY}}:e)}catch{}if(t<3)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id?{...e,settings:{...e.settings,orderAtTable:!1}}:e),e.orders=(e.orders??[]).filter(e=>'ord-seed-3'!==e.id&&'Q-2018'!==e.ref),e.audit=(e.audit??[]).filter(e=>!String(e.text??'').includes('Q-2018'))}catch{}if(t>=2)return e;try{const t=(0,u.buildSeed)((0,u.defaultSimStart)()),a=new Map(t.bookings.map(e=>[e.id,e])),r=new Set((0,m.anchoragePlan)().tables.map(e=>e.name)),n=e=>!e||e.split('+').every(e=>r.has(e));e.bookings=(e.bookings??[]).map(e=>{const t=a.get(e.id);return t?{...e,table:t.table,dog:t.dog,notes:t.notes}:'anchorage'!==e.restaurantId||n(e.table)?e:{...e,table:void 0}})}catch{}return e},merge:(e,r)=>{const n={...r,...e};return a.IS_WILDINGS&&(n.restaurants=n.restaurants.map(t.withWildingsAddress)),n},storage:(0,c.createJSONStorage)(()=>o.default)}))},881,[1155,5,1156,842,1159,1160,995,1169,1170,3,1071,819,1177,827,976,1099]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShallow",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]);function o(e){const t=u.default.useRef(void 0);return u=>{const o=e(u);return(0,n.shallow)(t.current,o)?t.current:t.current=o}}},884,[31,1182]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLE_ORDER_DEFAULT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"cleanToken",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"isTableNo",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fromRow",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"toRow",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"hm",{enumerable:!0,get:function(){return l}}),_e.openAt=function(e,t){const r=a(t),n=e.openFrom?a(e.openFrom):null,o=e.lastOrders?a(e.lastOrders):null;return null!==n&&null!==o?n<=o?r>=n&&r=n||r=n:null===o||r{const t=(e??'').trim().toUpperCase();return/^[A-Z2-9]{16}$/.test(t)?t:null},r=e=>/^[0-9]{1,4}$/.test(e),n=t=>t?{on:!!t.is_on,tables:Array.isArray(t.tables)?t.tables.map(String):null,staffAccept:!1!==t.staff_accept,openFrom:t.open_from?String(t.open_from).slice(0,5):null,lastOrders:t.last_orders?String(t.last_orders).slice(0,5):null,guestTip:t.guest_tip??''}:{...e},o=e=>({is_on:e.on,tables:e.tables&&e.tables.length?e.tables.filter(r):null,staff_accept:e.staffAccept,open_from:e.openFrom,last_orders:e.lastOrders,guest_tip:e.guestTip.slice(0,300)}),a=e=>{const[t,r]=e.split(':').map(Number);return 60*t+r},l=e=>`${String(Math.floor(e/60)%24).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`;const s=(e,t)=>e.reduce((e,r)=>e+r.qty*(t.find(e=>e.id===r.id)?.pricePence??0),0),u=(e,t,r)=>e.map(e=>t.find(t=>t.id===e.id)).filter(e=>!!e&&(e.allergens.some(e=>r.includes(e))||e.mayContain.some(e=>r.includes(e)))),c=(e,t)=>`${e.replace(/\/$/,'')}/t?k=${t}`,f=(e,t)=>`${e.replace(/\/$/,'')}/customer-app/index.html?table=${t}`,p=e=>{const t=e.trim();return t.length>=2&&t.length<=40&&/\p{L}/u.test(t)},b=e=>{const t=e.trim();return!t||/^\+?[0-9][0-9 ()-]{6,19}$/.test(t)},m=e=>'table'===e.type&&'table-qr'===e.channel,y=e=>m(e)&&!!e.held&&!e.accepted&&'cancelled'!==e.status,h=e=>!y(e),O=e=>'cancelled'===e.status?e.cancelReason?`Cancelled: ${e.cancelReason}`:'Cancelled by the staff.':e.held&&!e.accepted?'Sent. Waiting for a member of staff to accept it.':'served'===e.status||'collected'===e.status||'closed'===e.status?'Served. Enjoy!':'ready'===e.status?'Ready: on its way to your table.':'Accepted: the kitchen has your order.',P=['Sold out','Wrong table','Sent twice','Kitchen closed','Guest asked to cancel'],j='Pay at the bar or with your server. Paying by card from your phone is coming later.'},887,[]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.venueBusy=function(n,s,a){const d=(0,t.ymd)(new Date(a.getTime()-48384e5)),r=(0,t.ymd)(a),u=n.settings.busyLearningSince,o=u&&/^\d{4}-\d{2}-\d{2}$/.test(u)&&u>d?u:d,l=new Map,y=new Set,c=new Set,h=new Set;for(const a of s){if(h.has(a.id)||a.restaurantId!==n.id||a.date=r||!['confirmed','seated','finished'].includes(a.status)||!Number.isFinite(a.partySize)||a.partySize<=0)continue;h.add(a.id),y.add(a.date);const s=new Date(a.date+'T12:00:00');s.setDate(s.getDate()-(s.getDay()+6)%7),c.add((0,t.ymd)(s));const d=a.date+'T'+a.time.slice(0,2);l.set(d,(l.get(d)??0)+a.partySize)}const w=[...l.values()].sort((t,n)=>t-n),f=[...y].sort(),M=(f.length?Math.round((new Date(r+'T12:00:00').getTime()-new Date(f[0]+'T12:00:00').getTime())/864e5):0)>=28&&c.size>=4&&y.size>=16&&w.length>=40,b=n.settings.busyCoversPerHour,v=Number.isFinite(b)&&b>=1?Math.round(b):30,S=M&&!1!==n.settings.busyLearning,z=S?Math.max(1,Math.ceil(w[Math.ceil(.85*w.length)-1])):v,D=Math.max(1,Math.ceil(z/2));return{busy:z,steady:D,learned:S,weeks:c.size,enough:M,words:`Busy level: ${z} Covers an hour (${S?`learned from your last ${c.size} weeks`:null!=b?'set by you':'starting level'})`}},e.hourlyBand=function(t,n){return t>=n?'Busy':t>=Math.ceil(n/2)?'Steady':'Quiet'};var t=_r(_d[0])},933,[822]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEEN",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOUTERS_GUIDE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"KIRKMICHAEL_GUIDE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WILDINGS_GUIDE",{enumerable:!0,get:function(){return o}}),_e.guideCalendarEvents=function(e,t){return e.events.filter(e=>e.date).map(e=>({id:`${t}-ev-${e.date}-${e.title.toLowerCase().replace(/[^a-z0-9]+/g,'-').slice(0,40)}`,restaurantId:t,date:e.date,title:e.title,kind:'event',description:`${e.when}. ${e.detail}`,example:!1,source:e.source,time:e.time}))};const e='10 November 2026',t={id:'souters',name:"Souter's Inn",place:'Kirkoswald, Ayrshire',about:["Souter's Inn is a restaurant and bar in the village of Kirkoswald, Ayrshire. The official site describes a cosy country welcome and menus built around regional produce, with a bar, an ice cream shop and cake corner, and an upstairs dining room for private events.","The building stands on the site of the school house that Robert Burns attended in 1772, according to the official about page. Souter Johnnie's house and the old parish church and graveyard, known from Tam o' Shanter, are nearby.",'The official menu page says the inn can seat up to 130 diners. It also has a takeaway menu and lists breakfast every day.'],hoursTitle:'Opening hours',hoursLines:['Open daily from 9am, seven days a week.','Breakfast: 9am\u201311.45am, Monday to Sunday.','\xc0 la carte, children\u2019s, vegetarian and takeaway menus: 12 noon\u20139pm, Monday to Sunday.','Desserts: 9am\u20139pm, Monday to Sunday.','Meat Feast menu: every Tuesday, 12 noon\u20139pm.'],hoursNotes:['These kitchen hours are from the official menu page, checked 10 November 2026. The official homepage also says the inn is open daily from 9am.','Destination South Ayrshire, checked the same day, lists the inn open 9am\u20139pm, seven days a week, and says food is served all day.','Christmas Day and other festive closing times were not published on the official site on 10 November 2026. Bar last orders are not listed separately from the 9pm food hours.'],hoursSource:'https://www.soutersinn.com/menu and https://www.soutersinn.com/ (10 November 2026); Destination South Ayrshire listing also checked the same day.',festive:{title:'Festive flavours, from 1 December',lines:['Festive dishes are served from 1 December, alongside the usual menu.','A set festive menu is offered for tables of 10 or more: two courses \xa329.95 or three courses \xa335.95, Monday to Sunday 12 noon\u20139pm, with crackers included. Coffee or tea with a mince pie is \xa33.00.'],source:'https://www.soutersinn.com/ and the Festive Menu PDF linked from https://www.soutersinn.com/menu (10 November 2026).'},eventsIntro:'The official What\u2019s On page describes regular quiz nights and live music, but on 10 November 2026 the only dated listing was already in the past. Upcoming details below are taken from the official homepage and festive menu. Call 01655 760653 to ask about dates.',events:[{title:'Festive dishes and set festive menu',when:'From 1 December 2026',date:'2026-12-01',detail:'Festive dishes join the usual menu from 1 December. The set festive menu is for tables of 10 or more, two courses \xa329.95 or three courses \xa335.95, 12 noon\u20139pm, crackers included.',source:'https://www.soutersinn.com/ and festive menu PDF (10 November 2026).'}],regularEvents:[{title:'Meat Feast Tuesdays',detail:'Every Tuesday, 12 noon\u20139pm, with a dedicated meat feast menu.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Quiz nights and live music',detail:'The official What\u2019s On page says quiz nights and weekend live music are a regular part of the calendar. No future dates were published on 10 November 2026 \u2014 call to ask what\u2019s next.',source:'https://www.soutersinn.com/whatson (10 November 2026).'}],address:'47 Main Road, Kirkoswald, Ayrshire KA19 8HY',phone:'01655 760653',email:'souters@southernayr.com',website:'https://www.soutersinn.com/',websiteLabel:'soutersinn.com',socials:[{label:'Facebook',url:'https://www.facebook.com/soutersinn'},{label:'Instagram',url:'https://www.instagram.com/soutersinn/'},{label:'TikTok',url:'https://www.tiktok.com/@souters_inn'}],mapQuery:'Souter\'s Inn, 47 Main Road, Kirkoswald, KA19 8HY',booking:['Send a table request in this app, or call 01655 760653. Staff will confirm. No payment is taken here.','A general table deposit and cancellation policy was not published on the official website on 10 November 2026.'],policies:[{title:'Allergens',body:'Menus can change with the season and fresh produce. Please tell waiting staff about allergens or other dietary needs before you order.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Parking and access',body:'Destination South Ayrshire, checked 10 November 2026, lists parking, blue badge parking, disabled access, free Wi-Fi, and a welcome for walkers and cyclists. The official website does not spell these out itself.',source:'https://destinationsouthayrshire.co.uk/eat-and-drink/souters-inn/ (10 November 2026).'},{title:'Children',body:'A children\u2019s menu is served Monday to Sunday, 12 noon\u20139pm.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Dogs',body:'A dog policy was not published on the official website or the Destination South Ayrshire listing on 10 November 2026. Please call to ask.',source:'Official site and Destination South Ayrshire, 10 November 2026.'}],drinks:{title:'The bar',body:'The official menu page describes a bar with wines, ales, whiskies and cocktails. A priced drinks list was not published on the pages checked on 10 November 2026.',source:'https://www.soutersinn.com/menu (10 November 2026).'},awards:['TripAdvisor Travellers\u2019 Choice 2026, and 4.3 out of 5 from 1,119 TripAdvisor reviews, checked 10 November 2026.'],reviews:[{summary:'4.3 out of 5 from 1,119 reviews on TripAdvisor, and a Travellers\u2019 Choice award in 2026.',source:'TripAdvisor listing for Souter\u2019s Inn, Kirkoswald, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g3649164-d6729564-Reviews-Souter_s_Inn-Kirkoswald_South_Ayrshire_Ayrshire_Scotland.html',quotes:[{text:'Absolute perfection from start to finish! \u2026 The atmosphere is warm and welcoming, and the service was top-notch right from the moment we walked through the door.',by:'Anna',date:'6 October 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'},{text:'The staff were superb, the ambiance was amazing. By far the best pub food I have ever had. Could not fault this establishment at all.',by:'johnhK5391CS',date:'28 September 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'},{text:'Really put these guys to the test today, table of 12 from toddlers to grandparents, everyone enjoyed their food, service was fantastic.',by:'Kate',date:'9 October 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'}]}],functions:[{title:'Upstairs private dining',body:'The official functions page says the upstairs room comfortably seats 45, or 60 standing, with its own private bar. It is offered for birthdays, family dinners, funeral gatherings, baby showers, ticketed events and live music, with options from afternoon tea and buffets to three-course menus.',source:'https://www.soutersinn.com/functions (10 November 2026).'},{title:'Mezzanine seating',body:'The official menu page describes the upper mezzanine as a private dining area with its own oak bar, overlooking the patisserie and the lower bar, and says it can seat up to 70 guests. That figure differs from the 45 seated / 60 standing numbers on the functions page. Both are from the official site; please ask the venue which applies to your booking.',source:'https://www.soutersinn.com/menu and https://www.soutersinn.com/functions (10 November 2026).'}],giftVouchers:'Gift vouchers are listed on the official website. Call 01655 760653 or use the Gift Voucher link on soutersinn.com to ask. No payment is taken in this app.',photos:[{file:'gallery-1.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7160-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'gallery-2.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7187-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'gallery-3.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7218-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'upstairs-1.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+1-1920w.jpg',page:'https://www.soutersinn.com/functions'},{file:'upstairs-2.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+2-1920w.jpg',page:'https://www.soutersinn.com/functions'},{file:'upstairs-3.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+3-1920w.jpg',page:'https://www.soutersinn.com/functions'}],gaps:['Christmas Day and other festive closing times not published on the official site (10 November 2026).','Dog policy not published.','Priced wine, ale and cocktail lists not on the official pages checked.','A general table deposit policy was not published (ticketed events have used a deposit in the past).','Bar last orders not listed separately.','A current VisitScotland listing was not retrieved today (the page request failed).','No live Google review count was confirmed today \u2014 TripAdvisor figures were used instead.'],conflicts:['Functions page: upstairs seats 45, or 60 standing. Menu page: mezzanine seats up to 70. Prefer neither figure alone \u2014 both are official; shown together.','Official about page: Burns attended the school house in 1772. Destination South Ayrshire says 1775. The app uses 1772 from the official site.']},s={id:'kirkmichael',name:'The Kirkmichael Arms',place:'Kirkmichael, Ayrshire',about:['The Kirkmichael Arms is a Michelin-listed restaurant and bar in the village of Kirkmichael, South Ayrshire. The official site says it has been a pub since 1700, and names it Best Scottish Pub at The Scotsman Scran Awards 2025.','Chef and owner Justin Galea, who trained in Melbourne, took the pub on sight unseen after it closed in 2023, when two locals set out to bring it back as the heart of the village. The Herald has named him one of the 50 most exciting chefs working in Scotland.','The kitchen smokes its own salmon, churns butter, cures bacon and bakes bread, drawing on Scottish produce with classical French technique and occasional Asian influences. The official site is clear that it is still a proper pub \u2014 Sunday lunch, a pint by the fire, or a full dinner.'],hoursTitle:'Opening hours',hoursLines:['Monday to Wednesday: closed.','Thursday to Sunday: from 1pm, until 10.30pm.'],hoursNotes:['The visible official website copy, checked 10 November 2026, says \u201cThursday to Sunday from 1pm\u201d and does not print a closing time. The same official homepage publishes hours data of 13:00\u201322:30 on those days, which is what is shown above.','Kitchen last orders are not listed separately from closing time.','Opening times between Christmas and New Year were still \u201cto be confirmed\u201d on the official Christmas 2026 page (updated 9 October 2026, checked 10 November 2026). The restaurant is closed on Christmas Day.'],hoursSource:'https://www.kirkmichaelarms.co.uk/ (visible copy and published hours data, 10 November 2026).',festive:{title:'Christmas and New Year 2026',lines:['Christmas Day boxes, for cooking at home, can be collected on Wednesday 23 December: \xa3205 feeds 4, or \xa3310 feeds 6, paid when you order. Email enquiries@thekirkmichaelarms.co.uk. Optional extras include beech-smoked salmon at \xa310 per 100g and bottled cocktails at \xa335\u2013\xa340.','Friday 11 December: Secret Santa name share. Friday 18 December: Christmas quiz, Secret Santa and pub Christmas party. Saturday 19 December: carol night, with loaded hot chocolate, mulled wine and mince pies. Sunday 20 December: Unofficial Christmas Lunch (also the Sunday carvery).','Christmas Eve (24 December): \xe0 la carte, no set festive menu. Christmas Day: restaurant closed. Boxing Day (26 December): dinner. Sunday 27 December: open as normal. New Year\u2019s Eve (31 December): \xa3125 per person.','Sunday carvery from 1pm on 6, 13, 20 and 27 December. Private Christmas parties and pub buyouts are available \u2014 email to discuss.'],source:'https://www.kirkmichaelarms.co.uk/wilderness-journal/best-christmas-dining-ayrshire (updated 9 October 2026, checked 10 November 2026).'},eventsIntro:'The official bar page mentions quiz nights and open-mic jams as part of pub life, without a dated public calendar beyond the Christmas 2026 lineup below.',events:[{title:'Secret Santa name share',when:'Friday 11 December 2026',date:'2026-12-11',detail:'Share your name for the Secret Santa, or drop your name and gift in any time before 18 December.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas quiz, Secret Santa and pub party',when:'Friday 18 December 2026',date:'2026-12-18',detail:'Festive quiz and the Matt Davey Secret Santa Extravaganza, with a stick-or-twist gift draw.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Carol night at the Arms',when:'Saturday 19 December 2026',date:'2026-12-19',detail:'Christmas music by the fire, with loaded hot chocolate, mulled wine and mince pies.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Unofficial Christmas Lunch and Sunday carvery',when:'Sunday 20 December 2026, from 1pm',date:'2026-12-20',time:'13:00',detail:'A proper Christmas roast on the Sunday before Christmas Day, and a Sunday carvery from 1pm.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas box collection',when:'Wednesday 23 December 2026',date:'2026-12-23',detail:'Collect Christmas Day boxes ordered in advance (\xa3205 for 4 or \xa3310 for 6). Restaurant is closed on Christmas Day.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas Eve dining',when:'Thursday 24 December 2026',date:'2026-12-24',detail:'\xc0 la carte, with no set Christmas menu.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Boxing Day dinner',when:'Saturday 26 December 2026',date:'2026-12-26',detail:'Open for dinner on Boxing Day.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Sunday carvery',when:'Sunday 27 December 2026, from 1pm',date:'2026-12-27',time:'13:00',detail:'Open as normal, with Sunday carvery from 1pm.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'New Year\u2019s Eve',when:'Thursday 31 December 2026',date:'2026-12-31',detail:'New Year\u2019s Eve, \xa3125 per person. Opening times earlier in that week were still to be confirmed.',source:'Official Christmas 2026 page, checked 10 November 2026.'}],regularEvents:[{title:'Quiz nights and open-mic jams',detail:'The official bar page lists quiz nights and open-mic jams as part of regular pub life. No separate future dates were published on 10 November 2026, apart from the Christmas quiz on 18 December.',source:'https://www.kirkmichaelarms.co.uk/bar (10 November 2026).'},{title:'Sunday carvery',detail:'Sunday carvery is a regular service. In December 2026 it is from 1pm on the 6th, 13th, 20th and 27th.',source:'Official Christmas 2026 page and Sunday carvery journal, 10 November 2026.'},{title:'Whisky tasting',detail:'The official site has a whisky tasting page and describes a carefully chosen malt list. Ask staff about current tastings and prices \u2014 many list prices were unpublished on the sample drinks menus.',source:'https://www.kirkmichaelarms.co.uk/ (10 November 2026).'}],address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',phone:'01655 750 200',email:'enquiries@thekirkmichaelarms.co.uk',website:'https://www.kirkmichaelarms.co.uk/',websiteLabel:'kirkmichaelarms.co.uk',socials:[{label:'Facebook',url:'https://www.facebook.com/kirkmichaelarms/'},{label:'Instagram',url:'https://www.instagram.com/kirkmichaelarms_unfiltered/'}],mapQuery:'The Kirkmichael Arms, 3-5 Straiton Road, Kirkmichael, KA19 7PH',booking:['Send a table request in this app, or call 01655 750 200, or email enquiries@thekirkmichaelarms.co.uk. Staff will confirm. No payment is taken here.','The official website, checked 10 November 2026, says: if you cancel less than 48 hours before your booking, or do not show up, there is a \xa325 charge per person. Parties of 6 or more are asked for a \xa315 per person deposit, redeemed when you visit.','Pub buyouts: Monday to Thursday \xa33,500; Friday to Sunday \xa35,000. Email for availability.'],policies:[{title:'Cancellation and deposits',body:'The venue\u2019s own website says a \xa325 per person charge applies if you cancel less than 48 hours before your booking or do not show up. Larger parties of 6 or more are asked to pay a \xa315 per person deposit, redeemed at the time of your visit. No deposit is taken in this app.',source:'https://www.kirkmichaelarms.co.uk/booking (10 November 2026).'},{title:'Dogs',body:'The official Sunday carvery journal says dogs are welcome in the pub area, and that there is no dress code.',source:'https://www.kirkmichaelarms.co.uk/wilderness-journal/best-sunday-carvery-ayrshire (10 November 2026).'},{title:'Children',body:'A sample children\u2019s menu is published, at \xa314.95 for three courses.',source:'https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'},{title:'Parking',body:'The official Sunday carvery journal says there is plenty of parking in the village. A dedicated venue car park is not described on the official pages checked.',source:'Official Sunday carvery journal, 10 November 2026.'},{title:'Accessibility',body:'An accessibility statement was not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Allergens',body:'Please speak to staff about allergens. Allergen information was not published on the sample menus checked on 10 November 2026.',source:'https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'}],drinks:{title:'The bar',body:'The official bar page describes a proper pub, with local beers, carefully chosen wines and malts, quiz nights and open-mic jams. Sample whisky and wine menus are on the official menus page; many prices were unpublished (ask staff).',source:'https://www.kirkmichaelarms.co.uk/bar and https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'},awards:['Best Scottish Pub, The Scotsman Scran Awards 2025 (official site, 10 November 2026).','Michelin-listed / Michelin-recommended (official site, 10 November 2026).','Justin Galea named among The Herald\u2019s 50 most exciting chefs in Scotland (official site, 10 November 2026).'],reviews:[{summary:'4.6 out of 5 from 700 reviews on TripAdvisor, checked 10 November 2026.',source:'TripAdvisor listing for The Kirkmichael Arms, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g551837-d2637644-Reviews-The_Kirkmichael_Arms-Maybole_South_Ayrshire_Ayrshire_Scotland.html',quotes:[]}],functions:[{title:'Private Christmas parties and pub buyouts',body:'The official Christmas page says larger gatherings can have a dedicated space and festive menus, and that pub buyouts are offered. The official booking page lists buyout rates of \xa33,500 Monday to Thursday and \xa35,000 Friday to Sunday.',source:'Official Christmas 2026 page and https://www.kirkmichaelarms.co.uk/booking (10 November 2026).'}],photos:[{file:'exterior.jpg',alt:'The Kirkmichael Arms, from the official website',source:'https://www.kirkmichaelarms.co.uk/photos/Kirkmichael%20Arms-20_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/'},{file:'interior.jpg',alt:'Inside The Kirkmichael Arms, from the official website',source:'https://www.kirkmichaelarms.co.uk/photos/Kirkmichael%20Arms-895_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/'},{file:'bar.jpg',alt:'The bar at The Kirkmichael Arms',source:'https://www.kirkmichaelarms.co.uk/photos/bar/Kirkmichael-Arms-825.jpg',page:'https://www.kirkmichaelarms.co.uk/bar'},{file:'restaurant.jpg',alt:'The restaurant at The Kirkmichael Arms',source:'https://www.kirkmichaelarms.co.uk/photos/restaurant/Kirkmichael-Arms-412_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/restaurant'},{file:'story.jpg',alt:'The Kirkmichael Arms, from the official story page',source:'https://cdn.sanity.io/images/1er2n88p/production/6f2f9988ce1bf9df9c63a12af667ae89d5442bfb-1600x1067.jpg',page:'https://www.kirkmichaelarms.co.uk/our-story'},{file:'contact.jpg',alt:'The Kirkmichael Arms, from the official contact page',source:'https://www.kirkmichaelarms.co.uk/photos/contact/Kirkmichael%20Arms-544.jpg',page:'https://www.kirkmichaelarms.co.uk/contact'}],gaps:['Kitchen last orders not published separately.','Hours between Christmas and New Year still to be confirmed on the official Christmas page.','Accessibility details not published.','No official guest quotes on the website \u2014 only the TripAdvisor rating is shown.','A live Google review count was not confirmed today.','VisitScotland listing not confirmed today.','Many whisky and wine prices unpublished on the sample drinks menus.'],conflicts:['Visible official copy says \u201cfrom 1pm\u201d; official hours data on the same homepage lists 13:00\u201322:30. The app shows both, and uses 22:30 as the published close.']},o={id:'wildings',name:'Wildings Hotel & Restaurant',place:'Maidens, Ayrshire',about:['Wildings is a family-run hotel and restaurant in the harbour village of Maidens, on the Ayrshire coast, looking out over the Firth of Clyde towards Arran. The official site says it has two contemporary restaurants and 11 comfortable bedrooms, many with sea views.','It is run by the Sage family, now in its second generation. The official homepage names the owners as Dorothy, Sonya and Nicola. They describe warm hospitality and food made from local, seasonal produce from land and sea.','The village sits by a sandy beach and a historic harbour, with Culzean Castle and Country Park along the coast and golf courses nearby.'],hoursTitle:'Kitchen hours',hoursLines:['Lunch, Monday to Saturday: 12 noon\u20132pm.','Sunday lunch: 12 noon\u20132.30pm.','Dinner, every day: 6pm\u20139pm.'],hoursNotes:['These hours are from the official homepage, checked 10 November 2026. The kitchen is closed between lunch and dinner.','The lunch menu PDF still prints Sunday lunch as 12 noon\u20132.00pm, which is earlier than the website\u2019s 2.30pm. The app follows the official website for hours, and notes the PDF difference.','Bar opening hours, and Christmas or other seasonal closing times, were not published on the official pages checked on 10 November 2026. Please call 01655 331 401 to ask.'],hoursSource:'https://www.wildingshotel.com/ (10 November 2026). Lunch PDF conflict noted from the official menus linked at https://www.wildingshotel.com/team.',eventsIntro:'No dated public events, quiz nights or festive opening hours were published on the official pages checked on 10 November 2026. Call or email to ask about private dining, celebrations and seasonal hours.',events:[],regularEvents:[],address:'Maidens Rd, Maidens, Girvan, KA26 9NR',phone:'01655 331 401',email:'bookings@wildingsrestaurant-hotel.co.uk',website:'https://www.wildingshotel.com/',websiteLabel:'wildingshotel.com',socials:[{label:'Facebook',url:'https://www.facebook.com/profile.php?id=100057663900963'},{label:'Instagram',url:'https://www.instagram.com/wildingsmaidens/'}],mapQuery:'Wildings Hotel, Maidens Rd, Maidens, Girvan, KA26 9NR',booking:['Send a table or room request in this app, or call 01655 331 401, or email bookings@wildingsrestaurant-hotel.co.uk. Staff will confirm. No payment is taken here.','A deposit or cancellation policy was not published on the official website on 10 November 2026.','Visit Girvan, a local guide checked the same day, says booking is essential, especially at weekends, in summer and during busy golf events on the coast, and that hours can shift seasonally \u2014 confirm when you book.'],policies:[{title:'Allergens',body:'Please tell the person taking your order about any allergies. The official menus say the venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.',source:'Official menu PDFs linked from https://www.wildingshotel.com/team (10 November 2026).'},{title:'Parties of six or more',body:'Parties of six or more: no separate or split bills.',source:'Official menu PDFs, 10 November 2026.'},{title:'Children',body:'A children\u2019s menu is offered for under 11s, at \xa39 for one course, \xa310 for two courses or \xa311 for three courses, with extra servings at \xa33.95.',source:'Official kids menu PDF, 10 November 2026.'},{title:'Parking',body:'The official website does not itself describe parking. A guest testimonial on the official homepage mentions \u201cplenty of parking\u201d. TripAdvisor\u2019s hotel listing, checked 10 November 2026, lists free parking. Visit Girvan says parking is at the Harbour Road car park.',source:'Official homepage testimonial; TripAdvisor hotel listing; https://www.girvanholidayhome.co.uk/wildings-restaurant-maidens.html (all 10 November 2026).'},{title:'Dogs',body:'A dog policy was not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Accessibility',body:'Accessibility details were not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Check-in and check-out',body:'Check-in and check-out times were not published on the official website on 10 November 2026. Please ask the hotel when you book.',source:'Official site, 10 November 2026.'}],drinks:{title:'Drinks',body:'A guest testimonial on the official homepage mentions a good selection of alcoholic and non-alcoholic drinks. A priced wine or bar list was not published on the official pages checked on 10 November 2026. Ask staff.',source:'https://www.wildingshotel.com/ (10 November 2026).'},awards:[],reviews:[{summary:'On TripAdvisor, checked 10 November 2026: the restaurant listing is 4.4 out of 5 from 1,326 reviews, and the hotel listing is 4.6 out of 5 from 89 reviews.',source:'TripAdvisor restaurant and hotel listings for Wildings, Maidens, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g947977-d951940-Reviews-Wildings_Hotel_and_Restaurant-Maidens_South_Ayrshire_Ayrshire_Scotland.html',quotes:[{text:'Huge room (room 2), lovely view of the seafront \u2026 Room was comfortable and warm. Always amazing food expertly prepared \u2026 Staff are all friendly and chatty \u2026 plenty of parking.',by:'Lynn Pope',source:'Testimonial on https://www.wildingshotel.com/ (10 November 2026).'}]}],rooms:{intro:'The official site lists 11 bedrooms, including single, double, king, twin and family rooms, many with sea views and a full Scottish breakfast included. Call reception on 01655 331 401, or email, to enquire.',items:[{name:'Double room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'King room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'Twin room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'Family room',price:'From \xa3205',note:'Including full Scottish breakfast.'}],source:'https://www.wildingshotel.com/prices (10 November 2026).',notes:['Single rooms are mentioned on the official accommodation page, but no single-room price was published on 10 November 2026 \u2014 please call to ask.','Prices can change. Confirm with the hotel when you book.']},functions:[{title:'Private dining',body:'The official website shows a private dining room among its restaurant photographs. No published capacity, hire rate or wedding package was found on the official pages checked on 10 November 2026. Call or email to ask.',source:'https://www.wildingshotel.com/ (10 November 2026).'}],photos:[{file:'exterior.jpg',alt:'The exterior of Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/out1-508w.jpg',page:'https://www.wildingshotel.com/'},{file:'room.jpg',alt:'A bedroom at Wildings, from the official accommodation page',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Room+Wildings+edit-680w.png',page:'https://www.wildingshotel.com/prices'},{file:'booths.jpg',alt:'Restaurant booths at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+boths+in+restaurant-1920w.png',page:'https://www.wildingshotel.com/'},{file:'restaurant.jpg',alt:'The main restaurant at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+main+restaurant-1920w.png',page:'https://www.wildingshotel.com/'},{file:'private-dining.jpg',alt:'Private dining at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+restaurant+private-1920w.png',page:'https://www.wildingshotel.com/'},{file:'fish.jpg',alt:'A fish dish at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Fish+close+up+widlings-1920w.png',page:'https://www.wildingshotel.com/'}],gaps:['Bar hours not published.','Christmas and seasonal hours not published.','Dog policy, accessibility, and official check-in / check-out times not published.','Single-room price not published.','No priced drinks list.','No official events calendar found.','A live Google review count was not confirmed today.','VisitScotland listing not confirmed today.'],conflicts:['Official footer and contact page use Maidens Rd, Maidens, Girvan, KA26 9NR. TripAdvisor listings (hotel and restaurant) and some older pages use Harbour Road, same postcode. The app uses Maidens Rd from the official site.','Official website Sunday lunch to 2.30pm; official lunch PDF still says 12 noon\u20132.00pm. The app follows the website for hours.']}},934,[]); +__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])},935,[31,1071,825,818,25]); +__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])},936,[992,953]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},937,[31,128,1401,825,990,818,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:l,inStaffApp:n,shiftManager:a,big:o,testID:d}){const[h,p]=(0,t.useState)(!1),x=(0,u.useSession)(e=>e.meId),y=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:n,role:l,shiftManager:a})||x&&!(0,m.canChangeBookings)(y)?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S.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:()=>p(!0),style:{minHeight:o?64:44}}),h?(0,$.jsx)(F,{rid:e,id:s.id,who:i,onClose:()=>p(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:l,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,n.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,$.jsx)(F,{rid:e,id:o,who:i,hidePrivate:a,onClose:l}):(0,$.jsxs)(S.Sheet,{visible:!0,onClose:l,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,$.jsx)(S.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${N(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}, ${N(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,$.jsx)(S.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,$.jsx)(S.Button,{kind:"ghost",label:"Close",onPress:l,style:{minHeight:44}})]})},_e.EditBookingSheet=F;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),l=(e=i)&&e.__esModule?e:{default:e},n=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),u=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),C=_r(_d[19]),f=_r(_d[20]),I=_r(_d[21]),w=_r(_d[22]),k=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]);const P=/^([01]\d|2[0-3]):[0-5]\d$/,O=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const N=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,j.ymd)(s)?'Tomorrow':B(e)};const E=e=>e?(e/100).toFixed(e%100?2:0):'',W=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},B=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',z=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')}`:''},R=e=>e.charAt(0).toUpperCase()+e.slice(1);function L({title:e,children:t,testID:s}){return(0,$.jsxs)(l.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:y.colours.hairline,alignItems:'stretch'},children:[(0,$.jsx)(S.T,{size:17,weight:"semibold",center:!0,colour:y.colours.goldLight,children:e}),t]})}const A=({label:e,value:t,onChange:s,max:i=20,testID:l})=>(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,children:e}),(0,$.jsx)(S.Stepper,{testID:l,value:t,min:0,max:i,onChange:s,label:e})]});function F({rid:e,id:i,who:u,onClose:b,hidePrivate:m=!1}){(0,I.useBlurOutside)();const N=(0,n.useBookings)(e),F=N.find(e=>e.id===i),M=(0,d.useRestaurant)(e),H=(0,a.usePlan)(e),_=(0,o.useBlocks)(e=>e.blocks),[V,Y]=(0,t.useState)(F?(0,c.draftOf)(F):null),[G,U]=(0,t.useState)(null),[q,X]=(0,t.useState)(null),[K,Q]=(0,t.useState)(E(F?(0,c.draftOf)(F).depositDue:0)),[J,Z]=(0,t.useState)(E(F?(0,c.draftOf)(F).depositAmount:0)),[ee,te]=(0,t.useState)(B(F?(0,c.draftOf)(F).depositDate:''));if(!F||!V||!M)return null;const se=e=>{U(null),X(null),Y({...V,...e})},ie=(0,k.depositOf)(M.settings),le=e=>{const t=e.partySize??V.partySize,s=Math.min(e.children??V.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(F)&&V.depositOn&&!V.depositPaid&&W(K||'0')===(0,k.depositDue)(ie,V.partySize,V.children??0)){const e=(0,k.depositDue)(ie,t,s);e>0&&Q(E(e))}se({...e,children:s})},ne=O(V.time),ae=P.test(ne),oe=V.area?H.areas.filter(e=>e.name===V.area).map(e=>e.id):null,de=e=>!oe||e.split('+').every(e=>oe.includes(H.tables.find(t=>t.name===e)?.areaId??'')),re=(0,x.tableOptions)(H,N.filter(e=>e.date===V.date),V.table).filter(e=>de(e)||e===V.table),ce=!(V.depositOn&&(Number.isNaN(W(K||'0'))||V.depositPaid&&(Number.isNaN(W(J||'0'))||ee.trim()&&!z(ee)))),he={...V,time:ne,depositDue:W(K||'0')||0,depositAmount:W(J||'0')||0,depositDate:z(ee)},pe=(0,c.changedFields)(F,he),ue=M.settings.turnMins??90,ge=async()=>{const t=(0,c.editPatch)(F,he,{by:u||'Team member',app:r.APP_VARIANT});if(Object.keys(t).length&&await n.repo.bookings.update(F.id,t),'seated'===F.status&&'table'in t&&t.table!==F.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(F.table),l=s(t.table),n=a.useFloor.getState(),o=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!l.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),l.forEach(t=>n.setLive(e,t,{stage:o,dirty:!1}))}X(`Saved. Changed: ${(0,c.editedWords)(pe)}.`),U(null),b()},be=V.allergies??[],me=e=>se({allergyNone:!1,allergies:be.some(t=>t.allergen===e)?be.filter(t=>t.allergen!==e):[...be,{allergen:e,severity:'allergy'}]}),xe=(0,c.historyLines)(F);return(0,$.jsxs)(S.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${F.name} \xb7 ${F.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,$.jsx)(l.default,{style:{alignItems:'center'},children:(0,$.jsx)(v.DepositChip,{b:F,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(F)?(0,$.jsx)(l.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,$.jsxs)(L,{title:"Deposit",testID:"edit-section-deposit",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"No deposit",selected:!V.depositOn,testID:"edit-deposit-none",onPress:()=>se({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,$.jsx)(S.Chip,{label:"Deposit due",selected:!!V.depositOn&&!V.depositPaid&&!V.depositWaived,testID:"edit-deposit-due",onPress:()=>se({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,$.jsx)(S.Chip,{label:"Deposit paid",selected:!!V.depositOn&&!!V.depositPaid,testID:"edit-deposit-paid",onPress:()=>{J||Z(K),ee||te(B((0,j.ymd)(new Date))),se({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),V.depositOn&&!V.depositPaid&&V.depositWaived?(0,$.jsx)(S.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),V.depositOn&&!V.depositPaid&&V.depositWaived?(0,$.jsxs)(S.T,{size:15,center:!0,colour:y.colours.goldLight,testID:"edit-deposit-waived-by",children:[F.depositWaived?.by?(0,k.waiverText)(F.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,V.depositWaived||pe.includes('deposit')?null:(0,$.jsx)(l.default,{style:{alignItems:'center'},children:(0,$.jsx)(w.WaiveDepositButton,{b:F,who:u,onDone:e=>Y({...V,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e})})}),V.depositOn?(0,$.jsx)(S.Field,{label:"Deposit due (\xa3)",value:K,onChangeText:e=>{Q(e),se({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,V.depositOn&&V.depositPaid?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S.Field,{label:"Amount paid (\xa3)",value:J,onChangeText:e=>{Z(e),se({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"How was it paid?"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,$.jsx)(S.Chip,{label:R(e),selected:V.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>se({depositMethod:e})},e))}),(0,$.jsx)(S.Field,{label:"Date paid (DD/MM/YYYY)",value:ee,onChangeText:e=>{te((0,s.slashDate)(e,ee)),se({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),ee.trim()&&!z(ee)?(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ce?null:(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,$.jsx)(S.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,$.jsxs)(L,{title:"When",testID:"edit-section-when",children:[(0,$.jsx)(D.BookingDatePicker,{r:M,today:new Date,value:V.date,onChange:e=>se({date:e})}),(0,$.jsx)(S.Field,{label:"Time (24-hour, for example 19:15)",value:V.time,onChangeText:e=>se({time:e}),testID:"edit-time"}),ae?null:(0,$.jsx)(S.T,{size:15,colour:y.colours.amber,children:"Write the time like 19:15."}),(0,$.jsx)(C.AdultsChildren,{value:(0,f.peopleOf)(V.partySize,V.children),onChange:e=>le(e),depositsOn:ie.on&&ie.perPersonPence>0,testID:"edit-people"}),(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,children:"Table time"}),(0,$.jsx)(S.Stepper,{testID:"edit-duration",value:V.duration||0,min:0,max:360,step:15,onChange:e=>se({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,$.jsxs)(L,{title:"Where",testID:"edit-section-where",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"Any area",selected:!V.area,testID:"edit-area-any",onPress:()=>se({area:''})}),H.areas.map(e=>(0,$.jsx)(S.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:V.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>se({area:e.name})},e.id))]}),(0,$.jsx)(S.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(V.table)}),(0,x.splitChoices)(V.table).length?(0,$.jsxs)(l.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:"Split the joined tables"}),(0,$.jsx)(S.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,x.splitChoices)(V.table).map(e=>(0,$.jsx)(S.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>se({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,$.jsxs)(S.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Button,{kind:V.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(V.table?'':', chosen'),onPress:()=>se({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),re.map(e=>(0,$.jsx)(S.Button,{kind:e===V.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===V.table?', chosen':''}`,onPress:()=>se({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,$.jsxs)(L,{title:"Guest",testID:"edit-section-guest",children:[(0,$.jsx)(S.Field,{label:"Name",value:V.name,onChangeText:e=>se({name:e}),testID:"edit-name"}),(0,$.jsx)(S.Field,{label:"Phone",value:V.phone,onChangeText:e=>se({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,$.jsx)(S.Field,{label:"Email",value:V.email,onChangeText:e=>se({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"Booked by"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:V.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>se({source:e.id})},e.id))}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(V.tags??[]).includes(e);return(0,$.jsx)(S.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>se({tags:t?(V.tags??[]).filter(t=>t!==e):[...V.tags??[],e].sort()})},e)})})]}),(0,$.jsxs)(L,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,$.jsx)(A,{label:"Dogs",value:V.dogs??0,max:6,onChange:e=>se({dogs:e}),testID:"edit-dogs"}),(0,$.jsx)(A,{label:"High chairs",value:V.highChairs??0,max:10,onChange:e=>se({highChairs:e}),testID:"edit-high-chairs"}),(0,$.jsx)(A,{label:"Wheelchair users",value:V.wheelchair??0,max:10,onChange:e=>se({wheelchair:e}),testID:"edit-wheelchair"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"Occasion"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:(V.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>se({occasion:e.id})},e.id||'none'))})]}),(0,$.jsxs)(L,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"No allergies",selected:!!V.allergyNone&&!be.length,testID:"edit-allergy-none",onPress:()=>se({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,$.jsx)(S.Chip,{label:e.short,selected:be.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>me(e.id)},e.id))]}),be.map(e=>(0,$.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,$.jsxs)(S.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,$.jsx)(S.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>se({allergies:be.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,$.jsx)(S.Field,{label:"Anything else about allergies",value:V.allergyNote,onChangeText:e=>se({allergyNote:e}),testID:"edit-allergy-note"}),pe.includes('allergies')&&be.length?(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,$.jsx)(A,{label:"Vegan",value:V.vegan??0,max:V.partySize,onChange:e=>se({vegan:e}),testID:"edit-vegan"}),(0,$.jsx)(A,{label:"Vegetarian",value:V.vegetarian??0,max:V.partySize,onChange:e=>se({vegetarian:e}),testID:"edit-vegetarian"})]}),(V.holds??[]).length||(F.holds??[]).some(e=>e.qty>0&&!e.served)?(0,$.jsxs)(L,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,$.jsx)(S.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(V.holds??[]).map(e=>{const t=(0,h.reservablesOf)(M),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),n=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,$.jsxs)(l.default,{testID:n,style:{gap:6,width:'100%'},children:[(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,$.jsx)(S.Stepper,{testID:n,value:e.qty,min:0,max:20,onChange:t=>se({holds:(0,c.setEditableHoldQty)(V.holds??[],e.kind,e.id,t)}),label:i})]}),(0,$.jsx)(S.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${n}-remove`,onPress:()=>se({holds:(0,c.removeEditableHold)(V.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(V.holds??[]).length?null:(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==F.status?(0,$.jsxs)(L,{title:"Status",testID:"edit-section-status",children:[(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:V.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>se({status:e.id})},e.id))}),(0,$.jsx)(S.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,$.jsx)(L,{title:"Notes",testID:"edit-section-notes",children:(0,$.jsx)(S.Field,{label:"Notes",value:V.notes,onChangeText:e=>se({notes:e}),placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),G?(0,$.jsxs)(l.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg},children:[G.map(e=>(0,$.jsx)(S.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,$.jsx)(S.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,q?(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:q}):null,(0,$.jsxs)(S.Row,{gap:8,wrap:!0,children:[(0,$.jsx)(S.Button,{label:G?'Save anyway':'Save changes',testID:"edit-save",disabled:!ae||!ce||V.name.trim().length<1||!pe.length,onPress:()=>{const t=ae?(0,o.blockAt)(_,e,V.date,ne):void 0,s=(0,c.editWarnings)(F,he,N,t,ue,H);!s.length||G?ge():U(s)},style:{minHeight:56,flex:1}}),(0,$.jsx)(S.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),xe.length?(0,$.jsx)(L,{title:"Changes",testID:"edit-history",children:xe.slice(0,12).map((e,t)=>(0,$.jsx)(S.T,{size:14,center:!0,colour:y.colours.muted,children:e},t))}):null,(0,$.jsx)(T.CancelBookingButton,{rid:e,b:F,name:F.name,big:!0,onDone:()=>b()}),(0,$.jsx)(T.ReinstateBookingButton,{b:F,name:F.name,today:(0,j.ymd)(new Date),onDone:()=>b()})]})}},938,[31,834,128,823,829,828,1082,807,817,832,819,866,863,992,1401,825,822,1407,994,1404,1405,1406,1078,14,991,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useScreensaverAsleep",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"useDisplayToolsH",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(0,t.create)(t=>({asleep:!1,set:n=>t({asleep:n})})),s=(0,t.create)(()=>({h:65}))},939,[995]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),u=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),f=(0,n.useOwner)(e=>e.staff),x=(0,r.workingNow)(u,f,t),b=(0,r.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:b,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'center',flexShrink:1,minWidth:0},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'center',alignItems:'center',minWidth:0},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:o.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:o.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'center',alignItems:'center',flexShrink:1,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:o.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:o.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:b,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:o.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:o.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:o.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:o.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),h=_r(d[7])},940,[31,128,953,863,1459,825,818,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},941,[874,31,128,818,823,942,863,984,982,983,881,825,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOut",{enumerable:!0,get:function(){return f}}),_e.setSoldOutBy=m,_e.setSoldOut=function(e,t,n){if(!o.useStore.getState().menu.find(t=>t.id===e))return;n&&m(n);p.add(e);try{o.useStore.getState().updateMenuItem(e,{soldOut:t})}finally{p.delete(e)}},_e.soldOutNow=function(e,t=c()){return(0,i.activeSoldOut)(f.getState().entries,e,t)},_e.linkSoldOut=h,_e.useSoldOutLink=function(e,t,n=!0){const r=_r(d[9]);r.useEffect(()=>{n&&h({adopt:e})},[e,n]),r.useEffect(()=>{n&&m(t)},[t,n])};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),a=_r(d[2]),i=_r(d[3]),s=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]);const c=()=>{try{return(0,o.nowFrom)(o.useStore.getState().clock)}catch{return new Date}},f=(0,r.create)()((0,a.persist)((e,t)=>({entries:[],adopted:{},mark:(t,n,r,a)=>{const u=c(),l=o.useStore.getState().restaurants.find(e=>e.id===t),f=(0,i.soldOutSettingsOf)(l?.settings?.soldOut),S=l?(0,s.hoursFor)(l,u)?.close??null:null,m=(0,i.clearAfterFor)(u,f,S),p={rid:t,itemId:n,name:r.slice(0,120),on:!0,at:u.toISOString(),by:a.slice(0,80),clearAfter:m?.toISOString(),auto:!1,kept:!1};e(e=>({entries:[...e.entries.filter(e=>!(e.rid===t&&e.itemId===n)),p]}))},back:(n,r,a)=>{const i=t().entries.find(e=>e.rid===n&&e.itemId===r);i&&i.on&&e(e=>({entries:e.entries.map(e=>e===i?{...e,on:!1,at:c().toISOString(),by:a.slice(0,80),clearAfter:void 0,kept:!0}:e)}))},expire:(n,r)=>{const a=(0,i.expiredSoldOut)(t().entries,n,r);if(!a.length)return 0;const s=new Set(a.map(e=>e.itemId));return e(e=>({entries:e.entries.map(e=>e.rid===n&&s.has(e.itemId)?{...e,on:!1,by:'Cleared automatically',clearAfter:void 0}:e)})),a.length}}),{name:'covercharge-soldout-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default),partialize:e=>({entries:e.entries.slice(-500),adopted:e.adopted})}));let S='Staff';function m(e){e&&(S=e.replace(' (example)',''))}const p=new Set;let O=null;function h(e){if(O)return O;let t=!1;const n=(e=o.useStore.getState().menu)=>new Map(e.map(e=>[e.id,e.soldOut]));let r=n();if(e.adopt){const e={...f.getState().adopted},t=[];for(const t of o.useStore.getState().menu)e[t.restaurantId];for(const t of o.useStore.getState().menu)e[t.restaurantId]=!0;f.setState(n=>({entries:[...n.entries,...t],adopted:e}))}const a=()=>{const e=c(),a=f.getState().entries,i=o.useStore.getState().menu,s=new Map;for(const t of a){const n=t.on&&(!t.clearAfter||new Date(t.clearAfter).getTime()>e.getTime());s.set(`${t.rid}|${t.itemId}`,n)}const u=i.filter(e=>s.has(`${e.restaurantId}|${e.id}`)&&s.get(`${e.restaurantId}|${e.id}`)!==e.soldOut);if(u.length){t=!0;try{const e=new Map(u.map(e=>[e.id,s.get(`${e.restaurantId}|${e.id}`)]));o.useStore.setState(t=>({menu:t.menu.map(t=>e.has(t.id)?{...t,soldOut:e.get(t.id)}:t)}))}finally{t=!1,r=n()}}},i=o.useStore.subscribe((e,i)=>{if(e.menu===i.menu)return;const s=n(e.menu);let o=!1;if(!t)for(const t of e.menu){const e=r.get(t.id);void 0!==e&&e!==t.soldOut&&(p.has(t.id)?t.soldOut?f.getState().mark(t.restaurantId,t.id,t.name,S):f.getState().back(t.restaurantId,t.id,S):o=!0)}r=s,o&&setTimeout(a,0)}),s=f.subscribe((e,t)=>{e.entries!==t.entries&&a()}),u=()=>{const e=c(),t=new Set(f.getState().entries.filter(e=>e.on).map(e=>e.rid));for(const n of t)f.getState().expire(n,e)};u(),a();const l=setInterval(u,3e4);let m=null;if(e.adopt)try{m=_r(d[8],"./autoSoldOutStore").startAutoSoldOut()}catch{m=null}return O=()=>{i(),s(),clearInterval(l),m&&m(),O=null},O}u.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchLive=e=>(0,l.setLiveData)(!!e),globalThis.__pitchSoldOut=e=>{const t=o.useStore.getState(),n=t.restaurants[0]?.id;if(!n)return;const r=t.menu.filter(e=>e.restaurantId===n&&!e.hidden),a=['Sticky toffee pudding','Cullen skink','Fish supper','Steak pie','Haggis bon bons','Cranachan','Lemon tart','Mussels','Scampi','Venison burger','Chips (large)','Oysters','Lobster thermidor','Crab claws','Tablet ice cream','Beef shin','Smoked salmon','Cheeseboard','Halibut','Clootie dumpling'],i=(new Date).toISOString(),s=Array.from({length:e},(e,t)=>r[t]?{id:r[t].id,name:r[t].name}:{id:`pitch-so-${t}`,name:a[t%a.length]});f.setState(e=>({entries:[...e.entries.filter(e=>e.rid!==n||!s.some(t=>t.id===e.itemId)).map(e=>e.rid===n?{...e,on:!1}:e),...s.map(e=>({rid:n,itemId:e.id,name:e.name,on:!0,at:i,by:'Chef'}))]}))})},942,[1160,995,1169,984,833,881,2,1183,982,31]); +__d(function(g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dismissNotice",{enumerable:!0,get:function(){return u.dismissNotice}}),Object.defineProperty(_e,"notify",{enumerable:!0,get:function(){return u.notify}}),Object.defineProperty(_e,"useSliders",{enumerable:!0,get:function(){return u.useSliders}}),Object.defineProperty(_e,"SLIDER",{enumerable:!0,get:function(){return j}}),_e.SliderButton=k,_e.SliderCard=C,_e.SliderHost=function(){y();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(0,t.useEffect)(()=>{if(p)return window.ccSlider=e=>(0,u.notify)(e),()=>{delete window.ccSlider}},[]),(0,t.useEffect)(()=>{if(o.current&&clearTimeout(o.current),!n)return;const e=void 0!==n.timeoutMs?n.timeoutMs:n.actions?.length||n.content?null:6e3;return e&&(o.current=setTimeout(()=>u.useSliders.getState().dismiss(n.id),e)),()=>{o.current&&clearTimeout(o.current)}},[n?.id,n?.timeoutMs]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!p||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=p?'fixed':'absolute';return(0,f.jsxs)(f.Fragment,{children:[n.modal?(0,f.jsx)(s.default,{...x('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,f.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...p?{bottom:l?`${12+l}px`:'calc(12px + env(safe-area-inset-bottom))'}:{}},children:(0,f.jsx)(C,{n:n,waiting:e.length-1,onClose:()=>u.useSliders.getState().dismiss(n.id)},n.id+':'+(n.seq??0))})]})};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=e(r(d[4])),l=e(r(d[5])),c=r(d[6]),a=r(d[7]),u=r(d[8]),b=r(d[9]),f=r(d[10]);const p='undefined'!=typeof document,h="\n[data-ccsl=\"in\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccsl-in{from{opacity:0;transform:translate3d(0,110%,0)}to{opacity:1;transform:none}}\n[data-ccsl=\"urgent\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both,ccsl-red 1.6s ease-in-out .45s infinite}\n@keyframes ccsl-red{0%,100%{box-shadow:0 10px 30px rgba(0,0,0,.6),0 0 0 1px rgba(255,107,94,.55)}50%{box-shadow:0 10px 40px rgba(0,0,0,.6),0 0 0 2px #FF6B5E,0 0 34px rgba(255,107,94,.45)}}\n[data-ccsl=\"dim\"]{animation:ccsl-dim .3s ease both}\n@keyframes ccsl-dim{from{opacity:0}to{opacity:1}}\n@media (prefers-reduced-motion: reduce){[data-ccsl]{animation:none !important}}\n",x=e=>p?{dataSet:{ccsl:e}}:{};function y(){(0,t.useEffect)(()=>{if(!p||document.getElementById('cc-slider-css'))return;const e=document.createElement('style');e.id='cc-slider-css',e.textContent=h,document.head.appendChild(e)},[])}const j={bg:'#17140F',border:'rgba(207,164,95,.55)',text:'#F5F1E8',quiet:'#A89A80',gold:c.colours.gold,ink:'#17130D'},w=(e="normal")=>'urgent'===e?c.colours.red:'warn'===e?c.colours.amber:c.colours.gold,S=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':j.border;function k({a:e,onDone:t,big:o}){const s=e.kind??'primary';return(0,f.jsx)(n.default,{testID:e.testID,accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{try{e.onPress?.()}finally{e.keepOpen||t()}},style:({pressed:e})=>({minHeight:o?56:44,minWidth:44,paddingHorizontal:'ghost'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?j.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,f.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?j.ink:'danger'===s?c.colours.red:j.quiet,children:e.label})})}function C({n:e,onClose:t,waiting:n=0,maxWidth:c=520}){y();const u=e.tone??'normal',h=w(u),C=e.content,z=!!e.big,{height:I}=(0,l.default)(),D=e.actions??[];return(0,f.jsxs)(s.default,{testID:e.testID??'cc-slider',accessibilityRole:"summary",accessibilityLabel:`${e.kicker?e.kicker+': ':''}${e.title}`,...x('urgent'===u?'urgent':'in'),style:{width:'100%',maxWidth:z?Math.max(c,900):c,alignSelf:'center',borderRadius:14,backgroundColor:j.bg,borderWidth:1,borderColor:S(u),overflow:'hidden',...p?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,f.jsx)(s.default,{style:{position:'absolute',left:0,top:0,bottom:0,width:5,backgroundColor:h}}):null,(0,f.jsxs)(o.default,{style:{maxHeight:Math.max(220,I-40)},contentContainerStyle:{paddingVertical:z?18:12,paddingLeft:'normal'!==u?z?24:18:z?20:14,paddingRight:z?20:14,gap:z?10:6},children:[(0,f.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:12},children:[e.icon?(0,f.jsx)(a.T,{size:z?34:22,children:e.icon}):null,(0,f.jsxs)(s.default,{style:{flex:1,gap:2},children:[e.kicker?(0,f.jsx)(a.T,{size:z?15:11,weight:"bold",colour:h,style:{letterSpacing:1.4},children:e.kicker}):null,(0,f.jsx)(a.T,{size:z?24:15,weight:"medium",colour:j.text,children:e.title}),e.body?(0,f.jsx)(a.T,{size:z?18:13,colour:j.quiet,children:e.body}):null]}),D.length||C?null:(0,f.jsx)(b.ToastClose,{testID:"cc-slider-ok",label:`Close: ${e.title}`,onPress:t,size:z?'lg':'md',colour:j.quiet})]}),C?(0,f.jsx)(C,{close:t}):null,D.length?(0,f.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:D.map(e=>(0,f.jsx)(k,{a:e,onDone:t,big:z},e.label))}):null,n>0?(0,f.jsxs)(a.T,{size:z?14:11,colour:j.quiet,center:!0,style:{alignSelf:'stretch'},children:[n," more waiting"]}):null]})]})}},943,[31,123,264,152,128,288,825,818,980,835,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CoversToday=function({rid:e,onPress:p,big:x,sound:$,testID:v="covers-today",day:j,compact:C=!1,snug:w=!1,tight:T=!1,aside:k}){const D=(0,c.useBookings)(e),S=(0,c.useNow)(3e4),I=(0,h.venueYmd)(S),L=j&&j!==I?j:I,_=L!==I,M=(0,u.coversFour)(D,L),R=(0,y.dayWord)(L,I),z=/^(Today|Yesterday|Tomorrow)$/.test(R),O=`COVERS ${R.toUpperCase()}`,P=_?`${z?`${R}\u2019s`:R} bookings \u203a`:'Today\u2019s bookings \u203a',W=_?`${z?`${R}, `:''}${(0,y.dayLong)(L)}`:'today',E=(0,o.useLiveState)();if('ready'!==E)return(0,f.jsx)(o.LiveWait,{state:E,title:"Covers today",testID:`${v}-wait`});const F=x?64:T?28:w?36:44,V=M.total?Math.min(1,M.done/M.total):0,Y=(e,o,t,c)=>(0,f.jsxs)(s.default,{style:{flex:1,alignItems:'center',gap:T?2:w?4:6,minWidth:0},children:[(0,f.jsx)(l.SplitFlap,{value:o,height:F,colour:t,testID:`covers-${c}`,sound:$}),(0,f.jsx)(n.T,{size:T?11:x||C?14:12,weight:"semibold",colour:b.colours.muted,numberOfLines:1,center:C||T,style:{letterSpacing:.4},children:e})]});return(0,f.jsxs)(t.default,{testID:v,dataSet:{centreExempt:'dashboard-card'},accessibilityRole:"button",disabled:!p,onPress:p,accessibilityLabel:`Covers ${W}: ${M.done} done, ${M.seated} seated, ${M.toCome} to come, ${M.total} total.${p?` Opens ${_?'that day\u2019s':'today\u2019s'} bookings.`:''}`,style:({pressed:e})=>({backgroundColor:e?b.colours.tilePressed:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:T?6:16,...w&&!T?{paddingVertical:8,paddingHorizontal:10}:null,gap:T?4:w?8:12}),children:[T?null:(0,f.jsxs)(s.default,{style:{flexDirection:C?'column':'row',justifyContent:'space-between',alignItems:'center',gap:C?w?2:6:void 0},children:[(0,f.jsx)(n.T,{center:C,size:C?16:12,weight:"semibold",colour:b.colours.goldMuted,style:{letterSpacing:1.6},children:O}),p?(0,f.jsx)(n.T,{center:C,size:C?14:12,colour:b.colours.muted,children:P}):null]}),(0,f.jsxs)(s.default,{style:{flexDirection:'row',gap:8},children:[Y('Done',M.done,b.colours.text,'done'),Y('Seated',M.seated,b.colours.text,'seated'),Y('To come',M.toCome,b.colours.text,'tocome'),Y('Total',M.total,b.colours.goldLight,'total')]}),T?null:(0,f.jsx)(s.default,{style:{height:4,borderRadius:2,backgroundColor:'rgba(255,255,255,0.06)',overflow:'hidden'},children:(0,f.jsx)(s.default,{style:{width:`${Math.round(100*V)}%`,height:4,backgroundColor:b.colours.gold,borderRadius:2}})})]})},r(d[0]);var o=r(d[1]),t=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),b=r(d[10]),f=r(d[11])},944,[31,1362,264,128,1393,818,823,832,822,967,825,25]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},945,[812,967,944,994,31,128,995,818,823,832,833,814,822,825,1386,993,1081,25]); +__d(function(_g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setDisplaySilent",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"soundAllowed",{enumerable:!0,get:function(){return u}}),e.chime=function(t="bright"){if(!u())return void l('__ccChimesBlocked');try{const n=o();if(!n)return;('bright'===t?[880,1318.5]:[659.3]).forEach((o,c)=>{const i=n.currentTime+.16*c,u=n.createOscillator(),l=n.createGain();u.type='sine',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime('bright'===t?.12:.07,i+.02),l.gain.exponentialRampToValueAtTime(1e-4,i+.9),u.connect(l).connect(n.destination),u.start(i),u.stop(i+.95)}),l('__ccChimes')}catch{}},Object.defineProperty(e,"LOW_CHIME_MIN",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"LOW_CHIME_MAX",{enumerable:!0,get:function(){return d}}),e.lowChime=function(t=0){if(!u())return void l('__ccChimesBlocked');const n=s+.095*Math.max(0,Math.min(1,t));'undefined'!=typeof window&&(window.__ccLowChimeLevels=[...window.__ccLowChimeLevels??[],Math.round(1e3*n)/1e3].slice(-40));try{const t=o();if(!t)return;[220,164.8].forEach((o,c)=>{const i=t.currentTime+.42*c,u=t.createOscillator(),l=t.createGain(),s=t.createBiquadFilter?.();u.type='triangle',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime(n,i+.12),l.gain.exponentialRampToValueAtTime(1e-4,i+1.6),s?(s.type='lowpass',s.frequency.value=900,u.connect(s).connect(l).connect(t.destination)):u.connect(l).connect(t.destination),u.start(i),u.stop(i+1.7)}),l('__ccLowChimes')}catch{}},Object.defineProperty(e,"flapSoundOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setFlapSound",{enumerable:!0,get:function(){return w}}),e.flapClick=function(){if('display'!==t.APP_VARIANT&&!c)return;if(!p())return;try{const t=o();if(!t)return;const n=t.currentTime,c=Math.floor(.03*t.sampleRate),i=t.createBuffer(1,c,t.sampleRate),u=i.getChannelData(0);for(let t=0;t{if('undefined'==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;return t?(n||(n=new t),'suspended'===n.state&&n.resume?.().catch?.(()=>{}),n):null};if('undefined'!=typeof window){const t=()=>{try{o()}catch{}window.removeEventListener('pointerdown',t)};window.addEventListener('pointerdown',t)}let c=!1;const i=t=>{c=t},u=()=>'display'!==t.APP_VARIANT&&!c,l=t=>{'undefined'!=typeof window&&(window[t]=(window[t]??0)+1)};const s=.015,d=.11;const f='cc-flap-sound',p=()=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(f)}catch{return!1}},w=t=>{try{localStorage.setItem(f,t?'1':'0')}catch{}}},946,[123,807]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},947,[812,31,980,823,832,822,946]); +__d(function(g,r,i,a,_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()})}},948,[805,31,288,128,995,807,953,1422,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},949,[31,128,989,825,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},950,[31,807,1469]); +__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'},951,[825]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=A,_e.resetTableLive=W,_e.seatBookingNow=E,_e.finishBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'finished'),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=H,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=Y,_e.WalkInSheet=U,_e.WalkInMatchPrompt=Q,_e.AssignTableSheet=V,_e.undoNotice=G,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[i,n]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>n({b:e}),combineTables:e=>n({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(U,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:G}):null,l?(0,L.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,L.jsx)(V,{booking:i.b,combine:i.combine,onClose:()=>n(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=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),B=_r(_d[28]),z=_r(_d[29]),O=_r(_d[30]),N=_r(_d[31]),M=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function A(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function E(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)}function H(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=A(e),a=(0,v.useFloor)(t=>t.live[e])??{},i=(0,v.usePlan)(e),n=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(n,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(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,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function Y({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=i?6:8,f=i?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(n??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],n=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!n,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,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?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:n?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:n?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function U({onClose:e,onSeated:a,wide:i,initialTable:n}){const{rid:r,r:d,now:x}=(0,y.useCtx)(15e3),T=H(r,x),[I,$]=(0,c.useState)(2),[P,B]=(0,c.useState)(!1),[z,N]=(0,c.useState)(n??null),R=(0,v.usePlan)(r),A=(0,k.useBookings)(r),_=(0,D.useBlocks)(e=>e.blocks),U=(0,D.closedAreasAt)(_,r,(0,w.ymd)(x),(0,w.hm)(x)),V=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(T).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(R,A.filter(e=>e.date===(0,w.ymd)(x)),e,I,x,(0,j.turnFor)(I,d.settings.turnMins),90,void 0,{closed:U})?.table??null},[R,A,T,I,U.size,x.getTime()]);(0,c.useEffect)(()=>{z&&(0,v.tablesOf)(z).some(e=>'Closed'===T[e]?.label)&&N(null)},[z,U.size]);const[G,K]=(0,c.useState)(!1),[X,J]=(0,c.useState)(''),Z=(e,t=String(e),s=()=>{B(!1),$(e)})=>{const o='9+'===t?P:!P&&I===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},ee=(0,L.jsx)(s.PartySizeInput,{value:I,onChange:$,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),te=(0,L.jsxs)(m.default,{style:{gap:8,width:i?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>Z(e)),Z(9,'9+',()=>{B(!0),$(e=>e>=9?e:9)})]}),P?ee:null]}),[se,oe]=(0,c.useState)(!1),[le,ae]=(0,c.useState)(null),ie=async(t=z,s=!1)=>{if(!se&&(0,M.guardBookingChange)(F)){if(!s){const e=(0,O.bookingsNearWalkIn)(A,x,I);if(e.length)return void ae({at:t,list:e})}oe(!0);try{const s=await k.repo.bookings.seatWalkIn(r,I,t??void 0,X);W(r,t??void 0),a(s),e()}finally{oe(!1)}}},ne=async(t,s)=>{if(!se&&(0,M.guardBookingChange)(F)){oe(!0);try{const o=s??t.table??null;o&&o!==t.table&&await k.repo.bookings.assignTable(t.id,o),await E(r,{...t,table:o??void 0}),(0,u.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})`}),ae(null),e()}finally{oe(!1)}}},re=(0,L.jsxs)(m.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),z?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>N(null)}):null]}),(0,L.jsx)(Y,{use:T,value:z,onPick:e=>{T[e]&&!T[e].busy?ie(e):N(z===e?null:e)},big:i,dense:i,best:V,bestSet:(0,h.bestTables)(R)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",V&&!z?` (suggested for ${I}: ${(0,l.tableNumbers)(V)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(x)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${I} ${1===I?'person':'people'}${z?` \xb7 ${(0,l.tableNumbers)(z)}`:''}`,disabled:se,onPress:()=>{ie()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[te,re]}):(0,L.jsxs)(L.Fragment,{children:[te,re]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[G?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:X,onChangeText:J,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>K(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),le?(0,L.jsx)(Q,{list:le.list,busy:se,onYes:e=>{ne(e,le.at)},onNo:()=>{const e=le.at;ae(null),ie(e,!0)},onClose:()=>ae(null)}):null]})}function Q({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,L.jsx)(C.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,L.jsxs)(m.default,{style:{gap:14},children:[e.map((e,o)=>(0,L.jsxs)(m.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,L.jsx)(m.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:26,weight:"bold",colour:S.colours.goldLight,testID:"walkin-match-question",children:(0,O.walkInMatchQuestion)(e)})}),e.table?(0,L.jsxs)(C.T,{size:17,colour:S.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,L.jsx)(C.T,{size:17,colour:S.colours.text,children:e.ref}),(0,L.jsx)(C.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,L.jsx)(C.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,y.useCtx)(15e3),n=H(o,i),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(i)),t,e.partySize,i,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,i.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),$=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,P=D.reduce((e,t)=>e+$(t),0),B=D.length>0&&P{if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},O=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${P} seats for ${e.partySize} Covers`:'No tables picked yet'})}),B?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-P," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:O,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(Y,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function G(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:O}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[A,W]=(0,c.useState)(ee.blocks),[_,Y]=(0,c.useState)(!1),[q,U]=(0,c.useState)(''),[Q,V]=(0,c.useState)(2),[G,K]=(0,c.useState)(0),X=Math.min(G,Math.max(0,Q-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ie,ne]=(0,c.useState)('phone'),[re,de]=(0,c.useState)((0,$.emptyNeeds)()),ue=(0,$.needsMissing)(re),[ce,be]=(0,c.useState)(null),ge=(0,v.usePlan)(b),he=(0,z.dogSetUp)(ge),pe=!0===re.dog&&he,me=re.dog?re.dogs:0,fe=(0,w.parseYmd)(A),ye=(0,j.turnFor)(Q,h.settings.turnMins),ke=E.filter(e=>e.date===A),xe=e=>(0,j.freeTablesAt)(ge,ke,Q,new Date(`${A}${(0,l.tableNumbers)(e)}:00`),ye,h.settings.turnMins,{dog:!0,closed:(0,D.closedAreasAt)(H,b,A,e)}),je=pe&&J?xe(J):[];(0,c.useEffect)(()=>{be(null)},[pe,J,Q]);const we=(0,x.bookingSlots)(h,fe,e=>E.filter(t=>t.date===A&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Q,A===(0,w.ymd)(p)?p:(0,w.addMins)(fe,0),e=>E.filter(t=>t.date===A&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Se=(0,T.guestPhone)(se),[Te,Ce]=(0,c.useState)(!1),ve=J?we.find(e=>e.time===J):void 0,De=ve&&ve.left=2&&!!J&&(!$e||Te)&&(0,o.validParty)(Q)&&Se.ok&&(0,T.emailOk)(le)&&(!Pe||Be&&_)&&(!pe||je.length>0)&&!ze,Ne=re.wheelchair>0||re.stepFree;return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(fe)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)($.FirstQuestions,{rid:b,value:re,onChange:de,party:Q,audience:"staff"}),re.dog&&!he?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:A,onChange:e=>{e!==A&&(W(e),Z(null),Y(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===ie,onPress:()=>ne('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===ie,onPress:()=>ne('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:U,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Se.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Se.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,L.jsx)(n.AdultsChildren,{value:(0,r.peopleOf)(Q,X),onChange:e=>{V(e.partySize),K(e.children),Ce(!1)},depositsOn:(0,i.depositOf)(h.settings).on&&(0,i.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:we.map(e=>{const t=pe&&e.available&&!xe(e.time).length||!(0,$.dogTimeOk)(h,E,A,e.time,me);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,A,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),Y(!1),Ce(!1)}},e.time)})}),$e?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[De?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Q,De.left,De.time)}):null,Ie?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ie.time,Ie.cap)}):null,(0,L.jsx)(C.Chip,{label:Te?'Booking over the limit: on':'Book anyway (over the limit)',selected:Te,onPress:()=>Ce(e=>!e),testID:"nb-over-ok"})]}):null,pe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",ge.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),je.length?(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:je.slice(0,10).map((e,t)=>(0,L.jsx)(C.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${Ne&&(0,z.accessibleSetUp)(ge)&&!(0,z.isAccessible)(ge,e.table)?' \xb7 not step-free':''}`,selected:(ce??je[0].table)===e.table,onPress:()=>be(e.table)},e.table))}):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Q," at ",J,". Try another time."]})]}):null,Pe?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Pe.from,"\u2013",Pe.to,Pe.reason?` (${Pe.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:_?'Manager override on':'Override and book anyway',selected:_,onPress:()=>Y(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,we.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(fe)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)($.MoreQuestions,{rid:b,r:h,value:re,onChange:de,party:Q,date:A,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ne&&!(0,z.accessibleSetUp)(ge)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:P.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(h.settings),Q,X))," (",(0,a.gbp)((0,i.depositOf)(h.settings).perPersonPence)," per adult for ",(0,i.depositOf)(h.settings).fromParty,"+",X?`; ${X} ${1===X?'child':'children'} free`:'; children free',"). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsxs)(C.Muted,{children:["The guest gets a confirmation text",le.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ze?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:ue.length?ue[0]:'Save booking',testID:"nb-save",disabled:!Oe,onPress:()=>{if(A<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,$.needsPatch)(re),s=re.tableReq.find(e=>!pe||je.some(t=>t.table===e)),o=pe?null:(0,N.requestedFreeTable)(re.tableReq,{date:A,time:J,partySize:Q},ge.tables.map(e=>e.name),ke,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Q,date:A,time:J,notes:ee.trim(),security:(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?'deposit':'none',depositPaid:0,...X?{children:X}:{},...(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?{depositDue:(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X),depositPolicy:(0,i.depositWords)((0,i.depositOf)(h.settings),Q,h.name,X).join(' '),depositRefundable:(0,i.depositOf)(h.settings).refundable,depositCutoffHours:(0,i.depositOf)(h.settings).cutoffHours}:{},phone:Se.pretty,email:le.trim()||void 0,source:ie,...e,...we.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...pe?{table:ce??s??je[0]?.table}:o?{table:o}:{}}).then(e=>(0,B.postNewBookingToKitchen)(e,O)).catch(()=>{}),u?.({date:A,time:J,name:q.trim()}),t()}})]})}},952,[874,813,1403,812,820,14,1404,1405,1406,943,31,1071,264,128,807,953,823,821,830,822,825,827,818,829,828,1407,831,817,993,832,1409,960,959,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtH",{enumerable:!0,get:function(){return d.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return d.fmtHDay}}),Object.defineProperty(_e,"authorityRole",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return b}}),_e.useShiftManager=h,_e.useSignedIn=S,_e.useCtx=function(e=1e4){const u=(0,t.useContext)(y),i=(0,r.useOwner)(e=>e.site),f=(0,r.useOwner)(e=>e.previewRole),c=(0,r.useOwner)(e=>e.staffAs),d=S(),l=u||'staff'===o.APP_VARIANT,D=(0,t.useContext)(b),O=h(),A=o.IS_CAR?'owner':l?D&&O?'manager':'staff':d?w(f,p(d)):f,I=(0,r.useOwner)(e=>e.staff),R=(0,n.useRestaurant)(i),M=(0,n.useNow)(e),C=o.IS_CAR?s.CAR_DEVICE_ID:d?d.id:l&&c?c:m[A],P=o.IS_CAR?s.CAR_ACTOR:I.find(e=>e.id===C)?.name??'Team member';return{rid:i,r:R,now:M,role:A,me:P,meId:C,today:(0,a.venueYmd)(M),signedIn:!o.IS_CAR&&!!d}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return A}}),_e.ensureAttendance=function(t,n){if(e.LIVE_VENUE_BUILD||(0,u.isLive)())return;const o=r.useOwner.getState(),s=[],i=o.staff.find(e=>e.active&&'manager'===e.role)??o.staff.find(e=>e.active&&'owner'===e.role),f=new Date(n);f.setDate(n.getDate()-O(n));const c=(0,a.ymd)(f),d=(0,a.ymd)(new Date(f.getFullYear(),f.getMonth(),f.getDate()+6)),m=(e,t,n)=>{const r=new Date(e);return r.setHours(0,0,0,0),r.setMinutes(Math.round(60*t)+n),r.toISOString()};for(let e=42;e>=1;e--){const t=new Date(n);t.setDate(t.getDate()-e);const r=(0,a.ymd)(t);if(o.attendance.some(e=>e.date===r))continue;const u=o.shifts.filter(e=>e.date===r&&!1!==e.published);(u.length?u:o.shifts.filter(e=>e.day===O(t)&&e.date>=c&&e.date<=d&&!1!==e.published)).forEach((n,a)=>{const o=e=>Math.round((7*r.charCodeAt(9)+13*a+e)%17-5),u=n.end-n.start,f=u>8?30:u>6?20:0,c=e>2&&i?{signOff:{by:i.name,byId:i.id,at:m(t,34,a)}}:{};s.push({id:`at-${r}-${n.staffId}`,staffId:n.staffId,date:r,in:m(t,n.start,o(1)),out:m(t,n.end,o(2)),inSite:!0,outSite:!0,breakMins:f,...c})})}s.length&&r.useOwner.setState({attendance:[...r.useOwner.getState().attendance,...s]})},_e.paidMins=function(e,t){if(!e.in)return{worked:0,brk:0,paid:0};const n=Math.max(0,Math.round(((e.out?new Date(e.out):t).getTime()-new Date(e.in).getTime())/6e4)),r=e.breakMins??0;return{worked:n,brk:r,paid:Math.max(0,n-r)}},Object.defineProperty(_e,"hmDur",{enumerable:!0,get:function(){return I}}),_e.payRange=function(e,t,n){const r=new Date(n);if(r.setHours(0,0,0,0),'monthly'===e){const e=new Date(r.getFullYear(),r.getMonth()+t,1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{s:e,e:n,key:`m-${(0,a.ymd)(e)}`}}const o='weekly'===e?7:14,s=new Date(r);s.setDate(r.getDate()-O(r));let u=new Date(s);if('fortnightly'===e){const e=new Date(2026,0,5);(Math.round((s.getTime()-e.getTime())/6048e5)%2+2)%2==1&&u.setDate(u.getDate()-7)}u.setDate(u.getDate()+t*o);const i=new Date(u);return i.setDate(u.getDate()+o-1),{s:u,e:i,key:`${e[0]}-${(0,a.ymd)(u)}`}},_e.useHourly=function(){const e=S(),t=(0,r.useOwner)(e=>e.hourly);return o.IS_CAR||e?t:R};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),r=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]),u=_r(_d[7]),i=_r(_d[8]),f=_r(_d[9]),c=_r(_d[10]),d=_r(_d[11]);const m={owner:c.ROSTER.find(e=>'owner'===e.role)?.id??'',manager:c.ROSTER.find(e=>'manager'===e.role)?.id??'',staff:c.ROSTER.find(e=>'staff'===e.app)?.id??''},l={staff:0,manager:1,owner:2},p=e=>e.ownerAccess?'owner':e.managerAccess&&'staff'===e.role?'manager':e.role,w=(e,t)=>l[e]>l[t]?t:e,y=(0,t.createContext)(!1),D=()=>(0,t.useContext)(y),b=(0,t.createContext)(!1);function h(){const e=(0,t.useContext)(y)||'staff'===o.APP_VARIANT,n=S(),r=(0,u.useSync)(e=>!!e.venueId&&'staff'===e.kind),a=(0,u.useSync)(e=>e.perms);return(0,i.shiftManagerOn)({inStaffApp:e,managerAccess:n?.managerAccess,role:n?.role,app:(0,f.rosterPerson)(n?.id)?.app,live:r,perms:a})}function S(){const e=(0,f.useSession)(e=>e.meId),t=(0,r.useOwner)(e=>e.staff);return e?t.find(t=>t.id===e&&t.active):void 0}const O=e=>(e.getDay()+6)%7,A=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const I=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const R={}},953,[842,31,823,863,822,807,977,824,1101,866,15,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,"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,'+')}},954,[876,812,985,31,119,123,128,829,830,825,818,993,1071,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"areaMarks",{enumerable:!0,get:function(){return n}}),_e.AreaTabs=function({plan:o,area:e,onPick:u,counts:a,closed:b}){return(0,c.jsx)(t.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:o.areas.map(o=>{const h=o.id===e,f=b?.has(o.id);return(0,c.jsx)(l.default,{testID:`area-${o.id}`,accessibilityRole:"tab",accessibilityLabel:`Area ${o.name}${o.dogs?', dogs allowed':''}${o.outdoor?', outdoor':''}${f?', closed for weather':''}`,accessibilityState:{selected:h},onPress:()=>u(o.id),style:{maxWidth:'100%',minWidth:0,flexShrink:1,minHeight:48,paddingHorizontal:16,borderRadius:24,borderWidth:1.5,borderColor:h?s.colours.gold:f?s.colours.blue:s.colours.border,backgroundColor:h?s.colours.gold:s.colours.surface,justifyContent:'center'},children:(0,c.jsxs)(t.T,{weight:"semibold",size:15,colour:h?s.colours.onGold:s.colours.text,children:[o.name,n(o),f?(0,c.jsx)(t.T,{size:12,colour:h?s.colours.onGold:s.colours.blue,children:" closed"}):null,a?.[o.id]?(0,c.jsxs)(t.T,{size:12,colour:h?s.colours.onGold:s.colours.muted,children:[" ",a[o.id]]}):null]})},o.id)})})},r(d[0]);var o,e=r(d[1]),l=(o=e)&&o.__esModule?o:{default:o},s=r(d[2]),t=r(d[3]),c=r(d[4]);const n=o=>`${o.dogs?' \ud83d\udc3e':''}${o.outdoor?' \ud83c\udf26':''}`},955,[31,264,825,818,25]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=R,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),N=a.now,F=e=>l({t:'set',p:e}),[H,O]=(0,i.useState)(e.startStep??'areas'),[U,G]=(0,i.useState)(e.initial.areas[0]?.id??''),[_,K]=(0,i.useState)(null),X=(0,w.useOwner)(e=>e.site),J=(0,y.useFloor)(e=>e.settings[X]),Y=!1!==J?.gridSnap,Z=(0,j.gridOf)(J?.gridSize),[q,V]=(0,i.useState)(null),[Q,ee]=(0,i.useState)(null),[se,te]=(0,i.useState)(null),ae=(0,T.useSync)(e=>e.venueId),le=e.role??'staff',[oe,ne]=(0,i.useState)(''),{width:re,height:ie}=(0,c.default)(),de=re>=900,ue=a.past.length>0||JSON.stringify(N)!==JSON.stringify(e.initial),ce=(0,b.planCounts)(N);(0,i.useEffect)(()=>{N.areas.some(e=>e.id===U)||G(N.areas[0]?.id??'')},[N.areas,U]),(0,i.useEffect)(()=>{oe&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:oe,timeoutMs:3500,testID:'plan-toast'}),ne(''))},[oe]);const he='table'===_?.kind?N.tables.find(e=>e.id===_.id):void 0,be='fixture'===_?.kind?(N.fixtures??[]).find(e=>e.id===_.id):void 0,ge=(e,s)=>{const t=N.tables.find(s=>s.id===e),a=t&&s.name&&s.name!==t.name?N.joins.map(e=>({...e,tables:e.tables.map(e=>e===t.name?s.name:e)})):N.joins,l=t&&s.name&&s.name!==t.name?N.areas.map(e=>e.best?.includes(t.name)?{...e,best:e.best.map(e=>e===t.name?s.name:e)}:e):N.areas;F({...N,areas:l,joins:a,tables:N.tables.map(t=>t.id===e?{...t,...s}:t)})},pe=e=>{const s=N.tables.find(s=>s.id===e);F({...N,tables:N.tables.filter(s=>s.id!==e),joins:N.joins.filter(e=>!s||!e.tables.includes(s.name))}),K(null)},me=e=>{const s=b.FIXTURES.find(s=>s.id===e),t={id:(0,b.fid)('fx'),areaId:U,kind:e,x:25*Math.round((b.PLAN_W-s.w)/50),y:25,w:s.w,h:s.h};F({...N,fixtures:[...N.fixtures??[],t]}),K({kind:'fixture',id:t.id})},xe=e=>{const s=(0,j.tidyArea)(N,e,Z),t=(0,j.movedCount)(N,s);t?(F(s),ne(`Tidied: ${t} table${1===t?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):ne('Already tidy: every table is on the grid and lined up.')},fe=e=>{const s=(0,b.autoArrange)(N.tables.filter(s=>s.areaId===e),$(N,e));F({...N,tables:[...N.tables.filter(s=>s.areaId!==e),...s]}),ne('Layout tidied. Undo if you preferred it before.')};(0,i.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const s=e.target?.tagName;if('INPUT'===s||'TEXTAREA'===s)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==H||!_)return;const t=e.altKey?1:Y?Z:5,a={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowUp:[0,-t],ArrowDown:[0,t]}[e.key];a&&(e.preventDefault(),je(_.kind,_.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===_.kind?pe(_.id):(F({...N,fixtures:(N.fixtures??[]).filter(e=>e.id!==_.id)}),K(null))),'r'===e.key.toLowerCase()&&ye(_.kind,_.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const je=(e,s,t,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(b.PLAN_W-e.w,l?e.x+t:t)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});F('table'===e?{...N,tables:N.tables.map(e=>e.id===s?{...e,...o(e)}:e)}:{...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?{...e,...o(e)}:e)})},ye=(e,s)=>{F('table'===e?{...N,tables:N.tables.map(e=>e.id===s?(0,b.rotate90)(e):e)}:{...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?(0,b.rotate90)(e):e)})},we='display'===e.mode;return(0,I.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[we?(0,I.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,I.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,I.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,I.jsx)(h.default,{style:{backgroundColor:(0,s.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,I.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,I.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,I.jsxs)(h.default,{style:{marginRight:6},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,I.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,I.jsx)(x.Row,{gap:6,children:k.map(e=>{const s=e.id===H;return(0,I.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{O(e.id),K(null),V(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:s?p.colours.gold:p.colours.border,backgroundColor:s?p.colours.goldTint:'transparent'},children:[(0,I.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:s?p.colours.gold:p.colours.surface2},children:(0,I.jsx)(x.T,{size:13,weight:"bold",colour:s?p.colours.onGold:p.colours.muted,children:e.n})}),(0,I.jsx)(x.T,{weight:"semibold",size:15,colour:s?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,I.jsx)(h.default,{style:{flex:1}}),(0,I.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,I.jsxs)(x.T,{weight:"bold",size:16,children:[ce.tables," tables \xb7 ",ce.seats," seats"]}),(0,I.jsxs)(x.Muted,{size:12,children:[N.areas.length," area",1===N.areas.length?'':'s',ue?' \xb7 unsaved changes':'']})]}),(0,I.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,I.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,I.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>ue?ee({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,I.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!ue,onPress:()=>ee({title:'Save changes to the table plan?',body:`${ce.tables} tables \xb7 ${ce.seats} seats across ${N.areas.length} area${1===N.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(R(N))}),style:{minHeight:44}}),ae?(0,I.jsx)(S.NamedPlanButtons,{onSaveAs:()=>te('save'),onList:()=>te('list')}):null]}),(0,I.jsxs)(h.default,{style:{flex:1},children:['areas'===H?(0,I.jsx)(M,{plan:N,set:F,confirm:ee,wide:de,next:()=>O('tables'),toast:ne}):null,'tables'===H?(0,I.jsx)(E,{plan:N,set:F,area:U,setArea:G,addTables:(e,s)=>{let t={...N,areas:[...N.areas],tables:[...N.tables]};const a=new Set(t.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const s of e){if(a.has(s.name)){l.push(s.name);continue}let e=U;if(s.area){const a=t.areas.find(e=>e.name.toLowerCase()===s.area.toLowerCase());a?e=a.id:(e=A(t,s.area),t.areas.push({id:e,name:s.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(s.name,e,s.seats,P(t,e)),[d]=(0,b.placeNew)(t.tables.filter(s=>s.areaId===e),[i],(t.fixtures??[]).filter(s=>s.areaId===e));t.tables.push(d),a.add(s.name),n.add(e),o++}if(s)for(const e of n){const s=t.tables.filter(s=>s.areaId===e),a=(0,b.autoArrange)(s,$(t,e));t={...t,tables:[...t.tables.filter(s=>s.areaId!==e),...a]}}return o&&F(t),ne(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:pe,patch:ge,wide:de,next:()=>O('arrange'),back:()=>O('areas')}):null,'arrange'===H?(0,I.jsxs)(h.default,{style:{flex:1,flexDirection:de?'row':'column'},children:[(0,I.jsxs)(h.default,{style:{flex:1,padding:10,gap:8,minHeight:de?void 0:Math.min(420,.5*ie)},children:[(0,I.jsx)(L,{plan:N,area:U,onPick:e=>{G(e),K(null),V(null)}}),q?(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,I.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(N.tables.find(e=>e.id===q)?.name),"."]}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>V(null)})]}):null,(0,I.jsx)(f.DesignerCanvas,{plan:N,areaId:U,sel:_,onSelect:e=>{if(q&&'table'===e?.kind&&e.id!==q){const s=N.tables.find(e=>e.id===q),t=N.tables.find(s=>s.id===e.id),a=N.joins.find(e=>e.tables.includes(s.name)),l=a?N.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,t.name])].sort((e,s)=>(0,b.numOf)(e)-(0,b.numOf)(s))}:e).filter(e=>e===a||!e.tables.includes(t.name)):[...N.joins.filter(e=>!e.tables.includes(t.name)),{id:(0,b.fid)('j'),tables:[s.name,t.name].sort((e,s)=>(0,b.numOf)(e)-(0,b.numOf)(s))}];return F({...N,joins:l}),V(null),ne(`Joined: book as ${l.find(e=>e.tables.includes(s.name)).tables.join('+')}`),void K(e)}V(null),K(e)},snapOn:Y,grid:Z,joinFrom:q,onMove:(e,s,t,a)=>je(e,s,t,a),onResize:(e,s,t,a)=>{if('table'===e){const e=N.tables.find(e=>e.id===s);if('round'===e.shape){const l=Math.max(t,a);ge(s,{w:l,h:l,x:e.x,y:e.y})}else ge(s,{w:t,h:a,shape:t===a?'square':'rect',x:e.x,y:e.y})}else F({...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?{...e,w:t,h:a}:e)})}}),(0,I.jsxs)(x.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",Y?`tables snap to a ${Z} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,I.jsx)(u.default,{style:{width:de?330:void 0,flexGrow:de?0:1,flexShrink:0,flexBasis:de?330:void 0,borderLeftWidth:de?1:0,borderTopWidth:de?0:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:he?(0,I.jsx)(W,{t:he,plan:N,patch:e=>ge(he.id,e),rotate:()=>ye('table',he.id),remove:()=>pe(he.id),duplicate:()=>{const e=z(N),s={...he,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[t]=(0,b.placeNew)(N.tables.filter(e=>e.areaId===he.areaId),[s],(N.fixtures??[]).filter(e=>e.areaId===he.areaId));F({...N,tables:[...N.tables,t]}),K({kind:'table',id:t.id}),ne(`${(0,o.tableNumbers)(e)} added`)},join:()=>V(he.id),split:e=>F({...N,joins:N.joins.filter(s=>s.id!==e)}),moveArea:e=>{const[s]=(0,b.placeNew)(N.tables.filter(s=>s.areaId===e),[{...he,areaId:e,sectionId:P(N,e)}],(N.fixtures??[]).filter(s=>s.areaId===e));F({...N,tables:N.tables.map(e=>e.id===he.id?s:e)}),G(e)},onDone:()=>K(null),toast:ne}):be?(0,I.jsxs)(h.default,{style:{gap:10},children:[(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===be.kind)?.label}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>K(null)})]}),(0,I.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,I.jsx)(x.Chip,{label:e.label,selected:be.kind===e.id,onPress:()=>F({...N,fixtures:(N.fixtures??[]).map(s=>s.id===be.id?{...s,kind:e.id}:s)})},e.id))}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>ye('fixture',be.id)}),(0,I.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{F({...N,fixtures:(N.fixtures??[]).filter(e=>e.id!==be.id)}),K(null)}})]}):(0,I.jsxs)(h.default,{style:{gap:12},children:[(0,I.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",N.areas.find(e=>e.id===U)?.name??'']}),(0,I.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,I.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=z(N),s=(0,b.newTable)(e,U,4,P(N,U)),[t]=(0,b.placeNew)(N.tables.filter(e=>e.areaId===U),[s],(N.fixtures??[]).filter(e=>e.areaId===U));F({...N,tables:[...N.tables,t]}),K({kind:'table',id:t.id})}}),(0,I.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,I.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,I.jsx)(x.Chip,{label:e.label,onPress:()=>me(e.id)})},e.id))}),(0,I.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>xe(U)}),(0,I.jsx)(x.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>fe(U)}),(0,I.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:e=>y.useFloor.getState().setSettings(X,{...y.DEFAULT_SETTINGS,...J??{},gridSnap:e})}),(0,I.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:N.areas.map(e=>{const s=(0,b.planCounts)(N,e.id);return(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsxs)(x.T,{size:14,children:[e.name,(0,C.areaMarks)(e)]}),(0,I.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})})]})})]}):null]}),Q?(0,I.jsx)(h.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,I.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,I.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:Q.title}),(0,I.jsx)(t.GoldClose,{onPress:()=>ee(null),label:"Close",testID:"designer-confirm-close"})]}),(0,I.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:Q.body}),(0,I.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ee(null)}),(0,I.jsx)(x.Button,{kind:Q.danger?'danger':'primary',label:Q.ok,testID:"confirm-ok",onPress:()=>{const e=Q;ee(null),e.run()}})]})]})}):null,'save'===se&&ae?(0,I.jsx)(S.SaveAsPlanDialog,{venueId:ae,plan:R(N),onClose:()=>te(null),onSaved:()=>te(null),toast:ne}):null,'list'===se&&ae?(0,I.jsx)(S.SavedPlansDialog,{venueId:ae,mode:e.mode,role:le,isCar:v.IS_CAR,onClose:()=>te(null),onLive:s=>{l({t:'reset',p:s}),e.onLiveChange?.(s),te(null)},toast:ne}):null]})};var s=r(_d[0]),t=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(r(_d[11])),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),C=r(_d[19]),S=r(_d[20]),T=r(_d[21]),v=r(_d[22]),I=r(_d[23]);const k=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(e,s){return'set'===s.t?{past:[...e.past,e.now].slice(-80),now:s.p,future:[]}:'undo'===s.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===s.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:s.p,future:[]}}function R(e){const s=new Set(e.tables.map(e=>e.name)),t=[...e.sections];for(const s of e.areas)t.some(e=>e.id===`s-${s.id}`)||e.tables.some(e=>e.areaId===s.id&&e.sectionId)||t.push({id:`s-${s.id}`,name:s.name,colour:'#CFA45F',server:''});return{...e,sections:t,fixtures:(e.fixtures??[]).filter(s=>e.areas.some(e=>e.id===s.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>s.has(e)))}}const z=e=>{let s=1;const t=new Set(e.tables.map(e=>e.name));for(;t.has(String(s));)s++;return String(s)},P=(e,s)=>e.tables.find(e=>e.areaId===s)?.sectionId??`s-${s}`,$=(e,s)=>(e.fixtures??[]).some(e=>e.areaId===s&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,s)=>{let t=(0,b.slug)(s),a=2;for(;e.areas.some(e=>e.id===t);)t=`${(0,b.slug)(s)}-${a++}`;return t};function B({label:e,glyph:s,onPress:a,disabled:l}){return(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===s?(0,I.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,I.jsx)(t.GoldX,{size:14}),(0,I.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,I.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[s,(0,I.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:s,onPick:t}){return(0,I.jsx)(u.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===s,o=(0,b.planCounts)(e,a.id);return(0,I.jsx)(d.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>t(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,I.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,C.areaMarks)(a)," ",(0,I.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function M({plan:e,set:s,confirm:t,wide:l,next:n,toast:c}){const[f,j]=(0,i.useState)(''),y=(t,a)=>s({...e,areas:e.areas.map(e=>e.id===t?{...e,...a}:e)}),w=(t,a)=>{const l=[...e.areas],o=t+a;o<0||o>=l.length||([l[t],l[o]]=[l[o],l[t]],s({...e,areas:l}))},C=()=>{const t=f.trim();if(!t)return;if(e.areas.some(e=>e.name.toLowerCase()===t.toLowerCase()))return void c(`There's already an area called ${t}`);const a=A(e,t);s({...e,areas:[...e.areas,{id:a,name:t,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:t,colour:'#CFA45F',server:''}]}),j('')};return(0,I.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,I.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,I.jsx)(x.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,I.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(F,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,I.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,I.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,I.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,I.jsx)(x.Row,{gap:8,children:(0,I.jsx)(F,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,I.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),N.map(t=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===t;return(0,I.jsx)(d.default,{testID:`area-colour-${a.id}-${t.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${t}`,onPress:()=>s({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:t}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:t}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:t,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},t)})]}),(()=>{const s=e.tables.filter(e=>e.areaId===a.id).sort((e,s)=>e.name.localeCompare(s.name,void 0,{numeric:!0})),t=a.best??[];return s.length?(0,I.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:s.map(e=>(0,I.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:t.includes(e.name),onPress:()=>y(a.id,{best:t.includes(e.name)?t.filter(s=>s!==e.name):[...t,e.name]})},e.id))}),(0,I.jsx)(x.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,I.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,I.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,I.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,I.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,I.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>t({title:`Remove ${a.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>s({...e,areas:e.areas.filter(e=>e.id!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,I.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,I.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,I.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,I.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,I.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,I.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>t({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{s(e.make()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,I.jsx)(x.T,{weight:"semibold",children:e.name}),(0,I.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const N=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function F({value:e,onCommit:s,label:t="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,I.jsx)(a.TextInput,{accessibilityLabel:t,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>s(o.trim()),onSubmitEditing:()=>s(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function E({plan:e,set:s,area:t,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[S,T]=(0,i.useState)(4),[v,k]=(0,i.useState)(''),[D,R]=(0,i.useState)(!0),P=(0,i.useMemo)(()=>(0,b.parseTableList)(v),[v]),$=e.tables.filter(e=>e.areaId===t).sort(b.byNumber),A=z(e),M=e.areas.find(e=>e.id===t),N=(e,s)=>{const t=(0,b.sizeFor)(s),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(e.id,{maxSeats:s,minSeats:Math.min(e.minSeats,s),...l?{}:'round'===e.shape?{w:t.h,h:t.h}:{w:t.w,h:t.h,shape:t.shape}})};return(0,I.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,I.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,I.jsx)(L,{plan:e,area:t,onPick:l}),(0,I.jsxs)(x.Muted,{children:[M?`${M.name}${M.dogs?' \xb7 dogs allowed':''}${M.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,I.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:$.length?$.map((e,s)=>(0,I.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:s?1:0,borderColor:p.colours.border},children:[(0,I.jsxs)(h.default,{style:{width:92},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,I.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,I.jsx)(h.default,{style:{flex:1},children:(0,I.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:s=>N(e,s)})}),(0,I.jsx)(x.Muted,{children:"seats"}),(0,I.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,I.jsx)(h.default,{style:{padding:16},children:(0,I.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,I.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,I.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,I.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",M?.name]}),(0,I.jsxs)(x.Row,{gap:10,children:[(0,I.jsxs)(h.default,{style:{width:120},children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,I.jsx)(a.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:A,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,I.jsxs)(h.default,{children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,I.jsx)(x.Stepper,{value:S,min:1,max:20,label:"seats",onChange:T})]})]}),(0,I.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||A)}`,testID:"add-table",onPress:()=>{n([{name:(w||A).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,I.jsx)(x.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,I.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:v,onChangeText:k,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),v.trim()?(0,I.jsxs)(x.T,{size:14,colour:P.items.length?p.colours.ok:p.colours.amber,children:["Found ",P.items.length," table",1===P.items.length?'':'s'," \xb7 ",P.items.reduce((e,s)=>e+s.seats,0)," seats",P.skipped.length?` \xb7 couldn't read: ${P.skipped.slice(0,2).join('; ')}`:'']}):null,(0,I.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:D,onChange:R}),(0,I.jsx)(x.Button,{label:P.items.length?`Add ${P.items.length} tables`:'Add tables',testID:"paste-add",disabled:!P.items.length,onPress:()=>{n(P.items,D)&&k('')}})]})]})]})}function W({t:e,plan:s,patch:t,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,i.useState)(e.name);(0,i.useEffect)(()=>S(e.name),[e.id,e.name]);const T=s.joins.find(s=>s.tables.includes(e.name)),v=()=>{const a=C.trim().toUpperCase();if(a&&a!==e.name)return s.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void S(e.name)):void t({name:a})};return(0,I.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,I.jsx)(l.TableNumberWarning,{plan:s}),(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,I.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:v,onSubmitEditing:v,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,I.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:s=>t({maxSeats:s,minSeats:Math.min(e.minSeats,s)})})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,I.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>t({minSeats:e})})]}),(0,I.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,I.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const s=Math.max(e.w,e.h);t({shape:'square',w:s,h:s})}}),(0,I.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const s=Math.max(e.w,e.h);t({shape:'round',w:s,h:s})}}),(0,I.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const s=(0,b.sizeFor)(Math.max(5,e.maxSeats));t({shape:'rect',w:e.h>e.w?e.w:s.w,h:e.h>e.w?s.w:s.h})}}),(0,I.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const s=(0,b.sizeFor)(e.maxSeats);t({shape:s.shape,w:s.w,h:s.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),T?(0,I.jsxs)(h.default,{style:{gap:6},children:[(0,I.jsxs)(x.T,{size:14,children:["Joined with ",T.tables.filter(s=>s!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,I.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(T.tables.join('+'))})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(T.id),style:{flex:1}})]})]}):(0,I.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,I.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>t({online:e})}),s.areas.length>1?(0,I.jsxs)(h.default,{style:{gap:6},children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:s.areas.map(s=>(0,I.jsx)(x.Chip,{label:s.name,selected:s.id===e.areaId,onPress:()=>s.id!==e.areaId&&j(s.id)},s.id))})]}):null,(0,I.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},956,[876,835,874,935,812,943,31,123,264,152,288,128,1071,825,818,1510,1511,829,863,955,1513,824,807,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"saverConnected",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"SAVER_BUCKET",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useSaverCfg",{enumerable:!0,get:function(){return S}}),_e.loadSaver=v,_e.saveSaver=async function(e,t){const n=f();if(!n)return void S.getState().set(e);const{error:o}=await l().from('display_screensaver').upsert({venue_id:n,...(0,u.saverToRow)(e),updated_at:(new Date).toISOString(),updated_by:t.slice(0,80)});if(o)throw o;S.getState().set(e)},_e.watchSaver=y,_e.uploadSaverPhoto=async function(e,t){const n=f();if(!n)throw new Error('Photos need the venue connection.');if(t>=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},957,[31,995,872,824,987]); +__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})]})]})}},958,[991,31,128,823,829,960,825,818,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.guardBookingChange=w,_e.saveTablesReported=async function(e,t,n,o,s,u){if(!w(u,{b:t,tables:n}))return!1;const v=n.length?(0,h.notSavedWhat)({...t,name:o,table:n.join('+')}):`Taking the table off ${o}`;u(`Saving ${v}\u2026`);try{await(0,b.saveBookingTables)(e,t,n)}catch(e){const t=`${v} did not save: ${String(e?.message??e).slice(0,120)}`;return u(t),(0,l.announce)(t),!1}const y=await(0,c.waitForBookingSave)(t.id);if('saved'===y.state||'local'===y.state){const e=(0,r.savedWords)(o,t.partySize,n,s);return u(e),(0,l.announce)(e),!0}const k='waiting'===y.state?`${v}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${v} did not save. ${f("why"in y?y.why:"the shared system did not take it")}. Tap the red banner to try again.`;return u(k),(0,l.announce)(k),!1},_e.reportBookingSave=async function(e,t,n,o){const s=await(0,c.waitForBookingSave)(e);if('saved'===s.state||'local'===s.state)return o(t),(0,l.announce)(t),!0;const r='waiting'===s.state?`${n}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${n} did not save. ${f('why'in s?s.why:'the shared system did not take it')}. Tap the red banner to try again.`;return o(r),(0,l.announce)(r),!1},_e.BookingSaveBanner=function({rid:e,testID:r="booking-save-banner",margin:c}){const b=(0,h.useBookingSaves)(e=>e.notSaved),w=(0,s.useBookings)(e).filter(e=>b[e.id]).map(e=>void 0!==b[e.id].want?{...e,table:b[e.id].want||void 0}:e),{msg:S,retry:$}=k(),m=(0,t.useRef)(''),p=w.map(e=>(0,h.notSavedLine)(e)),B=w.map(e=>e.id).sort().join(',');if((0,t.useEffect)(()=>{B&&B!==m.current&&(0,l.announce)(1===w.length?p[0]:`${w.length} booking changes did not save. Tap the red banner to try again.`),m.current=B},[B]),!w.length)return null;const j=1===w.length?p[0]:`${w.length} booking changes did not save. Tap to try again.`;return(0,y.jsx)(n.default,{testID:r,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${j}${w.length>1?` ${w.map(e=>(0,h.notSavedWhat)(e)).join('. ')}.`:''} ${f(b[w[0].id].why)}.`,onPress:$,style:{...c??{},alignSelf:'stretch',gap:4,padding:12,borderRadius:12,borderWidth:2,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:(0,y.jsxs)(o.default,{accessibilityRole:"alert",style:{alignItems:'center',gap:4},children:[(0,y.jsx)(v.T,{testID:`${r}-title`,size:17,weight:"semibold",center:!0,colour:"#FFD2CC",children:j}),w.length>1?w.slice(0,6).map(e=>(0,y.jsx)(v.T,{testID:`${r}-line`,size:15,center:!0,colour:"#FFD2CC",children:(0,h.notSavedWhat)(e)},e.id)):null,(0,y.jsx)(v.T,{testID:`${r}-why`,size:14,center:!0,colour:"#FFB3AA",children:w.length>1?`${f(b[w[0].id].why)}${w.length>6?` \xb7 and ${w.length-6} more`:''}`:f(b[w[0].id].why)}),S?(0,y.jsx)(v.T,{testID:`${r}-msg`,size:14,center:!0,colour:u.colours.goldLight,children:S}):null]})})},_e.BookingNotSavedLine=function({b:e}){const t=(0,h.useBookingSaves)(t=>t.notSaved[e.id]),{msg:o,retry:s}=k();if(!t)return null;void 0!==t.want&&(e={...e,table:t.want||void 0});return(0,y.jsxs)(n.default,{testID:`booking-not-saved-${e.id}`,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${(0,h.notSavedLine)(e)} ${f(t.why)}.`,onPress:s,style:{alignSelf:'stretch',padding:8,borderRadius:10,borderWidth:1.5,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:[(0,y.jsx)(v.T,{size:15,weight:"semibold",center:!0,colour:"#FFD2CC",children:(0,h.notSavedLine)(e)}),o?(0,y.jsx)(v.T,{size:13,center:!0,colour:u.colours.goldLight,children:o}):null]})};var t=_r(d[0]),n=e(_r(d[1])),o=e(_r(d[2])),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),b=_r(d[9]),v=_r(d[10]),y=_r(d[11]);const f=e=>e.charAt(0).toUpperCase()+e.slice(1);function w(e,t){const n=(0,c.bookingSaveBlocker)();if(!n)return!0;t&&h.useBookingSaves.getState().mark({id:t.b.id,table:t.b.walkIn?'walk_ins':'bookings',why:n,...t.tables?{want:t.tables.join('+')}:{}});const o=`${t?(0,h.notSavedWhat)({...t.b,...t.tables?{table:t.tables.join('+')||void 0}:{}}):'This change'} did not save: ${n}.`;return e?.(o),(0,l.announce)(o),!1}function k(){const[e,n]=(0,t.useState)('');return{msg:e,retry:async()=>{n('Saving\u2026'),(0,l.announce)('Saving');const e=await(0,c.saveBookingsNow)(!0),t=e?`Not saved: ${e}.`:h.useBookingSaves.getState().count()?'Sent again. The banner clears when the shared system takes it.':'Nothing is left waiting. Check the plan and make the change again if it is not there.';n(t),(0,l.announce)(t)}}}},959,[31,264,128,823,960,1402,824,1252,825,990,818,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=u,e.requestedFreeTable=function(t,n,a,s,l=90){const o={id:n.id??'new',status:'confirmed',...n};for(const n of t)if(a.includes(n)&&!u(o,[n],s,l).length)return n;return null},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=c,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${c(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${c(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${c(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))}function c(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},960,[812,830]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},961,[812,1042,31,123,264,128,989,823,825,818,1461,943,963,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"unconfirmedTakeaways",{enumerable:!0,get:function(){return x}}),_e.useBuildingChime=function(e,s=4e3,i=6e4){const o=(0,a.useAlerts)(e=>e.prefs.muted);(0,t.useEffect)(()=>{if(!e||o)return;const t=Date.now(),l=()=>(0,c.lowChime)(Math.min(1,(Date.now()-t)/i));l();const n=setInterval(l,s);return()=>clearInterval(n)},[e,o,s,i])},_e.TakeawayFacts=b,_e.TakeawayTakeover=function({rid:e,me:i}){const o=(0,l.useOrders)(e),n=x(o),a=n[0],c=s.default.useRef(i);return c.current=i,(0,t.useEffect)(()=>{a?(0,f.notify)({id:'takeaway-takeover',tone:a.allergies.length?'urgent':'warn',modal:!0,big:!0,testID:'takeaway-takeover',icon:'\ud83e\udd61',kicker:'NEW TAKEAWAY ORDER',title:`Order ${a.ref}: read it, then tap Confirm`,body:"This stays on screen until someone confirms."+(n.length>1?` ${n.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,j.jsx)(y,{rid:e,id:a.id,me:c.current})}):(0,f.dismissNotice)('takeaway-takeover')},[a?.id,n.length,e]),(0,t.useEffect)(()=>()=>(0,f.dismissNotice)('takeaway-takeover'),[]),null};var t=r(d[0]),s=e(t),i=e(r(d[1])),o=e(r(d[2])),l=r(d[3]),n=r(d[4]),a=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),j=r(d[10]);const w=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'As soon as possible',x=e=>e.filter(e=>'takeaway'===e.type&&'new'===e.status&&!e.accepted).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function b({o:e,big:t,personal:s=!0}){const o=t?1:.8;return(0,j.jsxs)(i.default,{style:{gap:10},children:[(0,j.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:18},children:[(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Collection"}),(0,j.jsx)(h.T,{size:34*o,weight:"bold",colour:u.colours.goldLight,children:w(e.slotTime)})]}),s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Customer"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.customerName})]}):null,s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Phone"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.phone??'Not given'})]}):null,(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Order"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.ref})]})]}),e.allergies.length?(0,j.jsxs)(i.default,{testID:"takeover-allergy",style:{backgroundColor:'#7A140D',borderRadius:12,padding:12,borderWidth:2,borderColor:'#FFB3AB'},children:[(0,j.jsxs)(h.T,{size:22*o,weight:"bold",colour:"#FFFFFF",children:["\u26a0 ALLERGY: ",e.allergies.map(e=>`${(0,n.allergenLabel)(e.allergen)} (${(0,n.severityLabel)(e.severity)})`).join(', ')]}),e.lines.filter(e=>e.overridden).map((e,t)=>(0,j.jsxs)(h.T,{size:16*o,weight:"semibold",colour:"#FFE3DF",children:["Customer overrode a warning: ",e.name," contains ",e.contains.map(n.allergenLabel).join(', ')]},t))]}):(0,j.jsx)(h.T,{size:16*o,colour:u.colours.ok,children:"No allergies declared"}),(0,j.jsx)(i.default,{style:{gap:4},children:e.lines.map((e,t)=>(0,j.jsxs)(h.T,{size:22*o,weight:"semibold",children:[e.qty," \xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 \u201c${e.notes}\u201d`:'']},t))})]})}function y({rid:e,id:t,me:s}){const n=(0,l.useOrders)(e).find(e=>e.id===t),{width:a}=(0,o.default)();return n?(0,j.jsxs)(i.default,{style:{gap:12},children:[(0,j.jsx)(b,{o:n,big:a>=700}),(0,j.jsx)(h.Button,{label:`Confirm order ${n.ref}`,testID:"takeover-confirm",onPress:()=>{l.repo.orders.accept(n.id,s)},style:{minHeight:72,borderRadius:14}})]}):null}},962,[31,128,288,823,819,963,946,825,818,943,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},963,[1462,1463,1465,1464,1466,946,1467]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'Closed for weather':'For weather',accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),I=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{testID:"block-today",title:"Today",sub:T?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!T,onPress:()=>m('today')}),(0,f.jsx)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},964,[812,31,1443,973,264,128,828,829,833,822,825,818,1084,1518,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:w,now:b,turnBase:v,blocks:M=[],height:T=150,forecastNote:$,emptyText:D,past:A,closed:k,compact:C=!1,dense:I=!1,bare:z=!1,fill:F=!1,fit:L=!1,tight:S=!1,live:_=!1}){const[H,O]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),P=j.getTime()-18e5,E=w.getTime()+36e5,R=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(P),new Date(E),v),[e,P,E,v]),X=60*j.getHours()+j.getMinutes(),U=60*w.getHours()+w.getMinutes(),W=(0,t.useMemo)(()=>(0,f.chartBands)(M,X,U),[M,X,U]),G=new Date(j);G.setHours(0,0,0,0);const V=e=>G.getTime()+6e4*e,Y=Math.max(8,...R.map(e=>e.covers)),Z=R.reduce((e,t)=>!t.covers||(0,f.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),W)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),q=L&&N?Math.max(24,Math.floor(N)):Math.max(48,T-m.AXIS_BAND),J=I?8:16,K=Math.max(10,H-28-8),Q=Math.max(10,q-J-6),ee=e=>28+(e-P)/(E-P)*K,te=e=>J+Q-e/(1.15*Y)*Q,se=[];for(let e=new Date(P);e.getTime()<=E;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=P&&t.getTime()<=E&&se.push(t.getTime())}const ie=_?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ne=Math.min(E,Math.max(P,b.getTime())),oe=k?null:_?{t:ne,covers:ie,text:(0,m.seatedNowText)(ie)}:Z,le=H?(0,m.layoutChart)({width:H,height:q,t0:P,t1:E,hours:se,busiest:oe}):{hours:[],busiest:null},re=R.map((e,t)=>`${t?'L':'M'}${ee(e.t).toFixed(1)},${te(e.covers).toFixed(1)}`).join(' '),ae=F&&re&&R.length>1?`${re} L${ee(R[R.length-1].t).toFixed(1)},${te(0).toFixed(1)} L${ee(R[0].t).toFixed(1)},${te(0).toFixed(1)} Z`:'',de=(0,i.coversFour)(e,e[0]?.date??''),he=`Total ${de.total} ${1===de.total?'Cover':'Covers'}`,ue=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,ce=le.busiest?.text??(k?'':_?(0,m.seatedNowText)(ie):Z?(0,m.busiestText)(Z.t,Z.covers):''),xe=W.map(e=>e.spoken).join('. '),ge=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(w)}.${ce?` ${ce}.`:''}${xe?` ${xe}.`:''}`,me=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(n.default,{testID:"day-graph",style:[h.look.panel,L?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:z?4:I?2:10,paddingBottom:z?2:6,backgroundColor:c.colours.bg}],children:[z?null:C?(0,y.jsxs)(n.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(d.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(d.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:he})]}):(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(d.T,{size:I?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(d.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:he})]}),z||S?null:k?$?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:$}):null:(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),$?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:$}):(0,y.jsx)(n.default,{style:{flex:1}}),(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(w)]})]}),(0,y.jsx)(n.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ge,onLayout:e=>{O(e.nativeEvent.layout.width),L&&B(e.nativeEvent.layout.height)},style:L?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,T-m.AXIS_BAND),minHeight:24,overflow:'hidden'}:{height:q,minHeight:q},children:H?(0,y.jsxs)(l.default,{width:H,height:q,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${me}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${me}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),W.map((e,t)=>(0,y.jsx)(o.Rect,{x:ee(V(e.fromMin)),y:J,width:Math.max(3,ee(V(e.toMin))-ee(V(e.fromMin))),height:Q,fill:`url(#${me}-${e.strength})`},`${e.fromMin}-${t}`)),ae?(0,y.jsx)(o.Path,{d:ae,fill:"#3A2F1E",stroke:"none"}):null,re?(0,y.jsx)(o.Path,{d:re,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,k?null:[j,w].map((e,t)=>(0,y.jsx)(o.Line,{x1:ee(e.getTime()),x2:ee(e.getTime()),y1:J,y2:J+Q,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:le.busiest.x+le.busiest.w/2,y:le.busiest.y+le.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:le.busiest.text}):null,ue?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+K/2,y:J+Q/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null}),(0,y.jsxs)(n.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(d.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),le.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,H)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,H-t),s));return(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':it.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},966,[]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_BACK",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"DAY_AHEAD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"DAY_IDLE_MS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"dayOffset",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"shiftDay",{enumerable:!0,get:function(){return y}}),_e.dayWord=f,Object.defineProperty(_e,"dayLong",{enumerable:!0,get:function(){return p}}),_e.bookingsForDay=function(e,t,o){return e.filter(e=>e.date===t&&(0,n.ACTIVE)(e))},_e.dayCovers=function(e,t,o){return(0,n.coversFour)(e,t)},_e.DaySwitch=function({day:e,today:n,onDay:b,back:x=c,ahead:j=u,idPrefix:$="display-day",stacked:D=!1,header:w=!1,onPickDate:C}){const P=h(e,n),k=t=>{const o=y(e,t);b(o===n?null:o)},L=y(e,-1),I=y(e,1),v=0!==P,T=(e,o,n,s,c)=>(0,d.jsx)(t.default,{testID:c,accessibilityRole:"button",accessibilityLabel:o,accessibilityState:{disabled:s},disabled:s,onPress:n,style:({pressed:e})=>({minHeight:44,minWidth:w?44:D?140:92,flex:D?1:void 0,paddingHorizontal:w?8:D?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,opacity:s?.35:1,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:(0,d.jsx)(i.T,{center:D,size:D?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:D?void 0:1,children:e})}),O=f(e,n),W=C?(0,d.jsx)(t.default,{testID:`${$}-cal`,accessibilityRole:"button",accessibilityLabel:"Pick a date from the calendar",onPress:C,style:({pressed:e})=>({minHeight:44,minWidth:w?44:D?140:92,flex:D?1:void 0,paddingHorizontal:w?8:D?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:w?(0,d.jsxs)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{width:18,height:16,borderWidth:1.5,borderColor:l.colours.goldLight,borderRadius:3,overflow:'hidden'},children:[(0,d.jsx)(o.default,{style:{height:4,backgroundColor:l.colours.goldLight}}),(0,d.jsx)(o.default,{style:{flex:1,flexDirection:'row',flexWrap:'wrap',padding:1.5,gap:1.5,justifyContent:'center',alignContent:'center'},children:[0,1,2,3].map(e=>(0,d.jsx)(o.default,{style:{width:3,height:3,backgroundColor:l.colours.goldLight}},e))})]}):(0,d.jsx)(i.T,{center:D,size:D?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:1,children:"Calendar"})}):null;return D?(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1,borderColor:v?l.colours.gold:l.colours.hairline,backgroundColor:v?l.colours.goldTint:l.colours.surface},children:[(0,d.jsxs)(o.default,{testID:`${$}-label`,accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${O}, ${p(e)}`,style:{gap:2,alignItems:'center'},children:[(0,d.jsx)(i.T,{center:!0,size:20,weight:"semibold",colour:l.colours.goldLight,children:O}),(0,d.jsx)(i.T,{center:!0,size:16,children:p(e)})]}),(0,d.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),T('Today','Back to today',()=>b(null),!1,'back-to-today'),W,T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]})]}):w?(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,flexShrink:1,minWidth:0},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),(0,d.jsx)(t.default,{testID:`${$}-label`,accessibilityRole:v||C?'button':'text',disabled:!v&&!C,onPress:()=>v?b(null):C?.(),accessibilityLabel:v?`Showing ${O===(0,s.niceDate)((0,s.parseYmd)(e))?'':`${O}, `}${p(e)}. Back to today`:C?`Showing today, ${p(e)}. Open the calendar to pick a date`:`Showing today, ${p(e)}`,style:({pressed:e})=>({minWidth:72,maxWidth:220,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:8,borderWidth:v?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:v?l.colours.goldTint:'transparent'}),children:(0,d.jsx)(i.T,{size:14,weight:"semibold",colour:v?l.colours.gold:l.colours.text,numberOfLines:1,children:v&&O!==(0,s.niceDate)((0,s.parseYmd)(e))?`${O} \xb7 ${(0,s.niceDate)((0,s.parseYmd)(e))}`:O})}),W,T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]}):(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:8},children:[(0,d.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),(0,d.jsxs)(t.default,{testID:`${$}-label`,accessibilityRole:v||C?'button':'text',disabled:!v&&!C,onPress:()=>v?b(null):C?.(),accessibilityLabel:v?`Showing ${O===(0,s.niceDate)((0,s.parseYmd)(e))?'':`${O}, `}${p(e)}. Back to today`:C?`Showing today, ${p(e)}. Open the calendar to pick a date`:`Showing today, ${p(e)}`,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:6,borderWidth:v?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:v?l.colours.goldTint:'transparent'}),children:[(0,d.jsx)(i.T,{size:15,weight:"semibold",colour:v?l.colours.gold:l.colours.text,numberOfLines:1,children:v&&O!==(0,s.niceDate)((0,s.parseYmd)(e))?`${O} \xb7 ${(0,s.niceDate)((0,s.parseYmd)(e))}`:O}),v?(0,d.jsx)(i.T,{size:11,colour:l.colours.muted,numberOfLines:1,children:"Tap for today"}):null]}),T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]}),W?(0,d.jsx)(o.default,{style:{alignItems:'center'},children:W}):null]})},r(_d[0]);var t=e(r(_d[1])),o=e(r(_d[2])),i=r(_d[3]),n=r(_d[4]),s=r(_d[5]),l=r(_d[6]),d=r(_d[7]);const c=365,u=365,b=12e4,h=(e,t)=>Math.round(((0,s.parseYmd)(e).getTime()-(0,s.parseYmd)(t).getTime())/864e5),y=(e,t)=>(0,s.ymd)((0,s.addMins)((0,s.parseYmd)(e),1440*t+120));function f(e,t){const o=h(e,t);return 0===o?'Today':-1===o?'Yesterday':1===o?'Tomorrow':(0,s.niceDate)((0,s.parseYmd)(e))}const p=e=>(0,s.parseYmd)(e).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},967,[31,264,128,818,832,822,825,25]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CalendarGlyph=function({colour:e=o.colours.goldLight,size:t=18}){const s=Math.max(2,Math.round(.16*t));return(0,u.jsxs)(l.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{width:t,height:t-2,borderWidth:1.5,borderColor:e,borderRadius:3,overflow:'hidden',backgroundColor:'transparent'},children:[(0,u.jsx)(l.default,{style:{height:Math.max(3,Math.round(.22*t)),backgroundColor:e}}),(0,u.jsx)(l.default,{style:{flex:1,flexDirection:'row',flexWrap:'wrap',padding:2,gap:2,justifyContent:'center',alignContent:'center'},children:Array.from({length:4},(t,i)=>(0,u.jsx)(l.default,{style:{width:s,height:s,borderRadius:.5,backgroundColor:e,opacity:.9}},i))})]})},_e.DisplayCalendar=function({visible:e,today:b,day:f,bookings:x,restaurant:p,now:j,onDay:D,onClose:w,back:C=d.DAY_BACK,ahead:I=d.DAY_AHEAD,idPrefix:T="display-cal",showBusy:_=!0,sheetTestID:S}){const[$,v]=(0,t.useState)(f.slice(0,7)),[B,k]=(0,t.useState)(0);(0,t.useEffect)(()=>{e&&v(f.slice(0,7))},[e,f]);const R=(0,n.venueBusy)(p,x,j??new Date).busy,E=(0,c.monthCells)($),P=(0,c.shiftMonth)($,-1),L=(0,c.shiftMonth)($,1),O=(0,c.monthInRange)(P,b,C,I),Y=(0,c.monthInRange)(L,b,C,I),M=B/7,N=e=>M>=46?e.slice(0,3):e.slice(0,2),A=e=>{D(e===b?null:e),w()},U=(0,c.quickJumps)(b);return(0,u.jsx)(i.Sheet,{visible:e,onClose:w,title:"Pick a date",centerTitle:!0,maxWidth:560,testID:S??T,footer:(0,u.jsxs)(l.default,{style:{gap:10,alignItems:'center'},children:[(0,u.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:U.map(e=>{const t=(0,c.inDisplayRange)(e.date,b,C,I);return(0,u.jsx)(i.Chip,{label:e.label,selected:f===e.date,disabled:!t,testID:`${T}-jump-${e.id}`,accessibilityLabel:`${e.label}, ${(0,c.longDay)(e.date)}${t?'':', not available'}`,onPress:()=>{t&&(v(e.date.slice(0,7)),A(e.date))}},e.id)})}),(0,u.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:(0,u.jsx)(i.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close calendar",testID:`${T}-close`,onPress:w})})]}),children:(0,u.jsxs)(l.default,{style:{gap:10,alignItems:'stretch'},children:[(0,u.jsx)(i.T,{size:22,weight:"bold",colour:o.colours.goldLight,center:!0,accessibilityRole:"header",testID:`${T}-month`,children:(0,c.monthName)($)}),(0,u.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Previous month",accessibilityLabel:O?`Previous month, ${(0,c.monthName)(P)}`:`Previous month, ${(0,c.monthName)(P)}, not available`,disabled:!O,testID:`${T}-prev`,onPress:()=>v(P)}),(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Next month",accessibilityLabel:Y?`Next month, ${(0,c.monthName)(L)}`:`Next month, ${(0,c.monthName)(L)}, not available`,disabled:!Y,testID:`${T}-next`,onPress:()=>v(L)})]}),(0,u.jsxs)(l.default,{onLayout:e=>k(e.nativeEvent.layout.width),style:{width:'100%'},children:[(0,u.jsx)(l.default,{style:{flexDirection:'row'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:h.map(e=>(0,u.jsx)(l.default,{style:{width:'14.2857%',alignItems:'center'},children:(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,center:!0,children:N(e)})},e))}),(0,u.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},testID:`${T}-grid`,children:E.map((e,t)=>{if(!e)return(0,u.jsx)(l.default,{style:{width:'14.2857%',height:56}},`blank-${t}`);const n=(0,c.inDisplayRange)(e,b,C,I),d=e===f,h=(0,c.dayIsClosed)(p,e),j=_?(0,c.dayCoversTotal)(x,e):0,D=_?(0,c.dayBusyTier)(j,R,(0,c.serviceHoursOf)(p,e)):'none';return(0,u.jsxs)(s.default,{testID:`${T}-${e}`,accessibilityRole:"button",accessibilityLabel:(0,c.calendarDayLabel)(e,b,f,j,D,h,_),accessibilityState:{selected:d,disabled:!n},disabled:!n,onPress:()=>A(e),style:{width:'14.2857%',height:56,minHeight:56,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:d||e===b?1.5:0,borderColor:o.colours.gold,backgroundColor:d?o.colours.goldTint:'transparent',opacity:n?h?.45:1:.3},children:[(0,u.jsx)(i.T,{size:17,weight:d||e===b?'bold':'regular',colour:d?o.colours.goldLight:h?o.colours.muted:o.colours.text,center:!0,children:Number(e.slice(8))}),_?(0,u.jsx)(y,{tier:D}):null]},e)})})]}),(0,u.jsx)(l.default,{testID:`${T}-key`,children:(0,u.jsxs)(i.Row,{wrap:!0,gap:12,style:{justifyContent:'center',paddingTop:2},children:[_?[['silver','Quiet'],['bronze','Steady'],['gold','Busy']].map(([e,t])=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,u.jsx)(l.default,{style:{width:c.BUSY_DOT_SIZE[e],height:c.BUSY_DOT_SIZE[e],borderRadius:c.BUSY_DOT_SIZE[e]/2,backgroundColor:c.BUSY_DOT[e]}}),(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,children:t})]},e)):null,(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,children:"Closed days are faded"})]})})]})})};var t=r(_d[0]),s=e(r(_d[1])),l=e(r(_d[2])),i=r(_d[3]),n=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]);const h=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];function y({tier:e}){const t=c.BUSY_DOT_SIZE[e];return'none'===e?(0,u.jsx)(l.default,{style:{width:c.BUSY_DOT_SIZE.gold,height:c.BUSY_DOT_SIZE.gold,marginTop:2}}):(0,u.jsx)(l.default,{testID:`busy-dot-${e}`,style:{width:t,height:t,borderRadius:t/2,marginTop:2,backgroundColor:c.BUSY_DOT[e]}})}},968,[31,264,128,818,933,825,967,1387,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))}},969,[]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},970,[812,988]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},971,[31,264,128,818,970,825,949,25]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){if(t&&t.length&&o)return t.find(t=>t.staffId===n&&'approved'===t.status&&t.from<=o&&o<=t.to)}Object.defineProperty(e,'__esModule',{value:!0}),e.leaveCovering=t,Object.defineProperty(e,"coveredByLeave",{enumerable:!0,get:function(){return n}}),e.workingShifts=function(t,o){return o&&o.length?t.filter(t=>!n(o,t)):t},e.leaveLabel=function(t){return/sick|ill/i.test(t?.reason??'')?'Off sick':'On holiday'},e.leaveNote=function(t){return['Approved time off',t.reason&&'Holiday'!==t.reason?t.reason:'',t.decidedBy?`approved by ${t.decidedBy.replace(' (example)','')}`:''].filter(Boolean).join(' \xb7 ')};const n=(n,o)=>!!t(n,o.staffId,o.date)},972,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},973,[5,1315,1154,876,123,1318]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d}){const m=(0,h.useShellfish)(e,t,s),b=$(e),[f,p]=(0,o.useState)(!1),k=T(e,m.items.find(e=>e.supplierId)?.supplierId),x=(0,r.useLiveState)();if('ready'!==x)return(0,j.jsx)(r.LiveWait,{state:x,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!m.items.length)return null;const v=m.items.filter(e=>m.isLow(e.key)),w=m.items.length<=3?m.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:v.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,m.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",w]}),(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:m.items.map(t=>{const s=m.counts[t.key]??0,o=m.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),b[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,b[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-b[t.key]))]}):null]},t.key)})})]}),!n&&v.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",v.map(t=>`${(0,u.fmtStockCount)(e,t,m.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:k?`Order from ${k} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||v.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:k?`${k} order sheet \u203a`:'Order sheets \u203a'})}),f?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>p(!1),onOrder:l?()=>{p(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},974,[1086,807,31,1362,973,197,264,128,1439,818,1089,1087,1088,825,823,832,822,1402,824,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyChain=j,_e.BookingAllergyChain=function({b:l,me:t,readOnly:k}){const p=(0,i.useOrders)(l.restaurantId),S=(0,o.useStore)(e=>e.ackBookingAllergy);if(!l.allergies.length)return null;const A=p.find(e=>e.allergies.length&&!['cancelled','closed'].includes(e.status)&&(e.bookingId===l.id||!e.bookingId&&(0,c.linkedBooking)(e,[l])?.id===l.id));if(A)return(0,h.jsx)(j,{o:A,me:t,readOnly:k,compact:!0});const I={booked:l.allergyAck,ordered:void 0,kitchen:void 0,pass:void 0,table:void 0};return(0,h.jsxs)(s.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:l.allergyAck?u.colours.border:u.colours.red,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(n.T,{size:13,weight:"semibold",colour:"#FFD9D4",children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(n.Badge,{kind:l.allergyAck?'amber':'red',label:(l.allergyAck?1:0)+" of 5"})]}),(0,h.jsx)(y,{chain:I,next:l.allergyAck?null:'booked',testID:`allergy-steps-${l.ref}`}),l.allergyAck?(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:l.allergyAck.by,size:20,ring:!1}),(0,h.jsxs)(n.Muted,{style:{flex:1},children:["1. Booked: ",b(l.allergyAck.by)," at ",x(l.allergyAck.at),". Steps 2 to 5 are signed on the table's order."]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(n.T,{size:13,children:"Next: 1. Booked. Allergy recorded (who took it)."}),k?null:(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(n.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off Booked on ${l.ref}`,disabled:!t.trim(),onPress:()=>S(l.id,t)}),(0,h.jsxs)(n.Muted,{children:["as ",b(t)]})]})]})]})};var e=r(d[0]);r(d[1]);var l,t=r(d[2]),s=(l=t)&&l.__esModule?l:{default:l},n=r(d[3]),i=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]),h=r(d[9]);const x=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),b=e=>e.replace(' (example)','');function y({chain:e,next:l,testID:t}){return(0,h.jsx)(s.default,{testID:t,accessibilityLabel:`Allergen sign-off ${c.CHAIN_STEPS.filter(l=>e[l.id]).length} of 5`,style:{flexDirection:'row',alignItems:'flex-start'},children:c.CHAIN_STEPS.map((t,i)=>{const o=!!e[t.id],f=l===t.id,y=o?u.colours.ok:f?u.colours.gold:u.colours.border,j=0===i?'flex-start':i===c.CHAIN_STEPS.length-1?'flex-end':'center',k=(0,h.jsxs)(s.default,{style:{width:'200%',alignSelf:j,alignItems:j},children:[(0,h.jsx)(n.T,{size:11,weight:f?'semibold':'regular',colour:o?u.colours.text:f?u.colours.gold:u.colours.muted,style:{textAlign:0===i?'left':i===c.CHAIN_STEPS.length-1?'right':'center'},children:t.label}),e[t.id]?(0,h.jsxs)(n.T,{size:10,colour:u.colours.muted,numberOfLines:1,style:{textAlign:0===i?'left':i===c.CHAIN_STEPS.length-1?'right':'center'},children:[b(e[t.id].by).split(' ')[0]," ",x(e[t.id].at)]}):null]}),p=i%2==1;return(0,h.jsxs)(s.default,{style:{flex:1,alignItems:'center'},children:[(0,h.jsx)(s.default,{style:{minHeight:30,justifyContent:'flex-end',alignSelf:'stretch',alignItems:j},children:p?k:null}),(0,h.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',width:'100%',marginVertical:2},children:[(0,h.jsx)(s.default,{style:{flex:1,height:2,backgroundColor:i?o||f?y:u.colours.border:'transparent'}}),(0,h.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,borderWidth:2,borderColor:y,backgroundColor:o?u.colours.ok:'transparent',alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(n.T,{size:12,weight:"bold",colour:o?'#0B0B0B':f?u.colours.gold:u.colours.muted,children:o?'\u2713':String(t.n)})}),(0,h.jsx)(s.default,{style:{flex:1,height:2,backgroundColor:i<4?o?u.colours.ok:u.colours.border:'transparent'}})]}),(0,h.jsx)(s.default,{style:{minHeight:30,alignSelf:'stretch',alignItems:j},children:p?null:k})]},t.id)})})}function j({o:l,me:t,readOnly:j,compact:k}){const p=(0,i.useBookings)(l.restaurantId),S=(0,o.useStore)(e=>e.signAllergyStep);if(!l.allergies.length)return null;const A=(0,c.linkedBooking)(l,p),I=(0,c.orderChain)(l,A),C=(0,c.nextStep)(l,A),w=c.CHAIN_STEPS.filter(e=>I[e.id]).length,T=C?(0,c.stepInfo)(C):null,B='table'===C&&!['ready','served','collected'].includes(l.status);return(0,h.jsxs)(s.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:C?u.colours.red:u.colours.ok,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(n.T,{size:13,weight:"semibold",colour:C?'#FFD9D4':'#E2C489',children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(n.Badge,{kind:C?'red':'ok',label:C?`${w} of 5`:'Complete'})]}),(0,h.jsx)(y,{chain:I,next:C,testID:`allergy-steps-${l.ref}`}),k?null:c.CHAIN_STEPS.filter(e=>I[e.id]).map(e=>(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:I[e.id].by,size:20,ring:!1}),(0,h.jsxs)(n.Muted,{style:{flex:1},children:[e.n,". ",e.label,": ",b(I[e.id].by)," at ",x(I[e.id].at)]})]},e.id)),T?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(n.T,{size:13,children:["Next: ",T.n,". ",T.label,". ",T.what,"."]}),j?null:(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(n.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off ${T.label} on ${l.ref}`,disabled:!t.trim()||B,onPress:()=>S(l.id,C,t)}),(0,h.jsxs)(n.Muted,{children:["as ",b(t)]})]}),B?(0,h.jsx)(n.Muted,{children:"Signed off at the pass. The table step is signed when the dish is served."}):(0,h.jsx)(n.Muted,{children:"The ticket can't move on until this step is signed off."})]}):(0,h.jsx)(n.Muted,{children:"All five steps signed off. The full chain is in the allergen audit log."})]})}},975,[876,31,128,818,1082,881,976,825,996,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CHAIN_STEPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"stepInfo",{enumerable:!0,get:function(){return t}}),e.linkedBooking=l,e.orderChain=o,e.nextStep=s,Object.defineProperty(e,"doneCount",{enumerable:!0,get:function(){return c}}),e.canSign=function(n,t,l){return s(n,l)===t},e.statusBlock=function(n,l,s){if(!n.allergies.length||'cancelled'===l)return null;const c=o(n,s),u=n=>c[n]?null:`${t(n).n}. ${t(n).label} needs signing off first`;return'acknowledged'===l||'preparing'===l||'ready'===l?u('booked')??u('ordered')??u('kitchen'):'served'===l?u('booked')??u('ordered')??u('kitchen')??u('pass'):'collected'===l||'closed'===l?u('booked')??u('ordered')??u('kitchen')??u('pass')??u('table'):null},e.chainNeedsAction=function(n,t){const o=s(n,l(n,t));return!(!o||'table'===o&&!['ready','served'].includes(n.status))},e.bookingNeedsAction=function(n,t){return n.allergies.length>0&&!n.allergyAck&&!t.some(t=>t.allergies.length&&l(t,[n])?.id===n.id)};const n=[{id:'booked',n:1,label:'Booked',what:'Allergy recorded (who took it)'},{id:'ordered',n:2,label:'Ordered',what:'Server confirms with the guest'},{id:'kitchen',n:3,label:'Kitchen',what:'Chef signs off before cooking'},{id:'pass',n:4,label:'Pass',what:'Checked before it leaves the pass'},{id:'table',n:5,label:'Table',what:'Server signs off when served'}],t=t=>n.find(n=>n.id===t);function l(n,t){return n.bookingId?t.find(t=>t.id===n.bookingId):'table'===n.type&&n.tableNo?t.find(t=>t.restaurantId===n.restaurantId&&'seated'===t.status&&!!t.table&&t.table.split('+').includes(String(n.tableNo))):void 0}function o(n,t){return{booked:n.allergyChain?.booked??(t?.allergies.length?t.allergyAck:void 0),ordered:n.allergyChain?.ordered,kitchen:n.allergyAck,pass:n.allergyChain?.pass,table:n.handoverCheck}}function s(t,l){if(!t.allergies.length)return null;const s=o(t,l);return n.find(n=>!s[n.id])?.id??null}const c=(t,l)=>{const s=o(t,l);return n.filter(n=>s[n.id]).length}},976,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_ACTOR",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CAR_DEVICE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"CAR_DEFAULT_LABEL",{enumerable:!0,get:function(){return u}}),e.carDeviceIdentity=c,e.actorStamp=function(t){if(t.isCar)return r;if((0,n.isKitchenViaDisplay)())return(0,n.kitchenActor)();if('device'===t.kind)return'Display';return t.staffRef&&String(t.staffRef).trim()||t.fallback||'Staff'},e.migrateCarStaffIdentity=function(n){return n?.venueId?c({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,label:n.label}):null},e.carPairApproved=function(n){return'approved'===String(n?.status??'')&&!(!n?.venue_id&&!n?.venueId)};var n=_r(d[0]);const r='Car',t='car-device',u='Tesla';function c(n){return{kind:'device',venueId:String(n.venue_id??n.venueId??''),venueSlug:String(n.venue_slug??n.venueSlug??'anchorage'),venueName:String(n.venue_name??n.venueName??'The Anchorage'),canWrite:!0,role:'owner',displayName:r,label:n.label&&String(n.label).trim()||u}}},977,[979]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ROLE_BADGES",{enumerable:!0,get:function(){return n}}),e.cleanBadge=t,Object.defineProperty(e,"badgeSpoken",{enumerable:!0,get:function(){return o}}),e.assignShiftBadge=function(n,o,c){const s=t(c);return n.map(n=>n.id===o?{...n,badge:s,changed:!!n.published||n.changed}:n)};const n=['Bar','Floor','Upstairs KP','Downstairs KP','Sauce','Larder'];function t(t){const o=String(t??'').trim().toLowerCase();return n.find(n=>n.toLowerCase()===o)}const o=n=>t(n)?`, on ${t(n)}`:''},978,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KITCHEN_TICKET_RE",{enumerable:!0,get:function(){return t}}),e.kitchenTicketFromHash=function(n){const c=(n||'').match(/[#&]cckitchen=([A-Za-z0-9_-]{24,64})(?:&|$)/);return c&&t.test(c[1])?c[1]:null},e.chefKitchenUrl=function(t,n){const c=t.includes('?')?t.replace('?','?from=display&'):t.replace(/(#|$)/,'?from=display$1'),[s,o]=c.split('#'),u=(o||'').split('&').filter(t=>t&&!t.startsWith('cckitchen=')).join('&');return`${s}#cckitchen=${n}${u?`&${u}`:''}`},e.markKitchenViaDisplay=function(t,s){try{if('undefined'==typeof sessionStorage)return;t?(sessionStorage.setItem(n,'1'),s&&sessionStorage.setItem('cc-kitchen-actor',String(s).slice(0,60))):(sessionStorage.removeItem(n),sessionStorage.removeItem('cc-kitchen-actor'),sessionStorage.removeItem(c))}catch{}},e.isKitchenViaDisplay=function(){try{return'undefined'!=typeof sessionStorage&&'1'===sessionStorage.getItem(n)}catch{return!1}},e.kitchenActor=function(){try{return`${('undefined'!=typeof sessionStorage?sessionStorage.getItem('cc-kitchen-actor'):null)||'Head Chef'} via Display`.slice(0,80)}catch{return'Head Chef via Display'}},e.kitchenSessionStoreName=function(){return c};const t=/^[A-Za-z0-9_-]{24,64}$/,n='cc-kitchen-via-display',c='covercharge-kitchen-session-v1'},979,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSliders",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"notify",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"dismissNotice",{enumerable:!0,get:function(){return c}});var t=r(d[0]);let u=0;const s=t=>'urgent'===t.tone?0:'warn'===t.tone?1:2,n=(0,t.create)()((t,n)=>({queue:[],push:n=>t(t=>{const o=t.queue.find(t=>t.id===n.id),c=o?t.queue.map(t=>t.id===n.id?{...n,seq:o.seq}:t):[...t.queue,{...n,seq:++u}];return{queue:(f=c,[...f].sort((t,u)=>s(t)-s(u)||(t.seq??0)-(u.seq??0))).slice(0,40)};var f}),dismiss:u=>{const s=n().queue.find(t=>t.id===u);if(s){t(t=>({queue:t.queue.filter(t=>t.id!==u)}));try{s.onClose?.()}catch{}}},dismissWhere:t=>{for(const u of n().queue.filter(t))n().dismiss(u.id)}})),o=t=>n.getState().push(t),c=t=>n.getState().dismiss(t)},980,[995]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"pinProblem",{enumerable:!0,get:function(){return r.pinProblem}}),Object.defineProperty(_e,"ERROR_TEXT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"errorText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useDisplayTiles",{enumerable:!0,get:function(){return u}}),_e.refreshTiles=async function(){const e=await l('display_staff_list',{});Array.isArray(e)&&u.setState({tiles:e,at:Date.now()});const t=await l('display_pin_lengths',{});t&&'object'==typeof t&&!('ok'in t)&&u.setState({lens:t})},_e.refreshManagers=async function(){const e=await l('display_managers',{});Array.isArray(e)&&u.setState({managers:e})},Object.defineProperty(_e,"displayClock",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"displayChangePin",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"displayAddTemp",{enumerable:!0,get:function(){return y}}),_e.setStaffPin=async function(e,n,a=4){const o=_();if(!o)return{ok:!1,error:'Sign in to the venue to set PINs (they are kept on the server only).'};const s=(0,r.pinProblem)(n,a);if(s)return{ok:!1,error:s};try{const{error:r}=await(0,t.getSupabase)().rpc('set_staff_pin',{p_venue:o,p_staff_ref:e,p_pin:n});return r?{ok:!1,error:r.message.replace(/^.*?:\s*(?=The PIN|Pick a PIN)/,'')}:{ok:!0}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},_e.addTempStaff=async function(e){const n=_();if(!n)return{ok:!1,error:'Sign in to the venue to add temp staff (the code is made and kept on the server).'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc('add_temp_staff',{p_venue:n,p_name:e.name,p_dept:e.dept??null,p_rate:e.rate??null,p_until:e.until||null});return a?{ok:!1,error:a.message}:{ok:!0,...r}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},Object.defineProperty(_e,"usePinStatus",{enumerable:!0,get:function(){return k}}),_e.refreshPinStatus=async function(){const e=_();if(!e)return;try{const{data:n}=await(0,t.getSupabase)().rpc('staff_pin_status',{p_venue:e});Array.isArray(n)&&k.setState(Object.fromEntries(n.map(e=>[e.staff_ref,{hasPin:e.has_pin,locked:e.locked}])),!0)}catch{}},_e.localTiles=function(e,t){return e.filter(e=>e.active&&e.displayClock&&!(e.temp&&e.tempUntil&&e.tempUntil({ref:e.id,name:e.name,nickname:e.nickname,dept:e.dept,temp:!!e.temp})).sort((e,t)=>Number(!!e.temp)-Number(!!t.temp)||e.name.localeCompare(t.name))},Object.defineProperty(_e,"displayBlockChange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"displayBlockEdit",{enumerable:!0,get:function(){return h}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]),a=_r(d[4]),o=_r(d[5]);const s={wrong:'That PIN is not right. Try again.',locked:'Too many wrong tries. Locked for 15 minutes, or ask a manager to reset your PIN.',nopin:'No PIN set yet. Ask a manager to set one in Staff & roles.',notallowed:'This person can\u2019t clock in at the Display. A manager can turn it on in Staff & roles.',already:'Already clocked in.',notin:'Not clocked in yet.',onbreak:'Already on a break.',notmanager:'Only an owner or manager can add temp staff.',format:'The new PIN must be 4 to 8 digits (6 or more for managers and owners).',weak:'Pick a PIN that is harder to guess (not all the same digit or a run like 1234).',devicelocked:'Too many wrong PINs on this Display. Wait 15 minutes, then try again.',unpaired:'Pair this Display first (Settings \u203a Devices on the Managers app), then try again.',offline:'No connection. Try again in a moment.'},c=(e,t)=>'format'===e&&t?.min?`The new PIN must be ${t.min} to 8 digits.`:s[e??'']??(e||'Something went wrong. Try again.'),p=()=>'device'===n.useSync.getState().kind&&!!n.useSync.getState().venueId;async function l(e,n){if(a.PITCH)return(0,o.pitchClock)(e,n);if(!p())return{ok:!1,error:'unpaired'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc(e,n);return a?{ok:!1,error:/paired Display/.test(a.message)?'unpaired':a.message}:r}catch{return{ok:!1,error:'offline'}}}const u=(0,e.create)(()=>({tiles:null,managers:[],lens:{}}));const f=(e,t,n,r={})=>l('display_clock',{p_staff_ref:e,p_pin:t,p_action:n,p_break_mins:r.breakMins??null,p_off_rota:!!r.offRota}),m=(e,t,n)=>l('display_change_pin',{p_staff_ref:e,p_old:t,p_new:n}),y=(e,t,n)=>l('display_add_temp',{p_manager_ref:e,p_manager_pin:t,p_name:n.name,p_dept:n.dept??null,p_rate:n.rate??null,p_until:n.until||null}),_=()=>'staff'===n.useSync.getState().kind?n.useSync.getState().venueId:void 0;const k=(0,e.create)(()=>({}));const b=(e,t,n,r,a)=>l('display_block_change',{p_manager_ref:e,p_manager_pin:t,p_block_id:n,p_action:r,p_doc:a}),h=(e,t,n,r)=>l('display_block_edit',{p_block_id:e,p_action:t,p_doc:n,p_by:r})},981,[995,872,824,1508,2,1509]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOutLinks",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isAutoLink",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"autoSync",{enumerable:!0,get:function(){return v}}),_e.itemsFor=b,_e.dishUsesFor=p,_e.countsFor=O,_e.reasonFor=function(e,t,n){const s=n??p(e).find(e=>e.id===t)?.uses??[],r=O(e),i=c.useStore.getState().menu.find(e=>e.id===t)?.name??'';return(0,u.dishReason)(i,(0,u.shortOf)(s,r),r,b(e))},_e.runAutoSoldOut=y,_e.startAutoSoldOut=function(){if(w)return w;let e=null;const t=()=>{e||(e=setTimeout(()=>{e=null,y()},400))},n=[d.useShellStore.subscribe((e,n)=>{e.events===n.events&&e.server===n.server&&e.items===n.items||t()}),h.subscribe(t),S.useCardStore.subscribe((e,n)=>{e.cards!==n.cards&&t()}),c.useStore.subscribe((e,n)=>{e.menu===n.menu&&e.restaurants===n.restaurants||t()}),f.useSoldOut.subscribe((e,n)=>{e.entries!==n.entries&&t()})],s=setInterval(t,6e4);return t(),w=()=>{n.forEach(e=>e()),clearInterval(s),e&&clearTimeout(e),w=null},w},_e.useAutoSoldOutView=function(e){const t=(0,c.useStore)(e=>e.menu),n=h(e=>e.links),s=(0,S.useCardStore)(e=>e.cards),r=(0,d.useShellStore)(t=>t.items[e]);(0,d.useShellStore)(e=>e.events),(0,d.useShellStore)(t=>t.server[e]);const i=(r??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active})),o=p(e,t,n,s,i),l=O(e);return{dishes:o,counts:l,items:i,reason:e=>{const t=o.find(t=>t.id===e);return t?(0,u.dishReason)(t.name,(0,u.shortOf)(t.uses,l),l,i):''},links:n}};var e,t=_r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[1]),r=_r(_d[2]),u=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),S=_r(_d[9]),f=_r(_d[10]);const m=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},h=(0,s.create)()((0,r.persist)(e=>({links:[],setLink:(t,n,s,r)=>e(e=>{const u=e.links.filter(e=>!(e.rid===t&&e.itemId===n));return{links:[...u,{rid:t,itemId:n,uses:s?s.filter(e=>e.qty>0).slice(0,10):[],at:m().toISOString(),by:r.slice(0,80),...s?{}:{auto:!0}}]}})}),{name:'covercharge-soldout-links-v1',version:1,storage:(0,r.createJSONStorage)(()=>n.default)})),k=e=>!!e&&!0===e.auto,v={soldOutRead:new Set,linksRead:new Set};function b(e){return(d.useShellStore.getState().items[e]??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active}))}function p(e,t=c.useStore.getState().menu,n=h.getState().links,s=S.useCardStore.getState().cards,r=b(e)){const i=[];for(const o of t){if(o.restaurantId!==e||o.hidden)continue;const t=s.find(t=>t.restaurantId===e&&t.menuItemId===o.id),l=n.find(t=>t.rid===e&&t.itemId===o.id),c=(0,u.inferUses)(o,t,r),d=k(l)?c:(0,u.usesFor)(o,l,t,r);i.push({id:o.id,name:o.name,uses:d.uses,source:d.source,guess:c.uses})}return i}function O(e){return(0,d.venueCounts)(d.useShellStore.getState(),e)}function I(e){const t={};for(const n of d.useShellStore.getState().events)n.rid===e&&(!t[n.kind]||n.at>t[n.kind])&&(t[n.kind]=n.at);return t}function y(e=m()){const t=c.useStore.getState();let n=0;for(const s of t.restaurants){const t=s.id;if((0,o.liveData)()&&(!d.useShellStore.getState().server[t]||!v.soldOutRead.has(t)||!v.linksRead.has(t)))continue;const r=(0,i.soldOutSettingsOf)(s.settings?.soldOut).auto,l=p(t),c=(0,u.planAuto)({rid:t,enabled:r,dishes:l,counts:O(t),entries:f.useSoldOut.getState().entries,lastChange:I(t),now:e});if(!c.mark.length&&!c.clear.length)continue;const S=e.toISOString();f.useSoldOut.setState(e=>{const n=new Set(c.clear),s=new Map(c.mark.map(e=>[e.itemId,e.name])),r=e.entries.filter(e=>!(e.rid===t&&s.has(e.itemId))).map(e=>e.rid===t&&n.has(e.itemId)?{...e,on:!1,at:S,by:'Count back up',kept:!1,clearAfter:void 0}:e);return{entries:[...r,...c.mark.map(e=>({rid:t,itemId:e.itemId,name:e.name.slice(0,120),on:!0,at:S,by:'Live count',auto:!0,kept:!1}))]}}),n+=c.mark.length+c.clear.length}return n}let w=null;l.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchCounts=e=>{const t=c.useStore.getState().restaurants[0]?.id;if(!t)return;const n=O(t),s=m().toISOString(),r=Object.entries(e).filter(([e,t])=>(n[e]??0)!==t).map(([e,r],u)=>({id:`pitch-count-${Date.now()}-${u}`,rid:t,kind:e,delta:r-(n[e]??0),reason:'count',by:'Chef',app:'chef',at:s}));return r.length&&d.useShellStore.setState(e=>({events:[...e.events,...r]})),y()})},982,[1160,995,1169,983,984,1183,2,881,1087,1151,942]); +__d(function(_g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.parseQty=i,_e.inferUses=u,_e.usesFor=function(e,t,n,o){const s=new Set(o.filter(e=>!1!==e.active).map(e=>e.key));return t?{uses:t.uses.filter(e=>s.has(e.key)&&e.qty>0),source:t.uses.length?'link':'none'}:u(e,n,o)},_e.shortOf=c,_e.shortReason=f,_e.dishReason=function(e,t,n,o){if(!t.length)return'';const i=e.replace(/\([^)]*\)/g,'').trim(),a=e=>{const t=o.find(t=>t.key===e);return!!t&&new RegExp(`\\b(${s(t)})$`,'i').test(i)},l=t.filter(e=>!a(e.key));return l.length?f(l,n,o):t.some(e=>(n[e.key]??0)>0)?'not enough left':'none left'},Object.defineProperty(_e,"withReason",{enumerable:!0,get:function(){return h}}),_e.usesText=function(e,t){return e.length?e.map(e=>{const n=t.find(t=>t.key===e.key),o=(n?.name??e.key).toLowerCase(),s=(n?.plural??`${o}s`).toLowerCase();return`${.5===e.qty?'\xbd':Number.isInteger(e.qty)?String(e.qty):`${Math.floor(e.qty)}\xbd`} ${e.qty>1?s:o}`}).join(', '):'Not linked to the counts'},_e.planAuto=function(e){const{rid:t,enabled:n,dishes:o,counts:s,entries:i,lastChange:a,now:l}=e,u={mark:[],clear:[]},f=new Map(i.filter(e=>e.rid===t).map(e=>[e.itemId,e])),h=l.getTime(),m=e=>e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>h),d=new Set;for(const e of o){d.add(e.id);const t=f.get(e.id),o=n?c(e.uses,s):[];if(o.length){if(t&&m(t))continue;if(t&&t.kept){const e=o.map(e=>a[e.key]??'').sort().pop()??'';if(!e||e<=t.at)continue}u.mark.push({itemId:e.id,name:e.name})}else t&&t.auto&&m(t)&&u.clear.push(e.id)}for(const e of f.values())e.auto&&m(e)&&!d.has(e.itemId)&&u.clear.push(e.itemId);return u};const e='meat|bisque|stock|cakes?|claws?|sauce|butter|oil|paste|salad|mayo|mayonnaise|thermidor|tails?|bon|croquettes?|p\xe2t\xe9|pate|rolls?|soup|linguine|ravioli',t=/^(g|kg|gram|grams|ml|l|litre|litres|oz|lb|lbs|cl)$/i,n={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,half:.5,'\xbd':.5},o=e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&'),s=e=>{const t=new Set([e.name,e.plural].map(e=>e.trim().toLowerCase()).filter(Boolean));for(const e of[...t])e.endsWith('s')?t.add(e.slice(0,-1)):t.add(e+'s');return[...t].sort((e,t)=>t.length-e.length).map(o).join('|')};function i(e){const t=(e||'').trim().toLowerCase();if(!t)return 1;if(/^\xbd$|^half\b/.test(t))return.5;const o=t.match(/^(\d+(?:\.\d+)?)\s*(\xbd)?/);if(o)return Number(o[1])+(o[2]?.5:0);const s=t.split(/\s+/)[0];return n[s]??1}const a=(e,t)=>'half'===e.unit?Math.max(.5,Math.round(2*t)/2):Math.max(1,Math.round(t)),l=e=>(e.optionGroups??[]).some(e=>e.choices.some(e=>/\bhalf\b/i.test(e.label)));function u(n,o,u){const c=u.filter(e=>!1!==e.active&&'kg'!==e.unit),f=(e,t)=>({source:e,uses:t.map(t=>{const o=c.find(e=>e.key===t.key),s='half'===o.unit&&l(n)&&'description'!==e?.5:t.qty;return{key:t.key,qty:a(o,s)}})});if(o){const e=[];for(const n of c){const a=new RegExp(`\\b(${s(n)})\\b`,'i'),l=o.ingredients.find(e=>a.test(e.name)&&!t.test((e.unit||'').trim())&&!/\b(meat|stock|bisque|oil|butter|paste)\b/i.test(e.name));l&&e.push({key:n.key,qty:i(`${l.qty} ${l.unit}`)})}if(e.length)return f('card',e)}const h=n.description??'';{const t=[];for(const n of c){const o=new RegExp(`\\b(half an?|a|an|one|two|three|four|five|six|\\d+(?:\\.\\d+)?|\xbd)\\s+(?:(?:whole|fresh|live|dressed|local)\\s+)?(?:[A-Za-z'\u2019-]+\\s+){0,2}?(${s(n)})\\b(?!\\s+(?:${e}))`,'i'),a=h.match(o);a&&t.push({key:n.key,qty:i(a[1])})}if(t.length)return f('description',t)}{const e=n.name.replace(/\([^)]*\)/g,'').trim(),t=[];for(const n of c)new RegExp(`\\b(${s(n)})$`,'i').test(e)&&t.push({key:n.key,qty:1});if(t.length)return f('name',t)}return{uses:[],source:'none'}}function c(e,t){return e.filter(e=>(t[e.key]??0)(n.find(t=>t.key===e)?.name??e).toLowerCase(),s=e.filter(e=>(t[e.key]??0)<=0).map(e=>o(e.key)),i=e.filter(e=>(t[e.key]??0)>0).map(e=>o(e.key)),a=e=>e.length<=2?e.join(' or '):`${e.slice(0,-1).join(', ')} or ${e[e.length-1]}`;return[s.length?`no ${a(s)}`:'',i.length?`not enough ${a(i)}`:''].filter(Boolean).join(', ')}const h=(e,t)=>t?`${e.replace(/\s*\([^)]*\)\s*$/,'').trim()||e} (${t})`:e},983,[]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SOLD_OUT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOLD_OUT_CLEAR_LABEL",{enumerable:!0,get:function(){return t}}),_e.soldOutSettingsOf=function(t){const n='morning'===t?.clear||'manual'===t?.clear||'close'===t?.clear?t.clear:e.clear,o=/^([01]\d|2[0-3]):[0-5]\d$/.test(t?.morningAt??'')?t.morningAt:e.morningAt;return{clear:n,morningAt:o,auto:!1!==t?.auto}},_e.clearAfterFor=function(e,t,o){if('manual'===t.clear)return;const c=(()=>{const o=n(e,t.morningAt);return ee.getTime()?o:c},_e.activeSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>o)).sort((e,t)=>t.at.localeCompare(e.at)||e.name.localeCompare(t.name))},_e.expiredSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&!!e.clearAfter&&new Date(e.clearAfter).getTime()<=o)},_e.stripText=o,_e.stripNeedsTicker=function(e,t,n){return o(e).length*n*.56>Math.max(0,t-150)},_e.soldOutCount=function(e){return 1===e?'1 dish sold out':`${e} dishes sold out`};const e={clear:'close',morningAt:'05:00',auto:!0},t={close:'When the kitchen closes',morning:'Next morning',manual:'Only when someone taps Back on'};const n=(e,t,n=0)=>{const[o,c]=t.split(':').map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+n,o,c,0,0)};function o(e){return e.join(' \xb7 ')}},984,[]); +__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(0,n.sha256HexSync)(`cc-wake:${i}:${t}`),o={pinHash:a(t,i),pinSalt:i,pinLen:4,pinDefault:!0};function u(){const n=globalThis.crypto,t=new Uint8Array(12);if(n?.getRandomValues)n.getRandomValues(t);else for(let n=0;nn.toString(16).padStart(2,'0')).join('')}const l=(n,t)=>a(t,n.pinSalt)===n.pinHash},986,[1244]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/(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])},988,[819]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n.default}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=(t=e)&&t.__esModule?t:{default:t}},989,[1292]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,s,t){const l=(0,p.tableKey)(t),o=(0,g.tablesOf)(s.table);await h.repo.bookings.update(s.id,(0,y.tablePatch)(l||null)),'seated'===s.status&&s.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(s=>g.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0})),l&&(0,j.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:j=90,onClose:$,onSaved:w,onPickOnPlan:T,canClear:L=!0}){const S=(0,g.usePlan)(e),P=(0,h.useBookings)(e),[W,z]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),D=(0,l.useMemo)(()=>(0,p.pickGroups)(S),[S]),I=P.filter(e=>e.date===y.date),B=(0,p.seatsOf)(S,W),R=(0,p.seatLine)(B.total,y.partySize),O=(0,p.pickClashes)(y,W,I,j),M=e=>(0,p.pickClashes)(y,[e],I,j)[0]?.with,N=(0,p.tableKey)(W)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,m.useBlocks)(e=>e.blocks),A=(0,m.blockAt)(_,e,y.date,y.time),[F,G]=(0,l.useState)(null),Y=e=>{G(null),z(s=>(0,p.toggleTable)(s,e))},[K]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{K&&(0,c.announce)(`Tables can't be saved: ${K}.`)},[K]);const[E,H]=(0,l.useState)(!1),U=async s=>{(0,o.guardBookingChange)(w,{b:y,tables:s})?(H(!0),$(),await(0,o.saveTablesReported)(e,y,s,f,(0,p.seatsOf)(S,s).total,e=>w?.(e))):$()},V=(0,v.jsxs)(u.default,{style:{gap:8},children:[(0,v.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(W)} picked. ${R.text}.`,children:[(0,v.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(W)}),(0,v.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:R.text})]}),A?(0,v.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,v.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,O.length?(0,v.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(O)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,v.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(O)," You can still save."]})}):null,F?(0,v.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:F,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,v.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:F}),(0,v.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,v.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(W)} for ${f}, ${y.partySize} people`,disabled:E,onPress:()=>{U(W)},style:[C,{flexGrow:1}]}),(0,v.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>G(null),style:C})]})]}):null,(0,v.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[F?null:(0,v.jsx)(x.Button,{testID:"table-pick-save",label:E?'Saving\u2026':O.length?'Save anyway':'Save tables',disabled:!N||!W.length||E,accessibilityLabel:`${O.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(W)} for ${f}. ${R.text}.${O.length?` ${(0,p.clashWords)(O)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(w,{b:y,tables:W}))return void $();const e=(0,p.overCapacityAsk)(W,B.total,y.partySize);!e||F?U(W):G(e)},style:[C,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&L?(0,v.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:E,onPress:()=>U([]),style:C}):null,(0,v.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:C})]})]});return(0,v.jsxs)(x.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:V,children:[(0,v.jsx)(s.TableNumberWarning,{plan:S}),K?(0,v.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${K}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,v.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${K}.`})}):null,(0,v.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),T?(0,v.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>T(W),style:C}):null,D.map(e=>(0,v.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,v.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,v.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const s=W.includes(e.name),l=M(e.name);return(0,v.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:s},'aria-checked':s,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,s,l),onPress:()=>Y(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?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!s?'dashed':'solid',backgroundColor:s?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,v.jsx)(x.T,{size:18,weight:"semibold",colour:s?k.colours.onGold:k.colours.text,children:(0,t.tableNumbers)(e.name)}),(0,v.jsxs)(x.T,{size:14,colour:s?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),D.length?null:(0,v.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var s=r(d[0]),t=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),m=r(d[16]),v=r(d[17]);const C={minHeight:56}},990,[935,812,31,959,824,1402,264,128,823,829,1401,960,825,822,818,952,828,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})]})]})}},991,[31,128,823,829,1401,969,960,825,866,863,807,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"BOOKING_VIEW_ONLY",{enumerable:!0,get:function(){return n}}),e.isKitchenPorter=o,e.canChangeBookings=function(n){return!n||(!('owner'!==n.role&&'manager'!==n.role&&!n.ownerAccess&&!n.managerAccess)||('boolean'==typeof n.bookingWrite?n.bookingWrite:!o(n)))},Object.defineProperty(e,"BOOKING_CHANGE_ACTIONS",{enumerable:!0,get:function(){return t}});const n='View only. Ask a manager to change bookings.';function o(n){return!(!n||'staff'!==n.role)&&/porter|KP/i.test(n.job??'')}const t=new Set(['add_walkin','seat_booking','finish_booking','no_show','cancel_booking','move_booking','change_booking','decide_booking','block_table','waitlist_seat'])},992,[]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenBar=p,_e.NeedsPills=k,_e.BookingNeeds=x,Object.defineProperty(_e,"needsIcons",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"confirmHolds",{enumerable:!0,get:function(){return S}}),_e.serveHolds=y,_e.postNewBookingToKitchen=function(e,t){if(!t||'system'===t)return;const s=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),l=[],r=`${e.name}, ${(0,c.niceDate)((0,c.parseYmd)(e.date)).slice(0,3)} ${e.time}${e.table?`, table ${e.table}`:''}`;if((e.holds??[]).filter(e=>e.qty>0).length){const t=I(e.restaurantId);l.push(`${(0,u.holdsText)(e,(0,u.reservablesOf)(s),t)} reserved: ${r}. Tap Platter OK in the Head Chef app.`)}(0,u.hasAllergens)(e)&&l.push(`\u26a0\ufe0f Allergens: ${(0,u.allergenText)(e)} \u2014 ${r}. Please sign \u2018Allergens seen\u2019.`);if(!l.length)return;a.useOwner.getState().chatSend({ch:'kitchen',from:t,text:l.join('\n'),at:(new Date).toISOString()})},_e.useKitchenTodo=D,_e.KitchenSignoffs=function({rid:t,today:s,by:a,app:f,canConfirm:p=!0,showAll:k}){const j=D(t,s),I=(0,o.useBookings)(t),T=(0,o.useRestaurant)(t),O=(0,n.useStockItems)(t),$=(0,u.reservablesOf)(T),A=I.filter(e=>e.date===s&&!['cancelled','noshow'].includes(e.status)&&(e.holds??[]).some(e=>e.qty>0)),C=k?[...j,...A.filter(e=>!j.includes(e))]:j;return C.length?(0,b.jsxs)(l.default,{testID:"kitchen-signoffs",style:{gap:10,padding:16,borderRadius:16,borderWidth:1.5,borderColor:j.length?h.colours.amber:h.colours.hairline,backgroundColor:h.colours.surface},children:[(0,b.jsx)(r.T,{size:12,weight:"semibold",colour:j.length?h.colours.amber:h.colours.goldMuted,style:{letterSpacing:1.6},children:j.length?`KITCHEN SIGN-OFF NEEDED (${j.length})`:'RESERVED TODAY'}),C.map(t=>(0,b.jsxs)(l.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:h.colours.hairline},testID:`signoff-${t.ref}`,children:[(0,b.jsxs)(r.T,{weight:"semibold",children:[t.name," \xb7 ",t.partySize," Covers \xb7 ",t.date===s?'Today':(0,c.niceDate)((0,c.parseYmd)(t.date))," ",t.time,t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:'']}),(0,b.jsx)(x,{b:t}),p?(0,b.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,u.needsAllergenSeen)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"danger",label:"Allergens seen",testID:`allergens-seen-${t.ref}`,onPress:()=>o.useStore.getState().ackBookingAllergy(t.id,a)}):null,(0,u.needsHoldOk)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"success",label:/platter/i.test((0,u.holdsText)(t,$,O))?'Platter OK':'Reservation OK',testID:`platter-ok-${t.ref}`,onPress:()=>S(t.id,a)}):null,t.date===s&&t.holdOk&&(t.holds??[]).some(e=>!e.served)&&['seated','confirmed'].includes(t.status)?(0,b.jsx)(r.Button,{small:!0,kind:"secondary",label:"Served",testID:`served-${t.ref}`,onPress:()=>y(t,a,f)}):null]}):(0,b.jsx)(r.Muted,{children:"The kitchen signs these off."})]},t.id))]}):null},_e.PlattersBooked=function({rid:e,date:t,label:s}){const a=(0,o.useBookings)(e),c=(0,o.useRestaurant)(e),f=(0,n.useStockItems)(e),p=(0,u.heldSummary)(a,t,(0,u.reservablesOf)(c)),k=Object.entries(p.stock).filter(([,e])=>e>0).map(([e,t])=>`${t} ${(f.find(t=>t.key===e)?.name??e).toLowerCase()}`);return p.platters||k.length?(0,b.jsx)(l.default,{testID:"platters-booked",children:(0,b.jsxs)(r.T,{weight:"semibold",colour:h.colours.goldLight,children:[s??'Platters booked',": ",p.platters,k.length?` (${k.join(', ')})`:'']})}):null};var e=_r(d[0]);_r(d[1]);var t,s=_r(d[2]),l=(t=s)&&t.__esModule?t:{default:t},r=_r(d[3]),o=_r(d[4]),n=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);const f=({label:e,bg:t,fg:s,border:o,testID:n})=>(0,b.jsx)(l.default,{testID:n,style:{backgroundColor:t,borderColor:o,borderWidth:1,borderRadius:999,paddingHorizontal:9,paddingVertical:2},children:(0,b.jsx)(r.T,{size:13,weight:"semibold",colour:s,children:e})});function p({b:e,big:t}){return(0,u.hasAllergens)(e)?(0,b.jsxs)(l.default,{testID:`allergen-bar-${e.ref}`,style:{backgroundColor:h.colours.redSolid,borderRadius:10,paddingHorizontal:10,paddingVertical:t?8:5,gap:2},children:[(0,b.jsxs)(r.T,{size:t?16:13,weight:"bold",colour:"#FFFFFF",children:["\u26a0\ufe0f ALLERGENS: ",(0,u.allergenText)(e)]}),e.allergyAck?(0,b.jsxs)(r.T,{size:12,colour:"#FFE3DF",children:["Seen by kitchen: ",e.allergyAck.by]}):(0,b.jsx)(r.T,{size:12,colour:"#FFE3DF",children:"Kitchen hasn\u2019t signed \u2018Allergens seen\u2019 yet"})]}):null}function k({b:t,r:s}){const l=(0,n.useStockItems)(t.restaurantId),o=(0,u.reservablesOf)(s),a=(t.holds??[]).some(e=>e.qty>0),c=[];return t.drinksOnly&&c.push((0,b.jsx)(f,{testID:"pill-drinks",label:"\ud83c\udf77 Drinks only (after last food orders)",bg:h.colours.surface2,fg:h.colours.goldLight,border:h.colours.accentBorder},"x")),(0,u.hasAccess)(t)&&c.push((0,b.jsx)(f,{testID:"pill-access",label:`\u267f ${(0,u.accessText)(t)}`,bg:h.colours.blueBg,fg:"#E2C489",border:h.colours.blue},"a")),(0,u.dogCount)(t)&&c.push((0,b.jsx)(f,{testID:"pill-dog",label:"\ud83d\udc15 "+((0,u.dogCount)(t)>1?`${(0,u.dogCount)(t)} dogs`:'Dog'),bg:h.colours.surface2,fg:h.colours.text,border:h.colours.hairline},"d")),(0,u.dietText)(t)&&c.push((0,b.jsx)(f,{testID:"pill-veg",label:`\u24cb ${(0,u.dietText)(t)}`,bg:"#2A2216",fg:"#E2C489",border:"#CFA45F"},"v")),a&&c.push(t.holdOk?(0,b.jsx)(f,{testID:"pill-platter",label:`\u2713 ${(0,u.holdsText)(t,o,l)} \xb7 confirmed`,bg:h.colours.okBg,fg:"#E2C489",border:h.colours.ok},"h"):(0,b.jsx)(f,{testID:"pill-platter",label:`\ud83e\udd9e ${(0,u.holdsText)(t,o,l)} \xb7 awaiting kitchen`,bg:h.colours.amberBg,fg:"#FFE2A8",border:h.colours.amber},"h")),t.tableReq?.length&&c.push((0,b.jsx)(f,{testID:"pill-request",label:`Requested: ${t.tableReq.map(t=>`${(0,e.tableNumbers)(t)}`).join(' or ')}`,bg:h.colours.goldTint,fg:h.colours.goldLight,border:h.colours.accentBorder},"t")),c.length?(0,b.jsx)(r.Row,{wrap:!0,gap:6,children:c}):null}function x({b:e,big:t}){const s=(0,o.useRestaurant)(e.restaurantId);return(0,b.jsxs)(l.default,{style:{gap:6},children:[(0,b.jsx)(p,{b:e,big:t}),(0,b.jsx)(k,{b:e,r:s})]})}const j=e=>[(0,u.hasAllergens)(e)?'\u26a0\ufe0f':'',(0,u.hasAccess)(e)?'\u267f':'',(0,u.dogCount)(e)?'\ud83d\udc15':'',(0,u.dietText)(e)?'\u24cb':'',(e.holds??[]).some(e=>e.qty>0)?e.holdOk?'\ud83e\udd9e\u2713':'\ud83e\udd9e':''].filter(Boolean).join(' '),S=(e,t)=>o.useStore.getState().updateBooking(e,{holdOk:{by:t,at:(new Date).toISOString()}});function y(e,t,s){const l=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),r=(0,u.stockNeed)(e,(0,u.reservablesOf)(l));for(const[l,o]of Object.entries(r))o>0&&n.shellfish.append({rid:e.restaurantId,kind:l,delta:-o,reason:'sold',by:t,app:s});const a=(new Date).toISOString();o.useStore.getState().updateBooking(e.id,{holds:(e.holds??[]).map(e=>e.served?e:{...e,served:{by:t,at:a}})})}const I=e=>n.useShellStore.getState().items[e]??[];function D(e,t){return(0,o.useBookings)(e).filter(e=>e.date>=t&&!e.walkIn&&((0,u.needsAllergenSeen)(e)||(0,u.needsHoldOk)(e))).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time))}},993,[812,31,128,818,823,1087,863,832,822,825,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},994,[31,128,14,825,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})},995,[1167,1168]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function i(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_AVATARS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"AVATAR_BGS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"AVATAR_RINGS",{enumerable:!0,get:function(){return j}}),_e.specFor=E,_e.AvatarArt=$,_e.AvatarLook=v,_e.useStaffMember=M,_e.StaffAvatar=function({id:i,name:t,size:s=34,ring:c=!0}){const f=M(i,t),h=f?.id??i,u=(0,n.useAvatars)(i=>h?i.photos[h]:void 0),F=(0,o.useSetup)(i=>h?i.looks[h]:void 0),j=`${(f?.name??t??'Team member').replace(' (example)','')}'s avatar`;return(0,y.jsx)(r.default,{testID:h?`avatar-${h}`:'avatar',accessibilityLabel:j,accessibilityRole:"image",style:{width:s,height:s,borderRadius:s/2,overflow:'hidden',borderWidth:c?Math.max(1,s/22):0,borderColor:x.colours.gold,backgroundColor:(0,e.soutersSurface)('#111')},children:u?(0,y.jsx)(l.default,{source:{uri:u.dataUrl},style:{width:'100%',height:'100%'},accessibilityIgnoresInvertColors:!0}):(0,y.jsx)(v,{look:F,id:h,name:f?.name??t,size:s-(c?2*Math.max(1,s/22):0)})})};var e=_r(d[0]);_r(d[1]);var l=i(_r(d[2])),r=i(_r(d[3])),t=_r(d[4]),s=i(t),c=_r(d[5]),n=_r(d[6]),o=_r(d[7]),x=_r(d[8]),f=_r(d[9]),h=_r(d[10]),y=_r(d[11]);const u=Object.fromEntries(h.ROSTER.map(i=>[i.id,i.avatar])),F=['#2A2520','#B89A72','#D9A441','#4A3F35','#3A3029','#8A6A3B'],j=['#E9B949','#CFA45F'],C=F,p=['#F1C7A5','#E8B48F','#C68B5E','#8D5B3E','#F4D2B8','#A86B45'],A=['#2B1B12','#7A4E2A','#151515','#C2462E','#D9B26A'],b=['quiff','flip','crop','beehive','bob','curls'],k=i=>{let e=7;for(const l of i)e=31*e+l.charCodeAt(0)>>>0;return e};function E(i,e){if(i&&u[i])return u[i];const l=k(i||e||'crew');return{bg:C[l%6],ring:j[l%2],skin:p[(l>>3)%6],hair:A[(l>>6)%5],hairStyle:b[(l>>9)%6],suit:'#F2EAD8',antenna:['ball','star','none'][(l>>12)%3]}}const O=(i,e,l)=>`M${i} ${e-l} Q${i+.18*l} ${e-.18*l} ${i+l} ${e} Q${i+.18*l} ${e+.18*l} ${i} ${e+l} Q${i-.18*l} ${e+.18*l} ${i-l} ${e} Q${i-.18*l} ${e-.18*l} ${i} ${e-l}Z`;function $({spec:i,size:e=40}){const l=i,r='#1B1B1B',c='flip'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M29 50 C26 30 40 22 50 22 C60 22 74 30 71 50 C75 56 79 60 76 65 C72 60 69 58 66 57 L34 57 C31 58 28 60 24 65 C21 60 25 56 29 50Z",fill:l.hair}):'bob'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M30 58 C27 32 40 24 50 24 C60 24 73 32 70 58 L66 60 L34 60Z",fill:l.hair}):'beehive'===l.hairStyle?(0,y.jsxs)(t.G,{children:[(0,y.jsx)(t.Ellipse,{cx:50,cy:25,rx:15,ry:14,fill:l.hair}),(0,y.jsx)(t.Path,{d:"M31 54 C28 34 40 27 50 27 C60 27 72 34 69 54 Z",fill:l.hair})]}):'curls'===l.hairStyle?(0,y.jsx)(t.G,{children:[[34,34],[40,27],[50,24],[60,27],[66,34],[69,43],[31,43]].map(([i,e],r)=>(0,y.jsx)(t.Circle,{cx:i,cy:e,r:7,fill:l.hair},r))}):null,n='quiff'===l.hairStyle?(0,y.jsxs)(t.G,{children:[(0,y.jsx)(t.Path,{d:"M32 42 C31 27 43 23 51 25 C61 22 70 30 68 42 C63 35 57 33 50 34 C43 34 37 37 32 42Z",fill:l.hair}),(0,y.jsx)(t.Path,{d:"M46 26 C51 14 66 14 66 23 C61 20 54 21 50 28Z",fill:l.hair})]}):'crop'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M32 42 C31 28 42 25 50 25 C58 25 69 28 68 42 C64 36 58 33 50 33 C42 33 36 36 32 42Z",fill:l.hair}):'curls'===l.hairStyle?null:(0,y.jsx)(t.Path,{d:"M32 43 C33 30 42 27 50 27 C58 27 67 30 68 43 C61 38 57 33 51 33 C47 37 39 41 32 43Z",fill:l.hair});return(0,y.jsxs)(s.default,{width:e,height:e,viewBox:"0 0 100 100",children:[(0,y.jsx)(t.Circle,{cx:50,cy:50,r:50,fill:l.bg}),(0,y.jsx)(t.Ellipse,{cx:50,cy:50,rx:46,ry:13,fill:"none",stroke:"#FFF4E0",strokeOpacity:.28,strokeWidth:1.6,transform:"rotate(-28 50 50)"}),(0,y.jsx)(t.Path,{d:O(16,24,6),fill:"#FFF4E0",fillOpacity:.85}),(0,y.jsx)(t.Path,{d:O(84,34,4),fill:"#FFF4E0",fillOpacity:.7}),(0,y.jsx)(t.Circle,{cx:80,cy:16,r:1.6,fill:"#FFF4E0",fillOpacity:.8}),(0,y.jsx)(t.Circle,{cx:22,cy:70,r:1.3,fill:"#FFF4E0",fillOpacity:.6}),(0,y.jsx)(t.Path,{d:"M12 100 C14 82 31 74 50 74 C69 74 86 82 88 100 Z",fill:l.suit}),(0,y.jsx)(t.Path,{d:"M36 100 L40 84 L50 90 L60 84 L64 100Z",fill:l.ring,fillOpacity:.35}),(0,y.jsx)(t.Rect,{x:44,y:60,width:12,height:12,fill:l.skin}),c,(0,y.jsx)(t.Ellipse,{cx:50,cy:46,rx:17,ry:18.5,fill:l.skin}),n,l.specs?(0,y.jsxs)(t.G,{stroke:r,strokeWidth:1.6,fill:"#FFFFFF",fillOpacity:.25,children:[(0,y.jsx)(t.Rect,{x:37,y:42,width:11,height:8,rx:4}),(0,y.jsx)(t.Rect,{x:52,y:42,width:11,height:8,rx:4}),(0,y.jsx)(t.Line,{x1:48,y1:45,x2:52,y2:45})]}):null,(0,y.jsx)(t.Ellipse,{cx:42.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,y.jsx)(t.Ellipse,{cx:57.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,y.jsx)(t.Circle,{cx:43.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,y.jsx)(t.Circle,{cx:58.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,y.jsx)(t.Circle,{cx:38,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,y.jsx)(t.Circle,{cx:62,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,y.jsx)(t.Path,{d:"M44.5 55 Q50 60 55.5 55",stroke:r,strokeWidth:1.8,fill:"none",strokeLinecap:"round"}),(0,y.jsx)(t.Ellipse,{cx:50,cy:74,rx:21,ry:5.5,fill:l.ring}),(0,y.jsx)(t.Ellipse,{cx:50,cy:73,rx:16,ry:3,fill:"#000000",fillOpacity:.18}),(0,y.jsx)(t.Circle,{cx:50,cy:88,r:4,fill:l.ring}),(0,y.jsx)(t.Circle,{cx:50,cy:88,r:1.6,fill:l.bg}),(0,y.jsx)(t.Circle,{cx:50,cy:45,r:29,fill:"#FFF4E0",fillOpacity:.1,stroke:"#FFF4E0",strokeOpacity:.85,strokeWidth:2}),(0,y.jsx)(t.Path,{d:"M29 36 A23 23 0 0 1 41 22",stroke:"#FFFFFF",strokeOpacity:.85,strokeWidth:3.2,fill:"none",strokeLinecap:"round"}),(0,y.jsx)(t.Circle,{cx:28.5,cy:42,r:1.5,fill:"#FFFFFF",fillOpacity:.85}),'none'!==l.antenna?(0,y.jsx)(t.Line,{x1:50,y1:16,x2:50,y2:8,stroke:l.ring,strokeWidth:2}):null,'ball'===l.antenna?(0,y.jsx)(t.Circle,{cx:50,cy:6.5,r:3.3,fill:l.ring}):'star'===l.antenna?(0,y.jsx)(t.Path,{d:O(50,6.5,4.5),fill:l.ring}):null]})}function v({look:i,id:e,name:r,size:t=40}){const s=null!=i&&i>=1e3?f.AVATAR_OPTIONS.find(e=>e.look===i):void 0;return s?(0,y.jsx)(l.default,{source:{uri:s.dataUrl},style:{width:t,height:t},accessibilityLabel:s.name}):(0,y.jsx)($,{spec:null!=i?E(`${e??r}#look${i}`):E(e,r),size:t})}const P=i=>(i??'').replace(' (example)','').trim().toLowerCase();function M(i,e){const l=(0,c.useOwner)(i=>i.staff);return i?l.find(e=>e.id===i):e?l.find(i=>P(i.name)===P(e)):void 0}},996,[876,31,197,128,989,863,1190,1096,825,1357,15,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"notifSeedId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"headChefId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"gmId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"seedsFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useNotifs",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),p=r(d[5]),f=r(d[6]),c=r(d[7]);const l=(e,t)=>(0,o.uuidFrom)(`sched-notif:${t}:${e}`),S=()=>p.ROSTER.find(e=>'Head Chef'===e.level)?.id??p.ROSTER.find(e=>'chef'===e.app)?.id??'',b=()=>p.ROSTER.find(e=>'Manager'===e.level)?.id??'',h=e=>'anchorage'===e?(0,u.anchorageSeeds)(t=>l(e,t),S(),b()):[],O=()=>(new Date).toISOString(),v=(0,s.create)()((0,n.persist)((e,t)=>({items:[],snooze:{},ensure:i=>{const s=t().items,n=s.map(e=>(0,c.fixSupplierNames)(e.title)!==e.title||(0,c.fixSupplierNames)(e.message)!==e.message?{...e,title:(0,c.fixSupplierNames)(e.title),message:(0,c.fixSupplierNames)(e.message),updatedAt:O()}:e);n.some((e,t)=>e!==s[t])&&e({items:n});const o=new Set(t().items.map(e=>e.id)),u=h(i).filter(e=>!o.has(e.id)).map(e=>({...e,rid:i}));u.length&&e(e=>({items:[...e.items,...u]}))},add:(t,i)=>{const s=(0,f.uuid)();return e(e=>({items:[...e.items,{...i,id:s,rid:t,updatedAt:O()}]})),s},update:(t,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...i,updatedAt:O()}:e)})),remove:t=>e(e=>({items:e.items.flatMap(e=>e.id!==t?[e]:e.seed?[{...e,removed:!0,paused:!0,updatedAt:O()}]:[])})),resetSeeds:t=>{const i=new Map(h(t).map(e=>[e.id,e]));e(e=>{const s=e.items.map(e=>i.has(e.id)?{...i.get(e.id),rid:t,updatedAt:O()}:e),n=new Set(s.map(e=>e.id));return{items:[...s,...[...i.values()].filter(e=>!n.has(e.id)).map(e=>({...e,rid:t,updatedAt:O()}))]}})},setSnooze:(t,i)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[t,i]])}))}),{name:'covercharge-sched-notifs-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)}))},997,[1160,995,1169,1178,999,15,1099,1262]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"chairsId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rulesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useReminders",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"rulesOf",{enumerable:!0,get:function(){return A}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},n=_r(d[1]),s=_r(d[2]),u=_r(d[3]),o=_r(d[4]),l=_r(d[5]);const c=e=>(0,u.uuidFrom)(`reminder:chairs:${e}`),p=e=>(0,u.uuidFrom)(`break-rules:${e}`),f=()=>(new Date).toISOString(),b=(0,n.create)()((0,s.persist)((e,r)=>({reminders:[],rules:{},done:[],snooze:{},ensure:t=>{const n=r(),s={};n.reminders.some(e=>e.id===c(t))||(s.reminders=[...n.reminders,{...(0,o.defaultChairs)(c(t),t),rid:t}]),n.rules[t]||(s.rules={...n.rules,[t]:{...o.DEFAULT_BREAK_RULES,id:p(t)}}),Object.keys(s).length&&e(s)},add:(r,t)=>{const n=(0,l.uuid)();return e(e=>({reminders:[...e.reminders,{...t,id:n,rid:r,updatedAt:f()}]})),n},update:(r,t)=>e(e=>({reminders:e.reminders.map(e=>e.id===r?{...e,...t,updatedAt:f()}:e)})),remove:r=>e(e=>({reminders:e.reminders.flatMap(e=>e.id!==r?[e]:e.builtIn?[{...e,removed:!0,paused:!0,updatedAt:f()}]:[])})),resetReminder:r=>e(e=>({reminders:e.reminders.map(e=>e.id===r&&'chairs'===e.builtIn?{...(0,o.defaultChairs)(r,e.rid),rid:e.rid,updatedAt:f()}:e)})),setRules:(r,t)=>e(e=>({rules:{...e.rules,[r]:{...(0,o.clampRules)({...e.rules[r]??o.DEFAULT_BREAK_RULES,...t}),id:p(r),updatedAt:f()}}})),resetRules:r=>e(e=>({rules:{...e.rules,[r]:{...o.DEFAULT_BREAK_RULES,id:p(r),updatedAt:f()}}})),markDone:r=>e(e=>({done:[{...r,id:(0,l.uuid)(),at:r.at??f()},...e.done].slice(0,400)})),setSnooze:(r,t)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[r,t]])}))}),{name:'covercharge-reminders-v1',version:1,storage:(0,s.createJSONStorage)(()=>t.default)})),A=e=>(0,o.clampRules)(b.getState().rules[e]??o.DEFAULT_BREAK_RULES)},998,[1160,995,1169,1178,1245,1099]); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_FILTER_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOTIF_DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOTIF_GROUP_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"IN_APP_WINDOW_MINS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PUSH_WINDOW_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KITCHEN_OPEN_DAYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"TITLE_MAX",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MESSAGE_MAX",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validHm",{enumerable:!0,get:function(){return u}}),e.ukNow=p,Object.defineProperty(e,"timeOn",{enumerable:!0,get:function(){return m}}),e.notifDue=function(t,n,r=s){const o=p(n),d=m(t,o.dow);if(t.paused||t.removed||!u(d)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd,at:d};const f=l(d);return{due:o.mins>=f&&o.minst.days.includes(n));if(!r.length)return'No days ticked';const s=new Map;for(const n of r){const r=m(t,n);s.set(r,[...s.get(r)??[],n])}const o=t=>7===t.length?'Every day':t.map(t=>n[t]).join(', ');return[...s.entries()].map(([t,n])=>`${o(n)} at ${t}`).join('; ')+' (UK time)'},e.validateNotif=function(t){if(!t.title.trim())return'Give it a name.';if(t.title.length>f)return`Keep the name under ${f} letters.`;if(!t.message.trim())return'Type the message people will see.';if(t.message.length>c)return`Keep the message under ${c} letters.`;if(!u(t.time))return'Type the time as HH:MM, e.g. 21:00.';for(const n of Object.values(t.dayTimes??{}))if(!u(n))return'Type each day\u2019s time as HH:MM.';return t.days.length?t.recipients.staff.length||t.recipients.groups.length||(t.recipients.onShiftIn??[]).length?t.sendBy.inApp||t.sendBy.push?null:'Choose how to send it.':'Tick at least one person or group.':'Tick at least one day.'},e.anchorageSeeds=function(t,n,r){const s={staff:[n,r].filter(Boolean),groups:[]},o={inApp:!0,push:!0};return[{id:t('mills-milk'),seed:'mills-milk',title:'Mills milk order',message:'Make sure an order before 9:30',days:[...d],time:'21:00',dayTimes:{5:'20:55',0:'20:55'},recipients:s,sendBy:o},{id:t('peronis'),seed:'peronis',title:"Pieroni's order",message:"order Pieroni's by phone",days:[...d],time:'21:05',recipients:s,sendBy:o},{id:t('veg-second'),seed:'veg-second',title:'Veg order',message:'Order veg on the app before 11 PM',days:[...d],time:'21:15',recipients:s,sendBy:o},{id:t('reeds'),seed:'reeds',title:'Reids order',message:'Order Reids',days:[3,4],time:'21:25',recipients:s,sendBy:o},{id:t('spezbona'),seed:'spezbona',title:'Spes Bona order',message:'Do we need anything from Spes Bona for this week? Message Anna if we do for Friday delivery.',days:[3],time:'15:00',recipients:s,sendBy:o},{id:t('olsens'),seed:'olsens',title:"Olsen's order",message:"Place Olsen's order before 3:30 PM. By phone.",days:[2],time:'13:00',recipients:{staff:[r],groups:[]},sendBy:o},{id:t('allsons-list'),seed:'allsons-list',title:'Alsons drinks list',message:'Add anything extra to the Alsons drinks list.',days:[0],time:'20:00',recipients:{staff:['st-finn'],groups:[]},sendBy:o,open:{page:'orderlists',list:'allsons'}},{id:t('tea-towels'),seed:'tea-towels',title:'Tea towels',message:'Put a load of tea towels on to wash.',days:[...d],time:'15:00',recipients:{staff:[],groups:[],onShiftIn:['kp'],fallback:{staff:[],groups:['head_chef']}},sendBy:o},{id:t('rota-upload'),seed:'rota-upload',title:'Rota upload',message:"Make sure you have uploaded next week's rota.",days:[0],time:'20:50',recipients:s,sendBy:o}]};const t={kitchen:'On shift: Kitchen',foh:'On shift: Front of house',bar:'On shift: Bar',kp:'On shift: KPs',chefs:'On shift: Chefs'},n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],r={on_shift:'Everyone on shift',everyone:'Everyone',managers:'Owners and managers',head_chef:'Head Chef',kitchen:'Kitchen team',foh:'Front of house'},s=120,o=15,d=[3,4,5,6,0],f=60,c=160,u=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t),l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));function p(t){const r='number'==typeof t?new Date(t):t,s={};for(const t of new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(r))s[t.type]=t.value;return{dow:n.indexOf(String(s.weekday).slice(0,3)),mins:60*Number(s.hour)+Number(s.minute),ymd:`${s.year}-${s.month}-${s.day}`}}const m=(t,n)=>{const r=t.dayTimes?.[String(n)];return r&&u(r)?r:t.time};const h=t=>t.open?`./?open=${t.open.page}${t.open.list?`&list=${encodeURIComponent(t.open.list)}`:''}`:'./',y=(t,n)=>`${t.id}:${n}`,g=t=>(t??'').toLowerCase(),b=t=>t.level?['owner','manager'].includes(g(t.level)):['owner','manager'].includes(g(t.role)),O=t=>'head_chef'===g(t.role)||'head chef'===g(t.level)||'chef'===g(t.app)||/head chef/.test(g(t.job)),P=t=>'kitchen'===g(t.department)||/chef|kitchen|kp|porter/.test(g(t.job))||O(t),k=t=>/\bkp\b|kitchen porter/.test(g(t.job));function j(t,n){const r=g(n.department);return'kitchen'===t?P(n):'kp'===t?k(n):'chefs'===t?O(n)||/chef|commis/.test(g(n.job)):'bar'===t?'bar'===r||/\bbar/.test(g(n.job)):'front of house'===r||!r&&!P(n)&&!b(n)}function _(t,n,r=[]){const s=v(t.recipients,n,r),o=t.recipients.fallback;return s.length||!o?s:v({staff:o.staff,groups:o.groups},n,r)}const w=(t,n,r=[])=>!!t.recipients.fallback&&!v(t.recipients,n,r).length;function v(t,n,r){const s=t,o=n.filter(t=>!1!==t.active),d=new Set;for(const t of s.staff)o.some(n=>n.id===t)&&d.add(t);for(const t of s.groups)for(const n of o)('everyone'===t||'on_shift'===t&&r.includes(n.id)||'managers'===t&&b(n)||'head_chef'===t&&O(n)||'kitchen'===t&&P(n)||'foh'===t&&!P(n)&&!b(n))&&d.add(n.id);for(const t of s.onShiftIn??[])for(const n of o)r.includes(n.id)&&j(t,n)&&d.add(n.id);return[...d].sort()}const M=t=>({id:t.external_ref,role:t.roles?.key??void 0,job:t.job_title??'',department:t.department??'',active:!1!==t.active}),T=(t,n,r,s=[])=>_(t,r,s).includes(n)},999,[]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shiftNow=k,e.useShiftReminders=function({rid:c,staffId:u,name:h,kitchen:b,onStartBreak:S}){const D=(0,t.useRef)(S);D.current=S;const v=(0,t.useRef)(h);v.current=h;const I=(0,s.useReminders)(t=>`${t.reminders.length}:${t.done.length}:${JSON.stringify(t.rules[c]??{})}:${t.reminders.map(t=>t.updatedAt??'').join()}`),w=(0,r.useOwner)(t=>`${t.attendance.length}:${t.shifts.length}:${t.leave.length}`);(0,t.useEffect)(()=>{s.useReminders.getState().ensure(c);const t=()=>{const t=f(),{att:h,shift:S,on:I}=k(u,t),w=s.useReminders.getState();if(!I||!u)return w.reminders.forEach(t=>(0,a.dismissNotice)(`rem:${t.id}`)),void(0,a.dismissNotice)('break-reminder');const $=(0,s.rulesOf)(c),R=h?.in?new Date(h.in).getTime():void 0,p=!!h?.breaks?.length,y=`break:${h?.id??S?.id??''}`,M=(0,o.breakDue)({now:t,clockIn:R,shiftStart:S?l(S.date,S.start):void 0,shiftEnd:S?l(S.date,S.end):void 0,rotaBreak:void 0!==S?.breakAt?l(S.date,S.breakAt):void 0,hadBreak:p,rules:$},w.snooze[y]??0);if(M){const r=R??(S?l(S.date,S.start):t);(0,a.notify)({id:'break-reminder',tone:3===M.stage?'warn':'normal',icon:'\ud83e\uded6',kicker:'BREAK REMINDER',testID:'break-reminder',timeoutMs:null,title:M.label,body:`${R?'Clocked in':'Shift started'} at ${m(r)}. ${3===M.stage?'':'Over 6 hours needs a 20-minute break.'}`.trim(),actions:[{label:'Start break',testID:'break-reminder-start',onPress:()=>{if(!h)return D.current?.(),void(0,a.notify)({id:'break-clock-first',title:'Clock in first, then tap Start break.',body:'Your break is started from the clock screen.',timeoutMs:6e3});const t=new Date(f()).toISOString();(0,n.clockAction)('break_start',{rid:c,staffId:u,date:t.slice(0,10),at:t}).then(t=>{t.ok||(0,a.notify)({id:'break-blocked',tone:'warn',title:'Break not started',body:t.message,timeoutMs:1e4}),D.current?.()})}},{label:'Later',kind:'ghost',testID:'break-reminder-later',onPress:()=>{s.useReminders.getState().setSnooze(y,f()+6e4*$.snoozeMins),(0,a.dismissNotice)('break-reminder')}}]})}else(0,a.dismissNotice)('break-reminder');const N=r.useOwner.getState().staff.find(t=>t.id===u),O=b??(0,d.inKitchen)(N);for(const n of w.reminders){if(n.rid!==c)continue;const r=`rem:${n.id}`;if(n.removed||!(0,o.audienceMatch)(n.audience,O)){(0,a.dismissNotice)(r);continue}const{due:d,forDate:m}=(0,o.reminderDue)(n,t),l=w.done.find(t=>t.reminderId===n.id&&t.forDate===m),k=`rem:${n.id}:${m}`;!d||l||(w.snooze[k]??0)>t?(0,a.dismissNotice)(r):(0,a.notify)({id:r,icon:'\ud83e\ude91',kicker:'REMINDER',title:n.text,testID:'venue-reminder',timeoutMs:null,body:`For everyone on shift${'all'===n.audience?'':'kitchen'===n.audience?' in the kitchen':' front of house'}. Tap Done once it\u2019s done.`,actions:[{label:'Done',testID:'venue-reminder-done',onPress:()=>s.useReminders.getState().markDone({rid:c,reminderId:n.id,forDate:m,at:new Date(f()).toISOString(),staffRef:u,staffName:v.current.replace(' (example)','')})},{label:'Later',kind:'ghost',onPress:()=>s.useReminders.getState().setSnooze(k,f()+6e4*$.snoozeMins)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[c,u,I,w,b])};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]);const f=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock).getTime()}catch{return Date.now()}},m=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=(t,n)=>{const[r,s,o]=t.split('-').map(Number);return new Date(r,s-1,o,Math.floor(n),Math.round(n%1*60)).getTime()};function k(t,n){const s=r.useOwner.getState(),a=(0,r.openShiftOf)(s.attendance,t,new Date(n)),d=(0,o.ukClock)(n).ymd,c=(0,u.workingShifts)(s.shifts,s.leave),f=c.find(r=>r.staffId===t&&r.date===d&&!1!==r.published&&l(r.date,r.start)<=n&&nn.staffId===t&&n.date===d&&!1!==n.published):void 0),m=!a&&!!f&&s.attendance.some(n=>n.staffId===t&&n.date===d&&!!n.out&&new Date(n.out).getTime()>=l(f.date,f.start));return{att:a,shift:f,on:!!a||!!f&&!m}}},1000,[31,1391,863,998,1245,980,1269,881,972]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"START_PAIR",{enumerable:!0,get:function(){return t}});const t=(()=>{try{if('undefined'==typeof window||!window.location)return null;const t=new URL(window.location.href),n=new URLSearchParams(t.hash.replace(/^#/,'')),c=t.searchParams.get('pair')||n.get('pair');if(!c)return null;t.searchParams.delete('pair'),n.delete('pair');const o=n.toString();return window.history.replaceState(null,'',t.pathname+(t.search?t.search:'')+(o?`#${o}`:'')),c}catch{return null}})()},1001,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1041,[31,128,953,825,818,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCKED_STEPS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"BLOCKED_INTRO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"BLOCKED_SPOKEN",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"STILL_OFF",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"ALERTS_PROMPT_ON",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"usePushPrompt",{enumerable:!0,get:function(){return O}}),_e.bannerFor=L,_e.titleFor=R,_e.chromeUrlFor=B,_e.AlertsBanner=function(){const e=O(e=>e.mode);if(!e)return null;const{line:n,action:o}=L(e);return(0,C.jsxs)(r.default,{testID:"alerts-banner",accessibilityRole:"button",accessibilityLabel:`${n} ${o}.`,accessibilityHint:"Opens the steps",onPress:()=>O.setState({open:!0}),style:{alignSelf:'center',maxWidth:420,width:'100%',minHeight:48,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1,borderColor:l.colours.accentBorder,backgroundColor:l.colours.surface2},children:[(0,C.jsx)(H,{size:18}),(0,C.jsxs)(t.Text,{testID:"alerts-banner-text",style:{color:'#F2E6C9',fontSize:15,textAlign:'center',flexShrink:1},children:[n," ",(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontWeight:'700',textDecorationLine:'underline'},children:o})]})]})},_e.PushPrompt=function(){const e=(0,s.useSync)(e=>e.kind),u=(0,s.useSync)(e=>e.staffRef),p=(0,s.useSync)(e=>e.venueId),b=O(e=>e.mode),m=O(e=>e.open),x=e=>O.setState(e?{mode:e}:{mode:null,open:!1}),[w,A]=(0,n.useState)(null),[L,_]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!k.includes(f.APP_VARIANT)||!P)return;if(h.PITCH)return globalThis.__pitchPushPrompt=e=>{A(null),O.setState({mode:e,open:!!e})},void(globalThis.__pitchPushBanner=e=>{A(null),O.setState({mode:e,open:!1})});if('staff'!==e||!u||!p)return;let t=!0;const n=async()=>{let e='unsupported';if(!(0,c.inApkWebView)()){try{e=await(0,c.pushState)()}catch{return}if(!t)return;if('on'===e)return x(null),void(0,c.resaveIfAllowed)().catch(()=>{});if('off'===e&&'undefined'!=typeof Notification&&'granted'===Notification.permission){let e=!1;try{e=await(0,c.resaveIfAllowed)()}catch{}if(!t)return;if(e)return void x(null)}}const n=z(e);t&&(n&&Date.now()-D()>I?O.setState({mode:n}):x(null))};n();const o=()=>{'undefined'!=typeof document&&'visible'===document.visibilityState&&n()};try{document.addEventListener('visibilitychange',o)}catch{}return()=>{t=!1;try{document.removeEventListener('visibilitychange',o)}catch{}}},[e,u,p]),!b||!m)return null;const F=R(b),N={minHeight:64,borderRadius:16,justifyContent:'center',alignItems:'center',paddingHorizontal:20,backgroundColor:l.colours.gold,alignSelf:'stretch'},W=(e,n)=>(0,C.jsxs)(i.default,{style:{flexDirection:'row',gap:12,alignItems:'center',alignSelf:'stretch'},children:[(0,C.jsx)(i.default,{style:{width:30,height:30,borderRadius:15,borderWidth:1.5,borderColor:l.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontSize:15,fontWeight:'700'},children:e})}),(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,flex:1,lineHeight:22},children:n})]},e);return(0,C.jsx)(i.default,{testID:"alerts-prompt-backdrop",style:{position:'fixed',left:0,right:0,top:0,bottom:0,zIndex:2147483100,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:18},children:(0,C.jsxs)(i.default,{testID:"alerts-prompt",accessibilityRole:'dialog',accessibilityLabel:F,style:{width:'100%',maxWidth:380,backgroundColor:l.colours.surface2,borderColor:l.colours.accentBorder,borderWidth:1,borderRadius:22,paddingHorizontal:22,paddingTop:22,paddingBottom:18,alignItems:'center',gap:14,shadowColor:'#000',shadowOpacity:.5,shadowRadius:24,shadowOffset:{width:0,height:10}},children:[(0,C.jsx)(i.default,{style:{position:'absolute',top:10,right:10},children:(0,C.jsx)(y.GoldClose,{testID:"alerts-prompt-close",label:"Close",onPress:()=>{A(null),O.setState({open:!1})}})}),(0,C.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1.5,borderColor:l.colours.gold,alignItems:'center',justifyContent:'center',marginTop:6},children:(0,C.jsx)(H,{})}),(0,C.jsx)(t.Text,{testID:"alerts-prompt-title",accessibilityRole:"header",style:{color:l.colours.goldLight,fontSize:22,fontWeight:'700',textAlign:'center',lineHeight:28,paddingHorizontal:8},children:F}),'off'===b?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(r.default,{testID:"alerts-prompt-turn-on",accessibilityRole:"button",disabled:L,accessibilityState:{disabled:L,busy:L},accessibilityLabel:"Turn on alerts. Your phone will then ask to allow notifications: tap Allow.",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{const e=await(0,c.turnOnPush)();if(e.ok)return void x(null);A(e.message);const t=z(await(0,c.pushState)());x(t||null)}catch{A('Could not turn on alerts. Please try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Turning on\u2026':'Turn on alerts'})}),(0,C.jsxs)(t.Text,{testID:"alerts-prompt-allow",style:{color:'#F2E6C9',fontSize:17,textAlign:'center'},children:["When your phone asks, tap ",(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontWeight:'700'},children:"Allow"}),"."]})]}):null,'blocked'===b?(0,C.jsxs)(i.default,{testID:"alerts-prompt-blocked",accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"assertive",accessibilityLabel:j,style:{alignSelf:'stretch',gap:8},children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:17,textAlign:'center'},children:T}),S.map((e,t)=>W(t+1,e))]}):null,'blocked'===b?(0,C.jsx)(r.default,{testID:"alerts-prompt-recheck",accessibilityRole:"button",disabled:L,accessibilityState:{disabled:L,busy:L},accessibilityLabel:"I\u2019ve allowed it. Check again.",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{if('blocked'===await(0,c.pushState)())return void A(v);const e=await(0,c.turnOnPush)();if(e.ok)return void x(null);A(e.message);const t=z(await(0,c.pushState)());x(t)}catch{A('Could not check alerts. Please try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Checking\u2026':'I\u2019ve allowed it, check again'})}):null,'ios'===b?(0,C.jsxs)(i.default,{testID:"alerts-prompt-ios",style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,textAlign:'center'},children:"iPhone only sends alerts to apps on the Home Screen. First:"}),W(1,'Tap the Share button (the square with the arrow) in Safari.'),W(2,'Tap Add to Home Screen, then Add.'),W(3,'Open CoverCharge from your Home Screen.'),W(4,'Tap Turn on alerts, then Allow.')]}):null,'apk'===b||'webview'===b?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,textAlign:'center'},children:'apk'===b?'The phone app can\u2019t show alerts when it\u2019s closed. Chrome can. You\u2019ll stay signed in as you.':'This browser can\u2019t get alerts. Open CoverCharge in Chrome.'}),(0,C.jsx)(r.default,{testID:"alerts-prompt-open-chrome",accessibilityRole:"button",disabled:L,accessibilityLabel:"Open CoverCharge in Chrome to turn on alerts",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{let e=null;if('apk'===b){const t=await(0,s.makeChromeHandover)();if(!t.ok)return void A(t.message);e=t.code}const t=B(window.location.href,e,'apk'===b);if(h.PITCH)return A('Opening Chrome\u2026'),void(globalThis.__pitchLastChromeUrl=t);A('Opening Chrome\u2026 Then tap Turn on alerts there, and Allow.');try{window.location.href=t}catch{await o.default.openURL(t)}}catch{A('Could not open Chrome. Check your connection and try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Opening\u2026':'Open in Chrome'})}),(0,C.jsx)(t.Text,{style:{color:'#CFC6B4',fontSize:14,textAlign:'center'},children:"In Chrome: tap Turn on alerts, then Allow."})]}):null,w?(0,C.jsx)(i.default,{accessibilityLiveRegion:"assertive",accessibilityRole:'alert',children:(0,C.jsx)(t.Text,{testID:"alerts-prompt-msg",style:{color:l.colours.goldLight,fontSize:15,textAlign:'center'},children:w})}):null,(0,C.jsx)(r.default,{testID:"alerts-prompt-later",accessibilityRole:"button",accessibilityLabel:"Not now. Hide this until tomorrow",onPress:()=>{E(),A(null),x(null)},style:{minHeight:48,justifyContent:'center',paddingHorizontal:24},children:(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontSize:17,textDecorationLine:'underline'},children:"Not now"})})]})})};var t=_r(d[0]),n=_r(d[1]),o=e(_r(d[2]));_r(d[3]);var r=e(_r(d[4])),i=e(_r(d[5])),l=_r(d[6]),s=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),f=_r(d[11]),p=_r(d[12]),b=_r(d[13]),y=_r(d[14]),m=_r(d[15]),x=e(m),C=_r(d[16]);const w='cc-alerts-prompt-v1',S=['In Chrome, tap the three dots at the top right, then Settings.','Tap Site settings, then Notifications.','Find CoverCharge (covercharge-apps) under Blocked, tap it, and choose Allow.','Come back here and tap \u201cI\u2019ve allowed it, check again\u201d.'],T='Chrome has alerts switched off for CoverCharge on this phone, so the app can\u2019t ask again. To switch them back on:',j=`${T} ${S.map((e,t)=>`${t+1}. ${e}`).join(' ')}`,v='Alerts are still off in Chrome. Follow the steps above, then tap check again.',I=864e5,k=['owner','staff','chef'],P=!(b.IS_ISOLATED_VENUE||b.IS_QUEUED_VENUE||b.IS_GREENSIDE||b.IS_ABBOTSFORD||b.IS_KIRKTON),A=k.includes(f.APP_VARIANT)&&P&&!h.PITCH,O=(0,u.create)(()=>({mode:null,open:!1}));function L(e){return{line:'Alerts are off on this phone.',action:'off'===e?'Tap to turn on':'ios'===e?'Tap to see how':'apk'===e||'webview'===e?'Tap to open in Chrome':'Tap to fix'}}function R(e){return'apk'===e||'webview'===e?'Open CoverCharge in Chrome to turn on alerts':'ios'===e?'Add CoverCharge to your Home Screen':'blocked'===e?'Turn alerts back on in Chrome':'Turn on alerts so you don\u2019t miss orders and reminders'}const _=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent);function D(){try{const e=JSON.parse(localStorage.getItem(w)||'{}');return Number(e.later||0)}catch{return 0}}function E(){try{localStorage.setItem(w,JSON.stringify({later:Date.now(),version:p.APP_VERSION}))}catch{}}function z(e){return _()?'apk':(0,c.inApkWebView)()?'webview':'off'===e?'off':'blocked'===e?'blocked':'ios-home-screen'===e?'ios':null}function B(e,t,n){const o=new URL(e),r=`${o.origin}${o.pathname.replace(/[^/]*$/,'')}index.html${t?`#ccchrome=${t}`:''}`;return n?`googlechrome://navigate?url=${encodeURIComponent(r)}`:`intent://${o.host}${o.pathname.replace(/[^/]*$/,'')}index.html#Intent;scheme=https;package=com.android.chrome;end`}function H({size:e=32}={}){return(0,C.jsxs)(x.default,{width:e,height:e,viewBox:"0 0 24 24",accessible:!1,pointerEvents:"none",children:[(0,C.jsx)(m.Path,{d:"M6 16 V11 a6 6 0 0 1 12 0 V16 l1.5 2 H4.5 Z",stroke:l.colours.gold,strokeWidth:1.7,strokeLinejoin:"round",fill:"none"}),(0,C.jsx)(m.Path,{d:"M10 20.5 a2 2 0 0 0 4 0",stroke:l.colours.gold,strokeWidth:1.7,strokeLinecap:"round",fill:"none"})]})}},1042,[874,31,240,123,264,128,825,824,1363,995,2,807,1045,5,835,989,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"currentScrollY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"screenGeneration",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"restoreScroll",{enumerable:!0,get:function(){return o}}),_e.useScrollMemory=function(u){const c=(0,e.useRef)(0),o=(0,e.useRef)(0),l=(0,e.useRef)(0),s=(0,e.useRef)(0),f=(0,e.useRef)(0),v=(0,e.useRef)(null),y=(0,e.useRef)([]),h=()=>{y.current.forEach(clearTimeout),y.current=[]},b=()=>{const e=v.current;null!=e&&(u.current?.scrollTo({y:e,animated:!1}),f.current-s.current>=e-2&&(c.current=e,o.current=e,v.current=null,h()))},p=(0,e.useCallback)(e=>{if(h(),v.current=Math.max(0,e),e<=0)return v.current=null,u.current?.scrollTo({y:0,animated:!1}),c.current=0,void(o.current=0);for(const e of[0,30,80,160,320,600,1e3,1600,2500])y.current.push(setTimeout(b,e));y.current.push(setTimeout(()=>{v.current=null},2600))},[]);t={y:()=>o.current,restore:p};const R=(0,e.useCallback)(()=>{n++;return o.current},[]);return{props:{scrollEventThrottle:32,onScroll:e=>{const t=e.nativeEvent.contentOffset.y;c.current=t,s.current=e.nativeEvent.layoutMeasurement.height,f.current=e.nativeEvent.contentSize.height,Date.now()-l.current>250&&null==v.current&&(o.current=t)},onScrollBeginDrag:()=>{v.current=null,h()},onContentSizeChange:(e,t)=>{f.current=t,l.current=Date.now(),b()},onLayout:e=>{s.current=e.nativeEvent.layout.height}},restore:p,leave:R}};var e=r(d[0]);let t=null,n=0;const u=()=>t?t.y():0,c=()=>n,o=e=>t?.restore(e)},1043,[31]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBackLayers",{enumerable:!0,get:function(){return f}}),_e.runBackLayer=function(){const e=f.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(e,n,o=!0){const s=(0,t.useRef)(n);s.current=n,(0,t.useEffect)(()=>{if(!e)return;const t=++y,n=(0,u.currentScrollY)(),l=(0,u.screenGeneration)();return f.setState(e=>({layers:[...e.layers,{id:t,fn:()=>s.current(),own:o}]})),()=>{f.setState(e=>({layers:e.layers.filter(e=>e.id!==t)})),(0,u.screenGeneration)()===l&&(0,u.restoreScroll)(n)}},[e,o])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"BACK_GUTTER",{enumerable:!0,get:function(){return w}}),_e.BackTitleRow=function({back:e,onBack:n,title:s}){const[l,u]=(0,t.useState)(0),[f,y]=(0,t.useState)({w:96,h:48}),[p,b]=(0,t.useState)(0),S=Array.from(new Set(String(s??'').split(/\s+/).filter(Boolean)));String(s??'').length>=20&&S.length>=3&&S.push('00000000');const v=Math.max(w,Math.ceil(f.w)+4),j=e&&l>0&&l-2*v0&&(0===l||0===p);return(0,h.jsxs)(o.default,{testID:"screen-title-row",onLayout:e=>u(Math.round(e.nativeEvent.layout.width)),style:{minHeight:44,justifyContent:'center',alignItems:'center',paddingHorizontal:e&&!j?v:0,paddingTop:j?f.h:0},children:[e?(0,h.jsx)(o.default,{style:{position:'absolute',left:0,top:0},onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width),n=Math.round(e.nativeEvent.layout.height);y(e=>e.w===t&&e.h===n?e:{w:t,h:n})},children:(0,h.jsx)(g,{onPress:n})}):null,(0,h.jsx)(c.T,{size:22,weight:"bold",center:!0,style:B?{opacity:0}:void 0,accessibilityRole:"header",children:s}),e&&S.length?(0,h.jsx)(o.default,{"aria-hidden":!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{position:'absolute',left:0,top:0,opacity:0,alignItems:'flex-start'},onLayout:e=>b(Math.ceil(e.nativeEvent.layout.width)),children:S.map(e=>(0,h.jsx)(c.T,{size:22,weight:"bold",numberOfLines:1,style:{alignSelf:'flex-start'},children:e},e))}):null]})},_e.BackButton=g,_e.useWebBack=function(e){const n=(0,t.useRef)(e);n.current=e,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.history?.pushState)return;const e=()=>{try{window.history.pushState({...window.history.state??{},ccBack:Date.now()},'',window.location.href)}catch{}};e();const t=t=>{n.current()&&(t.stopImmediatePropagation?.(),e())};return window.addEventListener('popstate',t,!0),()=>window.removeEventListener('popstate',t,!0)},[])};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]);const f=(0,s.create)(()=>({layers:[]}));let y=0;const p=()=>f(e=>e.layers.some(e=>e.own)),w=100;function g({onPress:e,testID:t="screen-back",label:o="Back"}){return(0,h.jsx)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,h.jsxs)(c.T,{size:18,weight:"semibold",colour:l.colours.gold,children:["\u2039 ",o]})})}},1044,[31,123,264,128,995,825,818,1043,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.184'},1045,[]); +__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()})},1046,[31,1076]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTasksProgress=function(e,s){const t=(0,r.useDailyTasks)(t=>t.people[(0,r.personKey)(e,s)]?.tasks)??[],i=(0,r.useDailyTasks)(e=>e.ticks),{ymd:l,dow:o}=T();return(0,c.progress)(t,i,s,l,o)},_e.DailyTasksEditor=j,_e.MyTasksToday=function({rid:e,staffId:s,name:t,onShift:i}){const u=(0,r.useDailyTasks)(t=>t.people[(0,r.personKey)(e,s)]?.tasks)??[],h=(0,r.useDailyTasks)(e=>e.ticks),{ymd:y,dow:x}=T(),p=(0,c.tasksFor)(u,x);if(!s||!p.length)return null;const f=(0,c.progress)(u,h,s,y,x);return(0,k.jsx)(o.default,{testID:"my-tasks-today",children:(0,k.jsxs)(n.Card,{children:[(0,k.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(n.T,{weight:"semibold",colour:d.colours.gold,children:"My tasks today"}),(0,k.jsx)(n.Badge,{kind:f.done===f.total?'gold':'neutral',label:`${f.done} of ${f.total}`})]}),i?null:(0,k.jsx)(n.Muted,{size:12,children:"You\u2019re not on shift right now. You can still tick these when you are."}),p.map(c=>{const u=h.find(t=>t.id===(0,r.tickId)(e,s,c.id,y));return(0,k.jsxs)(l.default,{testID:`my-task-${c.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:!!u},disabled:!i,onPress:()=>r.useDailyTasks.getState().toggleTick(e,s,c.id,y,{id:s,name:t.replace(' (example)','')}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:8,opacity:i?1:.6},children:[(0,k.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:1.5,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:u?'#2a2414':'transparent'},children:u?(0,k.jsx)(n.T,{colour:d.colours.gold,children:"\u2713"}):null}),(0,k.jsxs)(o.default,{style:{flex:1},children:[(0,k.jsx)(n.T,{style:{textDecorationLine:u?'line-through':'none'},children:c.text}),u?(0,k.jsxs)(n.Muted,{size:12,children:["Done at ",b(u.at)]}):null]})]},c.id)}),(0,k.jsx)(n.Muted,{size:12,children:"Tip: tick each one as you finish it. Your manager sees how you\u2019re getting on. They start fresh every day."})]})})},_e.TaskLibrarySettings=function({rid:e}){(0,i.useEffect)(()=>{r.useDailyTasks.getState().ensure(e)},[e]);const t=(0,r.useDailyTasks)(s=>s.library[e]?.items)??[],[l,u]=(0,i.useState)(''),[h,x]=(0,i.useState)({}),f=r.useDailyTasks.getState(),b=s=>f.setLibrary(e,s);return(0,k.jsxs)(o.default,{style:{gap:8},testID:"task-library",children:[(0,k.jsx)(n.Muted,{size:13,children:"Tip: these are quick picks when you add someone\u2019s daily tasks (Staff & roles \u203a a person \u203a Daily tasks). You can always type a new one there too."}),t.map((e,i)=>(0,k.jsxs)(n.Row,{gap:6,style:{opacity:e.archived?.5:1},children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:`Rename ${e.text}`,value:h[e.id]??e.text,onChangeText:s=>x(t=>({...t,[e.id]:s})),onBlur:()=>{const s=(0,c.cleanTaskText)(h[e.id]??'');s&&s!==e.text&&b(t.map(t=>t.id===e.id?{...t,text:s}:t))},style:{...p,flex:1,minWidth:0}}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2191",disabled:0===i,onPress:()=>b((0,c.move)(t,i,-1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2193",disabled:i===t.length-1,onPress:()=>b((0,c.move)(t,i,1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>b(t.map(s=>s.id===e.id?{...s,archived:!s.archived}:s))})]},e.id)),(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:"New library task",testID:"task-lib-new",value:l,onChangeText:u,placeholder:"e.g. Check the beer garden",placeholderTextColor:d.colours.muted,style:{...p,flex:1}}),(0,k.jsx)(n.Button,{small:!0,label:"Add",disabled:!(0,c.cleanTaskText)(l),onPress:()=>{b([...t,{id:(0,y.uuid)(),text:(0,c.cleanTaskText)(l)}]),u('')}})]})]})},_e.KitchenTeamTasks=function({rid:e,actor:s}){const t=(0,x.useOwner)(e=>e.staff).filter(e=>e.active&&s&&(0,c.canEditTasks)(s,e));return(0,k.jsxs)(o.default,{style:{gap:10},testID:"kitchen-team-tasks",children:[(0,k.jsx)(n.Muted,{size:13,children:"Tip: set the daily tasks for your kitchen team here. They see them as \u2018My tasks today\u2019 when they\u2019re on shift and tick them off. Your own list and front of house lists are set by a manager."}),s?null:(0,k.jsx)(n.Muted,{children:"Sign in to change your team\u2019s tasks."}),s&&!t.length?(0,k.jsx)(n.Muted,{children:"No kitchen staff found. A manager can set each person\u2019s department in Staff & roles."}):null,t.map(t=>(0,k.jsxs)(n.Card,{children:[(0,k.jsx)(n.T,{weight:"semibold",children:(0,x.staffLabel)(t).replace(' (example)','')}),(0,k.jsxs)(n.Muted,{size:12,children:[t.job,t.dept?` \xb7 ${t.dept}`:'']}),(0,k.jsx)(j,{rid:e,person:t,actor:s})]},t.id))]})};var s=_r(_d[0]),t=_r(_d[1]),i=_r(_d[2]),l=e(_r(_d[3])),o=e(_r(_d[4])),n=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),k=_r(_d[13]);const p={minHeight:42,borderRadius:10,borderWidth:1,borderColor:d.colours.hairline,backgroundColor:d.colours.surface2,color:d.colours.text,paddingHorizontal:10,fontSize:15},f=[1,2,3,4,5,6,0],b=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),T=(e=Date.now())=>{const s=(0,u.ukClock)(e);return{ymd:s.ymd,dow:new Date(`${s.ymd}T12:00:00Z`).getUTCDay()}};function j({rid:e,person:u,actor:y}){(0,i.useEffect)(()=>{r.useDailyTasks.getState().ensure(e)},[e]);const x=(0,r.useDailyTasks)(s=>s.people[(0,r.personKey)(e,u.id)]?.tasks)??[],j=((0,r.useDailyTasks)(s=>s.library[e]?.items)??[]).filter(e=>!e.archived),w=(0,r.useDailyTasks)(e=>e.ticks),[D,v]=(0,i.useState)(!1),[C,S]=(0,i.useState)(''),[$,I]=(0,i.useState)(null),M=r.useDailyTasks.getState(),P=(0,c.canEditTasks)(y,u),{ymd:R,dow:L}=T(),z=(0,c.progress)(x,w,u.id,R,L),B=s=>M.setTasks(e,u.id,s),A=e=>{const s=x;B(x.filter(s=>s.id!==e.id)),(0,h.notify)({id:`task-undo-${e.id}`,title:`Removed \u201c${e.text}\u201d`,timeoutMs:8e3,actions:[{label:'Undo',testID:'task-undo',onPress:()=>B(s)}]})};return(0,k.jsxs)(o.default,{testID:`tasks-${u.id}`,style:{gap:6},children:[(0,k.jsx)(l.default,{accessibilityRole:"button",testID:`tasks-open-${u.id}`,onPress:()=>v(!D),children:(0,k.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(n.T,{weight:"semibold",colour:d.colours.gold,children:["Daily tasks ",D?'\u25b4':'\u25be']}),(0,k.jsx)(n.Muted,{size:12,children:x.length?`${z.done} of ${z.total} done today`:'None yet'})]})}),D?(0,k.jsxs)(o.default,{style:{gap:6},children:[x.map((s,i)=>{const l=w.find(t=>t.id===(0,r.tickId)(e,u.id,s.id,R));return(0,k.jsxs)(o.default,{testID:`task-row-${i}`,style:{borderTopWidth:1,borderColor:d.colours.hairline,paddingTop:6,gap:4},children:[(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsxs)(n.T,{style:{flex:1},colour:l?d.colours.gold:d.colours.text,children:[l?'\u2713 ':'',s.text]}),P?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2191",accessibilityLabel:`Move ${s.text} up`,disabled:0===i,onPress:()=>B((0,c.move)(x,i,-1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2193",accessibilityLabel:`Move ${s.text} down`,disabled:i===x.length-1,onPress:()=>B((0,c.move)(x,i,1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"Days",onPress:()=>I($===s.id?null:s.id)}),(0,k.jsx)(t.GoldClose,{size:"sm",testID:`task-remove-${i}`,label:`Remove ${s.text}`,onPress:()=>A(s)})]}):null]}),(0,k.jsxs)(n.Muted,{size:12,children:[s.days?.length?s.days.map(e=>c.TASK_DAY_NAMES[e]).join(', '):'Every day',l?` \xb7 ticked by ${l.byName.split(' ')[0]} at ${b(l.at)}`:'']}),$===s.id?(0,k.jsx)(n.Row,{wrap:!0,gap:4,children:f.map(e=>{const t=!!s.days?.includes(e);return(0,k.jsx)(n.Chip,{label:c.TASK_DAY_NAMES[e],selected:t,onPress:()=>B(x.map(i=>i.id===s.id?{...i,days:t?(i.days??[]).filter(s=>s!==e):[...i.days??[],e].sort()}:i))},e)})}):null]},s.id)}),P?(0,k.jsxs)(o.default,{style:{gap:6},children:[(0,k.jsx)(n.Row,{wrap:!0,gap:4,children:j.filter(e=>!x.some(s=>s.text.toLowerCase()===e.text.toLowerCase())).slice(0,12).map(s=>(0,k.jsx)(n.Chip,{testID:"task-lib-chip",label:`${s.text}`,onPress:()=>M.addTask(e,u.id,s.text,s.id)},s.id))}),(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:"New task",testID:`task-new-${u.id}`,value:C,onChangeText:S,placeholder:"Type a task, e.g. Restock the bar fridges",placeholderTextColor:d.colours.muted,style:{...p,flex:1},onSubmitEditing:()=>{(0,c.cleanTaskText)(C)&&(M.addTask(e,u.id,C),S(''))}}),(0,k.jsx)(n.Button,{small:!0,testID:`task-add-${u.id}`,label:"Add",disabled:!(0,c.cleanTaskText)(C),onPress:()=>{M.addTask(e,u.id,C),S('')}})]})]}):(0,k.jsx)(n.Muted,{size:12,children:'staff'===y?.role?'You can\u2019t change this list.':''})]}):null]})}},1047,[874,835,31,264,128,818,825,1266,1267,1245,980,1099,863,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.readBack=B,_e.ReviewSheet=L,_e.Bars=z,_e.CashCharts=A,_e.CashUpScreen=function(e){return e.closer?(0,$.jsx)(N,{rid:e.rid,tonight:e.today,who:e.who}):(0,$.jsx)(E,{...e})},_e.CloserCashUp=N,_e.PastDayCard=O,_e.TodaysTipsCard=function({rid:e,today:t,big:s}){const a=(0,f.useTipsShow)(e),o=(0,f.useCashUp)(e=>e.tips).filter(s=>s.rid===e&&(s.date===t||s.date===(0,x.addDaysYmd)(t,-1))).sort((e,t)=>t.date.localeCompare(e.date))[0],l=G(o?.total??0);return a.showToday&&o?(0,$.jsx)(p.Card,{highlight:y.colours.gold,children:(0,$.jsxs)(c.default,{testID:"todays-tips",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,$.jsx)(Y,{n:Math.ceil(o.total/25)}),(0,$.jsxs)(c.default,{style:{flex:1,gap:2},children:[(0,$.jsx)(p.T,{size:12,weight:"semibold",colour:y.colours.gold,style:{letterSpacing:1.5},children:o.date===t?'TODAY\u2019S TIPS':'LAST NIGHT\u2019S TIPS'}),(0,$.jsx)(p.T,{size:s?40:32,weight:"bold",colour:y.colours.goldLight,children:P(l)}),(0,$.jsxs)(p.Muted,{children:["Cash + card tips for the whole team \xb7 ",M(o.date),". Thank you, everyone."]})]})]})}):null},_e.TipsPotCard=V,_e.postTipsNotice=K,_e.latestDayTips=Z,_e.useTipsPosted=function(e,t,s=!0){const a=(0,f.useCashUp)(e=>e.tips),o=(0,f.useTipsShow)(e);(0,l.useEffect)(()=>{if(!s||!o.showToday)return;const l=Z(a,e,t);l&&K(e,l.date,l.total,t)},[e,t,a,o.showToday,s])},_e.CashUpSettings=function({rid:e}){const t=U(e),s=(t,s)=>f.useCashUp.getState().setFields(e,t,s),l=(e,l)=>(0,$.jsxs)(c.default,{style:{gap:6},children:[(0,$.jsx)(p.T,{weight:"semibold",children:l}),t[e].map((l,n)=>(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(o.TextInput,{testID:`cf-${e}-${l.key}`,value:l.label,onChangeText:a=>s(e,t[e].map((e,t)=>t===n?{...e,label:a.slice(0,40)}:e)),style:{flex:1,minHeight:38,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',color:y.colours.text,paddingHorizontal:8}}),(0,$.jsx)(p.Muted,{children:'money'===l.kind?'\xa3':'number'===l.kind?'#':'text'}),l.fixed?(0,$.jsx)(p.Muted,{children:"needed"}):(0,$.jsx)(a.GoldClose,{size:"sm",label:`Remove ${l.label}`,onPress:()=>s(e,t[e].filter((e,t)=>t!==n))})]},l.key)),(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"secondary",label:"Money figure",onPress:()=>s(e,[...t[e],{key:`f${Date.now().toString(36)}`,label:'New figure',kind:'money'}])}),(0,$.jsx)(p.Button,{small:!0,kind:"secondary",label:"Number",onPress:()=>s(e,[...t[e],{key:`n${Date.now().toString(36)}`,label:'New number',kind:'number'}])})]})]});return(0,$.jsxs)(c.default,{testID:"cashup-settings",style:{gap:12},children:[(0,$.jsx)(p.Muted,{children:"Tip: match these to the boxes on your paper cash up sheet and till printout. Cash tips total and Card tips total are needed for Today\u2019s tips and the Tips pot."}),l('cashFields','Cash up sheet'),l('salesFields','Weekly sales report')]})},_e.TipsSettings=function({rid:e}){const t=(0,f.useTipsShow)(e);return(0,$.jsxs)(c.default,{testID:"tips-settings",style:{gap:8},children:[(0,$.jsx)(p.Muted,{children:"Staff only ever see the team total: never anyone\u2019s share or pay. The Display never shows tips or money."}),(0,$.jsx)(p.Toggle,{testID:"tips-show-today",label:"Show Today\u2019s tips in the staff apps",value:t.showToday,onChange:t=>f.useCashUp.getState().setShow(e,{showToday:t})}),(0,$.jsx)(p.Toggle,{testID:"tips-show-pot",label:"Show the Tips pot in the staff apps",value:t.showPot,onChange:t=>f.useCashUp.getState().setShow(e,{showPot:t})})]})};var t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),n=e(_r(_d[5])),r=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),h=e(_r(_d[9])),c=e(_r(_d[10])),u=e(_r(_d[11])),p=_r(_d[12]),y=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),k=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]),T=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),I=_r(_d[26]),$=_r(_d[27]);const P=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,M=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function B(e){const t=t=>'number'==typeof e[t]?e[t]:null,s=(0,x.combinedTips)(e);return[['Gross',t('gross')],['card',t('card')],['cash',t('cash')],['tips',s],['food',t('food')],['drink',t('drink')]].filter(([,e])=>null!=e).map(([e,t])=>`${e} ${P(t)}`).join(', ')}function R({p:e,h:s}){const[a,o]=(0,l.useState)(e.startsWith('data:')?e:null),n=e.startsWith('data:')||(0,w.photosAllowed)();return(0,l.useEffect)(()=>{!a&&n&&(0,w.photoUrl)(e).then(o)},[e,n]),n?a?(0,$.jsx)(d.default,{source:{uri:a},style:{width:'100%',height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#111')},resizeMode:"contain"}):(0,$.jsx)(c.default,{style:{height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(p.Muted,{children:"Photo"})}):(0,$.jsx)(c.default,{testID:"photo-owners-only",accessible:!0,accessibilityLabel:"Taking-sheet photo. Only owners can view saved photos.",style:{height:Math.min(s,90),borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center',padding:10},children:(0,$.jsx)(p.Muted,{center:!0,children:"Photo saved. Only owners can view it."})})}function L({draft:e,fields:t,onClose:s,onConfirm:n,keyLabel:r,onKey:i,keyChoices:d}){const{width:h,height:f}=(0,u.default)(),m=h>=820;e.only&&(t=t.filter(t=>e.only.includes(t.key)));const[k,b]=(0,l.useState)(()=>Object.fromEntries(t.map(t=>[t.key,(0,x.isBlank)(e.vals[t.key])?'':String(e.vals[t.key])]))),[j,w]=(0,l.useState)(()=>e.categories.map(e=>({name:e.name,amount:String(e.amount)}))),[C,T]=(0,l.useState)(!1),v=Object.fromEntries(t.map(e=>[e.key,'text'===e.kind?k[e.key]?.trim()||null:(0,x.parseAmount)(k[e.key]??'',e.kind)])),S=t.filter(e=>'text'!==e.kind&&(k[e.key]??'').trim()&&null==v[e.key]).map(e=>e.key),D=(0,x.missing)(t,v),I=j.map(e=>({name:e.name.trim(),amount:(0,x.parseAmount)(e.amount)})).filter(e=>e.name),P=I.some(e=>null==e.amount),M=e=>({minHeight:42,borderRadius:10,borderWidth:e?2:1,borderColor:e?y.colours.amber:'rgba(255,255,255,0.15)',backgroundColor:e?'rgba(232,168,56,0.08)':'#141312',color:y.colours.text,paddingHorizontal:10,fontSize:17}),B=(0,$.jsx)(c.default,{testID:"review-photos",style:{gap:8,flex:m?1:void 0},children:e.photos.length?e.photos.map((t,s)=>(0,$.jsx)(R,{p:t,h:m?Math.max(300,.62*f/Math.min(2,e.photos.length)):260},s)):(0,$.jsx)(p.Muted,{children:"No photo: typed by hand."})}),L=(0,$.jsxs)(c.default,{testID:"review-fields",style:{gap:8,flex:m?1:void 0},children:[(0,$.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(p.Muted,{children:r}),d.map(t=>(0,$.jsx)(p.Chip,{label:t.label,selected:e.key===t.value,onPress:()=>i(t.value)},t.value))]}),t.map(e=>{const t='text'!==e.kind&&!(k[e.key]??'').trim()||S.includes(e.key);return(0,$.jsxs)(c.default,{style:{gap:3},children:[(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.T,{weight:"semibold",size:14,children:e.label}),t&&'text'!==e.kind?(0,$.jsx)(p.Badge,{kind:"amber",label:S.includes(e.key)?'Check this':'Not read: type it'}):null]}),(0,$.jsx)(o.TextInput,{testID:`review-${e.key}`,value:k[e.key]??'',onChangeText:t=>b(s=>({...s,[e.key]:t})),keyboardType:'text'===e.kind?'default':'decimal-pad',placeholder:'money'===e.kind?'\xa3':'number'===e.kind?'Number':'Optional',placeholderTextColor:"#777",style:M(t)})]},e.key)}),'sales'===e.kind?(0,$.jsxs)(c.default,{testID:"review-categories",style:{gap:6},children:[(0,$.jsx)(p.T,{weight:"semibold",size:14,children:"Sales by category (if the printout has them)"}),j.map((e,t)=>(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(o.TextInput,{value:e.name,onChangeText:e=>w(s=>s.map((s,a)=>a===t?{...s,name:e}:s)),placeholder:"e.g. Food",placeholderTextColor:"#777",style:[M(!1),{flex:2}]}),(0,$.jsx)(o.TextInput,{value:e.amount,onChangeText:e=>w(s=>s.map((s,a)=>a===t?{...s,amount:e}:s)),placeholder:"\xa3",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:[M(!e.amount.trim()||null==(0,x.parseAmount)(e.amount)),{flex:1}]}),(0,$.jsx)(a.GoldClose,{size:"sm",label:"Remove category",onPress:()=>w(e=>e.filter((e,s)=>s!==t))})]},t)),(0,$.jsx)(p.Button,{small:!0,kind:"secondary",testID:"review-add-cat",label:"Add a category",onPress:()=>w(e=>[...e,{name:'',amount:''}])})]}):null]});return(0,$.jsxs)(p.Sheet,{visible:!0,onClose:s,title:'cashup'===e.kind?'Check the cash up':'Check the weekly sales',maxWidth:1100,testID:"review-sheet",children:[(0,$.jsx)(p.Muted,{children:"Tip: check each figure against the photo. Nothing is saved until you tap Confirm. Amber boxes weren\u2019t read: type them, or leave them blank if the sheet doesn\u2019t have them."}),'edit'===e.reader||e.only?null:e.reader?(0,$.jsx)(p.Banner,{kind:"info",title:"Read from the photo",children:e.note}):e.photos.length?(0,$.jsx)(p.Banner,{kind:"info",title:"Type it from the photo",children:e.note}):null,m?(0,$.jsxs)(c.default,{style:{flexDirection:'row',gap:14},children:[B,L]}):(0,$.jsxs)($.Fragment,{children:[B,L]}),D.length?(0,$.jsxs)(p.Muted,{children:[D.length," figure",1===D.length?'':'s'," still blank. Blank means \u201cnot on the sheet\u201d, never zero."]}):null,(0,$.jsxs)(p.Row,{gap:8,children:[(0,$.jsx)(p.Button,{testID:"review-confirm",label:C?'Saving\u2026':'Confirm and save',disabled:C||!!S.length||P||!t.some(e=>'text'!==e.kind&&null!=v[e.key]),onPress:async()=>{T(!0),await n(v,I.map(e=>({name:e.name,amount:e.amount}))),T(!1)}}),(0,$.jsx)(p.Button,{kind:"secondary",label:"Cancel",onPress:s})]})]})}function z({data:e,height:t=140,testID:s,fmt:a=P}){const o=Math.max(1,...e.map(e=>e.value??0));return(0,$.jsxs)(c.default,{testID:s,style:{gap:4},children:[(0,$.jsx)(c.default,{style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:t},children:e.map((e,s)=>(0,$.jsxs)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'flex-end',height:t},children:[null!=e.value?(0,$.jsx)(p.T,{size:9,colour:y.colours.muted,children:a(e.value).replace('.00','')}):null,(0,$.jsx)(c.default,{style:{width:'80%',height:null==e.value?2:Math.max(3,e.value/o*(t-16)),borderRadius:4,backgroundColor:null==e.value?'#333':e.hi?y.colours.goldLight:y.colours.gold,opacity:null==e.value?.6:1}})]},s))}),(0,$.jsx)(c.default,{style:{flexDirection:'row',gap:4},children:e.map((e,t)=>(0,$.jsx)(p.T,{size:9,colour:y.colours.muted,style:{flex:1,textAlign:'center'},children:e.label},t))})]})}function A({rid:e,today:s}){const a=(0,f.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e),o=(0,f.useCashUp)(e=>e.sales).filter(t=>t.rid===e),l=(0,x.dailySeries)(a,s,14),n=(0,x.dailySeries)(a,s,14,x.combinedTips),r=(0,x.weekStartOf)(s),i=Array.from({length:8},(e,t)=>(0,x.addDaysYmd)(r,7*(t-7))).map(e=>{const t=o.find(t=>t.weekStart===e&&t.confirmedAt),s=t?.vals.net;return{label:M(e).split(' ').slice(1).join(' '),value:'number'==typeof s?s:null,hi:e===r}}),d=[...o].filter(e=>e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0],h=d?(0,x.weekCompare)(o,d.weekStart):null,u=d?.categories??[],m=Math.max(1,...u.map(e=>e.amount)),k=d?(0,x.weekCompare)(o,d.weekStart,'covers'):null;return(0,$.jsxs)(c.default,{testID:"cash-charts",style:{gap:12},children:[(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Takings, last 14 days"}),(0,$.jsx)(p.Muted,{children:"Card + cash from confirmed cash ups. A grey line means no cash up that day."}),(0,$.jsx)(z,{testID:"chart-daily",data:l.map(e=>({label:M(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Tips, last 14 days"}),(0,$.jsx)(p.Muted,{children:"Cash + card tips, team total."}),(0,$.jsx)(z,{testID:"chart-tips",height:100,data:n.map(e=>({label:M(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Weekly net sales"}),h&&null!=h.now?(0,$.jsx)(c.default,{testID:"week-compare",children:(0,$.jsxs)(p.T,{size:15,children:["Week of ",M(d.weekStart),": ",P(h.now),null!=h.prev?` \xb7 week before ${P(h.prev)}`:'',null!=h.change?` \xb7 ${h.change>=0?'\u25b2':'\u25bc'} ${Math.abs(h.change)}%`:'']})}):(0,$.jsx)(p.Muted,{children:"No weekly sales report yet."}),k&&null!=k.now?(0,$.jsxs)(p.Muted,{children:["Covers ",k.now,null!=k.prev?` (week before ${k.prev})`:'']}):null,(0,$.jsx)(z,{testID:"chart-weekly",data:i})]}),u.length?(0,$.jsxs)(p.Card,{children:[(0,$.jsxs)(p.T,{weight:"semibold",children:["By category, week of ",M(d.weekStart)]}),(0,$.jsx)(c.default,{testID:"chart-categories",style:{gap:6},children:u.map(e=>(0,$.jsxs)(c.default,{style:{gap:2},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(p.T,{size:14,children:e.name}),(0,$.jsx)(p.T,{size:14,colour:y.colours.goldLight,children:P(e.amount)})]}),(0,$.jsx)(c.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2826')},children:(0,$.jsx)(c.default,{style:{width:e.amount/m*100+"%",height:10,borderRadius:5,backgroundColor:y.colours.gold}})})]},e.name))})]}):null]})}function U(e){const t=(0,f.useCashSettings)(e),s=(0,m.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings.cashUpRecord);return(0,l.useMemo)(()=>({...t,record:s,cashFields:(0,x.cashFieldsForRecord)(t.cashFields,s)}),[t,s])}const F=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}):'',W=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`;function N({rid:e,tonight:t,who:s}){const a=U(e),o=(0,f.useCashUp)(e=>e.cashUps).find(s=>s.rid===e&&s.date===t),[r,i]=(0,l.useState)(null),[d,u]=(0,l.useState)(null),[m,k]=(0,l.useState)(!1),b=!!o?.confirmedAt,j=async e=>{if(b)return;const s=e?await(0,w.pickPhotos)({source:e}):[];if(e&&!s.length)return void u('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');let o,l={vals:{},reader:null,note:'Type the figures from the sheet.'};s.length&&(k(!0),u('Reading the photo\u2026'),o=await Promise.all(s.map((e,s)=>(0,w.uploadPhoto)('cashup',t,e,s))),l=await(0,C.readSheet)('cashup',o.filter(e=>!!e),a.cashFields),k(!1),u(null)),i({kind:'cashup',key:t,photos:s,vals:l.vals,categories:[],unread:(0,x.missing)(a.cashFields,l.vals),note:l.note,reader:l.reader,uploaded:o})},T=async a=>{if(!r||b)return void i(null);const o=r.uploaded&&r.uploaded.length===r.photos.length?r.uploaded:await Promise.all(r.photos.map((e,s)=>(0,w.uploadPhoto)('cashup',t,e,s))),l=r.photos.map((e,t)=>o[t]??e);f.useCashUp.getState().saveCashUp({rid:e,date:t,vals:a,photos:l,confirmedBy:s.name,confirmedAt:(new Date).toISOString(),readBy:r.reader});const d=B(a);u(`Tonight\u2019s cash up is saved and signed off${d?`: ${d}`:''}.${o.some(e=>null==e)&&r.photos.length?' The photo will be sent when this phone is back online.':''}`);try{n.default.announceForAccessibility?.(`Saved and signed off. ${d}`)}catch{}i(null)};return(0,$.jsxs)(c.default,{testID:"cashup-screen",style:{gap:12,alignItems:'center',width:'100%'},children:[d?(0,$.jsx)(p.Banner,{kind:"info",children:d}):null,(0,$.jsx)(p.Card,{highlight:y.colours.gold,children:(0,$.jsxs)(c.default,{testID:"closer-cashup",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:20,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Tonight\u2019s cash up"}),(0,$.jsxs)(p.T,{center:!0,size:15,colour:y.colours.muted,testID:"closer-day",children:[M(t)," \xb7 ",W(t)]}),b?(0,$.jsxs)(c.default,{testID:"closer-done",accessible:!0,accessibilityLabel:`Tonight's cash up is done. Submitted by ${o?.confirmedBy??'someone'} at ${F(o?.confirmedAt)}. ${B(o.vals)}. It is signed off. If something is wrong, ask an owner to unlock it.`,style:{alignItems:'center',gap:6,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:18,weight:"semibold",colour:y.colours.goldLight,children:"Done and signed off"}),(0,$.jsxs)(p.T,{center:!0,size:15,children:["Submitted by ",o?.confirmedBy??'\u2014'," at ",F(o?.confirmedAt)]}),(0,$.jsx)(p.T,{center:!0,size:15,children:B(o.vals)||'No figures'}),o.photos.length?(0,$.jsxs)(p.Muted,{center:!0,size:13,children:[o.photos.length," photo",o.photos.length>1?'s':''," of the taking sheet sent to the owners."]}):null,(0,$.jsx)(p.Muted,{center:!0,size:13,children:"If something is wrong, ask an owner to unlock it."})]}):(0,$.jsxs)($.Fragment,{children:[a.record?.length?(0,$.jsxs)(c.default,{testID:"cashup-record",accessibilityLabel:`What to record at nightly cash up. ${a.record.join(', ')}`,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"What to record"}),a.record.map(e=>(0,$.jsx)(p.T,{center:!0,children:e},e))]}):null,(0,$.jsx)(h.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:m,onPress:()=>{j('camera')},style:({pressed:e})=>({minHeight:64,width:'100%',borderRadius:16,backgroundColor:e?y.colours.goldLight:y.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:m?.5:1}),children:(0,$.jsx)(p.T,{center:!0,size:20,weight:"semibold",colour:y.colours.onGold,children:m?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,$.jsx)(p.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{j('gallery')}}),(0,$.jsx)(p.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{j(null)}})]}),(0,$.jsx)(p.Muted,{center:!0,size:13,children:"Check the figures, then Confirm. Once confirmed it\u2019s signed off, and the photo goes to the owners only."})]})]})}),(0,$.jsx)(p.Muted,{center:!0,size:12,testID:"closer-note",children:"You can do tonight\u2019s cash up only. Past takings, charts and sales reports are for owners and managers."}),r?(0,$.jsx)(L,{draft:r,fields:a.cashFields,onClose:()=>i(null),onConfirm:e=>T(e),keyLabel:"Day",keyChoices:[{label:'Tonight',value:t}],onKey:()=>{}},`closer-${r.photos.length}`):null]})}function E({rid:e,today:t,canEdit:s,who:a,chartsOnly:o,backdate:r}){const i=U(e),d=(0,f.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e).sort((e,t)=>t.date.localeCompare(e.date)),u=(0,f.useCashUp)(e=>e.sales).filter(t=>t.rid===e).sort((e,t)=>t.weekStart.localeCompare(e.weekStart)),[m,k]=(0,l.useState)(null),[b,j]=(0,l.useState)(null),D=(0,v.useLockedFor)(e),[I,R]=(0,l.useState)(!1),[z,F]=(0,l.useState)(null),W=async(e,s,a,o)=>{const l=a??('cashup'===e?t:(0,x.weekStartOf)((0,x.addDaysYmd)(t,-7)));if(D(e,l))return void j((0,v.lockedMessage)(e,l));const n=s?await(0,w.pickPhotos)({source:s}):[];if(s&&!n.length)return void j('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');const r='cashup'===e?i.cashFields:i.salesFields;let h,c={vals:{},reader:null,note:'Type the figures from the sheet.',categories:[]};n.length&&(R(!0),j('Reading the photo\u2026'),h=await Promise.all(n.map((t,s)=>(0,w.uploadPhoto)(e,l,t,s))),c=await(0,C.readSheet)(e,h.filter(e=>!!e),r),R(!1),j(null));const u=o&&'cashup'===e?d.find(e=>e.date===l)?.vals:void 0;k({kind:e,key:l,photos:n,vals:u?{...c.vals,...u}:c.vals,categories:c.categories??[],unread:(0,x.missing)(r,c.vals),note:c.note,reader:o?'edit':c.reader,uploaded:h,only:o})},N=[0,1,2].map(e=>({label:0===e?'Today':1===e?'Yesterday':M((0,x.addDaysYmd)(t,-e)),value:(0,x.addDaysYmd)(t,-e)}));'cashup'!==m?.kind||N.some(e=>e.value===m.key)||N.push({label:M(m.key),value:m.key});const E=[0,1,2].map(e=>{const s=(0,x.weekStartOf)((0,x.addDaysYmd)(t,-7*e));return{label:0===e?'This week':1===e?'Last week':`w/c ${M(s)}`,value:s}});return(0,$.jsxs)(c.default,{testID:"cashup-screen",style:{gap:12},children:[(0,$.jsx)(p.Muted,{children:"Tip: at the end of the night, tap Take a picture of the taking sheet: the figures are filled in from the photo for you to check beside it, then Confirm. Bigger venues can Upload a spreadsheet (CSV or Excel) for one night or several. Gross takings feed Spend per head. Head Chefs can see the graphs."}),b?(0,$.jsx)(p.Banner,{kind:"info",children:b}):null,(0,$.jsx)(V,{rid:e,today:t,manage:s,who:a}),s&&!o?(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"End of night cash up"}),i.record?.length?(0,$.jsxs)(c.default,{testID:"cashup-record",accessibilityLabel:`What to record at nightly cash up. ${i.record.join(', ')}`,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"What to record at nightly cash up"}),i.record.map(e=>(0,$.jsx)(p.T,{center:!0,children:e},e))]}):null,(0,$.jsx)(h.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:I,onPress:()=>{W('cashup','camera')},style:({pressed:e})=>({minHeight:64,borderRadius:16,backgroundColor:e?y.colours.goldLight:y.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:I?.5:1}),children:(0,$.jsx)(p.T,{size:20,weight:"semibold",colour:y.colours.onGold,children:I?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(p.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{W('cashup','gallery')}}),(0,$.jsx)(p.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{W('cashup',null)}}),(0,$.jsx)(p.Button,{testID:"cashup-sheet",kind:"secondary",label:"Upload a spreadsheet",accessibilityLabel:"Upload a spreadsheet of takings, CSV or Excel, for one night or several",onPress:async()=>{const e=await(0,T.pickSpreadsheet)();e&&('error'in e?j(e.error):F(e))}}),(0,$.jsx)(p.Button,{testID:"cashup-takings",kind:"secondary",label:"Enter takings",accessibilityLabel:"Enter tonight's takings: gross, and food and drink if you have them",onPress:()=>{W('cashup',null,t,x.TAKINGS_KEYS)}})]}),(0,$.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"Weekly sales report"}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(p.Button,{testID:"upload-sales",label:"Upload weekly sales report",onPress:()=>{W('sales','camera')}}),(0,$.jsx)(p.Button,{testID:"sales-gallery",kind:"secondary",label:"Choose from gallery",onPress:()=>{W('sales','gallery')}}),(0,$.jsx)(p.Button,{testID:"sales-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{W('sales',null)}})]}),(0,$.jsx)(p.Muted,{children:"Several pages? Pick them all at once. Fields can be changed in Settings \u203a Advanced \u203a Cash up."})]}):null,s&&r&&!o?(0,$.jsx)(O,{today:t,has:e=>d.some(t=>t.date===e),paid:t=>(0,S.paidOutFor)(t,f.useCashUp.getState().pot,e),onOpen:e=>{if(D('cashup',e))return void j((0,v.lockedMessage)('cashup',e));const t=d.find(t=>t.date===e);k({kind:'cashup',key:e,photos:t?.photos??[],vals:t?.vals??{},categories:[],unread:[],note:t?'':'Type the figures for that day.',reader:'edit'})}}):null,(0,$.jsx)(A,{rid:e,today:t}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Recent cash ups"}),d.length?d.slice(0,10).map(e=>(0,$.jsxs)(c.default,{testID:`cashup-row-${e.date}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)',gap:2},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(p.T,{weight:"semibold",children:M(e.date)}),(0,$.jsx)(p.T,{colour:y.colours.goldLight,children:P((0,x.takings)(e.vals))})]}),(0,$.jsx)(p.Muted,{children:i.cashFields.filter(e=>'text'!==e.kind&&'card'!==e.key&&'cash'!==e.key).map(t=>`${t.label} ${(0,x.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?P(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),(0,$.jsxs)(p.Muted,{children:["Confirmed by ",e.confirmedBy??'\u2014',e.photos.length?` \xb7 ${e.photos.length} photo${e.photos.length>1?'s':''}`:'']}),(0,S.historyLines)(e.vals).slice(0,3).map(t=>(0,$.jsx)(p.Muted,{size:12,testID:`cashup-later-${e.date}`,children:t},t)),s&&!D('cashup',e.date)?(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit",onPress:()=>k({kind:'cashup',key:e.date,photos:e.photos,vals:e.vals,categories:[],unread:[],note:'',reader:'edit'})}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:`takings-edit-${e.date}`,label:null==(0,x.grossOf)(e.vals)?'Add takings':'Edit takings',onPress:()=>k({kind:'cashup',key:e.date,photos:[],vals:e.vals,categories:[],unread:[],note:'',reader:'edit',only:x.TAKINGS_KEYS})})]}):null,s?(0,$.jsx)(v.CashLockControls,{kind:"cashup",item:e,label:M(e.date)}):null]},e.id)):(0,$.jsx)(p.Muted,{children:"None yet."})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Weekly sales reports"}),u.length?u.slice(0,8).map(e=>(0,$.jsxs)(c.default,{style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(p.T,{weight:"semibold",children:["w/c ",M(e.weekStart)]}),(0,$.jsx)(p.T,{colour:y.colours.goldLight,children:P('number'==typeof e.vals.net?e.vals.net:null)})]}),(0,$.jsx)(p.Muted,{children:i.salesFields.filter(e=>'net'!==e.key).map(t=>`${t.label} ${(0,x.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?P(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),s?(0,$.jsx)(v.CashLockControls,{kind:"sales",item:e,label:`w/c ${M(e.weekStart)}`}):null]},e.id)):(0,$.jsx)(p.Muted,{children:"None yet."})]}),z?(0,$.jsx)(T.SpreadsheetImport,{rid:e,file:z,who:a,locked:e=>D('cashup',e),onClose:()=>F(null),onSaved:e=>{j(e),F(null)}}):null,m?(0,$.jsx)(L,{draft:m,fields:'cashup'===m.kind?i.cashFields:i.salesFields,onClose:()=>k(null),onConfirm:async(s,o)=>{if(!m)return;if(D(m.kind,m.key))return j((0,v.lockedMessage)(m.kind,m.key)),void k(null);const l=m.uploaded&&m.uploaded.length===m.photos.length?m.uploaded:await Promise.all(m.photos.map((e,t)=>(0,w.uploadPhoto)(m.kind,m.key,e,t))),r=m.photos.map((e,t)=>l[t]??e),i=(new Date).toISOString();if('cashup'===m.kind){const o=d.find(e=>e.date===m.key),l=m.only&&o?{...o.vals,...s}:s,h=m.keynull==e)&&m.photos.length&&j(e=>`${e??''} The photo is kept on this device only (not signed in or offline).`),k(null)},keyLabel:'cashup'===m.kind?'Day':'Week starting',keyChoices:'cashup'===m.kind?N:E,onKey:e=>k({...m,key:e})},`${m.kind}-${m.photos.length}`):null]})}function O({today:e,has:t,paid:a,onOpen:o}){const[n,r]=(0,l.useState)((0,x.addDaysYmd)(e,-1)),[i,d]=(0,l.useState)((0,I.ukHistoryDate)((0,x.addDaysYmd)(e,-1))),[h,u]=(0,l.useState)(!1),f=(0,I.parseHistoryInput)(i)??'',m=(0,S.backdateProblem)(f,e),k=m?n:f,b=!m&&t(k),j=m?null:a(k),w=e=>{r(e),d((0,I.ukHistoryDate)(e))};return(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsxs)(c.default,{testID:"cashup-backdate",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:20,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Cash up for another day"}),(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.text,children:"Missed a night? Enter or correct takings and tips for any past day. It counts on that day everywhere."}),(0,$.jsx)(c.default,{style:{width:'100%',maxWidth:360},children:(0,$.jsx)(p.Field,{label:"Day (DD/MM/YYYY)",value:i,onChangeText:e=>d((0,s.slashDate)(e,i)),placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"cashup-backdate-date",style:{textAlign:'center'},accessibilityLabel:"Day of the cash up, as day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1})}),m?(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.amber,testID:"cashup-backdate-problem",children:m}):(0,$.jsx)(c.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cashup-backdate-status",children:(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.goldLight,children:b?`There is already a cash up for ${M(k)}: it opens for editing.`:`No cash up yet for ${M(k)}.`})}),j?(0,$.jsx)(c.default,{testID:"cashup-backdate-paid",style:{borderWidth:1,borderColor:y.colours.amber,borderRadius:10,padding:10,maxWidth:520},children:(0,$.jsxs)(p.T,{center:!0,size:14,colour:y.colours.amber,children:["Tips up to ",M(j.throughDate)," were already paid out. Tips you add for this day won\u2019t be in the pot automatically: add a correction in the Tips pot if they should still be shared."]})}):null,(0,$.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center'},children:[(0,$.jsx)(p.Button,{kind:"secondary",label:"Pick a date",testID:"cashup-backdate-pick",accessibilityLabel:`Pick a day from a calendar. Now ${m?'no valid day':M(k)}`,onPress:()=>u(!0),style:{minHeight:56}}),(0,$.jsx)(p.Button,{label:m?'Open cash up':b?`Edit cash up for ${M(k)}`:`Add cash up for ${M(k)}`,testID:"cashup-backdate-open",disabled:!!m,accessibilityLabel:m?'Open cash up, enter a valid past day first':`${b?'Edit':'Add'} the cash up for ${M(k)}`,onPress:()=>{w(k),o(k)},style:{minHeight:56}})]}),(0,$.jsxs)(p.Muted,{center:!0,children:["Saved with your name and the time, e.g. \u201cAdded later by you, ",M(e),"\u201d. Nothing is sent to anyone."]})]}),(0,$.jsx)(D.LookBackCalendar,{visible:h,today:e,selected:m?n:k,purpose:"Cash up for another day",idPrefix:"cashup-backdate",onClose:()=>u(!1),onPick:e=>{w(e),u(!1)}})]})}function Y({n:e,testID:t}){const s=Math.max(1,Math.min(14,e));return(0,$.jsx)(c.default,{testID:t,style:{width:64,height:114,justifyContent:'flex-end'},children:Array.from({length:s}).map((e,t)=>(0,$.jsx)(H,{delay:50*t},t))})}function H({delay:e}){const t=(0,l.useRef)(new r.default.Value(1)).current;return(0,l.useEffect)(()=>{r.default.timing(t,{toValue:0,duration:420,delay:e,easing:i.default.out(i.default.back(1.6)),useNativeDriver:!1}).start()},[]),(0,$.jsx)(r.default.View,{style:{height:7,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[0,-120]})}],opacity:t.interpolate({inputRange:[0,1],outputRange:[1,0]})},children:(0,$.jsx)(c.default,{style:{width:60,height:12,borderRadius:30,backgroundColor:y.colours.gold,borderWidth:1,borderColor:y.colours.goldLight}})})}function G(e){const[t,s]=(0,l.useState)(e),a=(0,l.useRef)(e);return(0,l.useEffect)(()=>{const t=a.current,o=e;if(t===o)return;const l=Date.now(),n=setInterval(()=>{const e=Math.min(1,(Date.now()-l)/1200);s(Math.round(100*(t+(o-t)*(1-Math.pow(1-e,3))))/100),e>=1&&(clearInterval(n),a.current=o)},40);return()=>clearInterval(n)},[e]),t}function V({rid:e,today:t,manage:s,who:a,big:o}){const n=(0,f.useTipsShow)(e),r=(0,f.useCashUp)(e=>e.tips).filter(t=>t.rid===e),i=(0,f.useCashUp)(e=>e.pot).filter(t=>t.rid===e),d=(0,b.useVenuePay)(e).pay,h=(0,k.tipsPeriod)(d,t),u=(0,l.useMemo)(()=>(0,x.tipsPot)(r,i,h.start,t),[r,i,h.start,t]),m=G(u.total),[j,w]=(0,l.useState)(null);return n.showPot||s?(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsxs)(c.default,{testID:"tips-pot",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,$.jsx)(Y,{n:Math.ceil(u.total/100),testID:"tips-pot-coins"},u.total),(0,$.jsxs)(c.default,{style:{flex:1,gap:2},children:[(0,$.jsx)(p.T,{size:12,weight:"semibold",colour:y.colours.gold,style:{letterSpacing:1.5},children:"TIPS POT"}),(0,$.jsx)(p.T,{size:o?40:32,weight:"bold",colour:y.colours.goldLight,children:P(m)}),(0,$.jsxs)(p.Muted,{children:["Tips held for the team since ",M(u.from),h.payday?` \xb7 next tip payday ${M(h.payday)}`:'',". Confirmed cash ups only.",n.showPot?'':' (Hidden from staff.)']})]})]}),s?(0,$.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"secondary",testID:"pot-payout",label:"Mark payout done",onPress:()=>w('payout')}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:"pot-correct",label:"Correct an entry",onPress:()=>w('correct')}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:"pot-history",label:"Past pots",onPress:()=>w('history')})]}):null,'payout'===j?(0,$.jsxs)(p.Sheet,{visible:!0,onClose:()=>w(null),title:"Mark payout done",maxWidth:520,testID:"pot-payout-sheet",children:[(0,$.jsxs)(p.T,{children:["Pay out ",P(u.total)," (tips from ",M(u.from)," to ",M(t),")?"]}),(0,$.jsx)(p.Muted,{children:"The pot goes back to \xa30.00 for the next period. This is logged and kept in Past pots. No money is moved by the app."}),(0,$.jsx)(p.Button,{testID:"pot-payout-confirm",label:"Yes, payout done",onPress:()=>{f.useCashUp.getState().addPotEvent({rid:e,kind:'payout',throughDate:t,amount:u.total,by:a?.name??'Manager'}),w(null)}})]}):null,'correct'===j?(0,$.jsx)(_,{rid:e,today:t,who:a,onClose:()=>w(null)}):null,'history'===j?(0,$.jsxs)(p.Sheet,{visible:!0,onClose:()=>w(null),title:"Past pots and corrections",maxWidth:560,testID:"pot-history-sheet",children:[u.history.length||i.some(e=>'correction'===e.kind)?null:(0,$.jsx)(p.Muted,{children:"No payouts or corrections yet."}),i.slice().sort((e,t)=>t.at.localeCompare(e.at)).map(e=>(0,$.jsxs)(c.default,{style:{paddingVertical:4},children:[(0,$.jsx)(p.T,{weight:"semibold",children:'payout'===e.kind?`Paid out ${P(e.amount)}`:`Correction ${e.amount>=0?'+':'\u2212'}${P(Math.abs(e.amount))} for ${M(e.forDate)}`}),(0,$.jsxs)(p.Muted,{children:['payout'===e.kind?`Tips to ${M(e.throughDate)}`:`\u201c${e.reason}\u201d`," \xb7 ",e.by," \xb7 ",new Date(e.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]})]},e.id))]}):null]}):null}function _({rid:e,today:s,who:a,onClose:n}){const[r,i]=(0,l.useState)(s),[d,h]=(0,l.useState)(''),[c,u]=(0,l.useState)(''),m=(0,x.parseAmount)(d),k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',backgroundColor:(0,t.soutersSurface)('#141312'),color:y.colours.text,paddingHorizontal:10,fontSize:16};return(0,$.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Correct an entry",maxWidth:520,testID:"pot-correct-sheet",children:[(0,$.jsx)(p.Muted,{children:"Tip: add or take off an amount for a day (use a minus for less, e.g. -5). Every correction is logged with your name and the reason."}),(0,$.jsx)(p.Row,{wrap:!0,gap:6,children:[0,1,2,3].map(e=>{const t=(0,x.addDaysYmd)(s,-e);return(0,$.jsx)(p.Chip,{label:0===e?'Today':M(t),selected:r===t,onPress:()=>i(t)},t)})}),(0,$.jsx)(o.TextInput,{testID:"pot-correct-amount",value:d,onChangeText:h,placeholder:"\xa3 e.g. -5.00",placeholderTextColor:"#777",keyboardType:"numbers-and-punctuation",style:k}),(0,$.jsx)(o.TextInput,{testID:"pot-correct-reason",value:c,onChangeText:u,placeholder:"Reason (required)",placeholderTextColor:"#777",maxLength:200,style:k}),(0,$.jsx)(p.Button,{testID:"pot-correct-save",label:"Save correction",disabled:null==m||0===m||!c.trim(),onPress:()=>{f.useCashUp.getState().addPotEvent({rid:e,kind:'correction',forDate:r,amount:m,reason:c.trim(),by:a?.name??'Manager'}),n()}})]})}function K(e,t,s,a){if(!Number.isFinite(s))return;const o=`${e}:${t}`;f.useCashUp.getState().seen[o]!==s&&(f.useCashUp.getState().markSeen(o,s),(0,j.notify)({id:`tips-${o}`,icon:'\ud83e\ude99',kicker:'TIPS',title:`${t===a?'Today\u2019s':'Last night\u2019s'} tips: ${P(s)}`,body:'Cash + card tips for the whole team. Added to the Tips pot. Thank you, everyone.',testID:'tips-notice',timeoutMs:12e3,actions:[{label:'Nice',testID:'tips-notice-ok',onPress:()=>{}}]}))}function Z(e,t,s){return e.filter(e=>e.rid===t&&e.date>=(0,x.addDaysYmd)(s,-1)&&e.date<=s).sort((e,t)=>t.date.localeCompare(e.date))[0]}},1048,[876,834,835,874,31,119,121,225,197,264,128,288,818,825,1050,881,13,1365,1366,980,1072,1379,1380,1383,1384,1385,1390,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useCashAccess",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"hasCashUpAccess",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({byRef:{},mine:null,loaded:!1,takings:null,tradingDate:null,photos:null})),n=()=>!0===t.getState().mine},1049,[995]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"cashUpId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"salesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"cashSettingsId",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"defaultCashSettings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useCashUp",{enumerable:!0,get:function(){return b}}),_e.forgetPastTakings=function(e,t){const s=b.getState(),n=s.cashUps.filter(s=>s.rid!==e||s.date===t),r=s.sales.filter(t=>t.rid!==e);n.length===s.cashUps.length&&r.length===s.sales.length||b.setState({cashUps:n,sales:r})},Object.defineProperty(_e,"useCashSettings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useTipsShow",{enumerable:!0,get:function(){return y}});var t=e(_r(d[0])),s=e(_r(d[1])),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]),u=_r(d[5]),l=_r(d[6]);const c=(e,t)=>(0,o.uuidFrom)(`cashup:${e}:${t}`),p=(e,t)=>(0,o.uuidFrom)(`sales:${e}:${t}`),h=e=>(0,o.uuidFrom)(`cashup-settings:${e}`),f=e=>({id:h(e),cashFields:u.DEFAULT_CASHUP_FIELDS.map(e=>({...e})),salesFields:u.DEFAULT_SALES_FIELDS.map(e=>({...e}))}),S=e=>{const t='number'==typeof e.vals.cashTips?e.vals.cashTips:null,s='number'==typeof e.vals.cardTips?e.vals.cardTips:null;return!e.confirmedAt||null==t&&null==s?null:{rid:e.rid,date:e.date,total:Math.round(100*((t??0)+(s??0)))/100,postedAt:e.confirmedAt,postedBy:e.confirmedBy}},b=(0,n.create)()((0,r.persist)((e,t)=>({cashUps:[],sales:[],tips:[],pot:[],settings:{},show:{},seen:{},saveCashUp:t=>{const s={...t,id:c(t.rid,t.date)},n=S(s);return e(e=>({cashUps:[s,...e.cashUps.filter(e=>e.id!==s.id)],tips:n?[n,...e.tips.filter(e=>!(e.rid===n.rid&&e.date===n.date))]:e.tips})),s},saveSales:t=>{const s={...t,id:p(t.rid,t.weekStart)};return e(e=>({sales:[s,...e.sales.filter(e=>e.id!==s.id)]})),s},setFields:(t,s,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??f(t),[s]:n,updatedAt:(new Date).toISOString()}}})),resetFields:t=>e(e=>({settings:{...e.settings,[t]:{...f(t),updatedAt:(new Date).toISOString()}}})),setShow:(t,s)=>e(e=>({show:{...e.show,[t]:{...e.show[t]??{showToday:!0,showPot:!0},...s}}})),addPotEvent:t=>e(e=>({pot:[{...t,id:(0,l.uuid)(),at:(new Date).toISOString()},...e.pot]})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:s}}))}),{name:'covercharge-cashup-v1',storage:(0,r.createJSONStorage)(()=>s.default),partialize:e=>({...e,cashUps:e.cashUps.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))})),sales:e.sales.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))}))})}));const w=e=>{const s=b(t=>t.settings[e])??f(e);return t.default.useMemo(()=>({...s,cashFields:(0,u.withTakingsFields)(s.cashFields)}),[s])},y=e=>b(t=>t.show[e])??{showToday:!0,showPot:!0}},1050,[31,1160,995,1169,1178,13,1099]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PERM_CATALOG",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PERM_KEYS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PERM_GROUPS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"permLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ROLE_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ROLE_LABEL",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ownerLevel",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"has",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ticks",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"toggle",{enumerable:!0,get:function(){return f}}),e.effectivePerms=function(t,n,a){const o=[...new Set([...t,...n])];return(o.includes('*')?o:o.filter(t=>!a.includes(t))).sort()},e.tickSource=function(t,n){return t.extra.includes(n)?'extra':t.removed.includes(n)&&!t.base.includes('*')?'removed':c(t.base,n)?'role':'off'},Object.defineProperty(e,"SOURCE_WORDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"isCloser",{enumerable:!0,get:function(){return p}}),e.tradingDay=function(t=new Date,n="Europe/London"){const a=new Date(t.getTime()-216e5),o=new Intl.DateTimeFormat('en-GB',{timeZone:n,year:'numeric',month:'2-digit',day:'2-digit'}).formatToParts(a),s=t=>o.find(n=>n.type===t)?.value??'';return`${s('year')}-${s('month')}-${s('day')}`},Object.defineProperty(e,"ukDay",{enumerable:!0,get:function(){return b}}),e.logWords=function(t){const n=t=>Array.isArray(t)?t:[],a=t=>t&&'object'==typeof t&&!Array.isArray(t)?t:{};let s=[],u=[];if('role'===t.target_kind){const a=n(t.before),o=n(t.after);s=o.filter(t=>!a.includes(t)),u=a.filter(t=>!o.includes(t))}else{const o=a(t.before),l=a(t.after),c=n(o.extra),g=n(l.extra),f=n(o.removed),d=n(l.removed);s=[...g.filter(t=>!c.includes(t)),...f.filter(t=>!d.includes(t))],u=[...d.filter(t=>!f.includes(t)),...c.filter(t=>!g.includes(t))]}const c='role'===t.target_kind?`${l[t.target_ref??'']??t.target_name??'Role'} role`:t.target_name??'Someone',g=[...s.map(t=>`+ ${o(t)}`),...u.map(t=>`\u2212 ${o(t)}`)];return`${t.changed_by_name??'Admin'}: ${c}${g.length?`, ${g.join(', ')}`:', back to their role'}`},e.logWhen=function(t){const n=new Date(t);return new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',year:'numeric',hour:'2-digit',minute:'2-digit',hour12:!1}).format(n).replace(',','')};const t=[{key:'bookings.manage',label:'Take and change bookings',group:'Bookings & floor'},{key:'bookings.settings',label:'Booking settings: times, tables and blocks',group:'Bookings & floor'},{key:'floor.manage',label:'Edit the table plan and seat tables',group:'Bookings & floor'},{key:'orders.manage',label:'Kitchen and table orders',group:'Bookings & floor'},{key:'stock.manage',label:'Stock and deliveries',group:'Kitchen & stock'},{key:'suppliers.manage',label:'Suppliers',group:'Kitchen & stock'},{key:'suppliers.order',label:'Order from suppliers',group:'Kitchen & stock'},{key:'recipes.edit',label:'Edit recipe cards and allergens',group:'Kitchen & stock'},{key:'recipes.signoff',label:'Sign off recipe cards',group:'Kitchen & stock'},{key:'attendance.view',label:'See everyone\u2019s hours',group:'Team'},{key:'rota.manage',label:'Make the rota and approve timesheets',group:'Team'},{key:'rota.kitchen',label:'Make the kitchen rota (kitchen team only)',group:'Team',note:'Add, change and publish shifts for the kitchen team in the Head Chef app. No hours, pay or takings.'},{key:'rota.swap',label:'Approve shift swaps',group:'Team'},{key:'shift.manager',label:'Shift manager features in the Staff app',group:'Team'},{key:'staff.manage',label:'Add staff and change their details',group:'Team'},{key:'takings.view',label:'See takings, past cash ups and sales reports',group:'Money',note:'Without this, \u201cCan use cash up\u201d is tonight\u2019s cash up only.'},{key:'wages.view',label:'See pay and wages',group:'Money'},{key:'wages.manage',label:'Change pay, cash-up settings and any day\u2019s cash up',group:'Money'},{key:'venue.settings',label:'Change venue settings',group:'Venue'},{key:'devices.manage',label:'Pair and remove screens',group:'Venue'},{key:'outbox.view',label:'See messages sent to guests',group:'Venue'}],n=t.map(t=>t.key),a=[...new Set(t.map(t=>t.group))],o=n=>t.find(t=>t.key===n)?.label??n,s=['owner','manager','supervisor','head_chef','staff'],l={owner:'Owner',manager:'Manager',supervisor:'Supervisor',head_chef:'Head Chef',staff:'Staff'},u=t=>t.includes('*'),c=(t,n)=>t.includes('*')||t.includes(n),g=t=>u(t)?[...n]:n.filter(n=>t.includes(n)),f=(t,n,a)=>(a?[...new Set([...t,n])]:t.filter(t=>t!==n)).sort();const d={role:'from their role',extra:'added just for them',removed:'taken off just for them',off:'off'},p=t=>t.cashUp&&!t.takings;const b=t=>/^\d{4}-\d{2}-\d{2}$/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t},1051,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtDate",{enumerable:!0,get:function(){return j}}),_e.SignOffLine=$,_e.CardView=P,_e.CardEditor=R,_e.RecipeCards=function({rid:e,actor:s,mode:l}){const h=(0,a.useRecipeCards)(e),u=(0,n.useMemo)(()=>h.filter(e=>!c.OFF_CARD_LIST.has(e.menuItemId)),[h]),[p,x]=(0,n.useState)(''),[b,j]=(0,n.useState)([]),[C,w]=(0,n.useState)('free-from'),[I,$]=(0,n.useState)('all'),[D,T]=(0,n.useState)(null),[k,S]=(0,n.useState)(null),v='edit'===l&&(0,m.canEditCards)(s.role),B=v?u:u.filter(e=>!!e.signOff),L=(0,n.useMemo)(()=>{const e='all'===I?B:B.filter(e=>(0,m.cardState)(e)===I);return(0,m.filterCards)(e,p,b,C).slice().sort((e,t)=>e.section.localeCompare(t.section)||M(e.dish).localeCompare(M(t.dish)))},[B,p,b,C,I]),O=u.filter(e=>!e.signOff).length,A=D?u.find(e=>e.id===D):void 0,N=k&&'new'!==k?u.find(e=>e.id===k)??null:null,z=e=>j(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,y.jsxs)(r.default,{testID:"recipe-cards",style:{gap:12},children:['read'===l?(0,y.jsx)(d.Banner,{kind:"info",title:"Read-only",children:"Signed-off recipe cards only. The head chef keeps these up to date."}):(0,y.jsx)(d.Muted,{center:!0,children:(0,m.maySignOff)(s,{createdBy:s.name,createdByRole:s.role})?'You can add, edit and sign off cards. A card goes live once it is signed off. Editing a card clears the sign-off.':'You can add and edit cards. The Head Chef, an owner or a manager signs it off before it goes live. Editing a card clears the sign-off.'}),u.some(e=>'example'===e.origin)?(0,y.jsx)(d.Banner,{kind:"example",title:"Example data",children:"Cards marked \u201cExample data\u201d are made-up examples to show how recipe cards work. Replace them with your own dishes."}):null,v?(0,y.jsx)(d.Button,{testID:"new-card",label:"New recipe card",onPress:()=>S('new')}):null,(0,y.jsx)(t.TextInput,{testID:"card-search",accessibilityLabel:"Search recipe cards",value:p,onChangeText:x,placeholder:"Search dishes or ingredients",placeholderTextColor:"#7D776C",style:d.styles.input}),(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.T,{size:o.font.small,colour:o.colours.muted,children:"Allergens:"}),(0,y.jsx)(d.Chip,{label:"Free from",selected:'free-from'===C,onPress:()=>w('free-from')}),(0,y.jsx)(d.Chip,{label:"Contains",selected:'contains'===C,onPress:()=>w('contains')}),b.length?(0,y.jsx)(d.Chip,{label:"Clear",onPress:()=>j([])}):null]}),(0,y.jsx)(d.Row,{gap:6,wrap:!0,children:f.ALLERGENS.map(e=>(0,y.jsx)(i.default,{testID:`filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:b.includes(e.id)},onPress:()=>z(e.id),style:{paddingVertical:5,paddingHorizontal:10,minHeight:44,minWidth:44,justifyContent:'center',borderRadius:14,borderWidth:1,borderColor:b.includes(e.id)?o.colours.gold:o.colours.border,backgroundColor:b.includes(e.id)?o.colours.gold:'transparent'},children:(0,y.jsx)(d.T,{size:13,colour:b.includes(e.id)?o.colours.onGold:o.colours.text,children:e.short})},e.id))}),v?(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.Chip,{label:`All (${u.length})`,selected:'all'===I,onPress:()=>$('all')}),(0,y.jsx)(d.Chip,{label:`Awaiting sign-off (${O})`,selected:'awaiting'===I,onPress:()=>$('awaiting')}),(0,y.jsx)(d.Chip,{label:`Signed off (${u.length-O})`,selected:'signed-off'===I,onPress:()=>$('signed-off')})]}):null,(0,y.jsx)(r.default,{testID:"card-count",children:(0,y.jsxs)(d.Muted,{center:!0,children:[L.length," ",1===L.length?'card':'cards',b.length?` ${'free-from'===C?'free from':'containing'} ${b.map(f.allergenLabel).join('free-from'===C?' and ':' or ')}`:'']})}),L.map(e=>(0,y.jsx)(E,{c:e,actor:s,mode:l,editable:v,onPress:()=>T(e.id)},e.id)),L.length?null:(0,y.jsx)(r.default,{testID:"cards-empty",style:{alignItems:'center',paddingVertical:16},children:(0,y.jsx)(d.T,{center:!0,colour:o.colours.muted,children:u.length?'No cards match.':'No recipe cards yet.'})}),(0,y.jsx)(d.Sheet,{visible:!!A&&!k,onClose:()=>T(null),title:A?.dish??'',maxWidth:640,testID:"card-sheet",children:A?(0,y.jsx)(P,{card:A,mode:l,actor:'read'===l?{...s,role:'staff'}:s,onEdit:v?()=>S(A.id):void 0}):null}),(0,y.jsx)(d.Sheet,{visible:!!k,onClose:()=>S(null),title:'new'===k?'New recipe card':`Edit: ${N?.dish??''}`,maxWidth:680,testID:"editor-sheet",children:k?(0,y.jsx)(R,{rid:e,card:N,actor:s,onDone:e=>{S(null),T(e)}},k):null})]})},Object.defineProperty(_e,"addedLabel",{enumerable:!0,get:function(){return m.addedLabel}}),Object.defineProperty(_e,"allergenSentence",{enumerable:!0,get:function(){return m.allergenSentence}}),Object.defineProperty(_e,"unsignedOldestFirst",{enumerable:!0,get:function(){return m.unsignedOldestFirst}}),_e.useUnsignedDishes=O,_e.UnsignedDishList=function({rid:e,actor:t,onClose:s,onOpenCards:l}){const i=O(e),c=(0,a.useRecipeCards)(e),[f,p]=(0,n.useState)(null),[x,b]=(0,n.useState)(null),[j,C]=(0,n.useState)(null);(0,h.useBackLayer)(!0,s);const w=x?c.find(e=>e.id===x):void 0,I=j?c.find(e=>e.id===j)??null:null,$=async e=>{try{await(0,u.recipeCards)().signOff(e.id,t),p(null)}catch(t){p({id:e.id,text:t?.message??'Could not sign off.'})}};return(0,y.jsxs)(r.default,{testID:"unsigned-list",style:{gap:12,alignItems:'stretch'},children:[(0,y.jsx)(h.BackButton,{onPress:s,testID:"unsigned-back"}),(0,y.jsx)(d.T,{center:!0,size:22,weight:"bold",colour:o.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Dishes not signed off"}),(0,y.jsx)(d.Muted,{center:!0,testID:"unsigned-status",children:i.length?`${i.length} ${1===i.length?'dish':'dishes'} waiting, oldest first.`:'Every dish is signed off.'}),i.map(({item:e,card:s,at:n})=>{const i=(0,m.allergenSentence)(s?s.allergens:e.allergens),a=!!s&&(0,m.maySignOff)(t,s),c=s?(0,m.signOffBlock)(s):null;return(0,y.jsxs)(d.Card,{highlight:o.colours.amber,style:{alignItems:'center',gap:8},children:[(0,y.jsxs)(r.default,{testID:`unsigned-row-${e.id}`,accessible:!0,accessibilityLabel:`${e.name}, ${(0,m.addedLabel)(n)}, ${i}`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,y.jsx)(d.T,{center:!0,weight:"bold",size:18,children:e.name}),(0,y.jsx)(d.T,{center:!0,children:(0,m.addedLabel)(n)}),(0,y.jsx)(d.Muted,{center:!0,children:i})]}),s&&a&&!c?(0,y.jsx)(d.Button,{testID:`unsigned-sign-${e.id}`,kind:"success",label:"Sign off",accessibilityLabel:`Sign off ${e.name} as ${t.name}`,onPress:()=>$(s),style:{alignSelf:'stretch'}}):null,s&&a&&c?(0,y.jsx)(d.Muted,{center:!0,children:c}):null,s&&!a?(0,y.jsx)(d.Muted,{center:!0,children:"Only the Head Chef, an owner or a manager can sign it off."}):null,s?(0,y.jsx)(d.Button,{small:!0,kind:"secondary",testID:`unsigned-open-${e.id}`,label:a&&c?'Check the recipe card':'Open recipe card',accessibilityLabel:`Open the recipe card for ${e.name}`,onPress:()=>b(s.id),style:{alignSelf:'stretch'}}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d.Muted,{center:!0,children:"No recipe card yet."}),l?(0,y.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open recipe cards",onPress:l,style:{alignSelf:'stretch'}}):null]}),f&&s&&f.id===s.id?(0,y.jsx)(d.Banner,{kind:"danger",children:f.text}):null]},e.id)}),(0,y.jsx)(d.Sheet,{visible:!!w&&!j,onClose:()=>b(null),title:w?.dish??'',maxWidth:640,testID:"unsigned-card-sheet",children:w?(0,y.jsx)(P,{card:w,actor:t,onEdit:(0,m.canEditCards)(t.role)?()=>C(w.id):void 0}):null}),(0,y.jsx)(d.Sheet,{visible:!!j,onClose:()=>C(null),title:`Edit: ${I?.dish??''}`,maxWidth:680,testID:"unsigned-editor-sheet",children:j&&I?(0,y.jsx)(R,{rid:e,card:I,actor:t,onDone:e=>{C(null),b(e)}},j):null})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),l=e(_r(_d[3])),i=e(_r(_d[4])),r=e(_r(_d[5])),o=_r(_d[6]),d=_r(_d[7]),a=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]);const j=e=>{const t=new Date(e.length<=10?`${e}T12:00:00`:e);return isNaN(+t)?e:t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})},C=e=>`\xa3${(Math.round(e)/100).toFixed(2)}`,w=e=>null==e?'Price on the board':C(e),I={example:p.EXAMPLE_TAG,imported:'Imported from the menu',new:null};function $({card:e,testID:t}){return e.signOff?(0,y.jsx)(r.default,{testID:t??'card-signed-off',accessibilityLabel:`Signed off by ${e.signOff.by}, ${j(e.signOff.at)}`,style:{alignItems:'center',gap:4,width:'100%'},children:(0,y.jsxs)(d.T,{center:!0,weight:"bold",colour:o.colours.gold,children:["Signed off by ",e.signOff.by,", ",j(e.signOff.at)]})}):(0,y.jsxs)(r.default,{testID:t??'card-signed-off',accessibilityLabel:"Not signed off yet",style:{alignItems:'center',gap:4,width:'100%'},children:[(0,y.jsx)(d.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:m.STATE_LABEL.awaiting}),(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,children:c.portionCardItemIds.includes(e.menuItemId)?'A portion card for the kitchen. The dish on the menu is not changed by this card.':e.wasLive?'Edited since the last sign-off. Guests see it as awaiting sign-off until a chef signs it again.':'This dish stays off the menu until a chef signs it off.'})]})}function D({dish:e,photo:t,height:s=180,pending:n,index:i,total:a,radius:c=12}){const h=n?{uri:n}:t?(0,u.recipeCards)().photoSource(t):null,f=i&&a?`Photo ${i} of ${a}`:'Plating photo';return h?(0,y.jsx)(l.default,{testID:i?`card-photo-${i}`:'card-photo',accessibilityLabel:`${f}${e?`: ${e}`:''}`,source:h,style:{width:'100%',height:s,borderRadius:c,backgroundColor:o.colours.surface2},resizeMode:"cover"}):(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:"No plating photo yet"+(e?`, ${e}`:''),style:{width:'100%',height:s,borderRadius:c,backgroundColor:o.colours.goldTint,alignItems:'center',justifyContent:'center',borderWidth:1.5,borderColor:o.colours.gold,gap:2},children:[(0,y.jsx)(d.T,{center:!0,size:Math.min(64,Math.max(30,Math.round(.38*s))),weight:"bold",colour:o.colours.gold,children:(e.trim()[0]??'?').toUpperCase()}),s>=120?(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:o.colours.goldLight,children:"No plating photo yet"}):null]})}function T({map:e}){const t=f.ALLERGENS.filter(t=>e[t.id]).map(e=>e.id);return t.length?(0,y.jsx)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:t.map(t=>{const s='may'===e[t],n=s?`May contain ${(0,f.allergenLabel)(t).toLowerCase()}`:(0,f.allergenLabel)(t);return(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:s?n:`Contains ${(0,f.allergenLabel)(t).toLowerCase()}`,style:{paddingHorizontal:12,paddingVertical:6,borderRadius:999,borderWidth:1.5,borderColor:s?o.colours.amber:o.colours.gold,backgroundColor:s?'transparent':o.colours.gold,maxWidth:'100%'},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"semibold",center:!0,colour:s?o.colours.amber:o.colours.onGold,children:n})},t)})}):(0,y.jsx)(d.Muted,{center:!0,children:"None of the UK 14 allergens."})}const k=({label:e,gold:t,testID:s})=>(0,y.jsx)(r.default,{testID:s,style:{paddingHorizontal:12,paddingVertical:5,borderRadius:999,borderWidth:1,borderColor:t?o.colours.gold:o.colours.accentBorder,backgroundColor:t?o.colours.goldTint:o.colours.surface,maxWidth:'100%'},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"medium",center:!0,colour:t?o.colours.goldLight:o.colours.text,children:e})}),S=({title:e})=>(0,y.jsxs)(r.default,{style:{width:'100%',alignItems:'center',gap:4,paddingTop:4},children:[(0,y.jsx)(d.T,{size:13,weight:"semibold",center:!0,colour:o.colours.goldMuted,accessibilityRole:"header",children:e.toUpperCase()}),(0,y.jsx)(r.default,{style:{width:36,height:2,borderRadius:1,backgroundColor:o.colours.gold}})]});function P({card:e,actor:t,onEdit:s,mode:l="edit"}){const[i,a]=(0,n.useState)(null),c=(0,m.signOffBlock)(e),h=I[e.origin],f=(0,m.cardPhotos)(e),p=(0,m.maySignOff)(t,e),x=(0,b.useCardCosting)(e,t.role,l);return(0,y.jsxs)(r.default,{testID:"card-view",style:{gap:12,alignItems:'center',width:'100%'},children:[f.length?(0,y.jsx)(D,{dish:e.dish,photo:f[0],height:220,index:1,total:f.length,radius:18}):(0,y.jsx)(D,{dish:e.dish,height:180,radius:18}),f.length>1?(0,y.jsx)(d.Row,{gap:8,style:{width:'100%'},children:f.slice(1).map((t,s)=>(0,y.jsx)(r.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(D,{dish:e.dish,photo:t,height:72,index:s+2,total:f.length})},t))}):null,(0,y.jsx)(d.T,{center:!0,size:26,weight:"bold",colour:o.colours.gold,accessibilityRole:"header",children:e.dish}),(0,y.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[h?(0,y.jsx)(d.Badge,{label:h,kind:'example'===e.origin?'blue':'neutral'}):null,(0,y.jsx)(k,{label:e.section,gold:!0}),(0,y.jsx)(k,{label:w(e.price)}),x&&x.summary.lines.length?(0,y.jsx)(k,{testID:"card-yield",label:x.summary.batch/Math.max(1,x.summary.perPortion||1)>1.5?`Makes ${Math.round(x.summary.batch/x.summary.perPortion)} portions`:'1 portion'}):null]}),(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:`Created by ${e.createdBy||'not recorded'}`,style:{width:'100%',alignItems:'center'},children:(0,y.jsxs)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,testID:"card-created-by",children:["Created by ",e.createdBy||'Not recorded']})}),(0,y.jsx)(r.default,{style:{width:'100%',paddingVertical:8,paddingHorizontal:10,borderRadius:14,borderWidth:1,borderColor:e.signOff?o.colours.accentBorder:o.colours.amber,backgroundColor:e.signOff?o.colours.accentBg:o.colours.amberBg},children:(0,y.jsx)($,{card:e,testID:"card-status"})}),(0,y.jsx)(S,{title:"Allergens"}),(0,y.jsx)(r.default,{testID:"card-allergens",style:{width:'100%'},children:(0,y.jsx)(T,{map:e.allergens})}),e.allergenNotes?(0,y.jsx)(d.Muted,{center:!0,children:e.allergenNotes}):null,e.allergensConfirmed?(0,y.jsxs)(d.Muted,{center:!0,children:["Allergen list confirmed by ",e.allergensConfirmed.by," on ",j(e.allergensConfirmed.at),"."]}):null,(0,y.jsx)(S,{title:"Ingredients"}),e.ingredients.length?(0,y.jsx)(r.default,{testID:"card-ingredients",style:{width:'100%',borderRadius:14,borderWidth:1,borderColor:o.colours.border,backgroundColor:o.colours.surface,overflow:'hidden'},children:e.ingredients.map((e,t)=>{const s=[e.qty,e.unit].filter(Boolean).join(' '),n=x?.byRecipeIng[e.id];return(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}${s?`, ${s}`:''}${n?`, ${C(n.cost)}`:''}`,style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:10,paddingHorizontal:12,borderTopWidth:t?1:0,borderColor:o.colours.border,minHeight:48},children:[(0,y.jsx)(d.T,{style:{flex:1,minWidth:0},children:e.name}),(0,y.jsxs)(r.default,{style:{alignItems:'flex-end',flexShrink:0,maxWidth:'40%'},children:[(0,y.jsx)(d.T,{weight:"semibold",colour:o.colours.goldLight,style:{textAlign:'right'},children:s||'\u2013'}),n?(0,y.jsx)(d.T,{size:o.font.small,colour:o.colours.muted,style:{textAlign:'right'},children:C(n.cost)}):null]})]},e.id)})}):(0,y.jsx)(d.Muted,{center:!0,children:"No ingredients on this card yet."}),(0,y.jsx)(S,{title:"Method"}),e.steps.length?(0,y.jsx)(r.default,{testID:"card-method",style:{width:'100%',gap:10},children:e.steps.map((e,t)=>(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`Step ${t+1}. ${e}`,style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,y.jsx)(r.default,{style:{width:32,height:32,borderRadius:16,borderWidth:1.5,borderColor:o.colours.gold,backgroundColor:o.colours.goldTint,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"bold",colour:o.colours.gold,children:t+1})}),(0,y.jsx)(d.T,{style:{flex:1,minWidth:0,paddingTop:4},children:e})]},t))}):(0,y.jsxs)(d.Muted,{center:!0,children:["No method yet.",(0,m.canEditCards)(t.role)?' Tap Edit to add the steps.':'']}),(0,y.jsx)(b.CardGpPanel,{card:e,actor:t,mode:l}),(0,y.jsxs)(d.Muted,{center:!0,children:["Version ",e.version," \xb7 last changed ",j(e.updatedAt)," by ",e.updatedBy]}),(0,m.canEditCards)(t.role)&&s?(0,y.jsx)(d.Button,{testID:"edit-card",kind:"secondary",label:"Edit card",accessibilityLabel:`Edit ${e.dish}`,onPress:s,style:{alignSelf:'stretch'}}):null,p&&!e.signOff?(0,y.jsxs)(r.default,{style:{gap:6,width:'100%'},children:[c?(0,y.jsx)(d.Banner,{kind:"warn",title:"Not ready to sign off",children:c}):null,(0,y.jsx)(d.Button,{testID:"sign-off",kind:"success",label:`Sign off as ${t.name}`,accessibilityLabel:`Sign off ${e.dish} as ${t.name}`,disabled:!!c,onPress:async()=>{try{await(0,u.recipeCards)().signOff(e.id,t),a(null)}catch(e){a(e?.message??'Could not sign off.')}}})]}):null,!(0,m.canEditCards)(t.role)||p||e.signOff?null:(0,y.jsx)(d.Banner,{kind:"info",title:"Sign-off",children:"Only the Head Chef, an owner or a manager can sign it off."}),i?(0,y.jsx)(d.Banner,{kind:"danger",children:i}):null]})}const v=()=>`i-${Math.random().toString(36).slice(2,9)}`,B=(e,t,s)=>e?{id:e.id,dish:e.dish,section:e.section,price:null==e.price?'':(e.price/100).toFixed(2),description:'',createdBy:e.createdBy??'',ingredients:e.ingredients.map(e=>({...e})),steps:[...e.steps],allergens:{...e.allergens},dismissed:[...e.dismissed],allergenNotes:e.allergenNotes??'',photos:(0,m.cardPhotos)(e),pending:[],confirm:!!e.allergensConfirmed}:{id:(0,m.uuid)(),dish:'',section:t,price:'',description:'',createdBy:s,ingredients:[{id:v(),name:'',qty:'',unit:''}],steps:[''],allergens:{},dismissed:[],allergenNotes:'',photos:[],pending:[],confirm:!1},L=e=>{const t=e.replace(/[\xa3\s]/g,'');if(!t)return null;const s=Number(t);return isFinite(s)&&s>=0?Math.round(100*s):'bad'};function R({rid:e,card:l,actor:c,onDone:h}){const p=(0,a.useRestaurant)(e),b=p?.sections??['Mains'],[j,C]=(0,n.useState)(()=>B(l,b[0]??'Mains',c.name)),[w,I]=(0,n.useState)(null),[$,T]=(0,n.useState)(null),[k,S]=(0,n.useState)(!1),P=e=>C(t=>({...t,...e})),R=j.ingredients.filter(e=>e.name.trim()),M={ingredients:R,allergens:j.allergens,dismissed:j.dismissed},O=(0,m.suggestAllergens)(R),E=(0,m.unresolved)(M),A=e=>{const t=j.allergens[e],s={...j.allergens};t?'contains'===t?s[e]='may':delete s[e]:s[e]='contains',P({allergens:s,dismissed:j.dismissed.filter(t=>t!==e),confirm:!1})},N=e=>{const t={...j.allergens};delete t[e],P({allergens:t,dismissed:[...new Set([...j.dismissed,e])],confirm:!1})},z=(e,t)=>P({ingredients:j.ingredients.map((s,n)=>n===e?{...s,...t}:s),confirm:!1}),W=(e,t)=>P({steps:j.steps.map((s,n)=>n===e?t:s)}),H=(e,t)=>{const s=[...j.steps],n=e+t;n<0||n>=s.length||([s[e],s[n]]=[s[n],s[e]],P({steps:s}))},_=j.photos.length+j.pending.length,F=async e=>{if(T(null),_>=m.MAX_RECIPE_PHOTOS)T('A card can hold 5 photos.');else try{const t=await(0,x.capturePlatingPhoto)(e);t&&(P({pending:[...j.pending,t]}),T(`Photo ${_+1} of ${m.MAX_RECIPE_PHOTOS}. Compressed on this device: ${t.width}\xd7${t.height}, ${(0,x.kb)(t.bytes)}${t.originalBytes?` (was ${(0,x.kb)(t.originalBytes)})`:''}.`))}catch(e){T(e?.message??'Could not read that photo.')}},[G,V]=(0,n.useState)(!1),U=j.dish||l?.dish||'this dish';return(0,y.jsxs)(r.default,{testID:"card-editor",style:{gap:12},children:[l?.signOff?(0,y.jsx)(d.Banner,{kind:"warn",title:"Saving a change clears the sign-off",children:"This card is signed off. Any change you save clears it until the Head Chef, an owner or a manager signs it off again."}):null,(0,y.jsx)(d.Field,{testID:"dish-name",label:"Dish name",value:j.dish,onChangeText:e=>P({dish:e}),placeholder:"e.g. Cullen skink"}),(0,y.jsx)(d.Field,{testID:"card-created-by-field",label:"Created by",value:j.createdBy,onChangeText:e=>P({createdBy:e}),placeholder:"Chef's name"}),l?null:(0,y.jsx)(d.Field,{testID:"dish-description",label:"Menu description (optional)",value:j.description,onChangeText:e=>P({description:e}),placeholder:"What guests read on the menu"}),(0,y.jsx)(d.T,{size:o.font.small,weight:"medium",colour:o.colours.muted,children:"Menu section"}),(0,y.jsx)(d.Row,{wrap:!0,gap:6,children:b.map(e=>(0,y.jsx)(d.Chip,{label:e,selected:j.section===e,onPress:()=>P({section:e})},e))}),(0,y.jsx)(d.Field,{testID:"dish-price",label:"Price (\xa3)",value:j.price,onChangeText:e=>P({price:e}),placeholder:"Blank = price on the board",keyboardType:"decimal-pad"}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Photos"}),(0,y.jsx)(d.T,{center:!0,colour:o.colours.muted,children:"Up to 5 photos."}),(0,y.jsxs)(r.default,{testID:"card-photos",style:{gap:10,width:'100%',alignItems:'center'},children:[j.photos.map((e,t)=>(0,y.jsxs)(r.default,{style:{width:'100%',gap:6,alignItems:'center'},children:[(0,y.jsx)(D,{dish:U,photo:e,height:160,index:t+1,total:_||j.photos.length}),(0,y.jsx)(d.Button,{testID:`photo-remove-${t+1}`,kind:"ghost",label:`Remove photo ${t+1}`,accessibilityLabel:`Remove photo ${t+1} of ${U}`,onPress:()=>P({photos:j.photos.filter((e,s)=>s!==t)})})]},e)),j.pending.map((e,t)=>(0,y.jsxs)(r.default,{style:{width:'100%',gap:6,alignItems:'center'},children:[(0,y.jsx)(D,{dish:U,pending:e.dataUrl,height:160,index:j.photos.length+t+1,total:_}),(0,y.jsx)(d.Button,{testID:`photo-remove-new-${t+1}`,kind:"ghost",label:`Remove photo ${j.photos.length+t+1}`,accessibilityLabel:`Remove new photo ${j.photos.length+t+1}`,onPress:()=>P({pending:j.pending.filter((e,s)=>s!==t)})})]},`new-${t}`)),_?null:(0,y.jsx)(D,{dish:U,height:160})]}),(0,y.jsx)(d.Button,{testID:"photo-camera",kind:"secondary",label:"Take photo",accessibilityLabel:"Take a photo for this recipe card",disabled:_>=m.MAX_RECIPE_PHOTOS,onPress:()=>F('camera')}),(0,y.jsx)(d.Button,{testID:"photo-library",kind:"secondary",label:"Choose photo",accessibilityLabel:"Choose a photo for this recipe card",disabled:_>=m.MAX_RECIPE_PHOTOS,onPress:()=>F('library')}),$?(0,y.jsx)(r.default,{testID:"photo-info",children:(0,y.jsx)(d.Muted,{center:!0,children:$})}):(0,y.jsx)(d.Muted,{center:!0,children:'shared'===(0,u.recipeCards)().mode?'Photos are shrunk on this device, then shared with the team. Staff and guests only see them once the card is signed off.':'Photos are shrunk on this device before they are saved.'}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Ingredients"}),(0,y.jsx)(d.Muted,{children:"Quantity, unit and ingredient. We suggest allergens from the ingredient names."}),j.ingredients.map((e,n)=>{const l=e.name.trim()?(0,m.suggestAllergens)([e]):[];return(0,y.jsxs)(r.default,{style:{gap:4},children:[(0,y.jsxs)(d.Row,{gap:6,children:[(0,y.jsx)(t.TextInput,{testID:`ing-qty-${n}`,accessibilityLabel:`Quantity ${n+1}`,value:e.qty,onChangeText:e=>z(n,{qty:e}),placeholder:"Qty",placeholderTextColor:"#7D776C",style:[d.styles.input,{width:64}]}),(0,y.jsx)(t.TextInput,{testID:`ing-unit-${n}`,accessibilityLabel:`Unit ${n+1}`,value:e.unit,onChangeText:e=>z(n,{unit:e}),placeholder:"g / ml / each",placeholderTextColor:"#7D776C",style:[d.styles.input,{width:92}]}),(0,y.jsx)(t.TextInput,{testID:`ing-name-${n}`,accessibilityLabel:`Ingredient ${n+1}`,value:e.name,onChangeText:e=>z(n,{name:e}),placeholder:"Ingredient",placeholderTextColor:"#7D776C",style:[d.styles.input,{flex:1}]}),(0,y.jsx)(s.GoldClose,{size:"sm",label:`Remove ingredient ${n+1}`,onPress:()=>P({ingredients:j.ingredients.filter((e,t)=>t!==n)})})]}),l.length?(0,y.jsxs)(d.Muted,{children:["Suggests: ",l.map(f.allergenLabel).join(', ')]}):null]},e.id)}),(0,y.jsx)(d.Button,{testID:"ing-add",small:!0,kind:"ghost",label:"Add ingredient",onPress:()=>P({ingredients:[...j.ingredients,{id:v(),name:'',qty:'',unit:''}]})}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Method"}),j.steps.map((e,n)=>(0,y.jsxs)(d.Row,{gap:6,style:{alignItems:'flex-start'},children:[(0,y.jsx)(d.T,{colour:o.colours.gold,style:{width:20,paddingTop:10},children:n+1}),(0,y.jsx)(t.TextInput,{testID:`step-${n}`,accessibilityLabel:`Step ${n+1}`,value:e,onChangeText:e=>W(n,e),multiline:!0,placeholder:"Describe this step",placeholderTextColor:"#7D776C",style:[d.styles.input,{flex:1,minHeight:56,textAlignVertical:'top'}]}),(0,y.jsxs)(r.default,{style:{gap:4},children:[(0,y.jsx)(i.default,{accessibilityLabel:`Move step ${n+1} up`,onPress:()=>H(n,-1),hitSlop:6,children:(0,y.jsx)(d.T,{colour:o.colours.muted,children:"\u25b2"})}),(0,y.jsx)(i.default,{accessibilityLabel:`Move step ${n+1} down`,onPress:()=>H(n,1),hitSlop:6,children:(0,y.jsx)(d.T,{colour:o.colours.muted,children:"\u25bc"})}),(0,y.jsx)(s.GoldClose,{size:"sm",label:`Remove step ${n+1}`,onPress:()=>P({steps:j.steps.filter((e,t)=>t!==n)})})]})]},n)),(0,y.jsx)(d.Button,{testID:"step-add",small:!0,kind:"ghost",label:"Add step",onPress:()=>P({steps:[...j.steps,'']})}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Allergens (UK 14)"}),(0,y.jsx)(d.Muted,{children:"Tap to cycle: contains \u2192 may contain \u2192 none. Suggested allergens are marked \u201c?\u201d until you add or rule them out."}),E.length?(0,y.jsxs)(r.default,{testID:"allergen-suggestions",style:{gap:6},children:[(0,y.jsx)(d.Banner,{kind:"warn",title:`Check ${E.length} suggested allergen${1===E.length?'':'s'}`,children:E.map(e=>`${(0,f.allergenLabel)(e)} (from ${(0,m.suggestedBy)(R,e).join(', ')})`).join('; ')}),E.map(e=>(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.T,{style:{flex:1},children:(0,f.allergenLabel)(e)}),(0,y.jsx)(d.Button,{testID:`suggest-add-${e}`,small:!0,label:"Contains",onPress:()=>P({allergens:{...j.allergens,[e]:'contains'},confirm:!1})}),(0,y.jsx)(d.Button,{testID:`suggest-may-${e}`,small:!0,kind:"secondary",label:"May contain",onPress:()=>P({allergens:{...j.allergens,[e]:'may'},confirm:!1})}),(0,y.jsx)(d.Button,{testID:`suggest-dismiss-${e}`,small:!0,kind:"ghost",label:"Not in this dish",onPress:()=>N(e)})]},e)),(0,y.jsx)(d.Button,{testID:"apply-suggestions",small:!0,kind:"secondary",label:"Add all suggestions as \u2018contains\u2019",onPress:()=>{const e={...j.allergens};E.forEach(t=>{e[t]='contains'}),P({allergens:e,confirm:!1})}})]}):null,(0,y.jsx)(d.Row,{wrap:!0,gap:6,children:f.ALLERGENS.map(e=>{const t=j.allergens[e.id],s=O.includes(e.id)&&!t&&!j.dismissed.includes(e.id),n='contains'===t?o.colours.redBg:'may'===t?o.colours.amberBg:o.colours.surface2,l='contains'===t?o.colours.red:'may'===t?o.colours.amber:s?o.colours.gold:o.colours.border;return(0,y.jsx)(i.default,{testID:`allergen-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.short}: ${'contains'===t?'contains':'may'===t?'may contain':'not marked'}`,onPress:()=>A(e.id),style:{paddingVertical:6,paddingHorizontal:10,borderRadius:16,borderWidth:s?2:1,borderStyle:s?'dashed':'solid',borderColor:l,backgroundColor:n},children:(0,y.jsxs)(d.T,{size:o.font.small,colour:'contains'===t?'#FFD9D4':'may'===t?'#FFE2A8':o.colours.text,children:[e.short,'may'===t?' (may)':'',s?' ?':'']})},e.id)})}),j.dismissed.length?(0,y.jsxs)(d.Muted,{children:["Ruled out: ",j.dismissed.map(f.allergenLabel).join(', ')]}):null,(0,y.jsx)(d.Field,{testID:"allergen-notes",label:"Allergen notes (optional)",value:j.allergenNotes,onChangeText:e=>P({allergenNotes:e}),placeholder:"e.g. Cooked in the shared fryer"}),(0,y.jsxs)(i.default,{testID:"confirm-allergens",accessibilityRole:"checkbox",accessibilityState:{checked:j.confirm,disabled:E.length>0},disabled:E.length>0,onPress:()=>P({confirm:!j.confirm}),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:j.confirm?o.colours.ok:o.colours.border,opacity:E.length?.5:1},children:[(0,y.jsx)(r.default,{style:{width:22,height:22,borderRadius:4,borderWidth:2,borderColor:j.confirm?o.colours.ok:o.colours.muted,alignItems:'center',justifyContent:'center',backgroundColor:j.confirm?o.colours.okBg:'transparent'},children:j.confirm?(0,y.jsx)(d.T,{colour:o.colours.ok,children:"\u2713"}):null}),(0,y.jsx)(d.T,{style:{flex:1},children:E.length?'Check the suggested allergens above first':`I have checked the allergen list against the ingredients (${c.name})`})]}),w?(0,y.jsx)(d.Banner,{kind:"danger",children:w}):null,(0,y.jsx)(d.Button,{testID:"card-save",label:G?'Saving\u2026':l?'Save changes':'Save card',disabled:G,onPress:async()=>{I(null);const t=L(j.price);if(!j.dish.trim())return I('Give the dish a name.');if('bad'===t)return I('Price should be in pounds, e.g. 14.50 (or leave it blank for "price on the board").');const s=(0,u.recipeCards)();V(!0);try{const n=[...j.photos];for(const t of j.pending){if(n.length>=m.MAX_RECIPE_PHOTOS)break;n.push(await s.savePhoto(e,j.id,t))}const i=j.steps.map(e=>e.trim()).filter(Boolean),r=j.createdBy.trim(),o={dish:j.dish.trim(),section:j.section,price:t,ingredients:R.map(e=>({...e,name:e.name.trim(),qty:e.qty.trim(),unit:e.unit.trim()})),steps:i,allergens:j.allergens,dismissed:j.dismissed,allergenNotes:j.allergenNotes.trim()||void 0,photo:n[0],photos:n,createdBy:r||void 0};if(l)await s.update(l.id,{...o,confirmAllergens:j.confirm},c),h(l.id);else{const t=await s.create(e,{...o,id:j.id,description:j.description.trim()||void 0},c);j.confirm&&await s.update(t.id,{confirmAllergens:!0},c),h(t.id)}}catch(e){I(e?.message??'Could not save the card.')}finally{V(!1)}}}),(0,y.jsx)(d.Muted,{center:!0,children:(0,m.maySignOff)(c,{createdBy:j.createdBy||c.name,createdByRole:c.role})?'After saving, sign the card off so it goes live.':'After saving, the Head Chef, an owner or a manager signs it off before it goes live.'}),l?k?(0,y.jsxs)(d.Row,{gap:8,children:[(0,y.jsx)(d.Button,{testID:"card-delete-yes",small:!0,kind:"danger",label:"Yes, remove this dish",onPress:async()=>{if(l)try{await(0,u.recipeCards)().remove(l.id,c),h(null)}catch(e){I(e?.message??'Could not remove the card.')}}}),(0,y.jsx)(d.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>S(!1)})]}):(0,y.jsx)(d.Button,{testID:"card-delete",small:!0,kind:"ghost",label:"Remove card and dish from the menu",onPress:()=>S(!0)}):null]})}const M=e=>e.replace(/ \xb7 Starter$/,' \xb7 1').replace(/ \xb7 Main$/,' \xb7 2');function O(e){const t=(0,a.useAllMenu)(e),s=(0,a.useRecipeCards)(e);return(0,n.useMemo)(()=>{const e=new Map(s.map(e=>[e.menuItemId,e]));return(0,m.unsignedOldestFirst)(t,t=>e.get(t.id)??(t.recipeCardId?s.find(e=>e.id===t.recipeCardId):void 0))},[t,s])}function E({c:e,actor:t,mode:s,editable:n,onPress:l}){const a=(0,m.cardPhotos)(e),c=(0,b.useCardCosting)(e,'read'===s?'staff':t.role,s),h=f.ALLERGENS.filter(t=>e.allergens[t.id]).length,u=c?.summary.gp,x=c?.summary.tone,C='ok'===x?o.colours.ok:'amber'===x?o.colours.amber:'red'===x?o.colours.red:o.colours.muted,I=`${e.dish}, ${e.section}, ${w(e.price)}, ${h?`${h} allergen${1===h?'':'s'}`:'no allergens marked'}${null!=u?`, GP ${u.toFixed(1)} percent`:''}, created by ${e.createdBy||'not recorded'}, ${e.signOff?`signed off by ${e.signOff.by}`:'awaiting sign-off'}`;return(0,y.jsxs)(i.default,{testID:`card-${e.menuItemId}`,accessibilityRole:"button",accessibilityLabel:I,onPress:l,style:({pressed:t})=>({width:'100%',minHeight:48,flexDirection:'row',gap:12,alignItems:'center',padding:10,borderRadius:18,borderWidth:1,borderColor:!e.signOff&&n?o.colours.amber:o.colours.accentBorder,backgroundColor:t?o.colours.tilePressed:o.colours.tile}),children:[(0,y.jsx)(r.default,{style:{width:84,flexShrink:0},children:(0,y.jsx)(D,{dish:e.dish,photo:a[0],height:84,radius:14})}),(0,y.jsxs)(r.default,{style:{flex:1,minWidth:0,gap:4,alignItems:'center'},children:[(0,y.jsx)(d.T,{center:!0,weight:"bold",size:18,colour:o.colours.gold,children:e.dish}),(0,y.jsxs)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,children:[e.section," \xb7 ",w(e.price),'example'===e.origin?` \xb7 ${p.EXAMPLE_TAG}`:'']}),(0,y.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,y.jsx)(k,{label:h?`${h} allergen${1===h?'':'s'}`:'No allergens marked'}),null!=u?(0,y.jsx)(r.default,{testID:`card-gp-${e.menuItemId}`,style:{paddingHorizontal:10,paddingVertical:4,borderRadius:999,borderWidth:1.5,borderColor:C},children:(0,y.jsxs)(d.T,{size:o.font.small,weight:"bold",colour:C,children:["GP ",u.toFixed(1),"%"]})}):null]}),(0,y.jsxs)(d.T,{center:!0,size:o.font.small,testID:`card-created-${e.menuItemId}`,children:["Created by ",e.createdBy||'Not recorded']}),(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:e.signOff?o.colours.goldLight:o.colours.amber,children:e.signOff?`Signed off by ${e.signOff.by}, ${j(e.signOff.at)}`:m.STATE_LABEL.awaiting})]})]})}},1052,[874,835,31,197,264,128,825,818,823,1431,1044,839,819,1178,1184,1397,1432,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1053,[874,31,264,128,818,825,863,881,1082,1242,1243,25]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ChatAsCtx",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return w.dmId}}),Object.defineProperty(_e,"inChannel",{enumerable:!0,get:function(){return w.inChannel}}),_e.autoPost=function(e,t){const n=new Date(globalThis.__ccNow??Date.now()).toISOString();(Array.isArray(e)?e:[e]).forEach(e=>f.useOwner.getState().sys(e,t,n))},_e.ensureChat=D,_e.useChatUnread=A,Object.defineProperty(_e,"DISPLAY_DEVICE_ID",{enumerable:!0,get:function(){return B}}),_e.chatSender=L,_e.Chat=function({go:e}){return(0,O.jsx)(z,{children:(0,O.jsx)(K,{go:e})})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),a=r(d[3]),o=r(d[4]),i=r(d[5]),l=r(d[6]),c=e(r(d[7])),h=e(r(d[8])),u=e(r(d[9])),m=r(d[10]),f=r(d[11]),p=r(d[12]),b=r(d[13]),x=r(d[14]),j=r(d[15]),y=r(d[16]),w=r(d[17]),C=r(d[18]),v=r(d[19]),S=r(d[20]),k=r(d[21]),O=r(d[22]);const R=(0,i.createContext)(null);function I(e){const t=(0,x.useCtx)(e),n=(0,i.useContext)(R);return n?{...t,meId:n.meId,role:n.role}:t}const T=[{id:'all',name:'Team',icon:'\ud83d\udce2'},{id:'kitchen',name:'Kitchen',icon:'\ud83c\udf73',pinned:!0},{id:'foh',name:'Front of house',icon:'\ud83c\udf7d\ufe0f'},{id:'managers',name:'Managers',icon:'\ud83d\udd11'}],M=[],P=e=>(e??'').replace(' (example)','');function D(e){if(a.LIVE_VENUE_BUILD)return;if(o.IS_WILDINGS)return;const t=f.useOwner.getState();if(t.chat.some(e=>'m-seed-all'===e.id&&/this phone only/.test(e.text??''))&&f.useOwner.getState().chatPatch('m-seed-all',{text:'Welcome to the team chat on CoverCharge.'}),t.chat.length)return;const n=(t,n,s,a={})=>{return{id:`m-seed-${t}`,ch:t,from:'system',text:s,at:(o=n,new Date(e.getTime()-6e4*o).toISOString()),reactions:{},seenBy:[],...a};var o};f.useOwner.setState({chat:[n('all',5,'Welcome to the team chat on CoverCharge.',{pinned:!0}),n('kitchen',4,'Kitchen channel: Head Chef, kitchen team and managers.'),n('foh',3,'Front of house channel: front of house, bar and managers.'),n('managers',2,'Managers channel: owners, managers and the supervisor only.')]})}function A(){const{meId:e}=I(3e4),{role:t}=I(3e4),n=(0,f.useOwner)(e=>e.chat),s=(0,f.useOwner)(e=>e.staff),a=(0,f.useOwner)(t=>t.chatMuted[e]??M),o=(0,i.useMemo)(()=>E(s,e,t),[s,e,t]);return(0,i.useMemo)(()=>{const t={};return n.forEach(n=>{n.removed||n.from===e||n.seenBy.includes(e)||!(0,w.inChannel)(n.ch,o)||(t[n.ch]=(t[n.ch]??0)+1)}),{by:t,total:Object.entries(t).filter(([e])=>!a.includes(e)).reduce((e,[,t])=>e+t,0)}},[n,e,a,o])}function E(e,t,n){if(t===j.CAR_DEVICE_ID)return{id:t,name:j.CAR_ACTOR,role:'owner',job:'',active:!0,level:'Owner',dept:''};if('display-device'===t)return{id:t,name:'Display',role:'owner',job:'',active:!0,level:'Owner',dept:''};const s=e.find(e=>e.id===t);return s||!t?s:{id:t,name:'You',role:n,job:'',active:!0,level:'owner'===n?'Owner':'manager'===n?'Manager':'Staff',dept:''}}const B='display-device';function L(e,t){return e===j.CAR_DEVICE_ID?{id:e,name:j.CAR_ACTOR,role:'owner',job:'',active:!0,level:'Owner',dept:''}:e===B?{id:e,name:'Display',role:'owner',job:'',active:!0,level:'Owner',dept:''}:t.find(t=>t.id===e)}class z extends i.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message??e)}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.err&&this.setState({err:null})}render(){return this.state.err?(0,O.jsxs)(u.default,{style:{gap:10},testID:"chat-error",children:[(0,O.jsx)(m.Banner,{kind:"warn",title:"Chat couldn\u2019t open",children:"Something went wrong showing this chat. Your messages are still saved on this phone. Go back and try again; if it keeps happening, close and reopen the app."}),(0,O.jsx)(m.Button,{kind:"secondary",label:"Back to chats",onPress:()=>{this.setState({err:null}),this.props.onBack?.()}})]}):this.props.children}}const $={owner:b.colours.gold,manager:b.colours.blue,staff:'#7a6f5c'};function _({s:e,size:t=34}){return e?(0,O.jsx)(y.StaffAvatar,{id:e.id,size:t}):(0,O.jsx)(u.default,{style:{width:t,height:t,borderRadius:t/2,backgroundColor:(0,n.soutersSurface)('#333'),alignItems:'center',justifyContent:'center'},children:(0,O.jsx)(m.T,{size:.38*t,weight:"bold",colour:"#111",children:"CC"})})}const N=[{caption:'Specials board',tone:'#4A3A22'},{caption:'Plating: Cullen skink',tone:'#3E2A2A'},{caption:'Delivery arrived',tone:'#40362A'},{caption:'Spillage by the bar',tone:'#2E2E40'}],W=['\ud83d\udc4d','\u2764\ufe0f','\ud83d\ude04','\ud83d\udc4f','\ud83d\udd25'];function H({ch:e,go:a,back:o}){const{now:j,meId:S,role:R,today:M}=I(1e4),D=(0,f.useOwner)(e=>e.staff),A=(0,f.useOwner)(e=>e.chat),E=(0,f.useOwner)(e=>e.shifts),B=(0,f.useOwner)(e=>e.leave),z=A.filter(t=>t.ch===e).sort((e,t)=>e.at.localeCompare(t.at)),[H,K]=(D.find(e=>e.id===S),(0,i.useState)('')),[V,U]=(0,i.useState)(null),[Y,q]=(0,i.useState)(!1),[F,G]=(0,i.useState)(!1),J=e.startsWith('dm:')?e.split(':').slice(1).length:D.filter(t=>t.active&&(0,w.inChannel)(e,t)).length;(0,i.useEffect)(()=>{const t=f.useOwner.getState().chat.some(t=>t.ch===e&&t.from!==S&&!t.seenBy.includes(S));f.useOwner.getState().chatSeen(e,S),t&&(0,v.markChatRead)(S,e)},[e,S,z.length]);const Q=t=>f.useOwner.getState().chatSend({ch:e,from:S,at:j.toISOString(),...t});(0,l.useBackLayer)(!0,o);const X=z.filter(e=>e.pinned&&!e.removed),Z=e.startsWith('dm:')?D.find(t=>t.id===e.split(':').slice(1).find(e=>e!==S)):void 0,ee=Z?.name.replace(' (example)','')??T.find(t=>t.id===e)?.name??'Private message',te=t.AVATAR_OPTIONS.find(t=>t.id===('kitchen'===e?'spatula':'bar'===e?'espresso-martini':'waves')),ne=(0,C.useChatSync)(e=>e.synced),se=(0,k.workingShifts)(E,B).filter(e=>e.staffId===S&&e.published&&e.date>=M).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,10);return(0,O.jsxs)(u.default,{style:{gap:8},children:[(0,O.jsxs)(u.default,{testID:"chat-thread-header",style:{gap:6,alignItems:'center'},children:[(0,O.jsx)(u.default,{style:{alignSelf:'flex-start'},children:(0,O.jsx)(l.BackButton,{onPress:o,testID:"chat-thread-back"})}),Z?(0,O.jsx)(y.StaffAvatar,{id:Z.id,size:88}):(0,O.jsx)(c.default,{testID:"chat-group-avatar",source:{uri:te.dataUrl},style:{width:88,height:88},accessibilityLabel:`${ee} group avatar`}),(0,O.jsx)(m.T,{center:!0,weight:"semibold",size:22,children:ee}),(0,O.jsxs)(m.Muted,{center:!0,children:[J," ",1===J?'member':'members']})]}),X.map(e=>(0,O.jsxs)(m.Card,{highlight:b.colours.gold,children:[(0,O.jsxs)(m.T,{size:12,colour:b.colours.gold,children:["\ud83d\udccc ",'system'===e.from?'Pinned note':`Pinned by ${P(D.find(t=>t.id===e.from)?.name)}`]}),(0,O.jsx)(m.T,{size:14,children:e.text})]},e.id)),z.map((t,s)=>{const o=L(t.from,D),i=t.from===S,l=t.seenBy.filter(e=>e!==t.from).length,c=0===s||t.at.slice(0,10)!==z[s-1].at.slice(0,10);return'system'===t.from?(0,O.jsxs)(u.default,{style:{alignItems:'center',gap:2},children:[c?(0,O.jsx)(m.Muted,{children:(0,p.niceDate)(new Date(t.at))}):null,(0,O.jsx)(u.default,{style:{backgroundColor:(0,n.soutersSurface)('#1c1a14'),borderRadius:10,paddingHorizontal:10,paddingVertical:5,borderWidth:1,borderColor:b.colours.border},children:(0,O.jsxs)(m.T,{size:13,colour:/Allergy|86|Sold out/.test(t.text??'')?b.colours.amber:b.colours.muted,children:["CoverCharge \xb7 ",t.text," \xb7 ",(0,p.hm)(new Date(t.at))]})})]},t.id):(0,O.jsxs)(u.default,{style:{gap:2},children:[c?(0,O.jsx)(m.Muted,{center:!0,children:(0,p.niceDate)(new Date(t.at))}):null,(0,O.jsxs)(m.Row,{style:{alignItems:'flex-start',flexDirection:i?'row-reverse':'row'},children:[(0,O.jsx)(_,{s:o}),(0,O.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:`Message from ${o?.name}`,onPress:()=>U(V===t.id?null:t.id),style:{maxWidth:'78%',backgroundColor:i?'#3a2f12':b.colours.surface,borderRadius:14,padding:9,borderWidth:1,borderColor:t.pinned?b.colours.gold:b.colours.border,gap:3},children:[(0,O.jsxs)(m.Row,{gap:6,children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:o?$[o.role]:b.colours.muted,children:P(o?.name)}),(0,O.jsxs)(m.T,{size:11,colour:b.colours.muted,children:[o?f.ROLE_LABEL[o.role]:''," \xb7 ",(0,p.hm)(new Date(t.at))]})]}),t.removed?(0,O.jsx)(m.T,{size:14,colour:b.colours.muted,children:"Message removed by the owner"}):(0,O.jsxs)(O.Fragment,{children:[t.photo?(0,O.jsx)(u.default,{style:{width:200,height:120,borderRadius:10,backgroundColor:t.photo.tone,justifyContent:'flex-end',padding:6},children:(0,O.jsxs)(m.T,{size:12,children:[t.photo.caption," (example image)"]})}):null,t.text?(0,O.jsx)(m.T,{size:15,children:t.text}):null,'cover'===t.action?(0,O.jsx)(m.Button,{small:!0,kind:"secondary",label:"Open cover requests on the rota",onPress:()=>a('more','rota')}):null]}),Object.entries(t.reactions).filter(([,e])=>e.length).length?(0,O.jsx)(m.Row,{wrap:!0,gap:4,children:Object.entries(t.reactions).filter(([,e])=>e.length).map(([e,t])=>(0,O.jsx)(u.default,{style:{borderRadius:10,paddingHorizontal:6,backgroundColor:t.includes(S)?'#4a3c16':'#222'},children:(0,O.jsxs)(m.T,{size:12,children:[e," ",t.length]})},e))}):null,i?(0,O.jsx)(m.T,{size:11,colour:b.colours.muted,children:l?`Seen by ${l}`:'Sent'}):null]})]}),V!==t.id||t.removed?null:(0,O.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:i?'flex-end':'flex-start',paddingLeft:i?0:40},children:[W.map(e=>(0,O.jsx)(h.default,{accessibilityLabel:`React ${e}`,onPress:()=>{f.useOwner.getState().chatReact(t.id,e,S),U(null)},style:{padding:4},children:(0,O.jsx)(m.T,{size:20,children:e})},e)),'staff'===R||e.startsWith('dm:')?null:(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:t.pinned?'Unpin':'Pin',onPress:()=>{f.useOwner.getState().chatPatch(t.id,{pinned:!t.pinned}),U(null)}}),'owner'!==R||i?null:(0,O.jsx)(m.Button,{small:!0,kind:"danger",label:"Remove",onPress:()=>{f.useOwner.getState().chatPatch(t.id,{removed:!0,pinned:!1}),U(null)}})]})]},t.id)}),(0,O.jsxs)(m.Row,{gap:6,children:[(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Send a photo",onPress:()=>q(!0),style:{padding:8},children:(0,O.jsx)(m.T,{size:20,children:"\ud83c\udf9e\ufe0f"})}),(0,O.jsx)(s.TextInput,{accessibilityLabel:"Message",placeholder:`Message ${ee}`,placeholderTextColor:"#7D776C",value:H,onChangeText:K,style:[m.styles.input,{flex:1,minWidth:0,width:0}]}),(0,O.jsx)(m.Button,{small:!0,label:"Send",disabled:!H.trim(),onPress:()=>{Q({text:H.trim()}),K('')}})]}),(0,O.jsx)(m.Row,{wrap:!0,gap:6,children:(0,O.jsx)(m.Button,{small:!0,kind:"secondary",label:"Ask for shift cover",onPress:()=>G(!0)})}),ne?null:(0,O.jsx)(m.Muted,{center:!0,children:"Not shared yet: this message stays on this phone only. Nobody else will see it."}),(0,O.jsx)(m.Sheet,{visible:Y,onClose:()=>q(!1),title:"Send a photo",children:(0,O.jsx)(m.Row,{wrap:!0,gap:8,children:N.map(e=>(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.caption,onPress:()=>{Q({photo:e}),q(!1)},style:{width:'47%',height:100,borderRadius:10,backgroundColor:e.tone,justifyContent:'flex-end',padding:6},children:(0,O.jsx)(m.T,{size:12,children:e.caption})},e.caption))})}),(0,O.jsxs)(m.Sheet,{visible:F,onClose:()=>G(!1),title:"Ask for shift cover",children:[se.length?null:(0,O.jsx)(m.Muted,{children:"You have no shifts on the rota this week."}),se.map(e=>(0,O.jsx)(m.Button,{kind:"secondary",label:`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`,onPress:()=>{const t=`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`;f.useOwner.getState().addSwap({shiftId:e.id,fromId:S,kind:'cover',note:`Cover asked in chat for ${t}`}),Q({text:`Can anyone cover my ${t} shift? I\u2019ve added a cover request on the rota.`,action:'cover'}),G(!1)}},e.id)),(0,O.jsx)(m.Muted,{children:"Creates a cover request in Rota \u203a Swaps & leave for a manager to approve."})]})]})}function K({go:e}){const{now:t,meId:s,role:a}=I(3e4),o=(0,f.useOwner)(e=>e.staff),l=(0,f.useOwner)(e=>e.chat),c=(0,f.useOwner)(e=>e.chatMuted[s]??M),{by:x,total:j}=A(),y=(0,C.useChatSync)(e=>e.synced),k=(0,C.useChatSync)(e=>e.error),R=(0,w.useKitchenExtra)(e=>e.extra),[B,$]=(0,i.useState)(null),[N,W]=(0,i.useState)(!1),[K,V]=(0,i.useState)(!1);(0,i.useEffect)(()=>{D(t)},[]),(0,i.useEffect)(()=>{$(null)},[s]);const U=(0,S.useChatOpen)(e=>e.ch);(0,i.useEffect)(()=>{if(!U)return;const e=U.startsWith('dm:')||T.some(e=>e.id===U)?U:null;e&&(0,w.inChannel)(e,E(o,s,a))&&$(e),S.useChatOpen.getState().request(void 0)},[U,s,a,o]);const Y=E(o,s,a);if(B)return(0,O.jsx)(z,{resetKey:B,onBack:()=>$(null),children:(0,O.jsx)(H,{ch:B,go:e,back:()=>$(null)})});const q=e=>l.filter(t=>t.ch===e).sort((e,t)=>t.at.localeCompare(e.at))[0],F=o.filter(e=>e.active&&e.id!==s).map(e=>{const t=(0,w.dmId)(s,e.id);return{x:e,id:t,u:x[t]??0,l:q(t)?.at??''}}).sort((e,t)=>t.u-e.u||t.l.localeCompare(e.l)||P(e.x.name).localeCompare(P(t.x.name))),G='owner'===a||'manager'===a,J=({id:e,name:t,icon:s,avatar:a})=>{const i=q(e),l=x[e]??0,f=c.includes(e);return(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:`Open ${t}`,onPress:()=>$(e),style:{padding:12,borderTopWidth:1,borderColor:b.colours.border},children:(0,O.jsxs)(m.Row,{children:[a?(0,O.jsx)(_,{s:a}):(0,O.jsx)(u.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:(0,n.soutersSurface)('#222'),alignItems:'center',justifyContent:'center'},children:(0,O.jsx)(m.T,{size:16,children:s})}),(0,O.jsxs)(u.default,{style:{flex:1},children:[(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{weight:l?'bold':'medium',children:[t,f?' \ud83d\udd15':'']}),i?(0,O.jsx)(m.Muted,{children:(0,p.hm)(new Date(i.at))}):null]}),(0,O.jsx)(m.Muted,{numberOfLines:1,children:i?i.removed?'Message removed':`${'system'===i.from?'CoverCharge':P(L(i.from,o)?.name)}: ${i.text??'Photo'}`:'No messages yet'})]}),l?(0,O.jsx)(u.default,{style:{backgroundColor:f?'#555':b.colours.red,borderRadius:10,minWidth:20,height:20,alignItems:'center',justifyContent:'center',paddingHorizontal:5},children:(0,O.jsx)(m.T,{size:11,weight:"bold",children:l})}):null]})})};return(0,O.jsxs)(u.default,{style:{gap:10},children:[y?(0,O.jsx)(u.default,{testID:"chat-synced",children:(0,O.jsx)(m.Muted,{children:"\u2713 Shared with the team: messages reach everyone in the chat on their own phone."})}):(0,O.jsx)(m.Banner,{kind:"warn",title:"On this device only for now",children:"You\u2019re not connected with your personal link (or chat sharing isn\u2019t switched on yet), so anything you send stays on this device and nobody else will see it. Open your personal invite link to share chat with the team. Use your usual group chat for anything urgent."}),y&&k?(0,O.jsx)(u.default,{testID:"chat-sync-error",children:(0,O.jsx)(m.Banner,{kind:"warn",title:"Can\u2019t reach the server right now",children:"Showing the messages on this phone. New messages will be sent and others\u2019 messages will appear when the connection is back; it retries automatically."})}):null,(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.Muted,{children:["Signed in as ",P(Y?.name)," (",'Head Chef'===Y?.level?'Head Chef':f.ROLE_LABEL[a],")"]}),(0,O.jsxs)(m.Row,{gap:6,children:[j||Object.keys(x).length?(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"chat-mark-all",accessibilityLabel:"Mark all chats as read",onPress:()=>(0,v.markChatRead)(s,'*')}):null,(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:"Chat settings",onPress:()=>V(!0)})]})]}),(0,O.jsxs)(u.default,{style:{borderRadius:14,borderWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface,overflow:'hidden'},children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{padding:10},children:"TEAM CHATS"}),T.filter(e=>'all'===e.id||(0,w.inChannel)(e.id,Y)).map(e=>(0,O.jsx)(J,{id:e.id,name:e.pinned?`${e.name} \ud83d\udccc`:e.name,icon:e.icon},e.id))]}),(0,O.jsxs)(u.default,{style:{borderRadius:14,borderWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface,overflow:'hidden'},children:[(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between',padding:10},children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:b.colours.gold,children:"PRIVATE MESSAGES"}),(0,O.jsx)(m.Button,{small:!0,kind:"success",label:"New message",testID:"chat-new-pm",onPress:()=>W(!0)})]}),F.map(e=>(0,O.jsx)(J,{id:e.id,name:P(e.x.name),avatar:e.x},e.id)),F.length?null:(0,O.jsx)(m.Muted,{style:{padding:10},children:"Nobody else on the team yet."})]}),(0,O.jsx)(m.Muted,{children:"Private messages can only be read by the two people in them; owners and managers can\u2019t read other people\u2019s private messages. The Kitchen chat is for owners, managers, head chefs and kitchen staff, and can\u2019t be left."}),(0,O.jsx)(m.Sheet,{visible:N,onClose:()=>W(!1),title:"New private message",children:o.filter(e=>e.active&&e.id!==s).map(e=>(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:`Message ${e.name}`,onPress:()=>{W(!1),$((0,w.dmId)(s,e.id))},style:{paddingVertical:8},children:(0,O.jsxs)(m.Row,{children:[(0,O.jsx)(_,{s:e}),(0,O.jsxs)(u.default,{children:[(0,O.jsx)(m.T,{children:P(e.name)}),(0,O.jsxs)(m.Muted,{children:[f.ROLE_LABEL[e.role]," \xb7 ",e.job]})]})]})},e.id))}),(0,O.jsxs)(m.Sheet,{visible:K,onClose:()=>V(!1),title:"Chat settings",children:[(0,O.jsx)(m.Banner,{kind:"info",title:"Privacy",children:"Chat is for work. Managers and the owner see messages in the channels they belong to and the owner can remove messages in group chats. Private messages can only be read by the two people in them: the server enforces this, so nobody else (not even the owner) can read them. Don\u2019t share customer card or health details beyond what\u2019s needed for service."}),(0,O.jsx)(m.T,{weight:"semibold",children:"Mute channels"}),T.filter(e=>(0,w.inChannel)(e.id,Y)).map(e=>(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{children:[e.icon," ",e.name]}),(0,O.jsx)(m.Toggle,{label:`Mute ${e.name}`,value:c.includes(e.id),onChange:()=>f.useOwner.getState().chatMute(s,e.id)})]},e.id)),(0,O.jsx)(m.Muted,{children:"Muted channels don\u2019t count towards the tab badge. The Kitchen chat can be muted but not left."}),G?(0,O.jsxs)(u.default,{style:{gap:6},testID:"kitchen-members",children:[(0,O.jsx)(m.T,{weight:"semibold",children:"Kitchen chat members"}),(0,O.jsxs)(m.Muted,{children:["Automatic: owners, managers, head chefs and kitchen staff (chefs, kitchen porters). Change who else is in it here",y?'':'; saved on this device for now',"."]}),o.filter(e=>e.active).map(e=>{const t=R[e.id]??(0,w.kitchenByRule)(e);return(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{children:[P(e.name),null!=R[e.id]?' (changed)':'']}),(0,O.jsx)(m.Toggle,{label:`Kitchen chat: ${P(e.name)}`,value:t,onChange:t=>w.useKitchenExtra.getState().set(e.id,t===(0,w.kitchenByRule)(e)?null:t)})]},e.id)})]}):null]})]})}},1054,[1357,876,874,842,5,31,1044,197,264,128,818,863,822,825,953,977,996,1269,1268,824,1399,972,25]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SNOOZE_MINS",{enumerable:!0,get:function(){return S}}),e.useScheduledNotices=function({rid:u,staffId:S,name:w,onOpen:D}){const I=(0,t.useRef)(w);I.current=w;const N=(0,t.useRef)(D);N.current=D,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.location?.search)return;const t=new URLSearchParams(window.location.search);if('orderlists'===t.get('open'))o.useListOpen.getState().request(t.get('list')??void 0),setTimeout(()=>N.current?.('orderlists'),0);else if('chat'===t.get('open'))c.useChatOpen.getState().request(t.get('ch')??void 0),setTimeout(()=>N.current?.('chat'),0);else{const s=t.get('open');s&&v.includes(s)&&setTimeout(()=>N.current?.(s),0)}},[]);const O=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),b=(0,d.useReminders)(t=>t.done.length);(0,t.useEffect)(()=>{s.useNotifs.getState().ensure(u);const t=()=>{const t=h(),c=s.useNotifs.getState(),v=n.useOwner.getState().staff.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),w=v.filter(s=>!1!==s.active&&(0,p.shiftNow)(s.id,t).on).map(t=>t.id);for(const n of c.items){if(n.rid!==u)continue;const p=`sched:${n.id}`;if(!S||n.removed||n.paused||!n.sendBy.inApp||!(0,f.isRecipient)(n,S,v,w)){(0,l.dismissNotice)(p);continue}const{due:D,forDate:O}=(0,f.notifDue)(n,t),b=d.useReminders.getState().done.find(t=>t.reminderId===n.id&&t.forDate===O),R=`sched:${n.id}:${O}`;!D||b||(c.snooze[R]??0)>t?(0,l.dismissNotice)(p):(0,l.notify)({id:p,icon:'\ud83d\udd14',kicker:'NOTICE',title:n.title,body:n.message,testID:'sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'sched-notice-done',onPress:()=>d.useReminders.getState().markDone({rid:u,reminderId:n.id,forDate:O,at:new Date(h()).toISOString(),staffRef:S,staffName:I.current.replace(' (example)','')})},...'orderlists'===n.open?.page&&N.current?[{label:'Open list',testID:'sched-notice-open',onPress:()=>{o.useListOpen.getState().request(n.open?.list),N.current?.('orderlists')}}]:[],{label:'Later',kind:'ghost',testID:'sched-notice-later',onPress:()=>s.useNotifs.getState().setSnooze(R,h()+9e5)}]})}};t();const c=setInterval(t,2e4);return()=>clearInterval(c)},[u,S,O,b])};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),u=r(_d[6]),f=r(_d[7]),l=r(_d[8]),p=r(_d[9]);const h=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock).getTime()}catch{return Date.now()}},S=15,v=['bookings','rota','notifications','chat']},1055,[31,997,863,1059,1399,998,881,999,980,1000]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1056,[869,31,1264,863,881,870,1245,871,980,1391]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ListBadge=C,_e.OrderListsScreen=function({rid:e,who:t,editor:s,today:i}){(0,o.useEffect)(()=>{x.useOrderLists.getState().ensure(e)},[e]);const d=(0,x.useOrderLists)(e=>e.lists).filter(t=>t.rid===e&&!t.archived),n=(0,x.useOrderLists)(e=>e.items);(0,x.useOrderLists)(t=>t.settings[e]);const l=(0,x.orderSettingsOf)(e).allowStaff,h=(0,x.useListOpen)(e=>e.seed),[y,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(!h)return;const e=d.find(e=>e.seed===h);e&&(j(e.id),x.useListOpen.getState().request(void 0))},[h,d.length]);const f=s||l;if(!s&&!l)return(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{children:"Order lists are for managers and the Head Chef here."}),(0,w.jsx)(c.Muted,{children:"Ask a manager to switch on \u201cLet all staff add items\u201d."})]});const b=d.find(e=>e.id===y);if(b)return(0,w.jsx)($,{rid:e,list:b,editor:s,canAdd:f,who:t,today:i,onBack:()=>j(null)});const I=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"order-lists",children:[(0,w.jsxs)(c.Muted,{size:13,children:["Tip: add what\u2019s running low as you notice it. ",s?'On the day, tick what you got, then Finish order.':'A manager or the Head Chef places the order.']}),d.map(t=>{const s=(0,p.liveItems)(n.filter(t=>t.rid===e),t.id).filter(e=>'open'===e.status).length;return(0,w.jsx)(c.Card,{onPress:()=>j(t.id),children:(0,w.jsx)(u.default,{testID:`order-list-card-${t.seed??t.id}`,children:(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,i,I)})]}),(0,w.jsx)(c.Badge,{kind:s?'gold':'neutral',label:`${s} to get`})]})})},t.id)}),d.length?null:(0,w.jsx)(c.Muted,{children:"No order lists yet. Add one in Settings \u203a Advanced \u203a Order lists."})]})};var t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),o=r(_d[3]),d=e(r(_d[4])),n=e(r(_d[5]));r(_d[6]);var l=e(r(_d[7])),u=e(r(_d[8])),c=r(_d[9]),h=r(_d[10]),x=r(_d[11]),p=r(_d[12]),y=r(_d[13]),j=r(_d[14]),f=r(_d[15]),b=r(_d[16]),w=r(_d[17]);const I={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},L=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',v=e=>e.replace(' (example)','').split(' ')[0];function C({list:e,size:s=40}){const i=(0,f.useLogoCache)(t=>t.byList[e.id]),[n,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let t=!0;return!i&&e.logo&&(0,b.orderLogoUrl)(e.logo).then(e=>{t&&l(e)}),()=>{t=!1}},[e.logo,i]);const x=i??n;return x?(0,w.jsx)(d.default,{testID:`list-logo-${e.seed??e.id}`,source:{uri:x},accessibilityLabel:`${e.name} logo`,style:{width:s,height:s,borderRadius:s/2,borderWidth:1,borderColor:h.colours.gold}}):(0,w.jsx)(u.default,{testID:`list-initials-${e.seed??e.id}`,accessibilityLabel:`${e.name}`,style:{width:s,height:s,borderRadius:s/2,backgroundColor:(0,t.soutersSurface)('#1c1a16'),borderWidth:1,borderColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(c.T,{size:.38*s,weight:"bold",colour:h.colours.gold,children:(0,p.initials)(e.name)})})}function D({phone:e}){const t=(0,p.telHref)(e);if(!e||!t)return null;return'undefined'!=typeof navigator&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?(0,w.jsx)(l.default,{testID:"list-phone",accessibilityRole:"link",onPress:()=>{n.default.openURL(t)},children:(0,w.jsxs)(c.T,{colour:h.colours.gold,children:["\ud83d\udcde Call ",e]})}):(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(u.default,{testID:"list-phone",children:(0,w.jsxs)(c.T,{children:["\ud83d\udcde ",e]})}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"list-phone-copy",label:"Copy",onPress:()=>{navigator.clipboard?.writeText(e).then(()=>(0,y.notify)({id:'copied',title:'Number copied',timeoutMs:3e3}))}})]})}function T({list:e}){const t=x.useOrderLists.getState(),s=(0,f.useLogoCache)(t=>!!t.byList[e.id])||!!e.logo,i=async s=>{try{const i=await(0,j.capturePlatingPhoto)(s);if(!i)return;const o=await(0,f.squareLogo)(i.dataUrl,256);f.useLogoCache.getState().put(e.id,o);const d=await(0,b.uploadOrderLogo)(e.id,o);if(d.ok){const s=e.logo;t.updateList(e.id,{logo:d.path}),s&&(0,b.removeOrderLogo)(s)}else'offline'!==d.message&&(0,y.notify)({id:'logo',tone:'warn',title:'Logo saved on this device only',body:d.message,timeoutMs:7e3})}catch(e){(0,y.notify)({id:'logo',tone:'warn',title:'Couldn\u2019t use that picture',body:String(e.message),timeoutMs:7e3})}};return(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-camera",label:s?'Replace: take photo':'Logo: take photo',onPress:()=>{i('camera')}}),(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-library",label:s?'Replace: choose':'Logo: choose image',onPress:()=>{i('library')}}),s?(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"logo-remove",label:"Remove logo",onPress:()=>{f.useLogoCache.getState().drop(e.id),e.logo&&(0,b.removeOrderLogo)(e.logo),t.updateList(e.id,{logo:void 0})}}):null]})}function S({rid:e,list:t,who:i}){const[d,n]=(0,o.useState)(''),[l,y]=(0,o.useState)('1'),[j,f]=(0,o.useState)(''),[b,L]=(0,o.useState)(''),[C,D]=(0,o.useState)(null),T=x.useOrderLists.getState(),S=Number(l.replace(',','.')),B=d.trim().length>0&&(0,p.validQty)(S),$=()=>{n(''),y('1'),L(''),D(null)};return(0,w.jsxs)(u.default,{testID:"order-add",style:{gap:6},children:[(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Item",testID:"order-add-name",value:d,onChangeText:n,placeholder:"Item, e.g. Tennent\u2019s",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Quantity",testID:"order-add-qty",value:l,onChangeText:y,keyboardType:"decimal-pad",style:{...I,width:64,borderColor:(0,p.validQty)(S)?h.colours.hairline:h.colours.red}})]}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:p.UNITS.map(e=>(0,w.jsx)(c.Chip,{label:e||'no unit',selected:j===e,onPress:()=>f(e)},e||'none'))}),(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Note",testID:"order-add-note",value:b,onChangeText:L,placeholder:"Note (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(c.Button,{testID:"order-add-save",label:"Add",disabled:!B,onPress:()=>{const s=(0,p.findDuplicate)(T.items.filter(t=>t.rid===e),t.id,d,j);s?D(s):(T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$())}})]}),(0,w.jsxs)(c.Sheet,{visible:!!C,onClose:()=>D(null),title:"Already on the list",testID:"order-dup",children:[(0,w.jsx)(c.T,{children:C?`${C.name}: ${(0,p.qtyText)(C)} (added by ${v(C.addedByName)})`:''}),(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(c.Button,{testID:"order-dup-bump",label:`Add ${l} more`,onPress:()=>{C&&T.bump(C.id,S,i),$()}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Add as separate item",onPress:()=>{T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$()}})]})]})]})}function B({item:e,editor:t,who:s}){const i=x.useOrderLists.getState(),o='got'===e.status?h.colours.gold:'missing'===e.status?h.colours.amber:h.colours.text;return(0,w.jsxs)(u.default,{testID:`order-item-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.hairline,paddingVertical:8,gap:4},children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",colour:o,style:{flex:1,textDecorationLine:'got'===e.status?'line-through':'none'},children:e.name}),(0,w.jsx)(c.T,{weight:"semibold",children:(0,p.qtyText)(e)})]}),e.note?(0,w.jsxs)(c.Muted,{size:12,children:["Note: ",e.note]}):null,(0,w.jsxs)(c.Muted,{size:12,children:["Added by ",v(e.addedByName)," \xb7 ",L(e.addedAt),e.bumps?.length?` \xb7 +${e.bumps.map(e=>`${e.qty} ${v(e.name)}`).join(', ')}`:'',e.carried?' \xb7 carried over':'']}),'open'!==e.status?(0,w.jsxs)(c.Muted,{size:12,children:['got'===e.status?'Got / ordered':'Missing / not in stock'," \xb7 ",e.statusBy," ",L(e.statusAt)]}):null,t?(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Chip,{testID:`order-got-${e.id}`,label:"\u2713 Got / ordered",selected:'got'===e.status,onPress:()=>i.setStatus(e.id,'got'===e.status?'open':'got',s)}),(0,w.jsx)(c.Chip,{testID:`order-missing-${e.id}`,label:"Missing / not in stock",selected:'missing'===e.status,onPress:()=>i.setStatus(e.id,'missing'===e.status?'open':'missing',s)}),(0,w.jsx)(c.Chip,{testID:`order-remove-${e.id}`,label:"Remove",onPress:()=>{i.removeItem(e.id),(0,y.notify)({id:`undo-${e.id}`,title:`Removed ${e.name}`,timeoutMs:8e3,actions:[{label:'Undo',testID:'order-undo',onPress:()=>i.undoRemove(e.id)}]})}})]}):null]})}function $({rid:e,list:t,editor:d,canAdd:n,who:l,today:j,onBack:f}){(0,i.useBackLayer)(!0,f);const b=(0,x.useOrderLists)(e=>e.items),$=(0,x.useOrderLists)(e=>e.history).filter(e=>e.listId===t.id),P=(0,p.liveItems)(b.filter(t=>t.rid===e),t.id),[k,R]=(0,o.useState)(!1),[O,M]=(0,o.useState)(!1),[A,z]=(0,o.useState)(t.phone??''),N=x.useOrderLists.getState(),q=P.filter(e=>'got'!==e.status).length,H=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:`order-list-${t.seed??t.id}`,children:[(0,w.jsx)(i.BackButton,{onPress:f,testID:"order-list-back"}),(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t,size:48}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{size:18,weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,j,H)})]})]}),(0,w.jsx)(D,{phone:t.phone}),'trip'===t.kind&&d?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(c.Muted,{size:12,children:"Trip day for this trip"}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:[1,2,3,4,5,6,0].map(e=>(0,w.jsx)(c.Chip,{testID:`trip-day-${e}`,label:p.DAY_FULL[e].slice(0,3),selected:(t.tripDay??H)===e,onPress:()=>N.updateList(t.id,{tripDay:e})},e))})]}):null,d?(0,w.jsxs)(u.default,{style:{gap:6},children:[(0,w.jsx)(c.Row,{gap:6,children:(0,w.jsx)(s.TextInput,{accessibilityLabel:"Phone number",testID:"list-phone-edit",value:A,onChangeText:z,onBlur:()=>N.updateList(t.id,{phone:A.trim()||void 0}),placeholder:"Phone (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}})}),(0,w.jsx)(T,{list:t})]}):null]}),n?(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{weight:"semibold",children:"Add to this list"}),(0,w.jsx)(S,{rid:e,list:t,who:l})]}):null,(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",children:"On the list"}),(0,w.jsx)(c.Badge,{kind:"neutral",label:`${P.length}`})]}),P.length?P.map(e=>(0,w.jsx)(B,{item:e,editor:d,who:l},e.id)):(0,w.jsx)(c.Muted,{children:"Nothing on this list yet."}),d&&P.length?(0,w.jsx)(c.Button,{testID:"order-finish",label:"Finish order",onPress:()=>R(!0)}):null]}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"order-history",label:O?'Hide history \u25b4':`History (${$.length}) \u25be`,onPress:()=>M(!O)}),O?$.map(e=>(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.T,{weight:"semibold",children:[L(e.finishedAt)," \xb7 ",v(e.finishedByName)]}),(0,w.jsx)(c.Muted,{size:12,children:e.items.map(e=>`${e.name} ${(0,p.qtyText)(e)}${'missing'===e.status?' (missing)':'open'===e.status?' (not got)':''}`).join(' \xb7 ')}),e.carried?(0,w.jsxs)(c.Muted,{size:12,children:[e.carried," carried over"]}):null]},e.id)):null,(0,w.jsxs)(c.Sheet,{visible:k,onClose:()=>R(!1),title:"Finish this order?",testID:"order-finish-sheet",children:[(0,w.jsxs)(c.T,{children:[P.length-q," got or ordered",q?`, ${q} not got (missing or still open)`:'',"."]}),(0,w.jsx)(c.Muted,{children:"It goes into History with today\u2019s date and your name."}),q?(0,w.jsxs)(c.T,{weight:"semibold",children:["Carry over the ",q," not got to the next order?"]}):null,(0,w.jsxs)(c.Row,{wrap:!0,gap:8,children:[q?(0,w.jsx)(c.Button,{testID:"order-finish-carry",label:"Finish and carry over",onPress:()=>{N.finish(e,t.id,!0,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,body:`${q} carried over`,timeoutMs:6e3})}}):null,(0,w.jsx)(c.Button,{testID:"order-finish-clear",kind:q?'secondary':'primary',label:q?'Finish, don\u2019t carry over':'Finish order',onPress:()=>{N.finish(e,t.id,!1,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,timeoutMs:6e3})}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>R(!1)})]})]})]})}},1057,[876,874,1044,31,197,240,123,264,128,818,825,1059,1263,980,1397,1398,824,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PhoneAlerts=function({what:e="reminders and alerts set for you"}){const[s,h]=(0,t.useState)(null),[u,p]=(0,t.useState)(null),[y,f]=(0,t.useState)(null);(0,t.useEffect)(()=>{let e=!0;return(0,r.inApkWebView)()?h('apk'):(0,r.pushState)().then(t=>{e&&h(t)}).catch(()=>{e&&p('Could not check alerts. Try again.')}),()=>{e=!1}},[]);const b='on'===s?'Alerts are on for this phone.':'blocked'===s?i.BLOCKED_INTRO:'ios-home-screen'===s?'iPhone: add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.':'unsupported'===s?'This browser can\u2019t get alerts when the phone is locked. Open CoverCharge in Chrome.':null;return(0,c.jsxs)(n.default,{testID:"phone-alerts",style:{gap:10,alignItems:'center'},children:[(0,c.jsxs)(l.T,{center:!0,size:16,children:["Get the ",e," on this phone, even when the app is closed."]}),'apk'===s?(0,c.jsx)(l.T,{size:18,weight:"bold",colour:o.colours.gold,center:!0,testID:"alerts-open-chrome",children:"Open CoverCharge in Chrome to turn on alerts"}):null,b?(0,c.jsx)(l.T,{center:!0,size:15,testID:"alerts-status",children:b}):null,'off'===s?(0,c.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,c.jsx)(l.Button,{label:"Turn on alerts",testID:"turn-on-alerts",accessibilityLabel:"Turn on alerts. Your phone will then ask to allow notifications: tap Allow.",style:{minHeight:64,minWidth:260},onPress:async()=>{p(null);try{const e=await(0,r.turnOnPush)();p(e.message),e.ok?h('on'):h(await(0,r.pushState)())}catch{p('Could not turn on alerts. Please try again.')}}}),(0,c.jsx)(l.T,{size:16,center:!0,testID:"alerts-allow-line",children:"When your phone asks, tap Allow."})]}):null,'blocked'===s?(0,c.jsx)(n.default,{style:{gap:6,alignItems:'center',alignSelf:'stretch'},testID:"alerts-blocked-steps",accessible:!0,accessibilityLabel:i.BLOCKED_SPOKEN,children:i.BLOCKED_STEPS.map((e,t)=>(0,c.jsx)(l.T,{size:15,center:!0,children:`${t+1}. ${e}`},t))}):null,'blocked'===s?(0,c.jsx)(l.Button,{label:"I\u2019ve allowed it, check again",testID:"alerts-recheck",accessibilityLabel:"I\u2019ve allowed it. Check again.",style:{minHeight:64,minWidth:260},onPress:async()=>{p(null);try{if('blocked'===await(0,r.pushState)())return void p(i.STILL_OFF);const e=await(0,r.turnOnPush)();p(e.message),h(e.ok?'on':await(0,r.pushState)())}catch{p('Could not check alerts. Please try again.')}}}):null,'on'===s?(0,c.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,c.jsx)(l.Button,{label:"Send me a test notification",testID:"push-test",accessibilityLabel:"Send me a test notification. It goes only to your own phone.",style:{minHeight:56,minWidth:260},onPress:async()=>{f('Sending\u2026'),f((await(0,r.sendTestPush)()).message)}}),y?(0,c.jsx)(n.default,{accessibilityLiveRegion:"polite",children:(0,c.jsx)(l.T,{size:15,center:!0,testID:"push-test-msg",children:y})}):null,(0,c.jsx)(l.Button,{small:!0,kind:"ghost",label:"Turn off alerts on this phone",testID:"turn-off-alerts",onPress:async()=>{const e=await(0,r.turnOffPush)();p(e.message),h(await(0,r.pushState)())}})]}):null,u?(0,c.jsx)(n.default,{accessibilityLiveRegion:"assertive",accessibilityRole:'alert',children:(0,c.jsx)(l.T,{size:15,center:!0,testID:"push-msg",children:u})}):null,(0,c.jsx)(l.Muted,{center:!0,size:13,children:"For this phone only. Each person turns it on on their own phone."})]})};var e,t=_r(d[0]),s=_r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(d[2]),i=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6])},1058,[31,128,818,1042,825,1363,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"orderListSeedId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"orderListSettingsId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"orderListSeeds",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useOrderLists",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"orderSettingsOf",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"useListOpen",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),p=r(d[5]),l=r(d[6]);const c=(e,t)=>(0,u.uuidFrom)(`order-list:${t}:${e}`),S=e=>(0,u.uuidFrom)(`order-list-settings:${e}`),f=e=>'anchorage'===e?[{id:c(e,'allsons'),seed:'allsons',name:'Alsons (drinks)',kind:'running'},{id:c(e,'cash-carry'),seed:'cash-carry',name:'Cash and carry',kind:'trip',tripDay:5}]:[],A=()=>(new Date).toISOString(),O=(0,i.create)()((0,n.persist)((e,t)=>({lists:[],items:[],history:[],settings:{},ensure:s=>{const i=t(),n=new Set(i.lists.map(e=>e.id)),u=f(s).filter(e=>!n.has(e.id)).map(e=>({...e,rid:s})),p={},c=i.lists.map(e=>(0,l.fixSupplierNames)(e.name)!==e.name?{...e,name:(0,l.fixSupplierNames)(e.name),updatedAt:A()}:e);c.some((e,t)=>e!==i.lists[t])&&(p.lists=c),u.length&&(p.lists=[...p.lists??i.lists,...u]),i.settings[s]||(p.settings={...i.settings,[s]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(s)}}),Object.keys(p).length&&e(p)},addList:(t,s)=>{const i=(0,p.uuid)();return e(e=>({lists:[...e.lists,{...s,id:i,rid:t,updatedAt:A()}]})),i},updateList:(t,s)=>e(e=>({lists:e.lists.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),addItem:(t,s)=>{const i=(0,p.uuid)(),n=s.addedAt??A();return e(e=>({items:[...e.items,{...s,id:i,rid:t,status:'open',addedAt:n,updatedAt:n}]})),i},bump:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...(0,o.bumpQty)(e,s,i.id,i.name,A()),rid:e.rid}:e)})),updateItem:(t,s)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),setStatus:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,status:s,statusBy:'open'===s?void 0:i.name,statusAt:'open'===s?void 0:A(),updatedAt:A()}:e)})),removeItem:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!0,updatedAt:A()}:e)})),undoRemove:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!1,updatedAt:A()}:e)})),finish:(s,i,n,u)=>{const l=t().lists.find(e=>e.id===i);if(!l)return null;const c=A(),{round:S,drop:f,carriedOver:O}=(0,o.finishOrder)(l,t().items,n,u,c,p.uuid),_=new Set(f),y=new Map(O.map(e=>[e.id,e])),T={...S,rid:s};return e(e=>({items:e.items.filter(e=>!_.has(e.id)).map(e=>y.has(e.id)?{...y.get(e.id),rid:e.rid}:e),history:[T,...e.history].slice(0,300),lists:e.lists.map(e=>e.id===i?{...e,nextTrip:void 0,updatedAt:c}:e)})),T},setSettings:(t,s)=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,...e.settings[t],...s,id:S(t),updatedAt:A()}}})),resetSettings:t=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(t),updatedAt:A()}}}))}),{name:'covercharge-order-lists-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)})),_=e=>({...o.DEFAULT_ORDER_LIST_SETTINGS,...O.getState().settings[e]}),y=(0,i.create)()(e=>({request:t=>e({seed:t})}))},1059,[1160,995,1169,1178,1263,1099,1262]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return E}}),_e.personFromStaff=H,_e.signInWithText=V,_e.SignInWithLink=z,_e.signInWithHandover=F,_e.useSignedOutGate=function(){const e=(0,k.useSession)(e=>e.meId),n=(0,b.useSync)(e=>'device'===e.kind&&!!e.venueId);return h.IS_CAR?!S.PITCH&&!n:C.includes(h.APP_VARIANT)&&!S.PITCH&&!e&&!K()},_e.InviteGate=function(){const[e,N]=(0,u.useState)(k.useSession.persist.hasHydrated()),[H,V]=(0,u.useState)(k.START_INVITE||k.START_HANDOVER||k.START_KITCHEN?'checking':'done'),[L,U]=(0,u.useState)(null),[G,B]=(0,u.useState)(null),[Y,$]=(0,u.useState)(0),[X,Q]=(0,u.useState)(!1),[q,J]=(0,u.useState)(null),Z=(0,k.useSession)(e=>e.meId),ee=(0,k.useSession)(e=>!Z||!!e.welcomed[Z]);if((0,u.useEffect)(()=>{const e=k.useSession.persist.onFinishHydration(()=>N(!0));return k.useSession.persist.hasHydrated()&&N(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!C.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=k.useSession.getState().meId;if(k.START_KITCHEN&&'chef'===h.APP_VARIANT&&!e){const e=await(0,b.claimDisplayKitchen)(k.START_KITCHEN);if(!t)return;if('ok'===e.status&&e.id.staffRef){(0,y.markKitchenViaDisplay)(!0,e.id.displayName),M(e.id);try{k.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void V('done')}return U('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void V('done')}if(k.START_HANDOVER&&!k.START_INVITE&&!W){W=!0;const n=await(0,b.claimChromeHandover)(k.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef)M(n.id);else if('refused'===n.status&&!e)return B(n.message),void V('done')}if(k.START_INVITE&&!(e&&await(0,b.signedInHereAs)(e)&&await(0,b.rememberedInviteHere)(k.START_INVITE))){const e=await D(k.START_INVITE,e=>{t&&B(e)});if(!t)return;if('refused'===e.kind)return B(e.message),void V('done');if('offline'===e.kind)return Q(!0),void(n=setTimeout(()=>{t&&$(e=>e+1)},1e4));if(Q(!1),'bad'===e.kind)return void V('bad')}const s=O(k.useSession.getState().meId),o=s&&!1!==w.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)k.useSession.getState().signOut();else if(s&&!R(s)&&!k.START_INVITE&&await(0,b.signedInHereAs)(s.id)){if(await(0,b.forgetSignInHere)(),!t)return;k.useSession.getState().signOut(),J(E(s.app))}else if(s&&!R(s)){const e=(0,k.appUrl)(s.app,k.START_INVITE);if(e)return void window.location.replace(e)}V('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,Y]),!C.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(t.QueuedVenueWelcome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?'This link cannot be used here. Ask your authorised manager.':X?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(o.GreensideStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(r.AbbotsfordStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?'This link cannot be used here. Ask your authorised manager.':X?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(l.KirktonStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(s.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Z){const t=s.IsolatedStaffHome,o=k.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(t,{app:o,message:l})})}if(X)return _('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===H)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if(h.IS_OWNER_DESKTOP&&!Z&&!S.PITCH&&!K())return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(p.DesktopSignIn,{onCode:F,refused:G})});if((0,A.inPhoneApp)()&&!Z&&!S.PITCH)return G&&/already been used/i.test(G)?_(P,'invite-app-used'):G&&(0,x.isPhoneLinked)(G)?_(x.PHONE_LINKED_TEXT,'invite-phone-linked'):G?_(G,'invite-app-refused'):_(v,'invite-app-notsetup');if('bad'===H)return(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,j.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,j.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V('done')}),(0,j.jsx)(I.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(G&&!Z&&(0,x.isPhoneLinked)(G))return(0,j.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${x.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,j.jsx)(I.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,j.jsx)(I.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,j.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(G&&!Z)return(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,j.jsx)(I.Muted,{center:!0,children:G}),(0,j.jsx)(I.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,j.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>B(null)})]});if(q&&!Z)return(0,j.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,j.jsx)(I.Muted,{center:!0,children:q}),(0,j.jsx)(z,{})]});if(L&&!Z){const e=/expired/i.test(L);return(0,j.jsxs)(f.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,j.jsx)(I.Muted,{center:!0,children:L}),(0,j.jsx)(I.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!Z&&!S.PITCH&&!K())return(0,j.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:G?'This link can\u2019t be used here':'Sign in to CoverCharge'}),G?(0,j.jsx)(I.Muted,{center:!0,children:G}):null,(0,j.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,j.jsx)(z,{})]});const ne=(0,k.rosterPerson)(Z);return ne&&!ee&&R(ne)&&!(0,y.isKitchenViaDisplay)()?(0,j.jsx)(T.LaunchWelcome,{p:ne,onDone:()=>k.useSession.getState().markWelcomed(ne.id)}):null};var n=_r(d[0]),t=_r(d[1]),s=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),I=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]),w=_r(d[21]),j=_r(d[22]);const P='This app copy has already been set up on another phone. Ask your manager for a new link.',v='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',_=(e,n)=>(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e})}),C=['owner','staff','chef'],R=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,E=e=>`You now use ${k.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function N(e){k.useSession.getState().signIn(e.id);const n=w.useOwner.getState();w.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function H(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const O=e=>{const n=(0,k.rosterPerson)(e);if(n)return n;const t=e?w.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?H(t):void 0};async function D(e,n){const t=await(0,k.personForInvite)(e);if(t)return N(t),R(t)?((0,b.claimInvite)(e).then(e=>{if('refused'===e.status&&k.useSession.getState().meId===t.id&&(k.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==k.useSession.getState().meId){const n=O(e.id.staffRef);n&&N(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const s=await(0,b.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=O(s.id.staffRef)??H({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return N(o),{kind:'ok',p:o}}async function V(e,n=()=>{}){const t=(0,k.inviteFromText)(e);if(!t)return'bad';const s=await D(t,n);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!R(o)){const e=(0,k.appUrl)(o.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,s]=(0,u.useState)('');return(0,j.jsxs)(f.default,{style:{gap:6},children:[(0,j.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,j.jsx)(I.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await V(e,s);s('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,j.jsx)(I.T,{size:13,colour:m.colours.red,children:t}):null]})}function M(e){if(!e.staffRef)return;N(O(e.staffRef)??H({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function F(e){const n=await(0,b.claimChromeHandover)(e);return'ok'===n.status?n.id.staffRef?(M(n.id),'ok'):'bad':'refused'===n.status?{refused:n.message}:'offline'===n.status?'offline':'bad'}let W=!1;const K=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1060,[5,1520,1521,1522,1523,1524,31,123,47,128,807,1525,866,825,1527,818,824,979,2,1392,1240,863,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1061,[31,264,207,128,288,825,1444,25]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=j,_e.periodPay=T,_e.MyHoursPay=C,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),j=(0,a.useOwner)(e=>e.staff),k=(0,i.useMemo)(()=>j.filter(e=>e.active),[j]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:M,rid:v}=(0,y.useCtx)(6e4),N=(0,b.useVenuePay)(v).pay,[B,O]=(0,i.useState)(-1),[L,$]=(0,i.useState)(null),[S,H]=(0,i.useState)(''),[I,W]=(0,i.useState)(null),E=(0,i.useMemo)(()=>k.map(e=>({...T(e.id,B,M,R,D[e.id]??0,N,z),person:e})),[k,B,R,D,N,z]),_=E.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),V=E[0]?.label??'',F=k.find(e=>e.id===L),G=Math.round(100*Number(S));return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,f.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,f.jsx)(P,{label:V,offset:B,setOffset:O,badge:0===B?'Current period':void 0}),(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),E.map(e=>(0,f.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>W(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,f.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:x(e.person.name)}),c&&e.person.noTax?(0,f.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),H(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,f.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]$(null),title:`Hourly rate: ${x(F?.name)}`,children:[(0,f.jsx)(l.Muted,{children:F?`${F.level??a.ROLE_LABEL[F.role]} \xb7 ${F.job}${F.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(F,D[F.id],u.gbp)}`:''}),(0,f.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",value:S,onChangeText:H,style:l.styles.input}),Number.isFinite(G)&&G>0&&G{a.useOwner.getState().setRate(L,G),$(null)}}),L&&null!=D[L]?(0,f.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(L),$(null)}}):null]}),(0,f.jsx)(l.Sheet,{visible:!!I,onClose:()=>W(null),title:`What ${x(k.find(e=>e.id===I)?.name)} sees`,children:I?(0,f.jsx)(C,{staffId:I}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const x=e=>(e??'').replace(' (example)',''),w='Before tax and deductions, estimate';function j(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>T(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function T(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function P({label:e,offset:s,setOffset:t,badge:i}){return(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,f.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e}),i?(0,f.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function C({staffId:e}){const{meId:s,now:C,rid:k}=(0,y.useCtx)(6e4),D=e??s,R=(0,b.useVenuePay)(k).pay,z=(0,a.useOwner)(e=>e.staff).find(e=>e.id===D),M=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[D]??0,O=null!=N[D],[L,$]=(0,i.useState)(0),S=j(D,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...T(D,e,C,M,B,R,v)})),[D,M,B,R,v]);return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Banner,{kind:"info",title:w,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,f.jsxs)(l.Muted,{children:[x(z?.name)," \xb7 ",z?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",R.wagePayDay,[1,21,31].includes(R.wagePayDay)?'st':[2,22].includes(R.wagePayDay)?'nd':[3,23].includes(R.wagePayDay)?'rd':'th',", cut-off the ",R.wageCutoffDay,[1,21].includes(R.wageCutoffDay)?'st':[2,22].includes(R.wageCutoffDay)?'nd':[3,23].includes(R.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,f.jsx)(P,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Confirmed paid hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,f.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Gross pay from hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Tips allocated"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,f.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,f.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,f.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,f.jsxs)(l.Muted,{children:[w,". Tips are shown separately and only once a tip period is approved."]})]}),(0,f.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,f.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,f.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,f.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,f.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,f.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,f.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,f.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,f.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,f.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,f.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,f.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.label}),(0,f.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,f.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",w.toLowerCase()]})]})},e.o))]})}},1062,[874,1442,31,264,128,288,818,863,820,822,825,1079,953,1366,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,v=(0,f.tipsPeriod)(w,S.start,1),z=(0,f.wagePeriod)(w,D.start,1),H=e=>{l({...a,...e}),x(null)};return(0,M.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,M.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,M.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,M.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,M.jsx)(h.Chip,{label:$[e],selected:a.tipsFrequency===e,onPress:()=>H({tipsFrequency:e})},e))}),(0,M.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,M.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,M.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,M.jsxs)(h.Row,{children:[(0,M.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>H({tipsEndsDaysBefore:e})}),(0,M.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,M.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,M.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>H({wagePayDay:e})})]}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,M.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>H({wageCutoffDay:e})})]}),(0,M.jsxs)(h.Muted,{children:["Period runs the ",R(a.wageCutoffDay)," to the ",R(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,M.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,M.jsx)(h.Chip,{label:B[e],selected:(a.weekendRule??'none')===e,onPress:()=>H({weekendRule:e})},e))})]}),(0,M.jsx)(T.SectionHead,{title:"Preview"}),(0,M.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,M.jsx)(I,{label:"Next tips payday",day:S.payday,period:S}),(0,M.jsx)(I,{label:"Then",day:v.payday,period:v}),(0,M.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,M.jsx)(I,{label:"Next payday",day:D.payday,period:D}),(0,M.jsx)(I,{label:"Then",day:z.payday,period:z})]}),(0,M.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,M.jsx)(h.Banner,{kind:"success",title:y}):null,(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=H,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return V}}),_e.summaryTable=E,_e.detailTable=Y,_e.copyText=G,_e.periodOptions=U,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:$}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:$,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:W}=(0,k.useVenuePay)(s),L=(0,y.useOwner)(e=>e.staff),N=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),J=(0,P.useHourly)(),K=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,M.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,M.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,M.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>U(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>H(ye,L,N,r,J),[ye.key,L,N,J,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage($)?(0,M.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===W?(0,M.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,M.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,M.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,M.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,M.jsx)(_,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,M.jsx)(h.Card,{highlight:b.colours.gold,children:(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,M.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,M.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,M.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,M.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,M.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,M.jsx)(v.HoursExport,{}),B?(0,M.jsx)(i.default,{style:{alignItems:'center'},children:(0,M.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,M.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,M.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,M.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,M.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,M.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await G(F(E(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,V(E(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,V(Y(ge))),Te('CSV downloaded (one line per shift).')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=E(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,M.jsx)(h.Banner,{kind:"success",title:he}):null,K?(0,M.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,M.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,M.jsx)(u.HoursSummaryCard,{name:A(e.person),role:O(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,M.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${A(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,M.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,M.jsx)(o.WideTable,{children:(0,M.jsxs)(i.default,{testID:"hours-table",children:[(0,M.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,M.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:q[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,M.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,M.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${A(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,M.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,M.jsxs)(i.default,{style:{width:q[0]},children:[(0,M.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",A(e.person)]}),(0,M.jsx)(h.Muted,{children:O(e.person)})]}),(0,M.jsx)(h.T,{size:14,style:{width:q[1]},children:e.shifts}),(0,M.jsx)(h.T,{size:14,weight:"semibold",style:{width:q[2]},children:(0,l.durText)(e.confirmed)}),(0,M.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:q[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,M.jsx)(h.T,{size:14,style:{width:q[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,M.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:q[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,M.jsxs)(h.T,{size:14,weight:"semibold",style:{width:q[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,M.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,M.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:q[0]},children:["Total (",ge.length,")"]}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[1]},children:me.s}),(0,M.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:q[2]},children:(0,l.durText)(me.c)}),(0,M.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:q[3]},children:(0,l.durText)(me.p)}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,M.jsx)(h.T,{size:14,style:{width:q[5]},children:" "}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,M.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,M.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,M.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,M.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,M.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,M.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,v]=(0,n.useState)(0),$=(0,f.tipsPeriod)(u,S.period.start,D),[B,R]=(0,n.useState)(''),[I,z]=(0,n.useState)({}),[L,N]=(0,n.useState)(null),E=(0,n.useMemo)(()=>H($,p,T,a,{}),[$.key,p,T]),Y=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>I[e.id]??Y(e),_=E.filter(e=>e.confirmed>0||e.pending>0),q=Math.round(100*Number(B.replace(/[\xa3,\s]/g,''))),J=Number.isFinite(q)&&q>0&&q<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(B),K=_.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:Q}=(0,w.allocate)(J?q:0,K.map(e=>e.confirmed)),X={};K.forEach((e,s)=>{X[e.person.id]=Q[s]});const Z=K.reduce((e,s)=>e+s.confirmed,0),ee=Object.values(X).reduce((e,s)=>e+s,0),se=_.filter(e=>e.pending>0&&!U(e.person)),te=se.reduce((e,s)=>e+s.pending,0),oe=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],..._.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[A(e.person),O(e.person),(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&Z?(e.confirmed/Z*100).toFixed(2):'0.00',s?W(X[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(Z),(0,f.hMm)(Z),Z?'100.00':'0.00',W(ee)]],ne=e=>{N(e),setTimeout(()=>N(null),6e3)};return(0,M.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,M.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,M.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,M.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>v(D-1)}),(0,M.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,M.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)($.start,$.end)}),(0,M.jsxs)(h.Muted,{children:[(0,f.ukDate)($.start)," to ",(0,f.ukDate)($.end)," \xb7 ",$.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)($.payday)]}),0===D?(0,M.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>v(D+1)})]}),(0,M.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,M.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,M.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,M.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,M.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:B,onChangeText:R,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),B&&!J?(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,M.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),se.length?(0,M.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,M.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,M.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(te)," not approved yet"]}),(0,M.jsxs)(h.T,{size:14,children:[se.map(e=>`${A(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):_.length?(0,M.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,M.jsx)(o.WideTable,{children:(0,M.jsxs)(i.default,{testID:"tips-table",children:[(0,M.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,M.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),_.map(e=>{const s=U(e.person),t=X[e.person.id]??0;return(0,M.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,M.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${A(e.person)}`,onPress:()=>z({...I,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,M.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,M.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,M.jsxs)(i.default,{style:{width:150},children:[(0,M.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:A(e.person)}),(0,M.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':O(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,M.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,M.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&Z?`${(e.confirmed/Z*100).toFixed(1)}%`:'\u2013'}),(0,M.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,M.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,M.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",K.length," people)"]}),(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(Z)," h"]}),(0,M.jsx)(h.T,{size:14,style:{width:64},children:Z?'100%':'\u2013'}),(0,M.jsx)(h.T,{size:15,weight:"bold",colour:J&&ee===q?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(ee)})]})]})}),_.length?null:(0,M.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),J&&Z?(0,M.jsxs)(h.Muted,{children:["Check: ",K.length," shares add up to ",(0,x.gbp)(ee)," of ",(0,x.gbp)(q)," ",ee===q?'\u2713':'',". \xa3",(q/100/(Z/60)).toFixed(4)," per confirmed hour."]}):null,(0,M.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!J,onPress:async()=>{const e=await G(F(oe()));ne(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!J,onPress:()=>{(0,j.downloadText)(`tips-${$.start}-to-${$.end}.csv`,V(oe())),ne('CSV downloaded.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!J,onPress:()=>{const e=oe();(0,j.printTable)(`Tips ${(0,f.rangeText)($.start,$.end)} (paid ${(0,f.dayMonth)($.payday)})`,`Total ${(0,x.gbp)(q)} shared by confirmed hours${se.length?` \xb7 WARNING ${(0,f.decH)(te)} h not signed off`:''}`,e[0],e.slice(1))}})]}),L?(0,M.jsx)(h.Banner,{kind:"success",title:L}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,M.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,M.jsx)(r.CardHeading,{right:'none'===n?(0,M.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:["Next tips payday: ",(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,M.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:["Next payday: ",(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,M.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,M.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,M.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,M.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?H(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,M.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,M.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,M.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,M.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,M.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,M.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,M.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),v=_r(_d[26]),M=_r(_d[27]);const $={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},B={none:'Keep the date',before:'Friday before',after:'Monday after'};const R=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function I({label:e,day:s,period:t}){return(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:[e,": ",(0,M.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,M.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const z=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function H(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:z(e.in),outT:z(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const O=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,A=e=>e.name.replace(' (example)',''),W=e=>null==e?'':(e/100).toFixed(2),L=e=>e.replace(/[\t\r\n]+/g,' '),N=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,F=e=>e.map(e=>e.map(L).join('\t')).join('\n'),V=e=>e.map(e=>e.map(N).join(',')).join('\r\n');function E(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[A(e.person),O(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[W(e.rate),W(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',W(d.g)]:[]]]}function Y(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[A(e.person),O(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function G(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function U(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function _({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,M.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,M.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,M.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,M.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,M.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const q=[150,54,100,90,48,62,70]},1063,[874,834,1442,31,1443,123,264,288,128,1445,1446,1447,818,881,863,820,1365,825,1359,1065,1079,953,1366,1448,807,1449,1453,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ee,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return se}}),_e.rotaGrid=ne,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:o}=(0,$.useCtx)(6e4),i=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),r=(0,s.useOwner)(e=>e.shifts),d=(0,$.useHourly)(),u=(0,s.useOwner)(e=>e.availability),m=(0,s.useOwner)(e=>e.leave),x=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[I,M]=(0,l.useState)(0),B=(0,Y.useDateCalendar)(),[P,R]=(0,l.useState)(null),[A,z]=(0,l.useState)(null),[H,W]=(0,l.useState)(null),[F,G]=(0,l.useState)('week'),[Q,ie]=(0,l.useState)(!1),le=(0,$.useSignedIn)()?.name??'',re='staff'!==n,de=(0,C.addMins)(Z(t),7*I*1440);de.setHours(0,0,0,0);const ce=ee(de),ue=ce.sales,he='none'===ce.mode,fe=Array.from({length:7},(e,t)=>{const s=new Date(de);return s.setDate(de.getDate()+t),(0,C.ymd)(s)}),me=(0,s.visibleShifts)(r,re).filter(e=>e.date>=fe[0]&&e.date<=fe[6]),ge=(()=>{const e=new Date(de);return e.setDate(e.getDate()-7),(0,C.ymd)(e)})(),pe=me.filter(e=>!e.published||e.changed).length,xe=r.filter(e=>e.date>=ge&&e.date!!(0,s.leaveOn)(m,e,t),je=fe.map(e=>(0,g.workingShifts)(me,m).filter(t=>t.date===e).reduce((e,t)=>{return e+(X(s=t)-J(X(s)))*(d[s.staffId]??0);var s},0)),we=je.reduce((e,t)=>e+t,0),ye=ue.reduce((e,t)=>e+t,0),ke=(e,t)=>t?Math.round(e/t*100):0,Ie=re?i:i.filter(e=>e.id===o),Se=(0,a.useNarrow)(),Ce=Math.max(0,fe.indexOf((0,C.ymd)(t))),[De,ve]=(0,l.useState)(null),Te=De??Ce,$e=(e,t)=>!Se||t===Te,[Oe,Me]=(0,l.useState)(0),Be=ne(Oe,Se?1:7),Pe=Be.cell,Re=Be.name;return(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Week",selected:'week'===F,onPress:()=>G('week')}),(0,V.jsx)(f.Chip,{label:`Swaps & time off (${x.filter(e=>'open'===e.status).length+m.filter(e=>'pending'===e.status).length})`,selected:'requests'===F,onPress:()=>G('requests')}),(0,V.jsx)(f.Chip,{label:"Availability",selected:'availability'===F,onPress:()=>G('availability')})]}),'week'===F?(0,V.jsxs)(V.Fragment,{children:[!re&&o?(0,V.jsx)(k.RequestTimeOff,{meId:o,me:le,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,V.jsx)(h.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,V.jsx)(f.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,N.timeSheetLabel)(fe[0],fe[6]),onPress:()=>{(0,N.setHoursPreset)(fe[0],fe[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,V.jsxs)(h.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Oe?Math.min(Oe,Be.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{M(I-1),R(null)},style:{minWidth:96}}),(0,V.jsxs)(h.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,V.jsxs)(f.T,{weight:"semibold",center:!0,children:["Week of ",(0,C.niceDate)(de)]}),(0,V.jsxs)(f.Muted,{center:!0,children:[0===I?'This week':1===I?'Next week':-1===I?'Last week':I>0?`In ${I} weeks`:-I+" weeks ago",re?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{M(I+1),R(null)},style:{minWidth:96}})]}),(0,V.jsx)(h.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:B.openCal,style:{minWidth:96}})}),(0,V.jsx)(Y.AppDateCalendar,{visible:B.calOpen,today:(0,C.ymd)(t),day:(0,C.ymd)(de),idPrefix:"rota-cal",onClose:B.closeCal,onDay:e=>{M((0,Y.weekOffsetOf)(e??(0,C.ymd)(t),(0,C.ymd)(t))),R(null)}}),re?(0,V.jsxs)(f.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,V.jsx)(f.Button,{small:!0,kind:"secondary",label:"Copy last week"+(xe?` (${xe})`:''),disabled:!xe,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(ge,fe[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,V.jsx)(f.Button,{small:!0,kind:"success",label:pe?`Publish ${pe} ${1===pe?'change':'changes'}`:'Week published',disabled:!pe,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(fe[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),pe?(0,V.jsx)(f.Badge,{kind:"amber",label:`${pe} unpublished`}):me.length?(0,V.jsx)(f.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,P?(0,V.jsx)(f.Banner,{kind:"success",title:P}):null,Se?(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:$.DAY3.map((e,t)=>q.IS_CAR?(0,V.jsx)(f.Button,{kind:t===Te?'primary':'secondary',label:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}`,accessibilityLabel:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}${t===Te?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>ve(t),style:{minHeight:64,minWidth:96}},e):(0,V.jsx)(f.Chip,{label:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}`,selected:t===Te,onPress:()=>ve(t)},e))}):null,(0,V.jsx)(h.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Oe)>1&&Me(t)},style:{alignSelf:'stretch'},children:(0,V.jsx)(oe,{fits:Se||Be.fits,children:(0,V.jsxs)(h.default,{testID:"rota-grid",style:{gap:se,width:Be.width,alignSelf:'center'},children:[(0,V.jsxs)(h.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:se,backgroundColor:D.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:D.colours.hairline,zIndex:5},Se||Be.fits?ae:null],children:[(0,V.jsx)(h.default,{style:{width:Re,justifyContent:'center'},children:(0,V.jsx)(f.T,{size:11,weight:"semibold",colour:D.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),$.DAY3.map((e,s)=>(0,V.jsx)(h.default,{testID:"rota-date",style:{width:Pe,alignItems:'center'},children:(0,V.jsxs)(f.T,{size:Be.big?13:12,weight:"semibold",center:!0,colour:fe[s]===(0,C.ymd)(t)?D.colours.gold:D.colours.text,children:[e," ",(0,C.parseYmd)(fe[s]).getDate()]})},e)).filter($e)]}),Ie.map(e=>(0,V.jsxs)(h.default,{testID:"rota-row",style:{flexDirection:'row',gap:se,alignItems:'center'},children:[(0,V.jsxs)(h.default,{testID:"rota-name",style:{width:Re,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,V.jsx)(O.StaffAvatar,{id:e.id,size:28}),(0,V.jsxs)(h.default,{style:{flex:1,minWidth:0},children:[(0,V.jsx)(f.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,V.jsx)(f.T,{size:11,colour:D.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),$.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(me,e.id,fe[n]),o=(u[e.id]??[]).includes(n),i=be(e.id,fe[n]),l=(0,p.rotaCellWorked)(a,b,e.id,fe[n],re),r=!(!re||!l.workedLine&&!l.onShiftNow);return(0,V.jsxs)(c.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${$.DAY3[n]}, ${l.speech}${(0,E.badgeSpoken)(a?.badge)}${i?', on time off':''}${o?', unavailable':''}`,disabled:!re,onPress:()=>{a?W({staffId:e.id,date:fe[n],shift:a}):z({staffId:e.id,date:fe[n]})},style:({pressed:e})=>({width:Pe,minHeight:q.IS_CAR?64:r?80:52,height:r||(0,E.cleanBadge)(a?.badge)||q.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:l.differs?D.colours.amber:a?a.published?D.colours.gold:D.colours.amber:D.colours.border,backgroundColor:e?D.colours.goldTint:a?a.published?'#2b2414':'#241f14':i?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,E.cleanBadge)(a?.badge)?6:0}),children:[a?(0,V.jsxs)(f.T,{size:Be.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,$.fmtH)(a.start),"\u2013",(0,$.fmtH)(a.end)]}):l.workedLine?null:(0,V.jsx)(f.T,{size:12,center:!0,colour:D.colours.muted,children:i?'Off':o?'Unavail.':re?'Add':'\u2013'}),(0,E.cleanBadge)(a?.badge)?(0,V.jsx)(h.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:D.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,V.jsx)(f.T,{size:10,weight:"semibold",colour:D.colours.gold,center:!0,numberOfLines:1,children:(0,E.cleanBadge)(a?.badge)})}):null,l.workedLine?(0,V.jsx)(f.T,{testID:"rota-worked",size:10,colour:l.differs?D.colours.amber:D.colours.goldLight,center:!0,children:l.workedLine}):null,l.onShiftNow?(0,V.jsx)(f.T,{testID:"rota-on-shift-now",size:10,colour:D.colours.goldLight,center:!0,children:"On shift now"}):null,l.diffLabel?(0,V.jsx)(f.T,{size:10,colour:D.colours.amber,center:!0,children:l.diffLabel}):null,a&&i?(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.blue,children:(0,g.leaveLabel)((0,s.leaveOn)(m,e.id,fe[n])).toLowerCase()}):a&&o?(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.red,children:"unavailable"}):!a||!re||a.published&&!a.changed||l.workedLine||l.onShiftNow?null:(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter($e)]},e.id)),re?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se,marginTop:4},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:"Labour"})}),je.map((e,t)=>(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,children:(0,S.gbp)(e).replace('.00','')})},t)).filter($e)]}),he?null:(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:'example'===ce.mode?'Fcst sales (ex.)':'Fcst sales'})}),ue.map((e,t)=>(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,colour:D.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter($e)]}),he?null:(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:"Labour %"})}),je.map((e,t)=>{const s=ke(e,ue[t]);return(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,weight:"semibold",colour:ue[t]?s>32?D.colours.red:s>26?D.colours.amber:D.colours.ok:D.colours.muted,children:ue[t]?`${s}%`:'\u2013'})},t)}).filter($e)]})]}):null]})})}),!re&&o?(0,V.jsx)(h.default,{testID:"rota-team-on",children:(0,V.jsx)(f.Card,{children:fe.map((e,t)=>(0,V.jsx)(j.TeamOnDay,{date:e,meId:o,label:(0,C.niceDate)((0,C.parseYmd)(e))},e)).filter($e)})}):null,re&&he?(0,V.jsx)(f.Card,{children:(0,V.jsxs)(h.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Labour this week"}),(0,V.jsx)(h.default,{testID:"labour-week-cost",children:(0,V.jsx)(f.T,{weight:"semibold",children:(0,S.gbp)(we)})})]}),(0,V.jsxs)(f.Muted,{children:[(0,S.gbp)(we)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,V.jsx)(f.T,{weight:"semibold",colour:D.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,V.jsx)(f.Muted,{children:`Forecasts start once CoverCharge has ${1===ce.weeks?'1 week':`${ce.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ce.booked?(0,V.jsx)(h.default,{testID:"labour-booked",children:(0,V.jsxs)(f.T,{children:["Booked so far: ",ce.booked," Covers this week"]})}):null]})}):null,re&&!he?(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,V.jsxs)(f.Row,{gap:6,children:['example'===ce.mode?(0,V.jsx)(L.ExampleBadge,{}):null,(0,V.jsx)(f.Badge,{kind:ke(we,ye)>30?'red':'ok',label:`${ke(we,ye)}% this week`})]})]}),(0,V.jsxs)(f.Muted,{children:[(0,S.gbp)(we)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,S.gbp)(ye)," forecast sales. Target 25\u201330%. ",'example'===ce.mode?'Example figures: forecast sales use an example spend per cover.':'Forecast sales are your average takings for each weekday from your cash-ups.']}),(()=>{const e=ke(je[5],ue[5]);return e&&e<24?(0,V.jsxs)(f.T,{size:14,colour:D.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,re?(0,V.jsx)(f.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===F?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v.SectionHead,{title:"Shift swaps & cover"}),x.filter(e=>re||e.fromId===o||e.toId===o).map(e=>{const t=r.find(t=>t.id===e.shiftId),n=i.find(t=>t.id===e.fromId),a=i.find(t=>t.id===e.toId);return(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,V.jsx)(f.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,V.jsxs)(f.Muted,{children:[t?`${$.DAY3[t.day]} ${(0,$.fmtH)(t.start)}\u2013${(0,$.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&re?(0,V.jsxs)(f.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:i.filter(e=>U(n,e)).map(t=>(0,V.jsx)(f.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,V.jsx)(f.Button,{small:!0,label:"Approve",disabled:!e.toId||!U(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(i.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,T.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${$.DAY3[t.day]} ${(0,$.fmtH)(t.start)}\u2013${(0,$.fmtH)(t.end)})`:''}`)}}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),re?null:(0,V.jsxs)(f.Card,{children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,V.jsx)(f.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,V.jsx)(f.Muted,{testID:"swap-dept-note",children:(0,w.isAnchorageVenue)(y.VENUE_RID)?w.ANCHORAGE_SWAP_NOTE:K(i.find(e=>e.id===o))?w.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),me.filter(e=>e.staffId===o).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=x.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,V.jsxs)(h.default,{style:{gap:4,paddingVertical:4},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:14,weight:"medium",children:[$.DAY3[e.day]," ",(0,$.fmtH)(e.start),"\u2013",(0,$.fmtH)(e.end),(0,E.cleanBadge)(e.badge)?` \xb7 ${(0,E.cleanBadge)(e.badge)}`:'']}),t?(0,V.jsx)(f.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:o,kind:'cover',note:'Can anyone cover?'}),(0,T.autoPost)('all',`Cover needed: ${$.DAY3[e.day]} ${(0,$.fmtH)(e.start)}\u2013${(0,$.fmtH)(e.end)} (${(i.find(e=>e.id===o)?.name??'').replace(' (example)','')})`)}}),i.filter(e=>U(i.find(e=>e.id===o),e)).map(t=>(0,V.jsx)(f.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:o,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),me.some(e=>e.staffId===o)?null:(0,V.jsx)(f.Muted,{children:"No shifts on the rota this week."})]}),(0,V.jsx)(v.SectionHead,{title:"Holiday & time off"}),re?(0,V.jsx)(f.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>ie(!0)}):o?(0,V.jsx)(k.RequestTimeOff,{meId:o,me:le,testID:"rota-requests-time-off"}):null,m.filter(e=>re||e.staffId===o).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,V.jsx)(f.Card,{children:(0,V.jsxs)(h.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:(i.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,V.jsx)(f.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,V.jsxs)(f.Muted,{children:[(0,k.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&re?(0,V.jsxs)(f.Row,{gap:6,style:{justifyContent:'center'},children:[(0,V.jsx)(f.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),re&&o?(0,V.jsx)(k.TimeOffSheet,{visible:Q,onClose:()=>ie(!1),meId:o,me:le,manager:!0}):null]}):null,'availability'===F?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(f.Muted,{children:["Days each person can\u2019t work. ",re?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ie.filter(e=>'owner'!==e.role||!re).map(e=>(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{gap:8,children:[(0,V.jsx)(O.StaffAvatar,{id:e.id,size:30}),(0,V.jsx)(f.T,{weight:"semibold",children:e.name})]}),(0,V.jsx)(f.Row,{wrap:!0,gap:4,children:$.DAY3.map((t,n)=>{const a=(u[e.id]??[]).includes(n);return(0,V.jsx)(f.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,H?(0,V.jsx)(_.AssignRoleSheet,{name:(i.find(e=>e.id===H.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,C.niceDate)((0,C.parseYmd)(H.date))} \xb7 ${(0,$.fmtH)(H.shift.start)}\u2013${(0,$.fmtH)(H.shift.end)}`,current:H.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,E.assignShiftBadge)(s.useOwner.getState().shifts,H.shift.id,e)),W(null)},onEditTimes:()=>{z(H),W(null)},onClose:()=>W(null)}):null,A?(0,V.jsx)(te,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:a,meId:u,me:m,r:g,rid:p}=(0,$.useCtx)(5e3),x=((0,M.useClockArea)(e=>e.areas[p]),(0,M.areaOf)(p));const j=(0,B.privateClockVenue)(p),[w,y]=(0,l.useState)(!1),k=(0,s.useOwner)(e=>e.consent[u]),I=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),S=(0,s.useOwner)(e=>e.shifts),[v,T]=(0,l.useState)(!1),[L,H]=(0,l.useState)(null),[N,W]=(0,l.useState)(null),[Y,F]=(0,l.useState)(void 0),[E,_]=(0,l.useState)(null),[q,K]=(0,l.useState)(!1),[U,G]=(0,l.useState)(null),Q=I.filter(t=>t.staffId===u&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],X=Q&&(0,s.isOnBreak)(Q)?Q.breaks[Q.breaks.length-1]:void 0,J=(0,s.visibleShifts)(S,'staff'!==a).find(e=>e.staffId===u&&e.date===t),Z='staff'!==a,ee=Q?(0,$.paidMins)({in:Q.in},e).worked:0,te=x.on&&(0,P.areaSet)(x),se=Q?.geo?.[Q.geo.length-1],ne=I.filter(e=>e.staffId===u&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],ae=(0,r.useClockNotSent)(Q?.id??E?.id??ne?.id),[oe,re]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if(ae)re(!0);else if(oe){const e=setTimeout(()=>re(!1),6e3);return()=>clearTimeout(e)}},[ae]);const de=!ae&&oe,ce=async(s,n={})=>{H(s),W(null),F(void 0);const a=await(0,R.clockAction)(s,{rid:p,staffId:u,date:t,at:new Date(e.getTime()).toISOString(),...n});return H(null),a.ok?('out'===s&&a.att&&(_(a.att),(0,i.hrSettingsOf)(g.settings?.hr).on&&!o.useHr.getState().hasAnswered(p,a.att.id)&&G(a.att)),'in'===s&&_(null),a.att&&(0,r.markClockUnsent)(a.att.id),!0):(W(a.message),F(a.fix),(0,A.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return k?(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.Row,{gap:10,style:{flex:1},children:[(0,V.jsx)(O.StaffAvatar,{id:u,size:48}),(0,V.jsx)(f.T,{weight:"semibold",style:{flex:1},children:m})]}),(0,V.jsx)(f.Badge,{kind:Q?'ok':'neutral',label:Q?`On shift since ${(0,C.hm)(new Date(Q.in))}`:'Not clocked in'})]}),(0,V.jsx)(f.Muted,{children:J?`Today's shift: ${(0,$.fmtH)(J.start)}\u2013${(0,$.fmtH)(J.end)}`:'No shift on the rota today'}),(0,V.jsx)(h.default,{testID:"clock-area-line",children:(0,V.jsx)(f.T,{size:14,colour:D.colours.muted,children:te?j?`Location is checked only when you choose Clock in, at ${g.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${g.name}.`:x.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),se&&!0===se.inside&&null!=se.dist?(0,V.jsxs)(f.Muted,{children:["Last check: at the venue (about ",se.dist," m from the centre)."]}):null,Q?(0,V.jsx)(f.T,{size:30,weight:"bold",center:!0,children:(0,$.hmDur)(ee)}):null,Q&&X?(0,V.jsx)(h.default,{testID:"on-break",children:(0,V.jsxs)(f.T,{size:15,weight:"semibold",colour:D.colours.gold,center:!0,children:["On a break since ",(0,C.hm)(new Date(X.start))," \xb7 ",(0,s.loggedBreakMins)(Q,e)," min so far"]})}):null,Q?(0,V.jsxs)(V.Fragment,{children:[X?(0,V.jsx)(f.Button,{testID:"break-end",kind:"success",label:'break_end'===L?'Checking your location\u2026':'End break',disabled:!!L,onPress:()=>{ce('break_end')}}):(0,V.jsx)(f.Button,{testID:"break-start",kind:"secondary",label:'break_start'===L?'Checking your location\u2026':'Start break',disabled:!!L,onPress:()=>{ce('break_start')}}),(0,V.jsx)(f.Button,{testID:"clock-out",kind:"danger",label:'out'===L?'Checking your location\u2026':'Clock out',disabled:!!L,onPress:()=>{Q.breaks?.length?ce('out'):(W(null),T(!0))}})]}):(0,V.jsx)(f.Button,{testID:"clock-in",kind:"success",label:'in'===L?'Checking your location\u2026':'Clock in',disabled:!!L,onPress:()=>{j?y(!0):ce('in')}}),ae?(0,V.jsxs)(h.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,V.jsx)(f.T,{size:18,weight:"bold",colour:D.colours.gold,center:!0,children:"Not sent yet"}),(0,V.jsx)(f.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,V.jsx)(f.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{d.mutationQueue.retryNow()}})]}):de?(0,V.jsx)(h.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,V.jsx)(f.T,{size:14,colour:D.colours.ok,center:!0,children:"\u2713 Sent"})}):null,Q?.breaks?.length?(0,V.jsxs)(f.Muted,{center:!0,children:["Breaks today: ",Q.breaks.map(e=>`${(0,C.hm)(new Date(e.start))}\u2013${e.end?(0,C.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(Q,e)," min)"]}):null,N?(0,V.jsx)(h.default,{testID:"clock-message",children:(0,V.jsx)(f.Banner,{kind:"warn",title:"Not recorded",children:N})}):null,N&&'settings'===Y?(0,V.jsx)(f.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:z.openAppSettings}):null,N&&'location'===Y?(0,V.jsx)(f.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:z.openLocationSettings}):null,N&&'update'===Y?(0,V.jsx)(f.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:z.checkAppUpdate}):null]}),Z&&!(0,P.areaSet)(x)?(0,V.jsx)(h.default,{testID:"clock-area-warning",children:(0,V.jsx)(f.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,V.jsx)(c.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>K(!0),style:{alignSelf:'center',padding:6},children:(0,V.jsx)(f.T,{size:14,colour:D.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,V.jsx)(le,{onClose:()=>K(!1)}):null,(0,V.jsx)(b.BreakRoomCard,{staffId:u,name:m,now:e}),E?(()=>{const t=(0,$.paidMins)(E,e);return(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsxs)(f.T,{weight:"semibold",colour:D.colours.gold,children:["Clocked out at ",(0,C.hm)(new Date(E.out))]}),(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["Clocked ",(0,$.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,$.hmDur)(t.paid)]}),(0,V.jsxs)(f.Muted,{children:["In ",(0,C.hm)(new Date(E.in))," \xb7 out ",(0,C.hm)(new Date(E.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",E.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,V.jsx)(f.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,V.jsx)(f.Sheet,{visible:w,onClose:()=>y(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,V.jsxs)(h.default,{style:{gap:12},children:[(0,V.jsxs)(f.T,{children:["We check once that you are at ",g.name,", within about ",x.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,V.jsx)(f.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,V.jsx)(f.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{y(!1),ce('in')}}),(0,V.jsx)(f.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>y(!1)})]})}),Z?(0,V.jsx)(ie,{rid:p,today:t,now:e}):null,U?(0,V.jsx)(n.ShiftCheckout,{rid:p,shiftKey:U.id,day:U.date,meId:u,onClose:()=>G(null)}):null,(0,V.jsx)(f.Sheet,{visible:v,onClose:()=>T(!1),title:"Did you take a break? If so, how long?",children:(0,V.jsxs)(h.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,V.jsx)(f.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,V.jsx)(f.Chip,{testID:`forgot-break-${e}`,label:(0,P.breakLabel)(e),disabled:e>=ee,onPress:()=>{T(!1),ce('out',{addedBreak:e})}},e))}),(0,V.jsx)(f.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{T(!1),ce('out',{breakMins:0})}}),ee>360?(0,V.jsx)(f.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,V.jsx)(f.Muted,{children:j?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,V.jsx)(h.default,{style:{gap:10},children:(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsx)(f.T,{weight:"semibold",colour:D.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(f.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",g.name,", within about ",x.radius," m."]}),(0,V.jsx)(f.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,V.jsxs)(V.Fragment,{children:[" ",(0,V.jsxs)(f.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,V.jsx)(f.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",g.name," (within about ",x.radius," m)."]}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,V.jsx)(f.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(u,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,$.useCtx)(3e4);return s!=='staff'?(0,V.jsx)(de,{now:e,today:t,meId:n}):(0,V.jsx)(re,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]);_r(_d[9]);var c=e(_r(_d[10])),u=e(_r(_d[11])),h=e(_r(_d[12])),f=_r(_d[13]),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),B=_r(_d[32]),P=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),W=_r(_d[40]),Y=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),V=_r(_d[46]);const K=e=>(0,w.deptKey)(e?.dept),U=(e,t)=>(0,w.canSwapWith)(e,t,y.VENUE_RID),G=2650,Q=1900,X=e=>e.end-e.start,J=e=>e>8?.5:e>6?.3333333333333333:0,Z=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,$.weekday)(e)),t};function ee(e){const{rid:t,r:s,now:n}=(0,$.useCtx)(6e4),a=(0,m.useBookings)(t),o=(0,m.useOrders)(t),i=(0,m.useEvents)(t),r=(0,L.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,C.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),n=a.filter(e=>!e.walkIn&&'confirmed'===e.status&&t.some(t=>(0,C.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,H.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:l,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:l,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:l,booked:n,sales:t.map(e=>{const t=(0,I.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*G+t.restOfDay.takeaway*Q:0})}},[s,a,o,i,r,(0,C.ymd)(e)])}function te({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,l.useState)(e.shift?.start??12),[i,r]=(0,l.useState)(e.shift?.end??20),[d,c]=(0,l.useState)(e.shift?.breakAt),[u,m]=(0,l.useState)((0,E.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,V.jsxs)(f.Sheet,{visible:!0,onClose:t,title:(0,F.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,V.jsx)(f.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,k.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,V.jsx)(f.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,V.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,V.jsx)(f.Chip,{label:"None",selected:!u,onPress:()=>m(void 0),testID:"shift-badge-none"}),E.ROLE_BADGES.map(e=>(0,V.jsx)(f.Chip,{label:e,selected:u===e,onPress:()=>m(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,V.jsx)(f.Chip,{label:`${e} ${(0,$.fmtH)(t)}\u2013${(0,$.fmtH)(s)}`,selected:a===t&&i===s,onPress:()=>{o(t),r(s)}},e))}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{children:"Start"}),(0,V.jsx)(f.Stepper,{testID:"shift-start",value:a,step:.5,min:F.SHIFT_MIN_START,max:i-1,onChange:o,format:$.fmtH,label:"Start time"})]}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,V.jsx)(f.T,{children:"End"}),(0,V.jsxs)(h.default,{style:{alignItems:'flex-end'},children:[(0,V.jsx)(f.Stepper,{testID:"shift-end",value:i,step:.5,min:a+1,max:F.SHIFT_MAX_END,onChange:r,format:$.fmtH,label:"End time"}),i>=24?(0,V.jsx)(f.Muted,{children:"next day"}):null]})]}),(0,V.jsxs)(f.Muted,{children:[(i-a).toFixed(1),"h scheduled",J(i-a)?`, ${Math.round(60*J(i-a))}m planned break`:'']}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,V.jsx)(f.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,V.jsx)(f.Chip,{label:"Set a break time",onPress:()=>c(Math.min(i-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(i-a)/2)))/4)))}):(0,V.jsxs)(f.Row,{gap:6,children:[(0,V.jsx)(f.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:i-.25,onChange:c,format:$.fmtH,label:"Break time"}),(0,V.jsx)(f.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,V.jsx)(f.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,V.jsx)(f.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:i,breakAt:g?d:void 0,badge:(0,E.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:i,...void 0!==d&&g?{breakAt:d}:{},...(0,E.cleanBadge)(u)?{badge:(0,E.cleanBadge)(u)}:{}}),t()}}),(0,V.jsx)(f.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,V.jsx)(f.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const se=6;function ne(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*se:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+se),big:o>=104,fits:!e||s+t*(o+se)<=e}}const ae={position:'sticky',top:0};function oe({fits:e,children:t}){return e?(0,V.jsx)(h.default,{style:{alignItems:'center'},children:t}):(0,V.jsx)(u.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function ie({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),i=(0,$.useSignedIn)(),{me:r,meId:d}=(0,$.useCtx)(3e4),[c,u]=(0,l.useState)(null),[h,m]=(0,l.useState)(''),[g,p]=(0,l.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,R.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:i?.id??d,name:i?.name??r},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,A.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),p(null)};return(0,V.jsxs)(f.Card,{children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Record it for someone"}),(0,V.jsx)(f.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:a.map(e=>(0,V.jsx)(f.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:x?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,V.jsx)(f.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,V.jsx)(f.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,V.jsx)(f.T,{size:13,colour:D.colours.red,children:g}):null]}):null]})}function le({onClose:e}){const{now:t,today:n,meId:a}=(0,$.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),i=(0,s.useOwner)(e=>e.shifts),r=Array.from({length:7},(e,t)=>(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(n),1440*-t))),[d,c]=(0,l.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(i,!1).find(e=>e.staffId===a&&e.date===d),[m,g]=(0,l.useState)(u&&!u.out?'out':'in'),[p,b]=(0,l.useState)(h?Math.round(60*h.start):720),[j,w]=(0,l.useState)(h?Math.round(60*h.end):1200),[y,k]=(0,l.useState)(''),[I,S]=(0,l.useState)(!1),v=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==m,O='in'!==m,M=T&&O&&j<=p,B=(e,t)=>(0,V.jsx)(f.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,V.jsxs)(f.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,V.jsx)(f.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,V.jsx)(f.Button,{label:"Done",onPress:e})]}):(0,V.jsxs)(f.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,V.jsx)(f.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:r.map(e=>(0,V.jsx)(f.Chip,{label:e===n?'Today':(0,C.niceDate)((0,C.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,V.jsxs)(f.Muted,{children:[h?`Your rota that day: ${(0,$.fmtH)(h.start)}\u2013${(0,$.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,C.hm)(new Date(u.in))}\u2013${u.out?(0,C.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Forgot to clock in",selected:'in'===m,onPress:()=>g('in')}),(0,V.jsx)(f.Chip,{label:"Forgot to clock out",selected:'out'===m,onPress:()=>g('out')}),(0,V.jsx)(f.Chip,{label:"Forgot both",selected:'both'===m,onPress:()=>g('both')})]}),T?(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["In ",v(p)]}),B(b,p)]}):null,O?(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["Out ",v(j),j>=1440?' (next day)':'']}),B(w,j)]}):null,M?(0,V.jsx)(f.T,{size:13,colour:D.colours.red,children:"Clock-out must be after clock-in."}):null,(0,V.jsx)(f.Field,{label:"Note for your manager (optional)",value:y,onChangeText:k,placeholder:"e.g. phone died",maxLength:200}),(0,V.jsx)(f.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:m,suggestedIn:T?(0,x.isoAt)(d,p):void 0,suggestedOut:O?(0,x.isoAt)(d,j):void 0,note:y.trim(),at:t.toISOString()}),S(!0)}})]})}function re(){const{now:e,today:t,meId:n}=(0,$.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),i=(0,s.useOwner)(e=>e.timeRequests),[r,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),m=(0,C.ymd)(Z(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=m),b=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),w=i.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,V.jsxs)(h.default,{style:{gap:10},testID:"my-timesheet",children:[(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,V.jsxs)(h.default,{children:[(0,V.jsx)(f.T,{size:12,colour:D.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,V.jsx)(f.T,{size:28,weight:"bold",colour:D.colours.ok,children:(0,$.hmDur)(b)})]}),(0,V.jsxs)(h.default,{style:{alignItems:'flex-end'},children:[(0,V.jsx)(f.T,{size:12,colour:D.colours.muted,children:"PENDING SIGN-OFF"}),(0,V.jsx)(f.T,{size:18,weight:"semibold",colour:j?D.colours.amber:D.colours.muted,children:(0,$.hmDur)(j)})]})]}),(0,V.jsx)(f.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,V.jsx)(f.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,V.jsx)(v.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,V.jsxs)(h.default,{style:{flex:1},children:[(0,V.jsxs)(f.T,{size:14,children:[(0,C.niceDate)((0,C.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,V.jsxs)(f.Muted,{children:[e.suggestedIn?`in ${(0,C.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,C.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,V.jsx)(f.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,V.jsx)(v.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,$.paidMins)(t,e),i=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,V.jsxs)(f.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(h.default,{style:{flex:1},children:[(0,V.jsx)(f.T,{weight:"semibold",children:(0,C.niceDate)((0,C.parseYmd)(t.date))}),(0,V.jsxs)(f.Muted,{children:[(0,C.hm)(new Date(t.in)),"\u2013",t.out?(0,C.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,$.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,$.fmtH)(n.start)}\u2013${(0,$.fmtH)(n.end)}`:'']})]}),(0,V.jsx)(f.Badge,{kind:(0,x.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,x.statusLabel)(t)})]}),i?(0,V.jsxs)(f.T,{size:13,colour:D.colours.gold,children:["Adjusted by ",i.by.replace(' (example)',''),i.reason?`: ${i.reason}`:'']}):null,t.signOff?(0,V.jsxs)(f.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,V.jsx)(x.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,V.jsx)(f.Muted,{children:"No clocked shifts yet."}),r?(0,V.jsx)(le,{onClose:()=>d(!1)}):null]})}function de({now:e,today:n}){const o=(0,s.useOwner)(e=>e.staff),i=(0,s.useOwner)(e=>e.shifts),r=(0,$.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),u=(0,s.useOwner)(e=>e.timeRequests),m=(0,s.useOwner)(e=>e.leave),p=(0,s.useOwner)(e=>e.attLog),[b,j]=(0,l.useState)(n),[w,y]=(0,l.useState)(null),[k,I]=(0,l.useState)(!1),[T,M]=(0,l.useState)(!1),B=!!(0,$.useSignedIn)(),P=T?(0,N.pastWeekDays)(b,n):Array.from({length:7},(e,t)=>(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===b&&e.in),A=i.filter(e=>e.date===b&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>P.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),Y=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),F=L.reduce((t,s)=>t+(0,$.paidMins)(s,e).paid/60*(r[s.staffId]??0),0),E=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=o.find(e=>e.id===t.staffId),a=(0,s.shiftOf)(i,t.staffId,t.date),l=(0,$.paidMins)(t,e),d=r[t.staffId]??0;return`${n?.name},${t.date},${a?`${(0,$.fmtH)(a.start)}-${(0,$.fmtH)(a.end)}`:'-'},${(0,C.hm)(new Date(t.in))},${(0,C.hm)(new Date(t.out))},${l.brk},${(l.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(l.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==r[t.staffId]?'Rate not set':n?.noTax&&B?'No tax deducted':''}`}));return(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsx)(W.HoursDayPicker,{testID:"ts-pick",date:b,today:n,custom:T,onDate:e=>{j(e),M(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),M(!1)}}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:P.map(e=>(0,V.jsx)(f.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,N.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':T?(0,N.chipDay)(e):(0,C.niceDate)((0,C.parseYmd)(e)).slice(0,6).trim(),selected:b===e,onPress:()=>j(e)},e))}),(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",testID:"ts-week-title",children:T?(0,N.weekTitle)(b,n):'Last 7 days'}),(0,V.jsx)(f.Badge,{kind:"ok",label:`${(0,$.hmDur)(H)} confirmed`})]}),Y?(0,V.jsxs)(f.T,{size:13,colour:D.colours.amber,children:[(0,$.hmDur)(Y)," pending sign-off (not counted yet)"]}):null,(0,V.jsxs)(f.Muted,{children:["Labour cost ",(0,S.gbp)(Math.round(F))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,V.jsx)(a.WideTable,{children:(0,V.jsxs)(h.default,{style:{gap:2},children:[(0,V.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:D.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,V.jsx)(f.T,{size:12,weight:"semibold",colour:D.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const l=o.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(i,t.staffId,b),d=(0,$.paidMins)(t,e),h=(0,x.flagsFor)(t,r,e,n,u).map(e=>e.label);return(0,V.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,V.jsxs)(f.Row,{gap:4,style:{width:110},children:[(0,V.jsx)(O.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,V.jsx)(f.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:l?.name.replace(' (example)','')})]}),(0,V.jsx)(f.T,{size:12,style:{width:86},colour:D.colours.muted,children:r?`${(0,$.fmtH)(r.start)}\u2013${(0,$.fmtH)(r.end)}`:'\u2013'}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:(0,C.hm)(new Date(t.in))}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:t.out?(0,C.hm)(new Date(t.out)):'on'}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,V.jsx)(f.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,$.hmDur)(d.paid):`${(0,$.hmDur)(d.worked)}\u2026`}),(0,V.jsx)(f.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?D.colours.ok:'open'===(0,s.attStatus)(t)?D.colours.blue:D.colours.amber,children:(0,x.statusLabel)(t)}),(0,V.jsx)(f.T,{size:11,style:{width:140},colour:h.length?D.colours.amber:D.colours.ok,children:h.join(', ')||'OK'}),(0,V.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${l?.name}`,onPress:()=>y(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,V.jsx)(f.T,{size:12,colour:D.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,V.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,V.jsx)(f.T,{size:12,style:{width:110},children:o.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,V.jsxs)(f.T,{size:12,style:{width:86},colour:D.colours.muted,children:[(0,$.fmtH)(t.start),"\u2013",(0,$.fmtH)(t.end)]}),(()=>{const s=(0,g.leaveCovering)(m,t.staffId,t.date);return s?(0,V.jsxs)(f.T,{size:12,colour:D.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,g.leaveLabel)(s)," (rota covered)"]}):(0,V.jsx)(f.T,{size:12,colour:b===n&&60*t.start>60*e.getHours()+e.getMinutes()?D.colours.muted:D.colours.red,children:b===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,V.jsx)(f.Muted,{children:"No shifts or clock records for this day."}),(0,V.jsx)(f.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,V.jsx)(f.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,V.jsx)(v.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,V.jsxs)(f.Muted,{children:[(0,C.niceDate)(new Date(e.at))," ",(0,C.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,V.jsx)(f.Muted,{children:"No manual changes yet."}),w?(0,V.jsx)(x.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>y(null)}):null,(0,V.jsxs)(f.Sheet,{visible:k,onClose:()=>I(!1),title:"Payroll export",children:[(0,V.jsxs)(f.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",Y?`${(0,$.hmDur)(Y)} still pending sign-off is left out.`:'']}),(0,V.jsxs)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[E.slice(0,14).map((e,t)=>(0,V.jsx)(f.T,{size:10,colour:t?D.colours.text:D.colours.gold,children:e},t)),E.length>14?(0,V.jsxs)(f.Muted,{children:["\u2026 ",E.length-14," more rows"]}):null]}),(0,V.jsxs)(f.Muted,{children:[E.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1064,[876,863,1053,1442,1242,1243,31,1046,1076,123,264,152,128,818,823,972,1455,1447,1090,1456,1102,5,1103,879,820,822,825,1079,1054,953,996,1264,869,870,1391,980,1392,1093,1094,1450,1452,1386,1100,978,1457,807,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return O}}),_e.allocate=D,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:v,role:P,meId:B,me:F}=(0,x.useCtx)(6e4),R=(0,u.useOwner)(e=>e.staff),N=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),A=(0,u.useOwner)(e=>e.shifts),L=(0,u.useOwner)(e=>e.tronc),z=(0,u.useOwner)(e=>e.troncCash),_=(0,u.useOwner)(e=>e.troncHistory),V=(0,u.useOwner)(e=>e.troncLog),U=(0,c.useOrders)(C),q=(0,j.useVenuePay)(C).pay,[H,W]=(0,i.useState)(-1),[Y,K]=(0,i.useState)(''),[G,Q]=(0,i.useState)(!1),[J,X]=(0,i.useState)(!1),[Z,ee]=(0,i.useState)(L.text),[te,se]=(0,i.useState)(null),oe='staff'!==P,ie='owner'===P,{s:ne,e:re,key:le}=(0,j.venueRange)(q,'tips',H,S),ae=`${(0,h.niceDate)(ne)} \u2013 ${(0,h.niceDate)(re)} ${re.getFullYear()}`,de=_.find(e=>e.key===le),ce=e=>u.useOwner.getState().setOwner({tronc:{...L,...e}}),ue=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),pe=Math.round((re.getTime()-ne.getTime())/864e5)+1,he=(0,i.useMemo)(()=>{let e=U.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(ne)&&e.createdAt.slice(0,10)<=(0,h.ymd)(re)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!ue)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[le,U.length,ue]),me=(0,T.useCashUp)(e=>e.cashUps),fe=Math.round(100*(0,k.cashUpTipsBetween)(me,C,(0,h.ymd)(ne),(0,h.ymd)(re))),ye=z[le]??0,ge=de?de.pot:he+fe+ye,xe=(0,i.useMemo)(()=>{const e={};for(let t=0;tv)break;const o=(0,h.ymd)(s);R.forEach(t=>{const s=N.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[le,N.length,A.length,R.length]),je=R.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&L.includeManagers||'owner'===e.role&&L.includeOwner)),be=(0,i.useMemo)(()=>{if(de)return de.rows;const e=je.map(e=>{const t=(xe[e.id]?.paid??0)/60,s=L.points[O(e)]??1;return'hours'===L.method?t:'points'===L.method?t*s:'equal'===L.method?t>0?1:0:L.custom[e.id]??0}),{amounts:t}=D(ge,e),s=e.reduce((e,t)=>e+t,0);return je.map((o,i)=>({staffId:o.id,hours:(xe[o.id]?.paid??0)/60,points:L.points[O(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[de,je.map(e=>e.id).join(),xe,L,ge]),we=be.reduce((e,t)=>e+t.amount,0),Te=de?0:(()=>{const e=be.map(e=>e.pct);return D(ge,e).remainder})(),Ce=Object.entries(L.custom).filter(([e])=>je.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),Se='custom'===L.method&&Math.abs(Ce-100)>.01,ke=new Date(re.getFullYear(),re.getMonth()+2,0),ve=[..._].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==_.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),Me=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(be.map(e=>{const t=R.find(t=>t.id===e.staffId);return`${I(t.name)},${O(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(we/100).toFixed(2)}`]);return oe?(0,M.jsxs)(l.default,{style:{gap:10},children:[(0,M.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,M.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,M.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>W(H-1)}),(0,M.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,M.jsx)(d.T,{weight:"semibold",children:ae}),de?(0,M.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${de.lockedAt}`}):H>=0?(0,M.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,M.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:H>=0,onPress:()=>W(H+1)})]}),(0,M.jsxs)(d.Card,{children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Card tips on orders"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.card:he)})]}),(0,M.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.cashUps??0:fe)})]})}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Other cash tips"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.cash:ye)})]}),de?null:(0,M.jsxs)(d.Row,{gap:6,children:[(0,M.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:Y,onChangeText:K,style:[d.styles.input,{flex:1}]}),(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(Y)>=0)||''===Y.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{...z,[le]:Math.round(100*Number(Y))}}),K('')}})]}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,M.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(ge)})]}),(0,M.jsx)(d.Muted,{children:ue?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),de?(0,M.jsxs)(d.Muted,{children:["Locked with method: ",$[de.method],"."]}):(0,M.jsxs)(d.Card,{children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,M.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys($).map(e=>(0,M.jsx)(d.Chip,{label:$[e],selected:L.method===e,onPress:()=>ie&&ce({method:e})},e))}),ie?null:(0,M.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===L.method?Object.entries(L.points).map(([e,t])=>(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:e}),(0,M.jsx)(d.Row,{gap:6,children:(0,M.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ie&&ce({points:{...L.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===L.method?(0,M.jsxs)(M.Fragment,{children:[je.map(e=>(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{style:{flex:1},children:I(e.name)}),(0,M.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(L.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ce({custom:{...L.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ce({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,M.jsxs)(d.T,{size:13,colour:Se?m.colours.red:m.colours.ok,children:["Total ",Ce.toFixed(1),"%",Se?' (must be 100%)':' \u2713']})]}):null,(0,M.jsx)(d.Toggle,{label:"Include managers",value:L.includeManagers,onChange:e=>ie&&ce({includeManagers:e})}),(0,M.jsx)(d.Toggle,{label:"Include owner",value:L.includeOwner,onChange:e=>ie&&ce({includeOwner:e})}),L.includeOwner?(0,M.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,M.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[be.map(e=>{const t=R.find(t=>t.id===e.staffId);return(0,M.jsxs)(d.Card,{children:[(0,M.jsxs)(d.T,{center:!0,weight:"semibold",children:[I(t?.name),xe[e.staffId]?.est&&!de?'*':'']}),(0,M.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,M.jsxs)(d.T,{center:!0,children:["Points: ",'points'===L.method||'points'===de?.method?e.points.toFixed(1):'\u2013']}),(0,M.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,M.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,M.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(we)]})]}):(0,M.jsx)(r.default,{horizontal:!0,children:(0,M.jsxs)(l.default,{children:[(0,M.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,M.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),be.map(e=>{const t=R.find(t=>t.id===e.staffId);return(0,M.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,M.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[I(t?.name),xe[e.staffId]?.est&&!de?'*':'']}),(0,M.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,M.jsx)(d.T,{size:13,style:{width:54},children:'points'===L.method||'points'===de?.method?e.points.toFixed(1):'\u2013'}),(0,M.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,M.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,M.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,M.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,M.jsx)(d.T,{size:13,weight:"bold",colour:we===ge?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(we)})]})]})}),(0,M.jsxs)(d.Muted,{children:[we===ge?`\u2713 Total equals the pot (${(0,p.gbp)(ge)}).`:'\u2717 Total does not equal the pot.',Te?` Rounding: ${Te}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),de?null:(0,M.jsx)(d.Button,{label:"Approve & lock period",disabled:!ie||H>=0||Se||we!==ge||ge<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${le}`,key:le,label:ae,end:(0,h.ymd)(re),pot:ge,card:he,cash:ye,cashUps:fe,method:L.method,rows:be,lockedAt:e,by:F};u.useOwner.getState().setOwner({troncHistory:[t,..._],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${F} approved & locked tips for ${ae}: ${(0,p.gbp)(ge)} split ${$[L.method].toLowerCase()} between ${be.filter(e=>e.amount>0).length} staff`},...V]})}}),!de&&H>=0?(0,M.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ie||de?null:(0,M.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,M.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>Q(!0)}),de?(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:de.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!de.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${ae} approved: ${(0,p.gbp)(de.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:_.map(e=>e.id===de.id?{...e,shared:(0,h.niceDate)(S)}:e)}),se('Posted to All staff chat.')}}):null]}),te?(0,M.jsx)(d.Banner,{kind:"info",title:te}):null,(0,M.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,M.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(ge)} = allocated ${(0,p.gbp)(we)}`],[L.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(ke)} ${ke.getFullYear()}`],[!0,'Tip records kept for 3 years',`${_.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${V.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,M.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,M.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,M.jsxs)(l.default,{style:{flex:1},children:[(0,M.jsx)(d.T,{size:14,children:t}),(0,M.jsx)(d.Muted,{children:s})]})]},String(t))),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{ee(L.text),X(!0)}})]}),(0,M.jsx)(y.SectionHead,{title:"Tip history & audit log"}),_.map(e=>(0,M.jsxs)(d.Card,{children:[(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{weight:"semibold",children:e.label}),(0,M.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,M.jsxs)(d.Muted,{children:[$[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),V.map(e=>(0,M.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),_.length||V.length?null:(0,M.jsx)(d.Muted,{children:"No approved periods yet."}),(0,M.jsxs)(d.Sheet,{visible:G,onClose:()=>Q(!1),title:"Tips summary export",children:[(0,M.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,M.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Me.map((e,t)=>(0,M.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,M.jsxs)(d.Muted,{children:[ae," \xb7 ",$[de?.method??L.method]]})]}),(0,M.jsxs)(d.Sheet,{visible:J,onClose:()=>X(!1),title:"Tipping policy",children:[(0,M.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ie,value:Z,onChangeText:ee,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ie?(0,M.jsx)(d.Button,{label:"Save policy",onPress:()=>{ce({text:Z}),X(!1)}}):null,(0,M.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,M.jsx)(E,{})},_e.useStaffTips=N,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=N(e,t);(0,i.useEffect)(()=>{if(!o.showToday||F()||P.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=N(e,t),r=`Tip pot this period, ${B(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${B(i)}`;return(0,M.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,M.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,M.jsx)(A,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,M.jsx)(A,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=E;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),v=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);const $={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},O=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',I=e=>(e??'').replace(' (example)','');function D(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const B=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function F(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const R={pot:186.4,today:48.5};function N(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,v.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||P.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),F()?{pot:R.pot,today:R.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function A({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${B(s)}`;return(0,M.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,M.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,M.jsx)(d.Muted,{center:!0,children:o}):(0,M.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:B(s)})]})}function E(e={}){const t=(0,x.useCtx)(6e4),s=N(t.rid,t.today);return(0,M.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,M.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,M.jsx)(A,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,M.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,M.jsx)(A,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1065,[876,874,842,31,264,152,128,288,818,823,863,820,822,825,1054,1079,953,1366,1091,824,1050,1048,13,1384,1365,2,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1066,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1067,[]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},1068,[31,197,123,264,128,818,996,1358,1190,825,1359,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1069,[874,31,264,128,818,825,829,5,986,807,824,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RELEASE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"nightlyEmailAllowed",{enumerable:!0,get:function(){return t}});const n={specialsSync:!0,nightlyEmail:!1,nightlyPush:!1,supportSync:!0,planPhoto:!0},t=(t,l)=>'anchorage'!==t&&l&&n.nightlyEmail},1070,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},1071,[812,18]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photosAllowed=function(){const t=a.useSync.getState();return'staff'!==t.kind||!t.venueId||'off'===t.mode||'local'===t.mode||t.perms.includes('*')},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600,n=.78){return new Promise((r,o)=>{const c=URL.createObjectURL(t),i=new Image;i.onload=()=>{const t=Math.min(1,a/Math.max(i.width,i.height)),o=document.createElement('canvas');o.width=Math.round(i.width*t),o.height=Math.round(i.height*t),o.getContext('2d').drawImage(i,0,0,o.width,o.height),URL.revokeObjectURL(c),r(o.toDataURL('image/jpeg',n))},i.onerror=()=>{URL.revokeObjectURL(c),o(new Error('not an image'))},i.src=c})}},1072,[123,872,824,1097]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_LOYALTY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"consentText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"prettyCardNo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"cleanCode",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"cardQr",{enumerable:!0,get:function(){return s}}),_e.readCardQr=function(e){const r=/^covercharge:card:[^:]+:([A-Za-z0-9-]{8,9})$/.exec(e.trim());return r?n(r[1]):null},Object.defineProperty(_e,"codeQr",{enumerable:!0,get:function(){return o}}),_e.checkSettings=function(e){return!Number.isInteger(e.stampsNeeded)||e.stampsNeeded<2||e.stampsNeeded>30?'Stamps needed must be between 2 and 30.':e.reward.trim()?e.reward.length>80?'Keep the reward under 80 letters.':e.gapMinutes<0||e.gapMinutes>1440?'Time between stamps must be 0 to 24 hours.':e.maxPerDay<1||e.maxPerDay>10?'Stamps a day must be 1 to 10.':!Number.isInteger(e.stampExpiryDays)||e.stampExpiryDays<0||e.stampExpiryDays>1095?'Stamps last 0 (never run out) to 1095 days.':!Number.isInteger(e.rewardExpiryDays)||e.rewardExpiryDays<0||e.rewardExpiryDays>1095?'Rewards last 0 (never run out) to 1095 days.':!e.referralOn||e.referralGiver.trim()&&e.referralFriend.trim()?e.referralMonthlyCap<0||e.referralMonthlyCap>50?'Friend rewards a month must be 0 to 50.':null:'Say what both people get before you switch Bring a friend on.':'Say what the reward is, for example Free dessert.'},_e.checkOffer=function(e){if(!e.title.trim())return'Give the offer a title.';if(e.title.length>80)return'Keep the title under 80 letters.';if(e.details.length>500)return'Keep the details under 500 letters.';const r=/^\d{4}-\d{2}-\d{2}$/;return e.startsOn&&!r.test(e.startsOn)?'Start date should look like 2026-11-30.':e.endsOn&&!r.test(e.endsOn)?'End date should look like 2026-11-30.':e.startsOn&&e.endsOn&&e.endsOn`I agree to ${e} keeping my name and the phone or email I give, only to run my stamp card and offers here. I can leave at any time and my details are removed.`,t=e=>e&&8===e.length?`${e.slice(0,4)}-${e.slice(4)}`:e,n=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,''),s=(e,r)=>`covercharge:card:${e}:${r}`;const o=(e,r,t)=>`${e.replace(/\/$/,'')}/customer/${r}/loyalty?code=${t}`;const l=(e,r)=>e.isOn&&(!e.startsOn||e.startsOn<=r)&&(!e.endsOn||e.endsOn>=r),p=r=>r?{saved:!!r.updated_by,cardOn:!!r.card_on,stampsNeeded:r.stamps_needed??8,reward:r.reward??'',stampExpiryDays:r.stamp_expiry_days??0,rewardExpiryDays:r.reward_expiry_days??0,gapMinutes:r.gap_minutes??60,maxPerDay:r.max_per_day??1,referralOn:!!r.referral_on,referralGiver:r.referral_giver??'',referralFriend:r.referral_friend??'',referralMonthlyCap:r.referral_monthly_cap??5}:{...e},u=e=>({card_on:e.cardOn,stamps_needed:e.stampsNeeded,reward:e.reward.trim(),stamp_expiry_days:e.stampExpiryDays,reward_expiry_days:e.rewardExpiryDays,gap_minutes:e.gapMinutes,max_per_day:e.maxPerDay,referral_on:e.referralOn,referral_giver:e.referralGiver.trim(),referral_friend:e.referralFriend.trim(),referral_monthly_cap:e.referralMonthlyCap}),y=e=>({id:String(e.id),title:e.title??'',details:e.details??'',startsOn:e.starts_on??null,endsOn:e.ends_on??null,isOn:!1!==e.is_on})},1073,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOP_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PAY_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"cleanGiftCode",{enumerable:!0,get:function(){return o}}),e.prettyGiftCode=function(t){const n=o(t);return 16===n.length?n.match(/.{4}/g).join('-'):n},e.poundsToPence=i,e.redeemKey=function(t=Math.random){const n='abcdefghijkmnpqrstuvwxyz23456789';let r='r-';for(let o=0;o<20;o++)r+=n[Math.floor(32*t())%32];return r},Object.defineProperty(e,"expiryWords",{enumerable:!0,get:function(){return c}}),e.amountsFromText=function(t){const n=t.split(/[,\s]+/).filter(Boolean).map(i);return!n.length||n.length>6||n.some(t=>null===t||t<100)?null:[...new Set(n)].sort((t,n)=>t-n)},e.basketTotal=function(t,n){return t.reduce((t,r)=>t+(n.find(t=>t.id===r.id)?.pricePence??0)*r.qty,0)},Object.defineProperty(e,"settingsFromRow",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"settingsToRow",{enumerable:!0,get:function(){return a}});const t={giftsOn:!1,shopOn:!1,expiryMonths:24,amounts:[2500,5e3,1e4],minPence:500,maxPence:25e3,terms:''},n='Gift cards are sold through your website. You can also pay at the bar or till.',r={'waiting-payment':'Waiting for payment at the till',active:'Ready to use',used:'Used up',expired:'Expired',void:'Cancelled',paid:'Paid',ready:'Ready to collect',collected:'Collected',cancelled:'Cancelled'},o=t=>(t??'').toUpperCase().replace(/[^A-Z0-9]/g,'');function i(t){const n=(t??'').trim().replace(/^\xa3/,'');return/^\d{1,4}(\.\d{1,2})?$/.test(n)?Math.round(100*Number(n)):null}const c=t=>t%12==0?`${t/12} year${12===t?'':'s'}`:`${t} months`;const s=n=>n?{giftsOn:!!n.gifts_on,shopOn:!!n.shop_on,expiryMonths:n.expiry_months??24,amounts:n.amounts??t.amounts,minPence:n.min_pence??500,maxPence:n.max_pence??25e3,terms:n.terms??''}:{...t},a=t=>({gifts_on:t.giftsOn,shop_on:t.shopOn,expiry_months:t.expiryMonths,amounts:t.amounts,min_pence:t.minPence,max_pence:t.maxPence,terms:t.terms})},1074,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shopPublic",{enumerable:!0,get:function(){return p}}),e.myShop=async function(t){return await(0,n.guestSession)()?(0,n.rpc)('guest_my_shop',{p_slug:t}):{cards:[],orders:[]}},e.buyGift=async function(t,o){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_gift_buy',{p_slug:t,p_amount:o.amount,p_recipient:o.recipient,p_from:o.from,p_message:o.message})},e.shopOrder=async function(t,o,c){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_shop_order',{p_slug:t,p_lines:o,p_name:c})},Object.defineProperty(e,"giftCheck",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"giftRedeem",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"giftActivate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"giftIssue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"giftHonourWix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"giftVoid",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"giftSummary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"shopStatus",{enumerable:!0,get:function(){return v}}),e.waitingCards=async function(){const{data:t,error:n}=await c().from('gift_cards').select('id,last4,ref,initial_pence,balance_pence,status,source,recipient_name,issued_at,expires_at').eq('venue_id',s()).order('issued_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.shopOrders=async function(){const{data:t,error:n}=await c().from('shop_orders').select('*').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.readShopSettings=async function(){const{data:t,error:n}=await c().from('shop_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return(0,o.settingsFromRow)(t)},e.saveShopSettings=async function(t){const{error:n}=await c().from('shop_settings').upsert({venue_id:s(),...(0,o.settingsToRow)(t),updated_by:u(),updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readProducts=async function(){const{data:t,error:n}=await c().from('shop_products').select('*').eq('venue_id',s()).order('sort').order('name');if(n)throw n;return t??[]},e.saveProduct=async function(t){const n={venue_id:s(),name:t.name.trim(),details:t.details.trim(),price_pence:t.pricePence,stock:t.stock,is_live:t.live,updated_by:u(),updated_at:(new Date).toISOString()},{error:o}=t.id?await c().from('shop_products').update(n).eq('id',t.id):await c().from('shop_products').insert(n);if(o)throw o},Object.defineProperty(e,"payPublic",{enumerable:!0,get:function(){return S}}),e.payStart=async function(t,o,s){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const u='undefined'!=typeof window?window.location.href.split('?')[0]:'',{data:p,error:_}=await c().functions.invoke('pay-checkout',{body:{slug:t,kind:o,target:s,successUrl:u,cancelUrl:u}});if(_||!p?.url)throw new Error(p?.error??'Card payment isn\u2019t available yet. Pay at the bar or till.');if(!/^https:\/\/checkout\.stripe\.com\//.test(p.url))throw new Error('Card payment isn\u2019t available yet. Pay at the bar or till.');return p},Object.defineProperty(e,"payStatus",{enumerable:!0,get:function(){return P}}),e.readPaySettings=async function(){const{data:t,error:n}=await c().from('payment_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return{provider:t?.provider??'none',cardOn:!!t?.card_on,account:t?.stripe_account_id??''}},Object.defineProperty(e,"savePaySettings",{enumerable:!0,get:function(){return O}}),e.recentPayments=async function(){const{data:t,error:n}=await c().from('payments').select('id,kind,amount_pence,status,provider,created_at,paid_at').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(20);if(n)throw n;return t??[]};var t=r(d[0]),n=r(d[1]),o=r(d[2]);const c=()=>(0,t.getSupabase)(),s=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},u=()=>(n.useSync.getState().staffRef??'').slice(0,80)||null,p=t=>(0,n.rpc)('shop_public',{p_slug:t});const _=t=>(0,n.rpc)('staff_gift_check',{p_venue:s(),p_code:t}),f=(t,o,c,u)=>(0,n.rpc)('staff_gift_redeem',{p_venue:s(),p_code:t,p_amount:o,p_key:c,p_by:u}),y=(t,o)=>(0,n.rpc)('staff_gift_activate',{p_card:t,p_by:o}),l=(t,o,c)=>(0,n.rpc)('staff_gift_issue',{p_venue:s(),p_amount:t,p_recipient:o,p_by:c}),b=(t,o,c)=>(0,n.rpc)('staff_gift_honour_wix',{p_venue:s(),p_code:t,p_balance:o,p_by:c}),w=(t,o,c)=>(0,n.rpc)('staff_gift_void',{p_card:t,p_reason:o,p_by:c}),h=()=>(0,n.rpc)('staff_gift_summary',{p_venue:s()}),v=(t,o,c,s)=>(0,n.rpc)('staff_shop_status',{p_order:t,p_status:o,p_reason:c,p_by:s});const S=async t=>{try{return await(0,n.rpc)('pay_public',{p_slug:t})}catch{return{provider:'none',cardOn:!1,testMode:!0}}};const P=t=>(0,n.rpc)('guest_pay_status',{p_payment:t});const O=t=>(0,n.rpc)('staff_payment_settings_save',{p_venue:s(),p_provider:t.provider,p_card_on:t.cardOn,p_account:t.account,p_by:u()})},1075,[872,824,1074]); +__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},1076,[1246,1234,1247]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.refreshCashAccess=r,e.setStaffCashUp=async function(o,c){const u=s.useSync.getState().venueId;if(!u)return{ok:!1,error:'Not connected. Try again when the app is online.'};const f=(0,t.getSupabase)();try{const{data:t}=await f.from('staff').select('id').eq('venue_id',u).eq('external_ref',o).maybeSingle();if(!t?.id)return{ok:!1,error:'This person isn\u2019t on the shared team list yet.'};const{error:s}=await f.rpc('set_staff_cash_up',{p_staff:t.id,p_on:c});return s?{ok:!1,error:/owner or manager/i.test(s.message)?'Only an owner or manager can change this.':'Could not save. Try again.'}:(n.useCashAccess.setState(t=>({byRef:{...t.byRef,[o]:c}})),r(),{ok:!0})}catch{return{ok:!1,error:'Could not save. Try again when the app is online.'}}};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]);async function r(){const r=s.useSync.getState().venueId;if(!r||'staff'!==s.useSync.getState().kind)return;const o=(0,t.getSupabase)();try{const[{data:t},{data:s},c]=await Promise.all([o.rpc('my_cash_up_access',{p_venue:r}),o.from('staff').select('external_ref, can_cash_up').eq('venue_id',r),o.rpc('my_cash_up_scope',{p_venue:r}).then(t=>t,()=>({data:null}))]),u=c?.data??null;u&&'boolean'==typeof u.takings&&n.useCashAccess.setState({takings:u.takings,tradingDate:'string'==typeof u.tradingDate?u.tradingDate:null,photos:!0===u.photos});const f={};if(Array.isArray(s))for(const t of s)t.external_ref&&(f[t.external_ref]=!!t.can_cash_up);n.useCashAccess.setState({mine:'boolean'==typeof t?t:n.useCashAccess.getState().mine,byRef:Array.isArray(s)?f:n.useCashAccess.getState().byRef,loaded:!0})}catch{}}},1077,[872,824,1049]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1078,[31,128,823,807,817,14,1402,825,818,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RID",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return d}}),_e.nextStatus=function(e){return'new'===e.status||'acknowledged'===e.status?{to:'preparing',label:'Start preparing'}:'preparing'===e.status?{to:'ready',label:'takeaway'===e.type?'Mark ready (notify customer)':'Mark ready'}:'ready'===e.status?'takeaway'===e.type?{to:'collected',label:'Collected'}:{to:'served',label:'Served'}:null},Object.defineProperty(_e,"LIVE",{enumerable:!0,get:function(){return u}}),_e.busyLevel=b,_e.restOfDayLevel=function(e,t){const r=e.hours.filter(t=>!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1079,[31,264,128,818,825,5,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return m}}),_e.BookingsDayNav=function({today:e,date:s,onDate:u,sub:c,count:y}){const[p,D]=(0,t.useState)(sb(e,6)?s:e),[w,h]=(0,t.useState)(!1),f=Array.from({length:7},(e,t)=>b(p,t)),j=e=>{u(e),f.includes(e)||D(e)},$=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':k(t);return(0,d.jsxs)(o.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,d.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${m(b(p,-7))}`,onPress:()=>{D(b(p,-7)),u(b(p,-7))}}),(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${m(b(p,7))}`,onPress:()=>{D(b(p,7)),u(b(p,7))}}),s!==e?(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${m(e)}`,onPress:()=>{D(e),u(e),h(!1)}}):null,(0,d.jsx)(n.Button,{small:!0,kind:"ghost",label:w?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>h(!0)})]}),(0,d.jsx)(l.AppDateCalendar,{visible:w,today:e,day:s,showBusy:!0,onDay:t=>{const s=t??e;j(s),D(s)},onClose:()=>h(!1),idPrefix:"bookings-cal"}),(0,d.jsx)(n.Row,{wrap:!0,gap:6,children:f.map(e=>(0,d.jsx)(n.Chip,{label:$(e),sub:c(e),selected:s===e,onPress:()=>u(e)},e))}),(0,d.jsx)(o.default,{testID:"bookings-day-title",children:(0,d.jsxs)(n.T,{size:17,weight:"semibold",colour:i.colours.goldLight,children:[m(s),sString(e).padStart(2,'0');function b(e,t){const[s,o,n]=e.split('-').map(Number),l=new Date(Date.UTC(s,o-1,n+t,12));return`${l.getUTCFullYear()}-${y(l.getUTCMonth()+1)}-${y(l.getUTCDate())}`}const p=e=>{const[t,s,o]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,o,12)).getUTCDay()+6)%7},m=e=>{const[t,s,o]=e.split('-').map(Number);return`${c[p(e)]} ${o} ${u[s-1]} ${t}`},k=e=>{const[,t,s]=e.split('-').map(Number);return`${c[p(e)].slice(0,3)} ${s} ${u[t-1].slice(0,3)}`}},1080,[31,128,818,1386,825,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1081,[31,818,823,826,25]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return n.useStore}}),_e.useNow=function(e=1e4){const r=(0,n.useStore)(e=>e.clock),[,u]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=setInterval(()=>u(e=>e+1),e);return()=>clearInterval(t)},[e]),(0,n.nowFrom)(r)},Object.defineProperty(_e,"useRestaurant",{enumerable:!0,get:function(){return a}}),_e.useRecipeCards=c,_e.useAllMenu=f,_e.useMenu=function(e){const r=f(e);return(0,t.useMemo)(()=>r.filter(e=>!e.hidden),[r])},Object.defineProperty(_e,"useCustomer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBasket",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useOrders",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"useOrderAtTable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useOrder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useBookings",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useWaitlist",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useEvents",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"useStampCard",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useGiftCards",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useRatings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"useAudit",{enumerable:!0,get:function(){return v}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),u=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]);_r(_d[7]);const a=e=>(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)),l=e=>(0,o.recipeCards)().subscribe(e),d=[];function c(e){return(0,t.useSyncExternalStore)(l,()=>e?(0,o.recipeCards)().list(e):d,()=>e?(0,o.recipeCards)().list(e):d)}function f(e){const u=(0,n.useStore)((0,r.useShallow)(t=>t.menu.filter(t=>t.restaurantId===e))),o=c(e);return(0,t.useMemo)(()=>(0,s.resolveMenu)(u),[u,o])}const b=()=>(0,n.useStore)(e=>e.customer),S=()=>(0,n.useStore)(e=>e.basket),g=(e,t)=>'table'!==t.type||(0,u.orderAtTableOn)(e.restaurants.find(e=>e.id===t.restaurantId)),m=e=>(0,n.useStore)((0,r.useShallow)(t=>t.orders.filter(r=>(!e||r.restaurantId===e)&&g(t,r)))),p=e=>(0,n.useStore)(t=>(0,u.orderAtTableOn)(t.restaurants.find(t=>t.id===e))),O=e=>(0,n.useStore)(t=>t.orders.find(t=>t.id===e)),y=e=>(0,n.useStore)((0,r.useShallow)(t=>e?t.bookings.filter(t=>t.restaurantId===e):t.bookings)),w=e=>(0,n.useStore)((0,r.useShallow)(t=>t.waitlist.filter(t=>t.restaurantId===e))),I=[],j=u=>{const s=(0,n.useStore)((0,r.useShallow)(e=>e.events.filter(e=>null===e.restaurantId||e.restaurantId===u))),o=(0,n.useStore)(e=>e.restaurants.find(e=>e.id===u)),a=o?(0,e.regularEventsOf)(o):I,l=(new Date).toISOString().slice(0,7);return(0,t.useMemo)(()=>{if(!u||!a.length)return s;const t=new Date,r=new Date(t.getFullYear(),t.getMonth()-2,1),n=new Date(t.getFullYear()+1,t.getMonth()+1,0),o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`;return[...s,...(0,e.expandEvents)(u,a,o(r),o(n))]},[s,a,u,l])},P=e=>(0,n.useStore)(t=>t.stampCards.find(r=>r.restaurantId===e&&r.customerId===t.customer.id)),h=e=>(0,n.useStore)((0,r.useShallow)(t=>t.giftCards.filter(r=>(!e||r.restaurantId===e)&&r.ownerId===t.customer.id))),M=e=>(0,n.useStore)((0,r.useShallow)(t=>t.ratings.filter(t=>t.restaurantId===e))),v=e=>(0,n.useStore)((0,r.useShallow)(t=>t.audit.filter(t=>t.restaurantId===e)))},1082,[814,31,884,881,1323,1177,839,1151]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"METHOD_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY3",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAYS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"wd",{enumerable:!0,get:function(){return i}}),e.dayRange=function(t){const n=[...new Set(t)].sort((t,n)=>t-n);if(!n.length)return'';if(7===n.length)return'every day';return n.every((t,o)=>o===0||t===n[o-1]+1)&&n.length>=3?`${o[n[0]]} to ${o[n[n.length-1]]}`:n.map(t=>o[t]).join(', ')},e.nextDelivery=a,Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return d}}),e.remindersFor=function(t,n,o={}){const d=i(n);return t.filter(t=>t.orderDays.includes(d)).flatMap(t=>{if(o[t.id]&&new Date(o[t.id]).toDateString()===n.toDateString())return[];let d=!1;if(/^\d\d:\d\d$/.test(t.cutoff)){const[o,s]=t.cutoff.split(':').map(Number),i=new Date(n);i.setHours(o,s,0,0),d=n>i}const l=a(t,n),c=t.reminder||`Order ${t.name} today${l?` for ${s[i(l)]}`:''}`;return[{supplierId:t.id,name:t.name,text:`${c}${t.cutoff?d?` (cut-off ${t.cutoff} passed)`:` by ${t.cutoff}`:''}`,tone:d?'red':'amber',cutoffPassed:d}]})},e.orderLines=function(n,o,s,i=""){const a=n.items.filter(t=>(o[t.id]??0)>0).map(n=>`${(0,t.fishInStone)(i,n)?(0,t.fishQtyText)(i,n,o[n.id]):`${l(o[n.id])} ${n.unit}`} ${n.name}`.replace(/\s+/g,' ').trim());return s.split('\n').map(t=>t.trim()).filter(Boolean).forEach(t=>a.push(t)),a},e.orderMessage=function(t,n,o,s,i,l){const c=a(t,l);return[`Hi ${t.contact||t.name.split(' (')[0]}, order from ${n}${o?`, ${o}`:''}${c?` for ${d(c)}`:''}:`,...s.map(t=>`- ${t}`),'',`Thanks, ${i}`].join('\n')},e.intlDigits=c,Object.defineProperty(e,"smsLink",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"waLink",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"telLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"sid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_SHEETS",{enumerable:!0,get:function(){return k}});var t=r(_d[0]);const n={online:'Online',phone:'Phone',text:'Text message',whatsapp:'WhatsApp',tbc:'To be decided'},o=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],s=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],i=t=>(t.getDay()+6)%7;function a(t,n){const o=null!=t.deliversOn?[t.deliversOn]:t.deliveryDays;if(!o.length)return null;for(let t=1;t<=7;t++){const s=new Date(n);if(s.setDate(s.getDate()+t),o.includes(i(s)))return s}return null}const d=t=>t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});const l=t=>Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,'');function c(t){const n=t.replace(/[^\d+]/g,'').replace(/^\+/,'');return n.startsWith('00')?n.slice(2):n.startsWith('0')?`44${n.slice(1)}`:n}const u=(t,n)=>`sms:${t.replace(/[^\d+]/g,'')}?&body=${encodeURIComponent(n)}`,m=(t,n)=>`https://wa.me/${c(t)}?text=${encodeURIComponent(n)}`,f=t=>`tel:${t.replace(/[^\d+]/g,'')}`;let p=0;const h=(t="os")=>`${t}-${Date.now().toString(36)}${(p++).toString(36)}`,y=(t,n,o)=>({id:t,name:n,unit:o}),b=t=>({number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:'',...t}),k=[b({id:'os-reids',name:'Reids',goods:'Dry goods and frozen',method:'online',urlLabel:'Open Coldweb',deliveryDays:[0,1,2,3,4],frequency:'Order on Coldweb',items:[y('rd-chips','Frozen chips','boxes'),y('rd-oil','Fryer oil','tubs'),y('rd-flour','Flour','bags'),y('rd-rice','Rice','bags'),y('rd-peas','Frozen peas','bags')],notes:'Order on their Coldweb ordering site. Add the Coldweb link in Managers \u203a Settings \u203a Supplier order sheets, or here.'}),b({id:'os-veg',name:'Veg',goods:'Fruit and veg (supplier to be added)',method:'tbc',placeholder:!0,frequency:'To be added by Gordon',notes:'Placeholder: Gordon will add the veg supplier, how to order and delivery days.'}),b({id:'os-peroni',name:'J. Pieroni & Sons',goods:'Seafood (fish merchant, Ayr)',method:'phone',url:'https://pieronis.com',urlLabel:'Open pieronis.com',deliveryDays:[0,1,2,3,4,5],frequency:'Phone order',items:[y('pa-haddock','Haddock fillets','kg'),y('pa-mussels','Mussels','kg'),y('pa-scallops','Scallops','kg'),y('pa-salmon','Salmon','kg')],notes:'Phone order. Press Call, then read the order from the screen.'}),b({id:'os-spesbona',name:'Spes Bona',goods:'Langoustines and smoked haddock',method:'text',orderDays:[2],deliversOn:4,deliveryDays:[4],frequency:'Text on Wednesday for Friday',reminder:'Text Spes Bona today for Friday\u2019s langoustines and smoked haddock',items:[y('sb-langs','Langoustines','kg'),y('sb-smoked','Smoked haddock','kg')]}),b({id:'os-tarelgin',name:'Tarelgin',goods:'Butcher',method:'text',frequency:'Text order',items:[y('tg-steak','Ribeye steaks',''),y('tg-mince','Steak mince','kg'),y('tg-chicken','Chicken breasts',''),y('tg-sausage','Sausages','kg')]}),b({id:'os-mills',name:'Mills',goods:'Milk',method:'whatsapp',frequency:'WhatsApp message',items:[y('ml-milk','Milk','litres'),y('ml-cream','Double cream','litres'),y('ml-butter','Butter','kg')]}),b({id:'os-kittyfisher',name:'Kittyfisher boat (Big Sean)',goods:'Lobsters and crabs',method:'text',contact:'Sean',frequency:'Whenever stock is low',shellfish:!0,items:[y('kf-lobster','Lobsters',''),y('kf-crab','Crabs','')],notes:'Text Big Sean whenever the lobster or crab count runs low.'}),b({id:'os-lionsmane',name:'Lion\u2019s mane mushroom',goods:'Lion\u2019s mane mushrooms',method:'online',urlLabel:'Open seller',frequency:'Weekly or fortnightly',priceCapPerKg:2500,seller:'Cheapest UK seller (to be chosen)',items:[y('lm-kg','Lion\u2019s mane mushroom','kg')],notes:'Order online from the cheapest UK seller under the price cap. Check the price per kg before you buy.'})]},1083,[1086]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1084,[1516,1099,812,31,119,257,264,152,128,823,828,829,1517,822,825,1044,818,1518,981,824,936,25]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isAnchorage",{enumerable:!0,get:function(){return r}}),e.isBarFridge=n,Object.defineProperty(e,"chefCanSee",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"demoActor",{enumerable:!0,get:function(){return s}}),e.hasRealSignature=c,Object.defineProperty(e,"PLACEHOLDER_AUTHOR",{enumerable:!0,get:function(){return f}}),e.isPlaceholderCard=u,e.isDemoCard=function(t){return!c(t)&&(['example','sample','demo'].includes(t.origin||'')||s(t.updatedBy)||u(t))},Object.defineProperty(e,"isSeedChefChat",{enumerable:!0,get:function(){return m}});const t='6349aa07-3fec-46e9-8c69-7b1b08494793',r=r=>'anchorage'===r||r===t;function n(t){if('string'==typeof t)return/\bbar[\s_-]*(?:fridge|refrigerat)|\b(?:fridge|refrigerator)[\s_-]*(?:in[\s_-]*the[\s_-]*)?bar\b|^cp-bar$/i.test(t);if(!t||'object'!=typeof t)return!1;const r=t;if(n(['name','label','kind','unit','location','storage','storageLocation'].map(t=>r[t]).filter(t=>'string'==typeof t).join(' ')))return!0;return(['name','label'].some(t=>'string'==typeof r[t]&&''!==r[t].trim())?[]:['id','key','pointId']).concat(['name','label','unit','location','storage','storageLocation','aliases']).some(t=>Array.isArray(r[t])?r[t].some(n):'string'==typeof r[t]&&n(r[t]))}const o=(t,o)=>!r(t)||!n(o),s=t=>'string'==typeof t&&/(?:\b(?:example|sample|demo)\b)/i.test(t);function c(t){return[t.signOff?.by,t.allergensConfirmed?.by].some(t=>!!t&&!s(t))}const f='CoverCharge, for Head Chef sign-off';function u(t){return!c(t)&&(t.updatedBy||'').startsWith('CoverCharge')&&(!t.createdBy||t.createdBy.startsWith('CoverCharge'))}const l={'m-seed-all':'Welcome to the team chat on CoverCharge.','m-seed-kitchen':'Kitchen channel: Head Chef, kitchen team and managers.','m-seed-foh':'Front of house channel: front of house, bar and managers.','m-seed-managers':'Managers channel: owners, managers and the supervisor only.'},m=t=>'system'===t.from&&(!!l[t.id]&&l[t.id]===t.text||'m-seed-all'===t.id&&/this phone only/.test(t.text||''))},1085,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KG_PER_STONE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"HALF_STONE_KG",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isFishName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fishInStone",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"halfStone",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toStone",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"fromStone",{enumerable:!0,get:function(){return c}}),e.stoneText=b,e.stoneSpeech=h,Object.defineProperty(e,"fishQtyText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"fishQtySpeech",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantityStep",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"stepQuantity",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"inputQuantity",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"quantityUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"displayedCost",{enumerable:!0,get:function(){return k}}),e.parseStoneAmount=function(t){if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.toLowerCase().trim();if(/\b(?:kg|kilos?|kilograms?|grams?)\b/.test(n))return;const i=n.match(/(?:^|\s)(\d+(?:[.,]\d+)?)(\xbd)?(?:\s*(?:stone|st)\b|$)/);if(i)return Number(i[1].replace(',','.'))+(i[2]?.5:0);const o=n.match(/\b(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)(?: and a half)?(?: stone| st|$)/);return o?l.indexOf(o[1])+(/and a half/.test(o[0])?.5:0):/(?:^|\s)(?:\xbd|(?:a )?half(?: a)?)(?: stone| st|$)/.test(n)?.5:void 0};var t=r(d[0]);const n=6.35029318,i=3.17514659,o=(t="")=>!/\b(?:vegan|vegetarian|banana|blossom|mushroom|sauce|stock|oil)\b|\(vg\)/i.test(t)&&/\b(?:fish|haddock|salmon|cod|hake|halibut|plaice|sole|turbot|trout|mackerel|monkfish|seabass|sea bass|seabream|sea bream|tuna|pollock|coley|whiting|sardines?|anchov(?:y|ies)|herring)\b/i.test(t),u=(n,i)=>(0,t.isAnchorage)(n)&&/^(kg|kilos?|kilograms?|st|stone)$/i.test(i.unit||'')&&o(i.name),s=t=>Math.round(2*(t+Number.EPSILON))/2,f=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t/n,c=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t*n;function b(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'\u2212':''}${n%1?`${i||''}\xbd`:i} stone`}const l=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'];function h(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'minus ':''}${n%1?i?`${l[i]||i} and a half`:'half a':l[i]||i} stone`}const y=(t,n,i)=>u(t,n)?b(f(i,n.unit)):`${i} ${n.unit||''}`.trim(),p=(t,n,i)=>u(t,n)?h(f(i,n.unit)):y(t,n,i),O=(t,n)=>u(t,n)?c(.5,n.unit):'kg'===n.unit?.5:1,v=(t,n,i,o)=>u(t,n)?c(Math.max(0,s(f(i,n.unit))+.5*o),n.unit):Math.max(0,i+o*O(t,n)),P=(t,n,i)=>u(t,n)?c(s(i),n.unit):i,j=(t,n)=>u(t,n)?'stone':n.unit||'',k=(t,n,i)=>u(t,n)?i*c(1,n.unit):i},1086,[1085]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShellStore",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"localShellfish",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"shellfish",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"useStockItems",{enumerable:!0,get:function(){return O}}),_e.venueCounts=w,_e.useShellfish=function(e,t,s,o){const a=O(e,!1,o).filter(t=>'chef'!==s||(0,n.chefCanSee)(e,t)),d=_(t=>!!t.server[e]),u=_((0,l.useShallow)(t=>{const s=t.items[e]??[],n=new Set(s.filter(e=>o?e.group!==o:!!e.group).map(e=>e.key));return t.events.filter(s=>s.rid===e&&(!t.server[e]||I(s))&&!n.has(s.kind))})),c=_((0,l.useShallow)(t=>w(t,e))),p=(0,f.lastUndoable)(u),v=e=>a.find(t=>t.key===e);return{items:a,events:u,counts:c,undoable:p,synced:d,itemOf:v,isLow:e=>(0,f.isLowItem)(v(e),c[e]??0),sell:(n,o=!1)=>{const a=v(n),d=a&&(0,i.fishInStone)(e,a)?i.HALF_STONE_KG:o?.5:1;return!((c[n]??0){i>0&&E.append({rid:e,kind:n,delta:i,reason:'delivery',by:t,app:s})},recount:(n,i)=>{const o=i-(c[n]??0);o&&E.append({rid:e,kind:n,delta:o,reason:'count',by:t,app:s})},undoLast:()=>{p&&E.append({rid:e,kind:p.kind,delta:-p.delta,reason:'undo',by:t,app:s,undoes:p.id})}}};var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),i=r(_d[3]),o=r(_d[4]),a=r(_d[5]),d=(e=a)&&e.__esModule?e:{default:e};r(_d[6]);var u=r(_d[7]),c=r(_d[8]),l=r(_d[9]),f=r(_d[10]),p=r(_d[11]),v=r(_d[12]);const S=()=>{try{return(0,v.nowFrom)(v.useStore.getState().clock)}catch{return new Date}},h='covercharge-shellfish-v1',y='anchorage',_=(0,u.create)()((0,c.persist)(e=>({events:[],items:o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))},server:{},saveItem:(t,s)=>e(e=>{const n=e.items[t]??[];return{items:{...e.items,[t]:n.some(e=>e.key===s.key)?n.map(e=>e.key===s.key?s:e):[...n,s]}}}),removeItem:(t,s)=>e(e=>({items:{...e.items,[t]:(e.items[t]??[]).filter(e=>e.key!==s)}}))}),{name:h,storage:(0,c.createJSONStorage)(()=>d.default),version:4,partialize:e=>({events:e.events,items:e.items,server:e.server}),migrate:async e=>{t.LIVE_VENUE_BUILD&&e&&await(0,s.archiveChefCache)('tracked-stock',e);const n=e??{};return{events:(i=n.events,(i??[]).filter(e=>!e.id.startsWith('sf-seed-'))),items:n.items??(o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))}),server:n.server??{}};var i}})),b={list:e=>_.getState().events.filter(t=>t.rid===e),append:e=>{const t={...e,id:(0,p.uuid)(),at:e.at??S().toISOString()};return _.setState(e=>({events:[t,...e.events].slice(0,500)})),t},subscribe:e=>_.subscribe(e)},E=b;'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===h&&_.persist.rehydrate()});const k=[],O=(e,t=!1,s)=>{const n=_(t=>t.items[e])??k;return t?n:n.filter(e=>e.active&&(s?e.group===s:!e.group)).sort((e,t)=>e.sort-t.sort)},I=e=>!e.id.startsWith('sf-');function w(e,t){const s=e.items[t]??[],n=e.server[t],i=e.events.filter(e=>e.rid===t);if(!n)return(0,f.countsOf)(i,s);const o=new Set(n.seen),a=new Date(Date.now()-2592e5).toISOString();return(0,f.countsOf)(i.filter(e=>I(e)&&!o.has(e.id)&&e.at>=a),s,n.counts)}},1087,[842,1159,1085,1086,5,1160,123,995,1169,884,1089,1099,881]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOrderSheets",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useSheets",{enumerable:!0,get:function(){return f}});var e,s=r(d[0]),t=r(d[1]),h=r(d[2]),n=r(d[3]),o=(e=n)&&e.__esModule?e:{default:e},c=r(d[4]),i=r(d[5]),u=r(d[6]);const p=()=>h.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{}:{anchorage:u.ANCHORAGE_SHEETS.filter(e=>!e.placeholder).map(e=>({...e,items:e.items.map(e=>({...e}))}))},l=(0,c.create)()((0,i.persist)(e=>({sheets:p(),opened:{},upsert:(s,t)=>e(e=>{const h=e.sheets[s]??[];return{sheets:{...e.sheets,[s]:h.some(e=>e.id===t.id)?h.map(e=>e.id===t.id?t:e):[...h,t]}}}),patch:(s,t,h)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).map(e=>e.id===t?{...e,...h}:e)}})),remove:(s,t)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).filter(e=>e.id!==t)}})),markOpened:(s,t)=>e(e=>({opened:{...e.opened,[s]:t}})),reset:s=>e(e=>({sheets:{...e.sheets,[s]:'anchorage'===s&&p().anchorage||[]}}))}),{name:'covercharge-ordersheets-v1',storage:(0,i.createJSONStorage)(()=>o.default),version:3,migrate:async e=>{const h=e;return s.LIVE_VENUE_BUILD?(await(0,t.archiveChefCache)('order-sheets',h),{...h,sheets:{...h.sheets,anchorage:(h.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}}):h}})),_=[],f=e=>l(s=>s.sheets[e])??_},1088,[842,1159,5,1160,995,1169,1083]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANCHORAGE_STOCK",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"stockKey",{enumerable:!0,get:function(){return n}}),_e.countsOf=function(e,t=[],n={}){const u={...n};for(const e of t)u[e.key]=u[e.key]??0;for(const t of e)u[t.kind]=(u[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(u).map(([e,t])=>[e,o(i.get(e),t)]))},_e.lastUndoable=function(e){const t=new Set(e.filter(e=>e.undoes).map(e=>e.undoes));return e.find(e=>'undo'!==e.reason&&'count'!==e.reason&&!t.has(e.id))},Object.defineProperty(_e,"fmtCount",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isLowItem",{enumerable:!0,get:function(){return c}}),_e.describe=function(e,t){const n=(t?.name??e.kind).toLowerCase(),o=(t?.plural??`${e.kind}s`).toLowerCase(),s=t?i(e.rid,t,Math.abs(e.delta)):u(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${s} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${s} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${s} ${n})`:`Count: ${s} ${o}`},Object.defineProperty(_e,"isRoastItem",{enumerable:!0,get:function(){return l}}),_e.isSundayIn=function(e,t="Europe/London"){try{return'Sun'===new Intl.DateTimeFormat('en-GB',{weekday:'short',timeZone:t}).format(e)}catch{return 0===e.getDay()}};var e=r(_d[0]);const t=[{key:'lobster',name:'Lobster',plural:'Lobsters',unit:'half',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd9e',sort:1,active:!0},{key:'crab',name:'Crab',plural:'Crabs',unit:'whole',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd80',sort:2,active:!0}],n=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,40)||'item',o=(e,t)=>Math.max(0,'kg'===e?.unit?t:'half'===e?.unit?Math.round(2*t)/2:Math.round(t));const u=e=>{const t=Math.floor(e);return e-t>=.5?t?`${t}\xbd`:'\xbd':String(t)},i=(t,n,o)=>'kg'===n.unit?(0,e.fishQtyText)(t,n,o):u(o),s=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):u(o),c=(e,t)=>t<=(e?.lowAt??4);const l=e=>'roast'===e.group},1089,[1086]); +__d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.useGameClock=I,_e.usePlayable=function(e,t){return(0,y.gamePlayable)(I(e,t))},Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return C}}),_e.gameBase=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return C(e?.settings?.gameUrl)??v},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,b.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=I(e,s),u=(0,y.gamePlayable)(c);return n?(0,w.jsxs)(d.Card,{children:[(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(d.T,{size:13,colour:u?x.colours.ok:x.colours.muted,children:u?'Open':'Locked'})]}),(0,w.jsx)(d.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),u?null:(0,w.jsx)(d.Muted,{testID:"break-room-locked-text",children:y.GAME_LOCKED_TEXT}),(0,w.jsx)(d.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,w.jsx)(R,{staffId:e,name:t,playable:u,clock:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return T}}),_e.BreakRoom=R;var t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),n=e(r),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),c=e(_r(_d[6])),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),m=_r(_d[10]),y=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),p=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]),x=_r(_d[17]),w=_r(_d[18]);function I(e,t){const s=(0,m.useOwner)(e=>e.attendance);return(0,y.gameClock)(s,e,t)}const v='https://lennys-kitchen-chaos-13e285.deed.page/',C=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function S(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const T=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:I,playable:R,clock:P,onClose:L,car:M}){const D=(0,m.useOwner)(e=>e.staff),O=(0,f.useAvatars)(e=>e.photos),_=(0,h.useSetup)(e=>e.looks),z=(0,r.useRef)(null),[N,U]=(0,r.useState)({}),[A,B]=(0,r.useState)(!1),[G,q]=(0,r.useState)(null),H=(0,b.useStore)(e=>C(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??v),V=(0,r.useMemo)(()=>S(H),[H]),W=V?.origin??'',$=(0,j.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),K=!(!$||!e||$===e),X=K?null:$??e??null,Y=T(I),[F,J]=(0,r.useState)(''),[Q,Z]=(0,r.useState)(null),ee=(0,r.useRef)(null),te=(0,r.useRef)(0),se=(0,r.useRef)(null),re=(0,r.useRef)(R);re.current=R;const ne=(0,r.useMemo)(()=>D.filter(e=>e.active&&!e.name.includes('(example)')),[D]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const s of ne){const r=null!=_[s.id]&&_[s.id]>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===_[s.id]):void 0;if(r){e[s.id]=r.dataUrl;continue}const n=document.getElementById(`cc-av-${s.id}`)?.querySelector('svg');n&&(e[s.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n.outerHTML.includes('xmlns')?n.outerHTML:n.outerHTML.replace('clearTimeout(e)},[ne,_]);const oe=(0,r.useMemo)(()=>ne.map(e=>{const t=O[e.id]?.dataUrl??N[e.id],s={id:e.id,name:T(e.name),role:e.job||e.level||e.role};return t&&(s.avatarUrl=t),s}),[ne,O,N]),le=(0,r.useCallback)(e=>{try{W&&z.current?.contentWindow?.postMessage(e,W)}catch{}},[W]);return(0,r.useEffect)(()=>{const e=async e=>{if(!W||e.origin!==W||e.source!==z.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return q('string'==typeof t.version?String(t.version).slice(0,12):null),void B(!0);const s=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.listScores)(s,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!X||'string'==typeof e.staffId&&e.staffId!==X)return void le({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,k.listScores)(s,10),id:null}});const r='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.submitScore)(s,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:r,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:X,name:Y})})}'lenny:roundAbandoned'===t.type&&J('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&J(''),'lenny:progress'===t.type&&X&&t.staffId===X&&(0,k.saveProgress)(X,t.progress),'lenny:gameComplete'===t.type&&X&&t.staffId===X&&J(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[le,X,Y,W]),(0,r.useEffect)(()=>{B(!1),ee.current=null,se.current=null},[V?.src]),(0,r.useEffect)(()=>{if(!A)return;const e=e=>{se.current!==e&&(se.current=e,le({type:'lenny:setPlayable',playable:e}))},t=K?null:`${X??''}|${Y}`;if(t&&ee.current===t)return void e(R);const s=++te.current;ee.current=null,se.current&&e(!1),t&&(0,k.loadProgress)(X).catch(()=>null).then(r=>{s===te.current&&(le({type:'lenny:setPlayer',name:Y,staffId:X,...r?{progress:r}:{}}),ee.current=t,e(re.current))})},[A,K,X,Y,R,le]),(0,r.useEffect)(()=>{A&&le({type:'lenny:setRoster',staff:oe})},[A,oe,le]),(0,r.useEffect)(()=>{A&&null!==Q&&le({type:'lenny:setMuted',muted:Q})},[A,Q,le]),(0,w.jsx)(o.default,{visible:!0,animationType:"slide",onRequestClose:L,children:(0,w.jsxs)(c.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,s.soutersSurface)('#000')},children:[M?(0,w.jsx)(E,{status:K?'Switching player\u2026':R?'Parked only \xb7 enjoy!':'Game locked',muted:!!Q,onPause:()=>le({type:'lenny:pause'}),onMute:()=>Z(!Q),onClose:L}):(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:x.colours.bg},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(c.default,{testID:R&&!K?'break-playable':'break-locked',accessibilityLabel:G?`Game version ${G}`:void 0,children:(0,w.jsx)(d.T,{size:13,colour:R?x.colours.ok:x.colours.gold,children:K?'Switching player\u2026':R?'off'===P?'Off shift: enjoy!':'On your break: enjoy!':'Game locked'})}),(0,w.jsxs)(d.Row,{gap:4,children:[(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:Q?'Turn sound and voice on':'Mute sound and voice',onPress:()=>Z(!Q),style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:Q?'Sound on':'Mute'})}),(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",onPress:L,style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:"Close"})})]})]}),R||K?null:(0,w.jsx)(c.default,{testID:"break-locked-text",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.text,children:y.GAME_LOCKED_TEXT})}),F?(0,w.jsx)(c.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.muted,children:F})}):null,V?n.default.createElement('iframe',{ref:z,src:V.src,key:V.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,w.jsx)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(d.Muted,{children:"The Break room opens in the web app."})}),(0,w.jsx)(c.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:ne.map(e=>(0,w.jsx)(c.default,{nativeID:`cc-av-${e.id}`,children:(0,w.jsx)(u.AvatarLook,{look:_[e.id],id:e.id,name:e.name,size:96})},e.id))})]})})}function E({status:e,muted:t,onPause:s,onMute:r,onClose:n}){const o={minHeight:72,minWidth:150,paddingHorizontal:22,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'};return(0,w.jsxs)(c.default,{testID:"car-game-bar",style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:16,paddingVertical:10,backgroundColor:x.colours.bg,borderBottomWidth:1,borderColor:x.colours.border},children:[(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",accessibilityLabel:"Close the game",onPress:n,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Close"})}),(0,w.jsx)(l.default,{testID:"car-game-pause",accessibilityRole:"button",accessibilityLabel:"Pause the game",onPress:s,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Pause"})}),(0,w.jsxs)(c.default,{style:{flex:1,alignItems:'center',minWidth:0},children:[(0,w.jsx)(d.T,{size:22,weight:"semibold",center:!0,numberOfLines:1,children:"Lenny\u2019s Kitchen Chaos"}),(0,w.jsx)(d.T,{size:15,colour:x.colours.goldLight,center:!0,numberOfLines:1,children:`${e} \xb7 touch the big buttons on the game`})]}),(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:t?'Turn sound and voice on':'Mute sound and voice',onPress:r,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:t?'Sound on':'Mute'})}),(0,w.jsx)(c.default,{testID:"car-game-parked",style:{...o,minWidth:0,borderColor:x.colours.goldMuted,backgroundColor:'rgba(201,162,74,0.12)'},children:(0,w.jsx)(d.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:"PARKED ONLY"})})]})}},1090,[1357,876,31,257,123,264,128,996,818,1190,863,1434,1096,881,5,1435,824,825,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hash",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return r}}),_e.revenueHistory=function(e,t,r=28){const s=[];if(!(0,a.examplesAllowed)())return s;for(let a=r;a>=1;a--){const r=(0,o.addMins)(t,1440*-a),i=!!e.kitchenHours[r.getDay()],d=[1.05,0,0,.6,.7,1,1.2][r.getDay()]*('anchorage'===e.id?1:.6),l=t=>.85+.3*n((0,o.ymd)(r)+t+e.id),u=i?Math.round(24e4*d*l('d')):0,c=i?Math.round(95e3*d*l('t')):0,p=i?Math.round(52e3*d*l('q')):0;s.push({date:r,label:(0,o.niceDate)(r).slice(0,6),byChannel:{'Dine-in':u,Takeaway:c,'Table QR':p},total:u+c+p,covers:i?Math.round(150*d*l('c')):0})}return s},_e.dishStats=function(e){return(0,a.examplesAllowed)()?e.filter(e=>null!=e.price).map(e=>{const t=Math.round(20+260*n(e.id+'s')),o=.24+.22*n(e.id+'c'),a=e.price??0,r=Math.round(a*(1-o));return{item:e,sold:t,revenue:t*a,costPct:o,margin:r,gp:r*t}}):[]},_e.quadrant=function(e,t,o,a){return e>=o?t>=a?'Star':'Plough horse':t>=a?'Puzzle':'Dog'},Object.defineProperty(_e,"QUADRANT_TIP",{enumerable:!0,get:function(){return s}}),_e.crmCustomers=function(){return(0,a.examplesAllowed)()?i.map((e,t)=>{const o=n(e+t);return{id:0===t?'cust-demo':`cr-${t}`,name:`${e} ${d[t]}${0===t?'':' (example)'}`,phone:`07700 900${String(100+7*t).slice(-3)}`,visits:1+Math.round(18*o),lastVisit:`${1+Math.round(27*o)} days ago`,spend:Math.round(3e3+6e4*o),allergies:0===t?['Crustaceans (anaphylaxis)','Mustard']:o>.8?['Gluten (coeliac)']:o<.1?['Peanuts']:[],stamps:0===t?5:Math.round(7*o),optIn:o>.25,channel:r[Math.floor(3*o)%3],birthday:o>.6?`${1+Math.round(27*o)} Nov`:void 0}}):[]},Object.defineProperty(_e,"STOCK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"stockList",{enumerable:!0,get:function(){return u}}),_e.insights=function(e,n,r,s,i,d,u){const p=[];if(!(0,a.examplesAllowed)())return c(e,n,r,s,i,d,u);const h=new Date(d);h.setDate(h.getDate()+((6-h.getDay()+7)%7||7)),h.setHours(0,0,0,0);const b=(0,t.forecastToday)(e,n,r,s,h),m=Math.round(b.restOfDay.covers/Math.max(1,b.multiplier)),y=Math.max(35,Math.round(100*(b.multiplier-1))+35);p.push({id:'sat',icon:'\ud83d\udcc8',tone:'gold',title:`${(0,o.niceDate)(h)} forecast +${y}%: add 1 server 6\u20139pm`,body:`Example: about ${Math.round(m*(1+y/100))} covers expected vs about ${m} on a usual Saturday (bookings pace + Halloween weekend flag).`,action:{label:'Open rota',tab:'more',sub:'rota'}});const f=(0,t.forecastToday)(e,n,r,s,d),v=l[0],w=Math.ceil((f.restOfDay.covers+2*f.restOfDay.takeaway)*v.perCover);p.push({id:'haddock',icon:'\ud83d\udc1f',tone:'red',title:`Haddock low: ${v.onHand} portions left`,body:`Tonight\u2019s forecast needs about ${w}. Call the supplier before 18:00 or mark the fish supper sold out at ${v.onHand} sold.`,action:{label:'Prep list',tab:'more',sub:'prep'}});const k=s.find(e=>/Burns/.test(e.title));if(k){const e=Math.max(1,Math.round((new Date(k.date).getTime()-d.getTime())/6048e5));p.push({id:'burns',icon:'\ud83e\udd43',tone:'blue',title:`Burns Night in ${e} weeks: open bookings?`,body:'Last year\u2019s equivalent nights sold out about 3 weeks ahead (example). Publish the set menu and push to opted-in regulars.',action:{label:'Plan campaign',tab:'more',sub:'marketing'}})}const M=n.filter(e=>e.date===(0,o.venueYmd)(d)&&'noshow'===e.status).length;p.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:M?`${M} no-show today: deposits for 6+?`:'Deposits for bigger tables (example)',body:'Deposits are set per venue in Settings \u203a Advanced \u203a Deposits. Consider them on Fri/Sat after 19:00.',action:{label:'Bookings',tab:'bookings'}});const C=i.filter(e=>e.stars<=2).length;C&&p.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${C} low rating this week: cold chips at collection`,body:'Readiness alerts now time bagging 5 min before pickup. Reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});return p.push({id:'commission',icon:'\ud83d\udcb7',tone:'ok',title:'You kept about \xa31,240 in commission this month',body:'Example: \xa34,140 of direct takeaway orders that would have cost about 30% on delivery apps.',action:{label:'Analytics',tab:'more',sub:'analytics'}}),p.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${u} covers so far today`,body:'Lobster special is the top add-on tonight. Suggest it with the scallops (example).'}),p};var e=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]);const n=e=>{let t=2166136261;for(let o=0;o>>0)/4294967295},r=['Dine-in','Takeaway','Table QR'];const s={Star:'Keep: high margin and popular. Feature it.','Plough horse':'Popular, low margin: nudge the price or trim the cost.',Puzzle:'High margin, few sales: promote it or rename it.',Dog:'Low margin, few sales: consider removing it.'},i=['Alex','Fiona','Iain','Morag','Callum','Eilidh','Ross','Kirsty','Euan','Shona','Hamish','Isla','Craig','Ailsa','Neil','Catriona'],d=['Morgan','Campbell','Fraser','McLeod','Kerr','Wallace','Boyd','Hamilton','Stewart','Murray','Paterson','Duncan','Gilmour','Reid','Ross','Grant'];const l=[{cat:'Fish & seafood',id:'haddock',name:'Haddock fillets',unit:'portions',onHand:8,perCover:.22,par:40},{cat:'Fruit & veg',id:'chips',name:'Chipping potatoes',unit:'kg',onHand:25,perCover:.18,par:40},{cat:'Fish & seafood',id:'langoustine',name:'Langoustines',unit:'kg',onHand:4,perCover:.03,par:6},{cat:'Fish & seafood',id:'mussels',name:'Mussels',unit:'kg',onHand:10,perCover:.05,par:12},{cat:'Fish & seafood',id:'scallops',name:'Scallops',unit:'portions',onHand:14,perCover:.06,par:20},{cat:'Meat',id:'beef',name:'Burger patties',unit:'each',onHand:30,perCover:.1,par:40},{cat:'Fruit & veg',id:'peas',name:'Garden peas',unit:'kg',onHand:6,perCover:.04,par:8},{cat:'Dairy',id:'tartare',name:'House tartare sauce',unit:'tubs',onHand:5,perCover:.05,par:10}],u=()=>(0,a.examplesAllowed)()?l:[];function c(a,n,r,s,i,d,l){const u=[],c=(0,t.forecastToday)(a,n,r,s,d);c.enough||u.push({id:'history',icon:'\ud83d\udcc5',tone:'gold',title:'Not enough history yet',body:c.suggestions[0]?.replace(/^Not enough history yet\. /,'')??'',action:{label:'Settings \u203a Advanced',tab:'more',sub:'advanced'}});const p=(0,o.ymd)(d),h=n.filter(e=>e.date===p&&'noshow'===e.status).length;h&&u.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:`${h} no-show${1===h?'':'s'} today`,body:'Think about a deposit for larger parties (Settings \u203a Advanced \u203a Deposits).',action:{label:'Bookings',tab:'bookings'}});const b=i.filter(e=>e.stars<=2).length;b&&u.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${b} low rating${1===b?'':'s'} to read`,body:'Read what they said, reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});const m=s.filter(e=>e.date>=p).sort((e,t)=>e.date.localeCompare(t.date))[0];return m&&u.push({id:'event',icon:'\ud83d\udcc5',tone:'blue',title:`Coming up: ${m.title}`,body:`${(0,o.niceDate)(new Date(m.date+'T12:00:00'))}. Check your rota and think about a promo.`,action:{label:'Forecast',tab:'forecast'}}),u.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${l} covers so far today`,body:`Seated bookings and walk-ins recorded in CoverCharge today. ${(0,e.laterTodayLine)((0,e.laterTodayCovers)(n,p))}`}),u}},1091,[832,879,822,1183]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useExamples",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const l=()=>(0,t.useSyncExternalStore)(n.onDataModeChange,n.examplesAllowed,n.examplesAllowed)},1092,[31,1183]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useRealHistory=function(e,t){const o=(0,c.useExamples)(),n=(0,r.useBookings)(e),l=(0,r.useOrders)(e),f=(0,u.useCashUp)(e=>e.cashUps),y=(0,k.clampWeeks)((0,h.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings.forecastMinWeeks)),b=t.toDateString();return(0,s.useMemo)(()=>o?null:(0,k.buildHistory)(e,n,l,f.map(e=>({rid:e.rid,date:e.date,takings:(0,p.takings)(e.vals)})),t,y),[o,e,n,l,f,y,b])},Object.defineProperty(_e,"ExampleBadge",{enumerable:!0,get:function(){return b}}),_e.NotEnoughHistory=function({weeks:e,booked:s,what:t="Forecasts",testID:r="not-enough-history"}){return(0,y.jsx)(n.Card,{children:(0,y.jsxs)(o.default,{testID:r,style:{gap:6},children:[(0,y.jsx)(n.T,{weight:"semibold",colour:f.colours.gold,children:"Not enough history yet"}),(0,y.jsx)(n.Muted,{children:'Forecasts'===t?(0,l.notEnoughTip)(e):`${t} start once CoverCharge has ${1===e?'1 week':`${e} weeks`} of your bookings and cash-ups.`}),s?(0,y.jsx)(o.default,{testID:`${r}-booked`,children:(0,y.jsxs)(n.T,{children:["Booked so far: ",s," Covers"]})}):null,(0,y.jsx)(n.Muted,{children:"Tip: upload or add your bookings and do the cash up each night. Managers can change how much history is needed in Settings \u203a Advanced."})]})})};var e,s=_r(d[0]),t=_r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=_r(d[2]),r=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),p=_r(d[8]),k=_r(d[9]),f=_r(d[10]),y=_r(d[11]);const b=()=>(0,y.jsx)(n.Badge,{kind:"amber",label:l.EXAMPLE_LABEL.toUpperCase()})},1093,[31,128,818,823,1050,1183,1092,881,13,1094,825,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_MIN_WEEKS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"clampWeeks",{enumerable:!0,get:function(){return o}}),e.buildHistory=function(o,a,c,u,d,f=n){const l=(0,t.ymd)(d),y=(0,t.ymd)(new Date(d.getTime()-48384e5)),h=t=>t>=y&&tt.rid===o&&h(t.date));for(const t of k)D.add(t.date);const T=[...D].sort(),w=T.length?s(T[0],l):0,j=w>=7*f&&T.length>=2*f,O=t=>{const n={},o={};for(const t of T){const n=new Date(t+'T12:00:00').getDay();o[n]=(o[n]??0)+1}for(const[o,s]of Object.entries(t)){const t=new Date(o+'T12:00:00').getDay();n[t]??={};for(const[o,a]of Object.entries(s))n[t][Number(o)]=(n[t][Number(o)]??0)+a}for(const t of Object.keys(n))for(const s of Object.keys(n[+t]))n[+t][+s]=n[+t][+s]/(o[+t]||1);return n},M=Array.from({length:7},()=>[]);for(const t of k)'number'==typeof t.takings&&t.takings>0&&M[new Date(t.date+'T12:00:00').getDay()].push(Math.round(100*t.takings));const N=M.map(t=>t.length?Math.round(t.reduce((t,n)=>t+n,0)/t.length):null),_=k.filter(t=>'number'==typeof t.takings&&t.takings>0),E=(_.length?s(_.map(t=>t.date).sort()[0],l):0)>=7*f&&_.length>=2*f;return{covers:O(b),takeaway:O(p),days:T.length,spanDays:w,enough:j,minWeeks:f,takingsByDay:N,cashUps:_.length,salesEnough:E}};var t=r(_d[0]);const n=2,o=t=>{const o=Math.round(Number(t));return Number.isFinite(o)&&o>=1&&o<=8?o:n},s=(t,n)=>Math.round((new Date(n+'T12:00:00').getTime()-new Date(t+'T12:00:00').getTime())/864e5)},1094,[822]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1095,[876,31,121,225,123,128,288,989,818,874,825,1428,25]); +__d(function(_g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SETUP_STEPS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ACCESS_LEVELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ACCESS_ROLE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"ACCESS_APP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"accessOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PERMS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"DEFAULT_PERMS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"DEFAULT_GRADES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useSetup",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useSiteSetup",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"HOME_SETUP_NAGS_OFF",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"homeSetupNagsHidden",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"setupProgress",{enumerable:!0,get:function(){return v}});var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e},i=_r(d[2]),s=_r(d[3]);const o=[{id:'venue',title:'Venue details & logo',sub:'Name, address, phone, your logo and order at table'},{id:'hours',title:'Opening hours',sub:'When the kitchen is open each day'},{id:'plan',title:'Areas & table plan',sub:'Your areas, tables and seats'},{id:'paygrades',title:'Staff pay rates',sub:'Name, age, role and hourly rate; tap to edit'},{id:'staff',title:'Add staff',sub:'Name, role, access, pay and avatar'},{id:'permissions',title:'Permissions',sub:'What each access level can do'},{id:'email',title:'Link email',sub:'Your work email address'},{id:'website',title:'Link website',sub:'Your website and booking link'},{id:'invites',title:'Staff invite links',sub:'Personal links for each person'}],l=['Owner','Manager','Supervisor','Head Chef','Staff'],u={Owner:'owner',Manager:'manager',Supervisor:'manager','Head Chef':'staff',Staff:'staff'},c={Owner:'Managers',Manager:'Managers',Supervisor:'Managers','Head Chef':'Head Chef',Staff:'Staff'},f=(e,t)=>l.includes(e??'')?e:'owner'===t?'Owner':'manager'===t?'Manager':'Staff',b=[{id:'bookings',label:'Take and change bookings'},{id:'walkins',label:'Seat walk-ins'},{id:'block',label:'Block bookings and close the garden'},{id:'tableplan',label:'Edit the table plan'},{id:'kitchen',label:'Kitchen tickets and allergy ticks'},{id:'menu',label:'Edit the menu and allergens'},{id:'rota',label:'Make the rota'},{id:'timesheets',label:'Approve timesheets'},{id:'pay',label:'See pay and wages'},{id:'takings',label:'See takings and reports'},{id:'staff',label:'Add staff and change access'},{id:'settings',label:'Change venue settings'},{id:'billing',label:'Plan and billing'}],p=e=>Object.fromEntries(b.map(t=>[t.id,e])),g=e=>({...p(!1),...Object.fromEntries(e.map(e=>[e,!0]))}),S={Owner:p(!0),Manager:{...p(!0),staff:!1,billing:!1},Supervisor:g(['bookings','walkins','block','tableplan','kitchen','rota']),'Head Chef':g(['kitchen','menu','rota']),Staff:g(['bookings','walkins'])},h=[{id:'pg-foh',name:'Front of house',pence:1271},{id:'pg-bar',name:'Bar team',pence:1271},{id:'pg-kp',name:'Kitchen porter',pence:1271},{id:'pg-cdp',name:'Chef de partie',pence:1450},{id:'pg-sup',name:'Supervisor',pence:1400}],k=()=>({done:{},grades:h.map(e=>({...e})),staffGrade:{},perms:JSON.parse(JSON.stringify(S)),email:'',website:'',bookingUrl:'',invites:{}}),O=(0,i.create)()((0,s.persist)((e,t)=>({sites:{},looks:{},patch:(t,n)=>e(e=>({sites:{...e.sites,[t]:{...e.sites[t]??k(),...n}}})),markDone:(e,n,r=!0)=>{const i={...(t().sites[e]??k()).done};r?i[n]=(new Date).toISOString():delete i[n],t().patch(e,{done:i})},setPerm:(e,n,r,i)=>{const s=t().sites[e]??k();'Owner'!==n&&t().patch(e,{perms:{...s.perms,[n]:{...s.perms[n],[r]:i}}})},resetPerms:e=>t().patch(e,{perms:JSON.parse(JSON.stringify(S))}),setLook:(t,n)=>e(e=>{const r={...e.looks};return null==n?delete r[t]:r[t]=n,{looks:r}})}),{name:'covercharge-setup-v1',storage:(0,s.createJSONStorage)(()=>r.default),version:1})),P=e=>{const n=O(t=>t.sites[e])??y,r=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return{...n,email:r??n.email}},y=k(),E=['anchorage'],w=e=>E.includes(e),v=e=>{const t=o.filter(t=>e.done[t.id]).length;return{done:t,total:o.length,pct:t/o.length}}},1096,[881,1160,995,1169]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1097,[571,1376,1378,1377]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1098,[2,824]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"uuid",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isUuid",{enumerable:!0,get:function(){return t}});const x=()=>globalThis.crypto&&'randomUUID'in globalThis.crypto?globalThis.crypto.randomUUID():'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,x=>{const t=16*Math.random()|0;return('x'===x?t:3&t|8).toString(16)}),t=x=>'string'==typeof x&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)},1099,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"fmtH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fmtHDay",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SHIFT_MIN_START",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MAX_END",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shiftTitle",{enumerable:!0,get:function(){return f}});var t=r(d[0]);const n=t=>{const n=(Math.round(60*t)%1440+1440)%1440;return`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`},u=t=>`${n(t)}${t>=24?' (next day)':''}`,o=7,c=28,f=(n,u)=>`${n.replace(' (example)','')} \xb7 ${(0,t.niceDate)((0,t.parseYmd)(u))}`},1100,[822]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return c}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(t,s,o){const c=t.find(n=>n.id===s);return t.filter(t=>(0,n.canSwapWith)(c,t,o))};var n=r(d[0]);const t=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],s=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],o=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],c='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1101,[1102]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"deptKey",{enumerable:!0,get:function(){return n}}),e.sameDept=function(t,a){const o=n(t?.dept),s=n(a?.dept);return!!o&&o===s},Object.defineProperty(e,"teamKey",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ANCHORAGE_VENUE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_SWAP_EDGES",{enumerable:!0,get:function(){return s}}),e.isAnchorageVenue=d,e.canSwapWith=function(t,n,o){if(!t||!n||!1===t.active||!1===n.active||'owner'===t.role||'owner'===n.role)return!1;const c=l(t),f=l(n);if(!c.length||!f.length||c.some(t=>f.includes(t)))return!1;if(d(o))return s.some(([t,n])=>c.includes(t)&&f.includes(n)||c.includes(n)&&f.includes(t));const b=a(t.dept),u=a(n.dept);return!!b&&b===u},Object.defineProperty(e,"SWAP_DEPT_NOTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"ANCHORAGE_SWAP_NOTE",{enumerable:!0,get:function(){return u}}),e.teamOnDay=function(a,o,s,c){const f=o.find(t=>t.id===c),d=new Map;for(const f of a){if(f.date!==s||!0!==f.published||f.staffId===c)continue;const a=o.find(t=>t.id===f.staffId);if(!a||!1===a.active)continue;const l=String(a.dept??'').trim()||'Department not set',b=n(a.dept)||p,u=d.get(b)??{dept:l,people:[]};u.people.push({id:a.id,name:g(a.name),job:String(a.job??'').trim(),start:f.start,end:f.end,times:`${(0,t.fmtH)(f.start)}\u2013${(0,t.fmtH)(f.end)}`}),d.set(b,u)}const l=n(f?.dept);return[...d.entries()].sort(([t],[n])=>t===l?-1:n===l||t===p?1:n===p?-1:t.localeCompare(n)).map(([,t])=>({...t,people:t.people.sort((t,n)=>t.start-n.start||t.name.localeCompare(n.name))}))},e.teamOnDaySpoken=function(n,a){return a.length?`${n}, also on. `+a.map(n=>`${n.dept}: `+n.people.map(n=>`${n.name}${n.job?`, ${n.job}`:''}, ${(0,t.fmtH)(n.start)} to ${(0,t.fmtH)(n.end)}`).join('; ')).join('. ')+'.':`${n}: nobody else is on the rota.`};var t=r(_d[0]);const n=t=>String(t??'').trim().toLowerCase().replace(/\s+/g,' ');const a=t=>{const a=n(t);return'bar'===a||'foh'===a?'front of house':a},o='6349aa07-3fec-46e9-8c69-7b1b08494793',s=[['st-finn','st-agate'],['st-finn','st-eilidh'],['st-agate','st-eilidh'],['st-gabrielle','st-emily'],['st-gabrielle','st-agate'],['st-emily','st-agate'],['st-gordon','st-lenny'],['st-gordon','st-bisto'],['st-mia','st-lillie']],c={'st-finn':'0db9c5d4-f989-4ce8-838a-54c7735f83f0','st-agate':'fce268d0-63ab-42cd-a298-68e3ec5bcae4','st-eilidh':'88f41ae2-dd2f-41c2-b75d-fa735a77e703','st-gabrielle':'71174004-40de-4477-a157-04858a009baa','st-emily':'6b6f09b4-a65e-4390-b86e-b8c57eabe178','st-gordon':'456e0738-dea5-47a8-813e-7b13a0e6c10e','st-lenny':'4dfc8938-7c90-4667-92d2-410807f791f8','st-bisto':'ea2e4b54-ce06-465a-b796-4fa7cde99004','st-mia':'260f4c7b-e78a-45ba-9f8e-f6e33921762b','st-lillie':'636735ff-0d19-4c47-9bfa-3e13c261acc2','st-jack':'ce6f4391-ec69-4782-aac6-8500eb899cc2','st-cameron':'683888b9-2b3d-4225-b028-12cf577decbb','st-harvey':'3ad10d28-78c0-457d-9238-f4a27fb30170','st-james':'6ffe4ae0-2bc1-4355-b3b5-f6e79884d0dc','st-tracy':'79fbfe9e-1d64-412c-a191-42e94b35c1c7'},f=Object.fromEntries(Object.entries(c).map(([t,n])=>[n,t]));function d(t){const n=String(t??'').trim().toLowerCase();return'anchorage'===n||n===o}function l(t){if(!t)return[];const n=[t.id,t.ref,t.externalRef].map(t=>String(t??'').trim().toLowerCase()).filter(Boolean),a=new Set(n);for(const t of n){const n=c[t]?t:f[t];n&&(a.add(n),a.add(c[n]))}return[...a]}const b='Swaps and cover stay in your department. Bar counts as front of house. A manager can still move a shift on the rota.',u='You can only swap with the people named for you. A manager can still move a shift on the rota.',p='\0unset',g=t=>t.replace(/\s*\(example\)$/,'').trim()},1102,[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,"daysBetween",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rangeLabel",{enumerable:!0,get:function(){return h}}),_e.TimeOffSheet=b,_e.RequestTimeOff=function({meId:e,me:s,testID:l="request-time-off"}){const[d,f]=(0,t.useState)(!1),m=(0,o.ymd)(new Date),u=(0,r.useOwner)(e=>e.leave).filter(t=>t.staffId===e&&t.to>=m).sort((e,t)=>e.from.localeCompare(t.from));return(0,i.jsxs)(n.Card,{children:[(0,i.jsxs)(a.default,{testID:l,style:{gap:8,alignItems:'stretch'},children:[(0,i.jsx)(n.Button,{label:"Request time off",sub:"Holiday, appointments, days you can\u2019t work",testID:`${l}-open`,onPress:()=>f(!0)}),u.map(e=>(0,i.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:8,children:[(0,i.jsxs)(n.T,{size:14,style:{flex:1},children:[h(e.from,e.to)," \xb7 ",e.reason]}),(0,i.jsx)(n.Badge,{kind:'approved'===e.status?'ok':'declined'===e.status?'red':'amber',label:y(e.status)})]},e.id))]}),(0,i.jsx)(b,{visible:d,onClose:()=>f(!1),meId:e,me:s})]})};var t=_r(_d[0]),s=e(_r(_d[1])),a=e(_r(_d[2])),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),i=_r(_d[7]);const d=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['January','February','March','April','May','June','July','August','September','October','November','December'],m=['Holiday','Appointment','Family','Other'],u=e=>(e??'').replace(' (example)',''),c=(e,t)=>Math.round(((0,o.parseYmd)(t).getTime()-(0,o.parseYmd)(e).getTime())/864e5)+1,h=(e,t)=>e===t?(0,o.niceDateYear)((0,o.parseYmd)(e)):`${(0,o.niceDateYear)((0,o.parseYmd)(e))} to ${(0,o.niceDateYear)((0,o.parseYmd)(t))}`,y=e=>'approved'===e?'Approved':'declined'===e?'Declined':'Waiting for a manager';function p({from:e,to:r,onChange:m,today:u}){const c=(0,o.parseYmd)(e||u),[h,y]=(0,t.useState)({y:c.getFullYear(),m:c.getMonth()}),p=(new Date(h.y,h.m,1).getDay()+6)%7,b=new Date(h.y,h.m+1,0).getDate(),x=[...Array(p).fill(null),...Array.from({length:b},(e,t)=>(0,o.ymd)(new Date(h.y,h.m,t+1)))],j=(0,o.parseYmd)(u),w=h.y>j.getFullYear()||h.y===j.getFullYear()&&h.m>j.getMonth(),D=e=>y(({y:t,m:s})=>{const a=new Date(t,s+e,1);return{y:a.getFullYear(),m:a.getMonth()}}),I=t=>{!e||e&&r||tD(-1)}),(0,i.jsxs)(n.T,{weight:"semibold",testID:"time-off-month",children:[f[h.m]," ",h.y]}),(0,i.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u203a",accessibilityLabel:"Next month",testID:"time-off-next-month",onPress:()=>D(1)})]}),(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:d.map(e=>(0,i.jsx)(a.default,{style:{flex:1,alignItems:'center'},children:(0,i.jsx)(n.Muted,{children:e})},e))}),Array.from({length:Math.ceil(x.length/7)},(t,d)=>(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:Array.from({length:7},(t,f)=>{const m=x[7*d+f];if(!m)return(0,i.jsx)(a.default,{style:{flex:1,height:40}},f);const c=me&&mI(m),style:{flex:1,height:40,margin:1,borderRadius:8,alignItems:'center',justifyContent:'center',backgroundColor:h?l.colours.gold:y?'#3a3020':'transparent',opacity:c?.35:1},children:(0,i.jsx)(n.T,{size:14,weight:h?'semibold':'regular',colour:h?'#1a1407':l.colours.text,children:Number(m.slice(8))})},f)})},d))]})}function b({visible:e,onClose:s,meId:l,me:d,manager:f}){const y=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),b=(0,o.ymd)(new Date),[x,j]=(0,t.useState)(f?'':l),[w,D]=(0,t.useState)(''),[I,v]=(0,t.useState)(''),[S,Y]=(0,t.useState)('Holiday'),[C,T]=(0,t.useState)(null),M=I||w,A=!!x&&!!w&&M>=w,P=()=>{T(null),s()};return(0,i.jsx)(n.Sheet,{visible:e,onClose:P,title:f?'Add time off':'Request time off',testID:"time-off-sheet",children:C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Banner,{kind:"success",title:C}),(0,i.jsx)(n.Button,{label:"Done",testID:"time-off-done",onPress:P})]}):(0,i.jsxs)(i.Fragment,{children:[f?(0,i.jsxs)(a.default,{style:{gap:6},children:[(0,i.jsx)(n.T,{weight:"semibold",children:"Who\u2019s off?"}),(0,i.jsx)(n.Row,{wrap:!0,gap:6,children:y.filter(e=>'owner'!==e.role).map(e=>(0,i.jsx)(n.Chip,{testID:`time-off-who-${e.id}`,label:u(e.name),selected:x===e.id,onPress:()=>j(e.id)},e.id))})]}):null,(0,i.jsx)(n.Muted,{center:!0,children:w?I?'Tap a day to start again.':'Now tap your last day off (or tap Send for just that day).':'Tap your first day off.'}),(0,i.jsx)(p,{from:w,to:I,today:b,onChange:(e,t)=>{D(e),v(t)}}),w?(0,i.jsxs)(n.T,{center:!0,weight:"semibold",testID:"time-off-summary",children:[h(w,M)," \xb7 ",c(w,M)," ",1===c(w,M)?'day':'days']}):null,(0,i.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:m.map(e=>(0,i.jsx)(n.Chip,{label:e,selected:S===e,onPress:()=>Y(e)},e))}),(0,i.jsx)(n.Button,{label:f?'Add time off':'Send request',testID:"time-off-send",disabled:!A,onPress:()=>{const e=r.useOwner.getState().addLeave({staffId:x,from:w,to:M,reason:S,by:u(d),...f?{status:'approved',decidedBy:u(d)}:{}}),t=u(y.find(e=>e.id===x)?.name);T(f?`${t} is off ${h(e.from,e.to)}. It shows on the rota now.`:`Sent: ${h(e.from,e.to)}. A manager will approve it, and you\u2019ll see it here.`),D(''),v('')}}),(0,i.jsx)(n.Muted,{center:!0,children:f?'Approved straight away. The rota shows them off and Copy last week won\u2019t give them shifts on those days.':'Your manager sees it in Rota \u203a Swaps & time off and approves it. Nothing is sent by text or email.'})]})})}},1103,[31,264,128,818,863,822,825,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},1147,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.fromDisplayFlag=y,_e.displayUrlFrom=m,_e.openedFromDisplay=function(){return b},_e.BackToDisplayButton=I,_e.BackToDisplay=function(){const e=(0,p.useSession)(e=>e.meId),[n,s]=(0,t.useState)(!1),c=(0,t.useRef)(Date.now());return(0,t.useEffect)(()=>{if(!b||!(0,f.isKitchenViaDisplay)()||'undefined'==typeof window)return;const e=()=>{c.current=Date.now()};for(const t of['pointerdown','keydown','touchstart'])window.addEventListener(t,e,!0);const t=window.setInterval(()=>{Date.now()-c.current>D&&!n&&(s(!0),v())},5e3);return()=>{for(const t of['pointerdown','keydown','touchstart'])window.removeEventListener(t,e,!0);window.clearInterval(t)}},[n]),b?e?null:(0,h.jsx)(o.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,top:12,alignItems:'center',zIndex:9999},children:(0,h.jsx)(I,{})}):null};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),c=r(d[5]),l=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),h=r(d[10]);const w='cc-from-display';function y(e,t){try{const n=new URL(e),o=new URLSearchParams(n.hash.replace(/^#/,''));return'display'===n.searchParams.get('from')||'display'===o.get('from')||'1'===t}catch{return'1'===t}}function m(e){const t=new URL(e),n=t.pathname.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/);return`${t.origin}${n?n[1]:'/'}display-app/index.html`}const b=(()=>{if('undefined'==typeof window||'chef'!==s.APP_VARIANT)return!1;let e=null;try{e=window.sessionStorage.getItem(w)}catch{}const t=y(window.location.href,e);if(t)try{window.sessionStorage.setItem(w,'1')}catch{}return t})(),D=12e4;async function v(){if((0,f.isKitchenViaDisplay)()){try{await(0,u.endDisplayKitchen)()}catch{}try{p.useSession.getState().signOut()}catch{}(0,f.markKitchenViaDisplay)(!1)}try{window.sessionStorage.removeItem(w)}catch{}window.location.assign(m(window.location.href))}function I({compact:e}={}){const[o,s]=(0,t.useState)(!1);if(!b)return null;const u=e?48:56;return(0,h.jsx)(n.default,{testID:"back-to-display",accessibilityRole:"button",accessibilityLabel:"Back to Display",accessibilityHint:"Leaves the Head Chef app and opens the Display again",onPress:()=>{s(!0),v()},style:({pressed:t})=>({minHeight:u,minWidth:e?180:220,paddingHorizontal:e?16:22,borderRadius:u/2,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:t?c.colours.goldLight:c.colours.gold,borderWidth:2,borderColor:c.colours.bg}),children:(0,h.jsx)(l.T,{size:e?15:18,weight:"bold",colour:c.colours.bg,center:!0,children:o?'Opening the Display\u2026':'Back to Display'})})}},1148,[31,123,264,128,807,825,818,824,979,866,25]); +__d(function(g,r,_i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return l}}),_e.quietly=async function(e){u++;try{await e()}finally{u--;for(const e of p)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return w}}),_e.venueChannel=function(e,t,n,s){let i=o().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:o}of t)i=i.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${o??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return i.subscribe(e=>s(e)),i},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return n.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]),i=r(d[4]);const o=()=>(0,t.getSupabase)(),h=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(h).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${h(t[e])}`).join(',')}}`},c=e=>{const t=h(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},l=5;let u=0;const p=new Set;const f=()=>u>0;class w{known={};last=new Map;lastRev=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}unsubDone=null;async start(){this.known=await s.kv.get(this.kvKey,{}),this.snapshotLocal(),p.add(this),this.spec.writeBeforeRead&&this.pushUrgent(),this.unsub=this.spec.subscribe(()=>{u>0?this.snapshotLocal():this.applying||!this.reconciled&&!this.spec.writeBeforeRead||this.pushLocalChanges()}),this.unsubDone=i.mutationQueue.onDone(e=>{if(e.table!==this.spec.table||e.venueId!==this.venueId)return;const t=this.spec.list().find(t=>this.spec.key(t)===e.rowKey);t&&(this.known[this.spec.key(t)]=this.kh(t),this.saveKnown())})}pushUrgent(){const e=this.spec;if(e.writable())for(const t of e.list()){const n=e.key(t);!e.syncable(t)||e.urgent&&!e.urgent(t)||this.pending(n)||this.known[n]===this.kh(t)||this.write(t)}}unsavedKeys(){const e=this.spec;return e.list().filter(t=>e.syncable(t)&&(!e.inWindow||e.inWindow(t))&&this.known[e.key(t)]!==this.kh(t)&&!this.pending(e.key(t))).map(t=>e.key(t))}resendUnsaved(e=()=>!1){const t=this.spec;if(!t.writable())return 0;const n=new Set(this.unsavedKeys().filter(t=>!e(t)));let s=0;for(const e of t.list())n.has(t.key(e))&&(this.write(e),s++);return s}stop(){this.unsub?.(),this.unsub=null,this.unsubDone?.(),this.unsubDone=null,p.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}rev(e){return this.spec.revision?this.spec.revision(e):c(e)}kh(e){return this.spec.knownByRevision?this.rev(e):c(e)}snapshotLocal(){const e=this.spec.list();this.last=new Map(e.map(e=>[this.spec.key(e),c(e)])),this.lastRev=new Map(e.map(e=>[this.spec.key(e),this.rev(e)]))}saveKnown(){s.kv.set(this.kvKey,this.known)}pending(e){return i.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){const t=()=>{let e=o().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);return this.spec.filter&&(e=this.spec.filter(e)),e},n=['bookings','walk_ins','temp_readings','temp_units'].includes(this.spec.table)?await(0,e.readPages)(async(e,n)=>{const{data:s,error:i}=await t().order('id').range(e,n);if(i)throw i;return s??[]}):await(async()=>{const{data:e,error:n}=await t().limit(2e3);if(n)throw n;return e??[]})();this.merge(n,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(n)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],h=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),h=n.fromRow(t);if(!h)continue;i.add(e),p.push(h);const l=c(h),f=this.kh(h),w=s.get(e);if(!this.pending(e)){if(w){const t=this.kh(w);if(this.rev(w)===this.rev(h)){this.known[e]=f,c(w)!==l&&o.push(h);continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(w)){u.push(w);continue}}o.push(h),this.known[e]=f}}const f=n.authoritative?.(e)??null,w=[];for(const[e,t]of s)i.has(e)||this.pending(e)||(!f||!f(t)||n.writable()&&n.syncable(t)||n.inWindow&&!n.inWindow(t)?n.syncable(t)&&(n.inWindow&&!n.inWindow(t)||(this.known[e]?h.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t))):w.push(e));!e.length&&n.keepOnEmpty?.()&&(h.length=0,w.length=0);const v=this.massOk;if(this.massOk=!1,h.length>l&&!v)this.ev.onSuspect?.(n.name,`read would remove ${h.length} of ${s.size}`),h.length=0,u.length=0;else for(const e of h)delete this.known[e];for(const e of w)delete this.known[e],h.push(e);this.applyRemote(o,h);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=c(i);this.known[s]=this.kh(i),this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=c(s),i=this.rev(s);if(this.last.get(n)===t)continue;const o=this.lastRev.get(n);this.last.set(n,t),this.lastRev.set(n,i),void 0!==o&&o===i||(e.syncable(s)&&e.writable()&&this.known[n]!==this.kh(s)&&(!this.pending(n)||e.writeBeforeRead)?this.write(s):e.syncable(s)&&!e.writable()&&this.known[n]!==this.kh(s)&&this.ev.onSkipped?.(e.name,n))}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e),this.lastRev.delete(e);const s=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&s.length>l)return this.ev.onSuspect?.(e.name,`${s.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of s)delete this.known[t],i.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let s;try{s=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if('update'===t.mode){const e=t.venueColumn??'venue_id';i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:s,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:s,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1149,[1249,872,1246,1234,1076]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"SEED_CARD_COSTS",{enumerable:!0,get:function(){return A}}),_e.stripGpSamples=b,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return P}}),_e.useGpCalcView=function(){const e=P();return(0,i.useMemo)(()=>t.LIVE_VENUE_BUILD?{...e,...b(e)}:e,[e])},Object.defineProperty(_e,"GP_TABLES",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"GP_EPOCH",{enumerable:!0,get:function(){return E}}),_e.gpSyncItems=D,_e.gpSyncFromRow=L,_e.mergeGpItems=N,_e.gpSyncSpec=function(e,t){const i=C[e];return{name:i,table:i,deletes:!1,list:()=>D(P.getState(),e),key:e=>e.id,rowKey:t=>String('ing'===e?t.local_id:t.id),syncable:t=>'ing'===e?t.id.length>0&&t.id.length<=80:(0,u.isUuid)(t.id),writable:t,toRow:(t,i)=>({id:'ing'===e?(0,u.isUuid)(t.id)?t.id:(0,p.uuidFrom)(`gi:${i}:${t.id}`):t.id,venue_id:i,...'ing'===e?{local_id:t.id,name:String(t.doc?.name??'').slice(0,120)}:{},doc:_(t),updated_at:t.updatedAt,deleted_at:t.deletedAt??null}),fromRow:t=>L(e,t),apply:(t,i)=>P.setState(n=>N(n,e,t,i)),subscribe:t=>P.subscribe((i,n)=>{i.gone===n.gone&&('ing'===e?i.ingredients===n.ingredients:i[w[e]]===n[w[e]])||t()})}};var e,t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),d=(e=r)&&e.__esModule?e:{default:e},a=_r(_d[5]),c=_r(_d[6]),o=_r(_d[7]),p=_r(_d[8]),u=_r(_d[9]),l=_r(_d[10]),f=_r(_d[11]);let h=0;const m=e=>`${e}-${Date.now().toString(36)}${(h++).toString(36)}`,S=(e,t,i,n,s,r=0,d=[])=>({id:e,name:t,packSize:i,packUnit:n,packPrice:s,wastePct:r,allergens:d}),k=e=>new Date(Date.now()-864e5*e).toISOString(),y={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},v=[S('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),S('gi-potato','Potatoes (chipping)',25,'kg',1600,20),S('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),S('gi-oil','Rapeseed oil',20,'L',3200),S('gi-peas','Garden peas (frozen)',2.5,'kg',450),S('gi-lemon','Lemons',80,'each',1600),S('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),S('gi-capers','Capers',1,'kg',900,0,['sulphites']),S('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),S('gi-steak','Braising steak',5,'kg',6e3,10),S('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),S('gi-onion','Onions',10,'kg',1e3,10),S('gi-stock','Beef stock',1,'L',350,0,['celery']),S('gi-chicken','Chicken breast',5,'kg',4750),S('gi-leaves','Cos lettuce',12,'each',960,15),S('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),S('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),S('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),S('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),S('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),S('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs']),{...S('gi-haddock-stone','Haddock (by the stone)',1,'stone',11e3,0,['fish']),servings:30,servingName:'serving',supplier:'Local fish merchant',updatedAt:'2026-11-02T09:00:00.000Z'},{...S('gi-chicken-case','Chicken breast (5 kg case)',5,'kg',4e3),servings:25,servingName:'breast',supplier:'Butcher',updatedAt:'2026-11-02T09:00:00.000Z'}].map(e=>({...e,prices:(y[e.id]??[e.packPrice]).map((e,t,i)=>({p:e,at:k(7*(i.length-t))}))})),I=(e,t,i,n,s,r,d,a="")=>({id:e,name:t,category:i,lines:n.map(([e,t,i])=>({ingId:e,qty:t,unit:i})),portions:s,target:70,menuPrice:r,status:d,description:a,allergens:[]}),O=[I('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),I('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),I('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),I('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),I('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),I('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')],A={[(0,p.uuidFrom)('card:anchorage:a-fishsupper')]:{portions:1,lines:[{ingId:'gi-haddock-stone',qty:1,unit:'serving',recipeIngId:'a-fishsupper-i0'},{ingId:'gi-batter',qty:80,unit:'g',recipeIngId:'a-fishsupper-i1'},{ingId:'gi-potato',qty:250,unit:'g',recipeIngId:'a-fishsupper-i3'},{ingId:'gi-peas',qty:80,unit:'g',recipeIngId:'a-fishsupper-i4'},{ingId:'gi-mayo',qty:40,unit:'ml',recipeIngId:'a-fishsupper-i6'},{ingId:'gi-lemon',qty:.25,unit:'each',recipeIngId:'a-fishsupper-i7'}]}};function b(e){const t=e=>O.some(t=>t.id===e.id&&JSON.stringify(t)===JSON.stringify(e))||/\(example\)/i.test(e.name),i=new Set(e.dishes.filter(e=>!t(e)).map(e=>e.id));let n=!0;for(;n;){n=!1;for(const t of e.dishes.filter(e=>i.has(e.id)))for(const e of t.lines)e.ingId.startsWith('dish:')&&!i.has(e.ingId.slice(5))&&(i.add(e.ingId.slice(5)),n=!0)}const s=e.dishes.filter(e=>i.has(e.id)),r=new Set(s.flatMap(e=>e.lines.map(e=>e.ingId))),d=e=>{const t=v.find(t=>t.id===e.id);if(!t)return!1;const i=({prices:e,...t})=>JSON.stringify(t);return i(t)===i(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(t.prices?.map(e=>e.p)))},a=Object.fromEntries(Object.entries(e.cardCosts??{}).filter(([e,t])=>!(A[e]&&JSON.stringify(A[e])===JSON.stringify(t))));return Object.values(a).forEach(e=>e.lines.forEach(e=>r.add(e.ingId))),{dishes:s,ingredients:e.ingredients.filter(e=>r.has(e.id)||!d(e)),cardCosts:a}}const P=(0,a.create)()((0,c.persist)((e,i)=>({ingredients:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:v,dishes:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:O,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],cardCosts:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:A,gone:{},saveCardCost:(t,i)=>e(e=>{const n={...e.gone};return delete n[`card:${t}`],{cardCosts:{...e.cardCosts,[t]:{...i,updatedAt:(new Date).toISOString()}},gone:n}}),removeCardCost:t=>e(e=>{if(!e.cardCosts[t])return{};const{[t]:i,...n}=e.cardCosts;return{cardCosts:n,gone:{...e.gone,[`card:${t}`]:(new Date).toISOString()}}}),removeIngredient:t=>e(e=>({ingredients:e.ingredients.filter(e=>e.id!==t),gone:{...e.gone,[`ing:${t}`]:(new Date).toISOString()}})),saveIngredient:t=>{const n=i(),s=n.ingredients.find(e=>e.id===t.id),r=n.ingredients.map(e=>e.id===t.id?t:e);let d=n.alerts;if(s&&(s.packPrice!==t.packPrice||s.packSize!==t.packSize||s.wastePct!==t.wastePct)){const e=n.settings.vatPct,i=n.dishes.filter(e=>e.menuPrice).map(t=>{const i=(0,o.gpOf)((0,o.portionCost)(t,n.ingredients,n.dishes),t.menuPrice,e).gpPct,s=(0,o.gpOf)((0,o.portionCost)(t,r,n.dishes),t.menuPrice,e).gpPct;return{id:t.id,name:t.name,before:i,after:s,belowTarget:se.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),c=(a(t)-a(s))/a(s)*100;i.length&&(d=[{id:m('ma'),at:(new Date).toISOString(),ingredient:t.name,change:`${c>=0?'+':''}${c.toFixed(0)}%`,dishes:i},...d].slice(0,20))}const a=s&&JSON.stringify({...s,updatedAt:void 0})!==JSON.stringify({...t,updatedAt:void 0});e({ingredients:a?r.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):r,alerts:d})},addPricePaid:(e,t,n)=>{const s=i(),r=s.ingredients.find(t=>t.id===e);if(!(r&&t>0))return;const d=[...r.prices?.length?r.prices:[{p:r.packPrice,at:''}],{p:Math.round(t),at:n??(new Date).toISOString()}].slice(-20),a={...r,prices:d};i().saveIngredient({...a,packPrice:(0,o.costingPrice)(a,s.settings.priceBasis,s.settings.avgOf??5)})},addIngredient:t=>{const i=m('gi');return e(e=>({ingredients:[...e.ingredients,{updatedAt:(new Date).toISOString(),...t,id:i}]})),i},saveDish:t=>e(e=>({dishes:e.dishes.some(e=>e.id===t.id)?e.dishes.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):[{...t,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:t=>e(e=>({dishes:e.dishes.filter(e=>e.id!==t)})),setSettings:t=>{const n={...i().settings,...t};if(e({settings:n}),void 0!==t.priceBasis||void 0!==t.avgOf)for(const e of i().ingredients){const t=(0,o.costingPrice)(e,n.priceBasis,n.avgOf??5);t!==e.packPrice&&i().saveIngredient({...e,packPrice:t})}},dismissAlert:t=>e(e=>({alerts:e.alerts.filter(e=>e.id!==t)})),deliveries:{},counts:{},saveDelivery:(t,n)=>{const s=i(),r=(new Date).toISOString(),d=s.deliveries[t.id],a=n?(0,f.gpImpact)(s.ingredients,s.cardCosts??{},n,s.settings,t,d).snap:t.gp??d?.gp,{ingredients:c,lines:o}=(0,l.applyDelivery)(s.ingredients,t,s.settings,()=>m('gi'),r,d),p={...t,lines:o,updatedAt:r,...a?{gp:{...a,at:r}}:{}},u={...s.gone};return delete u[`del:${t.id}`],e({ingredients:c,deliveries:{...s.deliveries,[t.id]:p},gone:u}),p},removeDelivery:t=>e(e=>{if(!e.deliveries[t])return{};const{[t]:i,...n}=e.deliveries;return{deliveries:n,ingredients:(0,l.removeDeliveryPrices)(e.ingredients,t,e.settings,void 0,e.deliveries[t]),gone:{...e.gone,[`del:${t}`]:(new Date).toISOString()}}}),saveCount:t=>e(e=>{const i={...e.gone};return delete i[`count:${t.id}`],{counts:{...e.counts,[t.id]:{...t,updatedAt:(new Date).toISOString()}},gone:i}}),removeCount:t=>e(e=>{if(!e.counts[t])return{};const{[t]:i,...n}=e.counts;return{counts:n,gone:{...e.gone,[`count:${t}`]:(new Date).toISOString()}}})}),{name:'covercharge-gpcalc-v1',storage:(0,c.createJSONStorage)(()=>d.default),version:4,migrate:async(e,i)=>(t.LIVE_VENUE_BUILD&&e&&(await(0,n.archiveChefCache)('gpcalc',e),e={...e,...b({...e,dishes:e.dishes||[],ingredients:e.ingredients||[],cardCosts:e.cardCosts||{}})}),i<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e&&!e.cardCosts&&(e.cardCosts={}),e&&!e.gone&&(e.gone={}),e&&!e.deliveries&&(e.deliveries={}),e&&!e.counts&&(e.counts={}),e)}));'undefined'!=typeof window&&'undefined'!=typeof document&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,s.venueKey)('covercharge-gpcalc-v1')&&P.persist.rehydrate()});const w={card:'cardCosts',del:'deliveries',count:'counts'},C={ing:'ingredient_prices',card:'card_costs',del:'kitchen_deliveries',count:'kitchen_stock_counts'},E='1970-01-01T00:00:00.000Z',_=e=>JSON.parse(JSON.stringify(e));function D(e,t){const i=b(e),n='ing'===t?i.ingredients.map(e=>({id:e.id,updatedAt:e.updatedAt??E,doc:_({...e,updatedAt:e.updatedAt??E})})):Object.entries('card'===t?i.cardCosts:e[w[t]]??{}).map(([e,t])=>({id:e,updatedAt:t.updatedAt??E,doc:_({...t,updatedAt:t.updatedAt??E})})),s=new Set(n.map(e=>e.id)),r=Object.entries(e.gone??{}).filter(([e])=>e.startsWith(`${t}:`)).map(([e,i])=>({id:e.slice(t.length+1),updatedAt:i,deletedAt:i})).filter(e=>!s.has(e.id));return[...n,...r]}function L(e,t){const i=t?.doc,n=String('ing'===e?t?.local_id??'':t?.id??'');if(!i||'object'!=typeof i||i.id!==n||'string'!=typeof i.updatedAt||!n)return null;if(i.deletedAt)return'string'==typeof i.deletedAt?{id:n,updatedAt:i.updatedAt,deletedAt:i.deletedAt}:null;const s=i.doc;return s&&'object'==typeof s&&('ing'!==e||'string'==typeof s.name&&s.id===n&&Number(s.packSize)>0&&'string'==typeof s.packUnit&&Number.isFinite(Number(s.packPrice)))&&('ing'===e||Array.isArray(s.lines))&&('del'!==e&&'count'!==e||'string'==typeof s.date&&s.id===n)?{id:n,updatedAt:i.updatedAt,doc:i.doc}:null}function N(e,t,i,n){const s={...e.gone??{}},r=new Map('ing'===t?e.ingredients.map(e=>[e.id,e]):Object.entries(e[w[t]]??{})),d=[];for(const e of i){const i=`${t}:${e.id}`,n=r.get(e.id),a=n?n.updatedAt??E:void 0,c=s[i];if(e.deletedAt){if(n&&a>e.deletedAt)continue;r.delete(e.id),(!c||ce.updatedAt)continue;if(n&&a>e.updatedAt)continue;const o='ing'===t?{...e.doc,id:e.id,updatedAt:e.updatedAt}:{...e.doc,updatedAt:e.updatedAt};n?r.set(e.id,o):d.push([e.id,o]),delete s[i]}for(const e of n)r.delete(e),delete s[`${t}:${e}`];if('ing'===t){return{ingredients:[...r.values(),...d.map(([,e])=>e)],gone:s}}return{[w[t]]:Object.fromEntries([...r.entries(),...d]),gone:s}}},1150,[842,31,1159,5,1160,995,1169,1237,1178,1099,1238,1239]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCardStore",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"photoStorageFull",{enumerable:!0,get:function(){return C}}),_e.setStoragePhotoResolver=function(e){V=e},_e.cachePhotoAs=function(e,t){if(E.getState().photos[e]===t)return;E.setState(r=>({photos:{...r.photos,[e]:t}}))},Object.defineProperty(_e,"readLocalPhoto",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"localRecipeCards",{enumerable:!0,get:function(){return M}}),_e.ensureCards=F;var e,t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),s=_r(d[3]),a=_r(d[4]),o=_r(d[5]),c=(e=o)&&e.__esModule?e:{default:e};_r(d[6]);var u=_r(d[7]),l=_r(d[8]),f=_r(d[9]),m=_r(d[10]),h=_r(d[11]),p=_r(d[12]),S=_r(d[13]);const I='covercharge-recipecards-v1',y='covercharge-recipephotos-v1',O=()=>{try{return(0,S.nowFrom)(S.useStore.getState().clock)}catch{return new Date}},w=(0,u.create)()((0,l.persist)(()=>({cards:[],removed:[],log:[]}),{name:I,storage:(0,l.createJSONStorage)(()=>c.default),version:3,migrate:async e=>{const n=e;return t.LIVE_VENUE_BUILD?(await(0,r.archiveChefCache)('recipe-cards',n),{...n,cards:n.cards.filter(e=>!(0,s.isDemoCard)(e)),log:n.log.filter(e=>!(0,s.demoActor)(e.by))}):n}}));let b=!1;const v={getItem:e=>c.default.getItem(e),setItem:async(e,t)=>{try{await c.default.setItem(e,t),b=!1}catch{b=!0}},removeItem:e=>c.default.removeItem(e)},C=()=>b,E=(0,u.create)()((0,l.persist)(()=>({photos:{}}),{name:y,storage:(0,l.createJSONStorage)(()=>v),version:1})),_={lobster:_r(d[14]),skink:_r(d[15]),fishsupper:_r(d[16]),moules:_r(d[17]),stp:_r(d[18])};let A=0;const B=(e,t,r,n=t)=>{const s={id:`cl-${Date.now().toString(36)}${(A++).toString(36)}`,cardId:e.id,rid:e.restaurantId,at:O().toISOString(),by:t,text:n===t?r:`${r} (${n})`};w.setState(e=>({log:[s,...e.log].slice(0,300)}));try{S.useStore.getState().addAudit(e.restaurantId,'menu',`Recipe card: ${e.dish}: ${r} (${n})`)}catch{}},L=e=>w.setState(t=>({cards:t.cards.some(t=>t.id===e.id)?t.cards.map(t=>t.id===e.id?e:t):[...t.cards,e]}));let P=null,D=null;function U(){const e=w.getState().cards,r=t.LIVE_VENUE_BUILD?e.filter(e=>!(0,s.isDemoCard)(e)).map(e=>({...e,signOff:(0,s.demoActor)(e.signOff?.by)?null:e.signOff,allergensConfirmed:(0,s.demoActor)(e.allergensConfirmed?.by)?void 0:e.allergensConfirmed})):e;if(!D||P!==e){P=e;const t=new Map,n=new Map;for(const e of r)t.set(e.restaurantId,[...t.get(e.restaurantId)??[],e]),n.set(e.menuItemId,e);D={cards:r,byRid:t,byItem:n}}return D}const N=[];function R(e){if(!(0,f.canEditCards)(e.role))throw new Error('Only the head chef and managers can edit recipe cards.')}let V=null;const $=e=>E.getState().photos[e],M={mode:'local',list:e=>U().byRid.get(e)??N,get:e=>U().cards.find(t=>t.id===e),byMenuItem:e=>U().byItem.get(e),subscribe:e=>{const t=w.subscribe(e),r=E.subscribe(e);return()=>{t(),r()}},async create(e,t,r){R(r);const n=O().toISOString();k=!0;let s=t.menuItemId;try{s||(s=S.useStore.getState().addMenuItem({restaurantId:e,section:t.section,name:t.dish,description:t.description??'',price:t.price,dietary:[],allergens:t.allergens??{},prepMins:12,soldOut:!1,signOff:null}));const a=(0,f.cardPhotos)(t),o=t.createdBy?.trim()||r.name,c={id:t.id??(0,f.uuid)(),restaurantId:e,menuItemId:s,dish:t.dish,section:t.section,price:t.price,photo:a[0],photos:a,createdBy:o,createdByRole:t.createdByRole??(o===r.name?r.role:void 0),ingredients:t.ingredients??[],steps:t.steps??[],allergens:t.allergens??{},dismissed:t.dismissed??[],allergenNotes:t.allergenNotes,signOff:null,wasLive:!1,origin:'new',version:1,createdAt:n,updatedAt:n,updatedBy:r.name};return w.setState(e=>({cards:[...e.cards.filter(e=>e.menuItemId!==c.menuItemId),c]})),B(c,r.name,'card created, awaiting sign-off'),c}finally{k=!1}},async update(e,t,r){R(r);const n=M.get(e);if(!n)throw new Error('Card not found');const s=(0,f.editCard)(n,t,r.name,O().toISOString());return s.changed&&(L(s.card),B(s.card,r.name,s.resetSignOff?'edited, sign-off reset to Awaiting sign-off':t.confirmAllergens&&1===Object.keys(t).length?'allergens confirmed':'edited')),s.card},async signOff(e,t){const r=M.get(e);if(!r)throw new Error('Card not found');if(!(0,f.maySignOff)(t,r))throw new Error('Only the Head Chef, an owner or a manager can sign it off.');const n=(0,f.signOffBlock)(r);if(n)throw new Error(n);const s=(0,f.signOffCard)(r,t.name,O().toISOString());return L(s),B(s,t.name,'signed off',(0,f.signerLabel)(t)),s},async remove(e,t){R(t);const r=M.get(e);r&&(w.setState(t=>({cards:t.cards.filter(t=>t.id!==e),removed:[...t.removed,r.menuItemId]})),S.useStore.setState(e=>({menu:e.menu.map(e=>e.id===r.menuItemId?{...e,hidden:!0}:e)})),B(r,t.name,'card removed (dish hidden from the menu)'))},async savePhoto(e,t,r){const n=`local:${t}:${Date.now().toString(36)}`;return E.setState(e=>({photos:{...e.photos,[n]:r.dataUrl}})),n},photoSource(e){if(!e)return null;if(e.startsWith('asset:'))return _[e.slice(6)]??null;if(e.startsWith('local:')){const t=E.getState().photos[e];return t?{uri:t}:null}if(/^(https?:|data:)/.test(e))return{uri:e};const t=E.getState().photos[e];if(t)return{uri:t};const r=V?.(e);return r?{uri:r}:null}};let k=!1,j=!1;function F(){if(k)return;const e=S.useStore.getState().menu,{cards:r,removed:o}=w.getState(),c=new Set(r.map(e=>e.menuItemId)),u=e.filter(e=>!c.has(e.id)&&!o.includes(e.id)),l=O().toISOString();if(r.some(e=>(0,s.isPlaceholderCard)(e))&&w.setState(e=>({cards:e.cards.filter(e=>!(0,s.isPlaceholderCard)(e))})),!u.length)return;const f=a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD||!(0,n.examplesAllowed)()?[]:(0,p.exampleCards)(u),m=new Set(f.map(e=>e.menuItemId)),h=[...f,...u.filter(e=>!m.has(e.id)).map(e=>(0,p.importedCard)(t.LIVE_VENUE_BUILD&&(0,s.demoActor)(e.signOff?.by)?{...e,signOff:null}:e,l))];w.setState(e=>({cards:[...e.cards,...h]}))}(0,h.setMenuCardBridge)({cardFor:e=>U().byItem.get(e),menuItemAdded:e=>{if(k||!j)return;const t=O().toISOString(),r={...(0,p.importedCard)(e,t),id:(0,f.uuid)(),signOff:null,allergensConfirmed:void 0,wasLive:!1,origin:'new',updatedBy:'Added to the menu'};L(r),B(r,r.updatedBy,'card created from the menu, awaiting sign-off')},menuEdited:(e,t,r,n)=>{const s=U().byItem.get(e);if(!s)return;let a=(0,f.editCard)(s,t,r,O().toISOString()).card;n&&a.signOff&&(a={...a,signOff:null,version:a.version+1,updatedAt:O().toISOString(),updatedBy:r}),a!==s&&(L(a),B(a,r,s.signOff&&!a.signOff?'edited from the menu, sign-off reset':'edited from the menu'))},signOff:(e,t)=>{const r=U().byItem.get(e);r&&M.signOff(r.id,{name:t,role:'head-chef'}).catch(()=>{})}}),(0,m.setRecipeCardRepository)(M);const x=e=>new Promise(t=>{e.hasHydrated()?t():e.onFinishHydration(()=>t())});Promise.all([x(S.useStore.persist),x(w.persist)]).then(()=>{j=!0,F(),S.useStore.subscribe((e,t)=>{e.menu!==t.menu&&F()})}),'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===(0,a.venueKey)(I)&&w.persist.rehydrate(),e.key===(0,a.venueKey)(y)&&E.persist.rehydrate()})},1151,[842,1159,1183,1085,5,1160,123,995,1169,1178,839,1177,1184,881,1185,1186,1187,1188,1189]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SYNC_STALE_MS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"READ_GIVE_UP_MS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"FAST_GIVE_UP_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"RETRY_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"LIVE_DOWN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"SILENT_MS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REBUILD_GAP_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"HEARTBEAT_MS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"TICK_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"SLEEP_GAP_MS",{enumerable:!0,get:function(){return b}}),_e.syncStale=function(t,n,s=e){const o='string'==typeof t?Date.parse(t):t??0;return!o||!Number.isFinite(o)||n-o>s},_e.superviseSync=function(e){const t=e.now??(()=>Date.now()),d=e.setInterval??((e,t)=>setInterval(e,t)),h=e.clearInterval??(e=>clearInterval(e)),S=e.setTimeout??((e,t)=>setTimeout(e,t));let _=!1,v=!1;const y={fastReads:0,fullReads:0,rebuilds:0,wakes:0,authRefreshes:0,heartbeats:0,givenUp:0};let p=0,E=0,P=0,w=0,A=t(),M=0;const O=async t=>{try{await t()}catch(n){if(!e.isAuthError(n))throw n;y.authRefreshes++,await e.refreshAuth(),await t()}},R=()=>{if(_)return;if(p&&t()-p{e.markServer(),e.flush()},()=>{v||_||(v=!0,S(()=>{v=!1,R()},s))}).finally(()=>{p===o&&(p=0)})},j=()=>{if(E&&t()-E<6e4)return;E&&y.givenUp++;const n=E=t();y.fullReads++,O(e.readAll).then(()=>{e.flush()},()=>{}).finally(()=>{E===n&&(E=0)})},I=t=>{e.wake?.(),R(),j(),e.flush()},L=[d(R,e.fastMs),d(j,6e4),d(()=>{const n=t();n-A>b&&(y.wakes++,I()),A=n,'SUBSCRIBED'===e.realtime()?w=0:w||(w=n);const s=e.lastServerAt()?n-e.lastServerAt():0;(w&&n-w>o||s>u)&&(t()-P=f&&e.heartbeat&&(M=t(),y.heartbeats++,e.heartbeat().catch(()=>{}))},l)],T=()=>{e.doc&&'hidden'===e.doc.visibilityState||I()},U=()=>I();e.doc?.addEventListener?.('visibilitychange',T);for(const t of['online','focus','pageshow'])e.win?.addEventListener?.(t,U);return{kick:I,stats:()=>({...y}),stop:()=>{_=!0;for(const e of L)h(e);e.doc?.removeEventListener?.('visibilitychange',T);for(const t of['online','focus','pageshow'])e.win?.removeEventListener?.(t,U)}}};const e=6e4,t=3e4,n=1e4,s=2e3,o=45e3,u=9e4,c=12e4,f=6e4,l=5e3,b=2e4},1152,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPABASE_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SUPABASE_ANON_KEY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isSupabaseConfigured",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"REALTIME_TABLES",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n="https://rowdoidkftriylijobuy.supabase.co",o="sb_publishable_rPm723MQz6FwmFVHy6e1SA_ko-_-6GR",u=()=>!t.PITCH&&n.startsWith('https://')&&o.length>20,s=['bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_counts']},1153,[2]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_PALETTE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_DISPLAY",{enumerable:!0,get:function(){return o}});const t={bg:'#1A1A1A',surface:'#222222',surface2:'#292929',border:'#62675E',gold:'#7DB754',goldLight:'#AED28E',goldTint:'#25321E',goldMuted:'#A1C783',tile:'#222222',tilePressed:'#2D3428',accentBg:'rgba(125,183,84,0.13)',accentBorder:'rgba(125,183,84,0.55)',onGold:'#1A1A1A',ok:'#AED28E',okBg:'#25321E',blue:'#AED28E',blueBg:'#25321E'},o={quietBorder:'rgba(125,183,84,0.55)',quietPressed:'rgba(125,183,84,0.16)',primaryPressed:'#6D9F49'}},1154,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_LOCATION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WILDINGS_ADDRESS",{enumerable:!0,get:function(){return t}}),e.withWildingsAddress=function(r){return'wildings'===r.id?{...r,location:n,address:t}:r},e.withWildingsQuestionnaireAddress=function(n,r){return'wildings'===n&&r?{...r,venue:{...r.venue,address:t}}:r};const n='Maidens, KA26 9NR',t='Maidens Road, Maidens, KA26 9NR'},1155,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.sampleFingerprint=i,e.stripOwnerLiveSamples=function(n){const a={};for(const[s,o]of Object.entries(t.OWNER_SAMPLE_HASHES)){const t=n[s]||[];a[s]=t.filter(t=>!o.includes(i(t)))}a.chat=(n.chat||[]).filter(t=>!(0,s.isSeedChefChat)(t));const o=(n.changeRequests||[]).length-a.changeRequests.length;o&&(a.changesUsed=Math.max(0,(n.changesUsed||0)-o));return a},e.stripCoreLiveSamples=function(a){const c={...(0,n.stripCoreChefSamples)(a)};c.giftCards=(a.giftCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.giftCards.includes(i(s))),c.stampCards=(a.stampCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.stampCards.includes(i(s))),c.ratings=(a.ratings||[]).filter(t=>!(/^rt-[123]$/.test(t.id)&&(0,s.demoActor)(t.customerName))),i(a.customer)===t.LEGACY_CUSTOMER_HASH&&(c.customer={...a.customer,id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}});return c.restaurants=(a.restaurants||[]).filter(t=>!('saltmarsh'===t.id&&['The Venue','Saltmarsh Bistro'].includes(t.name))),c.menu=(c.menu||a.menu||[]).filter(t=>'saltmarsh'!==t.restaurantId).map(t=>t.signOff?t:o(t)),c};var t=r(d[0]),s=r(d[1]),n=r(d[2]);const a=t=>Array.isArray(t)?t.map(a):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([,t])=>void 0!==t&&'function'!=typeof t).sort(([t],[s])=>ts?1:0).map(([t,s])=>[t,a(s)])):t;function i(t){const s=JSON.stringify(a(t))??"null";let n=2166136261;for(let t=0;t>>0).toString(16)}const o=t=>Array.isArray(t)?t.map(o):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).map(([t,s])=>[t,'allergenNotes'===t&&'string'==typeof s&&/\(example\)/i.test(s)?'':o(s)])):t},1156,[1157,1085,1158]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"OWNER_SAMPLE_HASHES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CORE_SAMPLE_HASHES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"LEGACY_CUSTOMER_HASH",{enumerable:!0,get:function(){return b}});const c={referrals:["43f09bc0","c438fbad","96bf8c62","3399d421"],coats:["f51097ad","2f7efa3a"],merch:["ef6e14e","dbbc0999","dc233c1d"],merchOrders:["13b15512","bc27f242"],offers:["ad0fcde0","59e6c0cf"],photos:["53a60fd9","ab778a74","95de43cd"],changeRequests:["81c5be12","6819542c"],lost:["5bbf0d77","7d3aa9ed","850c049e"],campaigns:["9cdf8346","82150e7"],suppliers:["41df06e7","466e32ac","fa3d8eea","dfafa674","1e26fbd0","c195b120","5fc49e74","6aa8b0af","602fc2e4"],supplierOrders:["22636226","464d6a6a"]},f={giftCards:["b1bba36d","f029bc0e"],stampCards:["e7bedf6f","a3c8404d"]},b="4b1e9971"},1157,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.stripCoreChefSamples=function(n){return{bookings:(n.bookings||[]).filter(n=>!((0,e.isAnchorage)(n.restaurantId)&&t[n.id]===n.name)),orders:(n.orders||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('ord-seed-1'===t.id&&'R. Gilmour'===t.customerName||'ord-seed-2'===t.id&&'Table 3 guest'===t.customerName))),waitlist:(n.waitlist||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('wl-1'===t.id&&'Paterson'===t.name||'wl-2'===t.id&&'Duncan'===t.name))),menu:(n.menu||[]).map(t=>(0,e.isAnchorage)(t.restaurantId)&&(0,e.demoActor)(t.signOff?.by)?{...t,signOff:null}:t),events:(n.events||[]).filter(e=>!(e.example&&('anchorage'===e.restaurantId||null===e.restaurantId))),audit:(n.audit||[]).filter(e=>!('anchorage'===e.restaurantId&&/Example sign-off \(demo\)/i.test(e.text)))}};var e=r(d[0]);const t={'bk-101':'Campbell','bk-102':'Fraser','bk-103':'McLeod','bk-104':'Kerr','bk-105':'Wallace','bk-106':'Boyd','bk-107':'Hamilton','bk-108':'Stewart','bk-109':'Murray'}},1158,[1085]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.archiveChefCache=async function(e,t){const n=JSON.stringify(t);let o=2166136261;for(let e=0;e>>0).toString(16)}`;const c=await i.default.getItem(s);if(c){if(JSON.stringify(JSON.parse(c).rows)===n)return;s+=`:${Date.now()}`}await i.default.setItem(s,JSON.stringify({at:(new Date).toISOString(),store:e,rows:t}))};var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e}},1159,[1160]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),f={getItem:e=>u.default.getItem((0,n.venueKey)(e)),setItem:(e,t)=>u.default.setItem((0,n.venueKey)(e),t),removeItem:e=>u.default.removeItem((0,n.venueKey)(e))}},1160,[1161,5]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAsyncStorage",{enumerable:!0,get:function(){return n.useAsyncStorage}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=u.default},1161,[1162,1166]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return i}});var e,t=r(d[0]);const o=((e=t)&&e.__esModule?e:{default:e}).default.bind({concatArrays:!0,ignoreUndefined:!0});function n(e,t){const n=window.localStorage.getItem(e);if(n){const l=JSON.parse(n),c=JSON.parse(t),s=JSON.stringify(o(l,c));window.localStorage.setItem(e,s)}else window.localStorage.setItem(e,t)}function l(e,t){return new Promise((o,n)=>{try{const n=e();t?.(null,n),o(n)}catch(e){t?.(e),n(e)}})}function c(e,t,o){return Promise.all(e).then(e=>{const n=o?.(e)??null;return t?.(null,n),Promise.resolve(n)},e=>(t?.(e),Promise.reject(e)))}const s={getItem:(e,t)=>l(()=>window.localStorage.getItem(e),t),setItem:(e,t,o)=>l(()=>window.localStorage.setItem(e,t),o),removeItem:(e,t)=>l(()=>window.localStorage.removeItem(e),t),mergeItem:(e,t,o)=>l(()=>n(e,t),o),clear:e=>l(()=>window.localStorage.clear(),e),getAllKeys:e=>l(()=>{const e=window.localStorage.length,t=[];for(let o=0;o{},multiGet:(e,t)=>c(e.map(e=>s.getItem(e)),t,t=>t.map((t,o)=>[e[o],t])),multiSet:(e,t)=>c(e.map(e=>s.setItem(e[0],e[1])),t),multiRemove:(e,t)=>c(e.map(e=>s.removeItem(e)),t),multiMerge:(e,t)=>c(e.map(e=>s.mergeItem(e[0],e[1])),t)};var i=s},1162,[1163]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},1163,[1164]); +__d(function(g,r,i,a,m,e,d){'use strict';const t=r(d[0]),{hasOwnProperty:n}=Object.prototype,{propertyIsEnumerable:o}=Object,c=(t,n,o)=>Object.defineProperty(t,n,{value:o,writable:!0,enumerable:!0,configurable:!0}),s=this,f={concatArrays:!1,ignoreUndefined:!1},l=t=>{const c=[];for(const o in t)n.call(t,o)&&c.push(o);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(t);for(const s of n)o.call(t,s)&&c.push(s)}return c};function u(n){return Array.isArray(n)?y(n):t(n)?p(n):n}function y(t){const n=t.slice(0,0);return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}function p(t){const n=null===Object.getPrototypeOf(t)?Object.create(null):{};return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}const b=(t,n,o,s)=>(o.forEach(o=>{void 0===n[o]&&s.ignoreUndefined||(o in t&&t[o]!==Object.getPrototypeOf(t)?c(t,o,h(t[o],n[o],s)):c(t,o,u(n[o])))}),t),O=(t,o,s)=>{let f=t.slice(0,0),y=0;return[t,o].forEach(o=>{const p=[];for(let s=0;s!p.includes(t)),s)}),f};function h(n,o,c){return c.concatArrays&&Array.isArray(n)&&Array.isArray(o)?O(n,o,c):t(o)&&t(n)?b(n,o,l(o),c):u(o)}m.exports=function(...n){const o=h(u(f),this!==s&&this||{},f);let c={_:{}};for(const s of n)if(void 0!==s){if(!t(s))throw new TypeError('`'+s+'` is not an Option Object');c=h(c,{_:s},o)}return c._}},1164,[1165]); +__d(function(g,r,i,a,m,e,d){'use strict';m.exports=t=>{if('[object Object]'!==Object.prototype.toString.call(t))return!1;const o=Object.getPrototypeOf(t);return null===o||o===Object.prototype}},1165,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAsyncStorage=function(e){return{getItem:(...t)=>u.default.getItem(e,...t),setItem:(...t)=>u.default.setItem(e,...t),mergeItem:(...t)=>u.default.mergeItem(e,...t),removeItem:(...t)=>u.default.removeItem(e,...t)}};var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1166,[1162]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"createStore",{enumerable:!0,get:function(){return n}});const t=t=>{let n;const c=new Set,o=(t,o)=>{const s="function"==typeof t?t(n):t;if(!Object.is(s,n)){const t=n;n=(null!=o?o:"object"!=typeof s||null===s)?s:Object.assign({},n,s),c.forEach(c=>c(n,t))}},s=()=>n,u={setState:o,getState:s,getInitialState:()=>l,subscribe:t=>(c.add(t),()=>c.delete(t))},l=n=t(o,s,u);return u},n=n=>n?t(n):t},1167,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"create",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=r(d[1]);const c=e=>e;function o(e,t=c){const u=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return n.default.useDebugValue(u),u}const s=e=>{const t=(0,u.createStore)(e),n=e=>o(t,e);return Object.assign(n,t),n},l=e=>e?s(e):s},1168,[31,1167]); +__d(function(g,_r,i,_a3,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"combine",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"createJSONStorage",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"devtools",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"persist",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"redux",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"subscribeWithSelector",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"unstable_ssrSafe",{enumerable:!0,get:function(){return S}});const e=(e,t)=>(n,r,o)=>(o.dispatch=t=>(n(n=>e(n,t),!1,t),t),o.dispatchFromDevtools=!0,{dispatch:(...e)=>o.dispatch(...e),...t}),t=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,n=new Map,r=e=>{const t=n.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},o=(e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const o=n.get(r.name);if(o)return{type:"tracked",store:e,...o};const s={connection:t.connect(r),stores:{}};return n.set(r.name,s),{type:"tracked",store:e,...s}},s=(e,t,r)=>{if(void 0===t)return;const o=n.get(e);(null==o?void 0:o.stores[t])===r&&(delete o.stores[t],0===Object.keys(o.stores).length&&n.delete(e))},a=/^at (?:new |async )?(.+?) \(/,l=/^([^@]+)@/;function c(e){var t,n,r;if(!e)return;const o=e.split("\n"),s=o.findIndex(e=>e.includes("api.setState"));if(s<0)return;const c=(null==(t=o[s+1])?void 0:t.trim())||"";return(null==(n=a.exec(c))?void 0:n[1])||(null==(r=l.exec(c))?void 0:r[1])}const u=(e,a={})=>(l,u,p)=>{const{enabled:f,anonymousActionType:y,store:h,...b}=a;let S;try{S=(null!=f?f:"production"!==(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0))&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!S)return e(l,u,p);const{connection:O,..._}=o(h,S,b);let w,E=!0;p.setState=(e,t,n)=>{const o=l(e,t);if(!E)return o;const s=void 0===n?{type:y||c((new Error).stack)||"anonymous"}:"string"==typeof n?{type:n}:n;return void 0===h?(null==O||O.send(s,u()),o):(null==O||O.send({...s,type:`${h}/${s.type}`},{...r(b.name),[h]:p.getState()}),o)},p.devtools={cleanup:()=>{null==w||w(),w=void 0,s(b.name,h,p),void 0!==h&&n.has(b.name)||!O||"function"!=typeof O.unsubscribe||O.unsubscribe()}};const I=(...e)=>{const t=E;E=!1,l(...e),E=t},j=e(p.setState,u,p);if("untracked"===_.type?null==O||O.init(j):(_.stores[_.store]=p,null==O||O.init(Object.fromEntries(Object.entries(_.stores).map(([e,t])=>[e,e===_.store?j:t.getState()])))),t(p)){let e=!1;const t=p.dispatch;p.dispatch=(...n)=>{"production"===(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0)||"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return w=O.subscribe(e=>{var n;const o="object"==typeof b.serialize?b.serialize.reviver:void 0;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):v(e.payload,o,e=>{if("__setState"===e.type){if(void 0===h)return void I(e.state);1!==Object.keys(e.state).length&&console.error("\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");const t=e.state[h];if(null==t)return;return void(JSON.stringify(p.getState())!==JSON.stringify(t)&&I(t))}t(p)&&p.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return I(j),void 0===h?null==O?void 0:O.init(p.getState()):null==O?void 0:O.init(r(b.name));case"COMMIT":return void 0===h?void(null==O||O.init(p.getState())):null==O?void 0:O.init(r(b.name));case"ROLLBACK":return v(e.state,o,e=>{if(void 0===h)return I(e),void(null==O||O.init(p.getState()));I(e[h]),null==O||O.init(r(b.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return v(e.state,o,e=>{void 0!==h?JSON.stringify(p.getState())!==JSON.stringify(e[h])&&I(e[h]):I(e)});case"IMPORT_STATE":{const{nextLiftedState:t}=e.payload,r=null==(n=t.computedStates.slice(-1)[0])?void 0:n.state;if(!r)return;return I(void 0===h?r:r[h]),void(null==O||O.send(null,t))}case"PAUSE_RECORDING":return E=!E}return}}),j},v=(e,t,n)=>{let r;try{r=JSON.parse(e,t)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&n(r)},p=e=>(t,n,r)=>{const o=r.subscribe;r.subscribe=(e,t,n)=>{let s=e;if(t){const o=(null==n?void 0:n.equalityFn)||Object.is;let a=e(r.getState());s=n=>{const r=e(n);if(!o(a,r)){const e=a;t(a=r,e)}},(null==n?void 0:n.fireImmediately)&&t(a,a)}return o(s)};return e(t,n,r)};function f(e,t){return(...n)=>Object.assign({},e,t(...n))}function y(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var r;const o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),s=null!=(r=n.getItem(e))?r:null;return s instanceof Promise?s.then(o):o(s)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const h=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>h(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>h(t)(e)}}},b=(e,t)=>(n,r,o)=>{let s={storage:y(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},a=!1,l=0;const c=new Set,u=new Set;let v=s.storage;if(!v)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...e)},r,o);const p=()=>{const e=s.partialize({...r()});return v.setItem(s.name,{state:e,version:s.version})},f=o.setState;o.setState=(...e)=>(f(...e),p());const b=e((...e)=>(n(...e),p()),r,o);let S;o.getInitialState=()=>b;const O=()=>{var e,t;if(!v)return;const o=++l;a=!1,c.forEach(e=>{var t;return e(null!=(t=r())?t:b)});const f=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=r())?e:b))||void 0;return h(v.getItem.bind(v))(s.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];if(s.migrate){const t=s.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(o!==l)return;const[a,c]=e;return S=s.merge(c,null!=(t=r())?t:b),n(S,!0),a?p():void 0}).then(()=>{o===l&&(null==f||f(r(),void 0),S=r(),a=!0,u.forEach(e=>e(S)))}).catch(e=>{o===l&&(null==f||f(void 0,e))})};return o.persist={setOptions:e=>{s={...s,...e},e.storage&&(v=e.storage)},clearStorage:()=>{++l,null==v||v.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>O(),hasHydrated:()=>a,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},s.skipHydration||O(),S||b};function S(e,t="undefined"==typeof window){return(n,r,o)=>{if(!t)return e(n,r,o);const s=()=>{throw new Error("Cannot set state of Zustand store in SSR")};return o.setState=s,e(s,r,o)}}},1169,[]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return p}}),_e.defaultSimStart=function(e=new Date){const t=new Date(e),r=(5-t.getDay()+7)%7;return t.setDate(t.getDate()+r),t.setHours(17,30,0,0),t},_e.buildSeed=function(u){if(r.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE){const e=I(u);return{...e,restaurants:e.restaurants.filter(e=>'anchorage'===e.id),menu:c.anchorageMenu.map(e=>({...e,signOff:null})),bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:e.events.filter(e=>!e.example),ratings:[],walkIns:{},counters:{order:0,table:0,booking:0},customer:{...e.customer,id:'',referralCode:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}}}}return t.IS_ISOLATED_VENUE?{restaurants:[t.IS_QUEUED_VENUE?(0,e.queuedRestaurant)(t.VENUE_RID):t.IS_ABBOTSFORD?n.ABBOTSFORD_RESTAURANT:t.IS_KIRKTON?n.KIRKTON_RESTAURANT:t.IS_GREENSIDE?n.GREENSIDE_RESTAURANT:t.IS_WILDINGS?n.WILDINGS_RESTAURANT:t.IS_KIRKMICHAEL?n.KIRKMICHAEL_RESTAURANT:s.SOUTERS_RESTAURANT],menu:t.IS_WILDINGS?l.WILDINGS_MENU:t.IS_KIRKMICHAEL?d.KIRKMICHAEL_MENU:t.IS_SOUTERS?i.SOUTERS_MENU:[],customer:{id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}},bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:t.IS_WILDINGS?(0,o.guideCalendarEvents)(o.WILDINGS_GUIDE,'wildings'):t.IS_KIRKMICHAEL?(0,o.guideCalendarEvents)(o.KIRKMICHAEL_GUIDE,'kirkmichael'):t.IS_SOUTERS?(0,o.guideCalendarEvents)(o.SOUTERS_GUIDE,'souters'):[],ratings:[],audit:[],alertAcks:{},walkIns:{},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:0,table:0,booking:0}}:I(u)};var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),s=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),m=_r(_d[11]);const p='cust-demo';function I(e){const t=(0,m.ymd)(e),r=e=>e.toISOString(),s=n.restaurants.map(e=>'anchorage'===e.id?{...e,sections:c.ANCHORAGE_SECTIONS}:e),i={id:p,name:'Alex Morgan',email:'alex.demo@example.com',phone:'07700 900123',allergies:[{allergen:'crustaceans',severity:'anaphylaxis'},{allergen:'mustard',severity:'allergy'}],allergyConsent:!0,referralCode:'ALEX-7K2Q',marketingOptIn:{anchorage:!0}},o=(n,s,i,o,d={})=>({id:n,ref:`BK-${n.slice(-3).toUpperCase()}`,restaurantId:'anchorage',customerId:null,name:s,partySize:i,date:t,time:o,allergies:[],notes:'',status:'confirmed',security:i>=6?'deposit':'none',depositPaid:0,...i>=6?{depositDue:1e3*i}:{},createdAt:r((0,m.addMins)(e,-4320)),...d}),d=[o('bk-101','Campbell',2,'17:00',{table:'12',status:'seated',seatedAt:r((0,m.addMins)(e,-28)),tags:['Regular']}),o('bk-102','Fraser',4,'17:30',{table:'10',tags:['VIP']}),o('bk-103','McLeod',2,'18:00',{table:'11',allergies:[{allergen:'gluten',severity:'coeliac'}],notes:'Anniversary',occasion:'anniversary'}),o('bk-104','Kerr',6,'18:00',{table:'18'}),o('bk-105','Wallace',3,'18:30',{table:'13'}),o('bk-106','Boyd',8,'19:00',{table:'1+2',dog:!0,allergies:[{allergen:'peanuts',severity:'anaphylaxis'}],notes:'Birthday \u2014 bringing a dog',occasion:'birthday'}),o('bk-107','Hamilton',2,'19:00',{table:'5'}),o('bk-108','Stewart',4,'19:30',{table:'19',tags:['Regular']}),o('bk-109','Murray',2,'20:00',{table:'16'})],l=[{id:'wl-1',restaurantId:'anchorage',number:1,name:'Paterson',partySize:2,joinedAt:r((0,m.addMins)(e,-12)),status:'waiting'},{id:'wl-2',restaurantId:'anchorage',number:2,name:'Duncan',partySize:4,joinedAt:r((0,m.addMins)(e,-4)),status:'waiting'}],I=(0,m.atTime)(e,'17:45'),h=[{id:'ord-seed-1',ref:'T-1041',restaurantId:'anchorage',customerId:'cust-other',customerName:'R. Gilmour',type:'takeaway',slotTime:r(I),lines:[{itemId:'a-fishsupper',name:'Fish Supper',qty:2,unitPrice:1800,choices:['Beer-battered'],notes:'',contains:[],may:[],overridden:!1,prepMins:12},{itemId:'a-chips',name:'Triple-Cooked Chips (V)',qty:1,unitPrice:450,choices:[],notes:'Extra salt',contains:[],may:[],overridden:!1,prepMins:6}],subtotal:4050,tip:0,giftCardApplied:0,total:4050,paid:4050,status:'acknowledged',createdAt:r((0,m.addMins)(e,-50)),allergies:[],readiness:{}},{id:'ord-seed-2',ref:'Q-2017',restaurantId:'anchorage',customerId:'cust-other2',customerName:'Table 3 guest',type:'table',tableNo:'3',lines:[{itemId:'a-moules',name:'Moules Marini\xe8re',qty:1,unitPrice:2200,choices:['Main 500g with triple-cooked chips (\xa322.00)'],notes:'',contains:[],may:[],overridden:!1,prepMins:10},{itemId:'a-claymore',name:'The Claymore Burger',qty:1,unitPrice:1800,choices:[],notes:'No gherkins',contains:[],may:[],overridden:!1,prepMins:14}],subtotal:4e3,tip:0,giftCardApplied:0,total:4e3,paid:0,status:'preparing',createdAt:r((0,m.addMins)(e,-18)),allergies:[],readiness:{}}],y=[{restaurantId:'anchorage',customerId:p,stamps:5,rewardsAvailable:0,history:[{at:'2026-08-15',source:'Dine-in (staff scan)'},{at:'2026-08-29',source:'Takeaway'},{at:'2026-09-12',source:'Table QR bill'},{at:'2026-10-02',source:'Takeaway'},{at:'2026-10-16',source:'Referral \u2014 friend\u2019s first visit'}]},{restaurantId:'saltmarsh',customerId:p,stamps:2,rewardsAvailable:0,history:[{at:'2026-09-01',source:'Dine-in'},{at:'2026-10-01',source:'Dine-in'}]}],b=[{id:'gc-1',code:'ANC-G7QX-4M2P-9TRE',restaurantId:'anchorage',initial:5e3,balance:2500,ownerId:p,recipientName:'Alex',message:'Happy birthday! (example)',createdAt:'2026-09-20'},{id:'gc-2',code:'WEB-OLD-10-EXAMPLE',restaurantId:'anchorage',initial:1e3,balance:1e3,ownerId:'legacy',recipientName:'Legacy website bookings voucher (example)',message:'',createdAt:'2026-06-01',legacy:!0}],E=[...u.SCOTTISH_BANK_HOLIDAYS.map((e,t)=>({id:`bh-${t}`,restaurantId:null,date:e.date,title:e.title+(e.notes&&!/substitute/i.test(e.notes)?` (${e.notes.toLowerCase()})`:''),kind:'bank-holiday',description:'Scottish bank holiday',example:!1,source:u.BANK_HOLIDAY_SOURCE})),{id:'ev-halloween',restaurantId:'anchorage',date:(0,m.ymd)(new Date(e.getFullYear(),9,31)),title:'Halloween weekend (example)',kind:'event',description:'Example event \u2014 busy weekend flag for the forecast.',example:!0},{id:'ev-xmas-party',restaurantId:'anchorage',date:'2026-12-04',title:'Christmas party nights begin (example)',kind:'event',description:'Example: festive set menu, deposit required for parties of 8+.',example:!0},{id:'ev-hogmanay',restaurantId:null,date:'2026-12-31',title:'Hogmanay',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-burns',restaurantId:'anchorage',date:'2027-01-25',title:'Burns Night Supper (example)',kind:'event',description:'EXAMPLE event: haggis, neeps & tatties, address to the haggis, set menu \xa348pp. Booking opens via the app.',example:!0},{id:'ev-valentines',restaurantId:null,date:'2027-02-14',title:"Valentine's Day",kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-mothering',restaurantId:null,date:'2027-03-07',title:'Mothering Sunday (UK)',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-live',restaurantId:'anchorage',date:'2026-11-14',title:'Live acoustic music (example)',kind:'event',description:'EXAMPLE: local folk duo from 7pm.',example:!0},{id:'ev-school-xmas',restaurantId:null,date:'2026-12-23',title:'South Ayrshire schools close for Christmas',kind:'school-holiday',description:'23 Dec 2026 \u2013 4 Jan 2027',example:!1},{id:'ev-salt-quiz',restaurantId:'saltmarsh',date:'2026-11-05',title:'Quiz night (fictional)',kind:'event',description:'Fictional demo restaurant event.',example:!0}];return{restaurants:s,menu:[...c.anchorageMenu,...n.demoMenus],customer:i,bookings:d,waitlist:l,orders:h,stampCards:y,giftCards:b,events:E,ratings:[{id:'rt-1',restaurantId:'anchorage',customerId:'cust-x1',customerName:'Fiona (example)',stars:5,comment:'Best fish supper on the coast, and the staff were brilliant with my son\u2019s nut allergy.',createdAt:r((0,m.addMins)(e,-1560)),context:'Takeaway T-1032'},{id:'rt-2',restaurantId:'anchorage',customerId:'cust-x2',customerName:'Iain (example)',stars:4,comment:'Lovely langoustines. Bit of a wait for a table at 7.',createdAt:r((0,m.addMins)(e,-3e3)),context:'Dine-in, Table 6'},{id:'rt-3',restaurantId:'anchorage',customerId:'cust-x3',customerName:'Morag (example)',stars:2,comment:'Chips were cold by the time we collected.',createdAt:r((0,m.addMins)(e,-4320)),context:'Takeaway T-1019'}],audit:[],alertAcks:{},walkIns:{anchorage:6},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:1042,table:2018,booking:110}}}},1170,[6,5,842,3,1171,1172,934,1173,1174,1175,1176,822]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_RESTAURANT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SOUTERS_BOOKING_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SOUTERS_CONTACTS",{enumerable:!0,get:function(){return o}});const t={id:'souters',name:"Souter's Inn",tagline:'Culinary excellence meets country hospitality in Kirkoswald',location:'Kirkoswald, South Ayrshire',address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',phone:'01655 760653',website:'https://www.soutersinn.com/',fictional:!1,kitchenHours:{0:['09:00','21:00'],1:['09:00','21:00'],2:['09:00','21:00'],3:['09:00','21:00'],4:['09:00','21:00'],5:['09:00','21:00'],6:['09:00','21:00']},hoursNote:'Official menus (10 Nov 2026): breakfast daily 9\u201311.45am; \xe0 la carte, children\u2019s, vegetarian and takeaway 12 noon\u20139pm; desserts 9am\u20139pm. Official homepage: open daily from 9am. Destination South Ayrshire lists 9am\u20139pm, seven days, food all day. Christmas hours not published.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:16,stampTarget:8,stampReward:'',stampMinSpend:1e3,capacityPerHour:0,walkInShare:.35,turnMins:75,orderAtTable:!1,showTakeaway:!1,tableRequests:!0,shortName:"Souter's",deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'A general table deposit policy was not published on the official website (10 November 2026). No deposit is taken in this app.'}}},n='',o={email:'souters@southernayr.com',phone:'01655 760653'}},1171,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_MENU",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SOUTERS_MENU_COUNT",{enumerable:!0,get:function(){return t}});const s=[{id:"su-breakfast-full-breakfast",section:"Breakfast",name:"Full Breakfast",description:"Ayrshire Bacon, Link Sausage, Black Pudding, Potato Scone, Beans, Tomato, Mushrooms & Two Eggs (Poached, Scrambled or Fried) with White or Wholemeal Toast",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-benedict",section:"Breakfast",name:"Eggs Benedict",description:"Two Poached Eggs along with Ayrshire Bacon served on Toasted Muffin topped with Hollandaise Sauce",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-french-toast",section:"Breakfast",name:"French Toast",description:"Two Slices of Bloomer Eggy Bread with Ayrshire Bacon and a side of Maple Syrup",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-light-breakfast",section:"Breakfast",name:"Light Breakfast",description:"Ayrshire Bacon, Link Sausage, Beans, Tomato and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-royale",section:"Breakfast",name:"Eggs Royale",description:"Two Poached Eggs with Flaked Smoked Salmon served on Toasted Muffin topped with Hollandaise Sauce",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-fried-scottish-pancakes",section:"Breakfast",name:"Fried Scottish Pancakes",description:"Scottish Pancakes with Ayrshire Bacon and a side of Maple Syrup",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-to-fried-scottish-pancakes",section:"Breakfast add-ons",name:"Add Banana (to Fried Scottish Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-two-eggs-poached-fried-or-scrambled-",section:"Breakfast add-ons",name:"Add Two Eggs \u2013 Poached, Fried or Scrambled (to Fried Scottish Pancakes)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-vegetarian-breakfast",section:"Breakfast",name:"Vegetarian Breakfast",description:"Potato Scone, Tomato, Mushrooms, Beans and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:925,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-benedict",section:"Breakfast",name:"Smashed Avocado Benedict",description:"Smashed Avocado Guacamole, 2 Poached Eggs served on Toasted Muffin topped with Hollandaise Sauce",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-granola-bowl",section:"Breakfast",name:"Granola Bowl",description:"Almond and Raisin Granola topped with Berries, Natural Yoghurt and Honey",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-burrito",section:"Breakfast",name:"Breakfast Burrito",description:"Crispy Bacon, Two Fried Eggs, Jalape\xf1o Salsa, Guacamole, Cheddar Cheese, Salad & Sour Cream",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pancake-stack",section:"Breakfast",name:"Pancake Stack",description:"American style pancakes with Biscoff, Nutella, Chocolate Sauce & Fresh Strawberries",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-roll",section:"Breakfast",name:"Breakfast Roll",description:"with a choice of Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg; 2 Items \xa34.75 | 3 Items \xa35.50",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-breakfast",section:"Junior / Kids",name:"Kids Breakfast",description:"Pork Link Sausage, Beans, Potato Scone, served with a Slice of Toast",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-pancakes",section:"Junior / Kids",name:"Kids Pancakes",description:"American Style Pancakes served with Syrup, Nutella or Butter & Jam",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-or-strawberries-to-kids-panca",section:"Junior / Kids add-ons",name:"Add Banana or Strawberries (to Kids Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-black-pudding-add-on",section:"Add-ons",name:"Black Pudding (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-beans-add-on",section:"Add-ons",name:"Beans (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-add-on",section:"Add-ons",name:"Smashed Avocado (add-on)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pork-link-sausage-add-on",section:"Add-ons",name:"Pork Link Sausage (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-mushrooms-add-on",section:"Add-ons",name:"Mushrooms (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-tomato-add-on",section:"Add-ons",name:"Tomato (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-ayrshire-bacon-2-add-on",section:"Add-ons",name:"Ayrshire Bacon (2) (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-haggis-add-on",section:"Add-ons",name:"Haggis (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-egg-add-on",section:"Add-ons",name:"Egg (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-potato-scone-add-on",section:"Add-ons",name:"Potato Scone (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-bucket-of-chips",section:"Add-ons",name:"Bucket of Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-toasted-white-or-wholemeal-bread",section:"Add-ons",name:"Toasted White or Wholemeal Bread",description:"served with Butter and Preserve",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-freshly-baked-basket-of-bread-with-butte",section:"Starters / bread",name:"Freshly Baked Basket Of Bread With Butter",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-olive-oil-balsamic-vinegar",section:"Starters / bread",name:"Add Olive Oil & Balsamic Vinegar",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-soup-of-the-day",section:"Starters",name:"Soup of The Day",description:"served with Crusty Bread & Butter",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-a-la-carte-salad-of-poached-pear-blue-cheese",section:"Starters",name:"Salad Of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fresh-water-prawns",section:"Starters",name:"Fresh Water Prawns",description:"coated in Spicy Bang Bang Sauce, topped with Chopped Chilli, Peanuts & Coriander",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sliced-melon-fresh-fruits",section:"Starters",name:"Sliced Melon & Fresh Fruits",description:"with Coulis & Raspberry Sorbet",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-liver-p-t",section:"Starters",name:"Chicken Liver P\xe2t\xe9",description:"with Oatcakes, Plum & Apple Chutney",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-crispy-salt-pepper-calamari",section:"Starters",name:"Crispy Salt & Pepper Calamari",description:"served with Garlic Mayo & Oriental Dressing",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-mussels",section:"Starters",name:"Steamed Mussels",description:"with White Wine, Garlic, Shallots & Cream, served with Garlic Bread",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamy-baked-garlic-mushrooms",section:"Starters",name:"Creamy Baked Garlic Mushrooms",description:"with a Cheddar Cheese Gratin",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-boiled-egg-crispy-bacon-caesar-salad",section:"Starters",name:"Boiled Egg & Crispy Bacon Caesar Salad",description:"with Parmesan & Croutons",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-grilled-honey-glazed-goat-s-cheese-salad",section:"Starters",name:"Grilled Honey Glazed Goat\u2019s Cheese Salad",description:"with Roquito Peppers & Chilli Jam",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sticky-bbq-ribs-in-a-korean-gochujang-sa",section:"Starters",name:"Sticky BBQ Ribs in a Korean Gochujang Sauce",description:"with Onions, Peppers & Sesame Seeds",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cioppino-fish-soup",section:"Starters",name:"Cioppino Fish Soup",description:"fired up with Fresh Chillies & Smoked Paprika, topped with Croutons & Parmesan",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-fillet-steak",section:"From the grill",name:"8oz Fillet Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-10oz-sirloin-steak",section:"From the grill",name:"10oz Sirloin Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-rosemary-garlic-lamb-chops",section:"From the grill",name:"Rosemary & Garlic Lamb Chops",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:2750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-breaded-haggis-grill",section:"From the grill add-ons",name:"Top with Breaded Haggis (grill)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-6-garlic-buttered-prawns-grill",section:"From the grill add-ons",name:"Top with 6 Garlic Buttered Prawns (grill)",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-fillet-of-salmon-with-cheese-gla",section:"Main courses",name:"Steamed Fillet of Salmon with Cheese Glaze",description:"served with Buttered Greens & Creamed Potatoes",price:2150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breaded-haddock-chips",section:"Main courses",name:"Breaded Haddock & Chips",description:"with Homemade Tartare Sauce & Side Salad",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fish-of-the-day",section:"Main courses",name:"Fish of the Day",description:"Check Chef\u2019s Daily Specials",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,priceNote:"Ask staff",special:!0},{id:"su-a-la-carte-locally-caught-haggis-with-neeps-tatties",section:"Main courses",name:"Locally Caught Haggis with Neeps & Tatties",description:"served with Whisky Peppercorn Sauce & Greentails",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breast-of-cajun-spiced-chicken",section:"Main courses",name:"Breast Of Cajun Spiced Chicken",description:"with Capsicums, Rice Pilaf & a Curried Coconut & Mango Chutney Sauce",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-schnitzel",section:"Main courses",name:"Chicken Schnitzel",description:"Pan-Fried in Breadcrumbs, served with Crispy Bacon, Grilled Pineapple & Chips",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-beef-steak-butcher-s-sausage-pie",section:"Main courses",name:"Beef Steak & Butcher\u2019s Sausage Pie",description:"with Creamed Potatoes & Buttered Carrots",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-madras-spiced-lamb-curry",section:"Main courses",name:"Madras Spiced Lamb Curry",description:"with Chillies, Pineapple & Coriander, served with Aromatic Rice, Spiced Onions & a Poppadom",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-pan-fried-lambs-liver",section:"Main courses",name:"Pan-Fried Lambs Liver",description:"with Saut\xe9ed Onions, Smoked Bacon, Grilled Tomato, Creamed Potatoes & Red Wine Gravy",price:1750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-cheeseburger",section:"Main courses",name:"8oz Cheeseburger",description:"with Bacon, Peppered Mayo, Pickles & Tomato, served with Coleslaw & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-haggis-to-cheeseburger",section:"Main courses add-ons",name:"Add Haggis (to Cheeseburger)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-panko-breaded-chicken-burger",section:"Main courses",name:"Panko Breaded Chicken Burger",description:"in a Toasted Brioche Bun, with Curried Slaw, Katsu Sauce & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Leeks, English Mustard & Matured Cheddar, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-bacon-to-macaroni-cheese",section:"Main courses add-ons",name:"Add Bacon (to Macaroni Cheese)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-penne-pasta-arrabbiata",section:"Main courses",name:"Penne Pasta Arrabbiata",description:"with Peppers, Vine Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-melon-prawn-salad",section:"Salads",name:"Melon & Prawn Salad",description:"with Marie Rose Cocktail Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-ploughman-s-salad",section:"Salads",name:"Ploughman\u2019s Salad",description:"Souter\u2019s Sausage Roll, Matured Cheddar, Pickle, Gammon, Boiled Egg & Crusty Bread; served with a choice of Chips or Boiled Potatoes",price:1695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-spiced-fillet-of-salmon",section:"Salads",name:"Cajun Spiced Fillet Of Salmon",description:"with Curried Coleslaw, Cashew Nuts & a Chilli, Ginger & Citrus Dressing; served with a choice of Chips or Boiled Potatoes",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-chicken-caesar-salad",section:"Salads",name:"Garlic Chicken Caesar Salad",description:"with Croutons, Parmesan, Baby Gem Lettuce, Boiled Egg & Caesar Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-prawn-smoked-salmon-sandwich",section:"Sandwiches",name:"Prawn & Smoked Salmon Sandwich",description:"with Rocket & Marie Rose Sauce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-tuna-mayonnaise-sandwich",section:"Sandwiches",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-spicy-bang-bang-chicken-sandwich",section:"Sandwiches",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-basil-pesto-chicken-sandwich",section:"Sandwiches",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-egg-mayonnaise-sandwich",section:"Sandwiches",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-a-cup-of-soup-with-any-sandwich",section:"Sandwiches add-ons",name:"Add a Cup of Soup (with any Sandwich)",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chips",section:"Sides",name:"Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-chips",section:"Sides",name:"Cajun Chips",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamed-potatoes",section:"Sides",name:"Creamed Potatoes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-onion-rings",section:"Sides",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-mac-cheese-side",section:"Sides",name:"Mac & Cheese (side)",description:"",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-seasonal-mixed-vegetables",section:"Sides",name:"Seasonal Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-coleslaw",section:"Sides",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-curried-coleslaw",section:"Sides",name:"Curried Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-side-salad",section:"Sides",name:"Souter\u2019s Side Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread",section:"Sides",name:"Garlic Bread",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread-with-cheese",section:"Sides",name:"Garlic Bread with Cheese",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-fresh-fruit-salad-sorbet",section:"Starters",name:"Fresh Fruit Salad & Sorbet",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-soup-of-the-day",section:"Starters",name:"Soup of the Day",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-garlic-bread-with-or-without-cheese",section:"Starters",name:"Garlic Bread (with or without Cheese)",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-breaded-goujons-of-chicken",section:"Main courses",name:"Breaded Goujons of Chicken",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-mini-breaded-fish",section:"Main courses",name:"Mini Breaded Fish",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-roast-chicken-salad",section:"Main courses",name:"Roast Chicken Salad",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-grilled-sausages-or-chicken-with-gravy",section:"Main courses",name:"Grilled Sausages or Chicken with Gravy",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-sticky-toffee-pudding",section:"Sweet treats",name:"Sticky Toffee Pudding",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-cone-from-the-counter",section:"Sweet treats",name:"Cone from the Counter",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-ice-cream-sundae",section:"Sweet treats",name:"Kids Ice Cream Sundae",description:"Two scoops, Sprinkles, Flakes, along with a choice of Sauce \u2013 Chocolate / Strawberry",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-juice-apple-orange-pineapple",section:"Drinks",name:"Juice \u2013 Apple / Orange / Pineapple",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-simply-fruit-shoot-orange-blackcurrant",section:"Drinks",name:"Simply Fruit Shoot \u2013 Orange / Blackcurrant",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-diluting-juice-orange-blackcurrant",section:"Drinks",name:"Diluting Juice \u2013 Orange / Blackcurrant",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-milk",section:"Drinks",name:"Milk",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-coke-diet-coke-lemonade",section:"Drinks",name:"Coke / Diet Coke / Lemonade",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-milk-shake-chocolate-strawberry",section:"Drinks",name:"Kids Milk Shake \u2013 Chocolate / Strawberry",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-sticky-toffee-pudding",section:"Dessert",name:"Souter\u2019s Sticky Toffee Pudding",description:"with Butterscotch Sauce & Vanilla Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cherry-almond-tart",section:"Dessert",name:"Cherry & Almond Tart",description:"with Cr\xe8me Anglaise & Wild Cherry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-individual-banoffee-pie",section:"Dessert",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-cheesecake-of-the-day",section:"Dessert",name:"Souter\u2019s Cheesecake of the Day",description:"Please ask your Server for Today\u2019s Choice",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-warm-chocolate-fudge-cake",section:"Dessert",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-meringue-pie",section:"Dessert",name:"Lemon Meringue Pie",description:"with Raspberries & Raspberry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-fresh-fruit-salad",section:"Dessert",name:"Fresh Fruit Salad",description:"with Citrus Syrup served with Pouring Cream, Ice Cream or Sorbet",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cheeseboard",section:"Dessert",name:"Cheeseboard",description:"A Selection of British & Continental Cheeses with Grapes, Fruit Chutney & Biscuits",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-affogato",section:"Dessert",name:"Affogato",description:"Vanilla Ice Cream with a Shot of Espresso",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-ice-cream-one-scoop",section:"Ice cream",name:"Ice Cream \u2013 One Scoop",description:"Please ask your Server for Today\u2019s Flavours",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-two-scoops",section:"Ice cream",name:"Ice Cream \u2013 Two Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-three-scoops",section:"Ice cream",name:"Ice Cream \u2013 Three Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-strawberry-snowball-delight",section:"Sundaes",name:"Strawberry Snowball Delight",description:"Vanilla & Strawberry Ice cream, Crushed Meringue, Fresh Strawberries, Strawberry Sauce, topped with a Snowball & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-biscoff-sundae",section:"Sundaes",name:"Biscoff Sundae",description:"Biscoff & Toffee Fudge Ice Cream, Whipped Cream, Crushed Lotus Biscoff Biscuits, Biscoff Topping Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-kinder-bueno-sundae",section:"Sundaes",name:"Kinder Bueno Sundae",description:"Kinder Bueno & Chocolate Ice Cream, Whipped Cream, Kinder Bueno Pieces, Chocolate Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-chilled-melon-seasonal-fruits",section:"Starters",name:"Chilled Melon & Seasonal Fruits",description:"with Fruit Coulis & Sorbet",price:850,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-garlic-mushrooms",section:"Starters",name:"Creamy Garlic Mushrooms",description:"with Cheddar Cheese & Crusty Bread",price:895,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-mediterranean-tomato-chunky-vegetable-so",section:"Starters",name:"Mediterranean Tomato & Chunky Vegetable Soup",description:"with Crusty Bread",price:650,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-honey-glazed-goats-cheese",section:"Starters",name:"Honey Glazed Goats Cheese",description:"with Tomato & Rocket Salad, Basil Pesto & Balsamic Dressing",price:850,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-freshly-baked-basket-of-bread",section:"Starters",name:"Freshly Baked Basket of Bread",description:"with Butter",price:450,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-vegetarian-vegan-add-olive-oil-balsamic",section:"Starters",name:"Add Olive Oil & Balsamic",description:"",price:100,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-boiled-egg-caesar-salad",section:"Starters",name:"Boiled Egg Caesar Salad",description:"with Croutons, Garlic Dressing & Vegetarian Cheese Shavings",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-salad-of-poached-pear-candied-walnuts",section:"Starters",name:"Salad of Poached Pear & Candied Walnuts",description:"with French Vinaigrette",price:795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-stuffed-peppers",section:"Main courses",name:"Stuffed Peppers",description:"with Braised Rice, Tomatoes, Basil & Brie, served with a Side Salad & a Bucket of Chips; without Brie is vegan",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-vegetable-cashew-nut-stir-fry",section:"Main courses",name:"Vegetable & Cashew Nut Stir Fry",description:"with Hoisin, Ginger & Garlic, served with Aromatic Rice",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Coleman\u2019s Mustard, Leeks & Matured Cheddar, served with Garlic Bread",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-pasta-arrabbiata",section:"Main courses",name:"Pasta Arrabbiata",description:"with Peppers, Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-coconut-vegetable-curry",section:"Main courses",name:"Creamy Coconut Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-katsu-vegetable-curry",section:"Main courses",name:"Katsu Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-fresh-fruit-salad",section:"Desserts",name:"Fresh Fruit Salad",description:"with Sorbet",price:700,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-sticky-toffee-pudding",section:"Desserts",name:"Sticky Toffee Pudding",description:"with Hot Caramel Sauce & Vanilla Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cherry-almond-tart",section:"Desserts",name:"Cherry & Almond Tart",description:"with Wild Cherry Ripple Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-trillionaire-tart",section:"Desserts",name:"Trillionaire Tart",description:"with Chocolate Pastry, Caramel Toffee & Chocolate Style Ganache, served with Vegan Vanilla Ice Cream",price:795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-individual-banoffee-pie",section:"Desserts",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-warm-chocolate-fudge-cake",section:"Desserts",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cheeseboard",section:"Desserts",name:"Cheeseboard",description:"served with Oatcakes & Seasonal Chutney",price:995,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-affogato",section:"Desserts",name:"Affogato",description:"1 Scoop of Plain Ice Cream with a shot of Espresso Coffee",price:650,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-ayrshire-bacon",section:"Morning (9am\u201312pm)",name:"Floured Bap with Ayrshire Bacon",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-pork-link-sausage",section:"Morning (9am\u201312pm)",name:"Floured Bap with Pork Link Sausage",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-poached-scrambled-fried",section:"Morning (9am\u201312pm)",name:"Floured Bap with Poached / Scrambled / Fried Egg",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-extra-item-on-floured-bap",section:"Morning (9am\u201312pm)",name:"Extra Item (on Floured Bap)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-traybakes",section:"Sweet treats",name:"Traybakes",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-freshly-baked-cakes",section:"Sweet treats",name:"Freshly Baked Cakes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-freshly-baked-plain-fruit-scone",section:"Sweet treats",name:"Freshly Baked Plain / Fruit Scone",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-soup-of-the-day",section:"Hot food (12pm\u20139pm)",name:"Soup of the Day",description:"with Crusty Bread; available 12pm\u20139pm",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-breaded-haddock-chips",section:"Hot food (12pm\u20139pm)",name:"Breaded Haddock & Chips",description:"with Tartare Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-steak-sausage-pie",section:"Hot food (12pm\u20139pm)",name:"Steak & Sausage Pie",description:"with Chips & Gravy",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-macaroni-cheese",section:"Hot food (12pm\u20139pm)",name:"Macaroni Cheese",description:"with Leeks, Mustard & Matured Cheddar, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-8oz-burger",section:"Hot food (12pm\u20139pm)",name:"8oz Burger",description:"with Bacon & Cheese, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-katsu-chicken-burger",section:"Hot food (12pm\u20139pm)",name:"Breaded Katsu Chicken Burger",description:"with Curried Slaw, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-cajun-chicken",section:"Hot food (12pm\u20139pm)",name:"Cajun Chicken",description:"with Rice & Coconut Curry Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-goat-s-cheese",section:"Hot food (12pm\u20139pm)",name:"Breaded Goat\u2019s Cheese",description:"with Tomato Salad, Pesto & Chutney, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-basil-pesto-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-spicy-bang-bang-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches (12pm\u20135pm)",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-tuna-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-egg-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-pork-fillet-escalopes",section:"Choose your cut",name:"Pork Fillet Escalopes",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-beef-fillet",section:"Choose your cut",name:"8oz Scotch Beef Fillet",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-sirloin",section:"Choose your cut",name:"8oz Scotch Sirloin",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-10oz-scotch-ribeye",section:"Choose your cut",name:"10oz Scotch Ribeye",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-scotch-lamb-chops",section:"Choose your cut",name:"Scotch Lamb Chops",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-600gm-scotch-t-bone-steak",section:"Choose your cut",name:"600gm Scotch T-Bone Steak",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:4500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-mixed-grill",section:"Choose your cut",name:"Souter\u2019s Mixed Grill",description:"4oz Sirloin / Chicken Breast / Lamb Chop / Pork Escalope; served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-chunky-chips-included-side-choice",section:"Side (included)",name:"Chunky Chips (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-baby-boiled-potatoes-included-side-choic",section:"Side (included)",name:"Baby Boiled Potatoes (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mashed-potato-included-side-choice",section:"Side (included)",name:"Mashed Potato (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-red-wine-jus-included-sauce-choice",section:"Sauce (included)",name:"Red Wine Jus (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-peppercorn-included-sauce-choice",section:"Sauce (included)",name:"Peppercorn (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mustard-included-sauce-choice",section:"Sauce (included)",name:"Mustard (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-onion-rings",section:"Upgrade extras",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garden-salad",section:"Upgrade extras",name:"Garden Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mixed-vegetables",section:"Upgrade extras",name:"Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-haggis-cake",section:"Upgrade extras",name:"Haggis Cake",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mac-cheese",section:"Upgrade extras",name:"Mac & Cheese",description:"",price:525,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garlic-prawns",section:"Upgrade extras",name:"Garlic Prawns",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-coleslaw",section:"Upgrade extras",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-2-course-set",section:"Festive set menu",name:"2 Course Festive Menu",description:"From 1 December, Monday\u2013Sunday 12\u20139pm, only available for tables of 10 or more. Christmas crackers included.",price:2995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-3-course-set",section:"Festive set menu",name:"3 Course Festive Menu",description:"From 1 December, Monday\u2013Sunday 12\u20139pm, only available for tables of 10 or more. Christmas crackers included.",price:3595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-chilled-melon-fruits",section:"Festive \xb7 Starters",name:"Chilled Melon & Fruits",description:"with Lemon Sorbet",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-salad-of-poached-pear-blue-cheese",section:"Festive \xb7 Starters",name:"Salad of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-souters-prawn-home-smoked-salmon-cocktail",section:"Festive \xb7 Starters",name:"Souter\u2019s Prawn & Home Smoked Salmon Cocktail",description:"with Baby Gem & Marie Rose Sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-smooth-chicken-liver-parfait",section:"Festive \xb7 Starters",name:"Smooth Chicken Liver Parfait",description:"with Spiced Plum Chutney & Oatcakes",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-soup-of-the-day",section:"Festive \xb7 Starters",name:"Soup of the Day",description:"served with Freshly Baked Crusty Bread",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-salad-of-warm-breaded-goats-cheese",section:"Festive \xb7 Starters",name:"Salad of Warm Breaded Goats Cheese",description:"with Red Onion Marmalade",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-traditional-roast-turkey",section:"Festive \xb7 Main courses",name:"Traditional Roast Turkey",description:"with Stuffing, Chipolatas, Roast Potatoes, Brussel Sprouts, Fresh Cranberry Sauce & Light Turkey Jus",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-individual-vegetable-chestnut-brie-cranberry-pie",section:"Festive \xb7 Main courses",name:"Individual Vegetable, Chestnut, Brie & Cranberry Pie",description:"served with a Creamy White Wine & Leek Sauce",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-pan-fried-fish-of-the-day-with-garlic-tiger-praw",section:"Festive \xb7 Main courses",name:"Pan Fried Fish of the Day with Garlic Tiger Prawns",description:"with Buttered Greens, Baby Potatoes, Capers & Citrus Beurre Blanc",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cajun-fillet-of-salmon-salad",section:"Festive \xb7 Main courses",name:"Cajun Fillet of Salmon Salad",description:"with Curried Coleslaw, Cashew Nuts & a Ginger & Lemongrass Dressing",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-individual-beef-steak-sausage-onion-pie",section:"Festive \xb7 Main courses",name:"Individual Beef Steak, Sausage & Onion Pie",description:"served with Creamed Potatoes & Glazed Carrots",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-lightly-peppered-breast-of-chicken",section:"Festive \xb7 Main courses",name:"Lightly Peppered Breast of Chicken",description:"served with Crispy Breaded Haggis, Champ Mashed Potatoes, Root Vegetables & Whisky Cream Sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-christmas-pudding",section:"Festive \xb7 Desserts",name:"Christmas Pudding",description:"with Brandy Sauce & Scottish Tablet Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cherry-almond-tart",section:"Festive \xb7 Desserts",name:"Cherry & Almond Tart",description:"with Chilled Cr\xe8me Anglaise & Wild Cherry Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-warm-chocolate-orange-fudge-cake",section:"Festive \xb7 Desserts",name:"Warm Chocolate & Orange Fudge Cake",description:"with Girvan Gelateria Vanilla Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cheesecake-of-the-day",section:"Festive \xb7 Desserts",name:"Cheesecake of the Day",description:"with Ice Cream",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-selection-of-scottish-farmhouse-cheese",section:"Festive \xb7 Desserts",name:"Selection of Scottish Farmhouse Cheese",description:"with Chutney, Grapes & Oatcakes",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-coffee-or-tea-with-a-mince-pie",section:"Festive \xb7 To finish",name:"Freshly Ground Coffee or Tea with a Mince Pie",description:"From 1 December, tables of 10 or more",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"souters",soldOut:!1,signOff:null})),t=235},1172,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIRKMICHAEL_MENU_COUNT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"KIRKMICHAEL_MENU",{enumerable:!0,get:function(){return n}});const s=133,n=[{id:"km-main-menu-khun-mais-canteen-grilled-aubergine",section:"Menu \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-langoustine-prawn-toast",section:"Menu \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-loch-ryan-venison-empinadas",section:"Menu \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-bbq-scotch-pork-neck-moo-ping",section:"Menu \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-scallop-slow-roasted-pork-belly",section:"Menu \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Menu \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-slow-roasted-apple-orchard-tamworth-pork-belly",section:"Menu \xb7 Main Courses on the specials board",name:"Slow Roasted Apple Orchard Tamworth Pork Belly",description:"Truffle Mash-Roasted Carrot-Spring Cabbage-Apple Puree",price:2800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-char-roasted-lamb-neck-fillet",section:"Menu \xb7 Main Courses on the specials board",name:"Char Roasted Lamb Neck Fillet",description:"Autumn Cabbage, Boiled Potatoes, Roast Carrot, Red Wine Jus",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-fire-roasted-lochryan-venison-loin",section:"Menu \xb7 Main Courses on the specials board",name:"Fire Roasted Lochryan Venison Loin",description:"Celeriac Parsley Puree-Wild Leeks-Potato Terrine-Juniper Jus",price:3900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-butter-poached-lemon-sole-fillet",section:"Menu \xb7 Main Courses on the specials board",name:"Butter Poached Lemon Sole Fillet",description:"Langoustines Tails-Pernod Chive Nage-Paris Mash-Truffle",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-grilled-tranche-of-turbot",section:"Menu \xb7 Main Courses on the specials board",name:"Grilled Tranche of Turbot",description:"Lemon Scented Monk's Beard-Pink Fir Apple Potatoes-Bearnaise",price:4400,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-lunch-khun-mais-canteen-grilled-aubergine",section:"Lunch \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-langoustine-prawn-toast",section:"Lunch \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-loch-ryan-venison-empinadas",section:"Lunch \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-bbq-scotch-pork-neck-moo-ping",section:"Lunch \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-scallop-slow-roasted-pork-belly",section:"Lunch \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Lunch \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-triple-cooked-hand-cut-chips",section:"Lunch \xb7 Sides",name:"Triple Cooked Hand Cut Chips",description:"",price:600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-khun-mais-canteen-grilled-aubergine",section:"Sunday lunch \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-langoustine-prawn-toast",section:"Sunday lunch \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-loch-ryan-venison-empinadas",section:"Sunday lunch \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-bbq-scotch-pork-neck-moo-ping",section:"Sunday lunch \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-scallop-slow-roasted-pork-belly",section:"Sunday lunch \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Sunday lunch \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-maple-glazed-bacon-loin",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Maple Glazed Bacon Loin",description:"",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-roasted-sirloin-of-scotch-beef",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Roasted Sirloin of Scotch Beef",description:"Beef Fat Roast Potatoes-Yorkshire Pudding-Spring Cabbage-Carrot-Peppercorn Sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-lemon-and-thyme-corn-fed-chicken",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Lemon and Thyme Corn Fed Chicken",description:"",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-carvery-plate",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Carvery Plate",description:"Beef, Bacon Loin, Corn Fed Chicken",price:3100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-fire-roasted-lochryan-venison-loin",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Fire Roasted Lochryan Venison Loin",description:"Celeriac Parsley Puree-Wild Leeks-Potato Terrine-Juniper Jus",price:3900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-butter-poached-lemon-sole-fillet",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Butter Poached Lemon Sole Fillet",description:"Langoustines Tails-Pernod Chive Nage-Paris Mash-Truffle",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-grilled-tranche-of-turbot",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Grilled Tranche of Turbot",description:"Lemon Scented Monk's Beard-Pink Fir Apple Potatoes-Bearnaise",price:4400,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-kids-garlic-bread",section:"Kids \xb7 Starters",name:"Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-cheesy-garlic-bread",section:"Kids \xb7 Starters",name:"Cheesy Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-soup",section:"Kids \xb7 Starters",name:"Soup",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-hamburger",section:"Kids \xb7 Mains",name:"Hamburger",description:"Scotch beef burger with brioche bun, lettuce, tomato & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-cheese-burger",section:"Kids \xb7 Mains",name:"Cheese Burger",description:"Scotch beef burger with cheddar cheese, brioche bun, lettuce, tomato & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-chicken-goujons",section:"Kids \xb7 Mains",name:"Chicken Goujons",description:"Crisp fried chicken strips with tortilla wraps, grated cheddar & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-fish-n-chips",section:"Kids \xb7 Mains",name:"Fish 'n Chips",description:"Battered haddock, lemon, tartare sauce & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-mac-n-cheese",section:"Kids \xb7 Mains",name:"Mac 'n Cheese",description:"Creamy Macaroni with cheddar cheese sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-strawberry-ice-cream",section:"Kids \xb7 Desserts",name:"Strawberry Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-chocolate-ice-cream",section:"Kids \xb7 Desserts",name:"Chocolate Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-vanilla-ice-cream",section:"Kids \xb7 Desserts",name:"Vanilla Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-sticky-toffee-pudding",section:"Kids \xb7 Desserts",name:"Sticky Toffee Pudding",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-whisky-whyte-macay",section:"Whisky \xb7 Blended Whisky",name:"Whyte & Macay",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-johnnie-walker-black-label",section:"Whisky \xb7 Blended Whisky",name:"Johnnie Walker Black Label",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-canadian-club",section:"Whisky \xb7 Blended Whisky",name:"Canadian Club",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jack-daniels-tennessee",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Jack Daniel's Tennessee",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-southern-comfort",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Southern Comfort",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-makers-mark-classic",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Maker's Mark Classic",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bulleit",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Bulleit",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bulleit-rye",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Bulleit Rye",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jim-beam-white-label",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Jim Beam White Label",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-woodford-reserve",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Woodford Reserve",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jameson",section:"Whisky \xb7 Irish Whiskey",name:"Jameson",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-hibiki-harmony-masters-masters-select",section:"Whisky \xb7 Japanese Whisky",name:"Hibiki Harmony Masters Masters Select",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenfiddich-12-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Glenfiddich 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenrothes-12-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Glenrothes 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-macallan-12-year-old-double-cask",section:"Whisky \xb7 Single Malt - Speyside",name:"Macallan 12 Year Old Double Cask",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-benrinnes-flora-fauna-15",section:"Whisky \xb7 Single Malt - Speyside",name:"Benrinnes Flora & Fauna 15",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-benrinnes-1997-maltman-18-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Benrinnes 1997 Maltman 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-balvenie-18-year-old-pedro-ximenez",section:"Whisky \xb7 Single Malt - Speyside",name:"Balvenie 18 Year Old Pedro Ximenez",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-macallan-18-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Macallan 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-aberlour-abunadh-cask-strength",section:"Whisky \xb7 Single Malt - Speyside",name:"Aberlour Abunadh Cask Strength",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-mortlach-16yo",section:"Whisky \xb7 Single Malt - Speyside",name:"Mortlach 16yo",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-dalmore-12-year-old",section:"Whisky \xb7 Single Malt - Highland",name:"Dalmore 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-oban-14-year-old",section:"Whisky \xb7 Single Malt - Highland",name:"Oban 14 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glencadam-10",section:"Whisky \xb7 Single Malt - Highland",name:"Glencadam 10",description:"",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-tomatin-legacy",section:"Whisky \xb7 Single Malt - Highland",name:"Tomatin Legacy",description:"",price:675,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-tomatin-14",section:"Whisky \xb7 Single Malt - Highland",name:"Tomatin 14",description:"",price:800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glendronach-15",section:"Whisky \xb7 Single Malt - Highland",name:"Glendronach 15",description:"",price:900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glenfarclas-21",section:"Whisky \xb7 Single Malt - Highland",name:"Glenfarclas 21",description:"",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glendronach-sherry-cask-18",section:"Whisky \xb7 Single Malt - Highland",name:"Glendronach Sherry Cask 18",description:"",price:2250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-bowmore-15-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Bowmore 15 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lagavulin-16-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Lagavulin 16 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-caol-ila-12-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Caol Ila 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-caol-ila-moch",section:"Whisky \xb7 Single Malt - Islay",name:"Caol Ila Moch",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-ardbeg-10",section:"Whisky \xb7 Single Malt - Islay",name:"Ardbeg 10",description:"",price:575,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-highland-park-12-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Highland Park 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-talisker-10-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Talisker 10 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-10-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Arran 10 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-port-cask-finish",section:"Whisky \xb7 Single Malt - Islands",name:"Arran Port Cask Finish",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-machrie-moor-cask-strength",section:"Whisky \xb7 Single Malt - Islands",name:"Machrie Moor Cask Strength",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-amarone-cask",section:"Whisky \xb7 Single Malt - Islands",name:"Arran Amarone Cask",description:"",price:725,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-hearach-oloroso-harris",section:"Whisky \xb7 Single Malt - Islands",name:"Hearach Oloroso, Harris",description:"",price:900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-ledaig-1974-mull",section:"Whisky \xb7 Single Malt - Islands",name:"Ledaig 1974, Mull",description:"",price:2250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-auchentoshan-three-wood",section:"Whisky \xb7 Single Malt - Lowlands",name:"Auchentoshan Three Wood",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-ailsa-bay",section:"Whisky \xb7 Single Malt - Lowlands",name:"Ailsa Bay",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenkinchie-12-year-old",section:"Whisky \xb7 Single Malt - Lowlands",name:"Glenkinchie 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-our-barley",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Our Barley\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-fallow-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Fallow Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-ploughing-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Ploughing Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-5",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"5\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-cask-strength-2nd-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Cask Strength 2nd Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-spirit-drink",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch Spirit Drink",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-vinaya",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch Vinaya",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-22-year-old-vintage-release",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch 22 Year Old Vintage Release",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-springbank-15-year-old",section:"Whisky \xb7 Single Malt - Campbeltown",name:"Springbank 15 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-springbank-18-year-old",section:"Whisky \xb7 Single Malt - Campbeltown",name:"Springbank 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-greyfriars-cuvee-brut",section:"Wine \xb7 Champagne/Sparkling",name:"Greyfriars Cuvee Brut",description:"England",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-greyfriars-rose-reserve",section:"Wine \xb7 Champagne/Sparkling",name:"Greyfriars Rose Reserve",description:"England",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ruinart-blank-de-blank",section:"Wine \xb7 Champagne/Sparkling",name:"Ruinart Blank De Blank",description:"",price:19e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-sanziana-pinot-noir-rose",section:"Wine \xb7 Rose",name:"Sanziana, Pinot Noir, Rose",description:"Romania",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-rose-organic",section:"Wine \xb7 Rose",name:"Art de Vivre Rose Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-orange-gold-white-organic",section:"Wine \xb7 Orange",name:"Orange Gold White Organic",description:"Gerard Bertrand Organic, France",price:6800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-les-lys-de-leon-sauvignon-blanc",section:"Wine \xb7 White",name:"Les Lys De Leon - Sauvignon Blanc",description:"Loir, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-fetele-feteasca-regala-recas-cramele",section:"Wine \xb7 White",name:"Fetele Feteasca Regala Recas Cramele",description:"Bannat, Romania",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-adam-who-riesling",section:"Wine \xb7 White",name:"Adam Who, Riesling",description:"Eden Valley, Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-rare-vineyards-marsanne-viognier",section:"Wine \xb7 White",name:"Rare Vineyards Marsanne-Viognier",description:"Languedoc France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-la-bergerie-chardonnay-francois-carillon",section:"Wine \xb7 White",name:"La Bergerie Chardonnay, Francois Carillon",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-blanc-organic",section:"Wine \xb7 White",name:"Art de Vivre Blanc Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-acrobat-pinot-gris",section:"Wine \xb7 White",name:"Acrobat Pinot Gris",description:"Oregon, U.S.A",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-dashwood-sauvignon-blanc",section:"Wine \xb7 White",name:"Dashwood Sauvignon Blanc",description:"Marlborough New Zealand",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-sancerre-la-graveli-re",section:"Wine \xb7 White",name:"Sancerre La Graveli\xe8re",description:"Joseph Mellot, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-petaluma-hanlin-hill-riesling",section:"Wine \xb7 White",name:"Petaluma Hanlin Hill Riesling",description:"Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-louis-jadot-puligny-montrachet",section:"Wine \xb7 White",name:"Louis Jadot Puligny Montrachet",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-vinvua-organic-nero-davola-doc",section:"Wine \xb7 Red",name:"Vinvua Organic Nero d'Avola DOC",description:"Sicilia Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-les-lys-de-leon-pinot-grigio",section:"Wine \xb7 Red",name:"Les Lys De Leon, Pinot Grigio",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-tres-priors-trepat-merlot",section:"Wine \xb7 Red",name:"Tres Priors Trepat Merlot",description:"Catalonia, Spain",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-alma-mora-malbec",section:"Wine \xb7 Red",name:"Alma Mora Malbec",description:"San Juan, Argentina",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-drifting-old-vine-zinfandel-lodi",section:"Wine \xb7 Red",name:"Drifting Old Vine Zinfandel Lodi",description:"California, U.S.A",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ch-teau-caz-au-maret-organic",section:"Wine \xb7 Red",name:"Ch\xe2teau Caz\xe9au Maret Organic",description:"Bordeaux, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-inzuzo-red-blend",section:"Wine \xb7 Red",name:"Inzuzo Red Blend",description:"Western Cape South Africa",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-languedoc-organic",section:"Wine \xb7 Red",name:"Art de Vivre LangueDOC Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-journeys-end-v4-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Journeys End V4 Cabernet Sauvignon",description:"South Africa",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-mucchietto-primitivo",section:"Wine \xb7 Red",name:"Mucchietto Primitivo",description:"Puglia, Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-yalumba-the-cigar-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Yalumba The Cigar Cabernet Sauvignon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-black-angus-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Black Angus Cabernet Sauvignon",description:"Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ch-teauneuf-du-pape-le-mioc-ne",section:"Wine \xb7 Red",name:"Ch\xe2teauneuf du Pape 'Le Mioc\xe8ne'",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-catena-zapata-malbec-argentino",section:"Wine \xb7 Red",name:"Catena Zapata Malbec Argentino",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-amarone-della-valpolicella-classico-reserva",section:"Wine \xb7 Red",name:"Amarone della Valpolicella Classico Reserva",description:"Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-psi-bodegas-ribera-del-duero",section:"Wine \xb7 Red",name:"Psi Bodegas Ribera Del Duero",description:"Spain",price:10600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-brunelo-di-mortlachino-ridolfi",section:"Wine \xb7 Red",name:"Brunelo Di Mortlachino Ridolfi",description:"Italy",price:16e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-flor-de-pingus-domain-de-pingus",section:"Wine \xb7 Red",name:"Flor De Pingus, Domain De Pingus",description:"Spain",price:29500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"kirkmichael",soldOut:!1,signOff:null}))},1173,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_MENU_COUNT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"WILDINGS_MENU",{enumerable:!0,get:function(){return n}});const s=83,n=[{id:"wi-lunch-smoked-haddock-gratin-with-creamed-potatoes",section:"Lunch \xb7 Starters",name:"Smoked Haddock Gratin with Creamed Potatoes",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-pear-poached-in-grenadine-with-prawns-marie-rose",section:"Lunch \xb7 Starters",name:"Pear Poached in Grenadine with Prawns Marie Rose",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chefs-pate-with-grape-chutney-toast",section:"Lunch \xb7 Starters",name:"Chefs Pate with Grape Chutney & Toast",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Lunch \xb7 Starters",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-melon-fan-with-sorbet-fruit-coulis",section:"Lunch \xb7 Starters",name:"Melon Fan with Sorbet & Fruit Coulis",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-spiced-chicken-salad-with-caesar-dressing-parmes",section:"Lunch \xb7 Starters",name:"Spiced Chicken Salad with Caesar Dressing & Parmesan",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-mushrooms-baked-in-a-cream-cheese-sauce-with-toa",section:"Lunch \xb7 Starters",name:"Mushrooms Baked in a Cream & Cheese Sauce with Toasted Ciabatta",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-smoked-haddock-salmon-chowder",section:"Lunch \xb7 Starters",name:"Smoked Haddock & Salmon Chowder",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Lunch \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-blackened-salmon-warm-potato-salad-a-pepper-must",section:"Lunch \xb7 Mains",name:"Blackened Salmon, Warm Potato Salad & a Pepper & Mustard Seed Dressing",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chicken-breast-coated-in-panko-crumb-with-a-ligh",section:"Lunch \xb7 Mains",name:"Chicken Breast Coated in Panko Crumb with a Lightly Spiced Sweet & Sour Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-fillet-of-pork-topped-with-banana-finished-with",section:"Lunch \xb7 Mains",name:"Fillet of Pork Topped with Banana Finished with a Creamy Coconut & Mango Curry Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-haddock-mornay-or-a-lemon-butter",section:"Lunch \xb7 Mains",name:"Haddock \u201cMornay\u201d or a Lemon Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chicken-piri-piri-szechuan-peppers-spices-served",section:"Lunch \xb7 Mains",name:"Chicken \u2018Piri-Piri\u2019 Szechuan Peppers & Spices served with a Yoghurt & Spring Onion Mayonnaise",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-lamb-fillet-with-a-cracked-black-pepper-cream-br",section:"Lunch \xb7 Mains",name:"Lamb Fillet with a Cracked Black Pepper Cream & Brandy Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00 \xb7 \xa32.00 supplement"},{id:"wi-lunch-pan-fried-fillet-of-hake-with-a-lobster-glaze",section:"Lunch \xb7 Mains",name:"Pan Fried Fillet of Hake with a Lobster Glaze",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-supreme-of-chicken-suedoise-white-wine-swiss-che",section:"Lunch \xb7 Mains",name:"Supreme of Chicken \u2018Suedoise\u2019 White Wine, Swiss Cheese, Cream & Mushrooms",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-spicy-chilli-with-rice-topped-with-onions-cheese",section:"Lunch \xb7 Mains",name:"Spicy Chilli with Rice Topped with Onions & Cheese",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-haddock-in-breadcrumbs-or-tempura-served-with-ta",section:"Lunch \xb7 Mains",name:"Haddock in Breadcrumbs or Tempura served with Tartar Sauce & Lemon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-lambs-liver-bacon",section:"Lunch \xb7 Mains",name:"Lambs Liver & Bacon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-any-extra-servings",section:"Lunch \xb7 Mains",name:"Any Extra Servings",description:"Each extra serving",price:395,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-dinner-tiger-prawns-tempura-with-a-sweet-chilli-dip",section:"Dinner \xb7 Starters",name:"Tiger Prawns Tempura with a Sweet Chilli Dip",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-smoked-haddock-bacon-gratin-with-braised-rice",section:"Dinner \xb7 Starters",name:"Smoked Haddock & Bacon Gratin with Braised Rice",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Dinner \xb7 Starters",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-spiced-chicken-salad-with-caesar-dressing-parmes",section:"Dinner \xb7 Starters",name:"Spiced Chicken Salad with Caesar Dressing & Parmesan",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-chefs-pate-with-grape-chutney-toast",section:"Dinner \xb7 Starters",name:"Chefs Pate with Grape Chutney & Toast",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-melon-fan-with-fresh-fruits-sorbet-mango-coulis",section:"Dinner \xb7 Starters",name:"Melon Fan with Fresh Fruits, Sorbet & Mango Coulis",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-smoked-haddock-salmon-chowder",section:"Dinner \xb7 Starters",name:"Smoked Haddock & Salmon Chowder",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Dinner \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-pear-poached-in-grenadine-with-prawns-marie-rose",section:"Dinner \xb7 Starters",name:"Pear Poached in Grenadine with Prawns Marie Rose",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-crayfish-avocado-melon-cocktail",section:"Dinner \xb7 Starters",name:"Crayfish, Avocado & Melon Cocktail",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-blackened-sea-bass-served-with-mixed-salad-a-swe",section:"Dinner \xb7 Mains",name:"Blackened Sea Bass served with Mixed Salad & a Sweet Pepper Vinaigrette",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-roast-rack-of-lamb-minted-peas-pan-juices",section:"Dinner \xb7 Mains",name:"Roast Rack of Lamb, Minted Peas & Pan Juices",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa32.50 supplement"},{id:"wi-dinner-roast-breast-of-duck-with-a-pink-peppercorn-bran",section:"Dinner \xb7 Mains",name:"Roast Breast of Duck with a Pink Peppercorn & Brandy Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-supreme-of-chicken-suedoise-white-wine-swiss-che",section:"Dinner \xb7 Mains",name:"Supreme of Chicken \u2018Suedoise\u2019 White Wine, Swiss Cheese, Cream & Mushrooms",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-lambs-liver-bacon-with-a-red-wine-jus",section:"Dinner \xb7 Mains",name:"Lambs Liver & Bacon with a Red Wine Jus",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-haddock-mornay-or-a-lemon-butter",section:"Dinner \xb7 Mains",name:"Haddock \u201cMornay\u201d or a Lemon Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-entrecote-steak-with-large-onion-rings-a-choice",section:"Dinner \xb7 Mains",name:"Entrecote Steak with Large Onion Rings & a Choice of Sauces",description:"Diane, Pepper or Caf\xe9 de Paris",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa38.00 supplement"},{id:"wi-dinner-haddock-in-breadcrumbs-or-tempura-served-with-ta",section:"Dinner \xb7 Mains",name:"Haddock in Breadcrumbs or Tempura served with Tartar Sauce & Lemon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-fillet-of-salmon-chicken-with-two-sauces-lobster",section:"Dinner \xb7 Mains",name:"Fillet of Salmon & Chicken with Two Sauces - \u2018Lobster\u2019 & White Wine Cream & Mushroom",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-fillet-steak-with-a-cracked-black-pepper-cream-s",section:"Dinner \xb7 Mains",name:"Fillet Steak with a Cracked Black Pepper & Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa312.00 supplement"},{id:"wi-dinner-fillet-of-pork-on-a-haggis-cake-with-a-mustard-g",section:"Dinner \xb7 Mains",name:"Fillet of Pork on a Haggis Cake with a Mustard Grain Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-wildings-chicken-schnitzel-topped-with-garlic-he",section:"Dinner \xb7 Mains",name:"Wildings Chicken Schnitzel Topped with Garlic & Herb Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-spicy-chilli-with-rice-topped-with-onions-cheese",section:"Dinner \xb7 Mains",name:"Spicy Chilli with Rice Topped with Onions & Cheese",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-any-extra-servings",section:"Dinner \xb7 Mains",name:"Any Extra Servings",description:"Each extra serving",price:395,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-vegetarian-roast-red-pepper-tomato-soup",section:"Vegetarian \xb7 Starters",name:"Roast Red Pepper & Tomato Soup",description:"",price:null,dietary:["GF option"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Vegetarian \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-melon-fan-with-sorbet-fruit-coulis",section:"Vegetarian \xb7 Starters",name:"Melon Fan with Sorbet & Fruit Coulis",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-mushrooms-baked-in-a-cream-cheese-sauce-with-toa",section:"Vegetarian \xb7 Starters",name:"Mushrooms Baked in a Cream & Cheese Sauce with Toasted Ciabatta",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Vegetarian \xb7 Mains",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-cajun-vegetables-crepe-glazed-in-a-cream-sauce",section:"Vegetarian \xb7 Mains",name:"Cajun Vegetables Crepe Glazed in a Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-vegan-curried-chickpea-with-cherry-tomatoes-wilt",section:"Vegetarian \xb7 Mains",name:"Vegan Curried Chickpea with Cherry Tomatoes & Wilted Spinach",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-vegetable-tempura",section:"Vegetarian \xb7 Mains",name:"Vegetable Tempura",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-mushroom-stroganoff-with-rice",section:"Vegetarian \xb7 Mains",name:"Mushroom Stroganoff with Rice",description:"",price:null,dietary:["GF option"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-sundried-tomato-feta-olive-tartlet-finished-with",section:"Vegetarian \xb7 Mains",name:"Sundried Tomato, Feta & Olive Tartlet, Finished with a Tomato Concasse & a Basil Dressing",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-sweets-trio-of-homemade-ice-creams",section:"Sweets \xb7 Desserts",name:"Trio of Homemade Ice Creams",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-cr-me-caramel-with-passion-fruit-ice-cream",section:"Sweets \xb7 Desserts",name:"Cr\xe8me Caramel with Passion Fruit Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-vanilla-cheesecake-with-strawberry-coulis-fresh",section:"Sweets \xb7 Desserts",name:"Vanilla Cheesecake with Strawberry Coulis & Fresh Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-sticky-toffee-pudding",section:"Sweets \xb7 Desserts",name:"Sticky Toffee Pudding",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-affogato",section:"Sweets \xb7 Desserts",name:"\u2018Affogato\u2019",description:"Wildings Ice Cream with a Shot of Espresso",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-chocolate-and-orange-liqueur-pot",section:"Sweets \xb7 Desserts",name:"Chocolate and Orange Liqueur Pot",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-rice-pudding-with-an-apple-compote",section:"Sweets \xb7 Desserts",name:"Rice Pudding with an Apple Compote",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-crepes-filled-with-bananas-and-maple-syrup",section:"Sweets \xb7 Desserts",name:"Crepes filled with Bananas and Maple Syrup",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-meringue-vacherin-with-a-berry-liqueur-compote",section:"Sweets \xb7 Desserts",name:"Meringue Vacherin with a Berry Liqueur Compote",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-bread-butter-pudding-with-pouring-cream",section:"Sweets \xb7 Desserts",name:"Bread & Butter Pudding with Pouring Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-selection-of-cheese-with-biscuits-grapes-chutney",section:"Sweets \xb7 Desserts",name:"Selection of Cheese with Biscuits, Grapes & Chutney",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"\xa33.00 supplement"},{id:"wi-sweets-tea",section:"Sweets \xb7 Hot drinks",name:"Tea",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-decaf-tea",section:"Sweets \xb7 Hot drinks",name:"Decaf Tea",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-espresso",section:"Sweets \xb7 Hot drinks",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-americano",section:"Sweets \xb7 Hot drinks",name:"Americano",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-latte",section:"Sweets \xb7 Hot drinks",name:"Latte",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-flat-white",section:"Sweets \xb7 Hot drinks",name:"Flat White",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-cappuccino",section:"Sweets \xb7 Hot drinks",name:"Cappuccino",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-mocha",section:"Sweets \xb7 Hot drinks",name:"Mocha",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-irish-coffee",section:"Sweets \xb7 Hot drinks",name:"Irish Coffee",description:"",price:775,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-kids-cheesy-garlic-bread",section:"Kids \xb7 Starters",name:"Cheesy Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-melon-sorbet",section:"Kids \xb7 Starters",name:"Melon & Sorbet",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-soup-of-the-day",section:"Kids \xb7 Starters",name:"Soup of the Day",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-breaded-haddock",section:"Kids \xb7 Mains",name:"Breaded Haddock",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-pasta-with-a-cheese-sauce-or-tomato-sauce",section:"Kids \xb7 Mains",name:"Pasta with a Cheese Sauce or Tomato Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-fish-pie",section:"Kids \xb7 Mains",name:"Fish Pie",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-tempura-chicken-goujons",section:"Kids \xb7 Mains",name:"Tempura Chicken Goujons",description:"All can be served with Fries and a choice of Beans or Vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-homemade-ice-cream",section:"Kids \xb7 Dessert",name:"Homemade Ice Cream",description:"Please ask Staff for Our Ice Cream Selection",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"}].map(s=>({...s,restaurantId:"wildings",soldOut:!1,signOff:null}))},1174,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SECTIONS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anchorageMenu",{enumerable:!0,get:function(){return o}});const i=i=>({id:i,name:'Served with',required:!0,multi:!1,choices:[{id:`${i}-custard`,label:'Custard',priceDelta:0,allergens:{}},{id:`${i}-icecream`,label:'Ice cream',priceDelta:0,allergens:{}},{id:`${i}-cream`,label:'Cream',priceDelta:0,allergens:{}},{id:`${i}-vegan`,label:'Vegan ice cream (ask server)',priceDelta:0,allergens:{}}]}),s=(i,s,n)=>({id:i,name:'Portion',required:!0,multi:!1,choices:[{id:`${i}-starter`,label:'Starter',priceDelta:0},{id:`${i}-main`,label:n,priceDelta:s}]}),n=[{id:'a-soup',section:'Starters',name:"Chef's Soup of the Day",description:'A heartwarming bowl of seasonal homemade soup, served with warm crusty bread and butter.',price:600,dietary:[],allergens:{},allergenNotes:'Recipe changes daily \u2014 check the day\u2019s soup.',prepMins:0},{id:'a-skink',section:'Starters',name:'Cullen Skink',description:'Traditional creamy soup made with locally smoked haddock, potatoes and leeks, served with warm crusty bread and butter.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-salmon',section:'Starters',name:'Scottish Smoked Salmon Roulade',description:'Delicate Scottish smoked salmon rolled with herb-infused cream cheese, served with garlic & herb crostini and dressed salad.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-haggis',section:'Starters',name:'Haggis Bon Bons',description:'Crisp golden panko-fried haggis balls, finished with a velvety Scotch whisky sauce and caramelised apple gel.',price:800,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-crabcakes',section:'Starters',name:'Spiced Crab Cakes',description:'Golden crab cakes, delicately seasoned with herbs and spices, served with crisp seasonal salad and house-made Marie Rose sauce.',price:900,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-tempura',section:'Starters',name:'Deluxe Mixed Tempura',description:"King prawns, chicken and lion's mane mushrooms in a light, crispy tempura batter, served with a dressed seasonal salad and house dipping sauce.",price:1e3,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[s('tempura',900,'Main with triple-cooked chips (\xa319.00)')]},{id:'a-kingoyster',section:'Starters',name:"Pan-Seared King Oyster Mushroom 'Scallops' (VG)",description:"King oyster mushroom 'scallops' prepared with the chef's special recipe of the day. Ask your server or see our specials board for today's garnish and accompaniments.",price:1e3,dietary:['VG'],allergens:{},allergenNotes:'Garnish changes daily \u2014 sign-off needed for each version.',prepMins:0,special:!0,unsigned:!0,optionGroups:[s('kingoyster',800,'Main (\xa318.00)')]},{id:'a-fishsupper',section:'Mains',name:'Fish Supper',description:'Locally landed haddock, available beer-battered or breaded, served with buttered peas, triple-cooked chips and homemade tartare sauce.',price:1800,dietary:['GF option'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'fs-coat',name:'Coating',required:!0,multi:!1,choices:[{id:'fs-batter',label:'Beer-battered',priceDelta:0},{id:'fs-bread',label:'Breaded',priceDelta:0}]}]},{id:'a-lionsmane',section:'Mains',name:"Southern Fried Lion's Mane Burger (VG)",description:"Crispy southern fried lion's mane mushroom, layered with vegan cheese and garlic aioli, served with triple-cooked chips and golden onion rings.",price:1800,dietary:['VG'],allergens:{},prepMins:0},{id:'a-pie',section:'Mains',name:'Steak & Ale Pie',description:'Slow-braised beef in a rich ale jus beneath golden all-butter puff pastry, served with buttered seasonal vegetables.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'pie-side',name:'Served with',required:!0,multi:!1,choices:[{id:'chips',label:'Triple-cooked chips',priceDelta:0},{id:'creamed',label:'Creamed potatoes',priceDelta:0,allergens:{}}]}]},{id:'a-bananablossom',section:'Mains',name:"Beer-Battered Banana Blossom 'Fish' Goujons (VG)",description:'Crisp beer-battered banana blossom goujons, dusted with locally foraged truffle seaweed seasoning, served with triple-cooked chips, garden peas and vegan tartare sauce.',price:1700,dietary:['VG'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-chicken',section:'Mains',name:'Roasted Breast of Chicken',description:'Golden pan-roasted chicken breast, served with creamed potatoes, buttered seasonal primaryBtns, and a fragrant lemon & thyme bouillon.',price:1900,dietary:[],allergens:{},prepMins:0},{id:'a-maccheese',section:'Mains',name:'Macaroni Cheese (V)',description:'Rich mature Cheddar macaroni finished with a golden cheese glaze, served with two slices of garlic bread.',price:1700,dietary:['V'],allergens:{},prepMins:0},{id:'a-penne',section:'Mains',name:'Cajun Chicken & Chorizo Penne Pasta',description:'Tender Cajun-spiced chicken strips, mixed peppers, red onion and smoky chorizo, tossed in a bold, creamy Cajun sauce, served with two slices of garlic bread.',price:1700,dietary:[],allergens:{},prepMins:0},{id:'a-caesar',section:'Mains',name:'Chicken Caesar Salad',description:'Tender pan-roasted chicken breast served on a bed of baby gem lettuce with golden garlic croutons, Parmesan and a classic Caesar dressing.',price:1800,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'caesar-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'caesar-bacon',label:'Add smoked Ayrshire bacon',priceDelta:150}]}]},{id:'a-moules',section:'Mains',name:'Moules Marini\xe8re',description:'Fresh Scottish mussels, steamed to perfection in a rich, creamy white wine and garlic sauce.',price:1200,dietary:[],allergens:{},prepMins:0,optionGroups:[s('moules',1e3,'Main 500g with triple-cooked chips (\xa322.00)')]},{id:'a-fillet',section:'From the Grill',name:'8oz Fillet Steak',description:'Prime 8oz fillet steak served with truffled woodland mushrooms, seasonal primaryBtns, golden onion rings and triple-cooked chips.',price:3800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'steak-sauce',name:'Sauce',required:!1,multi:!1,choices:[{id:'sauce-pepper',label:'Peppercorn sauce',priceDelta:0,allergens:{}},{id:'sauce-garlic',label:'Garlic butter',priceDelta:0,allergens:{}}]},{id:'steak-surf',name:'Surf & turf add-on',required:!1,multi:!1,choices:[{id:'surf-prawns',label:'Garlic prawns',priceDelta:800,allergens:{}},{id:'surf-scallops',label:'Scottish West Coast scallops',priceDelta:1e3,allergens:{}}]}]},{id:'a-claymore',section:'From the Grill',name:'The Claymore Burger',description:'One juicy 6oz homemade Scottish beef burger in a brioche bun with baby gem lettuce, tomato and gherkins, topped with cheese, smoked Ayrshire bacon and onion rings. Served with triple-cooked chips.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'claymore-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'claymore-haggis',label:'Add haggis and whisky sauce',priceDelta:150,allergens:{}}]}]},{id:'a-langoustines',section:"Captain's Table",name:'Whole Scottish Grilled Langoustines',description:'Locally caught whole Scottish langoustines grilled in garlic butter, served with a vibrant side salad and burnt lemon.',price:1700,dietary:[],allergens:{},prepMins:0,optionGroups:[s('lang',1200,'Main 500g with triple-cooked chips (\xa329.00)')]},{id:'a-scallops',section:"Captain's Table",name:'Pan-Seared West Coast Scallops',description:"Scottish West Coast scallops prepared to the chef's recipe of the day. Starter and main portions \u2014 see price on Specials Board.",price:null,priceNote:'See specials board',dietary:[],allergens:{},prepMins:0,special:!0,unsigned:!0},{id:'a-lobster',section:"Captain's Table",name:'Grilled Dunure Lobster',description:'Fresh Dunure lobster, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:3500,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'lobster-size',name:'Size',required:!0,multi:!1,choices:[{id:'lob-half',label:'Half',priceDelta:0},{id:'lob-whole',label:'Whole (\xa365.00)',priceDelta:3e3}]}]},{id:'a-crab',section:"Captain's Table",name:'Grilled Dunure Crab',description:'Freshly landed Dunure brown crab, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:4e3,dietary:[],allergens:{},prepMins:0},{id:'a-smorgasbord',section:'Platters',name:'Seafood Smorgasbord (serves one)',description:"250g langoustines, 3 pan-seared West Coast scallops, 250g fresh mussels, 6 garlic prawns and a roll of Scottish smoked salmon, with dressed side salad and warm crusty bread.",price:5e3,dietary:[],allergens:{},prepMins:0},{id:'a-deluxe',section:'Platters',name:'Deluxe Seafood Platter (serves two)',description:'One whole Dunure lobster, one whole Dunure crab, 500g whole langoustines, 500g moules marini\xe8re, pan-seared scallops, Scottish smoked salmon and 6 garlic prawns, with two portions of chips, side salad and warm crusty bread.',price:16500,dietary:[],allergens:{},prepMins:0},{id:'a-onionrings',section:'Sides',name:'House Beer-Battered Onion Rings (V)',description:'Crisp house beer-battered onion rings, served golden and crunchy.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-garlicbread',section:'Sides',name:'Garlic Bread (V)',description:'Warm toasted garlic bread, finished with garlic & parsley butter.',price:450,dietary:['V'],allergens:{},prepMins:0,optionGroups:[{id:'gb-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'gb-cheese',label:'Add cheese',priceDelta:100}]}]},{id:'a-chips',section:'Sides',name:'Triple-Cooked Chips (V)',description:'Golden triple-cooked chips, lightly tossed in Maldon sea salt.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'chips-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'chips-cajun',label:'Add Cajun seasoning',priceDelta:0,allergens:{}}]}]},{id:'a-truffle',section:'Sides',name:'Parmesan & Truffle Fries (V)',description:'Crispy fries topped with finely grated parmesan and tossed in a winter truffle infused oil.',price:500,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-salad',section:'Sides',name:'Side Salad (VG)',description:'Seasonal mixed leaves with cucumber, red onion and mixed peppers, finished with a light vinaigrette.',price:450,dietary:['VG'],allergens:{},prepMins:0},{id:'a-brulee',section:'Desserts',name:"Chef's Cr\xe8me Br\xfbl\xe9e of the Day (V)",description:"Smooth Madagascan custard with a delicately caramelised sugar crust. Ask your server or see our specials board for today's flavour.",price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-crumble',section:'Desserts',name:'Seasonal Fruit Crumble (V)',description:'Slow-cooked seasonal fruit topped with a golden buttery crumble.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('crumble')]},{id:'a-stp',section:'Desserts',name:'Sticky Toffee Pudding (V)',description:'A rich, homemade steamed date pudding, drenched in our signature homemade butterscotch sauce.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('stp')]},{id:'a-cheesecake',section:'Desserts',name:'Cheesecake of the Day (V)',description:'A smooth, creamy cheesecake on a buttery biscuit base. Gluten-free and vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('cheesecake')]},{id:'a-affogato',section:'Desserts',name:'Affogato (V)',description:'Two scoops of creamy vanilla ice cream with a freshly brewed shot of Italian espresso poured over. Vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0}],t=['Starters','Mains','From the Grill',"Captain's Table",'Platters','Sides','Desserts','Mini Anchors (under 12s)'],o=n.map(({unsigned:i,soldOut:s,...n})=>({...n,allergens:{},allergenNotes:'',prepMins:0,optionGroups:n.optionGroups?.map(i=>({...i,choices:i.choices.map(i=>({...i,allergens:{}}))})),restaurantId:"anchorage",soldOut:!!s,signOff:null}))},1175,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SCOTTISH_BANK_HOLIDAYS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"BANK_HOLIDAY_SOURCE",{enumerable:!0,get:function(){return n}});const t=[{date:"2026-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2026-12-25",title:"Christmas Day",notes:""},{date:"2026-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2027-01-01",title:"New Year\u2019s Day",notes:""},{date:"2027-01-04",title:"2nd January",notes:"Substitute day"},{date:"2027-03-26",title:"Good Friday",notes:""},{date:"2027-05-03",title:"Early May bank holiday",notes:""},{date:"2027-05-31",title:"Spring bank holiday",notes:""},{date:"2027-08-02",title:"Summer bank holiday",notes:""},{date:"2027-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2027-12-27",title:"Christmas Day",notes:"Substitute day"},{date:"2027-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2028-01-03",title:"New Year\u2019s Day",notes:"Substitute day"},{date:"2028-01-04",title:"2nd January",notes:"Substitute day"},{date:"2028-04-14",title:"Good Friday",notes:""},{date:"2028-05-01",title:"Early May bank holiday",notes:""},{date:"2028-05-29",title:"Spring bank holiday",notes:""},{date:"2028-08-07",title:"Summer bank holiday",notes:""},{date:"2028-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2028-12-25",title:"Christmas Day",notes:""},{date:"2028-12-26",title:"Boxing Day",notes:""}],n='gov.uk/bank-holidays.json (Scotland)'},1176,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setMenuCardBridge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"menuCardBridge",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveItem",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveMenu",{enumerable:!0,get:function(){return m}}),e.sortMenu=c;var t=r(d[0]);let n=null;const o=t=>{n=t},u=()=>n,i=o=>(0,t.overlayItem)(o,n?.cardFor(o.id)),m=t=>c(t.map(i));function c(t){return t.some(t=>'number'==typeof t.sort)?t.map((t,n)=>({m:t,i:n,k:'number'==typeof t.sort?t.sort:10*n})).sort((t,n)=>t.k-n.k||t.i-n.i).map(t=>t.m):t}},1177,[1178]); +__d(function(_g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canEditCards",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canSignOffCards",{enumerable:!0,get:function(){return r}}),e.maySignOff=function(t,n){return'staff'!==t.role&&('head-chef'===t.role||('head-chef'===t.actual||!('owner'!==t.role&&'manager'!==t.role||'owner'!==t.actual&&'manager'!==t.actual)||!!n.createdBy&&t.name.trim()===n.createdBy.trim()&&'head-chef'===n.createdByRole))},Object.defineProperty(e,"SIGNER_ROLE_LABEL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"signerLabel",{enumerable:!0,get:function(){return o}}),e.cardActorFor=function(t,n,r){const i=r?'Head Chef'===r.level&&'staff'===r.role?'head-chef':r.role:n;return{name:t,role:n,actual:i}},Object.defineProperty(e,"MAX_RECIPE_PHOTOS",{enumerable:!0,get:function(){return a}}),e.cardPhotos=s,e.suggestForIngredient=d,e.suggestAllergens=u,Object.defineProperty(e,"suggestedBy",{enumerable:!0,get:function(){return f}}),e.unresolved=g,e.applySuggestions=function(t){const n={...t.allergens};for(const r of g(t))n[r]='contains';return n},Object.defineProperty(e,"cardState",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"STATE_LABEL",{enumerable:!0,get:function(){return h}}),e.signOffBlock=function(t){if(!t.dish.trim())return'Give the dish a name first.';const n=g(t);return n.length?`Check the suggested allergens first: ${n.map(p).join(', ')}.`:t.allergensConfirmed?null:'Confirm the allergen list first.'},Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"CONTENT_FIELDS",{enumerable:!0,get:function(){return y}}),e.editCard=function(t,n,r,i){const{confirmAllergens:o,...a}=n,l={...a};l.photos&&_(s({photo:l.photo??t.photo,photos:l.photos}),s(t))&&(delete l.photos,void 0!==l.photo&&l.photo!==(t.photo??s(t)[0])||delete l.photo);const c=Object.keys(l).filter(n=>!_(l[n],t[n]));let d={...t};for(const t of c)d[t]=l[t];const f=c.some(t=>'allergens'===t||'dismissed'===t||'ingredients'===t);f&&!_(u(d.ingredients),u(t.ingredients))&&(d.allergensConfirmed=void 0);f&&(c.includes('allergens')||c.includes('dismissed'))&&(d.allergensConfirmed=void 0);let m=!1;!o||d.allergensConfirmed||g(d).length||(d.allergensConfirmed={by:r,at:i},m=!0);const h=c.length>0||m,p=c.length>0&&!!t.signOff;if(!h)return{card:t,changed:!1,resetSignOff:!1};c.length&&(d={...d,signOff:null,version:t.version+1});return{card:{...d,updatedAt:i,updatedBy:r},changed:h,resetSignOff:p}},e.signOffCard=function(t,n,r){return{...t,signOff:{by:n,at:r},wasLive:!0,updatedAt:r,updatedBy:n}},e.unsignedOldestFirst=function(t,n){return t.filter(t=>!t.signOff).map((t,r)=>{const i=n(t);return{item:t,card:i,at:i?.createdAt||null,order:r}}).sort((t,n)=>(t.at&&n.at?t.at.localeCompare(n.at):t.at?-1:n.at?1:0)||t.order-n.order)},e.addedLabel=function(t){const n=t?new Date(t.length<=10?`${t}T12:00:00`:t):null;return n&&!isNaN(+n)?`Added ${n.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}`:'Date not recorded'},e.allergenSentence=function(n){const r=t.ALLERGENS.filter(t=>'contains'===n[t.id]).map(t=>t.short.toLowerCase()),i=t.ALLERGENS.filter(t=>'may'===n[t.id]).map(t=>t.short.toLowerCase());return r.length||i.length?[r.length?`Contains ${r.join(', ')}.`:'',i.length?`May contain ${i.join(', ')}.`:''].filter(Boolean).join(' '):'No allergens listed yet.'},Object.defineProperty(e,"isRetiredMiniAnchors",{enumerable:!0,get:function(){return O}}),e.overlayItem=function(t,n){return n?{...t,name:n.dish,section:n.section,price:n.price,allergens:n.allergens,allergenNotes:n.allergenNotes,signOff:n.signOff?{by:n.signOff.by,at:n.signOff.at.slice(0,10)}:null,hidden:t.hidden||!n.signOff&&!n.wasLive||O(t.id)||O(n.menuItemId),recipeCardId:n.id}:O(t.id)?{...t,hidden:!0}:t},e.dishesFor=function(t,n){const r=t.filter(t=>!t.hidden),i=r.filter(t=>n.some(n=>'contains'===t.allergens[n])),o=r.filter(t=>!i.includes(t)&&n.some(n=>'may'===t.allergens[n])),a=r.filter(t=>!i.includes(t)&&!o.includes(t));return{contains:i,may:o,free:a}},e.filterCards=function(t,n,r,i="free-from"){const o=n.toLowerCase().split(/\s+/).filter(Boolean);return t.filter(t=>{const n=[t.dish,t.section,...t.ingredients.map(t=>t.name)].join(' ').toLowerCase();return!!o.every(t=>n.includes(t))&&(!r.length||('free-from'===i?r.every(n=>!t.allergens[n]):r.some(n=>!!t.allergens[n])))})},e.uuid=function(){const t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();const n=Array.from({length:16},()=>Math.floor(256*Math.random()));n[6]=15&n[6]|64,n[8]=63&n[8]|128;const r=n.map(t=>t.toString(16).padStart(2,'0')).join('');return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`},e.uuidFrom=function(t){let n='';for(let r=0;r<4;r++){let i=2166136261^2654435761*r;for(let n=0;n>>0;n+=i.toString(16).padStart(8,'0')}const r=n.slice(0,12)+'4'+n.slice(13,16)+(3&parseInt(n[16],16)|8).toString(16)+n.slice(17,32);return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`},Object.defineProperty(e,"RECIPE_CARD_EXTRA_COLUMNS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STEP_SEP",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"photoPath",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"RECIPE_PHOTO_BUCKET",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"RECIPE_CARD_TABLE",{enumerable:!0,get:function(){return S}}),e.cardToRow=function(t,n){return{row:{id:t.id,venue_id:n,dish:t.dish,ingredients:t.ingredients.map(({name:t,qty:n,unit:r,allergens:i})=>({name:t,qty:n,unit:r,...i?.length?{allergens:i}:{}})),method:t.steps.join(w),allergens:b(t.allergens,'contains'),may_contain:b(t.allergens,'may'),photo_url:!t.photo||t.photo.startsWith('local:')||t.photo.startsWith('asset:')?null:t.photo,signed_off_by:t.signOff?.by??null,signed_off_at:t.signOff?.at??null,updated_at:t.updatedAt},extra:{menu_item_id:t.menuItemId,section:t.section,price_pence:t.price,dismissed:t.dismissed,allergen_notes:t.allergenNotes??null,allergens_confirmed_by:t.allergensConfirmed?.by??null,allergens_confirmed_at:t.allergensConfirmed?.at??null,was_live:t.wasLive,origin:t.origin,version:t.version,updated_by:t.updatedBy}}},e.rowToCard=function(t,n,r={}){const i={};t.may_contain.forEach(t=>{i[t]='may'}),t.allergens.forEach(t=>{i[t]='contains'});const o=t.updated_at??(new Date).toISOString();return{id:t.id,restaurantId:n,menuItemId:r.menu_item_id??t.id,dish:t.dish,section:r.section??'Mains',price:r.price_pence??null,photo:t.photo_url??void 0,ingredients:t.ingredients.map((n,r)=>({id:`${t.id}-i${r}`,...n})),steps:t.method?t.method.split(w).filter(t=>t.trim()):[],allergens:i,dismissed:r.dismissed??[],allergenNotes:r.allergen_notes??void 0,allergensConfirmed:r.allergens_confirmed_by?{by:r.allergens_confirmed_by,at:r.allergens_confirmed_at}:void 0,signOff:t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:t.signed_off_at}:null,wasLive:r.was_live??!!t.signed_off_by,origin:r.origin??'new',version:r.version??1,createdAt:o,updatedAt:o,updatedBy:r.updated_by??''}};var t=_r(_d[0]);const n=t=>'head-chef'===t||'manager'===t||'owner'===t,r=t=>'head-chef'===t||'manager'===t||'owner'===t;const i={'head-chef':'Head Chef',manager:'Manager',owner:'Owner',staff:'Staff'},o=t=>`${t.name}, ${i[t.actual??t.role]}`;const a=5;function s(t){const n=(t.photos??[]).filter(t=>!!t);return[...t.photo&&!n.includes(t.photo)?[t.photo]:[],...n].slice(0,a)}const l=[[/\b(flour(?!y)|wheat|bread|crumb|panko|pastry|brioche|buns?\b|crouton|crostini|batter|beer|ale\b|lager|stout|barley|malt|rye|spelt|oat|couscous|semolina|pasta|penne|macaroni|spaghetti|noodle|biscuit|sponge|crumble|roux|tempura|digestive|self.raising)/i,['gluten']],[/\b(prawn|langoustine|lobster|crab|shrimp|crayfish|scampi|shellfish)/i,['crustaceans']],[/\b(mussel|scallop|clam|cockle|squid|calamari|octopus|whelk|winkle|oyster(?! mushroom)|oyster sauce)/i,['molluscs']],[/\b(egg|mayonnaise|mayo|aioli|tartare|hollandaise|meringue|custard|brioche|bearnaise)/i,['eggs']],[/\b(fish(?!er)|haddock|cod|salmon|hake|anchov|tuna|mackerel|trout|sea bass|monkfish|pollock|halibut|kipper|worcester|fish sauce|caesar)/i,['fish']],[/\b(peanut|groundnut|satay)/i,['peanuts']],[/\b(almond|hazelnut|walnut|cashew|pecan|pistachio|macadamia|brazil nut|praline|frangipane|marzipan|pesto)/i,['treenuts']],[/\b(soy|soya|tofu|edamame|miso|tamari|tempeh)/i,['soya']],[/\b(milk|butter(?!nut)|cream|cheese|cheddar|parmesan|mozzarella|brie|yoghurt|yogurt|cr[e\xe8]me|ghee|ice cream|custard|butterscotch|toffee|fudge|buttermilk|mascarpone|ricotta|whey)/i,['milk']],[/\b(celery|celeriac|stock cube|beef stock|chicken stock|veg(etable)? stock)/i,['celery']],[/\b(mustard|dijon|vinaigrette|piccalilli)/i,['mustard']],[/\b(sesame|tahini|hummus|houmous)/i,['sesame']],[/\b(wine|vinegar|dried apricot|dried fruit|sulphite|sulfite|prosecco|cider|port\b|sherry|dates?\b|raisin|sultana)/i,['sulphites']],[/\blupin/i,['lupin']]],c=[[/gluten.free|\bgf\b/i,'gluten'],[/dairy.free|vegan (butter|cheese|cream)|oat milk|plant.based/i,'milk'],[/egg.free|vegan mayo/i,'eggs']];function d(n){const r=new Set(n.allergens??[]);for(const[t,i]of l)t.test(n.name)&&i.forEach(t=>r.add(t));for(const[t,i]of c)t.test(n.name)&&!(n.allergens??[]).includes(i)&&r.delete(i);return t.ALLERGENS.map(t=>t.id).filter(t=>r.has(t))}function u(n){const r=new Set(n.flatMap(d));return t.ALLERGENS.map(t=>t.id).filter(t=>r.has(t))}const f=(t,n)=>t.filter(t=>d(t).includes(n)).map(t=>t.name);function g(t){return u(t.ingredients).filter(n=>!t.allergens[n]&&!t.dismissed.includes(n))}const m=t=>t.signOff?'signed-off':'awaiting',h={'signed-off':'Signed off',awaiting:'Awaiting sign-off'};const p=n=>t.ALLERGENS.find(t=>t.id===n)?.short??n,b=(n,r)=>t.ALLERGENS.filter(t=>r?n[t.id]===r:!!n[t.id]).map(t=>t.id),y=['dish','section','price','photo','photos','createdBy','ingredients','steps','allergens','dismissed','allergenNotes'],_=(t,n)=>JSON.stringify(t??null)===JSON.stringify(n??null);const O=t=>'a-mini'===t;const v={menu_item_id:'text',section:'text',price_pence:'integer null',dismissed:'text[]',allergen_notes:'text',allergens_confirmed_by:'text',allergens_confirmed_at:'timestamptz',was_live:'boolean',origin:'text',version:'integer',updated_by:'text'},w='\n',E=(t,n)=>`${t}/${n.id}-v${n.version}.jpg`,C='recipe-photos',S='recipe_cards'},1178,[819]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MESSAGING_CONFIG",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"previewProvider",{enumerable:!0,get:function(){return t}}),_e.relayProvider=n,Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"activeProvider",{enumerable:!0,get:function(){return s}});const e={mode:'preview',endpoint:'',smsService:'Twilio',emailService:'Postmark',smsSenderId:'ANCHORAGE',fromEmail:'bookings@your-venue.co.uk'},t={id:'preview',label:'Preview mode (nothing is sent)',live:!1,deliver:async()=>({ok:!0})};function n(e){return{id:'relay',label:'Your messaging server',live:!0,deliver:async t=>{try{const n=await fetch(e,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({channel:t.channel,to:t.to,subject:t.subject,body:t.body,html:t.html,ref:t.ref,kind:t.kind,restaurantId:t.restaurantId})});if(!n.ok)return{ok:!1,error:`Server said ${n.status}`};return{ok:!0,providerId:(await n.json().catch(()=>({}))).id}}catch(e){return{ok:!1,error:e?.message??'Network error'}}}}}const o=()=>'live'===e.mode&&!!e.endpoint,s=()=>o()?n(e.endpoint):t},1179,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"DEFAULT_TEMPLATES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PLACEHOLDERS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"teamName",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"longDate",{enumerable:!0,get:function(){return u}}),e.bookingVars=function(n,r){const o=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen).toLowerCase()}`).join(', '),a=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),i=`${n.partySize} ${1===n.partySize?'person':'people'}`,s={...c(r),first:l(n.name),name:n.name.trim(),date:u(n.date),time:n.time,covers:i,ref:n.ref};return{sms:{...s,allergy:n.allergies.length?` We\u2019ve noted the allergy (${o}) and the team will check it with you when you arrive.`:'',note:'',details:''},email:{...s,allergy:n.allergies.length?`Thank you for telling us about: ${a}. Our team will go through this with you when you arrive, and every dish for your table is checked at each step, from the kitchen to your table.`:'',note:n.notes.trim()?`Your note to us: "${n.notes.trim()}". We\u2019ll make sure the team sees it.`:'',details:[`Date: ${u(n.date)}`,`Time: ${n.time}`,`Table for: ${i}`,`Reference: ${n.ref}`].join('\n')}}},e.orderVars=function(r,o){const a=r.lines.reduce((t,n)=>t+n.qty,0),i=r.readyBy??r.slotTime,s=i?`at ${m(i)}`:'time to be confirmed',d=r.allergies.map(n=>(0,t.allergenLabel)(n.allergen).toLowerCase()).join(', '),u=r.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),y={...c(o),first:l(r.customerName),name:r.customerName,ref:r.ref,items:`${a} ${1===a?'item':'items'}`,total:(0,n.gbp)(r.total),collect:s,date:'',time:i?m(i):'',covers:''};return{sms:{...y,allergy:r.allergies.length?` We\u2019ve noted your allergy (${d}); the kitchen checks every item.`:'',itemList:'',details:'',note:''},email:{...y,allergy:r.allergies.length?`You told us about: ${u}. The kitchen signs off every item against it before your order leaves the pass.`:'',itemList:r.lines.map(t=>`${t.qty} \xd7 ${t.name}${t.choices.length?` (${t.choices.join(', ')})`:''}`).join('\n'),details:[`Order: ${r.ref}`,`Collection: ${i?m(i):'time to be confirmed'}`,`Items: ${a}`,`Total: ${(0,n.gbp)(r.total)}`].join('\n'),note:''}}},e.fill=y,Object.defineProperty(e,"fillEmailText",{enumerable:!0,get:function(){return h}}),e.emailHtml=function(t,n){const r=n.accent??'#B8893E',o=t.split(/\n{2,}/).map(t=>{const n=t.split('\n');return n.length>1&&n.every(t=>/^[^:]{2,22}:\s.+/.test(t))?`${n.map(t=>{const n=t.indexOf(':');return``}).join('')}
${p(t.slice(0,n))}${p(t.slice(n+1).trim())}
`:n.length>1&&n.every(t=>/^\d+ \xd7/.test(t))?`
    ${n.map(t=>`
  • ${p(t)}
  • `).join('')}
`:`

${n.map(p).join('
')}

`}).join('');return`${p(n.preheader??'')}
${p(n.venue.toUpperCase())}
${o}
You\u2019re getting this because you made a booking or order with ${p(n.venue)}. It\u2019s about your booking only, not marketing.
`},e.smsParts=function(t){const n=b(t),r=!f.test(n),o=n.length,a=r?o<=70?1:Math.ceil(o/67):o<=160?1:Math.ceil(o/153);return{chars:o,parts:a,unicode:r}},Object.defineProperty(e,"toGsm",{enumerable:!0,get:function(){return b}});var t=_r(_d[0]),n=_r(_d[1]);const r={booking:{title:'Booking confirmed',when:'Every booking: online, phone or in person (and when you confirm a request)'},request:{title:'Booking request received',when:'Online bookings that need you to confirm them first'},declined:{title:'Booking request declined',when:'When you decline a booking request'},order:{title:'Takeaway order confirmed',when:'Every takeaway order from the app (and phone orders with a number)'}},o={booking:{sms:'Hi {first}, you\u2019re booked in at {venue}: {date} at {time}, {covers}. Ref {ref}.{allergy} Need to change or cancel? Just call {venuePhone}. See you soon, {team}',subject:'You\u2019re booked in at {venue}: {date} at {time}',body:'Hi {first},\n\nThank you for booking with us. We\u2019re really looking forward to welcoming you.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf your plans change, just give us a ring on {venuePhone} and we\u2019ll happily move or cancel it for you. Please quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nWarm wishes,\n{team}'},request:{sms:'Hi {first}, thanks for your booking request at {venue} for {date} at {time}, {covers}. We\u2019ll text you shortly to confirm. Ref {ref}. Questions? Call {venuePhone}. {team}',subject:'We\u2019ve got your booking request for {date}',body:'Hi {first},\n\nThank you for your booking request. A member of the team will look at it and confirm with you very shortly.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf you have any questions in the meantime, call us on {venuePhone} and quote {ref}.\n\nWarm wishes,\n{team}'},declined:{sms:'Hi {first}, we\u2019re so sorry, we can\u2019t fit {covers} in on {date} at {time}. Please call {venuePhone} and we\u2019ll do our best to find another time. {team}',subject:'About your booking request for {date}',body:'Hi {first},\n\nThank you for asking to book with us. We\u2019re really sorry, but we can\u2019t fit your party in on {date} at {time}.\n\nWe\u2019d love to find another time that works. Give us a ring on {venuePhone} and we\u2019ll do our best.\n\nWith apologies and warm wishes,\n{team}'},order:{sms:'Hi {first}, thanks for your order {ref} from {venue}: {items}, {total}. Collection {collect}.{allergy} Questions? Call {venuePhone}. {team}',subject:'Your {venue} order {ref}',body:'Hi {first},\n\nThank you for your order. The kitchen has it and we\u2019ll have it ready for you.\n\n{details}\n\n{itemList}\n\n{allergy}\n\nAny questions, or need to change something? Call us on {venuePhone} and quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nEnjoy!\n{team}'}},a=[{key:'first',what:'Guest\u2019s first name'},{key:'name',what:'Name on the booking'},{key:'venue',what:'Venue name'},{key:'date',what:'Day and date'},{key:'time',what:'Time'},{key:'covers',what:'e.g. 4 people'},{key:'ref',what:'Reference'},{key:'venuePhone',what:'Venue phone'},{key:'address',what:'Venue address'},{key:'team',what:'e.g. The Anchorage team'},{key:'allergy',what:'Allergy reassurance (only if one was noted)'},{key:'note',what:'Their note (email only)'},{key:'details',what:'Details box (email only)'},{key:'items',what:'Orders: e.g. 3 items'},{key:'total',what:'Orders: total'},{key:'collect',what:'Orders: collection time'},{key:'itemList',what:'Orders: list of items (email)'}],i=t=>/^the\s/i.test(t.trim())?`${t.trim()} team`:`The ${t.trim()} team`,l=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||'there',s=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=['January','February','March','April','May','June','July','August','September','October','November','December'],u=t=>{const[n,r,o]=t.split('-').map(Number),a=new Date(n,r-1,o,12);return`${s[a.getDay()]} ${o} ${d[r-1]}`},m=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`};function c(t){return{venue:t.name,venuePhone:t.phone||'the restaurant',address:t.address||t.location,team:i(t.name)}}function y(t,n){return t.replace(/\{(\w+)\}/g,(t,r)=>r in n?n[r]:t).replace(/[ \t]{2,}/g,' ').replace(/ +([.,])/g,'$1').trim()}const h=(t,n)=>y(t,n).split(/\n{2,}/).map(t=>t.trim()).filter(Boolean).join('\n\n'),p=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"');const f=/^[A-Za-z0-9 \r\n@\xa3$\xa5\xe8\xe9\xf9\xec\xf2\xc7\xd8\xf8\xc5\xe5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\xc6\xe6\xdf\xc9!"#\xa4%&'()*+,\-./:;<=>?\xa1\xc4\xd6\xd1\xdc\xa7\xbf\xe4\xf6\xf1\xfc\xe0^{}\\[~\]|\u20ac]*$/;const b=t=>t.replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').replace(/[\u2013\u2014]/g,'-').replace(/\u2026/g,'...').replace(/\xd7/g,'x')},1180,[819,820]); +__d(function(g,_r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PHONE_ERROR",{enumerable:!0,get:function(){return s}}),e.ukPhone=function(s){if(!(s??'').trim())return{ok:!1,error:t};const o=n(r(s));return'bad'in o?{ok:!1,error:'chars'===o.bad?'Please use numbers only, for example 07700 900123.':'That doesn\u2019t look like a UK mobile or landline. For example 07700 900123 or 01292 502826.'}:o},e.guestPhone=function(o){if(!(o??'').trim())return{ok:!1,error:t};const u=r(o);if(/^(\+44|0044)/.test(u)||/^44\d{10}$/.test(u)||!/^(\+|00)/.test(u)){const t=n(u);return'bad'in t?{ok:!1,error:s}:t}const d=u.replace(/^(\+|00)/,'');if(!/^[1-9]\d+$/.test(d))return{ok:!1,error:s};const h=d.slice(0,l(d));let $=d.slice(h.length);$.startsWith('0')&&'39'!==h&&($=$.slice(1));return $.length<7||$.length>15||h.length+$.length>15?{ok:!1,error:s}:{ok:!0,e164:`+${h}${$}`,pretty:`+${h} ${c($)}`,kind:'international'}},e.emailOk=function(t){const s=(t??'').trim();return!s||/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s)};const t='A phone number is needed so we can send the confirmation.',s='That doesn\u2019t look like a phone number. For example 07700 900123 or +971 56 411 2017.';function n(t){if(t.startsWith('+44')?t='0'+t.slice(3):t.startsWith('0044')?t='0'+t.slice(4):/^44\d{10}$/.test(t)&&(t='0'+t.slice(2)),t.startsWith('0(0)')&&(t=t.replace('0(0)','0')),t.startsWith('00')&&(t=t.slice(1)),!/^0\d+$/.test(t))return{bad:'chars'};const s=/^07\d{9}$/.test(t),n=/^0[1238]\d{8,9}$/.test(t);if(!s&&!n)return{bad:'shape'};const r=s?`${t.slice(0,5)} ${t.slice(5)}`:/^02/.test(t)?`${t.slice(0,3)} ${t.slice(3,7)} ${t.slice(7)}`:/^0(3|8)/.test(t)?`${t.slice(0,4)} ${t.slice(4,7)} ${t.slice(7)}`:`${t.slice(0,5)} ${t.slice(5)}`;return{ok:!0,e164:'+44'+t.slice(1),pretty:r,kind:s?'mobile':'landline'}}const r=t=>(t??'').trim().replace(/[\s\-().]/g,'');const o=new Set('20 27 30 31 32 33 34 36 39 40 41 43 44 45 46 47 48 49 51 52 53 54 55 56 57 58 60 61 62 63 64 65 66 81 82 84 86 90 91 92 93 94 95 98'.split(' ')),l=t=>/^[17]/.test(t)?1:o.has(t.slice(0,2))?2:3;function c(t){const s=[t.slice(-4)];let n=t.slice(0,-4);for(;n.length>3;)s.unshift(n.slice(-3)),n=n.slice(0,-3);return n&&s.unshift(n),s.join(' ')}},1181,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shallow",{enumerable:!0,get:function(){return c}});const t=t=>Symbol.iterator in t,n=t=>"entries"in t,o=(t,n)=>{const o=t instanceof Map?t:new Map(t.entries()),s=n instanceof Map?n:new Map(n.entries());if(o.size!==s.size)return!1;for(const[t,n]of o)if(!s.has(t)||!Object.is(n,s.get(t)))return!1;return!0},s=(t,n)=>{const o=t[Symbol.iterator](),s=n[Symbol.iterator]();let c=o.next(),u=s.next();for(;!c.done&&!u.done;){if(!Object.is(c.value,u.value))return!1;c=o.next(),u=s.next()}return!!c.done&&!!u.done};function c(c,u){return!!Object.is(c,u)||"object"==typeof c&&null!==c&&"object"==typeof u&&null!==u&&(Object.getPrototypeOf(c)===Object.getPrototypeOf(u)&&(t(c)&&t(u)?n(c)&&n(u)?o(c,u):s(c,u):o({entries:()=>Object.entries(c)},{entries:()=>Object.entries(u)})))}},1182,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setLiveData=c,e.requireRealData=function(){t=!0,c(!0)},Object.defineProperty(e,"liveData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"examplesAllowed",{enumerable:!0,get:function(){return l}}),e.onDataModeChange=function(n){return s.add(n),()=>{s.delete(n)}},Object.defineProperty(e,"EXAMPLE_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"notEnoughTip",{enumerable:!0,get:function(){return b}});const n=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("abbotsford");let t=n,o=n;const s=new Set;function c(n){o!==(n=t||n)&&(o=n,s.forEach(n=>n()))}const u=()=>o,l=()=>!o;const f='Example figures',b=n=>`Forecasts start once CoverCharge has ${1===n?'1 week':`${n} weeks`} of your bookings and cash-ups.`},1183,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EXAMPLE_TAG",{enumerable:!0,get:function(){return t}}),_e.exampleCards=function(t){return l.flatMap(l=>{const h=t.find(e=>e.id===l.menuItemId);if(!h)return[];return[{id:(0,e.uuidFrom)(`card:${h.restaurantId}:${h.id}`),restaurantId:h.restaurantId,menuItemId:h.id,dish:h.name,section:h.section,price:h.price,photo:l.photo,ingredients:o(l.menuItemId,l.ings),steps:l.steps,allergens:l.allergens,dismissed:l.dismissed??[],allergenNotes:l.notes,allergensConfirmed:{by:s.by,at:s.at},signOff:l.awaiting?null:s,wasLive:!0,origin:'example',version:l.awaiting?2:1,createdAt:n,updatedAt:l.awaiting?'2026-10-28T15:20:00.000Z':n,updatedBy:l.awaiting?'Example edit (demo)':s.by}]})},_e.importedCard=function(t,s){return{id:(0,e.uuidFrom)(`card:${t.restaurantId}:${t.id}`),restaurantId:t.restaurantId,menuItemId:t.id,dish:t.name,section:t.section,price:t.price,ingredients:[],steps:[],allergens:{...t.allergens},dismissed:[],allergenNotes:t.allergenNotes,allergensConfirmed:t.signOff?{by:t.signOff.by,at:t.signOff.at}:void 0,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at}:null,wasLive:!t.hidden||!!t.signOff,origin:'imported',version:1,createdAt:s,updatedAt:s,updatedBy:'Imported from the menu'}};var e=r(d[0]);const t='Example data',s={by:'Example sign-off (demo)',at:'2026-10-26T10:00:00.000Z'},n='2026-10-26T09:00:00.000Z',o=(e,t)=>t.map(([t,s,n],o)=>({id:`${e}-i${o}`,qty:t,unit:s,name:n})),l=[{menuItemId:'a-lobster',photo:'asset:lobster',ings:[['1','whole','Live Dunure lobster (c. 600 g, Kitty Fisher)'],['60','g','Garlic butter'],['\xbd','','Lemon, charred'],['60','g','Mixed leaves, cucumber and red onion'],['15','ml','House vinaigrette (Dijon mustard)'],['200','g','Triple-cooked chips']],steps:['Chill the lobster for 20 minutes, then dispatch humanely and split lengthways. Remove the stomach sac and the intestinal tract.','Crack the claws. Season the flesh and spoon over half the garlic butter.','Grill flesh side up for 6\u20138 minutes until just opaque; baste with the rest of the butter.','Char the lemon on the grill. Dress the salad at the pass.','Plate on the long board: lobster, claws alongside, salad, chips in the cone, lemon and a pot of the pan butter.'],allergens:{crustaceans:'contains',milk:'contains',mustard:'contains',gluten:'may',fish:'may'},notes:'Chips are cooked in a shared fryer (gluten, fish, crustaceans may be present).'},{menuItemId:'a-skink',photo:'asset:skink',ings:[['120','g','Smoked haddock, undyed'],['200','ml','Whole milk'],['20','g','Butter'],['60','g','Leek, sliced'],['40','g','Onion, diced'],['120','g','Floury potato, diced'],['1','tbsp','Parsley, chopped'],['1','slice','Crusty bread'],['10','g','Butter (portion)']],steps:['Poach the haddock in the milk for 5 minutes. Lift out, flake and keep the milk.','Sweat the leek and onion in the butter until soft, with no colour.','Add the potato and the poaching milk; simmer for 15 minutes until the potato breaks down.','Crush a third of the potato for body, return the haddock and season with pepper.','Serve in the warm bowl, parsley on top, bread and butter on the side.'],allergens:{fish:'contains',milk:'contains',gluten:'contains'}},{menuItemId:'a-fishsupper',photo:'asset:fishsupper',ings:[['200','g','Haddock fillet, locally landed'],['80','g','Self-raising flour'],['100','ml','Beer (lager)'],['250','g','Triple-cooked chips'],['80','g','Garden peas'],['10','g','Butter'],['40','g','Tartare sauce (mayonnaise, capers, gherkins)'],['\xbc','','Lemon']],steps:['Whisk the flour and cold beer to a thick batter; rest for 10 minutes.','Dust the haddock in flour, dip in the batter and lower into the fryer at 180 \xb0C for 5\u20136 minutes.','Fry the chips at 190 \xb0C until golden.','Warm the peas with the butter.','Plate the fish on the chips, peas in the ramekin, tartare and lemon on the side.'],allergens:{fish:'contains',gluten:'contains',eggs:'contains',milk:'contains',mustard:'may',crustaceans:'may',sulphites:'may'},notes:'Shared fryer. Tartare is made with mayonnaise (egg, may contain mustard). The beer in the batter may contain sulphites.'},{menuItemId:'a-moules',photo:'asset:moules',ings:[['500','g','Scottish rope mussels, cleaned'],['30','g','Butter'],['1','','Shallot, finely diced'],['2','cloves','Garlic, sliced'],['100','ml','Dry white wine'],['60','ml','Double cream'],['1','tbsp','Parsley, chopped'],['2','slices','Crusty bread']],steps:['Check every mussel: discard any that are cracked or stay open when tapped.','Sweat the shallot and garlic in the butter for 2 minutes.','Add the mussels and wine, cover and steam on a high heat for 3\u20134 minutes until they open.','Discard any that stay shut. Stir in the cream and parsley.','Serve in the deep bowl with the bread and an empty-shell bowl.'],allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',gluten:'contains'}},{menuItemId:'a-stp',photo:'asset:stp',awaiting:!0,ings:[['30','g','Medjool dates, chopped'],['40','ml','Boiling water'],['25','g','Butter'],['30','g','Dark muscovado sugar'],['1','','Egg (\xbd per portion)'],['35','g','Self-raising flour'],['60','ml','Butterscotch sauce (butter, cream, brown sugar)']],steps:['Soak the dates in the boiling water for 10 minutes, then blitz.','Cream the butter and sugar, beat in the egg, fold in the flour and the dates.','Steam in buttered moulds for 35 minutes.','Warm the butterscotch sauce.','Turn out, pour over the sauce and serve with the guest\u2019s choice of custard, ice cream or cream.'],allergens:{gluten:'contains',milk:'contains',eggs:'contains',sulphites:'may'},notes:'Dried dates may contain sulphites. Accompaniments are chosen at order (see the dish options).'}]},1184,[1178]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg",width:800,height:600,toString(){return this.uri}}},1185,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg",width:800,height:600,toString(){return this.uri}}},1186,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},1187,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},1188,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},1189,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAvatars",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),o=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]);const l=(0,s.create)()((0,n.persist)((e,t)=>({photos:{},log:[],clears:{},doneClear:t=>e(e=>{if(!e.clears?.[t])return e;const o={...e.clears};return delete o[t],{clears:o}}),setOwn:(t,o,s,n)=>{if(!t||t!==o||!s.startsWith('data:image/'))return!1;const l=(new Date).toISOString();return e(e=>({clears:Object.fromEntries(Object.entries(e.clears??{}).filter(([e])=>e!==o)),photos:{...e.photos,[o]:{dataUrl:s,at:l}},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'made',by:n,at:l},...e.log].slice(0,100)})),!0},reset:(o,s)=>{if(s.id!==o&&'staff'===s.role)return!1;if(!t().photos[o])return!1;const n={...t().photos};return delete n[o],e(e=>({photos:n,clears:{...e.clears??{},[o]:(new Date).toISOString()},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'reset',by:s.name,at:(new Date).toISOString()},...e.log].slice(0,100)})),!0}}),{name:'covercharge-avatars-v1',storage:(0,n.createJSONStorage)(()=>o.default),version:1}))},1190,[1160,995,1169]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOON_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"setVenueWords",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"getVenueWords",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"setSessionMender",{enumerable:!0,get:function(){return l}}),e.askServer=async function o(c,u,p,l,f=!0){try{const b=(0,t.getSupabase)().functions.invoke(n,{body:{app:c,text:u,tools:p,...l?{receipt:l,spoken:!0,vocab:s}:{}}}),k=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),1e4)),{data:w,error:v}=await Promise.race([b,k]);return f&&'identity'===w?.reason&&await y()?o(c,u,p,l,!1):v||!w||!0!==w.ready||w.busy?{kind:'soon'}:w.call?.name?{kind:'call',name:String(w.call.name),args:w.call.args??{}}:'string'==typeof w.text&&w.text.trim()?{kind:'text',text:w.text.trim()}:{kind:'soon'}}catch{return{kind:'soon'}}},e.transcribe=async function n(o,c,u=8e3,p=!0){try{const l=/mp4|m4a|aac/.test(c.type)?'m4a':/ogg/.test(c.type)?'ogg':/wav/.test(c.type)?'wav':'webm',b=new FormData;b.append('app',o),s.length&&b.append('keyterms',JSON.stringify(s)),b.append('file',c,`speech.${l}`);const k=(0,t.getSupabase)().functions.invoke(f,{body:b}),w=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),u)),{data:v,error:x}=await Promise.race([k,w]);return x?{ok:!1,reason:'timeout'===String(x?.message)?'timeout':'offline'}:!0===v?.ok?{ok:!0,text:String(v.text??''),receipt:'string'==typeof v.receipt?v.receipt:void 0}:p&&'identity'===v?.reason&&await y()?n(o,c,u,!1):{ok:!1,reason:String(v?.reason??'busy'),text:'string'==typeof v?.text?v.text:void 0}}catch{return{ok:!1,reason:'offline'}}};var t=r(d[0]);const n='voice-assistant',o='Voice assistant is switching on soon. Until then I can do the everyday things, for example';let s=[];const c=t=>{s=t.slice(0,100)},u=()=>s;let p=null;const l=t=>{p=t};async function y(){try{return!!p&&await p()}catch{return!1}}const f='voice-transcribe'},1191,[872]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FunctionRegion",{enumerable:!0,get:function(){return e.FunctionRegion}}),Object.defineProperty(_e,"FunctionsError",{enumerable:!0,get:function(){return e.FunctionsError}}),Object.defineProperty(_e,"FunctionsFetchError",{enumerable:!0,get:function(){return e.FunctionsFetchError}}),Object.defineProperty(_e,"FunctionsHttpError",{enumerable:!0,get:function(){return e.FunctionsHttpError}}),Object.defineProperty(_e,"FunctionsRelayError",{enumerable:!0,get:function(){return e.FunctionsRelayError}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return t.PostgrestError}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return r.StorageApiError}}),Object.defineProperty(_e,"SupabaseClient",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"createClient",{enumerable:!0,get:function(){return N}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]);Object.keys(n).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return n[e]}})});var r=_r(d[3]),s=_r(d[4]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});let o,i="";var c;if("undefined"!=typeof Deno)i="deno",o=null===(c=Deno.version)||void 0===c?void 0:c.deno;else if("undefined"!=typeof document)i="web";else if("undefined"!=typeof navigator&&"ReactNative"===navigator.product)i="react-native";else{var u;i="node",o="undefined"!=typeof process?null===(u=process.version)||void 0===u?void 0:u.replace(/^v/,""):void 0}const l=[`runtime=${i}`];o&&l.push(`runtime-version=${o}`);const h={headers:{"X-Client-Info":`supabase-js/2.109.0; ${l.join("; ")}`}},f={schema:"public"},p={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},b={},v={enabled:!1,respectSamplingDecision:!0};let y=null;function w(){return e=this,t=void 0,r=function*(){try{const e=yield(null===y&&(y=import("@opentelemetry/api").catch(()=>null)),y);if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch(e){return null}},new((n=void 0)||(n=Promise))(function(s,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function c(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,c)}u((r=r.apply(e,t||[])).next())});var e,t,n,r}function k(e){if(!e||"string"!=typeof e)return null;const t=e.split("-");if(4!==t.length)return null;const[n,r,s,o]=t;if(2!==n.length||32!==r.length||16!==s.length||2!==o.length)return null;const i=/^[0-9a-f]+$/i;return i.test(n)&&i.test(r)&&i.test(s)&&i.test(o)?"00000000000000000000000000000000"===r||"0000000000000000"===s?null:{version:n,traceId:r,parentId:s,traceFlags:o,isSampled:!(1&~parseInt(o,16))}:null}function O(e,t){if(!e||!t||0===t.length)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch(e){return!1}for(const e of t)try{if("string"==typeof e){if(T(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if("function"==typeof e&&e(n))return!0}catch(e){continue}return!1}function T(e,t){if(t===e)return!0;if(t.startsWith("*.")){const n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith("."+n)))return!0}return!1}function P(e){const t=[];try{const n=new URL(e);t.push(n.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=j(e,"string");return"symbol"==S(t)?t:t+""}function U(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;te?(...t)=>e(...t):(...e)=>fetch(...e),F=(e,t,n,r,s)=>{const o=C(r),i=Headers,c=!0===(null==s?void 0:s.enabled),u=!1!==(null==s?void 0:s.respectSamplingDecision),l=c?P(t):null;return async(t,r)=>{var s;const c=null!==(s=await n())&&void 0!==s?s:e;let h=new i(null==r?void 0:r.headers);if(h.has("apikey")||h.set("apikey",e),h.has("Authorization")||h.set("Authorization",`Bearer ${c}`),l){const e=await _(t,l,u);e&&(e.traceparent&&!h.has("traceparent")&&h.set("traceparent",e.traceparent),e.tracestate&&!h.has("tracestate")&&h.set("tracestate",e.tracestate),e.baggage&&!h.has("baggage")&&h.set("baggage",e.baggage))}return o(t,R(R({},r),{},{headers:h}))}};async function _(e,t,n){if(!O("string"==typeof e||e instanceof URL?e:e.url,t))return null;const r=await w();if(!r||!r.traceparent)return null;if(n){const e=k(r.traceparent);if(e&&!e.isSampled)return null}return r}function L(e){return"boolean"==typeof e?{enabled:e}:e}function I(e,t){var n,r,s,o,i,c;const{db:u,auth:l,realtime:h,global:f}=e,{db:p,auth:b,realtime:v,global:y}=t,w=L(e.tracePropagation),k=L(t.tracePropagation),O={db:R(R({},p),u),auth:R(R({},b),l),realtime:R(R({},v),h),storage:{},global:R(R(R({},y),f),{},{headers:R(R({},null!==(n=null==y?void 0:y.headers)&&void 0!==n?n:{}),null!==(r=null==f?void 0:f.headers)&&void 0!==r?r:{})}),tracePropagation:{enabled:null!==(s=null!==(o=null==w?void 0:w.enabled)&&void 0!==o?o:null==k?void 0:k.enabled)&&void 0!==s&&s,respectSamplingDecision:null===(i=null!==(c=null==w?void 0:w.respectSamplingDecision)&&void 0!==c?c:null==k?void 0:k.respectSamplingDecision)||void 0===i||i},accessToken:async()=>""};return e.accessToken?O.accessToken=e.accessToken:delete O.accessToken,O}function D(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((n=t).endsWith("/")?n:n+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var n}var K=class extends s.AuthClient{constructor(e){super(e)}},x=class{constructor(e,n,s){var o,i;this.supabaseUrl=e,this.supabaseKey=n;const c=D(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,l=I(null!=s?s:{},{db:f,realtime:b,auth:R(R({},p),{},{storageKey:u}),global:h,tracePropagation:v});var y;(this.settings=l,this.storageKey=null!==(o=l.auth.storageKey)&&void 0!==o?o:"",this.headers=null!==(i=l.global.headers)&&void 0!==i?i:{},l.accessToken)?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!==(y=l.auth)&&void 0!==y?y:{},this.headers,l.global.fetch);this.fetch=F(n,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(R({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new t.PostgrestClient(new URL("rest/v1",c).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new r.StorageClient(this.storageUrl.href,this.headers,this.fetch,null==s?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new e.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t,n=this;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return null!==(e=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:o,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,lockAcquireTimeout:f,skipAutoInitialize:p},b,v){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K({url:this.authUrl.href,headers:R(R({},y),b),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,fetch:v,lockAcquireTimeout:f,skipAutoInitialize:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new n.RealtimeClient(this.realtimeUrl.href,R(R({},e),{},{params:R(R({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,n){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===n?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=n,this.realtime.setAuth(n))}};const N=(e,t,n)=>new x(e,t,n);(function(){if("undefined"!=typeof window)return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(null==t)return!1;const n=t.match(/^v(\d+)\./);return!!n&&parseInt(n[1],10)<=18})()&&console.warn("\u26a0\ufe0f Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")},1192,[1193,1198,1199,1214,1216]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return n.FunctionsClient}}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t.FunctionsError}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return t.FunctionsFetchError}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return t.FunctionsHttpError}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return t.FunctionsRelayError}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return t.FunctionRegion}});var n=r(d[0]),t=r(d[1])},1193,[1194,1197]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]),o=r(d[2]);class s{constructor(t,{headers:s={},customFetch:c,region:l=o.FunctionRegion.Any}={}){this.url=t,this.headers=s,this.region=l,this.fetch=(0,n.resolveFetch)(c)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(n){return(0,t.__awaiter)(this,arguments,void 0,function*(t,n={}){var s;let c,l;try{const{headers:u,method:f,body:h,signal:p,timeout:y}=n;let b={},{region:F}=n;F||(F=this.region);const v=new URL(`${this.url}/${t}`);let w;F&&'any'!==F&&(b['x-region']=F,v.searchParams.set('forceFunctionRegion',F));const j=!!u&&Object.keys(u).some(t=>'content-type'===t.toLowerCase());h&&!j?'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer?(b['Content-Type']='application/octet-stream',w=h):'string'==typeof h?(b['Content-Type']='text/plain',w=h):'undefined'!=typeof FormData&&h instanceof FormData?w=h:(b['Content-Type']='application/json',w=JSON.stringify(h)):w=!h||'string'==typeof h||'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer||'undefined'!=typeof FormData&&h instanceof FormData?h:JSON.stringify(h);let O=p;y&&(l=new AbortController,c=setTimeout(()=>l.abort(),y),p?(O=l.signal,p.addEventListener('abort',()=>l.abort())):O=l.signal);const x=yield this.fetch(v.toString(),{method:f||'POST',headers:Object.assign(Object.assign(Object.assign({},b),this.headers),u),body:w,signal:O}).catch(t=>{throw new o.FunctionsFetchError(t)}),B=x.headers.get('x-relay-error');if(B&&'true'===B)throw new o.FunctionsRelayError(x);if(!x.ok)throw new o.FunctionsHttpError(x);let C,T=(null!==(s=x.headers.get('Content-Type'))&&void 0!==s?s:'text/plain').split(';')[0].trim();return C='application/json'===T?yield x.json():'application/octet-stream'===T||'application/pdf'===T?yield x.blob():'text/event-stream'===T?x:'multipart/form-data'===T?yield x.formData():yield x.text(),{data:C,error:null,response:x}}catch(t){return{data:null,error:t,response:t instanceof o.FunctionsHttpError||t instanceof o.FunctionsRelayError?t.context:void 0}}finally{c&&clearTimeout(c)}})}}},1194,[1195,1196,1197]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return G}}),_e.__extends=t,Object.defineProperty(_e,"__assign",{enumerable:!0,get:function(){return r}}),_e.__rest=n,_e.__decorate=o,_e.__param=a,_e.__esDecorate=i,_e.__runInitializers=c,_e.__propKey=u,_e.__setFunctionName=s,_e.__metadata=f,_e.__awaiter=l,_e.__generator=p,Object.defineProperty(_e,"__createBinding",{enumerable:!0,get:function(){return y}}),_e.__exportStar=_,_e.__values=d,_e.__read=h,_e.__spread=b,_e.__spreadArrays=v,_e.__spreadArray=w,_e.__await=m,_e.__asyncGenerator=g,_e.__asyncDelegator=O,_e.__asyncValues=j,_e.__makeTemplateObject=P,_e.__importStar=x,_e.__importDefault=T,_e.__classPrivateFieldGet=I,_e.__classPrivateFieldSet=D,_e.__classPrivateFieldIn=R,_e.__addDisposableResource=k,_e.__disposeResources=F,_e.__rewriteRelativeImportExtension=C;var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){return function(r,n){t(r,n,e)}}function i(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,s="getter"===u?"get":"setter"===u?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,y=r.length-1;y>=0;y--){var _={};for(var d in n)_[d]="access"===d?{}:n[d];for(var d in n.access)_.access[d]=n.access[d];_.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[y])("accessor"===u?{get:l.get,set:l.set}:l[s],_);if("accessor"===u){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(c=i(h.get))&&(l.get=c),(c=i(h.set))&&(l.set=c),(c=i(h.init))&&o.unshift(c)}else(c=i(h))&&("field"===u?o.unshift(c):l[s]=c)}f&&Object.defineProperty(f,n.name,l),p=!0}function c(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function b(){for(var e=[],t=0;t1||c(e,t)})},t&&(n[e]=t(n[e])))}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,s):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:!1}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=d(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){o(n,a,(t=e[r](t)).done,t.value)})}}function o(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},E=function(e){return E=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},E(e)};function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=E(e),n=0;nt?(...n)=>t(...n):(...t)=>fetch(...t)},1196,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return u}});class t extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class n extends t{constructor(t){super('Failed to send a request to the Edge Function','FunctionsFetchError',t)}}class s extends t{constructor(t){super('Relay Error invoking the Edge Function','FunctionsRelayError',t)}}class o extends t{constructor(t){super('Edge Function returned a non-2xx status code','FunctionsHttpError',t)}}var u;!(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(u||(u={}))},1197,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PostgrestBuilder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"PostgrestClient",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"PostgrestFilterBuilder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"PostgrestQueryBuilder",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PostgrestTransformBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});const e=e=>Math.min(1e3*2**e,3e4),t=[520,503],r=["GET","HEAD","OPTIONS"];var s=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function n(e,t){return new Promise(r=>{if(null==t?void 0:t.aborted)return void r();const s=setTimeout(()=>{null==t||t.removeEventListener("abort",n),r()},e);function n(){clearTimeout(s),r()}null==t||t.addEventListener("abort",n)})}function i(e,s,n,i){return!(!i||n>=3)&&(!!r.includes(e)&&!!t.includes(s))}var l=class{constructor(e){var t,r,s,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,this.shouldStripNulls=null!==(s=e.shouldStripNulls)&&void 0!==s&&s,this.urlLengthLimit=null!==(n=e.urlLengthLimit)&&void 0!==n?n:8e3,this.retryEnabled=null===(i=e.retry)||void 0===i||i,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if("text/csv"===this.headers.get("Accept"))throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(t,s){var l=this;if(void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const e=this.headers.get("Accept");"application/vnd.pgrst.object+json"===e?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):e&&"application/json"!==e||this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const o=this.fetch;let h=(async()=>{let t=0;for(;;){const u={};let c;l.headers.forEach((e,t)=>{u[t]=e}),t>0&&(u["X-Retry-Count"]=String(t));try{c=await o(l.url.toString(),{method:l.method,headers:u,body:JSON.stringify(l.body,(e,t)=>"bigint"==typeof t?t.toString():t),signal:l.signal})}catch(s){if("AbortError"===(null==s?void 0:s.name)||"ABORT_ERR"===(null==s?void 0:s.code))throw s;if(!r.includes(l.method))throw s;if(l.retryEnabled&&t<3){const r=e(t);t++,await n(r,l.signal);continue}throw s}if(i(l.method,c.status,t,l.retryEnabled)){var s,h;const r=null!==(s=null===(h=c.headers)||void 0===h?void 0:h.get("Retry-After"))&&void 0!==s?s:null,i=null!==r?1e3*Math.max(0,parseInt(r,10)||0):e(t);await c.text(),t++,await n(i,l.signal);continue}return await l.processResponse(c)}})();return this.shouldThrowOnError||(h=h.catch(e=>{var t;let r="",s="",n="";const i=null==e?void 0:e.cause;if(i){var l,o,h,u;const t=null!==(l=null==i?void 0:i.message)&&void 0!==l?l:"",s=null!==(o=null==i?void 0:i.code)&&void 0!==o?o:"";r=`${null!==(h=null==e?void 0:e.name)&&void 0!==h?h:"FetchError"}: ${null==e?void 0:e.message}`,r+=`\n\nCaused by: ${null!==(u=null==i?void 0:i.name)&&void 0!==u?u:"Error"}: ${t}`,s&&(r+=` (${s})`),(null==i?void 0:i.stack)&&(r+=`\n${i.stack}`)}else{var c;r=null!==(c=null==e?void 0:e.stack)&&void 0!==c?c:""}const p=this.url.toString().length;return"AbortError"===(null==e?void 0:e.name)||"ABORT_ERR"===(null==e?void 0:e.code)?(n="",s="Request was aborted (timeout or manual cancellation)",p>this.urlLengthLimit&&(s+=`. Note: Your request URL is ${p} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):"HeadersOverflowError"!==(null==i?void 0:i.name)&&"UND_ERR_HEADERS_OVERFLOW"!==(null==i?void 0:i.code)||(n="",s="HTTP headers exceeded server limits (typically 16KB)",p>this.urlLengthLimit&&(s+=`. Your request URL is ${p} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:r,hint:s,code:n},data:null,count:null,status:0,statusText:""}})),h.then(t,s)}async processResponse(e){var t=this;let r=null,n=null,i=null,l=e.status,o=e.statusText;if(e.ok){var h,u;if("HEAD"!==t.method){var c;const i=await e.text();if(""===i);else if("text/csv"===t.headers.get("Accept"))n=i;else if(t.headers.get("Accept")&&(null===(c=t.headers.get("Accept"))||void 0===c?void 0:c.includes("application/vnd.pgrst.plan+text")))n=i;else try{n=JSON.parse(i)}catch(e){if(r={message:i},n=null,t.shouldThrowOnError)throw new s({message:i,details:"",hint:"",code:""})}}const p=null===(h=t.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),f=null===(u=e.headers.get("content-range"))||void 0===u?void 0:u.split("/");p&&f&&f.length>1&&(i=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,i=null,l=406,o="Not Acceptable"):n=1===n.length?n[0]:null)}else{const i=await e.text();try{r=JSON.parse(i),Array.isArray(r)&&404===e.status&&(n=[],r=null,l=200,o="OK")}catch(t){404===e.status&&""===i?(l=204,o="No Content"):r={message:i}}if(r&&t.shouldThrowOnError)throw new s(r)}return{success:null===r,error:r,data:n,count:i,status:l,statusText:o}}returns(){return this}overrideTypes(){return this}},o=class extends l{throwOnError(){return super.throwOnError()}select(e){let t=!1;const r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":("\""===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.order`:"order",l=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const n=void 0===s?"offset":`${s}.offset`,i=void 0===s?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(i,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:n=!1,format:i="text"}={}){var l;const o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,n?"wal":null].filter(Boolean).join("|"),h=null!==(l=this.headers.get("Accept"))&&void 0!==l?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${h}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const h=new RegExp("[,()]");var u=class extends o{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let n="";"plain"===s?n="pl":"phrase"===s?n="ph":"websearch"===s&&(n="w");const i=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${n}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>void 0!==t).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},c=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=null!=t?t:{},n=r?"HEAD":"GET";let i=!1;const l=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":("\""===e&&(i=!i),e)).join(""),{url:o,headers:h}=this.cloneRequestState();return o.searchParams.set("select",l),s&&h.append("Prefer",`count=${s}`),new u({method:n,url:o,headers:h,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const{url:n,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),r||i.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);n.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:n,headers:i,schema:this.schema,body:e,fetch:null!==(s=this.fetch)&&void 0!==s?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!0}={}){var i;const{url:l,headers:o}=this.cloneRequestState();if(o.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&l.searchParams.set("on_conflict",t),s&&o.append("Prefer",`count=${s}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);l.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:l,headers:o,schema:this.schema,body:e,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const{url:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new u({method:"PATCH",url:s,headers:n,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new u({method:"DELETE",url:r,headers:s,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=p(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=f(e,"string");return"symbol"==p(t)?t:t+""}function v(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function P(e){for(var t=1;t0?(e,t)=>{const r=new AbortController,s=setTimeout(()=>r.abort(),n),i=null==t?void 0:t.signal;if(i){if(i.aborted)return clearTimeout(s),o(e,t);const n=()=>{clearTimeout(s),r.abort()};return i.addEventListener("abort",n,{once:!0}),o(e,P(P({},t),{},{signal:r.signal})).finally(()=>{clearTimeout(s),i.removeEventListener("abort",n)})}return o(e,P(P({},t),{},{signal:r.signal})).finally(()=>clearTimeout(s))}:o,this.retry=l}from(e){if(!e||"string"!=typeof e||""===e.trim())throw new Error("Invalid relation name: relation must be a non-empty string.");return new c(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:s=!1,count:n}={}){var i;let l;const o=new URL(`${this.url}/rpc/${e}`);let h;const c=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(c)),p=r&&Object.values(t).some(c);p?(l="POST",h=t):r||s?(l=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{o.searchParams.append(e,t)})):(l="POST",h=t);const f=new Headers(this.headers);return p?f.set("Prefer",n?`count=${n},return=minimal`:"return=minimal"):n&&f.set("Prefer",`count=${n}`),new u({method:l,url:o,headers:f,schema:this.schemaName,body:h,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},w={PostgrestClient:$,PostgrestQueryBuilder:c,PostgrestFilterBuilder:u,PostgrestTransformBuilder:o,PostgrestBuilder:l,PostgrestError:s}},1198,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RealtimePresence",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"RealtimeChannel",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(_e,"RealtimeClient",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return n.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e,"postgresChangesFilter",{enumerable:!0,get:function(){return n.postgresChangesFilter}}),Object.defineProperty(_e,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n.REALTIME_LISTEN_TYPES}}),Object.defineProperty(_e,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return n.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return u.REALTIME_PRESENCE_LISTEN_EVENTS}}),Object.defineProperty(_e,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return n.REALTIME_SUBSCRIBE_STATES}}),Object.defineProperty(_e,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return n.REALTIME_CHANNEL_STATES}}),Object.defineProperty(_e,"WebSocketFactory",{enumerable:!0,get:function(){return l.default}});var t=e(r(d[0])),n=r(d[1]),E=e(n),u=r(d[2]),o=e(u),l=e(r(d[3]))},1199,[1200,1206,1207,1201]); +__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,"default",{enumerable:!0,get:function(){return f}});var t=e(r(d[0])),n=r(d[1]),s=e(r(d[2])),o=r(d[3]),c=e(r(d[4])),l=e(r(d[5]));const h=25e3,u=[1e3,2e3,5e3,1e4];function k(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem:t=>e.has(t)?e.get(t):null,key(t){var n;return null!==(n=Array.from(e.keys())[t])&&void 0!==n?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function p(){try{if('undefined'!=typeof globalThis&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(e){}return k()}class f{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint='',this.headers={},this.params={},this.ref=0,this.serializer=new s.default,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey))throw new Error('API key is required to connect to Realtime');this.apiKey=t.params.apikey;const c=this._initializeOptions(t);this.socketAdapter=new l.default(e,c),this.httpEndpoint=(0,o.httpEndpointURL)(e),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely('connect'),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const t=e.message;if(t.includes('Node.js'))throw new Error(`${t}\n\nTo use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n npm install ws\n\n import ws from "ws"\n const client = new RealtimeClient(url, {\n ...options,\n transport: ws\n })`);throw new Error(`WebSocket not available: ${t}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return this._cancelPendingDisconnect(),this.isDisconnecting()?'ok':await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return'ok'===t&&e.teardown(),t}async removeAllChannels(){const e=this.channels.map(async e=>{const t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,n){this.socketAdapter.log(e,t,n)}connectionState(){return this.socketAdapter.connectionState()||n.CONNECTION_STATE.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(e=>e.topic===n);if(s)return s;{const n=new c.default(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(n),n}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),0===this.channels.length&&(this.log('transport','no channels remaining, scheduling disconnect'),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),0===this._disconnectOnEmptyChannelsAfterMs)return this.log('transport','disconnecting immediately - no channels'),void this.disconnect();this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,0===this.channels.length&&(this.log('transport','deferred disconnect fired - no channels, disconnecting'),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log('transport',`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){null!==this._pendingDisconnectTimer&&(this.log('transport','pending disconnect cancelled - channel activity detected'),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let t,s=!1;if(e)t=e,s=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(e){this.log('error','Error fetching access token from callback',e),t=this.accessTokenValue}else t=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{const s={access_token:t,version:n.DEFAULT_VERSION};t&&e.updateJoinPayload(s),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(n.CHANNEL_EVENTS.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log('error',`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log('error','error waiting for auth on connect',e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,n)=>{'sent'==t&&this._setAuthSafely(),e&&e(t,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log('worker',`starting worker for from ${this.workerUrl}`):this.log('worker',"starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log('worker','worker error',e.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=e=>{'keepAlive'===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:'start',interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log('worker','terminating worker'),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{const e=new Blob(["\n addEventListener(\"message\", (e) => {\n if (e.data.event === \"start\") {\n setInterval(() => postMessage({ event: \"keepAlive\" }), e.data.interval);\n }\n });"],{type:'application/javascript'});t=URL.createObjectURL(e)}return t}_initializeOptions(e){var s,o,c,l,k,f,_,v,w,b,A,T;this.worker=null!==(s=null==e?void 0:e.worker)&&void 0!==s&&s,this.accessToken=null!==(o=null==e?void 0:e.accessToken)&&void 0!==o?o:null;const y={};let C,R;y.timeout=null!==(c=null==e?void 0:e.timeout)&&void 0!==c?c:n.DEFAULT_TIMEOUT,y.heartbeatIntervalMs=null!==(l=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==l?l:h,this._disconnectOnEmptyChannelsAfterMs=null!==(k=null==e?void 0:e.disconnectOnEmptyChannelsAfterMs)&&void 0!==k?k:2*(null!==(f=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==f?f:h),y.transport=null!==(_=null==e?void 0:e.transport)&&void 0!==_?_:t.default.getWebSocketConstructor(),y.params=null==e?void 0:e.params,y.logger=null==e?void 0:e.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(null==e?void 0:e.heartbeatCallback),y.sessionStorage=null!==(v=null==e?void 0:e.sessionStorage)&&void 0!==v?v:p(),y.reconnectAfterMs=null!==(w=null==e?void 0:e.reconnectAfterMs)&&void 0!==w?w:e=>u[e-1]||1e4;const E=null!==(b=null==e?void 0:e.vsn)&&void 0!==b?b:n.DEFAULT_VSN;switch(E){case n.VSN_1_0_0:C=(e,t)=>t(JSON.stringify(e)),R=(e,t)=>t(JSON.parse(e));break;case n.VSN_2_0_0:C=this.serializer.encode.bind(this.serializer),R=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=E,y.encode=null!==(A=null==e?void 0:e.encode)&&void 0!==A?A:C,y.decode=null!==(T=null==e?void 0:e.decode)&&void 0!==T?T:R,y.beforeReconnect=this._reconnectAuth.bind(this),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if('undefined'!=typeof window&&!window.Worker)throw new Error('Web Worker is not supported');this.workerUrl=null==e?void 0:e.workerUrl,y.autoSendHeartbeat=!this.worker}return y}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}},1200,[1201,1202,1204,1205,1206,1213]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebSocketFactory",{enumerable:!0,get:function(){return t}});class t{constructor(){}static detectEnvironment(){var t;if('undefined'!=typeof WebSocket)return{type:'native',wsConstructor:WebSocket};const o=globalThis;if('undefined'!=typeof globalThis&&void 0!==o.WebSocket)return{type:'native',wsConstructor:o.WebSocket};const n=void 0!==g?g:void 0;if(n&&void 0!==n.WebSocket)return{type:'native',wsConstructor:n.WebSocket};if('undefined'!=typeof globalThis&&void 0!==o.WebSocketPair&&void 0===globalThis.WebSocket)return{type:'cloudflare',error:'Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.',workaround:'Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.'};if('undefined'!=typeof globalThis&&o.EdgeRuntime||'undefined'!=typeof navigator&&(null===(t=navigator.userAgent)||void 0===t?void 0:t.includes('Vercel-Edge')))return{type:'unsupported',error:'Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.',workaround:'Use serverless functions or a different deployment target for WebSocket functionality.'};const s=globalThis.process;if(s){const t=s.versions;if(t&&t.node){const o=t.node,n=parseInt(o.replace(/^v/,'').split('.')[0]);return n>=22?void 0!==globalThis.WebSocket?{type:'native',wsConstructor:globalThis.WebSocket}:{type:'unsupported',error:`Node.js ${n} detected but native WebSocket not found.`,workaround:'Provide a WebSocket implementation via the transport option.'}:{type:'unsupported',error:`Node.js ${n} detected without native WebSocket support.`,workaround:"For Node.js < 22, install \"ws\" package and provide it via the transport option:\nimport ws from \"ws\"\nnew RealtimeClient(url, { transport: ws })"}}}return{type:'unsupported',error:'Unknown JavaScript runtime without WebSocket support.',workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let o=t.error||'WebSocket not supported in this environment.';throw t.workaround&&(o+=`\n\nSuggested solution: ${t.workaround}`),new Error(o)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return'native'===t.type||'ws'===t.type}catch(t){return!1}}}var o=t},1201,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_VERSION",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VSN_1_0_0",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"VSN_2_0_0",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_VSN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEFAULT_TIMEOUT",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"WS_CLOSE_NORMAL",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"MAX_PUSH_BUFFER_SIZE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SOCKET_STATES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"CHANNEL_STATES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"CHANNEL_EVENTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TRANSPORTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"CONNECTION_STATE",{enumerable:!0,get:function(){return E}});var n=r(d[0]);const t=`realtime-js/${n.version}`,o='1.0.0',c='2.0.0',u=c,l=n.version,b=1e4,_=1e3,f=100,p={connecting:0,open:1,closing:2,closed:3},s={closed:'closed',errored:'errored',joined:'joined',joining:'joining',leaving:'leaving'},O={close:'phx_close',error:'phx_error',join:'phx_join',reply:'phx_reply',leave:'phx_leave',access_token:'access_token'},j={websocket:'websocket'},E={connecting:'connecting',open:'open',closing:'closing',closed:'closed'}},1202,[1203]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1203,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});class t{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT='broadcast',this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=t?t:[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&'string'==typeof t.payload.event)return n(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer(null===(n=t.payload)||void 0===n?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:{},c=(new TextEncoder).encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,c)}_encodeUserBroadcastPush(t,n,s){var o,c;const l=t.topic,h=null!==(o=t.ref)&&void 0!==o?o:'',u=null!==(c=t.join_ref)&&void 0!==c?c:'',f=t.payload.event,y=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},_=0===Object.keys(y).length?'':JSON.stringify(y);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`ref length ${h.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`topic length ${l.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const A=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+h.length+l.length+f.length+_.length,E=new ArrayBuffer(this.HEADER_LENGTH+A);let U=new DataView(E),B=0;U.setUint8(B++,this.KINDS.userBroadcastPush),U.setUint8(B++,u.length),U.setUint8(B++,h.length),U.setUint8(B++,l.length),U.setUint8(B++,f.length),U.setUint8(B++,_.length),U.setUint8(B++,n),Array.from(u,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(h,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(l,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(f,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(_,t=>U.setUint8(B++,t.charCodeAt(0)));var N=new Uint8Array(E.byteLength+s.byteLength);return N.set(new Uint8Array(E),0),N.set(new Uint8Array(s),E.byteLength),N.buffer}decode(t,n){if(this._isArrayBuffer(t)){return n(this._binaryDecode(t))}if('string'==typeof t){const s=JSON.parse(t),[o,c,l,h,u]=s;return n({join_ref:o,ref:c,topic:l,event:h,payload:u})}return n({})}_binaryDecode(t){const n=new DataView(t),s=n.getUint8(0),o=new TextDecoder;if(s===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,o)}_decodeUserBroadcast(t,n,s){const o=n.getUint8(1),c=n.getUint8(2),l=n.getUint8(3),h=n.getUint8(4);let u=this.HEADER_LENGTH+4;const f=s.decode(t.slice(u,u+o));u+=o;const y=s.decode(t.slice(u,u+c));u+=c;const _=s.decode(t.slice(u,u+l));u+=l;const A=t.slice(u,t.byteLength),E=h===this.JSON_ENCODING?JSON.parse(s.decode(A)):A,U={type:this.BROADCAST_EVENT,event:y,payload:E};return l>0&&(U.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:f,event:this.BROADCAST_EVENT,payload:U}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||'ArrayBuffer'===(null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)}_pick(t,n){return t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([t])=>n.includes(t))):{}}}},1204,[]); +__d(function(g,r,i,a,m,e,d){"use strict";var t;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PostgresTypes",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"convertChangeData",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"convertColumn",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"convertCell",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toBoolean",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toNumber",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"toJson",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toTimestampString",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"httpEndpointURL",{enumerable:!0,get:function(){return y}}),(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(t||(t={}));const n=(t,n,o={})=>{var s;const u=null!==(s=o.skipTypes)&&void 0!==s?s:[];return n?Object.keys(n).reduce((o,s)=>(o[s]=c(s,t,n,u),o),{}):{}},c=(t,n,c,u)=>{const p=n.find(n=>n.name===t),l=null==p?void 0:p.type,f=c[t];return l&&!u.includes(l)?o(l,f):s(f)},o=(n,c)=>{if('_'===n.charAt(0)){const t=n.slice(1,n.length);return f(c,t)}switch(n){case t.bool:return u(c);case t.float4:case t.float8:case t.int2:case t.int4:case t.int8:case t.numeric:case t.oid:return p(c);case t.json:case t.jsonb:return l(c);case t.timestamp:return b(c);case t.abstime:case t.date:case t.daterange:case t.int4range:case t.int8range:case t.money:case t.reltime:case t.text:case t.time:case t.timestamptz:case t.timetz:case t.tsrange:case t.tstzrange:default:return s(c)}},s=t=>t,u=t=>{switch(t){case't':return!0;case'f':return!1;default:return t}},p=t=>{if('string'==typeof t){const n=parseFloat(t);if(!Number.isNaN(n))return n}return t},l=t=>{if('string'==typeof t)try{return JSON.parse(t)}catch(n){return t}return t},f=(t,n)=>{if('string'!=typeof t)return t;const c=t.length-1,s=t[c];if('{'===t[0]&&'}'===s){let s;const u=t.slice(1,c);try{s=JSON.parse('['+u+']')}catch(t){s=u?u.split(','):[]}return s.map(t=>o(n,t))}return t},b=t=>'string'==typeof t?t.replace(' ','T'):t,y=t=>{const n=new URL(t);return n.protocol=n.protocol.replace(/^ws/i,'http'),n.pathname=n.pathname.replace(/\/+$/,'').replace(/\/socket\/websocket$/i,'').replace(/\/socket$/i,'').replace(/\/websocket$/i,''),''===n.pathname||'/'===n.pathname?n.pathname='/api/broadcast':n.pathname=n.pathname+'/api/broadcast',n.href}},1205,[]); +__d(function(g,_r,_i,a,m,_e2,_d2){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return d.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e2,"postgresChangesFilter",{enumerable:!0,get:function(){return d.postgresChangesFilter}}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e2,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e2,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e2,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e2,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return h}});var t,n,i,s=_r(_d2[0]),r=e(_r(_d2[1])),o=_r(_d2[2]),c=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(o),l=_r(_d2[3]),u=e(_r(_d2[4])),d=_r(_d2[5]);!(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(t||(t={})),(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(n||(n={})),(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(i||(i={}));const h=s.CHANNEL_STATES;class p{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){var i,s;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,''),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},t.config),this.channelAdapter=new u.default(this.socket.socketAdapter,e,this.params),this.presence=new r.default(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=(0,o.httpEndpointURL)(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(null===(s=null===(i=this.params.config)||void 0===i?void 0:i.broadcast)||void 0===s?void 0:s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,o,c;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:h}}=this.params,p=null!==(o=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==o?o:[],E=!!this.bindings[n.PRESENCE]&&this.bindings[n.PRESENCE].length>0||!0===(null===(c=this.params.config.presence)||void 0===c?void 0:c.enabled),b={},f={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:E}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(t=>{null==e||e(i.CHANNEL_ERROR,(0,l.normalizeChannelError)(t))}),this._onClose(()=>null==e?void 0:e(i.CLOSED)),this.updateJoinPayload(Object.assign({config:f},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive('ok',async({postgres_changes:t})=>{this.socket._isManualToken()||this.socket.setAuth(),void 0!==t?this._updatePostgresBindings(t,e):null==e||e(i.SUBSCRIBED)}).receive('error',t=>{this.state=s.CHANNEL_STATES.errored;const n=Object.values(t).join(', ')||'error';null==e||e(i.CHANNEL_ERROR,new Error(n,{cause:t}))}).receive('timeout',()=>{null==e||e(i.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var n;const r=this.bindings.postgres_changes,o=null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0,c=[];for(let n=0;n{var i,s,r;const o=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);'broadcast'!==e.type||(null===(r=null===(s=null===(i=this.params)||void 0===i?void 0:i.config)||void 0===s?void 0:s.broadcast)||void 0===r?void 0:r.ack)||n('ok'),o.receive('ok',()=>n('ok')),o.receive('error',()=>n('error')),o.receive('timeout',()=>n('timed out'))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:r}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:'','Content-Type':'application/json'};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:'POST',headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:r,private:this.private}]})};try{const e=await this._fetchWithTimeout(this.broadcastEndpointURL,c,null!==(n=t.timeout)&&void 0!==n?n:this.timeout);return await(null===(i=e.body)||void 0===i?void 0:i.cancel()),e.ok?'ok':'error'}catch(e){return e instanceof Error&&'AbortError'===e.name?'timed out':'error'}}}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive('ok',()=>t('ok')).receive('timeout',()=>t('timed out')).receive('error',()=>t('error'))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){const i=new AbortController,s=setTimeout(()=>i.abort(),n),r=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(s),r}_on(e,t,n){const i=e.toLocaleLowerCase(),s=null==t?void 0:t.filter;(s instanceof d.RealtimePostgresFilterBuilder||'object'==typeof s&&null!==s&&'function'==typeof s.build)&&(t=Object.assign(Object.assign({},t),{filter:s.build()}));const r={type:i,filter:t,callback:n,ref:this.channelAdapter.on(e,n)};return this.bindings[i]?this.bindings[i].push(r):this.bindings[i]=[r],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{var i,s,r,o,c,l,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=null===(i=this.bindings[d])||void 0===i?void 0:i.find(t=>t.ref===e.ref);if(!h)return!0;if(['broadcast','presence','postgres_changes'].includes(d)){if('id'in h){const e=h.id,n=null===(s=h.filter)||void 0===s?void 0:s.event;return e&&(null===(r=t.ids)||void 0===r?void 0:r.includes(e))&&('*'===n||(null==n?void 0:n.toLocaleLowerCase())===(null===(o=t.data)||void 0===o?void 0:o.type.toLocaleLowerCase()))}{const e=null===(l=null===(c=null==h?void 0:h.filter)||void 0===c?void 0:c.event)||void 0===l?void 0:l.toLocaleLowerCase();return'*'===e||e===(null===(u=null==t?void 0:t.event)||void 0===u?void 0:u.toLocaleLowerCase())}}return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){const{close:n,error:i,leave:r,join:o}=s.CHANNEL_EVENTS;return t&&[n,i,r,o].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if('object'==typeof t&&'ids'in t){const e=t.data,{schema:n,table:i,commit_timestamp:s,type:r,errors:o}=e,c={schema:n,table:i,commit_timestamp:s,eventType:r,new:{},old:{},errors:o};return Object.assign(Object.assign({},c),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw new Error('cannot copy bindings into joined channel');for(const t in e.bindings)for(const n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_getPayloadRecords(e){const t={new:{},old:{}};return'INSERT'!==e.type&&'UPDATE'!==e.type||(t.new=c.convertChangeData(e.columns,e.record)),'UPDATE'!==e.type&&'DELETE'!==e.type||(t.old=c.convertChangeData(e.columns,e.old_record)),t}}},1206,[1202,1207,1205,1210,1211,1212]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return t}});var e,t,n=r(d[0]),c=(e=n)&&e.__esModule?e:{default:e};!(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(t||(t={}));class u{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new c.default(this.channel.channelAdapter,t)}}},1207,[1208]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(s,c){const u=o(c);this.presence=new n.Presence(s.getChannel(),u),this.presence.onJoin((n,c,o)=>{const u=t.onJoinPayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onLeave((n,c,o)=>{const u=t.onLeavePayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onSync(()=>{s.getChannel().trigger('presence',{event:'sync'})})}get state(){return t.transformState(this.presence.state)}static transformState(n){return n=c(n),Object.getOwnPropertyNames(n).reduce((t,c)=>{const o=n[c];return t[c]=s(o),t},{})}static onJoinPayload(n,t,c){return{event:'join',key:n,currentPresences:u(t),newPresences:s(c)}}static onLeavePayload(n,t,c){return{event:'leave',key:n,currentPresences:u(t),leftPresences:s(c)}}}function s(n){return n.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function c(n){return JSON.parse(JSON.stringify(n))}function o(n){return(null==n?void 0:n.events)&&{events:n.events}}function u(n){return(null==n?void 0:n.metas)?s(n):[]}},1208,[1209]); +__d(function(g,r,_i,a,_m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"Channel",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e2,"LongPoll",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e2,"Presence",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e2,"Push",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e2,"Serializer",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e2,"Socket",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e2,"Timer",{enumerable:!0,get:function(){return w}});var e=e=>{if("function"==typeof e)return e;return function(){return e}},t="undefined"!=typeof self?self:null,s="undefined"!=typeof window?window:null,i=t||s||globalThis,n=0,o=1,h=2,c=3,l="closed",u="errored",f="joined",p="joining",m="leaving",b="phx_close",k="phx_error",T="phx_join",y="phx_reply",C="phx_leave",v="longpoll",R="websocket",j=4,E="base64url.bearer.phx.",S=class{constructor(e,t,s,i){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},w=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},A=class{constructor(t,s,i){this.state=l,this.topic=t,this.params=e(s||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new S(this,T,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new w(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=f,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",e=>{this.state=u,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=l,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=u,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new S(this,C,e({}),this.timeout).send(),this.state=u,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(y,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=l,this.bindings=[]}onClose(e){this.on(b,e)}onError(e){return this.on(k,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(void 0===t||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new S(this,e,function(){return t},s);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=m;let s=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(b,"leave")},i=new S(this,C,e({}),t);return i.receive("ok",()=>s()).receive("timeout",()=>s()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,i){return this.topic===e&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=p,this.joinPush.resend(e))}trigger(e,t,s,i){let n=this.onMessage(e,t,s,i);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(i=>i.event===e&&this.filterBindings(i,t,s));for(let e=0;eu.abort(),o);l.signal=u.signal}return i.fetch(t,l).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>c&&c(e)).catch(e=>{"AbortError"===e.name&&h?h():c&&c(null)}),u}static xdomainRequest(e,t,s,i,n,o,h){return e.timeout=n,e.open(t,s),e.onload=()=>{let t=this.parseJSON(e.responseText);h&&h(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,s,i,n,o,h,c){e.open(t,s,!0),e.timeout=o;for(let[t,s]of Object.entries(i))e.setRequestHeader(t,s);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{if(e.readyState===j&&c){let t=this.parseJSON(e.responseText);c(t)}},h&&(e.ontimeout=h),e.send(n),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let s=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let n=t?`${t}[${i}]`:i,o=e[i];"object"==typeof o?s.push(this.serialize(o,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(o))}return s.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},L=e=>{let t="",s=new Uint8Array(e),i=s.byteLength;for(let e=0;ethis.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R),"$1/"+v)}endpointURL(){return H.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=n}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===o||this.readyState===n}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:s,messages:i}=e;if(410===t&&null!==this.token)return this.onerror(410),void this.closeAndRetry(3410,"session_gone",!1);this.token=s}else t=0;switch(t){case 200:i.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=o,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=L(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join("\n"),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,s){for(let e of this.reqs)e.abort();this.readyState=c;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,s,i,n){let o;o=H.request(e,this.endpointURL(),t,s,this.timeout,()=>{this.reqs.delete(o),i()},e=>{this.reqs.delete(o),this.isActive()&&n(e)}),this.reqs.add(o)}},B=class e{constructor(t,s={}){let i=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(i.state,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,s,i),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,s,i)}),this.pendingDiffs=[],n()}),this.channel.on(i.diff,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,s,i),n())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,s,i){let n=this.clone(e),o={},h={};return this.map(n,(e,s)=>{t[e]||(h[e]=s)}),this.map(t,(e,t)=>{let s=n[e];if(s){let i=t.metas.map(e=>e.phx_ref),n=s.metas.map(e=>e.phx_ref),c=t.metas.filter(e=>n.indexOf(e.phx_ref)<0),l=s.metas.filter(e=>i.indexOf(e.phx_ref)<0);c.length>0&&(o[e]=t,o[e].metas=c),l.length>0&&(h[e]=this.clone(s),h[e].metas=l)}else o[e]=t}),this.syncDiff(n,{joins:o,leaves:h},s,i)}static syncDiff(e,t,s,i){let{joins:n,leaves:o}=this.clone(t);return s||(s=function(){}),i||(i=function(){}),this.map(n,(t,i)=>{let n=e[t];if(e[t]=this.clone(i),n){let s=e[t].metas.map(e=>e.phx_ref),i=n.metas.filter(e=>s.indexOf(e.phx_ref)<0);e[t].metas.unshift(...i)}s(t,n,i)}),this.map(o,(t,s)=>{let n=e[t];if(!n)return;let o=s.metas.map(e=>e.phx_ref);n.metas=n.metas.filter(e=>o.indexOf(e.phx_ref)<0),i(t,n,s),0===n.metas.length&&delete e[t]}),e}static list(e,t){return t||(t=function(e,t){return t}),this.map(e,(e,s)=>t(e,s))}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static clone(e){return JSON.parse(JSON.stringify(e))}},O={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,i,n,o,h]=JSON.parse(e);return t({join_ref:s,ref:i,topic:n,event:o,payload:h})}},binaryEncode(e){let{join_ref:t,ref:s,event:i,topic:n,payload:o}=e,h=this.META_LENGTH+t.length+s.length+n.length+i.length,c=new ArrayBuffer(this.HEADER_LENGTH+h),l=new DataView(c),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,s.length),l.setUint8(u++,n.length),l.setUint8(u++,i.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(s,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(i,e=>l.setUint8(u++,e.charCodeAt(0)));var f=new Uint8Array(c.byteLength+o.byteLength);return f.set(new Uint8Array(c),0),f.set(new Uint8Array(o),c.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,c=s.decode(e.slice(h,h+i));h+=i;let l=s.decode(e.slice(h,h+n));h+=n;let u=s.decode(e.slice(h,h+o));return h+=o,{join_ref:c,ref:null,topic:l,event:u,payload:e.slice(h,e.byteLength)}},decodeReply(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(c,c+i));c+=i;let u=s.decode(e.slice(c,c+n));c+=n;let f=s.decode(e.slice(c,c+o));c+=o;let p=s.decode(e.slice(c,c+h));c+=h;let m=e.slice(c,e.byteLength);return{join_ref:l,ref:u,topic:f,event:y,payload:{status:p,response:m}}},decodeBroadcast(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=this.HEADER_LENGTH+2,h=s.decode(e.slice(o,o+i));o+=i;let c=s.decode(e.slice(o,o+n));return o+=n,{join_ref:null,ref:null,topic:h,event:c,payload:e.slice(o,e.byteLength)}}},$=class{constructor(t,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||1e4,this.transport=n.transport||i.WebSocket||P,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let o=null;try{o=i&&i.sessionStorage}catch{}this.sessionStore=n.sessionStorage||o,this.establishedConnections=0,this.defaultEncoder=O.encode.bind(O),this.defaultDecoder=O.decode.bind(O),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==P?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let h=null;s&&s.addEventListener&&(s.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),h=this.connectClock)}),s.addEventListener("pageshow",e=>{h===this.connectClock&&(h=null,this.connect())}),s.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>n.rejoinAfterMs?n.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>n.reconnectAfterMs?n.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(e,t,s)=>{console.log(`${e}: ${t}`,s)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=e(n.params||{}),this.endPoint=`${t}/${R}`,this.vsn=n.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new w(()=>{if(this.pageHidden)return this.log("Not reconnecting as page is hidden!"),void this.teardown();this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return P}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=H.appendParams(H.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=e(t)),this.conn&&!this.disconnecting||(this.longPollFallbackMs&&this.transport!==P?this.connectWithFallback(P,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(n=>{n.ref===t&&(this.off([i]),e(Date.now()-s))});return!0}transportName(e){return e===P?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${E}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let s,i=!1,n=!0,o=this.transportName(e),h=t=>{this.log("transport",`falling back to ${o}...`,t),this.off([void 0,s]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),s=this.onError(e=>{this.log("transport","error",e),n&&!i&&(clearTimeout(this.fallbackTimer),h(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!n){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const i=this.conn;this.waitForBufferDone(i,()=>{t?i.close(t,s||""):i.close(),this.waitForSocketClosed(i,()=>{this.conn===i&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){5!==s&&e.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s):t()}waitForSocketClosed(e,t,s=1){5!==s&&e.readyState!==c?setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s):t()}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(k,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case n:return"connecting";case o:return"open";case h:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let s=new A(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;this.log("push",`${t} ${s} (${o}, ${n})`,i)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(this.isConnected())if(this.pendingHeartbeatRef)this.heartbeatTimeout();else{this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}else try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;if(n&&n===this.pendingHeartbeatRef){const e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback("ok"===i.status?"ok":"error",e)}catch(e){this.log("error","error in heartbeat callback",e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${t} ${s} ${n&&"("+n+")"||""}`.trim(),i);for(let e=0;e{try{i(...t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}},1209,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeChannelError=function(n){if(n instanceof Error)return n;if('string'==typeof n)return new Error(n);if(n&&'object'==typeof n){const o=n;if('number'==typeof o.code){const t='string'==typeof o.reason&&o.reason?` (${o.reason})`:'';return new Error(`socket closed: ${o.code}${t}`,{cause:n})}return new Error('channel error: transport failure',{cause:n})}return new Error('channel error: connection lost')}},1210,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(n,t,s){const h=(o=s,{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},o.config)});var o;this.channel=n.getSocket().channel(t,h),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,t){return this.channel.on(n,t)}off(n,t){this.channel.off(n,t)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(t,s,h){let o;try{o=this.channel.push(t,s,h)}catch(n){throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>n.MAX_PUSH_BUFFER_SIZE){const n=this.channel.pushBuffer.shift();n.cancelTimeout(),this.socket.log('channel',`discarded push due to buffer overflow: ${n.event}`,n.payload())}return o}updateJoinPayload(n){const t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),n)}canPush(){return this.socket.isConnected()&&this.state===n.CHANNEL_STATES.joined}isJoined(){return this.state===n.CHANNEL_STATES.joined}isJoining(){return this.state===n.CHANNEL_STATES.joining}isClosed(){return this.state===n.CHANNEL_STATES.closed}isLeaving(){return this.state===n.CHANNEL_STATES.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}},1211,[1202]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"postgresChangesFilter",{enumerable:!0,get:function(){return c}});const t=/[,()"\\]/,n=n=>t.test(n)||n!==n.trim(),s=t=>`"${t.replace(/\\/g,'\\\\').replace(/"/g,'\\"')}"`,u=t=>{const u=null===t?'null':String(t);return n(u)?s(u):u},l=t=>null===t?'null':String(t),h=(t,n)=>{if('in'===t){const t=Array.isArray(n)?n:[n];if(0===t.length)throw new Error('Realtime `in` filter requires at least one value.');return`in.(${Array.from(new Set(t)).map(t=>u(t)).join(',')})`}return'is'===t?`is.${l(n)}`:`${t}.${u(n)}`};class o{constructor(){this.filters=[]}add(t,n,s,u=!1){const l=u?'not.':'';return this.filters.push(`${t}=${l}${h(n,s)}`),this}eq(t,n){return this.add(t,'eq',n)}neq(t,n){return this.add(t,'neq',n)}gt(t,n){return this.add(t,'gt',n)}gte(t,n){return this.add(t,'gte',n)}lt(t,n){return this.add(t,'lt',n)}lte(t,n){return this.add(t,'lte',n)}in(t,n){return this.add(t,'in',n)}like(t,n){return this.add(t,'like',n)}ilike(t,n){return this.add(t,'ilike',n)}match(t,n){return this.add(t,'match',n)}imatch(t,n){return this.add(t,'imatch',n)}is(t,n){return this.add(t,'is',n)}isDistinct(t,n){return this.add(t,'isdistinct',n)}not(t,n,s){return this.add(t,n,s,!0)}build(){return this.filters.join(',')}toString(){return this.build()}}const c=()=>new o},1212,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]);class s{constructor(n,s){this.socket=new t.Socket(n,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,s,o=1e4){return new Promise(c=>{setTimeout(()=>c('timeout'),o),this.socket.disconnect(()=>{t(),c('ok')},n,s)})}push(t){this.socket.push(t)}log(t,n,s){this.socket.log(t,n,s)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.connecting}isDisconnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}},1213,[1209,1202]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"StorageAnalyticsClient",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StorageClient",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(_e,"StorageError",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"StorageUnknownError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"StorageVectorsApiError",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"StorageVectorsClient",{enumerable:!0,get:function(){return X}}),Object.defineProperty(_e,"StorageVectorsError",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"VectorBucketApi",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"VectorBucketScope",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(_e,"VectorDataApi",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"VectorIndexApi",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(_e,"VectorIndexScope",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(_e,"isStorageError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isStorageVectorsError",{enumerable:!0,get:function(){return f}});var e=_r(d[0]);function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function n(e){var n=r(e,"string");return"symbol"==t(n)?n:n+""}function o(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},k=e=>{if(Array.isArray(e))return e.map(e=>k(e));if("function"==typeof e||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([e,r])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));t[n]=k(r)}),t},x=e=>!(!e||"string"!=typeof e)&&(!(0===e.length||e.length>100)&&(e.trim()===e&&(!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e)))),$=e=>{if("object"==typeof e&&null!==e){const t=e;if("string"==typeof t.msg)return t.msg;if("string"==typeof t.message)return t.message;if("string"==typeof t.error_description)return t.error_description;if("string"==typeof t.error)return t.error;if("object"==typeof t.error&&null!==t.error){const e=t.error;if("string"==typeof e.message)return e.message}}return JSON.stringify(e)},j=async(e,t,r,n)=>{if(null!==e&&"object"==typeof e&&"json"in e&&"function"==typeof e.json){const r=e;let o=parseInt(String(r.status),10);Number.isFinite(o)||(o=500),r.json().then(e=>{const r=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||o+"";t(new l($(e),o,r,n))}).catch(()=>{const e=o+"";t(new l(r.statusText||`HTTP ${o} error`,o,e,n))})}else t(new h($(e),e,n))},B=(e,t,r,n)=>{const o={method:e,headers:(null==t?void 0:t.headers)||{}};if("GET"===e||"HEAD"===e||!n)return c(c({},o),r);if(S(n)){var s;const e=(null==t?void 0:t.headers)||{};let r;for(const[t,n]of Object.entries(e))"content-type"===t.toLowerCase()&&(r=n);o.headers=w(e,"Content-Type",null!==(s=r)&&void 0!==s?s:"application/json"),o.body=JSON.stringify(n)}else o.body=n;return(null==t?void 0:t.duplex)&&(o.duplex=t.duplex),c(c({},o),r)};async function P(e,t,r,n,o,s,c){return new Promise((i,u)=>{e(r,B(t,n,o,s)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;if("vectors"===c){const t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status)return{};if(!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>i(e)).catch(e=>j(e,u,0,c))})}function N(e="storage"){return{get:async(t,r,n,o)=>P(t,"GET",r,n,o,void 0,e),post:async(t,r,n,o,s)=>P(t,"POST",r,o,s,n,e),put:async(t,r,n,o,s)=>P(t,"PUT",r,o,s,n,e),head:async(t,r,n,o)=>P(t,"HEAD",r,c(c({},n),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,n,o,s)=>P(t,"DELETE",r,o,s,n,e)}}const E=N("storage"),{get:C,post:V,put:I,head:T,remove:U}=E,_=N("vectors");var F=class{constructor(e,t={},r,n="storage"){var o;this.shouldThrowOnError=!1,this.url=e,this.headers=O(t),this.fetch=(o=r)?(...e)=>o(...e):(...e)=>fetch(...e),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=w(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let R;R=Symbol.toStringTag;var L=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[R]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let D;D=Symbol.toStringTag;var A=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[D]="BlobDownloadBuilder",this.promise=null}asStream(){return new L(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};const M={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},z={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J=class extends F{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var o=this;return o.handleOperation(async()=>{let s;const i=c(c({},z),n);let u=c(c({},o.headers),"POST"===e&&{"x-upsert":String(i.upsert)});const l=i.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(s=new FormData,s.append("cacheControl",i.cacheControl),l&&s.append("metadata",o.encodeMetadata(l)),s.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",i.cacheControl),l&&!s.has("metadata")&&s.append("metadata",o.encodeMetadata(l))):(s=r,u["cache-control"]=`max-age=${i.cacheControl}`,u["content-type"]=i.contentType,l&&(u["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&s instanceof ReadableStream||s&&"object"==typeof s&&"pipe"in s&&"function"==typeof s.pipe)&&!i.duplex&&(i.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))u=w(u,e,t);const h=o._removeEmptyFolders(t),p=o._getFinalPath(h),f=await("PUT"==e?I:V)(o.fetch,`${o.url}/object/${p}`,s,c({headers:u},(null==i?void 0:i.duplex)?{duplex:i.duplex}:{}));return{path:h,id:f.Id,fullPath:f.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var o=this;const s=o._removeEmptyFolders(e),i=o._getFinalPath(s),u=new URL(o.url+`/object/upload/sign/${i}`);return u.searchParams.set("token",t),o.handleOperation(async()=>{let e;const t=c(c({},z),n);let i=c(c({},o.headers),{"x-upsert":String(t.upsert)});const l=t.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),l&&e.append("metadata",o.encodeMetadata(l)),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.has("cacheControl")||e.append("cacheControl",t.cacheControl),l&&!e.has("metadata")&&e.append("metadata",o.encodeMetadata(l))):(e=r,i["cache-control"]=`max-age=${t.cacheControl}`,i["content-type"]=t.contentType,l&&(i["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&e instanceof ReadableStream||e&&"object"==typeof e&&"pipe"in e&&"function"==typeof e.pipe)&&!t.duplex&&(t.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))i=w(i,e,t);return{path:s,fullPath:(await I(o.fetch,u.toString(),e,c({headers:i},(null==t?void 0:t.duplex)?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const o=c({},r.headers);(null==t?void 0:t.upsert)&&(o["x-upsert"]="true");const s=await V(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:o}),u=new URL(r.url+s.url),l=u.searchParams.get("token");if(!l)throw new i("No token returned by API");return{signedUrl:u.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await V(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await V(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let o=n._getFinalPath(e);const s="object"==typeof(null==r?void 0:r.transform)&&null!==r.transform&&Object.keys(r.transform).length>0;let i=await V(n.fetch,`${n.url}/object/sign/${o}`,c({expiresIn:t},s?{transform:r.transform}:{}),{headers:n.headers});const u=new URLSearchParams;(null==r?void 0:r.download)&&u.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&u.set("cacheNonce",String(r.cacheNonce));const l=u.toString();return{signedUrl:encodeURI(`${n.url}${i.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const o=await V(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),s=new URLSearchParams;(null==r?void 0:r.download)&&s.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&s.set("cacheNonce",String(r.cacheNonce));const i=s.toString();return o.map(e=>c(c({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${i?`&${i}`:""}`):null}))})}download(e,t,r){const n="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(o,t.transform),null!=(null==t?void 0:t.cacheNonce)&&o.set("cacheNonce",String(t.cacheNonce));const s=o.toString(),c=this._getFinalPath(e);return new A(()=>C(this.fetch,`${this.url}/${n}/${c}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},r),this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>k(await C(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await T(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(u(e)){var n;const t=e instanceof l?e.status:e instanceof h?null===(n=e.originalError)||void 0===n?void 0:n.status:void 0;if(void 0!==t&&[400,404].includes(t))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;(null==t?void 0:t.download)&&n.set("download",!0===t.download?"":t.download),(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(n,t.transform),null!=(null==t?void 0:t.cacheNonce)&&n.set("cacheNonce",String(t.cacheNonce));const o=n.toString(),s="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=n._getFinalPath(e),s=new URLSearchParams;(null==t?void 0:t.transformations)&&s.set("transformations","true");const c=s.toString();return await U(n.fetch,`${n.url}/cdn/${o}${c?`?${c}`:""}`,{},{headers:n.headers},r)})}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const o=(null==t?void 0:t.sortBy)?c(c({},M.sortBy),t.sortBy):M.sortBy,s=c(c(c({},M),t),{},{sortBy:o,prefix:e||""});return await V(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=c({},e);return await V(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const K={"X-Client-Info":"storage-js/2.109.0"};var q=class extends F{constructor(e,t={},r,n){const o=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));super(o.href.replace(/\/$/,""),c(c({},K),t),r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await C(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await C(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await V(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await I(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=new URLSearchParams;(null==t?void 0:t.transformations)&&o.set("transformations","true");const s=o.toString();return await U(n.fetch,`${n.url}/cdn/${e}${s?`?${s}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},H=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),t),r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&r.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);const n=r.toString(),o=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await C(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(t){var r=this;if(!x(t))throw new i("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new e.IcebergRestCatalog({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>r.headers},fetch:this.fetch}),o=this.shouldThrowOnError;return new Proxy(n,{get(e,t){const r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(e){if(o)throw e;return{data:null,error:e}}}}})}},Q=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},G=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},W=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},X=class extends W{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Y(this.url,this.headers,e,this.fetch)}async createBucket(e){return(()=>super.createBucket)().call(this,e)}async getBucket(e){return(()=>super.getBucket)().call(this,e)}async listBuckets(e={}){return(()=>super.listBuckets)().call(this,e)}async deleteBucket(e){return(()=>super.deleteBucket)().call(this,e)}},Y=class extends Q{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return(()=>super.createIndex)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return(()=>super.listIndexes)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return(()=>super.getIndex)().call(this,this.vectorBucketName,e)}async deleteIndex(e){return(()=>super.deleteIndex)().call(this,this.vectorBucketName,e)}index(e){return new Z(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Z=class extends G{constructor(e,t,r,n,o){super(e,t,o),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=this;return(()=>super.putVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(e){var t=this;return(()=>super.getVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(e={}){var t=this;return(()=>super.listVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(e){var t=this;return(()=>super.queryVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(e){var t=this;return(()=>super.deleteVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},ee=class extends q{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new J(this.url,this.headers,e,this.fetch)}get vectors(){return new X(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new H(this.url+"/iceberg",this.headers,this.fetch)}}},1214,[1215]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IcebergError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"IcebergRestCatalog",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"getCurrentSchema",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isDecimalType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isFixedType",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseDecimalType",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"parseFixedType",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"typesEqual",{enumerable:!0,get:function(){return x}});var t=class extends Error{constructor(t,a){super(t),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown="CommitStateUnknownException"===a.icebergType||[500,502,504].includes(a.status)&&!0===a.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function a(t,a,s){const n=new URL(a,t);if(s)for(const[t,a]of Object.entries(s))void 0!==a&&n.searchParams.set(t,a);return n.toString()}async function s(t){return t&&"none"!==t.type?"bearer"===t.type?{Authorization:`Bearer ${t.token}`}:"header"===t.type?{[t.name]:t.value}:"custom"===t.type?await t.getHeaders():{}:{}}function n(n){const c=n.fetchImpl??globalThis.fetch;return{async request({method:o,path:p,query:u,body:l,headers:h}){const b=a(n.baseUrl,p,u),f=await s(n.auth),y=await c(b,{method:o,headers:{...l?{"Content-Type":"application/json"}:{},...f,...h},body:l?JSON.stringify(l):void 0}),T=await y.text(),w=(y.headers.get("content-type")||"").includes("application/json"),x=w&&T?JSON.parse(T):T;if(!y.ok){const a=w?x:void 0,s=a?.error;throw new t(s?.message??`Request failed with status ${y.status}`,{status:y.status,icebergType:s?.type,icebergCode:s?.code,details:a})}return{status:y.status,headers:y.headers,data:x}}}}function c(t){return t.join("\x1f")}var o=class{constructor(t,a=""){this.client=t,this.prefix=a}async listNamespaces(t){const a=t?{parent:c(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(t=>({namespace:t}))}async createNamespace(t,a){const s={namespace:t.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${c(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${c(t.namespace)}`})).data.properties}}async namespaceExists(a){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${c(a.namespace)}`}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createNamespaceIfNotExists(a,s){try{return await this.createNamespace(a,s)}catch(a){if(a instanceof t&&409===a.status)return;throw a}}};function p(t){return t.join("\x1f")}var u=class{constructor(t,a="",s){this.client=t,this.prefix=a,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`})).data.identifiers}async createTable(t,a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`,body:a,headers:s})).data.metadata}async updateTable(t,a){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,body:a});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(t){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,headers:a})).data.metadata}async tableExists(a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${p(a.namespace)}/tables/${a.name}`,headers:s}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createTableIfNotExists(a,s){try{return await this.createTable(a,s)}catch(n){if(n instanceof t&&409===n.status)return await this.loadTable({namespace:a.namespace,name:s.name});throw n}}},l=class{constructor(t){let a="v1";t.catalogName&&(a+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=n({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new o(this.client,a),this.tableOps=new u(this.client,a,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,a){return this.namespaceOps.createNamespace(t,a)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,a){return this.tableOps.createTable(t,a)}async updateTable(t,a){return this.tableOps.updateTable(t,a)}async dropTable(t,a){await this.tableOps.dropTable(t,a)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,a){return this.namespaceOps.createNamespaceIfNotExists(t,a)}async createTableIfNotExists(t,a){return this.tableOps.createTableIfNotExists(t,a)}},h=/^decimal\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)$/,b=/^fixed\s*\[\s*(\d+)\s*\]$/;function f(t){const a=t.match(h);return a?{precision:parseInt(a[1],10),scale:parseInt(a[2],10)}:null}function y(t){const a=t.match(b);return a?{length:parseInt(a[1],10)}:null}function T(t){return h.test(t)}function w(t){return b.test(t)}function x(t,a){const s=f(t),n=f(a);if(s&&n)return s.precision===n.precision&&s.scale===n.scale;const c=y(t),o=y(a);return c&&o?c.length===o.length:t===a}function O(t){return t.schemas.find(a=>a["schema-id"]===t["current-schema-id"])}},1215,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"navigatorLock",{enumerable:!0,get:function(){return l.navigatorLock}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return l.NavigatorLockAcquireTimeoutError}}),Object.defineProperty(_e,"lockInternals",{enumerable:!0,get:function(){return l.internals}}),Object.defineProperty(_e,"processLock",{enumerable:!0,get:function(){return l.processLock}}),Object.defineProperty(_e,"GoTrueAdminApi",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"GoTrueClient",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(_e,"AuthAdminApi",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"AuthClient",{enumerable:!0,get:function(){return u.default}});var t=e(r(d[0])),n=e(r(d[1])),o=e(r(d[2])),u=e(r(d[3])),c=r(d[4]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(d[5]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var l=r(d[6])},1216,[1217,1225,1232,1233,1224,1222,1227]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]),s=r(d[1]),n=r(d[2]),o=r(d[3]),h=r(d[4]);class u{constructor({url:t="",headers:s={},fetch:o,experimental:h}){this.url=t,this.headers=s,this.fetch=(0,n.resolveFetch)(o),this.experimental=null!=h?h:{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=o.SIGN_OUT_SCOPES[0]){if(o.SIGN_OUT_SCOPES.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${o.SIGN_OUT_SCOPES.join(', ')}`);try{return await(0,s._request)(this.fetch,'POST',`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async inviteUserByEmail(t,n={}){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async generateLink(n){try{const{options:o}=n,h=(0,t.__rest)(n,["options"]),u=Object.assign(Object.assign({},h),o);return'newEmail'in h&&(u.new_email=null==h?void 0:h.newEmail,delete u.newEmail),await(0,s._request)(this.fetch,'POST',`${this.url}/admin/generate_link`,{body:u,headers:this.headers,xform:s._generateLinkResponse,redirectTo:null==o?void 0:o.redirectTo})}catch(t){if((0,h.isAuthError)(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/users`,{body:t,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async listUsers(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{users:[]},error:t};throw t}}async getUserById(t){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t}`,{headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async updateUserById(t,o){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/users/${t}`,{body:o,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async deleteUser(t,o=!1){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:o},xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async _listFactors(t){(0,n.validateUUID)(t.userId);try{const{data:n,error:o}=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:t=>({data:{factors:t},error:null})});return{data:n,error:o}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteFactor(t){(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.id);try{return{data:await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listOAuthClients(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{clients:[]},error:t};throw t}}async _createOAuthClient(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getOAuthClient(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateOAuthClient(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteOAuthClient(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listCustomProviders(t){try{const n={};return(null==t?void 0:t.type)&&(n.type=t.type),await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:t=>{var s;return{data:{providers:null!==(s=null==t?void 0:t.providers)&&void 0!==s?s:[]},error:null}}})}catch(t){if((0,h.isAuthError)(t))return{data:{providers:[]},error:t};throw t}}async _createCustomProvider(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getCustomProvider(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateCustomProvider(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteCustomProvider(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminListPasskeys(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminDeletePasskey(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.passkeyId);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}}},1217,[1195,1218,1221,1224,1222]); +__d(function(g,r,_i,_a2,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.handleError=i,_e._request=async function(e,o,t,n){var a;const i=Object.assign({},null==n?void 0:n.headers);i[s.API_VERSION_HEADER_NAME]||(i[s.API_VERSION_HEADER_NAME]=s.API_VERSIONS['2024-01-01'].name);(null==n?void 0:n.jwt)&&(i.Authorization=`Bearer ${n.jwt}`);const u=null!==(a=null==n?void 0:n.query)&&void 0!==a?a:{};(null==n?void 0:n.redirectTo)&&(u.redirect_to=n.redirectTo);const l=Object.keys(u).length?'?'+new URLSearchParams(u).toString():'',_=await c(e,o,t+l,{headers:i,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(_):{data:Object.assign({},_),error:null}},_e._sessionResponse=l,_e._sessionResponsePassword=function(e){const s=l(e);!s.error&&e.weak_password&&'object'==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&'string'==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0)&&(s.data.weak_password=e.weak_password);return s},_e._userResponse=function(e){var s;return{data:{user:null!==(s=e.user)&&void 0!==s?s:e},error:null}},_e._ssoResponse=function(e){return{data:e,error:null}},_e._generateLinkResponse=function(s){const{action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i}=s,u=(0,e.__rest)(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i},l=Object.assign({},u);return{data:{properties:c,user:l},error:null}},_e._noResolveJsonResponse=function(e){return e};var e=r(d[0]),s=r(d[1]),o=r(d[2]),t=r(d[3]);const n=e=>{if('object'==typeof e&&null!==e){const s=e;if('string'==typeof s.msg)return s.msg;if('string'==typeof s.message)return s.message;if('string'==typeof s.error_description)return s.error_description;if('string'==typeof s.error)return s.error}return JSON.stringify(e)},a=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function i(e){var i;if(!(0,o.looksLikeFetchResponse)(e))throw new t.AuthRetryableFetchError(n(e),0);if(a.includes(e.status))throw new t.AuthRetryableFetchError(n(e),e.status);let u,c;try{u=await e.json()}catch(e){throw new t.AuthUnknownError(n(e),e)}const l=(0,o.parseResponseAPIVersion)(e);if(l&&l.getTime()>=s.API_VERSIONS['2024-01-01'].timestamp&&'object'==typeof u&&u&&'string'==typeof u.code?c=u.code:'object'==typeof u&&u&&'string'==typeof u.error_code&&(c=u.error_code),c){if('weak_password'===c)throw new t.AuthWeakPasswordError(n(u),e.status,(null===(i=u.weak_password)||void 0===i?void 0:i.reasons)||[]);if('session_not_found'===c)throw new t.AuthSessionMissingError}else if('object'==typeof u&&u&&'object'==typeof u.weak_password&&u.weak_password&&Array.isArray(u.weak_password.reasons)&&u.weak_password.reasons.length&&u.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0))throw new t.AuthWeakPasswordError(n(u),e.status,u.weak_password.reasons);throw new t.AuthApiError(n(u),e.status||500,c)}const u=(e,s,o,t)=>{const n={method:e,headers:(null==s?void 0:s.headers)||{}};return'GET'===e?n:(n.headers=Object.assign({'Content-Type':'application/json;charset=UTF-8'},null==s?void 0:s.headers),n.body=JSON.stringify(t),Object.assign(Object.assign({},n),o))};async function c(e,s,o,a,c,l){const _=u(s,a,c,l);let p;try{p=await e(o,Object.assign({},_))}catch(e){throw console.error(e),new t.AuthRetryableFetchError(n(e),0)}if(p.ok||await i(p),null==a?void 0:a.noResolveJson)return p;try{return await p.json()}catch(e){await i(e)}}function l(e){var s;let t=null;_(e)&&(t=Object.assign({},e),e.expires_at||(t.expires_at=(0,o.expiresAt)(e.expires_in)));return{data:{session:t,user:null!==(s=e.user)&&void 0!==s?s:'string'==typeof(null==e?void 0:e.id)?e:null},error:null}}function _(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}},1218,[1195,1219,1221,1222]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AUTO_REFRESH_TICK_DURATION_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AUTO_REFRESH_TICK_THRESHOLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"EXPIRY_MARGIN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REFRESH_FAILURE_COOLDOWN_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"GOTRUE_URL",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"STORAGE_KEY",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"AUDIENCE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DEFAULT_HEADERS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NETWORK_FAILURE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"API_VERSION_HEADER_NAME",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"API_VERSIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BASE64URL_REGEX",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"JWKS_TTL",{enumerable:!0,get:function(){return A}});var t=r(d[0]);const n=3e4,u=3,o=9e4,c=6e4,E='http://localhost:9999',_='supabase.auth.token',b='',f={'X-Client-Info':`gotrue-js/${t.version}`},R={MAX_RETRIES:10,RETRY_INTERVAL:2},O='X-Supabase-Api-Version',p={'2024-01-01':{timestamp:Date.parse('2024-01-01T00:00:00.0Z'),name:'2024-01-01'}},l=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,A=6e5},1219,[1220]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1220,[]); +__d(function(g,r,_i,a,m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),_e2.expiresAt=function(e){return Math.round(Date.now()/1e3)+e},_e2.generateCallbackId=function(){return Symbol('auth-callback')},Object.defineProperty(_e2,"isBrowser",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e2,"supportsLocalStorage",{enumerable:!0,get:function(){return i}}),_e2.parseParametersFromURL=function(e){const t={},n=new URL(e);if(n.hash&&'#'===n.hash[0])try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch(e){}return n.searchParams.forEach((e,n)=>{t[n]=e}),t},Object.defineProperty(_e2,"resolveFetch",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e2,"looksLikeFetchResponse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e2,"setItemAsync",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e2,"getItemAsync",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e2,"removeItemAsync",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e2,"Deferred",{enumerable:!0,get:function(){return p}}),_e2.decodeJWT=function(o){const s=o.split('.');if(3!==s.length)throw new t.AuthInvalidJwtError('Invalid JWT structure');for(let n=0;n{setTimeout(()=>t(null),e)})},_e2.retryable=function(e,t){return new Promise((n,o)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await e(s);if(!t(s,null,o))return void n(o)}catch(e){if(!t(s,e))return void o(e)}})()})},_e2.generatePKCEVerifier=b,_e2.generatePKCEChallenge=S,_e2.getCodeChallengeAndMethod=async function(e,t,n=!1){const o=b();let s=o;n&&(s+='/recovery');await l(e,`${t}-code-verifier`,s);const i=await S(o);return[i,o===i?'plain':'s256']},_e2.parseResponseAPIVersion=function(t){const n=t.headers.get(e.API_VERSION_HEADER_NAME);if(!n)return null;if(!n.match(P))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch(e){return null}},_e2.validateExp=function(e){if(!e)throw new Error('Missing exp claim');const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error('JWT has expired')},_e2.getAlgorithm=function(e){switch(e){case'RS256':return{name:'RSASSA-PKCS1-v1_5',hash:{name:'SHA-256'}};case'ES256':return{name:'ECDSA',namedCurve:'P-256',hash:{name:'SHA-256'}};default:throw new Error('Invalid alg claim')}},_e2.validateUUID=function(e){if(!A.test(e))throw new Error('@supabase/auth-js: Expected parameter to be UUID but is not')},_e2.assertPasskeyExperimentalEnabled=function(e){if(!e.passkey)throw new Error('@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).')},_e2.userNotAvailableProxy=function(){return new Proxy({},{get:(e,t)=>{if('__isUserNotAvailableProxy'===t)return!0;if('symbol'==typeof t){const e=t.toString();if('Symbol(Symbol.toPrimitive)'===e||'Symbol(Symbol.toStringTag)'===e||'Symbol(util.inspect.custom)'===e)return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})},_e2.insecureUserWarningProxy=function(e,t){return new Proxy(e,{get:(e,n,o)=>{if('__isInsecureUserWarningProxy'===n)return!0;if('symbol'==typeof n){const t=n.toString();if('Symbol(Symbol.toPrimitive)'===t||'Symbol(Symbol.toStringTag)'===t||'Symbol(util.inspect.custom)'===t||'Symbol(nodejs.util.inspect.custom)'===t)return Reflect.get(e,n,o)}return t.value||'string'!=typeof n||(console.warn('Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server.'),t.value=!0),Reflect.get(e,n,o)}})},_e2.deepClone=function(e){return JSON.parse(JSON.stringify(e))};var e=r(d[0]),t=r(d[1]),n=r(d[2]);const o=()=>'undefined'!=typeof window&&'undefined'!=typeof document,s={tested:!1,writable:!1},i=()=>{if(!o())return!1;try{if('object'!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(s.tested)return s.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),s.tested=!0,s.writable=!0}catch(e){s.tested=!0,s.writable=!1}return s.writable};const u=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),c=e=>'object'==typeof e&&null!==e&&'status'in e&&'ok'in e&&'json'in e&&'function'==typeof e.json,l=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},f=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return null}},h=async(e,t)=>{await e.removeItem(t)};class p{constructor(){this.promise=new p.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function y(e){return('0'+e.toString(16)).substr(-2)}function b(){const e=new Uint32Array(56);if('undefined'==typeof crypto){const e='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~',t=e.length;let n='';for(let o=0;o<56;o++)n+=e.charAt(Math.floor(Math.random()*t));return n}return crypto.getRandomValues(e),Array.from(e,y).join('')}async function w(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest('SHA-256',t),o=new Uint8Array(n);return Array.from(o).map(e=>String.fromCharCode(e)).join('')}async function S(e){if(!('undefined'!=typeof crypto&&void 0!==crypto.subtle&&'undefined'!=typeof TextEncoder))return console.warn('WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256.'),e;const t=await w(e);return btoa(t).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'')}p.promiseConstructor=Promise;const P=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;const A=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/},1221,[1219,1222,1223]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AuthError",{enumerable:!0,get:function(){return t}}),e.isAuthError=s,Object.defineProperty(e,"AuthApiError",{enumerable:!0,get:function(){return n}}),e.isAuthApiError=function(t){return s(t)&&'AuthApiError'===t.name},Object.defineProperty(e,"AuthUnknownError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CustomAuthError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AuthSessionMissingError",{enumerable:!0,get:function(){return c}}),e.isAuthSessionMissingError=function(t){return s(t)&&'AuthSessionMissingError'===t.name},Object.defineProperty(e,"AuthInvalidTokenResponseError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"AuthInvalidCredentialsError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AuthImplicitGrantRedirectError",{enumerable:!0,get:function(){return f}}),e.isAuthImplicitGrantRedirectError=function(t){return s(t)&&'AuthImplicitGrantRedirectError'===t.name},Object.defineProperty(e,"AuthPKCEGrantCodeExchangeError",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AuthPKCECodeVerifierMissingError",{enumerable:!0,get:function(){return A}}),e.isAuthPKCECodeVerifierMissingError=function(t){return s(t)&&'AuthPKCECodeVerifierMissingError'===t.name},Object.defineProperty(e,"AuthRetryableFetchError",{enumerable:!0,get:function(){return p}}),e.isAuthRetryableFetchError=function(t){return s(t)&&'AuthRetryableFetchError'===t.name},Object.defineProperty(e,"AuthRefreshDiscardedError",{enumerable:!0,get:function(){return b}}),e.isAuthRefreshDiscardedError=function(t){return s(t)&&'AuthRefreshDiscardedError'===t.name},Object.defineProperty(e,"AuthWeakPasswordError",{enumerable:!0,get:function(){return O}}),e.isAuthWeakPasswordError=function(t){return s(t)&&'AuthWeakPasswordError'===t.name},Object.defineProperty(e,"AuthInvalidJwtError",{enumerable:!0,get:function(){return P}});class t extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name='AuthError',this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function s(t){return'object'==typeof t&&null!==t&&'__isAuthError'in t}class n extends t{constructor(t,s,n){super(t,s,n),this.name='AuthApiError',this.status=s,this.code=n}}class o extends t{constructor(t,s){super(t),this.name='AuthUnknownError',this.originalError=s}}class u extends t{constructor(t,s,n,o){super(t,n,o),this.name=s,this.status=n}}class c extends u{constructor(){super('Auth session missing!','AuthSessionMissingError',400,void 0)}}class h extends u{constructor(){super('Auth session or user missing','AuthInvalidTokenResponseError',500,void 0)}}class l extends u{constructor(t){super(t,'AuthInvalidCredentialsError',400,void 0)}}class f extends u{constructor(t,s=null){super(t,'AuthImplicitGrantRedirectError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class E extends u{constructor(t,s=null){super(t,'AuthPKCEGrantCodeExchangeError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class A extends u{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.",'AuthPKCECodeVerifierMissingError',400,'pkce_code_verifier_not_found')}}class p extends u{constructor(t,s){super(t,'AuthRetryableFetchError',s,void 0)}}class b extends u{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,'AuthRefreshDiscardedError',409,void 0)}}class O extends u{constructor(t,s,n){super(t,'AuthWeakPasswordError',s,'weak_password'),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class P extends u{constructor(t){super(t,'AuthInvalidJwtError',400,'invalid_jwt')}}},1222,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.byteToBase64URL=o,e.byteFromBase64URL=i,e.stringToBase64URL=function(t){const u=[],n=t=>{u.push(t)},i={queue:0,queuedBits:0};return f(t,t=>{o(t,i,n)}),o(null,i,n),u.join('')},e.stringFromBase64URL=function(t){const u=[],n=t=>{u.push(String.fromCodePoint(t))},o={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},f=t=>{c(t,o,n)};for(let u=0;u{u.push(t)};for(let u=0;uu.push(t)),new Uint8Array(u)},e.bytesToBase64URL=function(t){const u=[],n={queue:0,queuedBits:0},i=t=>{u.push(t)};return t.forEach(t=>o(t,n,i)),o(null,n,i),u.join('')};const t='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'.split(''),u=' \t\n\r='.split(''),n=(()=>{const n=new Array(128);for(let t=0;t=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}}function i(t,u,o){const i=n[t];if(!(i>-1)){if(-2===i)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}for(u.queue=u.queue<<6|i,u.queuedBits+=6;u.queuedBits>=8;)o(u.queue>>u.queuedBits-8&255),u.queuedBits-=8}function s(t,u){if(!(t<=127)){if(t<=2047)return u(192|t>>6),void u(128|63&t);if(t<=65535)return u(224|t>>12),u(128|t>>6&63),void u(128|63&t);if(t<=1114111)return u(240|t>>18),u(128|t>>12&63),u(128|t>>6&63),void u(128|63&t);throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}u(t)}function f(t,u){for(let n=0;n55295&&o<=56319){const u=1024*(o-55296)&65535;o=65536+(t.charCodeAt(n+1)-56320&65535|u),n+=1}s(o,u)}}function c(t,u,n){if(0===u.utf8seq){if(t<=127)return void n(t);for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){u.utf8seq=n;break}if(2===u.utf8seq)u.codepoint=31&t;else if(3===u.utf8seq)u.codepoint=15&t;else{if(4!==u.utf8seq)throw new Error('Invalid UTF-8 sequence');u.codepoint=7&t}u.utf8seq-=1}else if(u.utf8seq>0){if(t<=127)throw new Error('Invalid UTF-8 sequence');u.codepoint=u.codepoint<<6|63&t,u.utf8seq-=1,0===u.utf8seq&&n(u.codepoint)}}},1223,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SIGN_OUT_SCOPES",{enumerable:!0,get:function(){return t}});const t=['global','local','others']},1224,[]); +__d(function(e,t,s,r,i,n,a){"use strict";Object.defineProperty(n,'__esModule',{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return A}});var o,l=t(a[0]),u=(o=l)&&o.__esModule?o:{default:o},h=t(a[1]),c=t(a[2]),d=t(a[3]),_=t(a[4]),g=t(a[5]),w=t(a[6]),y=t(a[7]),f=t(a[8]),p=t(a[9]),v=t(a[10]),b=t(a[11]);(0,y.polyfillGlobalThis)();const k={url:h.GOTRUE_URL,storageKey:h.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:h.DEFAULT_HEADERS,flowType:'implicit',debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},m={};class R{get jwks(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{cachedAt:e})}constructor(e){var t,s,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},k),e);if(this.storageKey=i.storageKey,this.instanceID=null!==(t=R.nextInstanceID[this.storageKey])&&void 0!==t?t:0,R.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,'function'==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&(0,_.isBrowser)()){const e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=null!==(s=i.experimental)&&void 0!==s?s:{},this.admin=new u.default({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=(0,_.resolveFetch)(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,null!=i.lock&&(this.lock=i.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new b.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,_.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),(0,_.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error('Failed to create a new BroadcastChannel, multi-tab state changes will not be available',e)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener('message',async e=>{this._debug('received broadcast notification from other tab or client',e),'TOKEN_REFRESHED'!==e.data.event&&'SIGNED_IN'!==e.data.event||(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug('#broadcastChannel','error',e)}})}i.skipAutoInitialize||this.initialize().catch(e=>{this._debug('#initialize()','error',e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${f.version}) ${(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())()),await this.initializePromise}async _initialize(){var e;try{let t={},s='none';if((0,_.isBrowser)()&&(t=(0,_.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(t)?s='implicit':await this._isPKCECallback(t)&&(s='pkce')),(0,_.isBrowser)()&&this.detectSessionInUrl&&'none'!==s){const{data:r,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug('#_initialize()','error detecting session from URL',i),(0,c.isAuthImplicitGrantRedirectError)(i)){const t=null===(e=i.details)||void 0===e?void 0:e.code;if('identity_already_exists'===t||'identity_not_found'===t||'single_identity_not_deletable'===t)return{error:i}}return{error:i}}const{session:n,redirectType:a}=r;return this._debug('#_initialize()','detected session in URL',n,'redirect type',a),await this._saveSession(n),setTimeout(async()=>{'recovery'===a?await this._notifyAllSubscribers('PASSWORD_RECOVERY',n):await this._notifyAllSubscribers('SIGNED_IN',n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return(0,c.isAuthError)(e)?this._returnResult({error:e}):this._returnResult({error:new c.AuthUnknownError('Unexpected error during initialization',e)})}finally{await this._handleVisibilityChange(),this._debug('#_initialize()','end')}}async signInAnonymously(e){var t,s,r;try{const i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{data:null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==s?s:{},gotrue_meta_security:{captcha_token:null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken}},xform:d._sessionResponse}),{data:n,error:a}=i;if(a||!n)return this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,s,r;try{let i;if('email'in e){const{email:s,password:r,options:n}=e;let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey)),i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:d._sessionResponse})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:t,password:n,options:a}=e;i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null==a?void 0:a.data)&&void 0!==s?s:{},channel:null!==(r=null==a?void 0:a.channel)&&void 0!==r?r:'sms',gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:d._sessionResponse})}}const{data:n,error:a}=i;if(a||!n)return await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if('email'in e){const{email:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}}const{data:s,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!s||!s.session||!s.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers('SIGNED_IN',s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,null!=this.lock?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:t}=e;switch(t){case'ethereum':return await this.signInWithEthereum(e);case'solana':return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,s,r,i,n,a,o,l,u,h,g;let w,y;if('message'in e)w=e.message,y=e.signature;else{const{chain:h,wallet:c,statement:d,options:g}=e;let f;if((0,_.isBrowser)())if('object'==typeof c)f=c;else{const e=window;if(!('ethereum'in e)||'object'!=typeof e.ethereum||!('request'in e.ethereum)||'function'!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");f=e.ethereum}else{if('object'!=typeof c||!(null==g?void 0:g.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');f=c}const p=new URL(null!==(t=null==g?void 0:g.url)&&void 0!==t?t:window.location.href),b=await f.request({method:'eth_requestAccounts'}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=(0,v.getAddress)(b[0]);let m=null===(s=null==g?void 0:g.signInWithEthereum)||void 0===s?void 0:s.chainId;if(!m){const e=await f.request({method:'eth_chainId'});m=(0,v.fromHex)(e)}const R={domain:p.host,address:k,statement:d,uri:p.href,version:'1',chainId:m,nonce:null===(r=null==g?void 0:g.signInWithEthereum)||void 0===r?void 0:r.nonce,issuedAt:null!==(n=null===(i=null==g?void 0:g.signInWithEthereum)||void 0===i?void 0:i.issuedAt)&&void 0!==n?n:new Date,expirationTime:null===(a=null==g?void 0:g.signInWithEthereum)||void 0===a?void 0:a.expirationTime,notBefore:null===(o=null==g?void 0:g.signInWithEthereum)||void 0===o?void 0:o.notBefore,requestId:null===(l=null==g?void 0:g.signInWithEthereum)||void 0===l?void 0:l.requestId,resources:null===(u=null==g?void 0:g.signInWithEthereum)||void 0===u?void 0:u.resources};w=(0,v.createSiweMessage)(R),y=await f.request({method:'personal_sign',params:[(0,v.toHex)(w),k]})}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'ethereum',message:w,signature:y},(null===(h=e.options)||void 0===h?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null===(g=e.options)||void 0===g?void 0:g.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,s,r,i,n,a,o,l,u,h,g,w;let y,f;if('message'in e)y=e.message,f=e.signature;else{const{chain:c,wallet:d,statement:g,options:w}=e;let p;if((0,_.isBrowser)())if('object'==typeof d)p=d;else{const e=window;if(!('solana'in e)||'object'!=typeof e.solana||!('signIn'in e.solana&&'function'==typeof e.solana.signIn||'signMessage'in e.solana&&'function'==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");p=e.solana}else{if('object'!=typeof d||!(null==w?void 0:w.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');p=d}const v=new URL(null!==(t=null==w?void 0:w.url)&&void 0!==t?t:window.location.href);if('signIn'in p&&p.signIn){const e=await p.signIn(Object.assign(Object.assign(Object.assign({issuedAt:(new Date).toISOString()},null==w?void 0:w.signInWithSolana),{version:'1',domain:v.host,uri:v.href}),g?{statement:g}:null));let t;if(Array.isArray(e)&&e[0]&&'object'==typeof e[0])t=e[0];else{if(!(e&&'object'==typeof e&&'signedMessage'in e&&'signature'in e))throw new Error('@supabase/auth-js: Wallet method signIn() returned unrecognized value');t=e}if(!('signedMessage'in t&&'signature'in t&&('string'==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields');y='string'==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),f=t.signature}else{if(!('signMessage'in p&&'function'==typeof p.signMessage&&'publicKey'in p&&'object'==typeof p&&p.publicKey&&'toBase58'in p.publicKey&&'function'==typeof p.publicKey.toBase58))throw new Error('@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API');y=[`${v.host} wants you to sign in with your Solana account:`,p.publicKey.toBase58(),...g?['',g,'']:[''],'Version: 1',`URI: ${v.href}`,`Issued At: ${null!==(r=null===(s=null==w?void 0:w.signInWithSolana)||void 0===s?void 0:s.issuedAt)&&void 0!==r?r:(new Date).toISOString()}`,...(null===(i=null==w?void 0:w.signInWithSolana)||void 0===i?void 0:i.notBefore)?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...(null===(n=null==w?void 0:w.signInWithSolana)||void 0===n?void 0:n.expirationTime)?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...(null===(a=null==w?void 0:w.signInWithSolana)||void 0===a?void 0:a.chainId)?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...(null===(o=null==w?void 0:w.signInWithSolana)||void 0===o?void 0:o.nonce)?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...(null===(l=null==w?void 0:w.signInWithSolana)||void 0===l?void 0:l.requestId)?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...(null===(h=null===(u=null==w?void 0:w.signInWithSolana)||void 0===u?void 0:u.resources)||void 0===h?void 0:h.length)?['Resources',...w.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join('\n');const e=await p.signMessage((new TextEncoder).encode(y),'utf8');if(!(e&&e instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet signMessage() API returned an recognized value');f=e}}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'solana',message:y,signature:(0,p.bytesToBase64URL)(f)},(null===(g=e.options)||void 0===g?void 0:g.captchaToken)?{gotrue_meta_security:{captcha_token:null===(w=e.options)||void 0===w?void 0:w.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!=t?t:'').split('/');try{if(!s&&'pkce'===this.flowType)throw new c.AuthPKCECodeVerifierMissingError;const{data:t,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:d._sessionResponse});if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('recovery'===r?'PASSWORD_RECOVERY':'SIGNED_IN',t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=r?r:null}),error:i})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,a=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:d._sessionResponse}),{data:o,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o||!o.session||!o.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers('SIGNED_IN',o.session)),this._returnResult({data:o,error:l})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if('email'in e){const{email:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null==i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:t,options:s}=e,{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null==s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null==s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},channel:null!==(n=null==s?void 0:s.channel)&&void 0!==n?n:'sms'}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number.')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,s;try{let r,i;'options'in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:a}=await(0,d._request)(this.fetch,'POST',`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:d._sessionResponse});if(a)throw a;if(!n){throw new Error('An error occurred on token verification.')}const o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers('recovery'==e.type?'PASSWORD_RECOVERY':'SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,s,r,i,n;try{let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const l=await(0,d._request)(this.fetch,'POST',`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},'providerId'in e?{provider_id:e.providerId}:null),'domain'in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:o}),headers:this.headers,xform:d._ssoResponse});return(null===(i=l.data)||void 0===i?void 0:i.url)&&(0,_.isBrowser)()&&!(null===(n=e.options)||void 0===n?void 0:n.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new c.AuthSessionMissingError;const{error:r}=await(0,d._request)(this.fetch,'GET',`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if('email'in e){const{email:s,type:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return o&&await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:s,type:r,options:i}=e,{data:n,error:a}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a type')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,t){this._debug('#_acquireLock','begin',e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug('#_acquireLock','lock acquired for storage key',this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug('#_acquireLock','lock released for storage key',this.storageKey),this.lockAcquired=!1}})}finally{this._debug('#_acquireLock','end')}}async _useSession(e){this._debug('#_useSession','begin');try{const t=await this.__loadSession();return await e(t)}finally{this._debug('#_useSession','end')}}async __loadSession(){this._debug('#__loadSession()','begin'),null==this.lock||this.lockAcquired||this._debug('#__loadSession()','used outside of an acquired lock!',(new Error).stack);try{let e=null;const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(this._debug('#getSession()','session from storage',t),null!==t&&(this._isValidSession(t)?e=t:(this._debug('#getSession()','session from storage is not valid'),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&1e3*e.expires_at-Date.now()Date.now())){const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(t&&t.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:r},error:null})}finally{this._debug('#__loadSession()','end')}}async getUser(e){if(e)return await this._getUser(e);let t;return await this.initializePromise,t=null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):await this._getUser(),t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:e,xform:d._userResponse}):await this._useSession(async e=>{var t,s,r;const{data:i,error:n}=e;if(n)throw n;return(null===(t=i.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0,xform:d._userResponse}):{data:{user:null},error:new c.AuthSessionMissingError}})}catch(e){if((0,c.isAuthError)(e))return(0,c.isAuthSessionMissingError)(e)&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t)):await this._updateUser(e,t)}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new c.AuthSessionMissingError;const n=r.session;let a=null,o=null;'pkce'===this.flowType&&null!=e.email&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{data:l,error:u}=await(0,d._request)(this.fetch,'PUT',`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:d._userResponse});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers('USER_UPDATED',n),this._returnResult({data:{user:n.user},error:null})})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new c.AuthSessionMissingError;const t=Date.now()/1e3;let s=t,r=!0,i=null;const{payload:n}=(0,_.decodeJWT)(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{data:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:'bearer',expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers('SIGNED_IN',i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null==e?void 0:e.refresh_token))throw new c.AuthSessionMissingError;const{data:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var s;try{if(!(0,_.isBrowser)())throw new c.AuthImplicitGrantRedirectError('No browser detected.');if(e.error||e.error_description||e.error_code)throw new c.AuthImplicitGrantRedirectError(e.error_description||'Error in URL with unspecified error_description',{error:e.error||'unspecified_error',code:e.error_code||'unspecified_code'});switch(t){case'implicit':if('pkce'===this.flowType)throw new c.AuthPKCEGrantCodeExchangeError('Not a valid PKCE flow url.');break;case'pkce':if('implicit'===this.flowType)throw new c.AuthImplicitGrantRedirectError('Not a valid implicit grant flow url.')}if('pkce'===t){if(this._debug('#_initialize()','begin','is PKCE flow',!0),!e.code)throw new c.AuthPKCEGrantCodeExchangeError('No code detected.');const{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;const i=new URL(window.location.href);return i.searchParams.delete('code'),window.history.replaceState(window.history.state,'',i.toString()),{data:{session:t.session,redirectType:null!==(s=t.redirectType)&&void 0!==s?s:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:n,refresh_token:a,expires_in:o,expires_at:l,token_type:u}=e;if(!(n&&o&&a&&u))throw new c.AuthImplicitGrantRedirectError('No session defined in URL');const d=Math.round(Date.now()/1e3),g=parseInt(o);let w=d+g;l&&(w=parseInt(l));const y=w-d;1e3*y<=h.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${g}s`);const f=w-g;d-f>=120?console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale',f,w,d):d-f<0&&console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew',f,w,d);const{data:p,error:v}=await this._getUser(n);if(v)throw v;const b={provider_token:r,provider_refresh_token:i,access_token:n,expires_in:g,expires_at:w,refresh_token:a,token_type:u,user:p.user};return window.location.hash='',this._debug('#_getSessionFromURL()','clearing window.location.hash'),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return'function'==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:'global'}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:'global'}){return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i&&!(0,c.isAuthSessionMissingError)(i))return this._returnResult({error:i});const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!(0,c.isAuthApiError)(t)||404!==t.status&&401!==t.status&&403!==t.status)&&!(0,c.isAuthSessionMissingError)(t))return this._returnResult({error:t})}return'others'!==e&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=(0,_.generateCallbackId)(),s={id:t,callback:e,unsubscribe:()=>{this._debug('#unsubscribe()','state change callback with id removed',t),this.stateChangeEmitters.delete(t)}};return this._debug('#onAuthStateChange()','registered callback with id',t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)}):await this._emitInitialSession(t)})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback('INITIAL_SESSION',r)),this._debug('INITIAL_SESSION','callback id',e,'session',r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback('INITIAL_SESSION',null)),this._debug('INITIAL_SESSION','callback id',e,'error',t),(0,c.isAuthSessionMissingError)(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let s=null,r=null;'pkce'===this.flowType&&([s,r]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,d._request)(this.fetch,'POST',`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return'token'in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:s,error:r}=await this._useSession(async t=>{var s,r,i,n,a;const{data:o,error:l}=t;if(l)throw l;const u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await(0,d._request)(this.fetch,'GET',u,{headers:this.headers,jwt:null!==(a=null===(n=o.session)||void 0===n?void 0:n.access_token)&&void 0!==a?a:void 0})});if(r)throw r;return(0,_.isBrowser)()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==s?void 0:s.url),this._returnResult({data:{provider:e.provider,url:null==s?void 0:s.url},error:null})}catch(t){if((0,c.isAuthError)(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var s;try{const{error:r,data:{session:i}}=t;if(r)throw r;const{options:n,provider:a,token:o,access_token:l,nonce:u}=e,h=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(s=null==i?void 0:i.access_token)&&void 0!==s?s:void 0,body:{provider:a,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:d._sessionResponse}),{data:_,error:g}=h;return g?this._returnResult({data:{user:null,session:null},error:g}):_&&_.session&&_.user?(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers('USER_UPDATED',_.session)),this._returnResult({data:_,error:g})):this._returnResult({data:{user:null,session:null},error:new c.AuthInvalidTokenResponseError})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){const t="#_refreshAccessToken()";this._debug(t,'begin');try{const s=Date.now();return await(0,_.retryable)(async s=>(s>0&&await(0,_.sleep)(200*Math.pow(2,s-1)),this._debug(t,'refreshing attempt',s),await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:d._sessionResponse})),(e,t)=>{const r=200*Math.pow(2,e);return t&&(0,c.isAuthRetryableFetchError)(t)&&Date.now()+r-sDate.now())?this._debug(r,'proactive refresh failed, access token still valid \u2014 preserving session'):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:s,expiresAt:Date.now()+h.REFRESH_FAILURE_COOLDOWN_MS},null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,'end')}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,'begin',t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map(async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(i),r.length>0){for(let e=0;ethis._autoRefreshTokenTick(),h.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&'object'==typeof e&&'function'==typeof e.unref?e.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&'object'==typeof t&&'function'==typeof t.unref?t.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug('#_stopAutoRefresh()');const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),null===(e=this.broadcastChannel)||void 0===e||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug('#_autoRefreshTokenTick()','begin'),null==this.lock)if(null===this.refreshingDeferred)try{const e=Date.now();try{await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}else this._debug('#_autoRefreshTokenTick()','refresh already in flight, skipping');else try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}})}catch(e){if(!(e instanceof w.LockAcquireTimeoutError))throw e;this._debug('auto refresh token tick lock not available')}}async _handleVisibilityChange(){if(this._debug('#_handleVisibilityChange()'),!(0,_.isBrowser)()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug('#visibilityChangedCallback','error',e)}},null===window||void 0===window||window.addEventListener('visibilitychange',this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error('_handleVisibilityChange',e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;if(this._debug(t,'visibilityState',document.visibilityState),'visible'===document.visibilityState){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,null!=this.lock)await this._acquireLock(this.lockAcquireTimeout,async()=>{'visible'===document.visibilityState?await this._recoverAndRefresh():this._debug(t,'acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting')});else{if('visible'!==document.visibilityState)return void this._debug(t,'visibilityState is no longer visible, skipping recovery');await this._recoverAndRefresh()}}else'hidden'===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null==s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null==s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),'pkce'===this.flowType){const[e,t]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey),s=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(s.toString())}if(null==s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null==s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join('&')}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;return i?this._returnResult({data:null,error:i}):await(0,d._request)(this.fetch,'DELETE',`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)return this._returnResult({data:null,error:n});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},'phone'===e.factorType?{phone:e.phone}:'totp'===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors`,{body:a,headers:this.headers,jwt:null===(s=null==i?void 0:i.session)||void 0===s?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):('totp'===e.factorType&&'totp'===o.type&&(null===(r=null==o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=Object.assign({challenge_id:e.challengeId},'webauthn'in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:'create'===e.webauthn.type?(0,b.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,b.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/verify`,{body:n,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers('MFA_CHALLENGE_VERIFIED',a),this._returnResult({data:a,error:o}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challenge(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});if(n.error)return n;const{data:a}=n;if('webauthn'!==a.type)return{data:a,error:null};switch(a.webauthn.type){case'create':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case'request':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:s}=await this.getUser();if(s)return{data:null,error:s};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])r.all.push(s),'verified'===s.status&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,s,r,i;if(e)try{const{payload:r}=(0,_.decodeJWT)(e);let i=null;r.aal&&(i=r.aal);let n=i;const{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!==(s=null===(t=null==a?void 0:a.factors)||void 0===t?void 0:t.filter(e=>'verified'===e.status))&&void 0!==s?s:[]).length>0&&(n='aal2');return{data:{currentLevel:i,nextLevel:n,currentAuthenticationMethods:r.amr||[]},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}const{data:{session:n},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=(0,_.decodeJWT)(n.access_token);let l=null;o.aal&&(l=o.aal);let u=l;(null!==(i=null===(r=n.user.factors)||void 0===r?void 0:r.filter(e=>'verified'===e.status))&&void 0!==i?i:[]).length>0&&(u='aal2');return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?await(0,d._request)(this.fetch,'GET',`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'approve'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'deny'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;return s?this._returnResult({data:null,error:s}):t?await(0,d._request)(this.fetch,'GET',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?(await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let s=t.keys.find(t=>t.kid===e);if(s)return s;const r=Date.now();if(s=this.jwks.keys.find(t=>t.kid===e),s&&this.jwks_cached_at+h.JWKS_TTL>r)return s;const{data:i,error:n}=await(0,d._request)(this.fetch,'GET',`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(n)throw n;return i.keys&&0!==i.keys.length?(this.jwks=i,this.jwks_cached_at=r,s=i.keys.find(t=>t.kid===e),s||null):null}async getClaims(e,t={}){try{let s=e;if(!s){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}const{header:r,payload:i,signature:n,raw:{header:a,payload:o}}=(0,_.decodeJWT)(s);if(!(null==t?void 0:t.allowExpired))try{(0,_.validateExp)(i.exp)}catch(e){throw new c.AuthInvalidJwtError(e instanceof Error?e.message:'JWT validation failed')}const l=r.alg&&!r.alg.startsWith('HS')&&r.kid&&'crypto'in globalThis&&'subtle'in globalThis.crypto?await this.fetchJwk(r.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!l){const{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:i,header:r,signature:n},error:null}}const u=(0,_.getAlgorithm)(r.alg),h=await crypto.subtle.importKey('jwk',l,u,!0,['verify']);if(!await crypto.subtle.verify(u,h,n,(0,p.stringToUint8Array)(`${a}.${o}`)))throw new c.AuthInvalidJwtError('Invalid JWT signature');return{data:{claims:i,header:r,signature:n},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,s,r;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:i,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}});if(n||!i)return this._returnResult({data:null,error:n});const a=(0,b.deserializeCredentialRequestOptions)(i.options),o=null!==(r=null===(s=null==e?void 0:e.options)||void 0===s?void 0:s.signal)&&void 0!==r?r:b.webAuthnAbortService.createNewAbortSignal(),{data:l,error:u}=await(0,b.getCredential)({publicKey:a,signal:o});if(u||!l)return this._returnResult({data:null,error:null!=u?u:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const h=(0,b.serializeCredentialRequestResponse)(l);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,s;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const n=(0,b.deserializeCredentialCreationOptions)(r.options),a=null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.signal)&&void 0!==s?s:b.webAuthnAbortService.createNewAbortSignal(),{data:o,error:l}=await(0,b.createCredential)({publicKey:n,signal:a});if(l||!o)return this._returnResult({data:null,error:null!=l?l:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const u=(0,b.serializeCredentialCreationResponse)(o);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:s,error:r}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:s,error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:d._sessionResponse});return s?this._returnResult({data:null,error:s}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:t,error:null}))}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'GET',`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'PATCH',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:e.friendlyName}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{error:i}=await(0,d._request)(this.fetch,'DELETE',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}}R.nextInstanceID={};var A=R},1225,[1217,1219,1222,1218,1221,1226,1227,1228,1220,1223,1229,1230]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.memoryLocalStorageAdapter=function(t={}){return{getItem:o=>t[o]||null,setItem:(o,n)=>{t[o]=n},removeItem:o=>{delete t[o]}}}},1226,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"internals",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"LockAcquireTimeoutError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"ProcessLockAcquireTimeoutError",{enumerable:!0,get:function(){return s}}),_e.navigatorLock=async function(e,t,s){o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire lock',e,t);const c=new globalThis.AbortController;let l;t>0&&(l=setTimeout(()=>{c.abort(),o.debug&&console.log('@supabase/gotrue-js: navigatorLock acquire timed out',e)},t));await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:'exclusive',ifAvailable:!0}:{mode:'exclusive',signal:c.signal},async c=>{if(!c){if(0===t)throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: not immediately available',e),new n(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(o.debug)try{const e=await globalThis.navigator.locks.query();console.log('@supabase/gotrue-js: Navigator LockManager state',JSON.stringify(e,null,' '))}catch(e){console.warn('@supabase/gotrue-js: Error when querying Navigator LockManager state',e)}return console.warn('@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request'),clearTimeout(l),await s()}clearTimeout(l),o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquired',e,c.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released',e,c.name)}})}catch(u){if(t>0&&clearTimeout(l),null!==u&&'object'==typeof u&&'name'in u&&'AbortError'===u.name&&t>0){if(c.signal.aborted)return o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock',e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:'exclusive',steal:!0},async t=>{if(!t)return console.warn('@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true'),await s();o.debug&&console.log('@supabase/gotrue-js: navigatorLock: recovered (stolen)',e,t.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released (stolen)',e,t.name)}}));throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: lock was stolen by another request',e),new n(`Lock "${e}" was released because another request stole it`)}throw u}},_e.processLock=async function(e,o,n){var l;const u=null!==(l=c[e])&&void 0!==l?l:Promise.resolve(),b=(async()=>{try{return await u,null}catch(e){return null}})(),k=(async()=>{let c=null;try{const t=o>=0?new Promise((t,n)=>{c=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${e}" acquisition timed out after ${o}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),n(new s(`Acquiring process lock with name "${e}" timed out`))},o)}):null;await Promise.race([b,t].filter(e=>e)),null!==c&&clearTimeout(c)}catch(e){if(null!==c&&clearTimeout(c),e instanceof t)throw e}return await n()})();return c[e]=(async()=>{try{return await k}catch(e){if(e instanceof t){try{await u}catch(e){}return null}throw e}})(),await k};var e=r(d[0]);const o={debug:!!(globalThis&&(0,e.supportsLocalStorage)()&&globalThis.localStorage&&'true'===globalThis.localStorage.getItem('supabase.gotrue-js.locks.debug'))};class t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class n extends t{}class s extends t{}const c={}},1227,[1221]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.polyfillGlobalThis=function(){if('object'==typeof globalThis)return;try{Object.defineProperty(Object.prototype,'__magic__',{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){'undefined'!=typeof self&&(self.globalThis=self)}}},1228,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}Object.defineProperty(e,'__esModule',{value:!0}),e.getAddress=t,e.fromHex=function(t){return parseInt(t,16)},e.toHex=function(t){const n=(new TextEncoder).encode(t);return'0x'+Array.from(n,t=>t.toString(16).padStart(2,'0')).join('')},e.createSiweMessage=function(n){var s;const{chainId:o,domain:u,expirationTime:c,issuedAt:l=new Date,nonce:f,notBefore:I,requestId:v,resources:h,scheme:$,uri:w,version:E}=n;if(!Number.isInteger(o))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${o}`);if(!u)throw new Error("@supabase/auth-js: Invalid SIWE message field \"domain\". Domain must be provided.");if(f&&f.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${f}`);if(!w)throw new Error("@supabase/auth-js: Invalid SIWE message field \"uri\". URI must be provided.");if('1'!==E)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${E}`);if(null===(s=n.statement)||void 0===s?void 0:s.includes('\n'))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`);const S=t(n.address),b=$?`${$}://${u}`:u,p=n.statement?`${n.statement}\n`:'',j=`${b} wants you to sign in with your Ethereum account:\n${S}\n\n${p}`;let x=`URI: ${w}\nVersion: ${E}\nChain ID: ${o}${f?`\nNonce: ${f}`:''}\nIssued At: ${l.toISOString()}`;c&&(x+=`\nExpiration Time: ${c.toISOString()}`);I&&(x+=`\nNot Before: ${I.toISOString()}`);v&&(x+=`\nRequest ID: ${v}`);if(h){let t='\nResources:';for(const n of h){if(!n||'string'!=typeof n)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${n}`);t+=`\n- ${n}`}x+=t}return`${j}\n${x}`}},1229,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return l.WebAuthnError}}),Object.defineProperty(e,"isWebAuthnError",{enumerable:!0,get:function(){return l.isWebAuthnError}}),Object.defineProperty(e,"identifyRegistrationError",{enumerable:!0,get:function(){return l.identifyRegistrationError}}),Object.defineProperty(e,"identifyAuthenticationError",{enumerable:!0,get:function(){return l.identifyAuthenticationError}}),Object.defineProperty(e,"WebAuthnAbortService",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"webAuthnAbortService",{enumerable:!0,get:function(){return u}}),e.deserializeCredentialCreationOptions=function(i){if(!i)throw new Error('Credential creation options are required');if('undefined'!=typeof PublicKeyCredential&&'parseCreationOptionsFromJSON'in PublicKeyCredential&&'function'==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:o,user:l,excludeCredentials:s}=i,u=(0,t.__rest)(i,["challenge","user","excludeCredentials"]),c=(0,n.base64UrlToUint8Array)(o).buffer,f=Object.assign(Object.assign({},l),{id:(0,n.base64UrlToUint8Array)(l.id).buffer}),h=Object.assign(Object.assign({},u),{challenge:c,user:f});if(s&&s.length>0){h.excludeCredentials=new Array(s.length);for(let t=0;t0){c.allowCredentials=new Array(l.length);for(let t=0;tnull!==t&&'object'==typeof t&&!Array.isArray(t),i=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),o={};for(const l of t)if(l)for(const t in l){const s=l[t];if(void 0!==s)if(Array.isArray(s))o[t]=s;else if(i(s))o[t]=s;else if(n(s)){const i=o[t];n(i)?o[t]=p(i,s):o[t]=p(s)}else o[t]=s}return o}function w(t,n){return p(b,t,n||{})}function A(t,n){return p(y,t,n||{})}class O{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:'webauthn'}))}async _challenge({factorId:t,webauthn:n,friendlyName:o,signal:l},s){var c;try{const{data:i,error:b}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!i)return{data:null,error:b};const y=null!=l?l:u.createNewAbortSignal();if('create'===i.webauthn.type){const{user:t}=i.webauthn.credential_options.publicKey;if(!t.name){const n=o;if(n)t.name=`${t.id}:${n}`;else{const n=(await this.client.getUser()).data.user,i=(null===(c=null==n?void 0:n.user_metadata)||void 0===c?void 0:c.name)||(null==n?void 0:n.email)||(null==n?void 0:n.id)||'User';t.name=`${t.id}:${i}`}}t.displayName||(t.displayName=t.name)}switch(i.webauthn.type){case'create':{const n=w(i.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:o,error:l}=await f({publicKey:n,signal:y});return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}case'request':{const n=A(i.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:o,error:l}=await h(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:n,signal:y}));return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in challenge',t)}}}async _verify({challengeId:t,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:i})}async _authenticate({factorId:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn authentication')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:o},signal:l},{request:s});if(!u)return{data:null,error:f};const{webauthn:h}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:o,credential_response:h.credential_response}})}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in authenticate',t)}}}async _register({friendlyName:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn registration')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(n=>{var i;return null===(i=n.data)||void 0===i?void 0:i.all.find(n=>'webauthn'===n.factor_type&&n.friendly_name===t&&'unverified'!==n.status)}).then(t=>t?this.client.mfa.unenroll({factorId:null==t?void 0:t.id}):void 0),{data:null,error:f};const{data:h,error:b}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:o},signal:l},{create:s});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:o,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:b}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in register',t)}}}}},1230,[1195,1223,1222,1221,1231]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebAuthnUnknownError",{enumerable:!0,get:function(){return t}}),e.isWebAuthnError=function(n){return'object'==typeof n&&null!==n&&'__isWebAuthnError'in n},e.identifyRegistrationError=function({error:t,options:s}){var u,c,R;const{publicKey:E}=s;if(!E)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Registration ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else if('ConstraintError'===t.name){if(!0===(null===(u=E.authenticatorSelection)||void 0===u?void 0:u.requireResidentKey))return new o({message:'Discoverable credentials were required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',cause:t});if('conditional'===s.mediation&&'required'===(null===(c=E.authenticatorSelection)||void 0===c?void 0:c.userVerification))return new o({message:'User verification was required during automatic registration but it could not be performed',code:'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',cause:t});if('required'===(null===(R=E.authenticatorSelection)||void 0===R?void 0:R.userVerification))return new o({message:'User verification was required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',cause:t})}else{if('InvalidStateError'===t.name)return new o({message:'The authenticator was previously registered',code:'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',cause:t});if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('NotSupportedError'===t.name){return 0===E.pubKeyCredParams.filter(n=>'public-key'===n.type).length?new o({message:'No entry in pubKeyCredParams was of type "public-key"',code:'ERROR_MALFORMED_PUBKEYCREDPARAMS',cause:t}):new o({message:'No available authenticator supported any of the specified pubKeyCredParams algorithms',code:'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',cause:t})}if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(E.rp.id!==s)return new o({message:`The RP ID "${E.rp.id}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('TypeError'===t.name){if(E.user.id.byteLength<1||E.user.id.byteLength>64)return new o({message:'User ID was not between 1 and 64 characters',code:'ERROR_INVALID_USER_ID_LENGTH',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new credential',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})},e.identifyAuthenticationError=function({error:t,options:s}){const{publicKey:u}=s;if(!u)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Authentication ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else{if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(u.rpId!==s)return new o({message:`The RP ID "${u.rpId}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new assertion signature',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})};var n=r(d[0]);class o extends Error{constructor({message:n,code:o,cause:t,name:s}){var u;super(n,{cause:t}),this.__isWebAuthnError=!0,this.name=null!==(u=null!=s?s:t instanceof Error?t.name:void 0)&&void 0!==u?u:'Unknown Error',this.code=o}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class t extends o{constructor(n,o){super({code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:o,message:n}),this.name='WebAuthnUnknownError',this.originalError=o}}},1231,[1230]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1232,[1217]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1233,[1225]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.setSyncNamespace=function(e){s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:${e}:`:`cc-sync:${e}:`},Object.defineProperty(_e,"syncNamespace",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"kv",{enumerable:!0,get:function(){return i}}),_e.uuid=function(){const e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();const t=new Uint8Array(16);if(e?.getRandomValues)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,'0')).join('');return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`};var e,t=r(d[0]),n=r(d[1]),c=(e=n)&&e.__esModule?e:{default:e};let s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:`:'cc-sync:';const o=()=>s,i={async get(e,t){try{const n=await c.default.getItem(s+e);return null==n?t:JSON.parse(n)}catch{return t}},async set(e,t){try{await c.default.setItem(s+e,JSON.stringify(t))}catch{}},async remove(e){try{await c.default.removeItem(s+e)}catch{}}}},1234,[5,1160]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UK14",{enumerable:!0,get:function(){return t}}),e.cardAllergenMap=n,e.applyServerCard=function(t,s){const i=s.updated_at?new Date(String(s.updated_at)).toISOString():t.updatedAt,o=s.doc?.item?.allergenNotes;return{...t,allergens:n(s.allergens,s.may_contain),allergenNotes:'string'==typeof o&&o?o:void 0,dish:'string'==typeof s.dish&&s.dish?s.dish:t.dish,section:'string'==typeof s.section&&s.section?s.section:t.section,price:'number'==typeof s.price_pence?s.price_pence:t.price,signOff:t.signOff??{by:'Head chef',at:i}}},e.serverItem=function(t,s){const i=t.doc?.item;return i&&i.id?{...i,restaurantId:s,allergens:n(t.allergens,t.may_contain)}:null},Object.defineProperty(e,"noAllergenWords",{enumerable:!0,get:function(){return s}});const t=['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'];function n(n,s){const i=n=>Array.isArray(n)?n.map(String).filter(n=>t.includes(n)):[],o={};for(const t of i(s))o[t]='may';for(const t of i(n))o[t]='contains';return o}const s=t=>t?'No listed allergens':'Allergens not confirmed yet: ask staff'},1235,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isKitchenTeam",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canEditKitchenRota",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"kitchenTeam",{enumerable:!0,get:function(){return c}}),e.kitchenPending=function(t,n,c,s){return t.filter(t=>n.has(t.staffId)&&!!t.date&&t.date>=c&&t.date<=s&&(!t.published||t.changed))},e.publishKitchen=function(t,n,c,s){let u=0;return{shifts:t.map(t=>!n.has(t.staffId)||!t.date||t.dates||t.published&&!t.changed?t:(u++,{...t,published:!0,changed:!1})),n:u}},Object.defineProperty(e,"clashes",{enumerable:!0,get:function(){return s}});const t=t=>'kitchen'===String(t.dept??'').trim().toLowerCase()&&'owner'!==t.role&&'manager'!==t.role&&!t.managerAccess&&!t.ownerAccess,n=t=>t.includes('*')||t.includes('rota.kitchen')||t.includes('rota.manage'),c=n=>n.filter(n=>!1!==n.active&&t(n));const s=(t,n,c,s,u,o)=>t.some(t=>t.staffId===n&&t.date===c&&t.id!==o&&t.startt.category===n&&t.menuPrice&&t.id!==r).map(t=>t.menuPrice);return i.length?{avg:Math.round(i.reduce((t,n)=>t+n,0)/i.length),count:i.length}:null},Object.defineProperty(e,"GRAMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"PACK_UNITS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"unitName",{enumerable:!0,get:function(){return u}}),e.convert=function(t,n,r){const i=a[n],o=a[r];return i&&o&&i.dim===o.dim?t*i.f/o.f:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"perServing",{enumerable:!0,get:function(){return f}}),e.perBaseUnit=d,Object.defineProperty(e,"servingWord",{enumerable:!0,get:function(){return p}}),e.lineCost=g,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return m}}),e.suggestAllergens=function t(n,r,i=[],o=0){const c=new Set;for(const a of n.lines)if(a.ingId.startsWith('dish:')){const n=i.find(t=>t.id===a.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>c.add(t)),t(n,r,i,o+1).forEach(t=>c.add(t)))}else r.find(t=>t.id===a.ingId)?.allergens?.forEach(t=>c.add(t));return[...c]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return h}}),e.gpOf=P,e.toPricePoint=b,e.suggestPrice=y,Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return O}}),e.multipleOf=function(t,n,r,i="inc"){return t<=0?0:('inc'===i?n:h(n,r))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return x}}),e.suggestForMultiple=function(t,n,r,i,o){const c=t*Math.max(0,n)*('ex'===i?1+r/100:1);return o?b(Math.ceil(c)):Math.ceil(c)},e.amountLabel=S,e.cardCostSummary=function(t,n,r,i){const o=(t?.lines??[]).map(t=>{const r=n.find(n=>n.id===t.ingId);return{line:t,name:r?.name??'Removed ingredient',cost:g(t,n),label:S(t,r)}}),c=o.reduce((t,n)=>t+n.cost,0),a=Math.max(1,t?.portions||1),s=c/a,u=t?.target??r.defaultTarget??70,l=s>0?y(s,u,r.vatPct,r.pricePoints):null,f=t?.menuPrice&&t.menuPrice>0?t.menuPrice:null,d=f??(i&&i>0?i:l),p=d&&s>0?P(s,d,r.vatPct):null;return{lines:o,batch:c,perPortion:s,target:u,suggested:l,price:d,priceIsSuggested:!(f||i&&i>0),gp:p?p.gpPct:null,cashGp:p?p.cashGp:null,foodCostPct:p?p.foodCostPct:null,tone:p?v(p.gpPct,u):null,missing:o.filter(t=>t.cost<=0).length}},Object.defineProperty(e,"foodCostTargetOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"targetGpForFoodCost",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"foodCostTone",{enumerable:!0,get:function(){return C}}),e.lineRates=function(t,n,r){const i=Math.max(1,n||1),o=r?d(r):null;return{perPortion:t/i,perKilo:o?o.pence:null,per:o?o.per:null}},e.lineRatesText=function(t){return`${M(t.perPortion)} a portion${null!=t.perKilo?` \xb7 ${M(t.perKilo)} a ${'item'===t.per?'item':t.per}`:''}`},e.vatAwareGp=function(t,n,r){const i=P(t,n,r),o=n>0?(n-t)/n*100:0;return{...i,vatPence:n-i.ex,naiveGpPct:o}},e.menuOverview=function(t){return[...t].sort((t,n)=>(null==t.gp?1:0)-(null==n.gp?1:0)||(t.gp??0)-(n.gp??0)||(n.foodCostPct??0)-(t.foodCostPct??0)||t.name.localeCompare(n.name))},e.marginDrops=function(t,n){const r=new Set,i=[];for(const o of[...t].filter(t=>t.gp&&t.date>=n).sort((t,n)=>(n.gp.at||n.date).localeCompare(t.gp.at||t.date)))for(const t of o.gp.dishes)null==t.before||null==t.after||r.has(t.id)||t.aftert.prices?.length?t.prices:[{p:t.packPrice,at:''}];function i(t,n=5){const i=r(t),o=i.slice(-Math.max(1,n)),c=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:i[i.length-1].p,avg:c,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const o=(t,n="latest",r=5)=>'average'===n?i(t,r).avg:i(t,r).latest;const c={g:1,kg:1e3,oz:28.349523125,lb:453.59237,stone:1e3*t.KG_PER_STONE},a={kg:{dim:'mass',f:c.kg},g:{dim:'mass',f:c.g},oz:{dim:'mass',f:c.oz},lb:{dim:'mass',f:c.lb},stone:{dim:'mass',f:c.stone},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},s=['kg','g','stone','lb','oz','L','ml','each'],u=(t,n=1)=>'L'===t?1===n?'litre':'litres':'stone'===t?'stone':'each'===t?'each':t;const l=(t,n)=>[...'mass'===a[t].dim?['g','kg','oz','lb']:'vol'===a[t].dim?['ml','L']:['each'],...n&&n>0?['serving']:[]],f=t=>t.servings&&t.servings>0?t.packPrice/t.servings:null;function d(t){const n=a[t.packUnit];if(!(n&&t.packSize>0))return null;const r=t.packSize*n.f;return'mass'===n.dim?{pence:t.packPrice/r*1e3,per:'kg'}:'vol'===n.dim?{pence:t.packPrice/r*1e3,per:'litre'}:{pence:t.packPrice/r,per:'item'}}const p=(t,n)=>{const r=(t?.servingName||'serving').trim().toLowerCase();return 1===n?r:/(s|sh|ch|x)$/.test(r)?`${r}es`:`${r}s`};function g(t,n,r=[],i=0){if(t.ingId.startsWith('dish:')){const o=r.find(n=>n.id===t.ingId.slice(5));return o&&i<4?m(o,n,r,i+1)*t.qty:0}const o=n.find(n=>n.id===t.ingId);if(!o||!o.packSize)return 0;if('serving'===t.unit){const n=f(o);return null==n?0:t.qty*n}const c=a[o.packUnit],s=a[t.unit];if(!s||c.dim!==s.dim)return 0;const u=o.packPrice/(o.packSize*c.f),l=Math.min(95,Math.max(0,t.wastePct??o.wastePct??0));return t.qty*s.f*u/(1-l/100)}const m=(t,n,r=[],i=0)=>t.lines.reduce((t,o)=>t+g(o,n,r,i),0)/Math.max(1,t.portions||1);const h=(t,n)=>t/(1+n/100);function P(t,n,r){const i=h(n,r);return{ex:i,gpPct:i>0?(i-t)/i*100:0,cashGp:i-t,foodCostPct:i>0?t/i*100:0}}function b(t){const n=Math.floor(t/100),r=t-100*n;return r<=50?100*n+50:r<=95?100*n+95:100*(n+1)+50}function y(t,n,r,i){const o=t/(1-Math.min(95,Math.max(0,n))/100)*(1+r/100);return i?b(Math.ceil(o)):Math.ceil(o)}const v=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',M=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,O=t=>`${t.toFixed(1)}%`;const x=t=>`${t.toFixed(1)}x`;function S(t,n){const r=Number.isInteger(t.qty)?String(t.qty):String(Math.round(1e3*t.qty)/1e3);return'serving'===t.unit?`${r} ${p(n,t.qty)}`:'each'===t.unit?`${r} ${1===t.qty?'item':'items'}`:`${r} ${u(t.unit,t.qty)}`}const k=t=>Math.round(10*(100-t))/10,j=t=>Math.round(10*(100-Math.min(60,Math.max(5,t))))/10,C=(t,n)=>t<=n+.05?'ok':t<=n+5?'amber':'red'},1237,[1086]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"piecesPerPack",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pieceName",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"lineTotal",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"deliveryTotal",{enumerable:!0,get:function(){return l}}),e.countPacks=a,Object.defineProperty(e,"countLineValue",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"countValue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"countUnitsFor",{enumerable:!0,get:function(){return p}}),e.applyDelivery=function(i,c,l,a,u=(new Date).toISOString(),o){let p=f(i,c.id,l,u,o);const v=`${c.date}T12:00:00.000Z`,h=c.lines.map(i=>{const o=i.name.trim();let f=p.find(n=>n.id===i.ingId)??p.find(n=>n.name.trim().toLowerCase()===o.toLowerCase());const h={p:Math.round(i.packPrice),at:v,src:c.id},k=t(i),b=k?{servings:Math.round(1e3*k)/1e3,servingName:s(i)}:{};if(!f){const n=a();return f={id:n,name:o,packSize:i.packSize,packUnit:i.packUnit,packPrice:h.p,wastePct:0,prices:[h],...b,...c.supplier.trim()?{supplier:c.supplier.trim()}:{},updatedAt:u},p=[...p,f],{...i,ingId:n,name:o,...k?{prevServings:null,prevServingName:null}:{}}}const P=d([...f.prices?.length?f.prices:[{p:f.packPrice,at:''}],h]).slice(-20),y=k?{prevServings:f.servings??null,prevServingName:f.servingName??null}:{},S={...f,packSize:i.packSize,packUnit:i.packUnit,prices:P,...b,...c.supplier.trim()?{supplier:c.supplier.trim()}:{},updatedAt:u};return S.packPrice=(0,n.costingPrice)(S,l.priceBasis,l.avgOf??5),p=p.map(n=>n.id===f.id?S:n),{...i,ingId:f.id,name:f.name,...y}});return{ingredients:p,lines:h}},e.removeDeliveryPrices=f,e.matchIngredient=function(n,t){const i=k(n);if(!i.length)return null;let s=null,c=0;for(const l of t){if(h(n)!==h(l.name))continue;const t=k(l.name),a=(n,t)=>n===t||Math.min(n.length,t.length)>=5&&(n.startsWith(t)||t.startsWith(n)),u=i.filter(n=>t.some(t=>a(n,t))).length,o=u?u/Math.max(i.length,t.length)+(l.name.trim().toLowerCase()===n.trim().toLowerCase()?1:0):0;o>c&&(c=o,s=l)}return c>=.5?s:null},e.cardUnit=b,e.suggestAmount=function(t,i,s){const c=(0,n.unitsFor)(s.packUnit,s.servings),l=Number(String(t).replace(',','.').trim()),a=b(i);if(Number.isFinite(l)&&l>0&&a){if('each'===a&&!c.includes('each')&&c.includes('serving'))return{qty:l,unit:'serving'};if(c.includes(a))return{qty:l,unit:a}}return{qty:0,unit:c[0]}};var n=r(_d[0]);const t=n=>n.count&&n.count>0&&n.packs>0?n.count/n.packs:null,i=n=>{const t=n.trim().toLowerCase();return t.length>3&&/ies$/.test(t)?`${t.slice(0,-3)}y`:t.length>3&&/(sh|ch|x)es$/.test(t)?t.slice(0,-2):t.length>3&&/s$/.test(t)&&!/ss$/.test(t)?t.slice(0,-1):t},s=n=>i(n.countName||'piece')||'piece',c=n=>Math.round((n.packs||0)*(n.packPrice||0)),l=n=>n.lines.reduce((n,t)=>n+c(t),0);function a(t){if(!(t.qty>=0))return null;if('pack'===t.unit)return t.qty;if('serving'===t.unit)return t.servings&&t.servings>0?t.qty/t.servings:null;const i=(0,n.convert)(t.qty,t.unit,t.packUnit);return null!=i&&t.packSize>0?i/t.packSize:null}const u=n=>{const t=a(n);return null==t?0:Math.round(t*n.packPrice)},o=n=>n.lines.reduce((n,t)=>n+u(t),0),p=t=>['pack',...(0,n.unitsFor)(t.packUnit,t.servings)],d=n=>[...n].sort((n,t)=>(n.at||'').localeCompare(t.at||''));function f(t,i,s,c=(new Date).toISOString(),l){return t.map(t=>{if(!t.prices?.some(n=>n.src===i))return t;const a=t.prices.filter(n=>n.src!==i),u=l?.lines.find(n=>n.ingId===t.id&&void 0!==n.prevServings),o=u?{servings:u.prevServings??void 0,servingName:u.prevServingName??void 0}:{},p={...t,...o,prices:a.length?a:[{p:t.packPrice,at:''}],updatedAt:c};return u&&null==u.prevServings&&(delete p.servings,delete p.servingName),p.packPrice=(0,n.costingPrice)(p,s.priceBasis,s.avgOf??5),p})}const v=n=>n.toLowerCase().replace(/\b(pea|bean|broccoli|radish|sunflower)\s*-?\s*(shoots?|sprouts?)\b/g,'$1$2'),h=n=>(v(n).match(/[a-z]*(shoot|sprout|cress)[a-z]*/g)||[]).map(n=>n.replace(/s$/,'')).sort().join(','),k=n=>v(n).replace(/\([^)]*\)/g,' ').replace(/[^a-z\s]/g,' ').split(/\s+/).filter(n=>n.length>2&&!['the','and','with','cooked','fresh','chopped','diced','sliced','cleaned','whole'].includes(n)).map(n=>n.replace(/(es|s)$/,''));function b(n){const t=n.trim().toLowerCase().replace(/\.$/,'');return['g','gram','grams','gr'].includes(t)?'g':['kg','kilo','kilos','kgs'].includes(t)?'kg':['ml','mls'].includes(t)?'ml':['l','litre','litres','liter','liters','ltr'].includes(t)?'L':['oz','ounce','ounces'].includes(t)?'oz':['lb','lbs','pound','pounds'].includes(t)?'lb':['','whole','each','single','singles','piece','pieces','slice','slices','sliced','portion','portions','wedge','wedges','x'].includes(t)?'each':null}},1238,[1237]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"normRead",{enumerable:!0,get:function(){return r}}),e.rememberedMatch=i,e.matchLine=function(t,r,a,s,c){const o=i(t,a,s,c);if(o)return{ing:o,how:'remembered'};const l=r.trim().toLowerCase(),u=c.find(t=>t.name.trim().toLowerCase()===l);if(u)return{ing:u,how:'exact'};const p=(0,n.matchIngredient)(r,c)??(0,n.matchIngredient)(t,c);return p?{ing:p,how:'close'}:{ing:null,how:'new'}},e.packUnitOf=s,e.lineFlags=function(t,n){const r=[];t.sure||r.push('Not sure it read this line right');t.item||r.push('Item name not read');t.packs&&t.packs>0||r.push('Quantity not read');t.packSize&&t.packSize>0&&s(t.packUnit)||r.push('Pack size not read');null==t.unitPrice&&r.push('Price not read');null!=t.unitPrice&&t.packs&&null!=t.lineTotal&&Math.abs(t.packs*t.unitPrice-t.lineTotal)>Math.max(2,.01*t.lineTotal)&&r.push('Quantity times price does not match the line total');'new'===n&&r.push('New item: not on your price list yet');'close'===n&&r.push('Matched to a similar name: check it is the same item');return r},e.costView=c,e.lineCostChange=function(r,a,i){const s=(0,n.piecesPerPack)(a),o=s?{servings:s,servingName:(a.countName||'piece').replace(/s$/i,'')}:{},l=r?{...r,packSize:a.packSize,packUnit:a.packUnit,...o,prices:[...r.prices?.length?r.prices:[{p:r.packPrice,at:''}],{p:a.packPrice,at:'z'}]}:{id:'',name:'',packSize:a.packSize,packUnit:a.packUnit,packPrice:a.packPrice,wastePct:0,...o};l.packPrice=r?(0,t.costingPrice)(l,i.priceBasis,i.avgOf??5):a.packPrice;const u=c(r),p=c(l),d=u?.base&&p?.base&&u.base.per===p.base.per&&u.base.pence>0?(p.base.pence-u.base.pence)/u.base.pence*100:null;return{before:u,after:p,changePct:d}},e.menuGp=o,Object.defineProperty(e,"NOTICEABLE_DROP",{enumerable:!0,get:function(){return l}}),e.gpImpact=function(t,r,a,i,s,c){const u=o(t,r,a,i),{ingredients:p}=(0,n.applyDelivery)(t,s,i,()=>`tmp-${Math.random()}`,void 0,c),d=o(p,r,a,i),m=d.dishes.map(t=>{const n=u.dishes.find(n=>n.id===t.id),r=n?.gp??t.gp,a=r-t.gp;return{id:t.id,name:t.name,before:r,after:t.gp,target:t.target,drop:a,flagged:a>=l||r>=t.target-.05&&t.gpMath.abs(t.before-t.after)>=.05).sort((t,n)=>n.drop-t.drop);return{snap:{at:`${s.date}T12:00:00.000Z`,before:u.menu,after:d.menu,dishes:d.dishes.map(t=>({id:t.id,name:t.name,before:u.dishes.find(n=>n.id===t.id)?.gp??null,after:t.gp}))},dishes:m,after:p}},Object.defineProperty(e,"RANGE_WEEKS",{enumerable:!0,get:function(){return u}}),e.mondayOf=m,e.gpHistory=function(t,n,r,a=d(new Date)){const i=[],s=m(a),[c,o,l]=s.split('-').map(Number);for(let t=u[r]-1;t>=0;t--)i.push(d(new Date(c,o-1,l-7*t)));const p=[...t].sort((t,n)=>t.date.localeCompare(n.date)||(t.createdAt??'').localeCompare(n.createdAt??'')),f={};let h=null;for(const t of p)t.datenull!=t.after).map(t=>[t.id,t.after]))});const b=[],k=[];for(const t of i){const r=d(new Date(Number(t.slice(0,4)),Number(t.slice(5,7))-1,Number(t.slice(8,10))+7)),a=p.filter(n=>n.date>=t&&n.datenull!=t.after).map(t=>[t.id,t.after]))},n.gp.dishes.forEach(t=>{f[t.id]=t.name}));const r=n.gp&&null!=n.gp.before&&null!=n.gp.after?n.gp.after-n.gp.before:null;(!n.gp||null==r||Math.abs(r)>=.05)&&k.push({week:t,date:n.date,id:n.id,supplier:n.supplier,change:r})}t!==s?b.push(h?{...h,week:t}:{week:t,menu:null,dishes:{}}):b.push({week:t,menu:n.menu,dishes:Object.fromEntries(n.dishes.map(t=>[t.id,t.gp]))})}return{points:b,markers:k,names:f}},Object.defineProperty(e,"RANGE_SAID",{enumerable:!0,get:function(){return f}}),e.gpSummary=function(t,n){const r=t.filter(t=>null!=t.menu);if(!r.length)return'No GP history yet. It starts with the first delivery that changes a cost.';const a=r[r.length-1].menu,i=t=>Math.abs(t)<.05?'steady':`${t>0?'up':'down'} ${Math.abs(t).toFixed(1)} points`,s=r.length>1?r[r.length-2].menu:null,c=r[0].menu;return null==s?`Menu GP now ${a.toFixed(1)} percent. Not enough history to compare yet.`:`Menu GP now ${a.toFixed(1)} percent, ${i(a-s)} on the week before, ${i(a-c)} over ${f[n]}.`};var t=_r(_d[0]),n=_r(_d[1]);const r=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,' ').replace(/\s+/g,' ').trim(),a=(t,n)=>r(t)===r(n)&&!!r(t);function i(t,n,i,s){const c=r(t);if(!c)return null;const o=(Array.isArray(i)?i:Object.values(i)).filter(t=>a(t.supplier,n)).sort((t,n)=>(n.updatedAt??n.createdAt).localeCompare(t.updatedAt??t.createdAt));for(const t of o)for(const n of t.lines)if(n.read&&r(n.read)===c){const t=s.find(t=>t.id===n.ingId);if(t)return t}return null}function s(n){const r=(n??'').trim().toLowerCase().replace(/\.$/,'');return r?['kg','kgs','kilo','kilos','kilogram','kilograms'].includes(r)?'kg':['g','gr','gram','grams','gm','gms'].includes(r)?'g':['l','lt','ltr','litre','litres','liter','liters'].includes(r)?'L':['ml','mls'].includes(r)?'ml':['lb','lbs','pound','pounds'].includes(r)?'lb':['oz','ounce','ounces'].includes(r)?'oz':['st','stone'].includes(r)?'stone':['each','ea','x','unit','units','pc','pcs','piece','pieces','item','items','case','cases','box','boxes','tray','trays','pack','packs','bottle','bottles','can','cans','tin','tins','jar','jars','tub','tubs','bag','bags','dozen','doz'].includes(r)?'each':t.PACK_UNITS.includes(r)?r:null:null}function c(n){if(!n)return null;const r=(0,t.perServing)(n);return{base:(0,t.perBaseUnit)(n),piece:null!=r?{pence:r,name:(n.servingName||'piece').toLowerCase()}:null}}function o(n,r,a,i){const s=a.map(a=>{const s=(0,t.cardCostSummary)(r[a.id],n,i,a.price);return{id:a.id,name:a.dish,gp:s.gp,target:s.target}}).filter(t=>null!=t.gp);return{menu:s.length?s.reduce((t,n)=>t+n.gp,0)/s.length:null,dishes:s}}const l=2;const u={'4w':4,'3m':13,'12m':52},p=t=>String(t).padStart(2,'0'),d=t=>`${t.getFullYear()}-${p(t.getMonth()+1)}-${p(t.getDate())}`;function m(t){const[n,r,a]=t.split('-').map(Number),i=new Date(n,r-1,a);return i.setDate(i.getDate()-(i.getDay()+6)%7),d(i)}const f={'4w':'4 weeks','3m':'3 months','12m':'12 months'}},1239,[1237,1238]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteFromLocation=function(n,t){const o=new URLSearchParams(n).get('invite');if(o)return o;const s=(t||'').match(/[#&]invite=([A-Za-z0-9_-]{10,})/);return s?s[1]:null},e.addressWithoutInvite=function(n){try{const t=new URL(n);t.searchParams.delete('invite');const o=t.hash.replace(/^#/,'').split('&').filter(n=>n&&!n.startsWith('invite=')&&!n.startsWith('ccchrome=')&&!n.startsWith('cckitchen=')).join('&');return t.hash=o?`#${o}`:'',t.toString()}catch{return n}},Object.defineProperty(e,"PHONE_LINKED_TEXT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isPhoneLinked",{enumerable:!0,get:function(){return t}}),e.inviteRefusal=function(t){return/already linked to another phone/i.test(t)?n:/update the app/i.test(t)?'Update the app: close it, then open your personal link again.':/already been used/i.test(t)?'This link has already been used on another device. Ask your manager for a new one.':/expired/i.test(t)?'This link has expired. Ask your manager for a new one.':/replaced|switched off|not valid|invalid|unknown invite/i.test(t)?'This link has been replaced or switched off. Ask your manager for a new one.':/personal app link is incomplete/i.test(t)?'Open the complete personal iPhone link your manager sent.':/no longer active/i.test(t)?'This person is no longer on the team. Ask your manager if this is wrong.':null},Object.defineProperty(e,"WIPE_PREFIXES",{enumerable:!0,get:function(){return o}}),e.keysToWipe=function(n){return n.filter(n=>o.some(t=>n.startsWith(t)))},e.handoverFromHash=function(n){const t=(n||'').match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|$)/);return t?t[1]:null};const n='This link is already linked to another phone. Ask a manager to reset it or send you a new link.',t=n=>!!n&&/already linked to another phone/i.test(n);const o=['covercharge-','cc-sync:','cc-','sb-']},1240,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.persistedSessionSlice=function(n,o){return n?{welcomed:o.welcomed}:{meId:o.meId,signedInAt:o.signedInAt,welcomed:o.welcomed}},e.migrateCarSession=function(n){return{meId:null,signedInAt:void 0,welcomed:(n&&'object'==typeof n?n:{}).welcomed??{}}},e.carResetsSessionOnLoad=function(n,o){return n&&!o}},1241,[]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hrRemote",{enumerable:!0,get:function(){return y}}),_e.exampleHr=f,_e.stripHrSamples=m,Object.defineProperty(_e,"useHr",{enumerable:!0,get:function(){return q}});var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),i=r(_d[4]),u=(e=i)&&e.__esModule?e:{default:e},d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const y={live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null},v=(e,t,s)=>(0,c.oneWayToken)(e,`shift:${t}:${s}`),p=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function f(e,t){const s=[];for(let n=14;n>=1;n--){const o=p(t,-n),i=4===n?2:4+7*n%4;for(let t=0;t!((0,s.isAnchorage)(e.venue)&&e.example)),questions:e.questions.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrq-ex-[123]$/.test(e.id))),shouts:e.shouts.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrs-ex-[123]$/.test(e.id)))}}const q=(0,d.create)()((0,l.persist)((e,t)=>({secret:(0,c.newSecret)(),answered:[],voted:{},checkins:[],questions:[],shouts:[],log:[],seeded:{},ensure:(s,i)=>{if(n.LIVE_VENUE_BUILD||o.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(s)||t().seeded[s]||y.live)return;const u=f(s,i);e(e=>({seeded:{...e.seeded,[s]:!0},checkins:[...e.checkins,...u.checkins],questions:[...e.questions,...u.questions],shouts:[...e.shouts,...u.shouts]}))},hasAnswered:(e,s)=>t().answered.includes(v(t().secret,e,s)),submit:s=>{const n=t(),o=v(n.secret,s.rid,s.shiftKey);if(n.answered.includes(o))return'already';const i=(0,c.checkInPayload)({venue:s.rid,day:s.day,token:o,morale:s.morale,staffing:s.staffing}),u=s.question?(0,c.cleanQuestion)(s.question):null,d=s.shoutTo?.trim().slice(0,80)||void 0,l=s.shoutBody?.trim().slice(0,280)||void 0;return e({answered:[...n.answered,o].slice(-300)}),y.live&&y.checkout?(y.checkout({rid:s.rid,shiftKey:'',day:i.day,morale:i.morale,staffing:i.staffing,question:u??void 0,kind:s.kind??'up',shoutTo:d,shoutBody:l,token:o}),'queued'):(e(e=>({checkins:[...e.checkins,{venue:i.venue,day:i.day,morale:i.morale,staffing:i.staffing}],questions:u?[...e.questions,{id:(0,h.uuid)(),venue:s.rid,body:u,kind:s.kind??'up',up:0,yes:0,no:0,hidden:!1,postedOn:s.day}]:e.questions,shouts:d?[...e.shouts,{id:(0,h.uuid)(),venue:s.rid,day:s.day,to:d,body:l}]:e.shouts})),'ok')},skip:(s,n)=>{const o=t(),i=v(o.secret,s,n);o.answered.includes(i)||e({answered:[...o.answered,i].slice(-300)})},post:(t,s,n,o)=>{const i=(0,c.cleanQuestion)(s);if(!i)return null;const u=(0,h.uuid)();return e(e=>({questions:[...e.questions,{id:u,venue:t,body:i,kind:n,up:0,yes:0,no:0,hidden:!1,postedOn:o}]})),y.live&&y.post&&y.post(t,u,i,n),u},vote:(s,n)=>{const o=t();if(o.voted[s])return!1;const i=o.questions.find(e=>e.id===s);if(!i||i.hidden)return!1;const u='up'===i.kind?1:n;return e({voted:{...o.voted,[s]:u},questions:o.questions.map(e=>e.id===s?(0,c.applyVote)(e,u):e)}),y.live&&y.vote&&y.vote(s,(0,c.oneWayToken)(o.secret,`vote:${s}`),u),!0},moderate:(s,n,o,i)=>{const u=t().questions.find(e=>e.id===s);u&&(e(e=>({questions:e.questions.map(e=>e.id===s?{...e,hidden:'hide'===n}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:n,reason:o.trim()||void 0,by:i,at:(new Date).toISOString()},...e.log].slice(0,500)})),y.live&&y.moderate&&y.moderate(s,n,o.trim()))},reply:(s,n,o)=>{const i=n.trim().slice(0,600),u=t().questions.find(e=>e.id===s);if(!u)return;const d=(new Date).toISOString();e(e=>({questions:e.questions.map(e=>e.id===s?{...e,reply:i||void 0,replyAt:i?d:void 0}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:'reply',by:o,at:d},...e.log].slice(0,500)})),y.live&&y.reply&&y.reply(s,i)},setRemoteBoard:(t,s)=>e(e=>({questions:[...e.questions.filter(e=>e.venue!==t),...s]})),upsertRemote:t=>e(e=>({questions:e.questions.some(e=>e.id===t.id)?e.questions.map(e=>e.id===t.id?t:e):[...e.questions,t]}))}),{name:'covercharge-hr-v1',version:3,storage:(0,l.createJSONStorage)(()=>u.default),migrate:async e=>n.LIVE_VENUE_BUILD&&e?(await(0,t.archiveChefCache)('hr',e),{...e,...m(e)}):e}))},1242,[1159,1085,842,5,1160,995,1169,1243,1099]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_ANSWERS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_WORDING",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_HR",{enumerable:!0,get:function(){return r}}),e.hrSettingsOf=function(t){const n=t??{},r=n.wording??{},s=Object.fromEntries(Object.entries(o).map(([t,n])=>[t,a(r[t],'intro'===t||'staffing'===t||'question'===t?160:60,n)]));return{on:!1!==n.on,askQuestion:!1!==n.askQuestion,askShout:!1!==n.askShout,board:!1!==n.board,wording:s}},Object.defineProperty(e,"MORALE_STEPS",{enumerable:!0,get:function(){return s}}),e.moraleWord=function(t,n=o){return t<=1?n.moraleLow:t>=5?n.moraleHigh:2===t?'Fairly low':3===t?'OK':'Good'},Object.defineProperty(e,"STAFF_STOPS",{enumerable:!0,get:function(){return u}}),e.snapStaffing=i,e.staffingWord=function(t,n=o){const r=i(t);return r<=12?n.staffLow:r<45?"A bit short":r<=55?n.staffMid:r<88?"A bit over":n.staffHigh},e.oneWayToken=function(n,o){return(0,t.sha256HexSync)(`cc-hr:${n}:${o}`).slice(0,40)},e.newSecret=function(){let t='';const n=globalThis.crypto;if(n?.getRandomValues){return n.getRandomValues(new Uint8Array(24)).forEach(n=>{t+=n.toString(16).padStart(2,'0')}),t}for(let n=0;n<48;n++)t+=Math.floor(16*Math.random()).toString(16);return t},e.checkInPayload=function(t){const n=Math.max(1,Math.min(5,Math.round(t.morale)));return{venue:t.venue,day:t.day,token:t.token,morale:n,staffing:null==t.staffing?null:i(t.staffing)}},e.dayResults=function(t,o=n){const r=new Map;for(const n of t){const t=r.get(n.day)??[];t.push(n),r.set(n.day,t)}const a=[];let s=0;for(const[t,n]of[...r.entries()].sort(([t],[n])=>t.localeCompare(n))){if(n.lengtht.staffing).filter(t=>null!=t);a.push({day:t,answers:n.length,morale:Math.round(n.reduce((t,n)=>t+n.morale,0)/n.length*10)/10,staffing:r.length?Math.round(r.reduce((t,n)=>t+n,0)/r.length):null,short:r.filter(t=>t<45).length,perfect:r.filter(t=>t>=45&&t<=55).length,over:r.filter(t=>t>55).length})}return{shown:a,held:s}},Object.defineProperty(e,"QUESTION_MAX",{enumerable:!0,get:function(){return f}}),e.cleanQuestion=function(t){const n=t.replace(/\s+/g,' ').trim().slice(0,f);return n.length>=3?n:null},e.boardOrder=function(t,n){const o=t=>'up'===t.kind?t.up:t.yes+t.no;return t.filter(t=>n||!t.hidden).sort((t,n)=>Number(t.hidden)-Number(n.hidden)||o(n)-o(t)||n.postedOn.localeCompare(t.postedOn)||t.id.localeCompare(n.id))},e.applyVote=function(t,n){return'up'===t.kind?{...t,up:t.up+1}:1===n?{...t,yes:t.yes+1}:{...t,no:t.no+1}};var t=_r(d[0]);const n=3,o={intro:'Before you go: 3 quick taps, about 15 seconds. Your name is never saved with your answers.',morale:'How was team morale today?',moraleLow:'Low',moraleHigh:'High',staffing:'Was there enough staff on today for the number of customers?',staffLow:'Not enough',staffMid:'Perfect',staffHigh:'Overstaffed',question:'Got a question you\u2019d like to post anonymously for the team to vote on?',shout:'Shout out a teammate?'},r={on:!0,askQuestion:!0,askShout:!0,board:!0,wording:o},a=(t,n,o)=>('string'==typeof t?t.trim().slice(0,n):'')||o;const s=[1,2,3,4,5];const u=[0,12.5,25,37.5,50,62.5,75,87.5,100].map(t=>Math.round(t));function i(t){const n=Math.max(0,Math.min(100,Number.isFinite(t)?t:50));return u.reduce((t,o)=>Math.abs(o-n)>>0;o.push(c>>>24&255,c>>>16&255,c>>>8&255,255&c,h>>>24&255,h>>>16&255,h>>>8&255,255&h);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64),f=(t,n)=>t>>>n|t<<32-n;for(let n=0;n>>3,e=f(u[t-2],17)^f(u[t-2],19)^u[t-2]>>>10;u[t]=u[t-16]+n+u[t-7]+e>>>0}let e=l[0],s=l[1],c=l[2],h=l[3],a=l[4],i=l[5],p=l[6],d=l[7];for(let n=0;n<64;n++){const o=d+(f(a,6)^f(a,11)^f(a,25))+(a&i^~a&p)+t[n]+u[n]>>>0,l=(f(e,2)^f(e,13)^f(e,22))+(e&s^e&c^s&c)>>>0;d=p,p=i,i=a,a=h+o>>>0,h=c,c=s,s=e,e=o+l>>>0}l[0]=l[0]+e>>>0,l[1]=l[1]+s>>>0,l[2]=l[2]+c>>>0,l[3]=l[3]+h>>>0,l[4]=l[4]+a>>>0,l[5]=l[5]+i>>>0,l[6]=l[6]+p>>>0,l[7]=l[7]+d>>>0}return Array.from(l).map(t=>t.toString(16).padStart(8,'0')).join('')};const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t){const n=[];for(let e=0;e=55296&&o<=56319&&e+1=56320&&n<=57343&&(o=65536+(o-55296<<10)+(n-56320),e++)}o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<65536?n.push(224|o>>12,128|o>>6&63,128|63&o):n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}return n}},1244,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LEGAL_LIMIT_MINS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_BREAK_RULES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"REMINDER_WINDOW_MINS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CHAIRS_TEXT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ANCHORAGE_CHAIRS_DAYS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultChairs",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AUDIENCE_LABEL",{enumerable:!0,get:function(){return s}}),e.clampRules=c,Object.defineProperty(e,"validTime",{enumerable:!0,get:function(){return d}}),e.ukClock=l,e.reminderDue=function(t,n){const i=l(n);if(t.paused||!d(t.time)||!t.days.includes(i.dow))return{due:!1,forDate:i.ymd};const o=f(t.time);return{due:i.mins>=o&&i.mins=t.shiftEnd))return null;const r=b(t).filter(n=>n.at<=t.now),i=r.length?r[r.length-1]:null;if(!i)return null;if(t.nowr?i:null}return i};const t=360,n={on:!0,afterMins:240,repeatMins:30,snoozeMins:15},r=180,i='Time to put the chairs up on the tables',o=[4,0],a=(t,n)=>'anchorage'===n?{id:t,text:i,days:[...o],time:'21:00',audience:'all',builtIn:'chairs',push:!0}:{id:t,text:i,days:[5,0],time:'21:00',audience:'all',builtIn:'chairs'},u=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],s={all:'Everyone on shift',foh:'Front of house',kitchen:'Kitchen'};function c(r){const i=(t,n,r,i)=>{const o=Math.round(Number(t));return Number.isFinite(o)?Math.min(i,Math.max(r,o)):n};return{on:!1!==r.on,afterMins:i(r.afterMins,n.afterMins,30,t),repeatMins:i(r.repeatMins,n.repeatMins,5,120),snoozeMins:i(r.snoozeMins,n.snoozeMins,5,60)}}const d=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t);function l(t){const n='number'==typeof t?new Date(t):t,r=Object.fromEntries(new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(n).map(t=>[t.type,t.value]));return{dow:u.indexOf(String(r.weekday).slice(0,3)),mins:60*Number(r.hour)+Number(r.minute),ymd:`${r.year}-${r.month}-${r.day}`}}const f=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));const m=(t,n)=>'all'===t||('kitchen'===t?n:!n);function b(t){const n=c(t.rules),r=t.clockIn??t.shiftStart;if(!n.on||void 0===r||t.hadBreak)return[];const i=r+216e5,o=Math.min(void 0!==t.rotaBreak&&t.rotaBreak>r?t.rotaBreak:r+6e4*n.afterMins,i),a=[{stage:1,at:o,label:void 0!==t.rotaBreak&&t.rotaBreak>r&&t.rotaBreak<=i?'Your break on the rota is now.':'Time for your break.'}],u=o+6e4*n.repeatMins;return a.push({stage:2,at:u,label:'Reminder: you haven\u2019t had your break yet.'}),i>u&&a.push({stage:3,at:i,label:'You\u2019ve worked 6 hours without a break. You need a 20-minute break (UK law).'}),a}},1245,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isOnline",{enumerable:!0,get:function(){return t}}),_e.setOnline=o,_e.onConnectivity=function(e){return n.add(e),()=>{n.delete(e)}},_e.isNetworkError=function(e){if(!e)return!1;const n=String(e.message??e).toLowerCase();return 0===e.status||/network|fetch failed|failed to fetch|timeout|timed out|offline|econn|enotfound|socket/.test(n)};let e=!0;const n=new Set,t=()=>e;function o(t){t!==e&&(e=t,n.forEach(n=>n(e)))}const s=globalThis.window;s?.addEventListener&&('boolean'==typeof s.navigator?.onLine&&(e=s.navigator.onLine),s.addEventListener('online',()=>o(!0)),s.addEventListener('offline',()=>o(!1)))},1246,[]); +__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'}},1247,[1246]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1248,[1249,1250,872,1234,1076]); +__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())}}}},1250,[1234]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.staffNickname=t,_e.staffDate=l,_e.staffSyncItem=c,_e.staffRevision=o,_e.staffEdited=function(e,n,t){return o(e,t)!==o(n,t)},_e.staffRow=function(e,t,l,o){const s=c(e,l),m={venue_id:t,external_ref:s.id,display_name:s.name||'Staff',job_title:s.job||null,department:s.dept||null,active:!1!==s.active};l.nickname&&(m.nickname=s.nickname??null);l.display&&(m.display_clock=!0===s.displayClock,m.temp=!0===s.temp,m.temp_until=s.temp?s.tempUntil??null:null);o&&n.test(o)&&!s.ownerAccess&&!s.managerAccess&&(m.role_id=o);return m};const e=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function t(e){if('string'!=typeof e)return null;return e.trim().slice(0,40)||null}function l(n){return'string'==typeof n&&e.test(n)?n:null}function c(e,n={nickname:!0,display:!0}){const c='owner'===e.role||'manager'===e.role||'staff'===e.role?e.role:'staff',o=!0===e.temp,s={id:e.id,name:(e.name??'').trim(),role:c,level:(e.level??'').trim(),job:(e.job??'').trim(),dept:(e.dept??'').trim(),active:!1!==e.active,managerAccess:!0===e.managerAccess,ownerAccess:!0===e.ownerAccess};return'boolean'==typeof e.bookingWrite&&(s.bookingWrite=e.bookingWrite),n.nickname&&(s.nickname=t(e.nickname)),n.display&&(s.displayClock=!0===e.displayClock,s.temp=o,s.tempUntil=o?l(e.tempUntil):null),s}function o(e,n={nickname:!0,display:!0}){const t=c(e,n);return JSON.stringify({name:t.name??'',job:t.job??'',dept:t.dept??'',active:!1!==t.active,...n.nickname?{nickname:t.nickname??null}:{},...n.display?{displayClock:!0===t.displayClock,temp:!0===t.temp,tempUntil:t.tempUntil??null}:{}})}},1251,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBookingSaves",{enumerable:!0,get:function(){return s}}),_e.notSavedWhat=u,Object.defineProperty(_e,"notSavedLine",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),n=r(d[1]),o=r(d[2]),l=(e=o)&&e.__esModule?e:{default:e};const s=(0,t.create)()((0,n.persist)((e,t)=>({count:()=>Object.keys(t().notSaved).length,notSaved:{},mark:t=>e(e=>({notSaved:{...e.notSaved,[t.id]:{...t,at:(new Date).toISOString()}}})),clear:t=>e(e=>{if(!e.notSaved[t])return e;const n={...e.notSaved};return delete n[t],{notSaved:n}}),clearAll:()=>e({notSaved:{}})}),{name:'covercharge-booking-saves-v1',storage:(0,n.createJSONStorage)(()=>l.default),version:1,partialize:e=>({notSaved:e.notSaved})})),c=e=>{const t=(e??'').split('+').map(e=>e.trim()).filter(Boolean);return t.length?`${t.length>1?'Tables':'Table'} ${t.join(' + ')}`:''};function u(e){const t=c(e.table);if(e.walkIn)return`Walk-in of ${e.partySize}${t?` on ${t}`:''}`;const n=(e.name||'Guest').trim();return t?`${t} for ${n}`:`Booking for ${n} at ${e.time}`}const v=e=>`${u(e)} did not save. Tap to try again.`},1252,[995,1169,1160]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useTempSaves",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"tempKey",{enumerable:!0,get:function(){return l}}),_e.tempNotSavedLine=function(e,t){const n=[];e&&n.push(1===e?'1 temperature reading':`${e} temperature readings`);t.length&&n.push(1===t.length?`the change to ${t[0]}`:`${t.length} unit changes`);const o=n.join(' and ');return`${o.charAt(0).toUpperCase()}${o.slice(1)} did not save. Tap to try again.`},_e.tempWaitingLine=function(e){return`${1===e?'1 temperature reading is':`${e} temperature readings are`} waiting to send. ${1===e?'It sends':'They send'} by itself when the connection is back.`.replace('They send by itself','They send by themselves')};var e,t=r(d[0]),n=r(d[1]),o=r(d[2]),s=(e=o)&&e.__esModule?e:{default:e};const c=(e,t)=>`${e}:${t}`,u=(0,t.create)()((0,n.persist)((e,t)=>({notSaved:{},count:()=>Object.keys(t().notSaved).length,mark:t=>e(e=>({notSaved:{...e.notSaved,[c(t.table,t.id)]:{...t,at:(new Date).toISOString()}}})),clear:t=>e(e=>{if(!e.notSaved[t])return e;const n={...e.notSaved};return delete n[t],{notSaved:n}})}),{name:'covercharge-temp-saves-v1',storage:(0,n.createJSONStorage)(()=>s.default),version:1,partialize:e=>({notSaved:e.notSaved})})),l=c},1253,[995,1169,1160]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.pointFromRow=i,_e.pointToRow=n,_e.readingFromRow=r,_e.readingToRow=o,Object.defineProperty(_e,"sameReading",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"readingRev",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"pointRev",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"TEMP_WINDOW_DAYS",{enumerable:!0,get:function(){return l}}),_e.tempUnitsSpec=function(e,t){return{name:'temp_units',table:'temp_units',conflict:'venue_id,id',deletes:!1,list:()=>e.getState().points??[],key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>/^[A-Za-z0-9_.:-]{1,64}$/.test(e.id),writable:t,matchKey:e=>({id:e}),revision:s,knownByRevision:!0,filter:e=>e.order('sort',{ascending:!0}),toRow:(t,i)=>n(t,i,10*Math.max(0,(e.getState().points??[]).findIndex(e=>e.id===t.id))),fromRow:e=>i(e),apply:t=>e.setState(e=>{const i=new Map(t.map(e=>[e.id,e])),n=(e.points??[]).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{points:[...n,...t.filter(e=>!r.has(e.id))]}}),afterRead:t=>{const i=new Map(t.map((e,t)=>[String(e.id),Number(e.sort??t)]));e.setState(e=>{const t=e.points??[],n=[...t.filter(e=>i.has(e.id)).sort((e,t)=>i.get(e.id)-i.get(t.id)),...t.filter(e=>!i.has(e.id))];return n.every((e,i)=>e===t[i])?e:{points:n}})},subscribe:t=>e.subscribe((e,i)=>{e.points!==i.points&&t()})}},_e.tempReadingsSpec=function(e,t){const i=()=>new Date(Date.now()-6912e7).toISOString();return{name:'temp_readings',table:'temp_readings',mode:'insert',conflict:'venue_id,id',deletes:!1,protect:!0,list:()=>e.getState().entries??[],key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>/^[A-Za-z0-9_.:-]{1,64}$/.test(e.id)&&!!e.pointId&&!!e.at,writable:t,matchKey:e=>({id:e}),revision:c,knownByRevision:!0,filter:e=>e.gte('taken_at',i()),inWindow:e=>e.at>=i(),toRow:(e,t)=>o(e,t),fromRow:e=>r(e),supersededBy:(e,t)=>t.some(t=>t.id!==e.id&&a(t,e)),apply:(t,i)=>e.setState(e=>{const n=new Map(t.map(e=>[e.id,e])),r=new Set(i),o=e.entries??[],c=o.filter(e=>n.has(e.id)||!t.some(t=>t.id!==e.id&&a(t,e))).filter(e=>!r.has(e.id)||!o.some(t=>t.id!==e.id&&!r.has(t.id)&&a(t,e))).map(e=>{const t=n.get(e.id);return t?e.photo?{...t,photo:e.photo}:t:e}),s=new Set(c.map(e=>e.id));return{entries:[...t.filter(e=>!s.has(e.id)),...c].sort((e,t)=>t.at.localeCompare(e.at))}}),subscribe:t=>e.subscribe((e,i)=>{e.entries!==i.entries&&t()})}};var e=_r(d[0]);const t=e=>null==e||''===e?void 0:Number(e);function i(e){const i={id:String(e.id),name:String(e.name),kind:e.kind,due:Array.isArray(e.due)?e.due.map(String):[],aliases:Array.isArray(e.aliases)?e.aliases.map(String):[]},n=t(e.min_c),r=t(e.max_c);return void 0!==n&&(i.min=n),void 0!==r&&(i.max=r),e.section&&(i.section=e.section),e.location&&(i.location=String(e.location)),e.archived&&(i.archived=!0),i}function n(e,t,i){return{venue_id:t,id:e.id,name:e.name.slice(0,80),kind:e.kind,location:e.location?.trim()||null,min_c:e.min??null,max_c:e.max??null,due:e.due??[],aliases:e.aliases??[],section:e.section??null,archived:!!e.archived,sort:i}}function r(e){const i={id:String(e.id),pointId:String(e.point_id),name:String(e.point_name),kind:e.kind,at:new Date(e.taken_at).toISOString(),by:String(e.by_name??''),byId:String(e.by_ref??''),app:e.app??'chef',ok:!!e.ok,source:e.source??'typed'},n=t(e.value);void 0!==n&&(i.value=n),null!==e.done&&void 0!==e.done&&(i.done=!!e.done),e.corrective&&(i.corrective=String(e.corrective)),e.note&&(i.note=String(e.note)),e.initials&&(i.initials=String(e.initials)),e.probe_id&&(i.probeId=String(e.probe_id)),e.archived&&(i.archived=!0);const r=t(e.corrected_value);return void 0!==r&&(i.correctedValue=r),e.correction_note&&(i.correctionNote=String(e.correction_note)),e.corrected_by&&(i.correctedBy=String(e.corrected_by)),i}function o(e,t){return{venue_id:t,id:e.id,point_id:e.pointId,point_name:(e.name||'Check').slice(0,200),kind:e.kind,taken_at:e.at,value:e.value??null,done:e.done??null,ok:!!e.ok,by_name:(e.by??'').slice(0,120),by_ref:e.byId||null,app:e.app??null,source:e.source??null,corrective:e.corrective?.slice(0,1e3)||null,note:e.note?.slice(0,1e3)||null,initials:e.initials||null,probe_id:e.probeId||null}}const a=(e,t)=>e.pointId===t.pointId&&e.at===t.at&&(e.value??null)===(t.value??null)&&(e.done??null)===(t.done??null),c=t=>(0,e.hashOf)(r({...o(t,''),archived:t.archived??!1,corrected_value:t.correctedValue??null,correction_note:t.correctionNote??null,corrected_by:t.correctedBy??null})),s=t=>(0,e.hashOf)(i(n(t,'',0))),l=800},1254,[1149]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.mirrorRecords=o,_e.csToRow=i,_e.csFromRow=r,Object.defineProperty(_e,"csRev",{enumerable:!0,get:function(){return c}}),_e.applyRecords=s,_e.cooksafeSpec=function(t,n,d,a){return{name:'cooksafe_records',table:'cooksafe_records',conflict:'venue_id,id',deletes:!1,protect:!0,list:()=>o(t.getState(),n.getState().records??[],d),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,e.csIdOk)(t.id)&&e.CS_KINDS.includes(t.kind)&&!!t.at,writable:a,matchKey:e=>({id:e}),revision:c,knownByRevision:!0,toRow:(e,t)=>i(e,t),fromRow:e=>r(e),apply:e=>s(e,t,n),subscribe:e=>{const d=t.subscribe((t,n)=>{t.diary===n.diary&&t.daySigns===n.daySigns&&t.weekly===n.weekly&&t.inspectorSends===n.inspectorSends&&t.accidents===n.accidents&&t.entries===n.entries||e()}),o=n.subscribe((t,n)=>{t.records!==n.records&&e()});return()=>{d(),o()}}}};var e=_r(_d[0]),t=_r(_d[1]);const n=e=>`photo-${e}`.slice(0,64),d=e=>JSON.parse(JSON.stringify(e));function o(e,t,o){const i=[...t];for(const t of e.diary??[])i.push({id:t.id,kind:'diary',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.daySigns??[])i.push({id:`day-${t.date}`,kind:'daysign',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.weekly??[])i.push({id:`week-${t.week}`,kind:'weekly',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.inspectorSends??[])i.push({id:t.id,kind:'inspector',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.accidents??[])o(t)||i.push({id:t.id,kind:'accident',at:t.createdAt,by:t.reportedBy,byId:t.reportedById,doc:d(t)});for(const t of e.entries??[])t.photo&&i.push({id:n(t.id),kind:'photo',at:t.at,by:t.by,byId:t.byId,doc:{entryId:t.id,photo:t.photo}});return i}function i(e,t){return{venue_id:t,id:e.id,kind:e.kind,at:e.at,by_name:(e.by??'').slice(0,120),doc:{...e.doc,...e.byId?{_byId:e.byId}:{}},archived:!!e.archived}}function r(t){if(!e.CS_KINDS.includes(t.kind))return null;const n={...t.doc??{}},d=n._byId?String(n._byId):void 0;delete n._byId;const o={id:String(t.id),kind:t.kind,at:new Date(t.at).toISOString(),by:String(t.by_name??''),doc:n};return d&&(o.byId=d),t.archived&&(o.archived=!0),o}const c=e=>(0,t.hashOf)(r({...i(e,''),at:e.at}));function s(t,n,d){if(!t.length)return;const o=t.filter(t=>e.CS_OWN.includes(t.kind));o.length&&d.setState(e=>{const t=new Map(o.map(e=>[e.id,e])),n=e.records.map(e=>t.get(e.id)??e),d=new Set(n.map(e=>e.id));return{records:[...o.filter(e=>!d.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at))}});const i=e=>t.filter(t=>t.kind===e).map(e=>e.doc),r=(e,t,n,d=!0)=>{if(!t.length)return e??[];const o=new Map(t.map(e=>[n(e),e])),i=(e??[]).map(e=>o.get(n(e))??e),r=new Set(i.map(n)),c=[...t.filter(e=>!r.has(n(e))),...i];return d?c:c.reverse()},c=t.filter(e=>'photo'===e.kind);n.setState(e=>{const t={},n=i('diary');n.length&&(t.diary=r(e.diary,n,e=>e.id).sort((e,t)=>t.at.localeCompare(e.at)));const d=i('daysign');d.length&&(t.daySigns=r(e.daySigns,d,e=>e.date));const o=i('weekly');o.length&&(t.weekly=r(e.weekly,o,e=>e.week).sort((e,t)=>t.at.localeCompare(e.at)));const s=i('inspector');s.length&&(t.inspectorSends=r(e.inspectorSends,s,e=>e.id).sort((e,t)=>t.at.localeCompare(e.at)));const a=i('accident');if(a.length&&(t.accidents=r(e.accidents,a,e=>e.id).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))),c.length){const n=new Map(c.map(e=>[String(e.doc.entryId),String(e.doc.photo??'')]));let d=!1;const o=(e.entries??[]).map(e=>{const t=n.get(e.id);return t&&e.photo!==t?(d=!0,{...e,photo:t}):e});d&&(t.entries=o)}return t})}},1255,[1256,1149]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CS_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CS_PRIVATE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CS_OWN",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"csIdOk",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"csId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CS_SECTION_LABEL",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"REHEAT_MIN_C",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"reheatOk",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"ICE_RANGE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"BOIL_RANGE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"iceOk",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"boilOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"calibrationOk",{enumerable:!0,get:function(){return b}}),e.offsiteOk=function(t,n){return!!Number.isFinite(n)&&('chilled'===t?n<=8:'frozen'===t?n<=-15:n>=63)},e.deliveryOk=function(t,n){return'ambient'===t||!(null===n||!Number.isFinite(n))&&('chilled'===t?n<=8:n<=-15)},Object.defineProperty(e,"tempWords",{enumerable:!0,get:function(){return y}}),e.calibrationDue=function(t,n){const r=k(t,'calibration');return!r||n.getTime()-new Date(r).getTime()>26784e5},e.reviewDue=function(t,n){const r=k(t,'review');return!r||n.getTime()-new Date(r).getTime()>157248e5},Object.defineProperty(e,"REVIEW_QUESTIONS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"EXCLUSION_HOURS",{enumerable:!0,get:function(){return v}}),e.returnFrom=C,e.mayReturn=function(t,n){return!!t&&n.getTime()>=C(t).getTime()},Object.defineProperty(e,"HOUSE_RULES",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"FLOW_STEPS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"CLEANING_DEFAULT",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"FREQ_LABEL",{enumerable:!0,get:function(){return x}}),e.cleaningDue=function(t,n,r){const i=t=>{const n=new Date(t);return Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())},o=i(r.toISOString());return t.filter(t=>{const r=n.filter(n=>'cleaning'===n.kind&&!n.archived&&n.doc.taskId===t.id).map(t=>t.at).sort().pop();return!r||(o-i(r))/w>=P[t.freq]})},e.allergenMatrix=function(n){const r=n.filter(t=>!!t.signOff);return{rows:r.map(n=>({id:n.id,dish:n.dish,section:n.section??'',cells:t.ALLERGENS.map(t=>n.allergens?.[t.id]??'')})).sort((t,n)=>t.section.localeCompare(n.section)||t.dish.localeCompare(n.dish)),left:n.length-r.length}},Object.defineProperty(e,"MATRIX_HEAD",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"matrixCell",{enumerable:!0,get:function(){return D}}),e.matrixSpoken=function(n){const r=t.ALLERGENS.filter((t,r)=>'contains'===n.cells[r]).map(t=>t.short),i=t.ALLERGENS.filter((t,r)=>'may'===n.cells[r]).map(t=>t.short);return`${n.dish}: ${r.length?`contains ${r.join(', ')}`:'none of the 14 allergens'}${i.length?`; may contain ${i.join(', ')}`:''}.`},Object.defineProperty(e,"CS_KIND_LABEL",{enumerable:!0,get:function(){return A}}),e.recordSummary=_,e.csCsv=function(t){return['Date and time,Record,By,Details',...t.filter(t=>i.includes(t.kind)&&!t.archived).sort((t,n)=>t.at.localeCompare(n.at)).map(t=>[new Date(t.at).toLocaleString('en-GB'),A[t.kind],t.by,_(t)].map(N).join(','))].join('\n')};var t=_r(_d[0]);const n=['diary','daysign','weekly','inspector','accident','photo','reheat','calibration','review','offsite','delivery','training','exclusion','houserule','cleaning','pest','maintenance'],r=['accident','training','exclusion'],i=['reheat','calibration','review','offsite','delivery','training','exclusion','houserule','cleaning','pest','maintenance'],o=t=>/^[A-Za-z0-9_.:-]{1,64}$/.test(t);let a=0;const l=t=>`cs-${t.slice(0,6)}-${Date.now().toString(36)}${(a++).toString(36)}`,s={cross:'Cross-contamination & allergens',cleaning:'Cleaning',chilling:'Chilled storage & cooling',cooking:'Cooking, reheating & hot holding',management:'Management & records'},c=82,d=t=>Number.isFinite(t)&&t>=c,u=[-1,1],f=[99,101],h=t=>Number.isFinite(t)&&t>=u[0]&&t<=u[1],p=t=>Number.isFinite(t)&&t>=f[0]&&t<=f[1],b=(t,n)=>h(t)&&p(n);const y=t=>`${t<0?'minus ':''}${Math.abs(t)} degrees`,w=864e5,k=(t,n)=>t.filter(t=>t.kind===n&&!t.archived).map(t=>t.at).sort().pop()??null;const $=['New dishes, suppliers or equipment are covered by the CookSafe safe methods','Critical limits (cooking 75\xb0C, reheating 82\xb0C, chilling 8\xb0C or below, hot holding 63\xb0C or above) still right','Records were kept every day, with corrective actions written down','Every member of the team has training and induction records','House Rules read and still followed','Allergen information matches the signed-off recipe cards'],v=48;function C(t){return new Date(new Date(t).getTime()+1728e5)}const O=[{id:'hr-personal',title:'Personal hygiene',text:'Clean work clothes and aprons; hair tied back and covered; no jewellery except a plain band; cuts covered with a blue waterproof dressing; no smoking, eating or vaping in food areas.'},{id:'hr-fitness',title:'Fitness to work',text:'Anyone with sickness, diarrhoea, skin infections or infected cuts tells the person in charge before starting work. Food handlers with sickness or diarrhoea stay off until 48 hours after the symptoms stop.'},{id:'hr-hands',title:'Handwashing',text:'Wash hands with soap and warm water and dry with paper towels: before handling food, after raw food, after breaks, the toilet, bins, cleaning and touching face or phone.'},{id:'hr-cross',title:'Cross-contamination',text:'Raw and ready-to-eat food kept apart in storage, preparation and display; separate colour-coded boards, knives and equipment; raw meat on the bottom shelf; separate complex equipment for raw and ready-to-eat food.'},{id:'hr-allergens',title:'Allergen management',text:'Allergen information comes only from signed-off recipe cards; any change to a recipe or supplier is checked before serving; orders with an allergy are made separately with clean equipment.'},{id:'hr-cleaning',title:'Cleaning',text:'Clean as you go; follow the cleaning schedule; use the right chemical at the right dilution and contact time; food contact surfaces disinfected with a product meeting BS EN 1276 or 13697.'},{id:'hr-pests',title:'Pest control',text:'Doors and windows proofed or screened; food stored off the floor and covered; any sign of pests reported straight away and written in the pest control log.'},{id:'hr-maintenance',title:'Maintenance',text:'Equipment, fridges and the building kept in good repair; faults reported, written in the maintenance log and fixed before the equipment is used for food.'},{id:'hr-waste',title:'Waste management',text:'Bins lidded and emptied regularly; waste never left in food rooms overnight; outside bins kept closed and the area clean.'},{id:'hr-stock',title:'Stock control',text:'Deliveries checked and put away straight away; first in, first out; food labelled and dated; nothing used past its use-by date.'},{id:'hr-water',title:'Water supply',text:'Mains drinking water used for food, ice and cleaning; ice machines cleaned to the schedule.'},{id:'hr-physical',title:'Physical and chemical contamination',text:'No glass in food areas where avoidable; breakages cleared and recorded; chemicals stored away from food and clearly labelled.'},{id:'hr-training',title:'Training and supervision',text:'Every food handler has induction before starting and training for their job, recorded in the training records; the person in charge supervises and checks the daily records.'}],S=[{id:'purchase',title:'Purchase',limit:'Approved suppliers only'},{id:'delivery',title:'Delivery',limit:'Chilled 8\xb0C or below \xb7 Frozen \u221215\xb0C or below'},{id:'storage',title:'Storage',limit:'Fridges 5\xb0C or below (8\xb0C legal limit) \xb7 Freezers \u221218\xb0C or below'},{id:'prep',title:'Preparation',limit:'Raw and ready-to-eat kept apart \xb7 Allergens checked'},{id:'cooking',title:'Cooking',limit:'Core 75\xb0C or above'},{id:'cooling',title:'Cooling',limit:'Cooled within 90 minutes, then chilled'},{id:'reheating',title:'Reheating',limit:'Core 82\xb0C or above (Scotland)'},{id:'hothold',title:'Hot holding',limit:'63\xb0C or above'},{id:'service',title:'Service',limit:'Allergen information from signed-off cards'}],E=[{id:'cl-surfaces',task:'Work surfaces and chopping boards',freq:'daily'},{id:'cl-handbasins',task:'Hand-wash basins and taps',freq:'daily'},{id:'cl-floors',task:'Kitchen floors',freq:'daily'},{id:'cl-bins',task:'Bins emptied and cleaned',freq:'daily'},{id:'cl-handles',task:'Door, fridge and freezer handles',freq:'daily'},{id:'cl-fridges',task:'Inside fridges and seals',freq:'weekly'},{id:'cl-ovens',task:'Ovens, grill and fryer',freq:'weekly'},{id:'cl-filters',task:'Extraction canopy filters',freq:'weekly'},{id:'cl-freezers',task:'Freezers defrosted and cleaned',freq:'monthly'},{id:'cl-walls',task:'Walls, shelves and behind equipment',freq:'monthly'}],P={daily:1,weekly:7,monthly:31},x={daily:'Daily',weekly:'Weekly',monthly:'Monthly'};const j=['Dish',...t.ALLERGENS.map(t=>t.short)],D=t=>'contains'===t?'Yes':'may'===t?'May':'';const A={diary:'Diary',daysign:'Daily sign-off',weekly:'Weekly sign-off',inspector:'Sent to inspector',accident:'Accident book',photo:'Check photo',reheat:'Reheating',calibration:'Probe calibration',review:'Six-monthly review',offsite:'Off-site temperature',delivery:'Delivery',training:'Training',exclusion:'Exclusion / return to work',houserule:'House Rule',cleaning:'Cleaning',pest:'Pest control',maintenance:'Maintenance'},N=t=>`"${String(t??'').replace(/"/g,'""')}"`;function _(t){const n=t.doc;switch(t.kind){case'reheat':return`${n.food??''}: ${n.value}\xb0C${n.ok?'':' (below 82\xb0C)'}${n.action?`; action: ${n.action}`:''}`;case'calibration':return`${n.probe??'Probe'}: iced water ${n.ice}\xb0C, boiling ${n.boil}\xb0C${n.ok?'':' (out of range)'}${n.action?`; action: ${n.action}`:''}`;case'offsite':return`${n.food??''} at ${n.place??''}: ${n.value}\xb0C (${n.type})${n.ok?'':' (out of range)'}${n.action?`; action: ${n.action}`:''}`;case'delivery':return`${n.supplier??''}: ${n.items??''}${null!==n.value&&void 0!==n.value?`, ${n.value}\xb0C`:''} (${n.type})${!1===n.accepted?', rejected':''}${n.note?`; ${n.note}`:''}`;case'training':return`${n.person??''}: ${n.course??''}${n.expires?`, renew ${n.expires}`:''}`;case'exclusion':return`${n.person??''}: off from ${n.from??''}${n.stopped?`, symptoms stopped ${n.stopped}`:''}${n.returned?`, back ${n.returned}`:''}`;case'houserule':return`${n.title??''}: ${n.inPlace?'in place':'not ticked'}${n.text?` \u2014 ${n.text}`:''}`;case'cleaning':return`${n.task??''}${n.note?`; ${n.note}`:''}`;case'pest':case'maintenance':return`${n.what??''}${n.action?`; action: ${n.action}`:''}${n.contractor?` (${n.contractor})`:''}`;case'review':return`${n.answers?.filter(Boolean).length??0} of ${$.length} confirmed${n.note?`; ${n.note}`:''}`;default:return String(n.text??n.note??'')}}},1256,[819]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCookSafe",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"SCHEDULE_ID",{enumerable:!0,get:function(){return u}}),_e.scheduleOf=function(e){const r=e.find(e=>e.id===u),t=r?.doc.schedule;return Array.isArray(t)&&t.length?t:n.CLEANING_DEFAULT},Object.defineProperty(_e,"ruleRecordId",{enumerable:!0,get:function(){return l}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},c=_r(d[1]),o=_r(d[2]),n=_r(d[3]);const s=(0,c.create)()((0,o.persist)(e=>({records:[],add:(r,t,c,o,s)=>{const u={id:s??(0,n.csId)(r),kind:r,at:o??(new Date).toISOString(),by:c.by.replace(' (example)',''),byId:c.byId,doc:t};return e(e=>({records:[u,...e.records.filter(e=>e.id!==u.id)]})),u},update:(r,t)=>e(e=>({records:e.records.map(e=>e.id===r?{...e,doc:{...e.doc,...t}}:e)})),archive:r=>e(e=>({records:e.records.map(e=>e.id===r?{...e,archived:!0}:e)}))}),{name:'covercharge-cooksafe-v1',storage:(0,o.createJSONStorage)(()=>t.default),version:1})),u='cs-cleaning-schedule';const l=e=>`houserule-${e}`},1257,[1160,995,1169,1256]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.currentCanChangeBookings=function(){const o=t.useSession.getState().meId;if(!o)return!0;const u=n.useOwner.getState().staff.find(n=>n.id===o&&n.active);return(0,s.canChangeBookings)(u)};var n=r(d[0]),t=r(d[1]),s=r(d[2])},1258,[863,866,992]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEED_INGREDIENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SEED_RECIPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"WASTE_REASONS",{enumerable:!0,get:function(){return f}}),_e.stripKitchenExamples=S,Object.defineProperty(_e,"useKitchen",{enumerable:!0,get:function(){return w}});var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[6]),p=_r(_d[7]);const c=(e,t,s,i,n,r,o,d=[],l)=>({id:e,name:t,unit:s,cost:i,supplierId:n,par:r,onHand:o,allergens:d,prevCost:l}),u=[c('haddock','Haddock fillet','kg',1848,'sup-1',14,9.5,['fish'],1650),c('smk-haddock','Smoked haddock','kg',1500,'sup-1',4,3.2,['fish']),c('smk-salmon','Smoked salmon','kg',2800,'sup-1',3,1.1,['fish']),c('crab','White and brown crab meat','kg',3800,'sup-1',3,2.4,['crustaceans']),c('mussels','Rope mussels','kg',450,'sup-1',12,0,['molluscs']),c('langoustine','Langoustines','kg',2600,'sup-1',6,4.5,['crustaceans']),c('lobster','Lobster (whole)','each',1800,'sup-1',6,4,['crustaceans']),c('prawns','Prawns (cooked, peeled)','kg',1400,'sup-1',3,2.6,['crustaceans']),c('beef-fillet','Beef fillet','kg',4800,'sup-2',4,2.9),c('steak','Braising steak','kg',1200,'sup-2',8,6.2),c('patty','Burger patty 6 oz','each',160,'sup-2',40,18),c('chicken','Chicken breast','kg',950,'sup-2',10,7.5),c('chorizo','Chorizo','kg',1400,'sup-2',2,1.6,['sulphites']),c('haggis','Haggis','kg',900,'sup-2',4,3.5,['gluten','celery']),c('potatoes','Potatoes (chipping)','kg',90,'sup-3',75,40),c('onions','Onions','kg',110,'sup-3',15,11),c('leaves','Salad leaves','kg',700,'sup-3',3,.8),c('lemons','Lemons','each',25,'sup-3',60,44),c('milk','Whole milk','L',110,'sup-4',20,14,['milk']),c('cream','Double cream','L',380,'sup-4',12,9,['milk']),c('butter','Butter','kg',850,'sup-4',6,4.5,['milk']),c('cheddar','Mature cheddar','kg',900,'sup-4',5,3.8,['milk']),c('parmesan','Parmesan','kg',1800,'sup-4',2,1.4,['milk']),c('eggs','Free-range eggs','each',28,'sup-4',120,90,['eggs']),c('ice-cream','Vanilla ice cream','L',450,'sup-4',10,7,['milk','eggs']),c('flour','Plain flour','kg',90,'sup-5',16,12,['gluten']),c('batter','Beer batter mix','kg',220,'sup-5',12,3.5,['gluten']),c('pastry','Puff pastry','kg',450,'sup-5',6,4.2,['gluten','milk']),c('macaroni','Macaroni','kg',180,'sup-5',6,5,['gluten']),c('penne','Penne','kg',180,'sup-5',6,4.5,['gluten']),c('buns','Brioche buns','each',45,'sup-5',40,30,['gluten','eggs','milk','sesame']),c('baguette','Garlic baguette','each',90,'sup-5',24,16,['gluten','milk']),c('oil','Rapeseed oil (fryer)','L',200,'sup-5',60,32),c('sponge','Sticky toffee sponge (portion)','each',95,'sup-5',30,22,['gluten','eggs','milk']),c('truffle-oil','Truffle oil','L',3e3,'sup-5',1,.6)],k=(e,t,s)=>({dishId:e,yield:t,lines:s.map(([e,t])=>({ing:e,qty:t}))}),h=[k('a-fishsupper','1 portion (220 g fillet)',[['haddock',.22],['batter',.06],['potatoes',.35],['oil',.05],['lemons',1]]),k('a-skink','1 bowl',[['smk-haddock',.08],['potatoes',.1],['milk',.15],['cream',.05],['onions',.03],['butter',.01]]),k('a-salmon','1 plate',[['smk-salmon',.07],['cream',.03],['leaves',.02],['lemons',1]]),k('a-haggis','1 plate',[['haggis',.1],['flour',.02],['eggs',1],['oil',.03]]),k('a-crabcakes','2 cakes',[['crab',.08],['potatoes',.06],['flour',.02],['eggs',1],['leaves',.02]]),k('a-tempura','1 plate',[['haddock',.07],['prawns',.05],['onions',.05],['batter',.06],['oil',.04],['lemons',1]]),k('a-mini-fish-goujons','Fish Goujons & Chips',[['haddock',.1],['potatoes',.2],['batter',.03],['oil',.03]]),k('a-pie','1 pie',[['steak',.22],['pastry',.08],['onions',.05],['potatoes',.3],['oil',.03]]),k('a-chicken','1 plate',[['chicken',.22],['potatoes',.25],['cream',.05],['butter',.02]]),k('a-maccheese','1 bowl',[['macaroni',.12],['cheddar',.08],['milk',.2],['butter',.02],['flour',.015]]),k('a-penne','1 bowl',[['penne',.12],['chicken',.15],['chorizo',.04],['cream',.08],['parmesan',.01]]),k('a-caesar','1 plate',[['chicken',.16],['leaves',.08],['parmesan',.015],['eggs',1],['baguette',.25]]),k('a-moules','1 pot',[['mussels',.5],['cream',.08],['onions',.03],['baguette',.5]]),k('a-fillet','8 oz steak',[['beef-fillet',.227],['potatoes',.35],['onions',.05],['oil',.05],['butter',.02]]),k('a-claymore','1 burger',[['patty',1],['buns',1],['cheddar',.03],['potatoes',.3],['onions',.06],['batter',.03],['oil',.05]]),k('a-langoustines','1 plate',[['langoustine',.35],['butter',.03],['baguette',.5],['leaves',.03],['lemons',1]]),k('a-lobster','1 lobster',[['lobster',1],['butter',.04],['potatoes',.3],['oil',.04],['leaves',.03],['lemons',1]]),k('a-smorgasbord','Serves one',[['langoustine',.3],['mussels',.3],['crab',.08],['prawns',.1],['smk-salmon',.06],['leaves',.05],['lemons',2]]),k('a-deluxe','Serves two',[['lobster',1],['langoustine',.5],['crab',.15],['mussels',.5],['prawns',.15],['smk-salmon',.1],['leaves',.1],['lemons',3],['baguette',1]]),k('a-chips','1 side',[['potatoes',.35],['oil',.05]]),k('a-onionrings','1 side',[['onions',.15],['batter',.06],['oil',.04]]),k('a-garlicbread','1 side',[['baguette',.5],['butter',.02]]),k('a-truffle','1 side',[['potatoes',.35],['oil',.05],['parmesan',.015],['truffle-oil',.005]]),k('a-salad','1 side',[['leaves',.06],['lemons',.5]]),k('a-stp','1 portion',[['sponge',1],['cream',.05],['butter',.02],['ice-cream',.08]])],f=['Out of date','Spoiled','Over-production','Dropped / burnt','Returned by customer','Prep trim'],b=(e,t=10)=>{const s=new Date;return s.setDate(s.getDate()-e),s.setHours(t,0,0,0),s.toISOString()},y=e=>`${e}-${Math.random().toString(36).slice(2,8)}`;function v(){return{ingredients:u.map(e=>({...e})),recipes:h,targetGp:70,deliveries:[{id:'dl-today-fish',supplierId:'sup-1',due:'today',status:'expected',lines:[{ing:'haddock',ordered:10,received:8,price:1848},{ing:'mussels',ordered:12,received:12,price:450},{ing:'langoustine',ordered:3,received:3,price:2750},{ing:'smk-salmon',ordered:2,received:2,price:2800}]},{id:'dl-today-veg',supplierId:'sup-3',due:'today',status:'expected',lines:[{ing:'potatoes',ordered:50,received:50,price:90},{ing:'leaves',ordered:3,received:2,price:700},{ing:'lemons',ordered:30,received:30,price:25}]}],stockTakes:[{id:'stk-1',at:b(7,22),by:'Head Chef (example)',lines:[{ing:'haddock',expected:6,counted:5.4,cost:1650},{ing:'potatoes',expected:30,counted:28,cost:90},{ing:'cream',expected:8,counted:8,cost:380},{ing:'beef-fillet',expected:3.2,counted:3,cost:4800}]}],waste:[{id:'w1',at:b(1,21),by:'Head Chef (example)',item:'Haddock fillet',ing:'haddock',qty:.6,unit:'kg',reason:'Over-production',cost:1109},{id:'w2',at:b(2,15),by:'Head Chef (example)',item:'Salad leaves',ing:'leaves',qty:.5,unit:'kg',reason:'Spoiled',cost:350},{id:'w3',at:b(3,20),by:'Head Chef (example)',item:'Fish supper',qty:1,unit:'portion',reason:'Dropped / burnt',cost:517},{id:'w4',at:b(4,11),by:'Head Chef (example)',item:'Double cream',ing:'cream',qty:1,unit:'L',reason:'Out of date',cost:380},{id:'w5',at:b(5,22),by:'Head Chef (example)',item:'Chips',ing:'potatoes',qty:3,unit:'kg',reason:'Over-production',cost:270}],orders:[{id:'po-1',supplierId:'sup-1',at:b(1,13),by:'Head Chef (example)',status:'placed (by phone)',lines:[{ing:'haddock',qty:10,cost:1848},{ing:'mussels',qty:12,cost:450},{ing:'langoustine',qty:3,cost:2600},{ing:'smk-salmon',qty:2,cost:2800}],total:30520},{id:'po-2',supplierId:'sup-3',at:b(1,18),by:'Head Chef (example)',status:'placed (on website)',lines:[{ing:'potatoes',qty:50,cost:90},{ing:'leaves',qty:3,cost:700},{ing:'lemons',qty:30,cost:25}],total:7350}],prepTicks:{},temps:[{id:'t1',at:b(0,9),by:'Head Chef (example)',kind:'fridge',unit:'Walk-in fridge',temp:3},{id:'t2',at:b(0,9),by:'Head Chef (example)',kind:'freezer',unit:'Chest freezer',temp:-20}]}}function S(e){const t=v(),s=(e,t)=>t.some(t=>JSON.stringify(t)===JSON.stringify(e)),i=e.recipes.filter(e=>!s(e,t.recipes)),r=e.deliveries.filter(e=>!t.deliveries.some(t=>t.id===e.id&&t.supplierId===e.supplierId&&t.due===e.due&&'expected'===e.status&&!e.checkedBy&&!e.note&&JSON.stringify(t.lines)===JSON.stringify(e.lines))),o=e.stockTakes.filter(e=>!(0,n.demoActor)(e.by)),d=e.waste.filter(e=>!(0,n.demoActor)(e.by)),l=e.orders.filter(e=>!(0,n.demoActor)(e.by)),p=e.temps.filter(e=>!(0,n.demoActor)(e.by)),c=new Set([...i,...r,...o,...l].flatMap(e=>e.lines.map(e=>e.ing)));return d.forEach(e=>{e.ing&&c.add(e.ing)}),{ingredients:e.ingredients.filter(e=>c.has(e.id)||!s(e,t.ingredients)),recipes:i,deliveries:r,stockTakes:o,waste:d,orders:l,temps:p}}const w=(0,l.create)()((0,p.persist)(e=>({...r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v(),setTarget:t=>e({targetGp:Math.max(40,Math.min(90,Math.round(t)))}),setIngredient:(t,s)=>e(e=>({ingredients:e.ingredients.map(e=>e.id===t?{...e,...s}:e)})),setRecipeQty:(t,s,i)=>e(e=>({recipes:e.recipes.map(e=>e.dishId!==t?e:{...e,lines:i>0?e.lines.some(e=>e.ing===s)?e.lines.map(e=>e.ing===s?{...e,qty:i}:e):[...e.lines,{ing:s,qty:i}]:e.lines.filter(e=>e.ing!==s)})})),acceptDelivery:(t,i,n,o)=>e(e=>({deliveries:e.deliveries.map(e=>e.id===t?{...e,lines:i,status:'accepted',checkedBy:n,at:(new Date).toISOString(),note:o}:e),ingredients:e.ingredients.map(e=>{const t=i.find(t=>t.ing===e.id);return t?{...e,onHand:(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand+t.received:Math.round(100*(e.onHand+t.received))/100,...t.price!==e.cost?{prevCost:e.cost,cost:t.price}:{}}:e})})),saveStockTake:(t,s)=>e(e=>({stockTakes:[{id:y('stk'),at:(new Date).toISOString(),by:s,lines:Object.entries(t).map(([t,s])=>{const i=e.ingredients.find(e=>e.id===t);return{ing:t,expected:i.onHand,counted:s,cost:i.cost}})},...e.stockTakes],ingredients:e.ingredients.map(e=>e.id in t?{...e,onHand:t[e.id]}:e)})),addWaste:t=>e(e=>({waste:[{...t,id:y('w'),at:(new Date).toISOString()},...e.waste],ingredients:t.ing?e.ingredients.map(e=>e.id===t.ing?{...e,onHand:Math.max(0,(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand-t.qty:Math.round(100*(e.onHand-t.qty))/100)}:e):e.ingredients})),addOrder:t=>{const s=y('po');return e(e=>({orders:[{...t,id:s,at:(new Date).toISOString()},...e.orders]})),s},setOrderStatus:(t,s)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,status:s}:e)})),tickPrep:(t,s)=>e(e=>{const i={...e.prepTicks};return s?i[t]={by:s,at:(new Date).toISOString()}:delete i[t],{prepTicks:i}}),addTemp:t=>e(e=>({temps:[{...t,id:y('t'),at:(new Date).toISOString()},...e.temps]})),reset:()=>e(r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v())}),{name:'covercharge-kitchen-v1',version:3,storage:(0,p.createJSONStorage)(()=>d.default),migrate:async e=>{const s=e;return t.LIVE_VENUE_BUILD?(await(0,i.archiveChefCache)('kitchen',s),{...s,...S(s)}):s}}))},1259,[842,1086,1159,1085,5,1160,995,1169]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ACCIDENT_CATEGORIES",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"RIDDOR_CATEGORIES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"sid",{enumerable:!0,get:function(){return u}}),_e.isSeedAccident=S,_e.upgradeTempUnits=k,Object.defineProperty(_e,"useSafety",{enumerable:!0,get:function(){return w}});var e,t=r(_d[0]),i=r(_d[1]),n=r(_d[2]),a=r(_d[3]),s=(e=a)&&e.__esModule?e:{default:e},o=r(_d[4]),d=r(_d[5]),c=r(_d[6]);const l=['Near miss','Slip, trip or fall','Cut','Burn or scald','Manual handling','Struck by an object','Allergic reaction','Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days','Other'],p=['Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days'];let f=0;const u=e=>`${e}-${Date.now().toString(36)}${(f++).toString(36)}`,h=(e,t,i)=>({id:e,when:t,location:'',person:'',personType:'Staff',category:'Near miss',what:'',injury:'None',firstAid:'None needed',witnesses:'',reportedBy:'',reportedById:'',app:'staff',createdAt:`${t}:00`,...i});function y(){const e=new Date,t=(t,i)=>{const n=new Date(e);return n.setDate(n.getDate()-t),`${n.toISOString().slice(0,10)}T${i}`};return[h('acc-ex1',t(3,'19:40'),{location:'Kitchen pass',person:'Server (example)',category:'Near miss',what:'Example: water on the floor by the pass after the glass washer leaked. Nobody slipped.',firstAid:'None needed',witnesses:'Bar (example)',reportedBy:'Server (example)',reportedById:'st-4',app:'staff'}),h('acc-ex2',t(6,'12:15'),{location:'Kitchen: fryer section',person:'Head Chef (example)',category:'Burn or scald',what:'Example: splash of hot oil on the back of the hand while changing the basket.',injury:'Small burn, back of left hand',firstAid:'Cooled under running water for 20 minutes, sterile dressing',witnesses:'None',reportedBy:'Head Chef (example)',reportedById:'st-3',app:'chef'})]}function S(e){const t=({when:e,createdAt:t,...i})=>JSON.stringify(i);return y().some(i=>i.id===e.id&&t(i)===t(e))}function k(e){const t=Object.fromEntries(c.DEFAULT_POINTS.map(e=>[e.id,e])),i=new Set(['cp-prep','cp-bar','cp-freezer']);let n=e.map(e=>'cp-walkin'===e.id?{...e,archived:!0,due:[],aliases:[]}:i.has(e.id)?{...e,name:t[e.id].name,location:t[e.id].location,kind:t[e.id].kind,max:t[e.id].max,due:t[e.id].due,aliases:t[e.id].aliases,archived:!1}:e);const a=new Set(n.map(e=>e.id)),s=c.DEFAULT_POINTS.filter(e=>!a.has(e.id)),o=c.DEFAULT_POINTS.filter(e=>s.includes(e)&&('fridge'===e.kind||'freezer'===e.kind)),d=s.filter(e=>!o.includes(e));let l=-1;n.forEach((e,t)=>{'fridge'!==e.kind&&'freezer'!==e.kind||(l=t)}),n=[...n.slice(0,l+1),...o,...n.slice(l+1),...d];const p=n.filter(e=>'fridge'===e.kind||'freezer'===e.kind),f=[...p.filter(e=>'fridge'===e.kind),...p.filter(e=>'freezer'===e.kind)];let u=0;return n.map(e=>'fridge'===e.kind||'freezer'===e.kind?f[u++]:e)}const w=(0,o.create)()((0,d.persist)(e=>({points:c.DEFAULT_POINTS,entries:[],accidents:n.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:y(),probes:[],diary:[],daySigns:[],weekly:[],inspectorSends:[],logInspectorSend:t=>e(e=>({inspectorSends:[{...t,id:u('ins')},...e.inspectorSends??[]]})),addNote:t=>e(e=>({diary:[{...t,id:u('dn')},...e.diary??[]]})),signDay:t=>e(e=>({daySigns:[...(e.daySigns??[]).filter(e=>e.date!==t.date),t]})),signWeek:t=>e(e=>({weekly:[{...t,id:u('wk')},...(e.weekly??[]).filter(e=>e.week!==t.week)]})),addProbe:t=>e(e=>({probes:[...e.probes??[],{...t,id:u('pr'),status:'not-connected'}]})),removeProbe:t=>e(e=>({probes:(e.probes??[]).filter(e=>e.id!==t)})),addEntries:t=>e(e=>({entries:[...t.map(e=>({...e,id:`${u('hc')}${Math.random().toString(36).slice(2,7)}`})),...e.entries]})),setPoint:(t,i)=>e(e=>({points:e.points.map(e=>e.id===t?{...e,...i}:e)})),addPoint:t=>e(e=>({points:[...e.points,{...t,id:`${u('cp')}${Math.random().toString(36).slice(2,6)}`}]})),resetPoints:()=>e({points:c.DEFAULT_POINTS}),addAccident:t=>e(e=>({accidents:[{...t,id:u('acc'),createdAt:(new Date).toISOString()},...e.accidents]})),setRiddorNote:(t,i)=>e(e=>({accidents:e.accidents.map(e=>e.id===t?{...e,riddorNote:i}:e)}))}),{name:'covercharge-safety-v1',storage:(0,d.createJSONStorage)(()=>s.default),version:5,migrate:async(e,n)=>{if(t.LIVE_VENUE_BUILD&&e&&await(0,i.archiveChefCache)('safety',e),e&&n<2){const t=new Set((e.points??[]).map(e=>e.id));e.points=[...e.points??[],...c.DEFAULT_POINTS.filter(e=>!t.has(e.id))],e.diary=e.diary??[],e.daySigns=e.daySigns??[],e.weekly=e.weekly??[]}return e&&n<5&&(e.points=k(e.points??[])),t.LIVE_VENUE_BUILD&&e&&(e.accidents=(e.accidents||[]).filter(e=>!S(e))),e}}))},1260,[842,1159,5,1160,995,1169,1261]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"KIND_LABEL",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TEMP_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"isTempKind",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"SECTIONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"SECTION_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"sectionOf",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"initialsOf",{enumerable:!0,get:function(){return l}}),_e.unitAliases=u,Object.defineProperty(_e,"DEFAULT_POINTS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"limitText",{enumerable:!0,get:function(){return f}}),_e.inRange=p,_e.spokenNumber=y,_e.parseQuick=function(e,n){const r=n.filter(e=>!e.archived);return e.split(/[,;\n]+|\s+and\s+|\.\s+/i).map(e=>e.trim()).filter(Boolean).map(e=>{const n=e.toLowerCase().replace(/[\u2010\u2013]/g,'-').replace(/-(?!\d)/g,' '),o=` ${n.replace(/[^a-z0-9.\- ]/g,' ').replace(/\s+/g,' ')} `;let a,s=0,l='';for(const e of r)for(const n of[e.name.toLowerCase(),...e.aliases]){const t=n.replace(/-/g,' ').replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim();t&&o.includes(` ${t} `)&&t.length>s&&(a=e,s=t.length,l=t)}const c=y(l?n.replace(new RegExp(`(^|[^a-z0-9])${l.split(' ').map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&')).join('[^a-z0-9]+')}(?=$|[^a-z0-9])`),'$1 '):n);return/ (walk ?in|cold room) /.test(o)&&!/(walk|cold room)/.test(l)?{text:e,value:null,problem:'The walk-in is a dry store, not on the temperature log. Pick a fridge or freezer below.'}:a?t(a.kind)?null==c?{text:e,point:a,value:null,problem:'No temperature heard \u2014 type it in.'}:{text:e,point:a,value:c}:{text:e,point:a,value:null}:{text:e,value:c,problem:'Not sure which check this is \u2014 pick it below or type it.'}})},_e.missedChecks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const s of e){if(s.archived)continue;const e=s.due.filter(e=>k(e)<=o);if(!e.length)continue;const l=e[e.length-1],c=r.getTime()+6e4*k(e[0])-108e5,d=n.filter(e=>e.pointId===s.id&&new Date(e.at).getTime()>=c&&new Date(e.at).getTime()<=t.getTime()),u=e.length;d.lengthe.map(w).join(',')).join('\r\n')+'\r\n'},Object.defineProperty(_e,"SLOTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"SLOT_LABEL",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"SLOT_HINT",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"slotOf",{enumerable:!0,get:function(){return $}}),_e.todayTasks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const s of e){const e=s.archived?[]:[...s.due].sort();if(!e.length)continue;const l=r.getTime()+6e4*k(e[0])-108e5,c=n.filter(e=>e.pointId===s.id&&new Date(e.at).getTime()>=l&&new Date(e.at).getTime()<=t.getTime()).reverse().sort((e,n)=>e.at.localeCompare(n.at));e.forEach((e,n)=>{const t=c[n],r=k(e),l=t?'done':o>=r?'overdue':o>=r-60?'due':'upcoming';a.push({key:`${s.id}@${e}`,point:s,due:e,slot:$(e),status:l,entry:t})})}return a.sort((e,n)=>e.due.localeCompare(n.due)||e.point.name.localeCompare(n.point.name))},_e.unitStatus=function(e,n,t){const r=n.filter(n=>n.pointId===e.id&&null!=n.value).reverse().sort((e,n)=>e.at.localeCompare(n.at)),o=r[r.length-1];if(!o)return{rag:'none',history:r,why:'No readings yet'};const a=o.value;if(!p(e,a))return{rag:'red',latest:o,history:r,why:'Out of range'};const s=new Date(t);if(s.setHours(0,0,0,0),new Date(o.at).getTime()e.max-1||null!=e.min&&an.includes(e),r=['cross','cleaning','chilling','cooking','management'],o={cross:'Cross-contamination & allergens',cleaning:'Cleaning',chilling:'Chilled storage & cooling',cooking:'Cooking, reheating & hot holding',management:'Management & records'},a={fridge:'chilling',freezer:'chilling',cool:'chilling',delivery:'chilling',cook:'cooking',hothold:'cooking',cleaning:'cleaning',allergen:'cross',check:'management'},s=e=>e.section??a[e.kind],l=e=>e.replace(' (example)','').split(/\s+/).filter(Boolean).map(e=>e[0]).join('').slice(0,3).toUpperCase(),c={1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten'},d={1:'first',2:'second',3:'third',4:'fourth',5:'fifth',6:'sixth',7:'seventh',8:'eighth',9:'ninth',10:'tenth'};function u(e,n){const t=e.trim().toLowerCase().replace(/\s+/g,' ');if(!t)return[];const r=(n??'').trim().toLowerCase(),o=t.replace(/^(downstairs|upstairs|kitchen|cellar|basement|back|front|bar)\s+/,'').replace(r&&t.startsWith(r+' ')?new RegExp('^'+r.replace(/[.*+?^${}()|[\]\\]/g,'\\$&')+'\\s+'):/^$/,''),a=new Set([t,o]);for(const e of[t,o]){const n=e.match(/^(.*\S)\s+(\d{1,2})$/);n&&c[n[2]]&&(a.add(`${n[1]} ${c[n[2]]}`),a.add(`${n[1]} number ${n[2]}`),e!==o||/\s/.test(n[1])||a.add(`${d[n[2]]} ${n[1]}`))}return[...a].filter(Boolean)}const m=[{id:'cp-walkin',name:'Walk-in fridge',kind:'fridge',max:5,due:[],aliases:[],archived:!0},{id:'cp-prep',name:'Downstairs fridge 1',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 1')},{id:'cp-bar',name:'Downstairs fridge 2',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 2')},{id:'cp-fridge3',name:'Downstairs fridge 3',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 3')},{id:'cp-fridge4',name:'Upstairs fridge 4',location:'Upstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Upstairs fridge 4')},{id:'cp-freezer',name:'Downstairs freezer 1',location:'Downstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Downstairs freezer 1')},{id:'cp-freezer2',name:'Upstairs freezer 2',location:'Upstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Upstairs freezer 2')},{id:'cp-freezer3',name:'Upstairs freezer 3',location:'Upstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Upstairs freezer 3')},{id:'cp-cook',name:'Cooking: core temperature',kind:'cook',min:75,due:[],aliases:['core','cook','cooking','probe']},{id:'cp-cool',name:'Cooling: within 90 minutes',kind:'cool',max:8,due:[],aliases:['cooling','cool']},{id:'cp-hothold',name:'Hot hold: bain-marie',kind:'hothold',min:63,due:['18:00'],aliases:['hot hold','bain marie','bain-marie','hothold']},{id:'cp-del-chill',name:'Delivery: chilled',kind:'delivery',max:8,due:[],aliases:['chilled delivery','delivery chilled','delivery']},{id:'cp-del-frozen',name:'Delivery: frozen',kind:'delivery',max:-15,due:[],aliases:['frozen delivery','delivery frozen']},{id:'cp-clean',name:'Close-down clean signed off',kind:'cleaning',due:['23:00'],aliases:['cleaning','clean down','close down']},{id:'cp-allergen',name:'Allergen matrix checked against today\u2019s specials',kind:'allergen',due:['11:00'],aliases:['allergen','allergens']},{id:'cp-open-equip',name:'Fridges, freezers and other equipment working',kind:'check',section:'management',due:['09:00'],aliases:['equipment']},{id:'cp-open-staff',name:'Staff fit for work, in clean work clothes',kind:'check',section:'management',due:['09:00'],aliases:['staff fit']},{id:'cp-open-surfaces',name:'Prep areas, surfaces and utensils clean and disinfected',kind:'cleaning',due:['09:00'],aliases:['surfaces','prep areas']},{id:'cp-open-pests',name:'No signs of pests',kind:'check',section:'cleaning',due:['09:00'],aliases:['pests','pest']},{id:'cp-open-hands',name:'Hand-wash basins: hot water, soap and paper towels',kind:'check',section:'cross',due:['09:00'],aliases:['hand wash','handwash','soap']},{id:'cp-open-probe',name:'Probe thermometer working, probe wipes available',kind:'check',section:'management',due:['09:00'],aliases:['probe wipes','thermometer']},{id:'cp-mid-boards',name:'Raw and ready-to-eat kept apart; colour-coded boards in use',kind:'check',section:'cross',due:['12:00'],aliases:['boards','raw and ready to eat']},{id:'cp-close-stored',name:'Food covered, labelled, dated and put away',kind:'check',section:'chilling',due:['22:00'],aliases:['labelled','covered']},{id:'cp-close-useby',name:'Food past its use-by date thrown away',kind:'check',section:'chilling',due:['22:00'],aliases:['use by','use-by']},{id:'cp-close-waste',name:'Waste removed and bins relined',kind:'check',section:'cleaning',due:['22:00'],aliases:['waste','bins']}],f=e=>null!=e.min&&null!=e.max?`${e.min}\xb0C to ${e.max}\xb0C`:null!=e.max?`${e.max}\xb0C or colder`:null!=e.min?`${e.min}\xb0C or hotter`:'Done / not done';function p(e,n){return(null==e.min||n>=e.min)&&(null==e.max||n<=e.max)}const h={zero:0,nought:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90};function y(e){const n=e.toLowerCase().replace(/\u2212/g,'-').replace(/degrees?|\xb0c?|celsius|centigrade/g,' '),t=/\b(minus|negative)\b/.test(n),r=n.match(/-?\d+(?:[.,]\d+)?/);if(r){const e=Number(r[0].replace(',','.'));return t&&e>0?-e:e}const o=n.split(/[^a-z]+/).filter(Boolean);let a=null,s=null,l=!1;for(const e of o)if('point'!==e){if(e in h){if(l){s=h[e];break}a=(a??0)+h[e]}}else l=!0;if(null==a)return null;const c=null!=s?Number(`${a}.${s}`):a;return t?-c:c}const k=e=>{const[n,t]=e.split(':').map(Number);return 60*n+t};const b=e=>null!=e.value?`${e.value}\xb0C`:e.done?'Done':'Not done',w=e=>{const n=null==e?'':String(e);return/[",\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n},v=['Date','Time','Check','Type','Reading','Safe limit','Result','Corrective action','Note','Recorded by','Entry'];function D(n,t){return n.map(n=>{const r=new Date(n.at),o=t.find(e=>e.id===n.pointId);return[r.toLocaleDateString('en-GB'),r.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),n.name,e[n.kind],b(n),o?f(o):'',n.ok?'OK':'OUT OF RANGE',n.corrective??'',n.note??'',n.by,'probe'===n.source?'Wireless probe':'voice'===n.source?'Voice (confirmed)':'Typed']})}const O=['opening','midday','closing'],x={opening:'Opening',midday:'Midday',closing:'Closing'},C={opening:'until 11:00',midday:'11:00 to 16:00',closing:'from 16:00'},$=e=>{const n=k(e);return n<660?'opening':n<960?'midday':'closing'};const z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,T=['Opening and closing checks were done every day (or the reason is in the diary)','Every out-of-range reading has a corrective action','Probe thermometers checked (iced water / boiling water) this week','Allergen information is up to date for menu and special changes','Cleaning schedule followed; no signs of pests','Staff trained on any changed safe methods']},1261,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fixSupplierNames=function(b){return b?s.reduce((s,[b,n])=>s.replace(b,n),b):b};const s=[[/\bAl{2}sons?'?s?\b|\bAlson's\b/g,'Alsons'],[/\bSpe[zs] ?[Bb]ona\b|\bSpezbona\b/g,'Spes Bona'],[/\bReeds\b/gi,'Reids']]},1262,[]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_ORDER_LIST_SETTINGS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"UNITS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY_FULL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"normName",{enumerable:!0,get:function(){return a}}),e.findDuplicate=function(t,n,i,s){return t.find(t=>t.listId===n&&!t.removed&&'open'===t.status&&a(t.name)===a(i)&&u(t.unit)===u(s))},e.bumpQty=function(t,n,i,a,u){return{...t,qty:Math.round(100*(t.qty+n))/100,bumps:[...t.bumps??[],{by:i,name:a,qty:n,at:u}],updatedAt:u}},Object.defineProperty(e,"qtyText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"validQty",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"liveItems",{enumerable:!0,get:function(){return d}}),e.finishOrder=function(t,n,i,a,u,s){const o=d(n,t.id),l=o.filter(t=>'got'!==t.status),c={id:s(),listId:t.id,listName:t.name,finishedAt:u,finishedBy:a.id,finishedByName:a.name,items:o.map(t=>({name:t.name,qty:t.qty,unit:t.unit,note:t.note,status:t.status,addedByName:t.addedByName})),carried:i?l.length:0},p=i?l.map(t=>({...t,status:'open',carried:'missing'===t.status?'missing':'not-got',statusBy:void 0,statusAt:void 0,updatedAt:u})):[],m=new Set(p.map(t=>t.id));return{round:c,drop:o.filter(t=>!m.has(t.id)).map(t=>t.id),carriedOver:p}},e.nextTripDate=p,e.tripText=function(t,n,a){const u=p(t,n,a);if(!u)return'Running list';const[,s,o]=u.split('-').map(Number);return"Next trip "+(u===n?'today':u===l(n,1)?'tomorrow':`${i[c(u)]} ${o} ${['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][s-1]}`)},e.initials=function(t){const n=t.replace(/\(.*?\)/g,' ').split(/[^A-Za-z0-9]+/).filter(t=>t&&!['and','the','of','&'].includes(t.toLowerCase()));return n.length?(1===n.length?n[0].slice(0,2):n[0][0]+n[1][0]).toUpperCase():'?'},e.telHref=function(t){if(!t)return null;const n=t.trim().replace(/[^\d+]/g,'').replace(/(?!^)\+/g,'');return n.replace(/\D/g,'').length>=6?`tel:${n}`:null};const t={allowStaff:!0,defaultTripDay:5},n=['','cases','bottles','kegs','boxes','bags','packs','kg','litres','each'],i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],a=t=>t.trim().toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').replace(/s$/,''),u=t=>t.trim().toLowerCase().replace(/s$/,'');const s=t=>`${Number.isInteger(t.qty)?t.qty:t.qty.toFixed(2).replace(/0$/,'')}${t.unit?` ${t.unit}`:''}`,o=t=>Number.isFinite(t)&&t>0&&t<=9999,d=(t,n)=>t.filter(t=>t.listId===n&&!t.removed).sort((t,n)=>('open'===t.status?0:1)-('open'===n.status?0:1)||t.addedAt.localeCompare(n.addedAt));const l=(t,n)=>{const[i,a,u]=t.split('-').map(Number);return new Date(Date.UTC(i,a-1,u+n)).toISOString().slice(0,10)},c=t=>{const[n,i,a]=t.split('-').map(Number);return new Date(Date.UTC(n,i-1,a)).getUTCDay()};function p(n,i,a=t.defaultTripDay){if('trip'!==n.kind)return null;if(n.nextTrip&&n.nextTrip>=i)return n.nextTrip;const u=n.tripDay??a;return l(i,(u-c(i)+7)%7)}},1263,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useClockArea",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"areaOf",{enumerable:!0,get:function(){return _}});var e,t=r(d[0]),n=r(d[1]),s=r(d[2]),u=(e=s)&&e.__esModule?e:{default:e},c=r(d[3]),l=r(d[4]),E=r(d[5]);const o=(0,c.create)()((0,l.persist)(e=>({areas:(0,n.privateClockVenue)(t.VENUE_RID)?{[t.VENUE_RID]:(0,n.venueClockArea)(t.VENUE_RID)}:{},visiting:{},set:(s,u,c)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{...e.areas[s]??{},...u}),updatedAt:(new Date).toISOString(),updatedBy:c}}}),reset:(s,u)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{lat:e.areas[s]?.lat??null,lng:e.areas[s]?.lng??null}),updatedAt:(new Date).toISOString(),updatedBy:u}}}),setVisiting:t=>e(e=>({visiting:Object.fromEntries([...Object.entries(e.visiting).slice(-60),[t,!0]])}))}),{name:'covercharge-clock-area-v1',version:1,storage:(0,l.createJSONStorage)(()=>u.default)})),_=e=>t.IS_ISOLATED_VENUE&&e!==t.VENUE_RID?(0,E.cleanArea)(E.DEFAULT_CLOCK_AREA):(0,n.venueClockArea)(e,o.getState().areas[e]??{})},1264,[5,869,1160,995,1169,870]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteStatus=function(){return{'st-tracy':{state:'used',usedAt:s(3e3),devices:2},'st-gordon':{state:'used',usedAt:s(2940),devices:2},'st-bisto':{state:'used',usedAt:s(1800),devices:1},'st-agate':{state:'used',usedAt:s(1680),devices:1},'st-lenny':{state:'used',usedAt:s(1560),devices:1},'st-finn':{state:'unused',expiresAt:n(52),devices:0},'st-eilidh':{state:'used',usedAt:s(1200),devices:1},'st-emily':{state:'expired',devices:0},'st-lillie':{state:'used',usedAt:s(480),devices:1},'st-jack':{state:'unused',expiresAt:n(70),devices:0}}},e.linkPhones=async function(){return{...a}},e.resetPhone=async function(t){const s=a[t]?.phones??0;return delete a[t],s},e.reissueInvite=async function(t){const s='st-bisto'===t?'chef':['st-tracy','st-gordon','st-agate'].includes(t)?'owner':'staff';return{ok:!0,token:'DEMO-link-not-real-0000',expiresAt:n(72),app:s}},e.unlockCashUp=async function(s,n,a){const c=new Date(Date.now()+18e5).toISOString();'cashup'===s?t.useCashUp.setState(t=>({cashUps:t.cashUps.map(t=>t.id===n?{...t,unlockedUntil:c}:t)})):t.useCashUp.setState(t=>({sales:t.sales.map(t=>t.id===n?{...t,unlockedUntil:c}:t)}));return{ok:!0,until:c}},e.cashAudit=async function(t){return[{at:s(780),action:'unlocked',by:'Morgan',tbl:'cash_ups',reason:'Card total keyed as 1,284 not 1,248',changed:[]},{at:s(768),action:'changed',by:'Alex',tbl:'cash_ups',changed:['card']},{at:s(840),action:'created',by:'Alex',tbl:'cash_ups',changed:[]}]},e.pitchRpc=function(t,s){switch(t){case'list_displays':return c;case'create_display_code':case'new_code_for_display':return[{code:'DEMO7K2QX',expires_at:n(24*Number(s.p_hours?Number(s.p_hours)/24:7))}];default:return[]}};var t=r(d[0]);const s=t=>new Date(Date.now()-6e4*t).toISOString(),n=t=>new Date(Date.now()+36e5*t).toISOString();const a={'st-tracy':{phones:1,since:s(4445)},'st-bisto':{phones:1,since:s(2920)},'st-agate':{phones:1,since:s(1680)},'st-lenny':{phones:1,since:s(1560)},'st-eilidh':{phones:1,since:s(1200)}};const c=[{id:'pd-1',label:'Front desk tablet',can_write:!0,created_at:s(17280),last_seen_at:s(2),revoked_at:null,sessions:1,open_codes:0},{id:'pd-2',label:'Kitchen pass tablet',can_write:!1,created_at:s(12960),last_seen_at:s(5),revoked_at:null,sessions:1,open_codes:0}]},1265,[1050]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"libraryRowId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"personRowId",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"tickId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"personKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"useDailyTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"tasksOf",{enumerable:!0,get:function(){return O}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]);const l=e=>(0,o.uuidFrom)(`daily-task-library:${e}`),y=(e,t)=>(0,o.uuidFrom)(`daily-tasks:${e}:${t}`),b=(e,t,i,s)=>(0,o.uuidFrom)(`daily-task-tick:${e}:${(0,u.tickKey)(t,i,s)}`),f=()=>(new Date).toISOString(),k=(e,t)=>`${e}|${t}`,p=e=>u.DEFAULT_LIBRARY.map((t,i)=>({id:(0,o.uuidFrom)(`daily-task-lib:${e}:${i}`),text:t})),L=(0,s.create)()((0,n.persist)((e,t)=>({library:{},people:{},ticks:[],ensure:i=>{t().library[i]||e(e=>({library:{...e.library,[i]:{items:p(i)}}}))},setLibrary:(t,i)=>e(e=>({library:{...e.library,[t]:{items:i,updatedAt:f()}}})),addLibrary:(e,i)=>{const s=(0,u.cleanTaskText)(i);if(!s)return;const n=t().library[e]?.items??p(e);n.some(e=>e.text.toLowerCase()===s.toLowerCase()&&!e.archived)||t().setLibrary(e,[...n,{id:(0,c.uuid)(),text:s}])},setTasks:(t,i,s)=>e(e=>({people:{...e.people,[k(t,i)]:{tasks:s,updatedAt:f()}}})),addTask:(e,i,s,n)=>{const o=(0,u.cleanTaskText)(s);if(!o)return;const l=t().people[k(e,i)]?.tasks??[];l.some(e=>e.text.toLowerCase()===o.toLowerCase())||t().setTasks(e,i,[...l,{id:(0,c.uuid)(),text:o,...n?{libraryId:n}:{}}])},toggleTick:(t,i,s,n,o)=>e(e=>{const u=b(t,i,s,n);if(e.ticks.some(e=>e.id===u))return{ticks:e.ticks.filter(e=>e.id!==u)};const c=new Date(Date.now()-12096e5).toISOString().slice(0,10);return{ticks:[...e.ticks.filter(e=>e.forDate>=c),{id:u,rid:t,staffRef:i,taskId:s,forDate:n,byRef:o.id,byName:o.name,at:f()}]}}),resetLibrary:e=>t().setLibrary(e,p(e))}),{name:'covercharge-daily-tasks-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)})),O=(e,t)=>L.getState().people[k(e,t)]?.tasks??[]},1266,[1160,995,1169,1178,1267,1099]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TASK_MAX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanTaskText",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"appliesOn",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tasksFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"tickKey",{enumerable:!0,get:function(){return u}}),e.progress=function(t,n,o,u,c){const s=i(t,c),f=new Set(n.filter(t=>t.staffRef===o&&t.forDate===u).map(t=>t.taskId));return{done:s.filter(t=>f.has(t.id)).length,total:s.length}},e.move=function(t,n,o){const i=n+o;if(n<0||i<0||n>=t.length||i>=t.length)return t;const u=[...t];return[u[n],u[i]]=[u[i],u[n]],u},Object.defineProperty(e,"hasTask",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_LIBRARY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TASK_DAY_NAMES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isHeadChefP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isKitchenP",{enumerable:!0,get:function(){return d}}),e.canEditTasks=function(t,n){return!!t&&('owner'===t.role||'manager'===t.role||!!l(t)&&(t.id!==n.id&&'staff'===n.role&&!l(n)&&d(n)))};const t=80,n=n=>n.replace(/\s+/g,' ').trim().slice(0,t),o=(t,n)=>!t.days||0===t.days.length||t.days.includes(n),i=(t,n)=>t.filter(t=>o(t,n)),u=(t,n,o)=>`${t}|${n}|${o}`;const c=(t,o)=>t.some(t=>t.text.toLowerCase()===n(o).toLowerCase()),s=['Restock the bar fridges','Wipe down the menus','Check the toilets','Set the tables','Polish glasses','Empty the bins','Clean the coffee machine','Take out the recycling'],f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=t=>'staff'===t.role&&('Head Chef'===t.level||/^head chef/i.test(t.job??'')),d=t=>'kitchen'===(t.dept??'').trim().toLowerCase()},1267,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useChatSync",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"chatSynced",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({synced:!1,checked:!1})),n=()=>t.getState().synced},1268,[995]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useKitchenExtra",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isManagerish",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isKitchenStaff",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"kitchenByRule",{enumerable:!0,get:function(){return l}}),_e.inKitchen=b,_e.inChannel=function(e,t){return!!t&&(e.startsWith('dm:')?e.split(':').slice(1).includes(t.id):'all'===e||('kitchen'===e?b(t):'managers'===e?o(t):'foh'===e&&(o(t)||/front|bar|server|waiting/i.test(t.job))))},Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return h}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},c=r(d[1]),a=r(d[2]);const u=(0,c.create)()((0,a.persist)(e=>({extra:{},set:(t,n)=>e(e=>{const c={...e.extra};return null==n?delete c[t]:c[t]=n,{extra:c}})}),{name:'covercharge-kitchen-chat-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default)})),o=e=>!!e&&'staff'!==e.role,s=e=>!!e&&/head chef/i.test((e.level??'')+' '+e.job),f=e=>!!e&&(/^kitchen$/i.test(e.dept??'')||/chef|kitchen|\bkp\b|porter/i.test(e.job)),l=e=>!!e&&(o(e)||s(e)||f(e));function b(e){if(!e||!e.active)return!1;return u.getState().extra[e.id]??l(e)}const h=(e,t)=>`dm:${[e,t].sort().join(':')}`},1269,[1160,995,1169]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestSpecialsAfter=function(t,n){return n.ok?n.board?t&&t.postedAt>n.board.postedAt?{board:t,note:''}:{board:n.board,note:''}:{board:null,note:''}:{board:t,note:n.message}},Object.defineProperty(e,"GUEST_SPECIALS_OFFLINE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SUPPORT_NOT_SENT",{enumerable:!0,get:function(){return n}}),e.supportAfterWrite=function(t,o){return t.trim()?o.ok?{text:t,sent:!0,note:''}:{text:t,sent:!1,note:o.message||n}:{text:t,sent:!1,note:''}};const t='The specials board could not be loaded. What is already on this phone is unchanged.',n='Saved on this phone. It was not sent.'},1270,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1271,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get Badge(){return x.Badge},get DarkTheme(){return y.DarkTheme},get DefaultTheme(){return _.DefaultTheme},get ErrorBoundary(){return v.ErrorBoundary},get ExperimentalStack(){return U.ExperimentalStack},get ExpoRoot(){return c.ExpoRoot},get Icon(){return x.Icon},get IsWithinNativeNavigator(){return B.IsWithinNativeNavigator},get Label(){return x.Label},get LocaleProvider(){return I.LocaleProvider},get NativeStackView(){return E.NativeStackView},get NavigationAwareActivity(){return R.NavigationAwareActivity},get Navigator(){return t.Navigator},get RouterActionHandling(){return C.RouterActionHandling},get Sitemap(){return b.Sitemap},get Slot(){return t.Slot},get SplashScreen(){return S},get StackRouter(){return C.StackRouter},get SuspenseFallback(){return f.SuspenseFallback},get TabRouter(){return C.TabRouter},get Tabs(){return M.Tabs},get ThemeProvider(){return T.ThemeProvider},get Unmatched(){return l.Unmatched},get VectorIcon(){return x.VectorIcon},get attachRouteState(){return C.attachRouteState},get createBaseStackProps(){return j.createBaseStackProps},get createBaseTabProps(){return D.createBaseTabProps},get createNativeStackProps(){return W.createNativeStackProps},get createStandardRouterNavigator(){return B.createStandardRouterNavigator},get enableLegacyHeaderAppearance(){return F.enableLegacyHeaderAppearance},get extendRouter(){return C.extendRouter},get extendRouterActions(){return C.extendRouterActions},get integrateWithRouter(){return B.integrateWithRouter},get isActionHandled(){return C.isActionHandled},get router(){return u.router},get unstable_PerformanceObserver(){return G.unstable_PerformanceObserver},get unstable_createStandardRouterNavigator(){return B.unstable_createStandardRouterNavigator},get unstable_enablePerformanceIntegration(){return G.unstable_enablePerformanceIntegration},get unstable_integrateWithRouter(){return B.unstable_integrateWithRouter},get unstable_performance(){return G.unstable_performance},get unstable_useIsNavigating(){return o.useIsNavigating},get unstable_useReconcileTabHistory(){return H.useReconcileTabHistory},get useCanGoBack(){return n.useCanGoBack},get useCurrentRouteInfo(){return n.useCurrentRouteInfo},get useFocusEffect(){return h.useFocusEffect},get useGlobalSearchParams(){return n.useGlobalSearchParams},get useIsFocused(){return N.useIsFocused},get useLoaderData(){return n.useLoaderData},get useLocalSearchParams(){return n.useLocalSearchParams},get useNavigation(){return P.useNavigation},get useNavigationContainerRef(){return n.useNavigationContainerRef},get usePathname(){return n.usePathname},get usePreventRemove(){return L.usePreventRemove},get useRootNavigation(){return n.useRootNavigation},get useRootNavigationState(){return n.useRootNavigationState},get useRoute(){return A.useRoute},get useRoutePath(){return O.useRoutePath},get useRouter(){return n.useRouter},get useScrollToTop(){return w.useScrollToTop},get useSegments(){return n.useSegments},get useSitemap(){return p.useSitemap},get useTheme(){return k.useTheme},get useUnstableGlobalHref(){return n.useUnstableGlobalHref},get withLayoutContext(){return s.withLayoutContext}});const t=r(d[0]),n=r(d[1]),u=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),l=r(d[6]),b=r(d[7]),p=r(d[8]),v=r(d[9]),f=r(d[10]),R=r(d[11]),S=q(r(d[12])),P=r(d[13]),h=r(d[14]),N=r(d[15]),y=r(d[16]),_=r(d[17]),T=r(d[18]),k=r(d[19]),I=r(d[20]),O=r(d[21]),w=r(d[22]),A=r(d[23]),L=r(d[24]),x=r(d[25]),B=r(d[26]),H=r(d[27]),j=r(d[28]),D=r(d[29]),W=r(d[30]),C=r(d[31]),E=r(d[32]),F=r(d[33]),G=r(d[34]),M=r(d[35]),U=r(d[36]);function V(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(V=function(t){return t?u:n})(t)}function q(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=V(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=s?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(o,c,l):o[c]=t[c]}return o.default=t,u&&u.set(t,o),o}},1272,[695,420,513,1273,713,33,767,758,761,1274,665,663,668,534,538,543,482,484,448,449,1275,489,490,479,477,525,712,658,726,1276,725,359,704,709,379,1277,1280]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useIsNavigating",{enumerable:!0,get:function(){return u}});const t=r(d[1]);function u(){return(0,n().use)(t.NavigationPendingContext)}},1273,[31,376]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}function n(){const t=r(d[2]);return n=function(){return t},t}function l(){const t=r(d[3]);return l=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ErrorBoundary",{enumerable:!0,get:function(){return f}});r(d[4]);const s=r(d[5]),c=r(d[6]),u=r(d[7]);function h({error:o}){return(0,t().jsxs)(n().View,{style:{marginBottom:12,gap:4,flexWrap:'wrap'},children:[(0,t().jsx)(n().Text,{role:"heading","aria-level":1,style:y.title,children:"Something went wrong"}),(0,t().jsxs)(n().Text,{testID:"router_error_message",role:"heading","aria-level":2,style:y.errorMessage,children:["Error: ",o.message]})]})}function f({error:f,retry:x}){const w=(0,o().use)(s.BottomTabBarHeightContext)?n().View:l().SafeAreaView,S=f instanceof c.ReactServerError;return(0,t().jsx)(n().View,{style:y.container,children:(0,t().jsxs)(w,{style:{flex:1,gap:8,maxWidth:720,marginHorizontal:'auto'},children:[S?(0,t().jsx)(b,{error:f}):(0,t().jsx)(h,{error:f}),(0,t().jsx)(n().View,{style:{flex:1}}),!1,(0,t().jsx)(u.Pressable,{testID:"router_error_retry",onPress:x,children:({hovered:o,pressed:l})=>(0,t().jsx)(n().View,{style:[y.buttonInner,(o||l)&&{backgroundColor:'white'}],children:(0,t().jsx)(n().Text,{style:[y.buttonText,{color:o||l?'black':'white'}],children:"Retry"})})})]})})}const x={404:'NOT_FOUND',500:'INTERNAL_SERVER_ERROR',503:'SERVICE_UNAVAILABLE',504:'GATEWAY_TIMEOUT'};function b({error:o}){let l=String(o.statusCode);l+=': '+(x[o.statusCode]??'Server Error');const s=o.headers.get('cf-ray'),c=o.headers.get('Date');return(0,t().jsxs)(n().View,{style:{padding:12,gap:8},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:n().Platform.select({web:24,default:16}),fontWeight:'bold',marginBottom:4,color:'white'},children:l}),(0,t().jsx)(n().ScrollView,{style:{borderColor:'rgba(255,255,255,0.5)',borderTopWidth:n().StyleSheet.hairlineWidth,borderBottomWidth:n().StyleSheet.hairlineWidth,maxHeight:150},contentContainerStyle:{paddingVertical:4},children:(0,t().jsx)(n().Text,{testID:"router_error_message",selectable:!0,allowFontScaling:!0,style:{color:'white'},children:o.message})}),(0,t().jsx)(w,{title:"Code",right:o.statusCode}),s&&(0,t().jsx)(w,{title:"ID",right:s}),c&&(0,t().jsx)(w,{title:"Date",right:c}),o.url&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:14,opacity:.5,color:'white'},children:o.url})]})}function w({title:o,right:l}){const s={fontSize:16,color:'white'};return(0,t().jsxs)(n().View,{style:{flexDirection:'row',justifyContent:'space-between'},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:s,children:o}),l&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:[s,y.code],children:l})]})}const y=n().StyleSheet.create({container:{flex:1,backgroundColor:'black',padding:24,alignItems:'stretch',justifyContent:'center'},title:{color:'white',fontSize:n().Platform.select({web:32,default:24}),fontWeight:'bold'},buttonText:{fontSize:18,fontWeight:'bold',color:'black',...n().Platform.select({web:{transitionDuration:'100ms'}})},buttonInner:{...n().Platform.select({web:{transitionDuration:'100ms'}}),paddingVertical:12,paddingHorizontal:24,borderColor:'white',borderWidth:2,marginLeft:8,justifyContent:'center',alignItems:'center'},code:{fontFamily:n().Platform.select({default:'Courier',ios:'Courier New',android:'monospace'}),fontWeight:'500'},errorMessage:{color:'white',fontSize:16},subtitle:{color:'white',fontSize:14,marginBottom:12},link:{color:'rgba(255,255,255,0.4)',textDecorationStyle:'solid',textDecorationLine:'underline',fontSize:14,textAlign:'center'}})},1274,[25,31,34,290,509,546,667,760]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LocaleProvider",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o({direction:o,children:c}){return(0,n().jsx)(t.LocaleDirContext.Provider,{value:o,children:c})}},1275,[25,430]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({dispatch:t,isPreloaded:o,isRemovalPrevented:n,state:s}){return{isPreloaded:o,isRemovalPrevented:n,routeNames:s.routeNames,preload:o=>t({type:'PRELOAD',payload:{name:o}})}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createBaseTabProps",{enumerable:!0,get:function(){return t}})},1276,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get BottomTabBar(){return n.BottomTabBar},get BottomTabBarHeightCallbackContext(){return n.BottomTabBarHeightCallbackContext},get BottomTabBarHeightContext(){return n.BottomTabBarHeightContext},get BottomTabView(){return n.BottomTabView},get SceneStyleInterpolators(){return u},get Tabs(){return n.default},get TransitionPresets(){return c},get TransitionSpecs(){return f},get createJSTabsProps(){return n.createJSTabsProps},get createStandardBottomTabNavigator(){return n.createStandardBottomTabNavigator},get default(){return s},get useBottomTabBarHeight(){return n.useBottomTabBarHeight}});const t=r(d[0]),o=r(d[1]),n=b(r(d[2])),u=b(r(d[3])),c=b(r(d[4])),f=b(r(d[5]));function l(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,n=new WeakMap;return(l=function(t){return t?n:o})(t)}function b(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=l(o);if(n&&n.has(t))return n.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var b=c?Object.getOwnPropertyDescriptor(t,f):null;b&&(b.get||b.set)?Object.defineProperty(u,f,b):u[f]=t[f]}return u.default=t,n&&n.set(t,u),u}n.default.Screen=o.Screen,n.default.Protected=t.Protected;const s=n.default},1277,[719,720,1278,547,548,549]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get createJSTabsProps(){return h},get default(){return y}});const o=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),f=r(d[7]);var l,b;function h(t){const{dispatch:n,state:o}=t;return{...(0,f.createBaseTabProps)(t),popNestedStackToTop:t=>{const s=o.routes.find(n=>n.key===t)?.state;s?.key&&n({...c.StackActions.popToTop(),target:s.key})}}}l=r(d[8]),b=e,Object.keys(l).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(b,t)||Object.defineProperty(b,t,{enumerable:!0,get:function(){return l[t]}})});const y=(0,u.integrateWithRouter)(s.createStandardBottomTabNavigator,c.TabRouter,{activityDefaultThreshold:1,processDescriptors:p.appendMissingPlaceholderTabDescriptors,processState:p.appendMissingPlaceholderTabRoutes,createProps:h,processScreens:s=>s.map(s=>{if('function'!=typeof s.options&&void 0!==s.options?.href){const{href:c,...u}=s.options;if(u.tabBarButton)throw new Error('Cannot use `href` and `tabBarButton` together.');return null===c?{...s,options:{...u,hidden:!0}}:{...s,options:{...u,tabBarButton:s=>{const u='web'===n().Platform.OS?s.children:(0,t().jsx)(n().Pressable,{children:s.children});return(0,t().jsx)(o.Link,{...s,style:[{display:'flex'},s.style],href:c,asChild:'web'!==n().Platform.OS,children:u})}}}}return s})})},1278,[25,34,509,653,428,712,1279,1276,546]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){const s=n.routeNames.filter(t=>!n.routes.some(n=>n.name===t));if(0===s.length)return t;const u=s.reduce((t,n)=>(t[n]=o({key:void 0,name:n}),t),{});return{...t,...u}}function n(t,n){if(!t.routeNames.some(n=>!t.routes.some(t=>t.name===n)))return t;const s=t.routes[t.index]?.key,u=t.routeNames.map(s=>{const u=t.routes.find(t=>t.name===s);return u||o(s,n)}),c=Math.max(0,u.findIndex(t=>t.key===s));return{...t,index:c,routes:u}}function o(t,n){const o=n[t];if(!o)throw new Error(`Could not find a descriptor for route "${t}". This is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.`);return{...o.route,key:t,name:t}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get appendMissingPlaceholderTabDescriptors(){return t},get appendMissingPlaceholderTabRoutes(){return n}})},1279,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get ExperimentalStack(){return c},get default(){return o}});const n=u(r(d[1]));function u(t){return t&&t.__esModule?t:{default:t}}const c=Object.assign(u=>(0,t().jsx)(n.default,{...u}),{Screen:n.default.Screen,Protected:n.default.Protected}),o=c},1280,[25,1281]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,u){for(var n in u)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(u,n).get})})(e,{get Stack(){return t.default},get default(){return l}});const t=c(r(d[0])),u=r(d[1]),n=r(d[2]);function c(t){return t&&t.__esModule?t:{default:t}}t.default.Screen=u.StackScreen,t.default.Header=u.StackHeader,t.default.Title=u.StackTitle,t.default.Toolbar=n.StackToolbar;const l=t.default},1281,[696,729,734]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.default}});const t=o((n=r(d[0]),u=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(u,t)||Object.defineProperty(u,t,{enumerable:!0,get:function(){return n[t]}})}),n));var n,u;function o(t){return t&&t.__esModule?t:{default:t}}},1282,[1281]); +__d(function(g,r,i,a,m,e,d){"use strict";var t,n;Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get useIsPreview(){return s.useIsPreview},get usePreventZoomTransitionDismissal(){return o.usePreventZoomTransitionDismissal}}),t=r(d[0]),n=e,Object.keys(t).forEach(function(o){"default"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return t[o]}})});const o=r(d[1]),s=r(d[2])},1283,[509,1284,422]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreventZoomTransitionDismissal",{enumerable:!0,get:function(){return n}})},1284,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Color",{enumerable:!0,get:function(){return y}});r(d[0]);function t(t,n){return Object.keys(t).forEach(function(u){"default"===u||Object.prototype.hasOwnProperty.call(n,u)||Object.defineProperty(n,u,{enumerable:!0,get:function(){return t[u]}})}),t}t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e),t(r(d[5]),e);const n=new Proxy({},{get:(t,n)=>null}),u=new Proxy({},{get:(t,n)=>null}),o=new Proxy({},{get:(t,n)=>null}),l=new Proxy({},{get:(t,n)=>null}),c=new Proxy({get attr(){return u},get material(){return o},get dynamic(){return l}},{get:(t,n)=>n in t?t[n]:null}),y={get ios(){return n},get android(){return c}}},1285,[1286,1287,1288,1289,1290,1291]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return null}function n(t){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Material3Color(){return n},get Material3DynamicColor(){return t}})},1286,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1287,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1288,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1289,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1290,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1291,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inlineStyles",{enumerable:!0,get:function(){return n.inlineStyles}}),Object.defineProperty(_e,"loadLocalRawResource",{enumerable:!0,get:function(){return n.loadLocalRawResource}}),Object.defineProperty(_e,"LocalSvg",{enumerable:!0,get:function(){return n.LocalSvg}}),Object.defineProperty(_e,"SvgCss",{enumerable:!0,get:function(){return n.SvgCss}}),Object.defineProperty(_e,"SvgCssUri",{enumerable:!0,get:function(){return n.SvgCssUri}}),Object.defineProperty(_e,"SvgWithCss",{enumerable:!0,get:function(){return n.SvgWithCss}}),Object.defineProperty(_e,"SvgWithCssUri",{enumerable:!0,get:function(){return n.SvgWithCssUri}}),Object.defineProperty(_e,"WithLocalSvg",{enumerable:!0,get:function(){return n.WithLocalSvg}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return e.camelCase}}),Object.defineProperty(_e,"fetchText",{enumerable:!0,get:function(){return t.fetchText}}),Object.defineProperty(_e,"parse",{enumerable:!0,get:function(){return e.parse}}),Object.defineProperty(_e,"SvgAst",{enumerable:!0,get:function(){return e.SvgAst}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return e.SvgFromUri}}),Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return e.SvgFromXml}}),Object.defineProperty(_e,"SvgUri",{enumerable:!0,get:function(){return e.SvgUri}}),Object.defineProperty(_e,"SvgXml",{enumerable:!0,get:function(){return e.SvgXml}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),u=r(d[3]);Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});var o=r(d[4]);Object.keys(o).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return o[e]}})});var c,f=(c=o)&&c.__esModule?c:{default:c}},1292,[1293,1294,1313,1314,1296]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SvgAst=c,_e.SvgXml=l,_e.SvgUri=function(r){const{onError:o=i,uri:s,onLoad:c,fallback:u}=r,[f,p]=(0,t.useState)(null),[d,h]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s?(0,n.fetchText)(s).then(t=>{p(t),d&&h(!1),c?.()}).catch(t=>{o(t),h(!0)}):p(null)},[o,s,c]),d)return u??null;return e.createElement(l,{xml:f,override:r,fallback:u})},Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return d}}),_e.getStyle=h,_e.astToReact=x,_e.parse=j,Object.defineProperty(_e,"tags",{enumerable:!0,get:function(){return r.tags}});var t=_r(_d[0]),e=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e})(t),n=_r(_d[1]),r=_r(_d[2]);function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;enull!==o?j(o):null,[o]);return e.createElement(c,{ast:r,override:s||n})}catch(t){return r(t),l??null}}class u extends t.Component{state={ast:null};componentDidMount(){this.parse(this.props.xml)}componentDidUpdate(t){const{xml:e}=this.props;e!==t.xml&&this.parse(e)}parse(t){const{onError:e=i}=this.props;try{this.setState({ast:t?j(t):null})}catch(t){const n=t;e({...n,message:`[RNSVG] Couldn't parse SVG, reason: ${n.message}`})}}render(){const{props:t,state:{ast:n}}=this;return e.createElement(c,{ast:n,override:t.override||t})}}class f extends t.Component{state={xml:null};componentDidMount(){this.fetch(this.props.uri)}componentDidUpdate(t){const{uri:e}=this.props;e!==t.uri&&this.fetch(e)}async fetch(t){try{this.setState({xml:t?await(0,n.fetchText)(t):null})}catch(t){console.error(t)}}render(){const{props:t,state:{xml:n}}=this;return e.createElement(u,{xml:n,override:t,onError:t.onError})}}const p=(t,e)=>e.toUpperCase(),d=t=>t.replace(/[:-]([a-z])/g,p);function h(t){const e={},n=t.split(';').filter(t=>t.trim()),{length:r}=n;for(let t=0;tb(' ',t.length);function v(t,e){const n=t.split('\n'),r=n.length;let o=e,s=0;for(;s=t))break;o-=t}const c=t.slice(0,e).replace(/^\t+/,y),i=/(^|\n).*$/.exec(c),l=i&&i[0]||'',u=t.slice(e),f=/.*(\n|$)/.exec(u);return{line:s,column:o,snippet:`${l}${f&&f[0]}\n${b(' ',l.length)}^`}}const E=/[a-zA-Z0-9:_-]/,O=/
The Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

- + diff --git a/abbotsford/customer-app/index.html b/abbotsford/customer-app/index.html index cae5f01db405f4a7ef528af8dadf72dc434c37cc..3e5c63f24260cbe3d06a86da211278a66aad802d 100644 --- a/abbotsford/customer-app/index.html +++ b/abbotsford/customer-app/index.html @@ -30,6 +30,6 @@
The Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

- + diff --git a/abbotsford/customer-app/sw.js b/abbotsford/customer-app/sw.js index b89f1277ed035fbbbc7fbebdd21750a94dd5f7d5..5ff6666e4fb480bf0c07531bfa21d77dbac29082 100644 --- a/abbotsford/customer-app/sw.js +++ b/abbotsford/customer-app/sw.js @@ -1,4 +1,4 @@ -const V="cc-abbotsford-customer-9e6c1d717f090479",B="/abbotsford/customer-app/",P=["/abbotsford/customer-app/apple-touch-icon.png", "/abbotsford/customer-app/favicon.ico", "/abbotsford/customer-app/icon-192.png", "/abbotsford/customer-app/icon-512.png", "/abbotsford/customer-app/brand-logo.png", "/abbotsford/customer-app/index.html", "/abbotsford/customer-app/manifest.webmanifest", "/abbotsford/customer-app/brand-hero.png", "/abbotsford/customer-app/customer/abbotsford.html", "/abbotsford/customer-app/_expo/static/js/web/basket-7c4fed68ce9e0c09c65383c7cef79793.js", "/abbotsford/customer-app/_expo/static/js/web/index-e7d08ddd8307cc90502f5624c0ccc0bd.js", "/abbotsford/customer-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/abbotsford/customer-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/abbotsford/customer-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/abbotsford/customer-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/abbotsford/customer-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/abbotsford/customer-app/_expo/static/js/web/loyalty-679d7aa42c3cddfce82c3e1207d2d4cf.js", "/abbotsford/customer-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/abbotsford/customer-app/_expo/static/js/web/refer-01535dadf727412eb1a34a61dcc6d53d.js", "/abbotsford/customer-app/_expo/static/js/web/index-8235f7cd7c06ae9659cbc6917e39d992.js", "/abbotsford/customer-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/abbotsford/customer-app/_expo/static/js/web/book-7c4c90140093809a35e48a974143bb55.js", "/abbotsford/customer-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/abbotsford/customer-app/_expo/static/js/web/__common-b121afb35d569e7bff97f2c8db4fd6a8.js", "/abbotsford/customer-app/_expo/static/js/web/profile-b82887516ccba728915e95d502c0081a.js", "/abbotsford/customer-app/_expo/static/js/web/offers-eba5409c285b6031064e79e9f1ea19e0.js", "/abbotsford/customer-app/_expo/static/js/web/merch-63634eac687774d71f27698748247bd2.js", "/abbotsford/customer-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/abbotsford/customer-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js", "/abbotsford/customer-app/_expo/static/js/web/waitlist-7da65cbcea167a5ec8823003e69ae268.js", "/abbotsford/customer-app/_expo/static/js/web/_layout-cc684c774f1acfa41cee2ba0ed1e1b9a.js", "/abbotsford/customer-app/_expo/static/js/web/whatson-dd3d796ea1e77876d5803d9ecd8c1109.js", "/abbotsford/customer-app/_expo/static/js/web/index-c1c9ac942fc6d77c5bdc658c26dfe16e.js", "/abbotsford/customer-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/abbotsford/customer-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/abbotsford/customer-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/abbotsford/customer-app/_expo/static/js/web/lost-817d2886f8973bfa630e2a69674dc584.js", "/abbotsford/customer-app/_expo/static/js/web/index-c21267a9b534b341ed4458adcc7f4444.js", "/abbotsford/customer-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/abbotsford/customer-app/_expo/static/js/web/index-b8ac5c2e859493124da6709c3b2afc9f.js", "/abbotsford/customer-app/_expo/static/js/web/index-997bc0470ef63b01fb21fb195351458b.js", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/abbotsford/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/abbotsford/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/abbotsford/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/abbotsford/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/abbotsford/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/abbotsford/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/abbotsford/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/abbotsford/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/abbotsford/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/abbotsford/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/abbotsford/customer-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/abbotsford/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/abbotsford/customer-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/abbotsford/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/abbotsford/customer-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/abbotsford/customer-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/customer-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/abbotsford/customer-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/abbotsford/customer-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/abbotsford/customer-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/customer-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/abbotsford/customer-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/abbotsford/customer-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/abbotsford/customer-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/abbotsford/customer-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/abbotsford/customer-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/abbotsford/customer-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/abbotsford/customer-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/abbotsford/customer-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/abbotsford/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/abbotsford/customer-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/abbotsford/customer-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/abbotsford/customer-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/abbotsford/customer-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/abbotsford/customer-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/abbotsford/customer-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/abbotsford/customer-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/abbotsford/customer-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/abbotsford/customer-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/abbotsford/customer-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/abbotsford/customer-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/abbotsford/customer-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/abbotsford/customer-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png"]; +const V="cc-abbotsford-customer-0c816f9269d2af4e",B="/abbotsford/customer-app/",P=["/abbotsford/customer-app/index.html", "/abbotsford/customer-app/icon-192.png", "/abbotsford/customer-app/brand-logo.png", "/abbotsford/customer-app/favicon.ico", "/abbotsford/customer-app/brand-hero.png", "/abbotsford/customer-app/icon-512.png", "/abbotsford/customer-app/apple-touch-icon.png", "/abbotsford/customer-app/manifest.webmanifest", "/abbotsford/customer-app/customer/abbotsford.html", "/abbotsford/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/abbotsford/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/abbotsford/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/abbotsford/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/abbotsford/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/abbotsford/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/abbotsford/customer-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/abbotsford/customer-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/abbotsford/customer-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/abbotsford/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/abbotsford/customer-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/abbotsford/customer-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/abbotsford/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/abbotsford/customer-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/abbotsford/customer-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/abbotsford/customer-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/abbotsford/customer-app/assets/assets/brand/smokinggoat.fff2a9a694b41fed68c80a2c9bfe65da.png", "/abbotsford/customer-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/abbotsford/customer-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/abbotsford/customer-app/assets/assets/brand/drunkencoo.272f746bf13376f503acd81a524a7998.png", "/abbotsford/customer-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/abbotsford/customer-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/abbotsford/customer-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/abbotsford/customer-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/abbotsford/customer-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/abbotsford/customer-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/abbotsford/customer-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/customer-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/abbotsford/customer-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/customer-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/abbotsford/customer-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/abbotsford/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/abbotsford/customer-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/abbotsford/customer-app/assets/assets/brand/3idiots-hero.77d66ccb53ec1835c3b8a838e9bcfb5a.png", "/abbotsford/customer-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/abbotsford/customer-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/abbotsford/customer-app/assets/assets/brand/drunkencoo-hero.7c01fed6cb075a3a8e4f969bff1cf103.png", "/abbotsford/customer-app/assets/assets/brand/smokinggoat-hero.b2ae48c4a1fcf2521ae9ff58435a6649.png", "/abbotsford/customer-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/abbotsford/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/abbotsford/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/abbotsford/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/abbotsford/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/abbotsford/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/abbotsford/customer-app/_expo/static/js/web/index-ba5aea4e23e402619315d92ef1e4fc6c.js", "/abbotsford/customer-app/_expo/static/js/web/gift-791c64f5dbcb5e9b9629af9241dde456.js", "/abbotsford/customer-app/_expo/static/js/web/index-708cc108b14a03d1e55d135c08408edf.js", "/abbotsford/customer-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js", "/abbotsford/customer-app/_expo/static/js/web/__common-62dc618bc7e7f7ce3382df95eac3e0c0.js", "/abbotsford/customer-app/_expo/static/js/web/_layout-dca323c29b087b4dc8695422b2ba2b49.js", "/abbotsford/customer-app/_expo/static/js/web/basket-b6d5d5daeda35a03cd8137d4a926f820.js", "/abbotsford/customer-app/_expo/static/js/web/merch-1080abcf96d828ded78defd0c4e60db8.js", "/abbotsford/customer-app/_expo/static/js/web/waitlist-57b6a339b55faddefcbf15cc558b7de7.js", "/abbotsford/customer-app/_expo/static/js/web/lost-ce780ee1f6f200e996e7d3ed8cbad51e.js", "/abbotsford/customer-app/_expo/static/js/web/index-d72f0e09722c49318a402489e965ec4a.js", "/abbotsford/customer-app/_expo/static/js/web/feedback-e234bfa389c6fd89a2e9f35bd3515c4d.js", "/abbotsford/customer-app/_expo/static/js/web/refer-04f1fe483aeb39c42e1a284a988d0659.js", "/abbotsford/customer-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/abbotsford/customer-app/_expo/static/js/web/index-eae28ef7f0787cddcf90124d27547cf2.js", "/abbotsford/customer-app/_expo/static/js/web/loyalty-1a6a63899543a8249ca64860b4832a26.js", "/abbotsford/customer-app/_expo/static/js/web/index-2c33bb80c88c28d14a905ee5ebc63cab.js", "/abbotsford/customer-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js", "/abbotsford/customer-app/_expo/static/js/web/index-222dc045fd0aac3818857fc3da15e957.js", "/abbotsford/customer-app/_expo/static/js/web/index-3a48a611c5f1b65513f53dda0c60732a.js", "/abbotsford/customer-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js", "/abbotsford/customer-app/_expo/static/js/web/offers-4bae334794c27ee5d138768273078ed2.js", "/abbotsford/customer-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js", "/abbotsford/customer-app/_expo/static/js/web/index-18a42003614e46ed29f029ff3e81efd8.js", "/abbotsford/customer-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js", "/abbotsford/customer-app/_expo/static/js/web/index-53eecf698b5faf46c397a71cbb30d9b1.js", "/abbotsford/customer-app/_expo/static/js/web/book-34e99aaf0197899dc09c20d6bb54139f.js", "/abbotsford/customer-app/_expo/static/js/web/profile-51acbb4fee90028b48e71efb79e6d43a.js", "/abbotsford/customer-app/_expo/static/js/web/demo-bb0072f641fdd92aa99cba5bc91fc36d.js", "/abbotsford/customer-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js", "/abbotsford/customer-app/_expo/static/js/web/whatson-6498b8821e66bd4aa1639b57afb933a3.js", "/abbotsford/customer-app/_expo/static/js/web/index-781f41d21eb1976616497d82e8d74259.js"]; self.addEventListener('install',e=>e.waitUntil(caches.open(V).then(c=>Promise.all(P.map(u=>fetch(u).then(r=>{if(!r.ok)throw Error('cache');return c.put(u,r)})))).then(()=>self.skipWaiting()))); self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-abbotsford-customer-')&&k!==V).map(k=>caches.delete(k)))).then(()=>self.clients.claim()))); self.addEventListener('fetch',e=>{const u=new URL(e.request.url);if(e.request.method!=='GET'||u.origin!==location.origin||!u.pathname.startsWith(B))return;if(e.request.mode==='navigate'){e.respondWith(fetch(e.request).then(r=>r.ok?r:caches.match(B+'index.html')).catch(()=>caches.match(B+'index.html')));return;}e.respondWith(caches.match(e.request).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/abbotsford/d.html b/abbotsford/d.html index 9dffa8b7b7d77de0862298c04db18e1acf45dafd..e7dab3b29a134bdaecd21f3e619c0ae1ca4b44b8 100644 --- a/abbotsford/d.html +++ b/abbotsford/d.html @@ -1 +1 @@ -The Abbotsford Hotel · DisplayOpen Display pairingv0.3.12.84 \ No newline at end of file +The Abbotsford Hotel · DisplayOpen Display pairingv0.3.12.184 \ No newline at end of file diff --git a/abbotsford/display-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js b/abbotsford/display-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js new file mode 100644 index 0000000000000000000000000000000000000000..8039fc81f8fac85dbe1964b30e03ea44f335ea65 --- /dev/null +++ b/abbotsford/display-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},802,[805,31,807,25]); \ No newline at end of file diff --git a/abbotsford/display-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js b/abbotsford/display-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js new file mode 100644 index 0000000000000000000000000000000000000000..283d584fafbdddc8e5e6b0b5633e099144c8d6ba --- /dev/null +++ b/abbotsford/display-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js @@ -0,0 +1 @@ +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return b}});var n=_r(_d[0]),t=_r(_d[1]),s=_r(_d[2]),a=e(_r(_d[3])),l=e(_r(_d[4])),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]);function b(){const{rid:e,did:b}=(0,t.useLocalSearchParams)(),j=(0,h.useRestaurant)(e),x=(0,h.useMenu)(e).find(e=>e.id===b),y=(0,h.useCustomer)(),m=(0,h.useRecipeCards)(e).find(e=>e.id===x?.recipeCardId),k=m?.signOff&&m.photo?(0,g.recipeCards)().photoSource(m.photo):null,v=(0,h.useStore)(e=>e.addLine),w=(0,n.useTakeawayMenu)(n=>n.byVenue[e]),S=(0,h.useStore)(n=>n.basket.restaurantId===e&&'table'===n.basket.mode),[C,B]=(0,s.useState)(()=>(x?.optionGroups??[]).filter(e=>e.required).map(e=>e.choices[0].id)),[$,I]=(0,s.useState)(1),[P,T]=(0,s.useState)(''),[L,O]=(0,s.useState)(!1),[D,A]=(0,s.useState)(!1),[M,R]=(0,s.useState)(!1),[q,_]=(0,s.useState)(!1),N=(0,s.useMemo)(()=>x?(0,c.effectiveAllergens)(x,C):{},[x,C]);if(!j||!x)return(0,f.jsx)(d.Screen,{title:"Not found",children:(0,f.jsx)(d.T,{children:"Dish not found."})});const G=(0,c.conflictsFor)(N,y.allergies),Y=(x.price??0)+(x.optionGroups??[]).flatMap(e=>e.choices).filter(e=>C.includes(e.id)).reduce((e,n)=>e+n.priceDelta,0),z=S||j.fictional?'on':(0,n.takeawayAvail)(x,w),F=x.soldOut||!x.signOff||null===x.price||'on'!==z,Q=(e,n)=>{const t=x.optionGroups.find(n=>n.id===e);B(e=>{const s=t.choices.map(e=>e.id);return t.multi?e.includes(n)?e.filter(e=>e!==n):[...e,n]:e.includes(n)&&!t.required?e.filter(e=>e!==n):[...e.filter(e=>!s.includes(e)),n]})},V=e=>{h.useStore.getState().basket.restaurantId!==j.id&&h.useStore.getState().startBasket(j.id,'takeaway'),v({itemId:x.id,qty:$,choiceIds:C,notes:P,override:e?{allergens:G.contains,at:(new Date).toISOString()}:void 0}),O(!1),_(!0)};return(0,f.jsxs)(d.Screen,{title:x.name,subtitle:j.name,right:(0,f.jsx)(o.BasketButton,{}),children:[k?(0,f.jsx)(a.default,{testID:"dish-photo",source:k,accessibilityLabel:`${x.name}${'example'===m?.origin?' (example photo)':''}`,style:{width:'100%',height:200,borderRadius:12},resizeMode:"cover"}):null,(0,f.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(d.T,{weight:"bold",size:20,colour:p.colours.gold,children:null===x.price?x.priceNote:(0,u.gbp)(Y)}),x.dietary.map(e=>(0,f.jsx)(d.Badge,{kind:"ok",label:e},e))]}),(0,f.jsx)(d.T,{children:x.description}),G.contains.length?(0,f.jsx)(d.Banner,{kind:"danger",title:`Blocked: contains ${G.contains.map(c.allergenLabel).join(', ')}`,children:`You\u2019ve told us: ${y.allergies.filter(e=>G.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`).join('; ')}. This dish can\u2019t be added unless you deliberately override (for example, ordering for someone else).`}):null,G.may.length?(0,f.jsx)(d.Banner,{kind:"warn",title:`Warning: may contain ${G.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact is possible (e.g. shared fryer). Please speak to staff before ordering."}):null,(x.optionGroups??[]).map(e=>(0,f.jsxs)(d.Card,{children:[(0,f.jsxs)(d.T,{weight:"semibold",children:[e.name,e.required?' (required)':' (optional)']}),(0,f.jsx)(d.Row,{wrap:!0,gap:6,children:e.choices.map(n=>(0,f.jsx)(d.Chip,{label:n.label,sub:n.priceDelta?`+${(0,u.gbp)(n.priceDelta)}`:void 0,selected:C.includes(n.id),onPress:()=>Q(e.id,n.id)},n.id))})]},e.id)),(0,f.jsx)(d.Card,{children:(0,f.jsx)(r.AllergenPanel,{item:x,map:N,declared:y.allergies})}),j.fictional?null:(0,f.jsx)(d.AllergenNotice,{phone:j.phone}),(0,f.jsx)(d.Field,{label:"Notes for the kitchen (optional)",placeholder:"e.g. no gherkins",value:P,onChangeText:T}),(0,f.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(d.T,{weight:"semibold",children:"Quantity"}),(0,f.jsx)(d.Stepper,{value:$,onChange:I,label:"quantity"})]}),q?(0,f.jsx)(d.Banner,{kind:"success",title:"Added to basket",children:G.contains.length?'Allergy override recorded \u2014 the kitchen will see a large allergy alert.':'Carry on browsing or go to your basket.'}):null,F?(0,f.jsx)(d.Banner,{kind:"warn",children:x.soldOut||'sold-out'===z?'Sold out today.':'off'===z&&x.signOff&&null!==x.price?'This dish isn\u2019t on the takeaway menu. You can have it when you eat in.':x.signOff?'Price on the specials board \u2014 ask staff.':'Not available to order online until the head chef signs off its allergens.'}):G.contains.length?(0,f.jsxs)(l.default,{style:{gap:8},children:[(0,f.jsx)(d.Button,{kind:"secondary",label:"Choose something else",onPress:()=>t.router.back()}),(0,f.jsx)(d.Button,{kind:"danger",label:"Override and add anyway\u2026",onPress:()=>{A(!1),R(!1),O(!0)},testID:"override-open"})]}):(0,f.jsxs)(d.Row,{gap:8,children:[(0,f.jsx)(d.Button,{style:{flex:1},label:`Add ${$} to basket \xb7 ${(0,u.gbp)(Y*$)}`,onPress:()=>V(!1),testID:"add-to-basket"}),q?(0,f.jsx)(d.Button,{kind:"secondary",label:"Basket",onPress:()=>t.router.push('/customer/basket')}):null]}),(0,f.jsxs)(d.Sheet,{visible:L,onClose:()=>O(!1),title:"Allergy override",children:[(0,f.jsx)(d.Banner,{kind:"danger",title:`${x.name} contains ${G.contains.map(c.allergenLabel).join(', ')}`,children:`Your profile says: ${y.allergies.filter(e=>G.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`).join('; ')}.`}),(0,f.jsx)(d.Toggle,{label:"I understand this dish contains an allergen I have declared",value:D,onChange:A}),(0,f.jsx)(d.Toggle,{label:"It is for someone without this allergy, or I have spoken to staff",value:M,onChange:R}),(0,f.jsx)(d.Muted,{children:"The override is logged and shown to the kitchen as an allergy alert that must be acknowledged."}),(0,f.jsx)(d.Button,{kind:"danger",disabled:!D||!M,label:"Confirm override and add",onPress:()=>V(!0),testID:"override-confirm"})]})]})}},779,[836,805,31,197,128,837,838,818,819,820,823,839,825,25]); \ No newline at end of file diff --git a/abbotsford/display-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js b/abbotsford/display-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js new file mode 100644 index 0000000000000000000000000000000000000000..1bcd14167edfb4176466ea1f3be5800f7b8a603b --- /dev/null +++ b/abbotsford/display-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),u=_r(d[4]),c=_r(d[5]),s=_r(d[6]),l=_r(d[7]);function f(){const{n:f,r:b}=(0,r.useLocalSearchParams)(),E=(0,u.useStore)(t=>t.startBasket),[_,h]=(0,n.useState)(!1),S=b??c.VENUE_RID,j=(0,u.useOrderAtTable)(S),I=(0,s.guestServer)();return(0,n.useEffect)(()=>{t.LIVE_VENUE_BUILD||I||(j&&E(S,'table',String(f)),h(!0))},[S,f,j,I]),t.LIVE_VENUE_BUILD||I?(0,l.jsx)(o.Screen,{title:"Order at the table",children:(0,l.jsx)(o.Banner,{kind:"demo",title:"Scan the code on your table",children:"To order from your table, scan the QR code printed on it. Or order at the bar."})}):_?(0,l.jsx)(r.Redirect,{href:`/customer/${S}`}):null}},795,[842,805,31,818,823,5,845,25]); \ No newline at end of file diff --git a/abbotsford/display-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js b/abbotsford/display-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js new file mode 100644 index 0000000000000000000000000000000000000000..ff5510d14e2cb246f1f5b3730dd146368851dce4 --- /dev/null +++ b/abbotsford/display-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js @@ -0,0 +1,3 @@ +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=_r(d[0]),l=_r(d[1]),s=_r(d[2]),r=_r(d[3]),n=(e=r)&&e.__esModule?e:{default:e},o=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),y=_r(d[10]),b=_r(d[11]),j=_r(d[12]);const x=[['new','Placed'],['acknowledged','Accepted'],['preparing','Cooking'],['ready','Ready to collect'],['collected','Collected']],w=[['new','Sent'],['acknowledged','Accepted'],['preparing','Cooking'],['served','Food out'],['closed','Paid']];function f(){const{oid:e}=(0,l.useLocalSearchParams)(),r=(0,p.useOrder)(e),f=(0,p.useRestaurant)(r?.restaurantId),[k,T]=(0,s.useState)(0),[S,C]=(0,s.useState)(''),[v,M]=(0,s.useState)(!1),[P,A]=(0,s.useState)(0),[R,$]=(0,s.useState)(r?.split?.ways??1);if(!r||!f)return(0,j.jsx)(i.Screen,{title:"Order",children:(0,j.jsx)(i.T,{children:"Order not found."})});const O='takeaway'===r.type?x:w,I=Math.max(0,O.findIndex(([e])=>e===r.status)),N=Math.round(r.subtotal*P/100),B='table'===r.type?r.subtotal+(r.split?r.tip:N):r.total,_=B-r.paid,H=r.split?.ways??R,D=r.split?.paidShares??0,F=Math.ceil(B/H),q='collected'===r.status||'closed'===r.status;return(0,j.jsxs)(i.Screen,{title:`Order ${r.ref}`,subtitle:`${f.name} \xb7 ${'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Collection at ${r.slotTime?(0,h.hm)(new Date(r.slotTime)):'\u2014'}`}`,children:['takeaway'===r.type?(0,j.jsx)(b.TakeawayPayCard,{o:r,phone:f.phone}):null,'takeaway'===r.type&&'awaiting_payment'!==r.status&&'cancelled'!==r.status?(0,j.jsx)(i.Banner,{kind:"success",title:'ready'===r.status?'Your order is ready!':'Order placed',children:'ready'===r.status?'Head to the bar and give your order number. Staff will check allergies with you at handover.':`Show order number ${r.ref} at the bar when you arrive.`}):null,'awaiting_payment'===r.status||'cancelled'===r.status?null:(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.H2,{children:"Status"}),O.map(([e,t],l)=>(0,j.jsxs)(i.Row,{gap:10,children:[(0,j.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:l<=I?y.colours.gold:y.colours.surface2,borderWidth:1,borderColor:y.colours.gold}}),(0,j.jsx)(i.T,{weight:l===I?'semibold':'regular',colour:l<=I?y.colours.text:y.colours.muted,children:t})]},e)),r.allergyAck?(0,j.jsxs)(i.Muted,{children:["Kitchen signed off your allergies (",r.allergyAck.by,", ",(0,h.hm)(new Date(r.allergyAck.at)),")"]}):r.allergies.length?(0,j.jsx)(i.Muted,{children:"Waiting for the kitchen to sign off your allergies\u2026"}):null,'takeaway'!==r.type||q?null:(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.Button,{small:!0,kind:'on-my-way'===r.customerSignal?'primary':'secondary',label:"On my way",onPress:()=>p.repo.orders.customerSignal(r.id,'on-my-way')}),(0,j.jsx)(i.Button,{small:!0,kind:'here'===r.customerSignal?'primary':'secondary',label:"I\u2019m here",onPress:()=>p.repo.orders.customerSignal(r.id,'here')})]})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.H2,{children:"Items"}),r.lines.map((e,t)=>(0,j.jsxs)(n.default,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{style:{flex:1},children:[e.qty,"\xd7 ",e.name]}),(0,j.jsx)(i.T,{children:(0,u.gbp)(e.unitPrice*e.qty)})]}),e.choices.length?(0,j.jsx)(i.Muted,{children:e.choices.join(' \xb7 ')}):null,e.overridden?(0,j.jsx)(i.Badge,{kind:"red",label:`Allergy override: ${e.contains.map(c.allergenLabel).join(', ')}`}):null]},t)),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Subtotal"}),(0,j.jsx)(i.T,{children:(0,u.gbp)(r.subtotal)})]}),r.giftCardApplied?(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Of which gift card"}),(0,j.jsxs)(i.T,{colour:y.colours.ok,children:["\u2212",(0,u.gbp)(r.giftCardApplied)]})]}):null,r.tip?(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Tip"}),(0,j.jsx)(i.T,{children:(0,u.gbp)(r.tip)})]}):null,(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Paid (test, no real money)"}),(0,j.jsx)(i.T,{weight:"semibold",colour:y.colours.gold,children:(0,u.gbp)(r.paid)})]})]}),'table'===r.type&&'closed'!==r.status&&'cancelled'!==r.status?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsxs)(i.H2,{children:["Your bill \u2014 ",(0,t.tableNumbers)(r.tableNo)]}),r.split?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(i.T,{children:["Total ",(0,u.gbp)(B)," \xb7 split ",H," way",H>1?'s':''," \xb7 ",(0,u.gbp)(F)," each"]}),(0,j.jsxs)(i.T,{children:["Shares paid: ",D," of ",H," \xb7 remaining ",(0,u.gbp)(_)]}),(0,j.jsx)(i.Muted,{children:"Pay with a member of staff at your table. Online card payment for the table bill isn\u2019t set up."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Add a tip?"}),(0,j.jsx)(i.Row,{wrap:!0,children:[0,10,12.5,15].map(e=>(0,j.jsx)(i.Chip,{label:e?`${e}%`:'No tip',selected:P===e,onPress:()=>A(e)},e))}),(0,j.jsx)(i.Muted,{children:"Tips go to staff under the restaurant\u2019s tipping policy (Employment (Allocation of Tips) Act 2023)."}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Split evenly between"}),(0,j.jsx)(i.Stepper,{value:R,onChange:$,min:1,max:8,label:"people"})]}),(0,j.jsxs)(i.T,{children:["Total ",(0,u.gbp)(r.subtotal+N),R>1?` \xb7 ${(0,u.gbp)(Math.ceil((r.subtotal+N)/R))} each`:'']}),(0,j.jsx)(i.Button,{label:"Get the bill",onPress:()=>p.repo.orders.setSplit(r.id,R,N),testID:"get-bill"})]})]}):null,!q||r.rated||v?null:(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.H2,{children:"How was everything?"}),(0,j.jsxs)(i.Muted,{children:["One tap \u2014 this goes privately to ",f.name," only, never published."]}),(0,j.jsx)(o.Stars,{value:k,onChange:T}),k?(0,j.jsx)(i.Field,{label:"Anything to add? (optional)",value:S,onChangeText:C}):null,(0,j.jsx)(i.Button,{label:"Send feedback",disabled:!k,onPress:()=>{p.repo.feedback.add({restaurantId:f.id,orderId:r.id,customerId:r.customerId,customerName:r.customerName,stars:k,comment:S,context:'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Takeaway ${r.ref}`}),M(!0)},testID:"send-rating"})]}),v||r.rated?(0,j.jsx)(i.Banner,{kind:"success",children:"Thanks \u2014 your feedback went privately to the restaurant."}):null,q?(0,j.jsx)(i.Button,{kind:"secondary",label:"View stamp card",onPress:()=>l.router.push(`/customer/${f.id}/loyalty`)}):null]})}},792,[812,805,31,128,840,818,819,820,822,823,825,882,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPayCard=function({o:e,phone:y}){const[f,k]=(0,n.useState)(Date.now()),[w,x]=(0,n.useState)(!1),[j,b]=(0,n.useState)(''),[P,v]=(0,n.useState)(null),_=(0,n.useRef)(!1),B=(0,c.payView)(e,f);(0,n.useEffect)(()=>{const e=setInterval(()=>k(Date.now()),1e3);return()=>clearInterval(e)},[]);const T='pay'===B.kind||'expired'===B.kind&&_.current&&'awaiting_payment'===e.status;(0,n.useEffect)(()=>{if(!T||!_.current)return;const n=setInterval(()=>{(0,h.checkPaid)(e.id)},1e4),r=t.default.addEventListener('change',n=>{'active'===n&&(0,h.checkPaid)(e.id)});return()=>{clearInterval(n),r.remove()}},[T,e.id]);if('none'===B.kind)return null;if('sending'===B.kind)return(0,p.jsx)(s.Banner,{kind:"warn",title:"Saving your order\u2026",children:"Sending it to the restaurant. Card payment opens in a moment."});if('refused'===B.kind)return(0,p.jsxs)(s.Banner,{kind:"danger",title:"The restaurant couldn\u2019t take this order",children:[(0,p.jsx)(s.T,{size:14,colour:"#FFE3DF",children:`${B.reason} Nothing has been charged.`}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to the menu",onPress:()=>o.router.replace(`/customer/${e.restaurantId}`)})]});if('paid'===B.kind)return(0,p.jsx)(s.Banner,{kind:"success",title:`Paid ${(0,l.gbp)(B.amount)} by card`,children:B.late?'Your payment came in after the time ran out. The restaurant has your order and will contact you if the collection time needs to change.':'Your order has gone to the kitchen.'});if('expired'===B.kind)return(0,p.jsxs)(s.Banner,{kind:"warn",title:'awaiting_payment'===e.status?'Checking your payment\u2026':'Time ran out: order not sent',children:[(0,p.jsx)(s.T,{size:14,children:'awaiting_payment'===e.status?'We\u2019re checking with the payment page. If you paid, your order will show as paid shortly.':`Nothing has been charged. You can order again${y?` or ring ${y}`:''}.`}),'awaiting_payment'!==e.status?(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Order again",onPress:()=>o.router.replace(`/customer/${e.restaurantId}`)}):null]});return(0,p.jsxs)(s.Card,{highlight:u.colours.gold,children:[(0,p.jsx)(s.H2,{children:"Pay to send your order"}),(0,p.jsxs)(s.T,{children:["Your order goes to the kitchen once it\u2019s paid. Time left to pay: ",(0,p.jsx)(s.T,{weight:"bold",colour:B.secondsLeft<120?u.colours.red:u.colours.gold,children:(0,c.mmss)(B.secondsLeft)})]}),(0,p.jsx)(s.Button,{label:w?'Opening the payment page\u2026':`Pay ${(0,l.gbp)(e.total)} by card`,disabled:w||B.secondsLeft<120,onPress:async()=>{x(!0),b('');const n='undefined'!=typeof window?window.open('','_blank'):null,t=await(0,h.getPayLink)(e.id);if(x(!1),!t.ok)return n?.close(),void b(t.message);if(v(t.url),_.current=!0,n)try{return void(n.location.href=t.url)}catch{}},testID:"pay-card"}),B.secondsLeft<120?(0,p.jsx)(s.Muted,{children:"Not enough time left to pay. Wait for this order to expire, then order again."}):null,P?(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Open the payment page again",onPress:()=>{'undefined'!=typeof window?window.open(P,'_blank'):r.default.openURL(P)}}):null,P?(0,p.jsx)(s.Button,{small:!0,kind:"ghost",label:"I\u2019ve paid: check now",onPress:()=>{(0,h.checkPaid)(e.id)}}):null,j?(0,p.jsx)(s.T,{size:14,colour:u.colours.red,children:j}):null,(0,p.jsx)(s.Muted,{children:"Secure card payment on the restaurant\u2019s website. Apple Pay and Google Pay may be offered there."})]})};var n=_r(d[0]),t=e(_r(d[1])),r=e(_r(d[2]));_r(d[3]);var o=_r(d[4]),s=_r(d[5]),l=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10])},882,[31,232,240,123,805,818,820,825,836,883,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_OFF",{enumerable:!0,get:function(){return o}}),e.getPayLink=async function(u){try{if(!await(0,n.guestSession)())return{ok:!1,message:'Can\u2019t reach the restaurant. Check your signal and try again.'};const{data:c,error:y}=await(0,t.getSupabase)().functions.invoke('takeaway-pay',{body:{order_id:u}}),f=await s(c,y);return f&&'string'==typeof f.url&&f.url.startsWith('https://')?{ok:!0,url:f.url,expiresAt:String(f.expiresAt??''),amountPence:Number(f.amountPence??0)}:{ok:!1,message:'string'==typeof f?.error?f.error:o}}catch{return{ok:!1,message:o}}},e.checkPaid=async function(o){try{const{data:u,error:c}=await(0,t.getSupabase)().functions.invoke('takeaway-pay-check',{body:{order_id:o}}),y=await s(u,c);return(0,n.nudgeGuestSync)(),y?.off?'off':String(y?.state??'unknown')}catch{return'unknown'}};var t=r(d[0]),n=r(d[1]);const o='Card payment isn\u2019t available right now. Nothing has been charged. Please ring the restaurant.';async function s(t,n){if(t&&'object'==typeof t)return t;const o=n?.context;try{const t=o?.json?await o.json():null;return t&&'object'==typeof t?t:null}catch{return null}}},883,[872,824]); \ No newline at end of file diff --git a/abbotsford/display-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js b/abbotsford/display-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js new file mode 100644 index 0000000000000000000000000000000000000000..aa5686de2b7746d4738fdfd057a3991ab57eb798 --- /dev/null +++ b/abbotsford/display-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);r(d[1]);var n=r(d[2]),c=r(d[3]),o=r(d[4]),f=r(d[5]);function s(){const{section:s}=(0,t.useLocalSearchParams)();return(0,c.canShow)('chef')?s&&(0,o.chefSectionAllowed)(String(s))?(0,f.jsx)(n.ChefApp,{section:String(s)},String(s)):(0,f.jsx)(t.Redirect,{href:"/kitchen"}):(0,f.jsx)(t.Redirect,{href:c.ENTRY[c.APP_VARIANT]})}},776,[805,31,806,807,808,25]); \ No newline at end of file diff --git a/abbotsford/display-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js b/abbotsford/display-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js new file mode 100644 index 0000000000000000000000000000000000000000..4ab9c83ccd4d5db63de5f806f1ae8fc169929c85 --- /dev/null +++ b/abbotsford/display-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js @@ -0,0 +1,3 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]);function u(){const{token:u}=(0,t.useLocalSearchParams)(),h=(0,c.cleanToken)(u);return h?(0,s.guestServer)()?(0,l.jsx)(o.TableOrderLive,{token:h}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"demo",title:"Not connected",children:"This preview isn't connected to a venue, so table orders can't be sent from here."})}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"warn",title:"This code isn't working",children:"Please scan the QR code on your table again, or ask a member of staff."})})}},796,[805,31,818,885,887,845,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},885,[874,812,31,128,818,819,820,887,886,823,825,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})},886,[872,824,887]); \ No newline at end of file diff --git a/abbotsford/display-app/_expo/static/js/web/__common-1240cb6cc5260d7d05075ffe302b67da.js b/abbotsford/display-app/_expo/static/js/web/__common-1240cb6cc5260d7d05075ffe302b67da.js new file mode 100644 index 0000000000000000000000000000000000000000..f1e8ac43d8b70921d305856a907e14a4172c0ea3 --- /dev/null +++ b/abbotsford/display-app/_expo/static/js/web/__common-1240cb6cc5260d7d05075ffe302b67da.js @@ -0,0 +1,574 @@ +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}Object.defineProperty(e,"__esModule",{value:!0}),r(d[0]),t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e)},805,[1298,1299,1309,1310,1312]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:K}=(0,z.useChef)(3e4);(0,we.useReviewAlerts)(i);const V=(0,_.useSignedIn)(),X=V?.id??z.CHEF_ID,Z=V?.ownerAccess&&'owner'!==V.role?'owner privileges':V?.managerAccess&&'staff'===V.role?'manager privileges':'',Ce=(0,Se.useSync)(e=>e.perms),Pe=Ce.includes('*')||Ce.includes('takings.view');(0,o.useSoldOutLink)(!0,(V?.name??n).replace(' (example)',''));const Oe=e?Be[e]:void 0,[Ee,Le]=(0,A.useState)(Oe?.tab??'home'),[Ne,We]=(0,A.useState)(Oe?.k??null),[Fe,Ge]=(0,A.useState)(Oe?.stock??'levels'),[Ke,Me]=(0,A.useState)(void 0),[Ve,ze]=(0,A.useState)(Oe?.gp??'dishes'),Ue=(0,A.useRef)(null),qe=(0,y.ymd)(K),Qe=(0,y.ymd)(new Date(K.getTime()+864e5));(0,p.useTipsPosted)(i,qe);const Ye=(0,ie.useTravelDay)('chef',qe),Je='home'===Ee&&!Ye;(0,S.useKitchenTodoChime)(i,qe,()=>tt('kitchen','bookings')),(0,me.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,_.ensureAttendance)((new Date).toISOString().slice(0,10),K)},[]);const Xe=(0,A.useRef)({t:'home',k:null});Xe.current={t:Ee,k:Ne};const Ze=(0,A.useRef)([]),et=(0,r.useScrollMemory)(Ue),tt=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Pe||(t=null);const s=Xe.current;s.t===e&&s.k===t||(Ze.current=[...Ze.current,{...s,y:et.leave()}].slice(-30),et.restore(0)),Le(e),We(t)},[Pe]),st=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Xe.current;let t=Ze.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ze.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return et.leave(),Le(s.t),We(s.k),et.restore(s.y??0),!0},[]);(0,l.useWebBack)(st);const it=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ge(s),'gp'===e&&s&&ze(s),tt(e,t)})},[tt]),(0,b.useShiftReminders)({rid:i,staffId:X,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:V?.id??'',name:n,onOpen:e=>{'orderlists'===e&&tt('kitchen','orderlists'),'chat'===e&&tt('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:V?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',st);return()=>e.remove()},[st]),(0,A.useEffect)(()=>{'takings'!==Ne||Pe||(We(null),Le('kitchen'))},[Ne,Pe]),(0,Se.useSync)(e=>e.perms.join(','));const at=(0,H.kitchenHistoryAccess)(i),ot=Ae.filter(e=>('takings'!==e.id||Pe)&&('bookinghistory'!==e.id||at)&&('kitchensetup'!==e.id||at)),nt=Ne&&('takings'!==Ne||Pe)?Ae.find(e=>e.id===Ne):null,rt=((0,E.default)().width,nt?nt.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:ge.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[Ee]);return(0,Re.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:M.colours.bg},edges:['top','bottom'],children:[(0,Re.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:M.colours.border,gap:6},children:[(0,Re.jsx)(L.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,Re.jsx)(F.VoiceSlot,{size:44})}),(0,Re.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'80%',paddingRight:8},children:[(0,Re.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${Z?`, ${Z}`:''}`,style:{borderWidth:1,borderColor:M.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Re.jsxs)(G.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Re.jsx)(ue.StaffAvatar,{id:z.CHEF_ID,size:24,ring:!1}),(0,Re.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Re.jsxs)(G.T,{size:13,weight:"semibold",colour:M.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),Z?(0,Re.jsx)(G.Muted,{center:!1,size:10,numberOfLines:1,children:Z}):null]})]})}),(0,f.openedFromDisplay)()?(0,Re.jsx)(f.BackToDisplayButton,{compact:!0}):null]}),(0,Re.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Re.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,he.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:M.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Re.jsx)(G.T,{size:13,colour:M.colours.gold,children:"Staff app \u203a"})})]}),(0,Re.jsxs)(O.default,{ref:Ue,...et.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Ee?(0,Re.jsx)(ce.AlertsBanner,{}):null,'home'===Ee?(0,Re.jsx)(de.WhosOnShift,{}):null,(0,Re.jsx)(l.BackTitleRow,{back:!('home'===Ee&&!Ne||it),onBack:st,title:rt}),'home'===Ee?(0,Re.jsx)(ie.DayBar,{app:"chef",today:qe}):null,'home'===Ee&&Ye?(0,Re.jsx)(ie.DayView,{rid:i,day:Ye,today:qe,app:"chef"}):null,'home'===Ee?(0,Re.jsx)(le.WhoBar,{}):null,Je&&V?(0,Re.jsx)(h.MyTasksToday,{rid:i,staffId:V.id,name:V.name,onShift:(0,b.shiftNow)(V.id,K.getTime()).on}):null,Je&&(0,k.isKitchenViaDisplay)()?(0,Re.jsx)($e,{go:(e,t)=>{'stock'===e&&t&&Ge(t),'gp'===e&&t&&ze(t),'orders'===e&&Me(t),tt(e,'kitchen'===e?t??null:null)}}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(p.TodaysTipsCard,{rid:i,today:qe}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(p.TipsPotCard,{rid:i,today:qe}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(x.CoversToday,{rid:i,onPress:()=>tt('kitchen','bookings')}):null,Je?(0,Re.jsx)(j.LastFoodBanner,{rid:i,now:K}):null,Je?(0,Re.jsx)(w.NextTableFreeCard,{rid:i,now:K}):null,Je?(0,Re.jsx)(v.KitchenSignoffs,{rid:i,today:qe,by:n,app:"chef"}):null,Je?(0,Re.jsxs)(L.default,{style:{gap:4},children:[(0,Re.jsx)(v.PlattersBooked,{rid:i,date:qe,label:"Platters booked today"}),(0,Re.jsx)(v.PlattersBooked,{rid:i,date:Qe,label:"Platters booked tomorrow"})]}):null,Je?(0,Re.jsx)(Te.ChefAssistantButton,{}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)($e,{go:(e,t)=>{'stock'===e&&t&&Ge(t),'gp'===e&&t&&ze(t),'orders'===e&&Me(t),tt(e,'kitchen'===e?t??null:null)}}):null,'stock'!==Ee||c.PITCH?null:(0,Re.jsx)(te.KitchenCosts,{rid:i,me:(V?.name??n).replace(' (example)',''),actor:{name:(V?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Fe?'deliveries':'take'===Fe?'count':'deliveries'},`s-${Fe}`),'gp'!==Ee||c.PITCH?null:(0,Re.jsx)(te.KitchenCosts,{rid:i,me:(V?.name??n).replace(' (example)',''),actor:{name:(V?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ve}`),'stock'===Ee&&c.PITCH?(0,Re.jsx)(ee.StockScreen,{initial:Fe},Fe):null,'gp'===Ee&&c.PITCH?(0,Re.jsx)(U.GpScreen,{initial:Ve},Ve):null,'creator'===Ee?(0,Re.jsx)(ge.DishCreator,{rid:i,canPublish:!1}):null,'orders'===Ee?(0,Re.jsx)(Y.OrdersScreen,{focus:Ke},Ke??'all'):null,'rota'===Ee?(0,Re.jsx)(G.Card,{children:(0,Re.jsx)(J.KitchenRotaTab,{today:qe})}):null,'kitchen'!==Ee||nt?null:(0,Re.jsxs)(L.default,{style:{gap:10},children:[(0,Re.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:M.colours.border,backgroundColor:M.colours.surface,overflow:'hidden'},children:[He.map(e=>(0,Re.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>tt(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Re.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Re.jsxs)(L.default,{style:{flex:1},children:[(0,Re.jsx)(G.T,{weight:"medium",children:e.title}),(0,Re.jsx)(G.Muted,{children:e.sub})]}),(0,Re.jsx)(G.T,{colour:M.colours.muted,children:"\u203a"})]})},e.id)),ot.map(e=>(0,Re.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>tt(Ee,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:M.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Re.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Re.jsxs)(L.default,{style:{flex:1},children:[(0,Re.jsx)(G.T,{weight:"medium",children:e.title}),(0,Re.jsx)(G.Muted,{children:e.sub})]}),(0,Re.jsx)(G.T,{colour:M.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Re.jsx)(G.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Re.jsxs)(G.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Se.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ne&&X?(0,Re.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Re.jsx)(ne.ClockInOut,{}),(0,Re.jsx)(re.MyUpcomingShifts,{staffId:X,team:!0})]}):null,'mypay'===Ne?(0,Re.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Re.jsx)(ae.MyPeriods,{staffId:X}),(0,Re.jsx)(se.MyHoursPay,{staffId:X}),(0,Re.jsx)(oe.MyTips,{staffId:X}),(0,Re.jsx)(G.Card,{children:(0,Re.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ne?(0,Re.jsx)(L.default,{testID:"chef-alerts",children:(0,Re.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ne?(0,Re.jsx)(t.AvatarMaker,{meId:V?.id??z.CHEF_ID,me:n}):null,'reviews'===Ne?(0,Re.jsx)(je.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ne?(0,Re.jsx)(R.BookingHistory,{rid:i,today:qe}):null,'bookings'===Ne?(0,Re.jsx)(I.TodaysBookings,{rid:i,today:qe,by:n,app:"chef"}):null,'specials'===Ne?(0,Re.jsx)(fe.SpecialsEditor,{rid:i,me:n,app:"chef",now:K}):null,'forecast'===Ne?(0,Re.jsx)(q.ChefForecast,{openPrep:()=>tt('kitchen','prep')}):null,'prep'===Ne?(0,Re.jsx)(Q.PrepScreen,{}):null,'live'===Ne?(0,Re.jsx)(Q.TeamScreen,{}):null,'waste'===Ne?(0,Re.jsx)(Q.WasteScreen,{}):null,'recipes'===Ne?(0,Re.jsx)(xe.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ne?(0,Re.jsx)(Q.AllergenScreen,{openCards:()=>tt('kitchen','recipes')}):null,'takings'===Ne&&Pe?(0,Re.jsx)(p.CashUpScreen,{rid:i,today:qe,canEdit:!1,chartsOnly:!0,who:{id:X,name:n.replace(' (example)','')}}):null,'board'===Ne?(0,Re.jsx)(ve.QuestionBoard,{rid:i,today:qe,manager:!1,by:""}):null,'teamtasks'===Ne?(0,Re.jsx)(h.KitchenTeamTasks,{rid:i,actor:V}):null,'orderlists'===Ne?(0,Re.jsx)(C.OrderListsScreen,{rid:i,today:qe,editor:!0,who:{id:X,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ne?at?(0,Re.jsx)(D.TempUnitsSetup,{}):(0,Re.jsx)(G.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ne||'compliance'===Ne||'foodsafety'===Ne?(0,Re.jsx)(ke.HaccpLog,{mode:"chef",me:n,meId:z.CHEF_ID,now:K,rid:i}):null,'accidents'===Ne?(0,Re.jsx)(pe.AccidentBook,{app:"chef",me:n,meId:z.CHEF_ID,now:K,seeAll:!1}):null]}),(0,Re.jsx)(Ie.BottomTabs,{tablist:!0,background:M.colours.surface,active:'orders'===Ee?'kitchen':Ee,onPress:e=>tt(e),tabs:De.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Re.jsx)(Te.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Me(t),tt('orders')):'gp'===e?tt('gp'):tt('kitchen',e)}}),(0,Re.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Re.jsx)(ye.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),fe=_r(_d[67]),be=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]),Ie=_r(_d[79]),Re=_r(_d[80]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const De=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:ge.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],He=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],Ae=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],Be={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function $e({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,z.useChef)(3e4),d=(0,X.useSheetReminders)(),u=(0,z.useWeek)(),{covers:h,label:p,enough:k,booked:f}=(0,z.useForecast)(),b=(0,Y.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,z.isLow)(e.onHand,e.par)),x=b.filter(e=>e.ordersToday&&!e.placedToday),j=(0,V.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,Ce.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,te.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Re.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Re.jsx)(ke.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Re.jsxs)(G.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Re.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Re.jsxs)(G.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Re.jsx)(Z.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Re.jsx)(G.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Re.jsxs)(G.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,z.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,z.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,z.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Re.jsx)(z.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,K.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Re.jsx)(z.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,K.gbp)((0,z.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Re.jsx)(z.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Re.jsx)(z.Tile,{label:"Waste this week",value:t.waste.length?(0,K.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,z.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Re.jsx)(z.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Re.jsx)(z.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${f}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Re.jsx)(z.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Re.jsxs)(G.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Re.jsx)(G.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Re.jsxs)(G.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Re.jsx)(G.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[ge.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Re.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:M.colours.gold,backgroundColor:M.colours.surface},children:(0,Re.jsxs)(G.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Re.jsx)(G.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Re.jsx)(Pe.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},806,[1067,1387,1218,942,1388,1042,1043,1044,2,1057,1046,1047,979,1165,1000,822,944,1414,1415,993,1056,1054,1055,947,1419,1428,1430,1177,31,234,123,264,152,288,128,290,868,948,818,820,825,953,1440,1442,1443,1444,1446,1454,1453,1455,974,1457,1458,1061,945,1062,1064,1063,1475,1040,940,1041,996,866,1065,1449,1066,1477,961,1485,963,1051,841,950,1052,823,1489,941,824,1060,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"IS_OWNER_DESKTOP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"IS_CAR",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"APP_VARIANT",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"ENTRY",{enumerable:!0,get:function(){return l}}),_e.isAllowedPath=function(e,n=f){return!(t.IS_ISOLATED_VENUE&&/^\/(customer|table)(\/|$)/.test(e)&&![`/customer/${t.VENUE_RID}`,`/customer/${t.VENUE_RID}/`].includes(e))&&('/'===e||''===e||_[n].test(e))},_e.canShow=function(e,t=f){return t===e||'owner'===t&&'customer'===e};var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};const u=o.default.expoConfig?.extra?.appVariant??void 0??'owner',c=!1,s=!1,f=['owner','staff','customer','display','chef'].includes(u)?u:'owner',l={owner:'/owner',staff:'/team',customer:`/customer/${t.VENUE_RID}`,display:'/display',chef:'/kitchen'},_={owner:/^\/(owner|customer|table)(\/|$)/,customer:/^\/(customer|table)(\/|$)/,staff:/^\/team(\/|$)/,display:/^\/display(\/|$)/,chef:/^\/kitchen(\/|$)/}},807,[5,409]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PERMISSIONS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"CHEF_SECTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"chefSectionAllowed",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"rotaView",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"chatView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ticketView",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"supplierView",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"auditView",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"CARD_ROLE_APP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"cardCostsVisible",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"ownJobSeesCosts",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"costsAllowedFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ownJobManagesLinks",{enumerable:!0,get:function(){return h}});const e={owner:'all',manager:'all',staff:new Set(['rota-shifts','tickets','eighty-six','allergens']),chef:new Set(['stock','costing','gp','waste','dish-sales','prep','ordering','allergens','compliance','rota-shifts','kitchen-chat','tickets','eighty-six','specials'])},t=(t,n)=>{const a=e[t];return'all'===a||a.has(n)},n={stock:'stock','stock-take':'stock',deliveries:'stock',gp:'gp','price-changes':'gp','gp-week':'gp','menu-engineering':'dish-sales',orders:'ordering',forecast:'prep',prep:'prep',live:'tickets',waste:'waste',allergens:'allergens',compliance:'compliance',haccp:'compliance',accidents:'compliance','new-dish':'gp',specials:'specials',recipes:'allergens','recipe-cards':'allergens'},a=e=>e in n&&t('chef',n[e]),s=(e,n,a)=>t(e,'staff-personal')?{staff:n,shifts:a}:{staff:n.filter(e=>e.active).map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},job:e.job})),shifts:a.filter(e=>e.published).map(({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l})=>({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l}))},c=(e,t)=>'chef'===e?t.filter(e=>'kitchen'===e.ch&&!e.removed):t,l=(e,n)=>t(e,'customer-personal')?n:n.map(({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),f=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text)),u={'head-chef':'chef',manager:'manager',owner:'owner',staff:'staff'},p=(e,n="edit")=>'edit'===n&&t(u[e]??'staff','costing'),b=e=>'owner'===e.role||'manager'===e.role||'Head Chef'===e.level,m=e=>!e||b(e),h=e=>'owner'===e.role||'manager'===e.role},808,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},812,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},813,[31,264,274,128,1174,825,818,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_DWELL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"dwellBands",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"bandLabel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fmtMins",{enumerable:!0,get:function(){return o}}),_e.dwellFor=function(e,t,r=[]){const o=n(e),i=Math.max(0,o.findIndex(e=>t<=e.upTo)),s=o[i]??o[o.length-1];if(!1===e?.settings.dwellLearn)return{mins:s.mins,learned:!1,samples:0};const a=0===i?1:o[i-1].upTo+1,u=r.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt&&e.partySize>=a&&e.partySize<=s.upTo).map(e=>(new Date(e.finishedAt).getTime()-new Date(e.seatedAt).getTime())/6e4).filter(e=>e>=20&&e<=360).sort((e,t)=>e-t);if(u.length<8)return{mins:s.mins,learned:!1,samples:u.length};const l=u[Math.floor(u.length/2)];return{mins:5*Math.round((s.mins+l)/2/5),learned:!0,samples:u.length}},Object.defineProperty(_e,"DAYS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ruleText",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"ANCHORAGE_EVENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"regularEventsOf",{enumerable:!0,get:function(){return l}}),_e.occursOn=m,_e.nextOccurrence=function(e,t){const n=f(t);for(let t=0;t<400;t++){const r=c(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t));if(m(e,r))return r}return null},_e.expandEvents=function(e,t,n,r){const o=[];if(!t.some(e=>e.active))return o;const i=f(n),s=f(r);for(let n=i;n<=s;n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)){const r=c(n);for(const n of t)m(n,r)&&o.push({id:`${n.id}:${r}`,restaurantId:e,date:r,title:n.name,kind:'event',example:!1,source:'regular',description:[n.time?`from ${n.time}`:'',n.lastFood?`last food orders ${n.lastFood}`:'',n.notes??''].filter(Boolean).join(' \xb7 '),busier:n.busier,lastFood:n.lastFood,time:n.time})}return o},_e.lastFoodOn=function(t,n){if(!t)return null;const r=f(n).getDay(),o=t.settings.lastFoodByDay?.[r],s=(0,e.kitchenHoursOn)(t,f(n));let a=s?{time:s[1],reason:'kitchen closes'}:null;o&&(!a||oe?.settings.dwellBands?.length?e.settings.dwellBands:t,r=(e,t)=>{const n=0===t?1:e[t-1].upTo+1,r=e[t].upTo;return r>=9999?`${n} or more covers`:n===r?`${n} cover${1===n?'':'s'}`:`${n}\u2013${r} covers`},o=e=>e%60==0?`${e/60} hour${60===e?'':'s'}`:e>60?`${Math.floor(e/60)} h ${e%60} min`:`${e} min`;const i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],s=['','first','second','third','fourth'],a=e=>'last'===e.kind?`Last ${i[e.weekday]} of every month`:'nth'===e.kind?`${s[e.n][0].toUpperCase()}${s[e.n].slice(1)} ${i[e.weekday]} of every month`:'weekly'===e.kind?`Every ${i[e.weekday]}`:`One-off: ${e.date}`,u=[{id:'ev-music-night',name:'Open Mic Night',rule:{kind:'last',weekday:0},time:'20:00',notes:'Live music from 8pm.',busier:!0,lastFood:'19:00',active:!0}],l=e=>e?.settings.regularEvents??('anchorage'===e?.id?u:[]),d=e=>String(e).padStart(2,'0'),c=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`,f=e=>new Date(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)));function m(e,t){if(!e.active)return!1;const n=e.rule;if('once'===n.kind)return n.date===t;const r=f(t);return r.getDay()===n.weekday&&('weekly'===n.kind||('nth'===n.kind?Math.ceil(r.getDate()/7)===n.n:new Date(r.getFullYear(),r.getMonth(),r.getDate()+7).getMonth()!==r.getMonth()))}const b=e=>e?.settings.afterLastFood??'drinks',p=e=>{const[t,n]=e.split(':').map(Number);return`${t%12||12}${n?`:${d(n)}`:''}${t<12?'am':'pm'}`},y=e=>e?.settings.showTakeaway??'anchorage'!==e?.id,h=e=>!1!==e?.settings.coversCounter,O=e=>!1!==e?.settings.nextTableFree,$=e=>!1!==e?.settings.dogQuestion,w=e=>!1!==e?.settings.dietQuestion,F=e=>!1!==e?.settings.accessQuestion,k=(e,t)=>e?.settings.holidayFullNames?t:t.replace(/\s*\(substitute day\)/gi,'').trim()},814,[833]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},815,[874,31,123,128,25]); +__d(function(_g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.startForm=function(t=Date.now()){return{openedAt:t,hp:''}},e.guardFor=function(t,n=Date.now()){return{hp:t.hp,formMs:Math.max(0,Math.round(n-t.openedAt))}},e.rememberGuard=function(n,o){t.set(n,o)},e.takeGuard=function(n){const o=t.get(n);return o?(t.delete(n),o):{}};const t=new Map},816,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedFields=W,_e.historyText=D,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=W(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:D(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${A(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!W(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return E}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: 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.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],h=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],u=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],w=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),k=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return k(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){const i=y(e);return l.filter(e=>M(e,i)!==M(e,t))}const j=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,A=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function D(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${j(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${j(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${j(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${h.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=w(o.holds),i=w(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${A(s)}`}const E=e=>e.map(e=>f[e]).join(', ')},817,[832,1174,1420,960]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return A}}),_e.BrandBar=z,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,B.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,B.jsx)(v,{}):null]});return(0,B.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,B.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,B.jsx)(z,{title:t,subtitle:r,back:o,right:l})}),c?(0,B.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,B.jsx)(p.default,{style:{flex:1},children:u}),s?(0,B.jsx)(p.default,{style:N.footer,children:(0,B.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=F,_e.Card=H,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,B.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:D?'center':'flex-start'}],children:(0,B.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=E,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return $}}),_e.Row=O,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return _}}),_e.Field=function({label:e,...t}){return(0,B.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,B.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,B.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t,style:[N.input,t.multiline&&{minHeight:70,textAlignVertical:'top'},t.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,B.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,B.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,B.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,B.jsxs)(O,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,B.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,B.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,B.jsxs)(O,{gap:10,children:[(0,B.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,B.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,B.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,B.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,B.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,B.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w}){const{height:W}=(0,x.default)(),k=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},S=(0,r.useTyping)(),I=(0,r.useVisibleArea)(),D=S&&I&&I.height({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,B.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,R?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,B.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,B.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,B.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,B.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,B.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]);const R=['kirkton','abbotsford'].includes(k.VENUE_RID),D='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(D&&('semibold'===l||'bold'===l)&&!j);return(0,B.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,B.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,B.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),A=e=>(0,B.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??D});function z({title:e,back:t=!0,right:r,subtitle:o}){return(0,B.jsxs)(p.default,{style:N.brandBar,children:[(0,B.jsxs)(p.default,{style:N.row,children:[(0,B.jsx)(p.default,{style:N.brandSide,children:t?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,B.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,B.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,B.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,B.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,B.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,B.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,B.jsx)(A,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function v(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,B.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,B.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function F({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,B.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,B.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,B.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function H({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,B.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,B.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function E({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,B.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,B.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,B.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}A.statusLine=!0,F.centreRow=!0;const V=({phone:e})=>(0,B.jsx)(E,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),$=()=>(0,B.jsx)(E,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function O({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===H?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(D&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,B.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=D&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,B.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const _=()=>(0,B.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},818,[1164,835,1347,874,805,881,31,240,257,123,264,152,47,272,128,288,290,825,1345,1348,5,807,868,25]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ALLERGENS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"allergenLabel",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEVERITIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"severityLabel",{enumerable:!0,get:function(){return s}}),e.effectiveAllergens=function(l,n=[]){const t={...l.allergens};for(const s of l.optionGroups??[])for(const l of s.choices)if(n.includes(l.id)&&l.allergens)for(const[n,s]of Object.entries(l.allergens))'contains'!==t[n]&&(t[n]=s);return t},e.conflictsFor=function(l,n){const t=[],s=[];for(const a of n)'contains'===l[a.allergen]?t.push(a.allergen):'may'===l[a.allergen]&&s.push(a.allergen);return{contains:t,may:s}},Object.defineProperty(e,"hasConflict",{enumerable:!0,get:function(){return a}});const l=[{id:'gluten',label:'Cereals containing gluten',short:'Gluten'},{id:'crustaceans',label:'Crustaceans',short:'Crustaceans'},{id:'molluscs',label:'Molluscs',short:'Molluscs'},{id:'eggs',label:'Eggs',short:'Eggs'},{id:'fish',label:'Fish',short:'Fish'},{id:'peanuts',label:'Peanuts',short:'Peanuts'},{id:'treenuts',label:'Tree nuts',short:'Tree nuts'},{id:'soya',label:'Soya',short:'Soya'},{id:'milk',label:'Milk',short:'Milk'},{id:'celery',label:'Celery',short:'Celery'},{id:'mustard',label:'Mustard',short:'Mustard'},{id:'sesame',label:'Sesame',short:'Sesame'},{id:'sulphites',label:'Sulphur dioxide / sulphites',short:'Sulphites'},{id:'lupin',label:'Lupin',short:'Lupin'}],n=n=>l.find(l=>l.id===n)?.short??n,t=[{id:'intolerance',label:'Intolerance'},{id:'allergy',label:'Allergy'},{id:'coeliac',label:'Coeliac disease'},{id:'anaphylaxis',label:'Severe \u2014 anaphylaxis risk'}],s=l=>t.find(n=>n.id===l)?.label??l;const a=l=>l.contains.length>0||l.may.length>0},819,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"gbp",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return n}});const t=t=>`\xa3${(t/100).toFixed(2)}`,n=t=>Math.round(100*t)},820,[]); +__d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSlotMinutesOf=s,e.bookingNoticeMinsOf=r,e.bookingCoversPerStartOf=u,e.bookingPartiesPerStartOf=l,e.onlinePartyBounds=c,Object.defineProperty(e,"COVERS_WINDOW_MINS",{enumerable:!0,get:function(){return f}}),e.coversInHalfHour=m,e.countInStartSlot=p,e.bookingLimitsHint=function(t){const n=s(t),o=u(t),f=l(t),m=r(t),p=c(t);if(null!=o||null!=f){const t=[];return null!=o&&null!=f?t.push(`up to ${o} people and ${f} bookings at each start time`):null!=o?t.push(`up to ${o} people at each start time`):t.push(`up to ${f} bookings at each start time`),(p.max<100||p.min>1)&&t.push(`parties of ${p.min} to ${p.max}`),t.push(`from ${m} minutes ahead`),t.push('table rules still apply'),`Times are every ${n} minutes: ${t.join(', ')}.`}return`Times are every ${n} minutes. Covers per slot (${t.settings.bookingCoversPerSlot} per half hour) and table rules still apply.`},e.takeawaySlots=function(o,s,r){const u=(0,t.hoursFor)(o,r);if(!u)return[];const l=o.settings.slotMinutes,c=(0,n.addMins)(r,o.settings.leadMins),f=[];for(let t=new Date(u.open);t<=u.close;t=(0,n.addMins)(t,l)){if(tn.restaurantId===o.id&&'takeaway'===n.type&&'cancelled'!==n.status&&n.slotTime&&new Date(n.slotTime).getTime()===t.getTime()).length;f.push({time:new Date(t),label:(0,n.hm)(t),taken:r,cap:o.settings.slotCap,full:r>=o.settings.slotCap})}return f},e.bookingSlots=function(c,f,d,h,k,M=()=>0){const y=(0,t.hoursFor)(c,f);if(!y)return[];const S=[],$=y.close,P=(0,o.lastFoodOn)(c,b(f)),v=P?(0,n.atTime)(f,P.time):$,I='drinks'===(0,o.afterLastFood)(c),O=s(c),C=r(c),N=u(c),T=l(c);for(let t=new Date(y.open);t<=$;t=(0,n.addMins)(t,O)){const o=(0,n.hm)(t),s=t>v;if(s&&!I)continue;const r=null!=N?p(d,o,O):m(d,o),u=(N??c.settings.bookingCoversPerSlot)-r,l=null!=T?p(M,o,O):0,f=null!=T?T-l:void 0,b=t.getTime()=1;S.push({time:o,left:u,available:!b&&u>=h&&y,past:b,...s?{drinksOnly:!0}:{},...null!=f?{partiesLeft:f,partiesCap:T}:{}})}return S};var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]);function s(t){const n=t.settings.bookingSlotMinutes;return 5===n||10===n||15===n||20===n||30===n?n:15}function r(t){const n=t.settings.bookingNoticeMins;return'number'==typeof n&&Number.isInteger(n)&&n>=0&&n<=1440?n:30}function u(t){const n=t.settings.bookingCoversPerStart;return'number'==typeof n&&Number.isInteger(n)&&n>0&&n<=200?n:null}function l(t){const n=t.settings.bookingPartiesPerStart;return'number'==typeof n&&Number.isInteger(n)&&n>0&&n<=50?n:null}function c(t){const n=t.settings.onlinePartyMin,o=t.settings.onlinePartyMax,s='number'==typeof n&&Number.isInteger(n)&&n>=1&&n<=100?n:1;return{min:s,max:'number'==typeof o&&Number.isInteger(o)&&o>=s&&o<=100?o:100}}const f=30;function m(t,o){const s=Math.floor((0,n.toMins)(o)/f)*f;let r=0;for(let o=0;o`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},821,[833,822,814]); +__d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"pad",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return n}}),e.venueYmd=function(t,u="Europe/London"){try{const n=new Intl.DateTimeFormat('en-CA',{timeZone:u,year:'numeric',month:'2-digit',day:'2-digit'}).format(t);if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n}catch{}return n(t)},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseYmd",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toMins",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fromMins",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"atTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"addMins",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"dayShort",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"dayLong",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"monthLong",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"niceDate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"niceDateYear",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"minsBetween",{enumerable:!0,get:function(){return P}});const t=t=>String(t).padStart(2,'0'),n=n=>`${n.getFullYear()}-${t(n.getMonth()+1)}-${t(n.getDate())}`;const u=n=>`${t(n.getHours())}:${t(n.getMinutes())}`,a=t=>{const[n,u,a]=t.split('-').map(Number);return new Date(n,u-1,a)},o=t=>{const[n,u]=t.split(':').map(Number);return 60*n+u},c=n=>`${t(Math.floor(n/60))}:${t(n%60)}`,d=(t,n)=>{const u=new Date(t);return u.setHours(0,0,0,0),u.setMinutes(o(n)),u},m=(t,n)=>new Date(t.getTime()+6e4*n),b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],y=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],f=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],l=['January','February','March','April','May','June','July','August','September','October','November','December'],p=t=>b[t.getDay()],s=t=>y[t.getDay()],O=t=>l[t],M=t=>`${b[t.getDay()]} ${t.getDate()} ${f[t.getMonth()]}`,j=t=>`${M(t)} ${t.getFullYear()}`,P=(t,n)=>Math.round((n.getTime()-t.getTime())/6e4)},822,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"repo",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=t.localRepositories},823,[1349,1082]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return Q.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return Q.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return Q.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return Q.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return Q.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return et}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ct}}),i.rotaReconcile=Dt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();de.useOwner.getState().chatMarkRead(e,{[t]:a});const s=de.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>de.useOwner.getState().chatSeen(t,e)),Qt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await De().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(de.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await De().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(de.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await De().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return de.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...vt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(me.PITCH)return Se.unlockCashUp(e,t,a);const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await De().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?le.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):le.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})),{ok:!0,until:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.readCashAudit=async function(e){if(me.PITCH)return Se.cashAudit(e);const t=Ue.getState().venueId;if(!t)return[];let a=De().from('cash_up_audit').select('at, action, changed_by_name, tbl, for_date, reason, old_row, new_row').eq('venue_id',t).order('at',{ascending:!1}).limit(50);e&&(a=a.eq('row_id',e));const{data:s,error:n}=await a;return n||!Array.isArray(s)?[]:s.map(e=>({at:String(e.at),action:String(e.action),by:String(e.changed_by_name??'\u2014'),tbl:String(e.tbl),forDate:e.for_date??void 0,reason:e.reason??void 0,changed:(0,A.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=Ue.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await De().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(ya.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=_a,i.readAccessLog=async function(){const e=Ue.getState().venueId;if(!e)return[];try{const{data:t}=await De().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ue.getState().venueId;if(!e)return[];const{data:t,error:a}=await De().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await De().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=ha.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await De().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return ha.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await De().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return ya}}),i.claimInvite=Na,i.makeChromeHandover=async function(){const e=Ue.getState();if(me.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await De().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Ke});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(me.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await De().rpc('claim_chrome_handover',{p_code:e,p_app:Ke});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),Le&&ja(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(me.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{Me();const{data:t,error:a}=await De().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(me.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await De().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),Le&&ja(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{Me(),await De().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Aa)}catch{}},i.signedInHereAs=async function(e){Me();const t=await L.kv.get(Aa,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return Me(),await L.kv.get(Ca,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ue.getState();if(!u.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==u.VENUE_UUID||e.staffRef!==C.useSession.getState().meId)return null;Me();const t=await L.kv.get(Ca,null);return t?(0,C.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ue.getState();if(!u.IS_WILDINGS||'staff'!==e.kind||e.venueId!==u.VENUE_UUID||e.staffRef!==C.useSession.getState().meId)return null;Me();const t=await L.kv.get(Ca,null);return t?(0,C.appUrl)('staff',t):null},i.forgetSignInHere=async function(){Me(),await L.kv.remove(Aa),await L.kv.remove(Ca),Ee({mode:'signin',perms:[]});try{await Ba()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ue.getState().venueId;if(me.PITCH||!s||'staff'!==Ue.getState().kind)return{ok:!0};if(!(0,ue.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await qa('approve_shift_swap',{p_venue:s,p_shift:e,p_to_ref:t,p_kind:a}),{ok:!0}}catch(e){return{ok:!1,message:String(e?.message??e).replace(/^.*?:\s*/,'')||'Not allowed'}}},i.claimInviteForSync=async function(e){const t=await Na(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(me.PITCH)return Se.reissueInvite(e);const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await De().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.currentStaffAppLinks=async function(e){const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return qa('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return qa('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return qa('staff_app_link_history',{p_venue:Ue.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await qa('revoke_staff_app_link',{p_venue:Ue.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(me.PITCH)return Se.linkPhones();const e=Ue.getState().venueId;if(!e||'staff'!==Ue.getState().kind)return{};try{const t=await qa('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(me.PITCH)return Se.resetPhone(e);const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return Number(await qa('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(me.PITCH)return Se.inviteStatus();const e=Ue.getState().venueId;if(!e)return{};const{data:t,error:a}=await De().rpc('invite_status',{p_venue:e});if(a||!Array.isArray(t))return{};const s={};for(const e of t)s[String(e.staff_ref)]={state:e.state,expiresAt:e.expires_at??void 0,usedAt:e.used_at??void 0,devices:Number(e.devices??0)};return s},i.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Ta();const{data:t,error:a}=await De().rpc(u.IS_QUEUED_VENUE?'claim_'+u.VENUE_RID+'_pairing_code':u.IS_GREENSIDE?'claim_greenside_pairing_code':u.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':u.IS_KIRKTON?'claim_kirkton_pairing_code':u.IS_WILDINGS?'claim_wildings_pairing_code':u.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':u.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)return{ok:!1,error:'That code was not accepted. It may have expired. Ask a manager for a new one.'};const n={kind:'device',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await L.kv.set(Oa,n),ja(),{ok:!0,venueName:s.venue_name}}catch(e){const t=String(e?.message??e);return/fetch|network/i.test(t)?{ok:!1,error:'No connection. Check the tablet\u2019s Wi-Fi and try again.'}:/rate|too many/i.test(t)?{ok:!1,error:'Too many tries from this network. Wait a little and try again.'}:{ok:!1,error:/valid|switched off/i.test(t)?t:`Couldn\u2019t pair: ${t}`}}},i.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Ta();const{data:e,error:t}=await De().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ka,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:Pa(e)}}},i.carPairPoll=async function(e){try{Me();const t=e??await L.kv.get(Ka,null);if(!t)return'unknown';const{data:a,error:s}=await De().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,Y.carPairApproved)(n)){const e=(0,Y.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Oa,null);await L.kv.set(Oa,e),await L.kv.remove(Aa),C.useSession.getState().meId&&C.useSession.getState().signOut(),de.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||ja()}return'revoked'!==i&&'unknown'!==i||await Ma(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{Me(),await De().rpc('car_sign_out')}catch{}await Ma(),await Ba();try{await De().auth.signOut({scope:'local'})}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await qa('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:Pa(e)}}},i.carList=async function(){const e=Ue.getState().venueId;if(!e)return[];return(await qa('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=Ue.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await qa('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:Pa(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Oa),await Ba();try{await De().auth.signOut()}catch{}Ee({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Aa),await L.kv.remove(Ca),await Ba();try{await De().auth.signOut()}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'Disconnected. Open your personal invite link to connect again.'})},i.wipeThisDevice=async function(e={}){try{await Ba()}catch{}try{(0,K.isSupabaseConfigured)()&&await De().auth.signOut({scope:'local'})}catch{}let t=0;try{const e='undefined'!=typeof navigator?navigator:null,t=await(e?.serviceWorker?.getRegistration?.()),a=await(t?.pushManager?.getSubscription?.());a&&await a.unsubscribe()}catch{}for(const e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${u.VENUE_RID}:`)):(0,O.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!u.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This device has been wiped.'}),!1!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=xa,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return qa}}),i.mendSession=Fa,i.startAppSync=async function(e=u.VENUE_RID){if(u.IS_ISOLATED_VENUE&&e!==u.VENUE_RID)return;if(Le)return;Le=!0,$a=e,'customer'===Ke&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(Me(),'customer'!==Ke){const t=e=>new Promise(t=>{try{if(!e?.persist||e.persist.hasHydrated())return t();const a=e.persist.onFinishHydration(()=>{a?.(),t()});setTimeout(t,3e3)}catch{t()}}),a='chef'===Ke&&(0,w.isAnchorage)(e)?[z.useStore,de.useOwner,re.useKitchen,oe.useSafety,ae.useCardStore,S.useGpCalc,se.useOrderSheets,y.useSpecials,D.useHr]:[z.useStore,de.useOwner,re.useKitchen];if(await Promise.all(a.map(t)),'chef'===Ke&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ee({mode:'offline',message:'Saved kitchen data could not be backed up. Nothing was cleared. Free some device storage, then reopen.',lastError:'Legacy kitchen archive not ready'});try{await Cs(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ee({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ee({mode:'off'});$.mutationQueue.subscribe(()=>{const e=$.mutationQueue.waiting,t=e[0];Ee({pending:$.mutationQueue.pending.length,failed:$.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,j.describeWrite)(t)}: ${(0,j.plainReason)({...t.lastErr},'retry')}`:void 0})}),$.mutationQueue.onFailed(e=>Ee({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:$.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,j.describeWrite)(e),why:'conflict'===e.reason?(0,j.plainReason)({code:'conflict'},'refused'):(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),qe.push((0,P.onConnectivity)(e=>Ee({mode:e?Ue.getState().venueId?'live':Ue.getState().mode:Ue.getState().venueId?'offline':Ue.getState().mode}))),await Wa()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return Ga}}),i.serverOrder=es,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ts}}),i.nudgeGuestSync=function(){as?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return ss}}),i.stockSaveBlocker=ns,i.stockEventStatus=function(e){if(et(e))return{state:'saved'};const t=$.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,j.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=is,i.saveStockEventsNow=rs,i.bookingSaveBlocker=ds,i.resendUnsavedBookings=ls,i.saveBookingsNow=fs,i.waitForBookingSave=function(e,t=12e3){if(!Ne())return Promise.resolve({state:'local'});const a=ds();if(a)return Promise.resolve({state:'refused',why:a});const s=us()[0]?.venueId??'',n=()=>os.some(t=>$.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,P.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push($.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push($.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||us().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||us().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=Ss,i.tempLogState=function(){const e=hs()[0]?.venueId??'',t=hs().find(e=>'temp_readings'===e.spec.table),a=$.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!$.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(H.useTempSaves.getState().notSaved),i=oe.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ys,i.waitForTempSave=function(e,t,a=1e4){if(!Ne()||!hs().length)return Promise.resolve({state:'local'});const s=Ss(e);if(s)return Promise.resolve({state:'refused',why:s});const n=hs()[0]?.venueId??'',i=hs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>H.useTempSaves.getState().notSaved[(0,H.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>$.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=ks,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Ls}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=qs.get(a);if('customer'!==Ke||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():qs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),qa('public_day',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:Fe(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:Fe(a.from_time),to:Fe(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),qs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Ls.setState(e=>({n:e.n+1}))}).catch(()=>{const e=qs.get(a);e&&!e.ok&&qs.delete(a)}));const n=qs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ue.getState().venueId;if(!n||'staff'!==Ue.getState().kind)throw new Error('Connect to your venue first.');const i=await qa('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ue.getState().venueId;if(!e||'staff'!==Ue.getState().kind)return null;return(await qa('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');await qa('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),S=t(r[10]),h=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),K=t(r[27]),P=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),L=t(r[32]),B=t(r[33]),j=t(r[34]),F=t(r[35]),$=t(r[36]),W=t(r[37]),H=t(r[38]),Q=t(r[39]),V=t(r[40]),G=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),Se=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(a){if('default'!==a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,t})(_e),he=t(r[64]),ye=t(r[65]),we=t(r[66]),ve=t(r[67]),be=t(r[68]),ke=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]);const De=()=>(0,N.getSupabase)();$.mutationQueue.setExecutor(B.executeMutation),(0,x.setClockServer)(()=>'staff'===Ue.getState().kind);const Ue=(0,T.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ee=e=>Ue.setState(e),Te=e=>{const t=Ue.getState().perms;return t.includes('*')||t.includes(e)},Ne=()=>{const e=Ue.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ue.subscribe(()=>(0,Re.setLiveData)(Ne()));let Ke=Z.IS_CAR?'car':Z.APP_VARIANT,Pe=!1;const Me=()=>{Pe||((0,L.setSyncNamespace)(Ke),Pe=!0)};let xe=[],qe=[],Le=!1;const Be=()=>(new Date).toISOString().slice(0,10),je=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),Fe=e=>e?e.slice(0,5):'',$e=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],We=e=>JSON.parse(JSON.stringify(e));function He(e,t){const a=je(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write')),filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=We(e);if(t)return{id:e.id,venue_id:a,walk_date:e.date,arrived_at:e.seatedAt??e.createdAt,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:$e(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,ue.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:$e(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Qe(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>'guest'!==Ue.getState().kind,filter:e=>e.gte('created_at',t),inWindow:e=>e.createdAt>=t,toRow:(e,t)=>({id:e.id,venue_id:t,ref:e.ref,customer_id:(0,ue.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:We(e.lines??[]),allergies:$e(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:We(e.allergyChain??{}),readiness:We(e.readiness??{}),allergy_ticks:We(e.allergyTicks??{}),handover_check:e.handoverCheck?We(e.handoverCheck):null,accepted:e.accepted?We(e.accepted):null,doc:We(e)}),fromRow:t=>t.doc&&'object'==typeof t.doc?{...t.doc,id:String(t.id),restaurantId:e,status:t.status??t.doc.status}:null,apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Ve(e){const t=je(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...X.useBlocks.getState().blocks,...X.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==Ue.getState().kind,filter:e=>e.gte('block_date',t),inWindow:e=>e.date>=t,toRow:(e,t)=>({id:e.id,venue_id:t,block_date:e.date,from_time:e.from,to_time:e.to,reason:e.reason??null,note:e.note??null,area_id:e.areaId??null,area_name:e.areaName??null,created_by:e.by,created_at:e.createdAt,doc:We(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,X.blockClock)(t.from_time)??a?.from,n=(0,X.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>X.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>X.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ge=null,Je='Main plan';function ze(e){const t=e=>We({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ee.useFloor.getState().plans[e]??(0,ee.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Te('floor.manage')||Te('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ge??(0,Oe.uuidFrom)(`plan:${a}`),venue_id:a,name:Je||'Main plan',is_active:!0,...t(e),updated_by:(0,Y.actorStamp)({isCar:Z.IS_CAR,kind:Ue.getState().kind,staffRef:Ue.getState().staffRef,fallback:Ke})}),fromRow:e=>(Ge=String(e.id),Je=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,Ae.withSeedBest)(e,t[0]):void 0;a&&ee.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ee.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Ze(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>te.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Te('stock.manage'),matchKey:e=>({key:e}),toRow:(e,t)=>({venue_id:t,key:e.key,name:e.name,plural:e.plural,unit:e.unit,low_at:e.lowAt,supplier_id:e.supplierId?(0,ue.isUuid)(e.supplierId)?e.supplierId:(0,Oe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),fromRow:e=>{return{key:e.key,name:e.name,plural:e.plural,unit:e.unit,lowAt:Number(e.low_at),icon:e.icon??'\u2022',sort:e.sort??0,active:!1!==e.active,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),lt.get(t)??t)}:{}};var t},apply:(t,a)=>te.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.get(e.key)??e),o=new Set(r.map(e=>e.key));return{items:{...s.items,[e]:[...r,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>te.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Ye=new Set,Xe=new Set;$.mutationQueue.onDone(e=>{'stock_events'===e.table&&Xe.add(e.rowKey)});const et=e=>Xe.has(e)||Ye.has(e),tt=()=>Te('*')||Te('staff.manage')||Te('recipes.edit')||Te('recipes.signoff'),at=()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write'));function st(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>te.useShellStore.getState().events.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,ue.isUuid)(t.id)&&!!(te.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write')),filter:e=>e.gte('at',t).order('at',{ascending:!1}),inWindow:e=>e.at>=t,toRow:(e,t)=>({id:e.id,venue_id:t,item:e.kind,delta:e.delta,reason:e.reason,undoes:e.undoes&&(0,ue.isUuid)(e.undoes)&&(et(e.undoes)||$.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Ye.add(String(t.id)),{id:String(t.id),rid:e,kind:t.item,delta:Number(t.delta),reason:t.reason,by:t.by_name??'',app:t.app??'',at:new Date(t.at).toISOString(),...t.undoes?{undoes:String(t.undoes)}:{}}),apply:(e,t)=>te.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>te.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function nt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(te.useShellStore.getState().server[e]?.counts??{}).map(([e,t])=>({item:e,quantity:t})),key:e=>e.item,rowKey:e=>String(e.item),syncable:()=>!1,writable:()=>!1,toRow:()=>({}),fromRow:e=>({item:String(e.item),quantity:Number(e.quantity)}),apply:(a,s)=>{t={...te.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;te.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Ye]}}}))},afterRead:()=>{te.useShellStore.getState().server[e]||te.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Ye]}}}))},subscribe:()=>()=>{}}}const it=new Set;function rt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ae.useCardStore.getState().cards.filter(t=>t.restaurantId===e).map(e=>({card:e,item:t.find(t=>t.id===e.menuItemId)}))},key:e=>e.card.id,rowKey:e=>String(e.id),syncable:t=>(0,ue.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Te('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Oe.photoPath)(a,s),t=ot(s.photo);t&&((0,ae.cachePhotoAs)(e,t),dt(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Oe.cardToRow)(s,a);return{...i,...r,doc:We({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(a.card))return null;const s=t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:new Date(t.signed_off_at).toISOString()}:null;return{card:{...a.card,id:String(t.id),restaurantId:e,signOff:s&&a.card.signOff?a.card.signOff:s,...t.photo_url?{photo:t.photo_url}:{}},item:a.item?{...a.item,restaurantId:e,signOff:(0,w.isAnchorage)(e)&&(0,w.demoActor)(a.item.signOff?.by)?null:a.item.signOff}:void 0}},supersededBy:(e,t)=>t.some(t=>t.card.menuItemId===e.card.menuItemId&&t.card.id!==e.card.id),apply:(e,t)=>{if(!Te('recipes.edit')&&t.length){const e=new Set(t);ae.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ae.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),r=t.cards.filter(e=>!a.has(e.id)&&(s.has(e.id)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=ae.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ot=e=>(0,ae.readLocalPhoto)(e);async function dt(e,t){if(!it.has(e)){it.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await De().storage.from(Oe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){it.delete(e),Ee({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const ut=new Map,ct=(0,T.create)(()=>({n:0}));(0,ae.setStoragePhotoResolver)(e=>{const t=ut.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ue.getState().mode?(t||(ut.set(e,{url:'',at:Date.now()}),De().storage.from(Oe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(ut.set(e,{url:t.signedUrl,at:Date.now()}),ct.setState(e=>({n:e.n+1})),ae.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const lt=new Map;const ft=(e,t)=>{const a=(0,ue.isUuid)(t)?t:(0,Oe.uuidFrom)(`sup:${e}:${t}`);return lt.set(a,t),a};function pt(e){return{name:'order_sheets',table:'suppliers',list:()=>se.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Te('suppliers.manage'),toRow:(e,t)=>({id:ft(t,e.id),venue_id:t,name:e.name||'Supplier',category:e.goods||null,contact:e.contact??null,phones:e.number?[e.number]:[],website:e.url||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,notes:e.notes||null,doc:{kind:'sheet',localId:e.id,sheet:We(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(lt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>se.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.get(e.id)??e),o=new Set(r.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...r,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>se.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,ue.isUuid)(e)?e:(0,Oe.uuidFrom)(`sup:${Ue.getState().venueId}:${e}`)})}}let gt=!1,mt=!1;const _t=new Map,St=new Map,ht=new Map,yt=new Map,wt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',vt=e=>'owner'===e?{role:'owner',level:'Owner'}:'manager'===e?{role:'manager',level:'Manager'}:'supervisor'===e?{role:'manager',level:'Supervisor'}:'head_chef'===e?{role:'staff',level:'Head Chef'}:{role:'staff',level:'Staff'},bt=(e,t)=>({...e,managerAccess:t}),kt=()=>({nickname:gt,display:mt}),It=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=bt({role:e.role,level:e.level??vt(wt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},kt())};const Rt=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ot=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},At=e=>{const t=de.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,c.isKitchenTeam)(t)},Ct=2e3;function Dt(e,t){return t||!e.length||e.length>=Ct?null:e=>(0,ue.isUuid)(e.id)}function Ut(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Dt(t,Te('rota.manage')):null,keepOnEmpty:()=>e&&!Te('rota.manage'),list:()=>de.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&_t.has(e.staffId)&&(Te('rota.manage')||At(e.staffId)),writable:()=>Te('rota.manage')||Te('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(Rt());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ot(e.start),end_time:Ot(e.end),published:!!e.published,doc:We(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Et(){const e=je(62),t=e=>Te('rota.manage')||e.staffId===Ue.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>de.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ue.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=je(2)&&e.staffId===Ue.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:We(e.breaks??[]),break_mins:e.breakMins??0,doc:We((0,v.privateAttendance)(u.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(u.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Tt(){const e=je(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>de.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&e.staffId===Ue.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ue.getState().kind,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,ue.isUuid)(e.attendanceId)?e.attendanceId:null,kind:e.kind,suggested_in:e.suggestedIn??null,suggested_out:e.suggestedOut??null,note:(e.note??'').slice(0,300)||null,status:'open',doc:We({...e,status:'open'})}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),date:String(e.work_date).slice(0,10),attendanceId:e.attendance_id?String(e.attendance_id):t.attendanceId,kind:e.kind,suggestedIn:e.suggested_in?new Date(e.suggested_in).toISOString():void 0,suggestedOut:e.suggested_out?new Date(e.suggested_out).toISOString():void 0,note:e.note??'',at:t.at??new Date(e.created_at).toISOString(),status:e.status,resolvedBy:e.resolved_by_name??void 0,resolvedAt:e.resolved_at?new Date(e.resolved_at).toISOString():void 0}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Nt(e){de.leaveRemote.decide=t=>!(!Te('rota.manage')||!(0,ue.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&($.mutationQueue.enqueue({table:'staff_leave',venueId:e,kind:'rpc',fn:'staff_leave_decide',rowKey:t.id,values:{p_id:t.id,p_status:t.status}}),!0),qe.push(()=>{de.leaveRemote.decide=null})}function Kt(e){de.timesheetRemote.send=(t,a)=>{if(!Te('rota.manage')||!(0,ue.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return $.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:We(s)}}),!0}const s=a;if('attendance_void'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&($.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:We(s.breaks??[]),p_reason:n,p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0},qe.push(()=>{de.timesheetRemote.send=null})}function Pt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('created_at',new Date(Date.now()-2592e6).toISOString()),inWindow:()=>!1,toRow:(e,t)=>{return{id:(a=e.id,(0,ue.isUuid)(a)?a:(0,Oe.uuidFrom)(`outbox:${a}`)),local_id:e.id,venue_id:t,channel:e.channel,kind:e.kind,to_address:e.to||'',to_name:e.toName||null,subject:e.subject??null,body:e.body,html:e.html??null,ref_type:e.refType,ref_id:(0,ue.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:We(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.useStore.setState(t=>{const a=new Set(t.outbox.map(e=>e.id));return{outbox:[...e.filter(e=>!a.has(e.id)),...t.outbox].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,300)}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const Mt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function xt(e,t){if(!Array.isArray(t))return;const a=t.filter(e=>e&&'string'==typeof e.id&&'string'==typeof e.date&&'string'==typeof e.title).map(t=>({...t,restaurantId:e,example:!1}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function qt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[We({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ee.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:Mt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Te('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...Bt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...Bt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...Bt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Lt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Lt=t.feature_flags??{},Bt=t.settings??{};const a=t.settings?.app?.restaurant;if(!a)return null;const s='string'==typeof t.settings?.whatsapp?t.settings.whatsapp:void 0;return s&&!a.settings?.whatsapp&&(a.settings={...a.settings,whatsapp:s}),We({restaurant:{...a,id:e},msgTemplates:t.settings?.ops?.msgTemplates??{},display:t.settings?.ops?.display??{},games:!1!==t.feature_flags?.games,...Array.isArray(t.settings?.app?.events)?{events:t.settings.app.events}:{}})},apply:t=>{const a=t[0];a&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,p.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&ee.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&xt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ee.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Lt=null,Bt=null;const jt=()=>new Date(Date.now()-2592e6).toISOString(),Ft=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>_t.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},$t=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,ve.dmId)(t[0],t[1]):null},Wt=()=>Ue.getState().perms.includes('*');function Ht(){const e=()=>Ue.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>de.useOwner.getState().chat.filter(e=>(0,ue.isUuid)(e.id)).map(e=>We({id:e.id,ch:e.ch,from:e.from,text:e.text,photo:e.photo,at:e.at,removed:!!e.removed})),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>!!Ft(t.ch)&&(t.from===e()||Wt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('created_at',jt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=jt(),toRow:(e,t)=>{const a=Ft(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:_t.get(e.from)??null;return{id:e.id,venue_id:t,channel:a,from_staff:s,body:e.text??null,photo:e.photo??null,removed:e.removed,created_at:e.at}},fromRow:e=>{const t=$t(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?We({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>de.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=$t(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=de.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,ve.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,be.soundAllowed)())try{(0,be.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Qt(e,t,a){const s=Ue.getState();if(!we.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=_t.get(e),i='*'===t?'*':Ft(t);if(n&&i)try{await De().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Vt(e){const t=Ue.getState().staffRef,a=t?_t.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await De().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':$t(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&de.useOwner.getState().chatMarkRead(t,i)}catch{}}function Gt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=U.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:We(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:We(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'break_rules'===e.kind?'break_rules':'reminder',doc:e.doc??{}}),apply:(t,a)=>U.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[e];const o=new Map(t.filter(e=>'reminder'===e.kind).map(t=>[t.id,{...t.doc,id:t.id,rid:e}])),d=s.reminders.filter(e=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>U.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function Jt(e){const t=je(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>U.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.reminderId)&&e.staffRef===Ue.getState().staffRef,writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('for_date',t).order('done_at',{ascending:!1}),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,reminder_id:e.reminderId,for_date:e.forDate,staff_ref:e.staffRef,staff_name:e.staffName.slice(0,80),done_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,reminderId:String(t.reminder_id),forDate:String(t.for_date).slice(0,10),staffRef:t.staff_ref??'',staffName:t.staff_name??'Team',at:new Date(t.done_at).toISOString()}),apply:(e,t)=>U.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>U.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function zt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Zt=e=>null==e||''===e?null:Number(e),Yt=e=>e.filter(e=>!e.startsWith('data:')),Xt=()=>Te('takings.view');function ea(e){const t=!Xt();return{name:'cash_ups',table:'cash_ups',list:()=>le.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,k.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,k.tradingDay)()&&!e.onServer),writable:()=>Te('wages.manage')||(0,b.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,k.tradingDay)()):e.gte('for_date',je(400)),...t?{inWindow:e=>e.date===(0,k.tradingDay)()}:{},toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:We(e.vals),cash_tips:'number'==typeof e.vals.cashTips?e.vals.cashTips:null,card_tips:'number'==typeof e.vals.cardTips?e.vals.cardTips:null,photos:Yt(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,date:String(t.for_date),vals:t.vals??{},photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>le.useCashUp.setState(s=>({cashUps:zt(s.cashUps,t.map(e=>{const t=s.cashUps.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function ta(e){return{name:'sales_reports',table:'sales_reports',list:()=>le.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Te('wages.manage')||(0,b.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:We(e.vals),categories:e.categories,photos:Yt(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,weekStart:String(t.week_start),vals:t.vals??{},categories:t.categories??[],photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>le.useCashUp.setState(s=>({sales:zt(s.sales,t.map(e=>{const t=s.sales.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function aa(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=le.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,le.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Te('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:We({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,le.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>le.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function sa(e){return{name:'day_tips',table:'day_tips',list:()=>le.useCashUp.getState().tips.filter(t=>t.rid===e).map(e=>({...e,id:e.date})),key:e=>e.id,rowKey:e=>String(e.for_date),syncable:()=>!1,writable:()=>!1,deletes:!1,filter:e=>e.gte('for_date',je(120)),toRow:()=>({}),fromRow:t=>({id:String(t.for_date),rid:e,date:String(t.for_date),total:Number(t.total),postedAt:String(t.posted_at),postedBy:t.posted_by??void 0}),apply:t=>le.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function na(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>le.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('wages.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,for_date:e.forDate??null,through_date:e.throughDate??null,amount:e.amount,reason:e.reason??null,by_name:e.by,at:e.at}),fromRow:t=>({id:String(t.id),rid:e,kind:'payout'===t.kind?'payout':'correction',forDate:t.for_date??void 0,throughDate:t.through_date??void 0,amount:Zt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>le.useCashUp.setState(s=>({pot:zt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function ia(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=le.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Te('wages.manage'),toRow:(e,t)=>({venue_id:t,show_today:e.showToday,show_pot:e.showPot,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'show',showToday:!1!==e.show_today,showPot:!1!==e.show_pot}),apply:t=>le.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function ra(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>ce.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:We(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ce.useNotifs.setState(s=>({items:zt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ce.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function oa(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=fe.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:We(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:We(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings')||Te('suppliers.order'),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'settings'===e.kind?'settings':'list',doc:e.doc??{}}),apply:(t,a)=>fe.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...pe.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:zt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function da(e){const t=()=>Te('venue.settings')||Te('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>fe.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,ue.isUuid)(a.id)&&(0,ue.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,fe.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ue.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:Ue.getState().staffRef)||null,doc:We(n),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),listId:String(t.list_id),status:t.status??'open',rid:e}),apply:(t,a)=>fe.useOrderLists.setState(s=>({items:zt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){const t=je(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>fe.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings')||Te('suppliers.order'),filter:e=>e.gte('finished_at',t).order('finished_at',{ascending:!1}).limit(300),toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,list_id:e.listId,finished_at:e.finishedAt,finished_by:e.finishedByName.slice(0,80),doc:We(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useOrderLists.setState(s=>({history:zt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function ca(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=ge.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:We(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Te('venue.settings'),toRow:(e,t)=>({venue_id:t,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'area',doc:e.doc??{}}),apply:t=>{const a=t[0];a&&ge.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>ge.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function la(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=he.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,he.libraryRowId)(e),kind:'library',doc:We({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,he.personRowId)(e,i),kind:'person',staffRef:i,doc:We({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=de.useOwner.getState().staff.find(e=>e.id===Ue.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=de.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ye.canEditTasks)(t,a)},writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,staff_ref:e.staffRef??null,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'library'===e.kind?'library':'person',staffRef:e.staff_ref??void 0,doc:e.doc??{}}),apply:t=>he.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,he.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>he.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function fa(e){const t=je(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>he.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ue.getState();return e.byRef===t.staffRef||Te('staff.manage')},writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('for_date',t),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffRef,task_id:e.taskId,for_date:e.forDate,ticked_by_ref:e.byRef,ticked_by_name:e.byName.slice(0,80),ticked_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,staffRef:String(t.staff_ref),taskId:String(t.task_id),forDate:String(t.for_date).slice(0,10),byRef:String(t.ticked_by_ref??''),byName:String(t.ticked_by_name??''),at:String(t.ticked_at)}),apply:(t,a)=>he.useDailyTasks.setState(s=>({ticks:zt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>he.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function pa(e,t=!1){const a=je(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ke.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ue.getState().kind||Te('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Oe.uuidFrom)(`soldout:${a}:${e.itemId}`),venue_id:a,item_id:e.itemId.slice(0,80),name:e.name.slice(0,120),is_on:e.on,marked_at:e.at,by_name:(e.by||'Staff').slice(0,80),clear_after:e.clearAfter??null,...t?{auto:!!e.auto,kept:!!e.kept}:{}}),fromRow:a=>({rid:e,itemId:String(a.item_id),name:String(a.name??''),on:!0===a.is_on,at:String(a.marked_at),by:String(a.by_name??''),clearAfter:a.clear_after?String(a.clear_after):void 0,...t?{auto:!0===a.auto,kept:!0===a.kept}:{}}),apply:(t,a)=>ke.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ke.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Ie.autoSync.soldOutRead.add(e)}}}function ga(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Ie.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:(0,Oe.uuidFrom)(`soldoutlink:${t}:${e.itemId}`),venue_id:t,item_id:e.itemId.slice(0,80),uses:e.uses.slice(0,10).map(e=>({key:String(e.key).slice(0,40),qty:Math.max(0,Math.min(99,Number(e.qty)||0))})),auto:!!e.auto,updated_at:e.at,updated_by:(e.by||'Staff').slice(0,80)}),fromRow:t=>({rid:e,itemId:String(t.item_id),uses:(Array.isArray(t.uses)?t.uses:[]).map(e=>({key:String(e.key??''),qty:Number(e.qty)||0})).filter(e=>e.key&&e.qty>0),at:String(t.updated_at??''),by:String(t.updated_by??''),...!0===t.auto?{auto:!0}:{}}),apply:(t,a)=>Ie.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>Ie.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Ie.autoSync.linksRead.add(e)}}}async function ma(e,t="*"){const a='*'===t?`table:${e}`:`table:${e}.${t}`;try{const s=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:n}=await Promise.race([De().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function _a(){const e=Ue.getState().venueId;if(e)try{const{data:t}=await De().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();ya.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const ha=new Map;const ya=(0,T.create)(()=>({live:!1,known:!1}));async function wa(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([De().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function va(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([De().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const ba=(e,t)=>We({id:String(e.id),venue:t,body:String(e.body??''),kind:'yesno'===e.kind?'yesno':'up',up:Number(e.up_count??0),yes:Number(e.yes_count??0),no:Number(e.no_count??0),hidden:!!e.hidden,reply:e.reply??void 0,replyAt:e.reply_at??void 0,postedOn:String(e.posted_on??'').slice(0,10)}),ka='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Ia(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>D.useHr.getState().questions.filter(t=>t.venue===e&&(0,ue.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>ba(t,e),filter:e=>e.gte('posted_on',new Date(Date.now()-10368e6).toISOString().slice(0,10)),apply:(e,t)=>{const a=new Set(t);D.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>D.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Ra(e,t){const a=(t,a,s)=>{$.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(D.hrRemote,{live:!0,checkout:t=>a('hr_checkout',t.token,{p_venue:e,p_day:t.day,p_token:t.token,p_morale:t.morale,p_staffing:t.staffing,p_question:t.question??null,p_kind:t.kind??'up',p_shout_to:t.shoutTo??null,p_shout_body:t.shoutBody??null}),post:(t,s,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),vote:(e,t,s)=>a('hr_vote',e,{p_question:e,p_token:t,p_vote:s}),moderate:(e,t,s)=>a('hr_moderate',e,{p_question:e,p_action:t,p_reason:s}),reply:(e,t)=>a('hr_reply',e,{p_question:e,p_reply:t}),trend:async(t,a,s)=>{try{const{data:t,error:n}=await De().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?null:(t??[]).map(e=>({day:String(e.day).slice(0,10),answers:Number(e.answers),morale:Number(e.morale),staffing:null==e.staffing?null:Number(e.staffing),short:Number(e.short),perfect:Number(e.perfect),over:Number(e.over)}))}catch{return null}},shouts:async(a,s)=>{try{const{data:a,error:n}=await De().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?null:(a??[]).map(e=>({id:String(e.id),venue:t,day:String(e.day).slice(0,10),to:String(e.to_name),body:e.body??void 0}))}catch{return null}},log:async()=>{try{const{data:a,error:s}=await De().from('hr_mod_log').select('id,question_id,action,reason,by_name,at').eq('venue_id',e).order('at',{ascending:!1}).limit(30);return s?null:(a??[]).map(e=>({id:String(e.id),venue:t,questionId:String(e.question_id??''),action:e.action,reason:e.reason??void 0,by:String(e.by_name??'A manager'),at:String(e.at)}))}catch{return null}},refresh:async()=>{try{const{data:a,error:s}=await De().from('hr_questions').select(ka).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||D.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>ba(e,t)))}catch{}}}),qe.push(()=>{Object.assign(D.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Oa='pair:v1',Aa='staff:v1',Ca='staff:rejoin:v1';async function Da(e){const t=u.IS_QUEUED_VENUE?'claim_'+u.VENUE_RID+'_invite':u.IS_GREENSIDE?'claim_greenside_invite':u.IS_ABBOTSFORD?'claim_abbotsford_invite':u.IS_KIRKTON?'claim_kirkton_invite':u.IS_WILDINGS?'claim_wildings_invite':u.IS_KIRKMICHAEL?'claim_kirkmichael_invite':u.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:Ke,p_device:(0,C.deviceId)()},s=await De().rpc(t,{...a,p_phone:(0,C.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?De().rpc(t,a):s}async function Ua(){if('display'===Ke||'customer'===Ke||me.PITCH)return'none';const e=await L.kv.get(Ca,null);if(!e)return'none';try{await Ta();const{data:t,error:a}=await Da(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ca),await L.kv.remove(Aa),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Aa,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await L.kv.remove(Ca),'refused')}catch{return'offline'}}const Ea=e=>/jwt|refresh|token|401|not authenticated|invalid claim|session/i.test(String(e?.message??e))&&!/fetch|network/i.test(String(e?.message??e));async function Ta(){Me();const{data:e}=await De().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await De().auth.signInAnonymously();if(!t)return;const a=429===t.status||/rate|too many/i.test(t.message);if(!a||e>=2){if(a)throw new Error('Too many people are connecting from this network right now. Wait a few minutes, or switch to mobile data, and open the link again.');throw t}Ee({message:'Lots of people are connecting at once. Trying again in a moment\u2026'}),await new Promise(t=>setTimeout(t,0===e?15e3:45e3))}}async function Na(e){if(me.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await Da(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,u.venueKey)(`cc-pending-invite:${Ke}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),await L.kv.set(Ca,e),Le&&ja(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ee({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ka='car:request:v1',Pa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function Ma(){await L.kv.remove(Oa),await L.kv.remove(Aa),await L.kv.remove(Ka),C.useSession.getState().meId&&C.useSession.getState().signOut()}async function xa(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Ta(),!0}catch{return!1}}const qa=async(e,t={})=>{if(me.PITCH)return(0,_e.pitchRpc)(e,t);const{data:a,error:s}=await De().rpc(e,t);if(s)throw s;return a};let La=null;async function Ba(){for(const e of qe)try{e()}catch{}qe=[],xe.forEach(e=>e.stop()),xe=[],La&&(clearInterval(La),La=null)}async function ja(){await Ba(),await Wa()}async function Fa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Ke||me.PITCH)return!1;try{Me();const{data:e}=await De().auth.getSession();if(e.session){const{error:e}=await De().auth.refreshSession();if(!e)return!0}if('display'===Ke)return!1;if(!await L.kv.get(Ca,null))return!1;if(e.session)try{await De().auth.signOut({scope:'local'})}catch{}return'ok'===await Ua()&&(ja(),!0)}catch{return!1}}(0,l.setSessionMender)(Fa);let $a=u.VENUE_RID;async function Wa(){try{const e='undefined'!=typeof navigator?navigator.storage:null;e?.persist&&e.persist()}catch{}try{const e='undefined'!=typeof window?window.CoverChargeNative:null;e&&'function'==typeof e.checkUpdate&&/CoverChargePhone\//.test(navigator.userAgent)&&e.checkUpdate()}catch{}const e=$a;try{if(Ee({mode:'connecting'}),await $.mutationQueue.load(),'customer'===Ke)return void await za(e);let t=await L.kv.get(Oa,null),a=await L.kv.get(Aa,null);if(Z.IS_CAR&&!t&&a){const e=(0,Y.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Oa,t)),await L.kv.remove(Aa),a=null,C.useSession.getState().meId&&C.useSession.getState().signOut()}if(u.IS_ISOLATED_VENUE&&(t&&!(0,u.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,u.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ee({mode:'display'===Ke?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await De().auth.getSession();if('display'!==Ke&&!Z.IS_CAR&&a&&!s.session){const t=await Ua();if('offline'===t)return Ee({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{$a===e&&ja()},6e4);'refused'===t&&a.staffRef&&C.useSession.getState().meId===a.staffRef&&C.useSession.getState().signOut(),a=await L.kv.get(Aa,null),({data:s}=await De().auth.getSession())}const n='display'===Ke||Z.IS_CAR?t:a;if(!s.session||!n)return void Ee({mode:'display'===Ke||Z.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await qa('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Ke||Z.IS_CAR?await L.kv.remove(Oa):(await L.kv.remove(Aa),await L.kv.remove(Ca)),'staff'===n.kind&&n.staffRef&&C.useSession.getState().meId===n.staffRef&&C.useSession.getState().signOut(),void Ee({mode:'display'===Ke||Z.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Ke?'This display was unpaired by a manager.':Z.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,P.isOnline)()||/fetch|network/i.test(String(t?.message)))Ee({mode:'offline'});else if(Ea(t)&&'display'!==Ke){const{error:t}=await De().auth.refreshSession();t&&'ok'===await Ua()&&setTimeout(()=>{$a===e&&ja()},500)}i=Ue.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ee({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Z.IS_CAR&&'staff'===n.kind&&n.staffRef&&C.useSession.getState().meId!==n.staffRef&&(C.useSession.getState().signIn(n.staffRef),de.useOwner.setState({staffAs:n.staffRef})),Z.IS_CAR&&(C.useSession.getState().meId&&C.useSession.getState().signOut(),de.useOwner.setState({previewRole:'owner'})),await Qa(n.venueId,e,n.kind)}catch(e){Ee({mode:'local',lastError:String(e?.message??e)})}}const Ha=new Set(['venues','staff','bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_items','stock_events','stock_counts','recipe_cards','suppliers','supplier_orders','rota_shifts','attendance','time_requests','game_scores','floor_live','chat_messages','venue_reminders','reminder_done']);async function Qa(e,a,s){if(!(0,u.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Z.IS_CAR&&'device'===s;await ks(a),qe.push(xs(e));try{const{data:t}=await De().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])ht.set(e.key,e.id),yt.set(e.id,e.key)}catch{}const i=[qt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>de.useOwner.getState().staff.map(It),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Te('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,kt()),toRow:(e,t)=>(0,F.staffRow)(e,t,kt(),e.managerAccess||e.ownerAccess?null:ht.get(wt(e))),fromRow:e=>{if(!e.external_ref)return null;_t.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ns.set(String(e.external_ref),e.avatar_path??null);const t=bt(vt(yt.get(String(e.role_id))),!0===e.manager_access);return(0,F.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},kt())},apply:e=>de.useOwner.setState(t=>{const a=new Map(e.map(e=>[e.id,e])),s=t.staff.map(e=>a.has(e.id)?{...e,...a.get(e.id)}:e),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ms()},onRemote:()=>{Ms()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=de.useOwner.getState(),t=ie.useSetup.getState().sites[$a]?.staffGrade??{};return e.staff.filter(e=>_t.has(e.id)).map(a=>We({id:a.id,hourly:e.hourly[a.id]??null,salaried:!!a.salaried,noTax:!!a.noTax,grade:t[a.id]||void 0}))},key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>_t.has(e.id),writable:()=>Te('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:_t.get(e.id),venue_id:t,hourly_rate:null==e.hourly?null:e.hourly/100,salaried:e.salaried,no_tax:e.noTax,pay_grade:e.grade??null}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?We({id:t,hourly:null==e.hourly_rate?null:Math.round(100*Number(e.hourly_rate)),salaried:!!e.salaried,noTax:!!e.no_tax,grade:e.pay_grade||void 0}):null},apply:e=>de.useOwner.setState(t=>{const a={...t.hourly},s=new Map(e.map(e=>[e.id,e]));for(const t of e)null==t.hourly?delete a[t.id]:a[t.id]=t.hourly;if(e.length){const t=ie.useSetup.getState().sites[$a],a={...t?.staffGrade??{}};let s=!1;for(const t of e)(a[t.id]||void 0)!==t.grade&&(s=!0,t.grade?a[t.id]=t.grade:delete a[t.id]);s&&ie.useSetup.getState().patch($a,{staffGrade:a})}return{hourly:a,staff:t.staff.map(e=>s.has(e.id)?{...e,salaried:s.get(e.id).salaried,noTax:s.get(e.id).noTax}:e)}}),subscribe:e=>{const t=de.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=ie.useSetup.subscribe((t,a)=>{t.sites[$a]?.staffGrade!==a.sites[$a]?.staffGrade&&e()});return()=>{t(),a()}}},He(a,!1),He(a,!0),Ve(a),ze(a),Qe(a),Ze(a),st(a),nt(a),pt(a),{name:'supplier_directory',table:'suppliers',list:()=>de.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,name:e.name||'Supplier',category:e.category,contact:e.contact||null,phones:e.phones.filter(Boolean),email:e.email||null,website:e.website||null,account_ref:e.account||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,doc:{kind:'directory',localId:e.id,supplier:We(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>de.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.supplierId),writable:()=>Te('suppliers.order')||Te('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Be(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:We(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},rt(a),Us(a)];Te('wages.view')&&i.push(Es(a)),n&&(i.push(Ut(!0),Et(),Tt(),Pt(a)),Kt(e)),n&&await ma('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>de.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&/^\d{4}-\d{2}-\d{2}$/.test(e.from)&&/^\d{4}-\d{2}-\d{2}$/.test(e.to)&&e.to>=e.from&&(e.staffId===Ue.getState().staffRef&&'pending'===e.status||Te('rota.manage')),writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffId,from_date:e.from,to_date:e.to,reason:(e.reason??'').slice(0,200)||null,status:e.status,doc:We(e)}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),from:String(e.from_date).slice(0,10),to:String(e.to_date).slice(0,10),reason:e.reason??t.reason??'Holiday',status:e.status,by:e.requested_by_name??t.by,decidedBy:e.decided_by_name??void 0}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{leave:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ha.add('staff_leave'),Nt(e));const o=n&&await va();if(we.useChatSync.setState({synced:o,checked:!0}),qe.push(()=>we.useChatSync.setState({synced:!1})),o&&i.push(Ht(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(ve.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>_t.has(e.id),writable:()=>Te('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:_t.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:_t.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>ve.useKitchenExtra.setState(a=>{const s={...a.extra};return t.forEach(e=>{delete s[e]}),e.forEach(e=>{s[e.id]=e.include}),{extra:s}}),subscribe:e=>ve.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ma('hr_questions')&&(i.push(Ia(a)),Ha.add('hr_questions'),Ra(e,a)),'guest'!==s&&'customer'!==Ke&&await ma('temp_readings')&&(i.push((0,Q.tempUnitsSpec)(oe.useSafety,tt),(0,Q.tempReadingsSpec)(oe.useSafety,at)),Ha.add('temp_units'),Ha.add('temp_readings')),'guest'!==s&&'customer'!==Ke&&await ma('cooksafe_records')&&(i.push((0,V.cooksafeSpec)(oe.useSafety,G.useCookSafe,oe.isSeedAccident,at)),Ha.add('cooksafe_records')),'guest'!==s&&await ma('sold_out_items')?(i.push(pa(a,await ma('sold_out_items','auto'))),Ha.add('sold_out_items')):Ie.autoSync.soldOutRead.add(a),'guest'!==s&&await ma('sold_out_links')?(i.push(ga(a)),Ha.add('sold_out_links')):Ie.autoSync.linksRead.add(a),U.useReminders.getState().ensure(a),'guest'!==s&&await wa()&&(i.push(Gt(a)),n&&i.push(Jt(a))),ce.useNotifs.getState().ensure(a),fe.useOrderLists.getState().ensure(a),n){gt=await ma('staff','nickname'),mt=await ma('staff','display_clock');const[e,t,s,n]=await Promise.all([ma('scheduled_notifications'),ma('order_lists'),ma('venue_clock_area'),ma('daily_tasks')]);he.useDailyTasks.getState().ensure(a),n&&(i.push(la(a),fa(a)),Ha.add('daily_tasks'),Ha.add('daily_task_ticks')),e&&(i.push(ra(a)),_a()),t&&i.push(oa(a),da(a),ua(a)),s&&i.push(ca(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&Ha.add(n)}if('guest'!==s&&await ma('day_tips')){i.push(sa(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ha.add(e);await ma('tips_pot_events')&&i.push(na(a),ia(a)),n&&(Xt()||(0,le.forgetPastTakings)(a,(0,k.tradingDay)()),i.push(ea(a),aa(a)),Ha.add('cash_ups'),Xt()&&(i.push(ta(a)),Ha.add('sales_reports')),t(r[76])(r[75],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Ut(),Et()),await ma('scheduled_notifications')&&i.push(ra(a)));let d=!1;const c=()=>{if(Z.IS_CAR&&n&&Te('recipes.edit'))return!0;const e=de.useOwner.getState().staff.find(e=>e.id===Ue.getState().staffRef);return!!e&&e.active&&Te('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&c()&&await ma('ingredient_prices')&&(i.push((0,S.gpSyncSpec)('ing',c)),Ha.add('ingredient_prices'),await ma('card_costs')&&(i.push((0,S.gpSyncSpec)('card',c)),Ha.add('card_costs')),await ma('kitchen_deliveries')&&(i.push((0,S.gpSyncSpec)('del',c)),Ha.add('kitchen_deliveries')),await ma('kitchen_stock_counts')&&(i.push((0,S.gpSyncSpec)('count',c)),Ha.add('kitchen_stock_counts'))),(0,Ce.specialsSyncOn)()&&'guest'!==s&&await ma('specials_boards')&&(i.push((0,Ce.specialsBoardSpec)(a,()=>Te('recipes.edit')||Te('floor.manage')||Te('*'))),Ha.add('specials_boards'));const l={onActivity:()=>Ee({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ee({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ee({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await qa('whoami')??[]).some(t=>t.venue_id===e))return void($a===a&&ja());for(const a of xe){if(a.spec.name!==t)continue;const{count:s,error:n}=await De().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ds()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||H.useTempSaves.getState().mark({id:t,table:e,why:Ss(e)??'this screen could not send it'})}};xe=i.map(t=>new J.EntityBridge(t,e,l)),await Promise.all(xe.map(e=>e.start()));let f=0;const p=async()=>{if(!(f&&Date.now()-f<6e4)){f=Date.now();try{await g()}finally{f=0}}},g=async()=>{if(n&&(0,P.isOnline)())try{const t=await qa('whoami');if(!t?.some(t=>t.venue_id===e))return void($a===a&&ja())}catch(e){if(Ea(e)){if(Z.IS_CAR)return void($a===a&&ja());const e=await Ua();return void('ok'!==e&&'refused'!==e||$a===a&&ja())}}let t=0;for(const[a,s]of xe.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(we.useChatSync.getState().error&&we.useChatSync.setState({error:void 0}),await Vt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&we.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,P.setOnline)(!0),Ee({mode:'live',lastSyncAt:e,lastServerAt:e}),$.mutationQueue.flush()}else Ee({mode:'offline'});if(!Te('wages.view')){const e=Ue.getState().staffRef;de.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([p(),new Promise(e=>setTimeout(e,3e4))]);const m=new Map;for(const e of xe)m.set(e.spec.table,[...m.get(e.spec.table)??[],e]);const _=[...m.keys()].filter(e=>Ha.has(e)).map(e=>({table:e,venueColumn:m.get(e)[0].spec.venueColumn}));let y=!1;const w=(0,J.venueChannel)(e,_,(e,t,a)=>{for(const s of m.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ee({lastSyncAt:s,lastServerAt:s})},e=>{Ee({realtime:e}),'SUBSCRIBED'===e?(y&&p(),y=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(y=!0)});qe.push(()=>{De().removeChannel(w)}),qe.push((0,P.onConnectivity)(e=>{e&&p()}));const v=xe.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),b=(0,M.superviseSync)({fastMs:Ga(Ke),readFast:async()=>{for(const e of v)await e.read()},readAll:p,flush:()=>{$.mutationQueue.flush()},wake:()=>{$.mutationQueue.retryNow()},restart:()=>{$a===a&&ja()},realtime:()=>Ue.getState().realtime,lastServerAt:()=>{const e=Ue.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,P.setOnline)(!0),Ee({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Ea,refreshAuth:async()=>{await De().auth.refreshSession()},heartbeat:()=>Va(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});qe.push(b.stop)}async function Va(e){const t=Ue.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await qa('sync_heartbeat',{p_venue:e,p_device:(0,C.deviceId)()??'unknown',p_app:Ke,p_version:q.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const Ga=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ue.getState(),queue:$.mutationQueue.pending.map(e=>e.table),failedTables:$.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),me.PITCH&&(window.__ccSyncPreview=e=>Ee(e)));const Ja='guest:sent:v1';async function za(e){Ee({kind:'guest',venueSlug:e,perms:[]});try{const t=(await qa('public_venue',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!u.IS_ISOLATED_VENUE||t.id===u.VENUE_UUID)){Ee({venueId:t.id,venueName:t.name}),await ks(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,p.withWildingsAddress)({...a,id:e}):t)})),xt(e,t.app?.events)}await Za(e),Ee({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ee({mode:(0,P.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Za(e).catch(()=>{})},6e4);qe.push(()=>clearInterval(t)),u.IS_ISOLATED_VENUE||await Ya(e)}async function Za(e){const t=await qa('public_menu',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ae.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}});try{const t=await qa('public_takeaway_menu',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function Ya(e){let t=await L.kv.get(Ja,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,ue.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,ue.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await xa())return;for(const a of n)try{const s=(await qa('guest_create_booking',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_booking:{...We(a),...(0,R.takeGuard)(a.id),allergies:$e(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&z.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Ee({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await qa('guest_create_takeaway',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_order:{...We(a),...(0,R.takeGuard)(a.id),allergies:$e(a.allergies)}}))?.[0];t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?es(e,s):e)}))}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ee({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ts(s)}}:e)})))}await L.kv.set(Ja,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await qa('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ja,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await qa('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.useStore.setState(e=>({bookings:e.bookings.map(e=>{const a=t.get(e.id);return a&&a.status&&a.status!==e.status&&'declined'!==a.status?{...e,status:a.status}:'declined'===a?.status&&'cancelled'!==e.status?{...e,status:'cancelled'}:e}),orders:e.orders.map(e=>{const a=t.get(e.id);if(!a)return e;const s=es(e,a);return Xa(s)===Xa(e)?e:s})})),Ee({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ee({mode:(0,P.isOnline)()?Ue.getState().mode:'offline'})}finally{a=!1}}};qe.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),La=setInterval(()=>{n()},15e3),as=()=>{n()},n()}const Xa=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function es(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ts=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let as=null;const ss={bridges:()=>xe,restart:ja};function ns(){const e=Ue.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Te('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function is(){const e=xe.find(e=>'stock_events'===e.spec.table);if(!e||ns())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&($.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function rs(){const e=xe.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}is();try{await $.mutationQueue.retryNow()}catch{}}Ue.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{rs()},3e3)});const os=['bookings','walk_ins'];function ds(){const e=Ue.getState();return Ne()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Te('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const us=()=>xe.filter(e=>os.includes(e.spec.table)),cs=e=>$.mutationQueue.failed.some(t=>os.includes(t.table)&&t.rowKey===e);function ls(e=!1){return ds()?0:us().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&cs(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function fs(e=!1){const t=ds();if(t)return t;for(const e of us())try{await e.read()}catch{}ls(e);try{await $.mutationQueue.retryNow()}catch{}return e&&ps(),null}function ps(){const e=us()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(us().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||cs(s)||os.some(t=>$.mutationQueue.hasPending(t,e,s))||t.clear(s)}$.mutationQueue.onFailed(e=>{os.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),$.mutationQueue.onDone(e=>{os.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let gs=null;const ms=(e=2500)=>{gs&&clearTimeout(gs),gs=setTimeout(()=>{gs=null,fs(!1)},e)};(0,P.onConnectivity)(e=>{e&&ms()}),Ue.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Te('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&ms(3e3)});const _s=['temp_readings','temp_units'];function Ss(e="temp_readings"){const t=Ue.getState();return Ne()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||tt()?'device'!==t.kind||Te('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const hs=()=>xe.filter(e=>_s.includes(e.spec.table));async function ys(e=!1){const t=Ss();if(t)return t;for(const e of hs())try{await e.read()}catch{}const a=hs()[0]?.venueId??'';for(const t of hs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,$.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await $.mutationQueue.retryNow()}catch{}if(e){const e=H.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=hs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||$.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,H.tempKey)(t.table,t.id))}}return null}$.mutationQueue.onFailed(e=>{_s.includes(e.table)&&H.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),$.mutationQueue.onDone(e=>{_s.includes(e.table)&&H.useTempSaves.getState().clear((0,H.tempKey)(e.table,e.rowKey))});let ws=null;const vs=(e=3e3)=>{ws&&clearTimeout(ws),ws=setTimeout(()=>{ws=null,ys(!1)},e)};(0,P.onConnectivity)(e=>{e&&vs()}),Ue.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Te('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&vs(3500)});const bs='golive:v1:';async function ks(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Cs(e):(await L.kv.get(bs+e,!1)||await Cs(e),await L.kv.get(Os+e,!1)||(As(e),await L.kv.set(Os+e,!0)),await L.kv.get(Is+e,!1)||(Rs(),await L.kv.set(Is+e,!0)))}const Is='golive:v3:';function Rs(){const e=e=>JSON.stringify(e).includes('(example)');try{re.useKitchen.setState(t=>({waste:t.waste.filter(t=>!e(t)),stockTakes:t.stockTakes.filter(t=>!e(t)),deliveries:t.deliveries.filter(e=>'dl-today-fish'!==e.id&&'dl-today-veg'!==e.id)}))}catch{}}const Os='golive:v2:';function As(e){const t=e=>JSON.stringify(e).includes('(example)');z.useStore.setState(t=>({customer:{...t.customer,name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}},stampCards:t.stampCards.filter(t=>t.restaurantId!==e),giftCards:t.giftCards.filter(t=>t.restaurantId!==e),ratings:t.ratings.filter(t=>t.restaurantId!==e),events:t.events.filter(t=>!(t.example&&(t.restaurantId===e||null===t.restaurantId)))})),de.useOwner.setState(e=>({referrals:[],coats:[],merchOrders:[],lost:[],customerTags:{},offers:e.offers.filter(e=>!t(e)),changeRequests:e.changeRequests.filter(e=>!t(e)),campaigns:e.campaigns.filter(e=>!t(e)),supplierOrders:e.supplierOrders.filter(e=>!t(e)),chat:e.chat.filter(e=>e.id.startsWith('m-seed-')).map((e,t)=>({...e,at:new Date(Date.now()-6e4*(5-t)).toISOString()}))}))}async function Cs(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,re.stripKitchenExamples)(re.useKitchen.getState()),s=de.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:oe.useSafety.getState().accidents.filter(e=>!(0,oe.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(re.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',re.useKitchen.getState()),re.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),de.useOwner.setState(n)),r(oe.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',oe.useSafety.getState()),oe.useSafety.setState(i));const o=(0,D.stripHrSamples)(D.useHr.getState());r(D.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',D.useHr.getState()),D.useHr.setState(o));const d=(0,S.stripGpSamples)(S.useGpCalc.getState());r(S.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',S.useGpCalc.getState()),S.useGpCalc.setState(d));const u=se.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),se.useOrderSheets.setState(c));const l=ae.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ae.useCardStore.setState(f)),void await L.kv.set(bs+e,!0)}const t=t=>t.restaurantId===e&&!(0,ue.isUuid)(t.id);z.useStore.setState(a=>({bookings:a.bookings.filter(e=>!t(e)),orders:a.orders.filter(e=>!t(e)),waitlist:a.waitlist.filter(t=>t.restaurantId!==e),walkIns:Object.fromEntries(Object.entries(a.walkIns).filter(([t])=>!t.includes(e)))})),X.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,ue.isUuid)(t.id))})),ee.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),de.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,ue.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,ue.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,ue.isUuid)(e.id)),leave:e.leave.filter(e=>(0,ue.isUuid)(e.id)),swaps:[]}));try{re.useKitchen.setState(e=>(0,re.stripKitchenExamples)(e))}catch{}de.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,ue.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.supplierId))}));try{oe.useSafety.setState(e=>({accidents:e.accidents.filter(e=>{return!String(e.id).startsWith('acc-ex')&&(t=e,!JSON.stringify(t).includes('(example)'));var t})}))}catch{}await L.kv.set(bs+e,!0)}const Ds=(e,t)=>We({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Us(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ee.useFloor.getState().live[e]??{}).map(([e,t])=>Ds(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ue.getState().kind||Te('device.write'),deletes:!1,matchKey:e=>({table_name:e}),toRow:(e,t)=>({venue_id:t,table_name:e.name,stage:e.stage??null,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note?e.note.slice(0,200):null,updated_by:(0,Y.actorStamp)({isCar:Z.IS_CAR,kind:Ue.getState().kind,staffRef:Ue.getState().staffRef,fallback:Ke})}),fromRow:e=>Ds(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ee.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>ee.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Es(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(ie.useSetup.getState().sites[e]?.grades??ie.DEFAULT_GRADES).map((e,t)=>({id:e.id,name:e.name,pence:e.pence,sort:t})),key:e=>e.id,rowKey:e=>String(e.grade_id),syncable:e=>!!e.id&&!!e.name,writable:()=>Te('wages.manage'),matchKey:e=>({grade_id:e}),toRow:(e,t)=>({venue_id:t,grade_id:e.id,name:e.name.slice(0,60),pence:Math.max(0,Math.min(1e5,Math.round(e.pence))),sort:e.sort}),fromRow:e=>({id:String(e.grade_id),name:String(e.name),pence:Number(e.pence),sort:Number(e.sort??0)}),apply:(t,a)=>{if(!t.length&&!a.length)return;const s=ie.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));ie.useSetup.getState().patch(e,{grades:i})},subscribe:t=>ie.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ts='staff-avatars',Ns=new Map;let Ks=!1;const Ps=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ms(){if(!Ks){Ks=!0;try{for(const[e,t]of Ns){const a=ne.useAvatars.getState().photos[e];if(!t){a?.path&&ne.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ue.getState().staffRef)continue;const{data:s,error:n}=await De().storage.from(Ts).download(t);if(n||!s)continue;const i=await Ps(s);i.startsWith('data:image/')&&ne.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ks=!1}}}function xs(e){const t=async()=>{const t=Ue.getState().staffRef,a=t?_t.get(t)??Ue.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ue.getState().kind)return;const s=ne.useAvatars.getState().photos[t];try{const n=Ns.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&De().storage.from(Ts).remove([t]).catch(()=>{})};if(!s){const e=!!ne.useAvatars.getState().clears?.[t];return e&&n&&(await qa('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ns.set(t,null),i(n)),void(e&&ne.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ee({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===r.type?'jpg':'image/webp'===r.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await De().storage.from(Ts).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await qa('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ns.set(t,d),n!==d&&i(n),ne.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ee({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ne.useAvatars.getState().photos},s=ne.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Te('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ue.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ns.set(t,null),ne.useAvatars.getState().doneClear(t),qa('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>De().storage.from(Ts).remove([e])).catch(()=>{})}});return t(),s}const qs=new Map,Ls=(0,T.create)(()=>({n:0}))},824,{"0":836,"1":1269,"2":5,"3":1270,"4":1171,"5":6,"6":1194,"7":842,"8":1195,"9":1198,"10":1167,"11":808,"12":864,"13":1085,"14":869,"15":1048,"16":1050,"17":980,"18":816,"19":1274,"20":13,"21":866,"22":1276,"23":998,"24":1183,"25":995,"26":872,"27":1170,"28":1279,"29":1169,"30":1045,"31":1044,"32":1268,"33":1281,"34":1280,"35":1284,"36":1075,"37":1285,"38":1286,"39":1287,"40":1288,"41":1290,"42":1166,"43":881,"44":807,"45":977,"46":828,"47":829,"48":1087,"49":1168,"50":1088,"51":1225,"52":1096,"53":1291,"54":1180,"55":863,"56":1099,"57":997,"58":1049,"59":1058,"60":1293,"61":1294,"62":2,"63":1295,"64":1181,"65":1182,"66":1296,"67":1192,"68":946,"69":942,"70":982,"71":1218,"72":1179,"73":1070,"74":877,"75":1076,"76":29,"paths":{}}); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"colours",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"font",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return A}}),e.brandColour=function(I,S=F.gold){const r=/^#([0-9a-f]{6})$/i.exec(I??'');if(!r)return S;const _=parseInt(r[1],16),t=(_>>16)/255,E=(_>>8&255)/255,n=(255&_)/255,o=Math.max(t,E,n),A=Math.min(t,E,n),l=o-A;if(l<.12)return I;const D=o===t?((E-n)/l+6)%6*60:o===E?60*((n-t)/l+2):60*((t-E)/l+4);return D>65&&D<320?S:I};var I=_r(_d[0]),S=_r(_d[1]),r=_r(_d[2]),_=_r(_d[3]),t=_r(_d[4]),E=_r(_d[5]);const F={bg:I.IS_SOUTERS?'#56152A':I.IS_WILDINGS?'#272A2F':'#0B0B0B',surface:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#141414',surface2:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#363A42':'#1D1C1A',border:I.IS_SOUTERS?'#87435B':I.IS_WILDINGS?'#50545C':'#34302A',gold:I.IS_WILDINGS?'#FFE3A5':I.IS_KIRKMICHAEL?'#B87754':I.IS_SOUTERS?'#A4622E':'#CFA45F',goldLight:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',goldTint:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',goldMuted:I.IS_WILDINGS?'#DDC694':I.IS_KIRKMICHAEL?'#C2937A':I.IS_SOUTERS?'#C18F67':'#BFA06C',hairline:'rgba(255,255,255,0.09)',tile:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#18171A',tilePressed:I.IS_SOUTERS?'#64223B':I.IS_WILDINGS?'#393D45':'#211F1C',accentBg:I.IS_WILDINGS?'rgba(255,227,165,0.13)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.13)':I.IS_SOUTERS?'rgba(164,98,46,0.13)':'rgba(207,164,95,0.13)',accentBorder:I.IS_WILDINGS?'rgba(255,227,165,0.38)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.38)':I.IS_SOUTERS?'rgba(164,98,46,0.38)':'rgba(207,164,95,0.38)',text:'#F5F1E8',muted:'#B8B0A0',onGold:I.IS_WILDINGS?'#272A2F':I.IS_KIRKMICHAEL?'#0B0B0B':I.IS_SOUTERS?'#FFFFFF':'#0B0B0B',red:'#FF6B5E',redBg:'#4A1310',redSolid:'#C62F22',amber:'#FFB547',amberBg:'#3F2C05',shellfishFree:'#6EC470',ok:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',okBg:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',blue:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',blueBg:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#39352C':'#1E1A12',...I.IS_GREENSIDE?r.GREENSIDE_PALETTE:{},...I.IS_QUEUED_VENUE?S.QUEUED_PALETTE:{},...I.IS_KIRKTON?t.KIRKTON_PALETTE:{},...I.IS_ABBOTSFORD?_.ABBOTSFORD_PALETTE:{}},n={regular:'Poppins_400Regular',medium:'Poppins_500Medium',semibold:'Poppins_600SemiBold',bold:'Poppins_700Bold'},o={small:E.type.small,body:E.type.body,large:E.type.large,title:E.type.title,hero:E.type.hero},A={s:E.radii.s,m:E.radii.m,l:E.radii.l}},825,[5,1342,1193,1343,1344,1345]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},826,[240]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.templatesFor=function(t){const n={...r.DEFAULT_TEMPLATES};for(const o of Object.keys(r.DEFAULT_TEMPLATES))n[o]={...r.DEFAULT_TEMPLATES[o],...t?.[o]??{}};return n},e.composeBooking=function(t,n,o,c,u){if(n.walkIn)return[];return s(t,'booking-confirmation'===t?'booking':'booking-request'===t?'request':'declined',(0,r.bookingVars)(n,o),{phone:n.phone,email:n.email,name:n.name},{refType:'booking',refId:n.id,ref:n.ref},o,c,u)},e.composeOrder=function(t,n,o,c){return'takeaway'!==t.type?[]:s('order-confirmation','order',(0,r.orderVars)(t,n),{phone:t.phone,email:t.email,name:t.customerName},{refType:'order',refId:t.id,ref:t.ref},n,o,c)},e.deliverQueued=async function(r,n){if(!(0,t.isLive)())return;const o=(0,t.activeProvider)();for(const t of r){const r=await o.deliver(t);n(t.id,r.ok?{status:'sent'}:{status:'failed',error:r.error})}},e.statusLabel=function(t){const r='sms'===t.channel?'Text':'Email';return'preview'===t.status?`${r}: Ready (preview mode)`:'queued'===t.status?`${r}: Sending\u2026`:'sent'===t.status?`${r} sent`:`${r}: Not sent (failed)`},Object.defineProperty(e,"PREVIEW_BANNER",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);Object.keys(t).forEach(function(r){'default'===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})});var r=_r(d[1]);Object.keys(r).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var n=_r(d[2]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=()=>`msg-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-4)}`;function s(s,c,u,l,f,m,p,b){const y=[],v=(0,t.isLive)()?'queued':'preview',h=(0,t.activeProvider)().id,E=(0,n.guestPhone)(l.phone);if(E.ok&&y.push({id:o(),restaurantId:m.id,at:b,channel:'sms',kind:s,to:E.pretty,toName:l.name,body:(0,r.toGsm)((0,r.fill)(p[c].sms,u.sms)),...f,status:v,provider:h}),l.email?.trim()){const t=(0,r.fillEmailText)(p[c].body,u.email),n=(0,r.fill)(p[c].subject,u.email);y.push({id:o(),restaurantId:m.id,at:b,channel:'email',kind:s,to:l.email.trim(),toName:l.name,subject:n,body:t,html:(0,r.emailHtml)(t,{venue:m.name,preheader:n}),...f,status:v,provider:h})}return y}const c='Preview mode, not sent yet. Connect a text and email service to go live.'},827,[1214,1215,1216]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCK_REASONS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return m}}),_e.blockClock=function(e){if('string'==typeof e){const t=/(\d{1,2}):(\d{2})/.exec(e);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}return e instanceof Date&&!Number.isNaN(e.getTime())?`${String(e.getHours()).padStart(2,'0')}:${String(e.getMinutes()).padStart(2,'0')}`:void 0},Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return k}}),_e.blockedTablesAt=v,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return M}}),_e.closedAreasAt=function(e,t,o,n){const a=(0,u.toMins)(n),s=p(e,t,o).filter(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).map(e=>e.areaId);return new Set([...s,...[...v(e,t,o,n)].map(M)])},_e.blockAt=S,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,u.toMins)(e.to)>(0,u.toMins)(n))).sort((e,t)=>e.date===t.date?(0,u.toMins)(e.from)-(0,u.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o={...t,id:(0,a.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,a.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)}))},remove:(t,o)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>{const n=e.blocks.find(e=>e.id===t);return n?{blocks:e.blocks.filter(e=>e.id!==t),removed:[...e.removed,{...n,removedAt:(new Date).toISOString(),removedBy:o??n.by}]}:e})},put:t=>e(e=>{const o=e.blocks.filter(e=>e.id!==t.id),n=e.removed.filter(e=>e.id!==t.id);return t.removedAt?{blocks:o,removed:[...n,t]}:{blocks:[...o,t],removed:n}})}),{name:'covercharge-blocks-v1',storage:(0,c.createJSONStorage)(()=>n.default),version:2,migrate:e=>{const t=e??{};return{blocks:t.blocks??[],removed:t.removed??[]}}}));const k=e=>!e.areaId&&!e.tables?.length;function v(e,t,o,n){const a=(0,u.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).flatMap(e=>e.tables))}const O=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&k(e)).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),p=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),M=e=>`tbl:${e}`;function S(e,t,o,n){const a=(0,u.toMins)(n);return O(e,t,o).find(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to))}const $=(e,t,o,n)=>S(e,t,o,n),h=e=>e.privateFunction?`${e.privateFunction.title} \xb7 ${e.privateFunction.covers} Covers \xb7 ${e.areaName??'Whole venue'} \xb7 until ${e.to}`:e.tables?.length?`${e.tables.map(t.tableNumbers).join(', ')} blocked until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:e.areaId?`${e.areaName??'Area'} closed until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:`Bookings paused until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`,y=(e,t)=>{const o=m(e=>e.blocks);return O(o,e,t)}},828,[812,1190,1099,995,1191,822,992,1175]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SETTINGS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"seedPlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useFloor",{enumerable:!0,get:function(){return p}}),_e.hashOldPins=f,Object.defineProperty(_e,"usePlan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useDisplaySettings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"planOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j}}),_e.tablesLabel=v,_e.tableCardLabel=function(e){return(0,t.withTableWord)(v(e))},Object.defineProperty(_e,"joinTables",{enumerable:!0,get:function(){return S}});var e,n=r(d[0]),t=r(d[1]),a=r(d[2]),s=(e=a)&&e.__esModule?e:{default:e},i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});const u={privacy:!0,idleMins:2,pinOn:!1,...i.DEFAULT_WAKE,tonightCards:!0},b=e=>'souters'===e||n.IS_ISOLATED_VENUE&&'souters'===n.VENUE_RID?{areas:[{id:'su-restaurant',name:'Restaurant'},{id:'su-bar',name:'Bar'},{id:'su-mezzanine',name:'Mezzanine / private dining'},{id:'su-garden',name:'Beer garden',outdoor:!0},{id:'su-icecream',name:'Ice cream & cake corner'}],tables:[],joins:[],sections:[],fixtures:[]}:'kirkmichael'===e||n.IS_ISOLATED_VENUE&&'kirkmichael'===n.VENUE_RID?{areas:[{id:'km-restaurant',name:'Restaurant'},{id:'km-bar',name:'Bar'},{id:'km-private',name:'Private dining',label:'The Room (about 18 covers) \u2014 table plan to confirm'}],tables:[],joins:[],sections:[],fixtures:[]}:['wildings','greenside'].includes(e)||n.IS_ISOLATED_VENUE?{areas:[],tables:[],joins:[],sections:[],fixtures:[]}:'anchorage'===e?(0,c.anchoragePlan)():(0,c.starterPlan)(),p=(0,l.create)()((0,o.persist)((e,t)=>{const a=e=>t().plans[e]??b(e);return{plans:n.IS_ISOLATED_VENUE?{[n.VENUE_RID]:b(n.VENUE_RID)}:{anchorage:(0,c.anchoragePlan)()},live:{},settings:{},smsLog:[],setPlan:(n,t)=>e(e=>({plans:{...e.plans,[n]:t}})),updateTable:(n,t,s)=>{const i=a(n);e(e=>({plans:{...e.plans,[n]:{...i,tables:i.tables.map(e=>e.id===t?{...e,...s}:e)}}}))},addTable:(n,t)=>{const s=a(n);e(e=>({plans:{...e.plans,[n]:{...s,tables:[...s.tables,t]}}}))},removeTable:(n,t)=>{const s=a(n),i=s.tables.find(e=>e.id===t);e(e=>({plans:{...e.plans,[n]:{...s,tables:s.tables.filter(e=>e.id!==t),joins:s.joins.filter(e=>!i||!e.tables.includes(i.name))}}}))},setLive:(n,t,a)=>e(e=>({live:{...e.live,[n]:{...e.live[n]??{},[t]:{...e.live[n]?.[t]??{},...a}}}})),setSettings:(n,t)=>e(e=>({settings:{...e.settings,[n]:{...u,...e.settings[n]??{},...t}}})),logSms:(n,t,a)=>e(e=>{return{smsLog:[{id:(s='sms',`${s}-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`),rid:n,at:t,text:a},...e.smsLog].slice(0,50)};var s}),resetPlan:n=>e(e=>({plans:{...e.plans,[n]:b(n)}}))}},{name:'covercharge-floor-v1',version:6,storage:(0,o.createJSONStorage)(()=>s.default),migrate:(e,n)=>{const t=e??{};let a=t;if(n<2){const e={};for(const[n,a]of Object.entries(t.plans??{}))e[n]='anchorage'===n?(0,c.anchoragePlan)():(0,c.normalisePlan)(a);e.anchorage=(0,c.anchoragePlan)(),a={...t,plans:e,live:{}}}else if(n<3)a={...t,plans:{...t.plans??{},anchorage:(0,c.anchoragePlan)()}};else if(n<4){const e=t.plans?.anchorage;e&&(a={...t,plans:{...t.plans,anchorage:{...e,joins:(e.joins??[]).filter(e=>!(2===e.tables.length&&e.tables.includes('1')&&e.tables.includes('2')))}}})}return n<5&&(a={...a,settings:f(a.settings)}),n<6&&a.plans?.anchorage&&(a={...a,plans:{...a.plans,anchorage:(0,c.withSeedBest)('anchorage',a.plans.anchorage)}}),a}}));function f(e){const n={};for(const[t,a]of Object.entries(e??{})){const{pin:e,...s}=a??{};n[t]={...u,...s,...'pinHash'in s?{}:(0,i.fromOldPin)(e)}}return n}const h=e=>p(n=>n.plans[e])??E(e),N={};function E(e){return N[e]??=b(e)}const O=e=>{const n=p(n=>n.settings[e]);return n?{...u,...n}:u},P=e=>p.getState().plans[e]??E(e),j=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[];function v(e){const n=j((0,t.tableNumbers)(e));if(!n.length)return'';if(1===n.length)return n[0];const a=n.map(e=>/^\d+$/.test(e)?Number(e):NaN),s=a.every(e=>!Number.isNaN(e))?[...n].sort((e,n)=>Number(e)-Number(n)):n;return a.every(e=>!Number.isNaN(e))&&s.length>=3&&s.every((e,n)=>0===n||Number(e)===Number(s[n-1])+1)?`${s[0]}\u2013${s[s.length-1]}`:s.join(' + ')}const S=e=>[...new Set(e)].sort((e,n)=>/^\d+$/.test(e)&&/^\d+$/.test(n)?Number(e)-Number(n):e.localeCompare(n)).join('+')},829,[5,812,1190,986,995,1191,1070]); +__d(function(_g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STATUS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"STAGE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"turnFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"startOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"durOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"endOf",{enumerable:!0,get:function(){return f}}),e.clashes=function(a,s=90){const n=new Set,l=a.filter(t=>g(t)&&t.table);for(let a=0;a(0,t.tablesOf)(d.table).includes(a))&&(u(o)t.date===n&&!['cancelled','noshow'].includes(t.status)).sort((t,a)=>t.time.localeCompare(a.time));for(const s of a.tables){const a=i.filter(a=>(0,t.tablesOf)(a.table).includes(s.name)),n=a[0],o=(0,t.tablesOf)(n?.table);l[s.name]={table:s,status:n?'soon':'free',next:n,covers:n?.partySize??0,dayBookings:a.length?a:void 0,group:o.length>1?o:void 0,allergy:!(!n?.allergies?.length&&!n?.allergyNote),vip:n?.tags?.find(t=>'VIP'===t)??n?.tags?.find(t=>'Regular'===t),occasion:n?.occasion??h(n?.notes)}}return l},e.floorView=function(a,n,l,i,o,d=90,c){const b={},g=n.filter(t=>t.date===S(o));for(const n of a.tables){const a=i[n.name]??{},y=g.filter(a=>(0,t.tablesOf)(a.table).includes(n.name)),S=y.find(t=>'seated'===(0,s.shownStatus)(t)),v=y.filter(t=>'confirmed'===t.status).sort((t,a)=>t.time.localeCompare(a.time)).find(t=>O(o,t)>=-20),T=v?Math.round(O(o,v)):void 0,w=S?void 0:p(y,o,d),F=l.find(t=>'table'===t.type&&t.tableNo===n.name&&!['closed','cancelled','collected'].includes(t.status));let j='free';a.blocked?j='blocked':S?j=a.stage??'seated':!c?.has(n.areaId)&&!c?.has(`tbl:${n.name}`)||F?a.dirty?j='dirty':F?j=a.stage??'seated':v&&(j='soon'):j='blocked';const A=S,P=A?.tags?.find(t=>'VIP'===t)??A?.tags?.find(t=>'Regular'===t)??(A?void 0:v?.tags?.[0]);b[n.name]={table:n,status:j,booking:A,next:v,due:w,nextIn:T,covers:A?.partySize??0,group:(()=>{const a=(0,t.tablesOf)((A??('soon'===j?v:void 0))?.table);return a.length>1?a:void 0})(),orderOnly:!A&&!!F,note:a.note,seatedMins:A?Math.max(0,Math.round((o.getTime()-u(A).getTime())/6e4)):void 0,freeAt:A?f(A,d):void 0,allergy:!!(A?.allergies?.length||A?.allergyNote||!A&&(v?.allergies?.length||v?.allergyNote)||F?.allergies?.length),vip:P,occasion:A?.occasion??(A?void 0:v?.occasion??h(v?.notes))??h(A?.notes)}}return b},e.dueOnTable=p,Object.defineProperty(e,"OCCASION_ICON",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"tableAllowed",{enumerable:!0,get:function(){return v}}),e.suggestTable=function(s,n,l,i,o,d,c=90,b,p){const h=[...s.tables.map(t=>({name:t.name,seats:t.maxSeats,min:t.minSeats,parts:[t.name]})),...s.joins.map(t=>{const a=s.tables.filter(a=>t.tables.includes(a.name));return{name:t.tables.join('+'),seats:a.reduce((t,a)=>t+a.maxSeats,0),min:a.reduce((t,a)=>t+a.minSeats,0),parts:t.tables}})].filter(t=>t.parts.every(t=>v(s,t,p))),y=o.getTime()+6e4*d,O=new Set((0,a.bestTables)(s));let S=null;for(const a of h){if(a.seats['blocked'].includes(l[t]?.status)))continue;const s=!!l&&a.parts.some(t=>['seated','mains','dessert','bill','dirty'].includes(l[t]?.status)),d=n.filter(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()o.getTime()).length,p=1===a.parts.length&&O.has(a.parts[0])?12:0,h=(s?1e3:0)+100*d+10*(a.seats-i)+(i({name:t.name,seats:t.maxSeats,parts:[t.name]})),...s.joins.map(t=>({name:t.tables.join('+'),seats:s.tables.filter(a=>t.tables.includes(a.name)).reduce((t,a)=>t+a.maxSeats,0),parts:t.tables}))].filter(t=>t.seats>=l&&t.parts.every(t=>v(s,t,c))).filter(a=>!n.some(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()i.getTime())),y=new Set((0,a.bestTables)(s)),O=t=>1===t.parts.length&&y.has(t.parts[0])?0:1;return h.sort((t,a)=>t.seats-a.seats||t.parts.length-a.parts.length||O(t)-O(a)).map(t=>({table:t.name,seats:t.seats,area:s.areas.find(a=>a.id===s.tables.find(a=>a.name===t.parts[0])?.areaId)?.name??''}))},e.seatedPartiesAt=function(a,s,n){return s.filter(s=>s.date===n&&'seated'===s.status&&(0,t.tablesOf)(s.table).includes(a))},Object.defineProperty(e,"unseatStatus",{enumerable:!0,get:function(){return T}});var t=r(_d[0]),a=r(_d[1]),s=r(_d[2]);const n={colour:'#3A2F1E',fg:'#F1DDB0'},l={colour:'#CFA45F',fg:'#0B0B0B'},i={free:{label:'Free',...n},soon:{label:'Booked later',colour:'#9A3050',fg:'#FFF6F0'},seated:{label:'Seated',...l},mains:{label:'Seated',...l},dessert:{label:'Seated',...l},bill:{label:'Seated',...l},dirty:{label:'Needs clearing',colour:'#6E6555',fg:'#FFFFFF'},blocked:{label:'Blocked',...n}},o={seated:'Seated',mains:'Mains',dessert:'Dessert',bill:'Bill requested'},d=['seated','mains','dessert','bill'],c=(t,a=90)=>Math.min(a+60,a+15*Math.max(0,Math.ceil((t-2)/2))),u=t=>'seated'===(0,s.shownStatus)(t)&&t.seatedAt?new Date(t.seatedAt):new Date(`${t.date}T${t.time}:00`),b=(t,a=90)=>t.durationMins??c(t.partySize,a),f=(t,a=90)=>new Date(u(t).getTime()+6e4*b(t,a)),g=t=>!['cancelled','noshow','finished'].includes(t.status);function p(t,a,s=90){return t.filter(t=>'confirmed'===t.status&&O(a,t)<=45&&-O(a,t)t.time.localeCompare(a.time))[0]}const h=t=>t?/birthday/i.test(t)?'birthday':/anniversary/i.test(t)?'anniversary':void 0:void 0,y={birthday:'\ud83c\udf82',anniversary:'\ud83d\udc9d',celebration:'\ud83e\udd42'},O=(t,a)=>(new Date(`${a.date}T${a.time}:00`).getTime()-t.getTime())/6e4,S=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,v=(t,a,s)=>{const n=t.tables.find(t=>t.name===a);if(!n)return!1;const l=t.areas.find(t=>t.id===n.areaId);return!(s?.dog&&!(void 0!==n.dogOk?n.dogOk:l?.dogs))&&(!s?.closed?.has(n.areaId)&&!s?.closed?.has(`tbl:${n.name}`))};const T=t=>t.walkIn?'cancelled':'confirmed'},830,[829,1070,832]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"emptyNeeds",{enumerable:!0,get:function(){return w}}),_e.needsMissing=function(e,l=[]){const s=[];null===e.allergy?s.push('Answer the allergy question first'):'yes'!==e.allergy||e.allergens.length||l.length||e.allergyNote.trim()||s.push('Pick the allergens or describe them');null===e.dog&&s.push('Say whether a dog is coming');return s},_e.needsPatch=function(e,l=[]){const s='yes'===e.allergy?e.allergens.filter(e=>!l.some(l=>l.allergen===e)).map(l=>({allergen:l,severity:e.severity})):[],t=Object.entries(e.holds).filter(([,e])=>e>0).map(([e,l])=>{const s=e.indexOf(':');return{kind:e.startsWith('item:')?'item':'stock',id:s>=0?e.slice(s+1):e,qty:l}}),a=e.dog?Math.max(1,e.dogs):0,n={...e.wheelchair?{wheelchair:e.wheelchair}:{},...e.stepFree?{stepFree:!0}:{},...e.toilet?{toilet:!0}:{},...e.assistDog?{assistDog:!0}:{},...e.accessNote.trim()?{note:e.accessNote.trim()}:{}},r={...e.vegan?{vegan:e.vegan}:{},...e.vegetarian?{vegetarian:e.vegetarian}:{}};return{allergies:[...l,...s],allergyNone:'none'===e.allergy&&!l.length||void 0,allergyPeople:'yes'===e.allergy?e.allergyPeople:void 0,allergyNote:'yes'===e.allergy&&e.allergyNote.trim()?e.allergyNote.trim():void 0,dog:a>0,dogs:a||void 0,access:Object.keys(n).length?n:void 0,diet:Object.keys(r).length?r:void 0,holds:t.length?t:void 0,tableReq:e.tableReq.length?e.tableReq:void 0}},_e.FirstQuestions=function({rid:e,value:l,onChange:a,party:r,audience:i,profile:o=[]}){const y=e=>a({...l,...e}),b=(0,p.usePlan)(e),[x,j]=(0,t.useState)(!1),k=(0,s.dogQuestionOn)((0,u.useRestaurant)(e));(0,t.useEffect)(()=>{k||null!==l.dog||a({...l,dog:!1})},[k,l.dog]);const w=x?m.ALLERGENS:m.ALLERGENS.filter(e=>['gluten','milk','peanuts','treenuts','crustaceans','molluscs','fish','eggs','sesame'].includes(e.id)||l.allergens.includes(e.id)),q=[...o.map(e=>e.allergen),...l.allergens],M=(0,f.dogSetUp)(b);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(R,{tone:"red",testID:"q-allergens",children:[(0,v.jsx)(C,{sub:'guest'===i?'We ask everyone first, so the kitchen can keep you safe.':'Ask every guest first. It goes to the kitchen in red.',children:"\u26a0\ufe0f Does anyone in the party have a food allergy?"}),o.length?(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(e=>(0,v.jsx)(h.Badge,{kind:"red",label:`${m.ALLERGENS.find(l=>l.id===e.allergen)?.short} (from your profile)`},e.allergen))}):null,(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No allergies",selected:'none'===l.allergy,onPress:()=>y({allergy:'none',allergens:[]})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes, allergies",selected:'yes'===l.allergy,onPress:()=>y({allergy:'yes'})})})]}),'none'===l.allergy&&o.length?(0,v.jsx)(h.Muted,{children:"Your profile allergies above are still shared with the kitchen."}):null,'yes'===l.allergy?(0,v.jsxs)(n.default,{style:{gap:10},testID:"allergen-picker",children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"Which allergens? (the 14 UK allergens)"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[w.map(e=>(0,v.jsx)(h.Chip,{label:e.short,selected:l.allergens.includes(e.id)||o.some(l=>l.allergen===e.id),disabled:o.some(l=>l.allergen===e.id),onPress:()=>y({allergens:l.allergens.includes(e.id)?l.allergens.filter(l=>l!==e.id):[...l.allergens,e.id]})},e.id)),x?null:(0,v.jsx)(h.Chip,{label:"All 14\u2026",onPress:()=>j(!0)})]}),(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"How serious?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:m.SEVERITIES.map(e=>(0,v.jsx)(h.Chip,{label:e.label,selected:l.severity===e.id,onPress:()=>y({severity:e.id})},e.id))}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many people with allergies?"}),(0,v.jsx)(h.Stepper,{value:Math.min(l.allergyPeople,r),onChange:e=>y({allergyPeople:e}),min:1,max:Math.max(1,r),label:"people with allergies"})]}),(0,v.jsx)(h.Field,{label:"Anything else the kitchen should know? (optional)",value:l.allergyNote,onChangeText:e=>y({allergyNote:e}),placeholder:"e.g. traces of sesame, one child with coeliac disease",testID:"allergy-note"}),q.length?(0,v.jsx)(c.MenuAllergyCheck,{rid:e,allergens:q,audience:i}):null]}):null]}),k?(0,v.jsxs)(R,{tone:"gold",testID:"q-dogs",children:[(0,v.jsx)(C,{sub:M?'Well-behaved dogs are welcome at our dog-friendly tables.':'staff'===i?'Dog-friendly tables aren\u2019t marked yet (Managers \u203a Booking options), so any table is offered for now.':void 0,children:"\ud83d\udc15 Are you bringing a dog?"}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No",selected:!1===l.dog,onPress:()=>y({dog:!1})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes",selected:!0===l.dog,onPress:()=>y({dog:!0,dogs:Math.max(1,l.dogs)})})})]}),l.dog?(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many dogs?"}),(0,v.jsx)(h.Stepper,{value:l.dogs,onChange:e=>y({dogs:e}),min:1,max:4,label:"dogs"})]}):null]}):null]})},_e.useReserveAvailability=q,_e.MoreQuestions=function({rid:e,r:l,value:a,onChange:r,party:i,date:o,time:c,today:y,bookings:m,audience:b,showTables:x}){const j=e=>r({...a,...e}),w=l.settings,S=(0,u.useMenu)(e),P=(0,t.useMemo)(()=>S.filter(e=>/\((V|VG|Ve)\)|vegan|vegetarian/i.test(`${e.name} ${e.tags?.join(' ')??''}`)).slice(0,4),[S.length]),N=q(e,l,o,y,m,b),T=e=>a.holds[e]??0,D=(0,f.stockNeed)({holds:Object.entries(a.holds).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.indexOf(':')>=0?e.slice(e.indexOf(':')+1):e,qty:l}))},N.items),$=(e,l)=>Math.min(10,...e.map(e=>{const s=(D[e.key]??0)-T(l)*e.qty;return Math.floor(((N.free[e.key]??0)-s)/e.qty)})),I=(e,l,s,t)=>{const r=T(e),i=t<=0&&0===r;return(0,v.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'center',gap:10,opacity:i?.55:1},testID:`reserve-${e.replace(':','-')}`,children:[(0,v.jsxs)(n.default,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(h.T,{weight:"semibold",children:l}),(0,v.jsx)(h.Muted,{children:i?'Unavailable \u2014 none left for this day':s})]}),i?(0,v.jsx)(h.Badge,{kind:"neutral",label:"Unavailable"}):(0,v.jsx)(h.Stepper,{value:r,onChange:l=>j({holds:{...a.holds,[e]:Math.max(0,Math.min(l,Math.max(r,t)))}}),min:0,max:Math.max(r,Math.min(10,t)),label:l})]},e)},O=N.items.length>0||!1!==w.reserveStock&&N.stock.length>0,A=(0,p.usePlan)(e);return(0,v.jsxs)(v.Fragment,{children:[(0,s.accessQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-access",children:[(0,v.jsx)(C,{sub:"Optional. Tell us and we\u2019ll have the right table ready.",children:"\u267f Access needs"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Wheelchair users"}),(0,v.jsx)(h.Stepper,{value:a.wheelchair,onChange:e=>j({wheelchair:e}),min:0,max:Math.max(1,i),label:"wheelchair users"})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"Step-free access",selected:a.stepFree,onPress:()=>j({stepFree:!a.stepFree})}),(0,v.jsx)(h.Chip,{label:"Accessible toilet",selected:a.toilet,onPress:()=>j({toilet:!a.toilet})}),(0,v.jsx)(h.Chip,{label:"Assistance dog",selected:a.assistDog,onPress:()=>j({assistDog:!a.assistDog})})]}),(0,v.jsx)(h.Field,{label:"Anything else? (optional)",value:a.accessNote,onChangeText:e=>j({accessNote:e}),placeholder:"e.g. needs a chair with arms"}),w.accessStatement?.trim()?(0,v.jsx)(h.Muted,{children:w.accessStatement.trim()}):null]}):null,(0,s.dietQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-veg",children:[(0,v.jsx)(C,{sub:"We\u2019d love to look after you. Optional.",children:"\u24cb Any vegans or vegetarians?"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegan"}),(0,v.jsx)(h.Stepper,{value:a.vegan,onChange:e=>j({vegan:e}),min:0,max:Math.max(1,i),label:"vegans"})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegetarian"}),(0,v.jsx)(h.Stepper,{value:a.vegetarian,onChange:e=>j({vegetarian:e}),min:0,max:Math.max(1,i),label:"vegetarians"})]}),!1!==w.vegTeaser&&P.length&&(a.vegan||a.vegetarian)?(0,v.jsxs)(h.Muted,{children:["On the menu: ",P.map(e=>e.name).join(' \xb7 ')]}):null]}):null,O?(0,v.jsxs)(R,{tone:"gold",testID:"q-reserve",children:[(0,v.jsx)(C,{sub:N.known?'Held for you from today\u2019s count.':o>y||'guest'===b?'Held for you; the kitchen confirms and orders in.':void 0,children:"\ud83e\udd9e Reserve with your table"}),N.items.map(e=>I(`item:${e.id}`,`${e.name}${k(e.price)}`,e.description||e.uses.map(e=>`${e.qty} ${N.stock.find(l=>l.key===e.key)?.name.toLowerCase()??e.key}`).join(' + '),$(e.uses,`item:${e.id}`))),!1!==w.reserveStock?N.stock.map(e=>I(`stock:${e.key}`,`Reserve ${e.name.toLowerCase()}`,N.known?`${N.free[e.key]} available today`:'Held for the kitchen to order',$([{key:e.key,qty:1}],`stock:${e.key}`))):null,'staff'===b&&N.known?(0,v.jsxs)(h.Muted,{children:["Today: ",N.stock.map(e=>`${N.free[e.key]} ${e.plural.toLowerCase()} free (${N.reserved[e.key]??0} reserved)`).join(' \xb7 ')]}):null]}):null,x&&!1!==w.tableRequests&&A.tables.length?(0,v.jsx)(M,{rid:e,value:a,onChange:r,party:i,hide:w.tableRequestHide??[]}):null]})},_e.dogTimeOk=function(e,l,s,t,a){if(!a)return!0;const n=e.settings.maxDogsPerSlot;return!n||(0,f.dogsAt)(l,s,t)+a<=n},Object.defineProperty(_e,"accessibleSetUp",{enumerable:!0,get:function(){return f.accessibleSetUp}});var e,l=_r(d[0]),s=_r(d[1]),t=_r(d[2]),a=_r(d[3]),n=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),i=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),p=_r(d[10]),y=_r(d[11]),m=_r(d[12]),b=_r(d[13]),x=_r(d[14]),f=_r(d[15]),j=_r(d[16]),v=_r(d[17]);const k=e=>'display'===x.APP_VARIANT?'':` \xb7 ${(0,b.gbp)(e)}`,w=()=>({allergy:null,allergens:[],severity:'allergy',allergyPeople:1,allergyNote:'',dog:null,dogs:1,wheelchair:0,stepFree:!1,toilet:!1,assistDog:!1,accessNote:'',vegan:0,vegetarian:0,holds:{},tableReq:[]});const R=({children:e,tone:l,testID:s})=>(0,v.jsx)(n.default,{testID:s,style:{gap:10,padding:16,borderRadius:16,borderWidth:'plain'===l?1:1.5,borderColor:'red'===l?j.colours.red:'gold'===l?j.colours.accentBorder:j.colours.hairline,backgroundColor:'red'===l?'#1E1110':j.colours.surface},children:e}),C=({children:e,sub:l})=>(0,v.jsxs)(n.default,{style:{gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:e}),l?(0,v.jsx)(h.Muted,{children:l}):null]});function q(e,l,s,t,a,n,i){const o=(0,f.reservablesOf)(l),c=(0,y.useStockItems)(e),h=(0,y.useShellStore)((0,r.useShallow)(l=>(0,y.venueCounts)(l,e))),u=(0,y.useShellStore)(l=>!!l.server[e]),p=(0,f.reservedOn)(a,s,o,i),m=s===t&&('staff'===n||u),b={};for(const e of c)b[e.key]=m?Math.max(0,Math.floor((h[e.key]??0)-(p[e.key]??0))):1/0;return{items:o,stock:c,free:b,reserved:p,known:m}}function M({rid:e,value:s,onChange:a,party:r,hide:c}){const u=(0,p.usePlan)(e),y=u.areas.filter(e=>u.tables.some(l=>l.areaId===e.id&&!c.includes(l.name))),[m,b]=(0,t.useState)(y[0]?.id??''),x=s.dog?s.dogs:0,k=e=>c.includes(e)?'Not bookable':(0,f.tableBlockReason)(u,e,r,x,s.wheelchair>0||s.stepFree),w=Object.fromEntries(u.tables.map(e=>[e.name,{table:e,status:k(e.name)?'blocked':'free',covers:0,allergy:!1}])),q=e=>{if(k(e))return;const l=s.tableReq.includes(e)?s.tableReq.filter(l=>l!==e):[...s.tableReq,e].slice(-2);a({...s,tableReq:l})},M=u.tables.filter(e=>e.areaId===m&&!c.includes(e.name));return(0,v.jsxs)(R,{tone:"plain",testID:"q-table",children:[(0,v.jsx)(C,{sub:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best.",children:"\ud83e\ude91 Request a table (optional)"}),y.length>1?(0,v.jsx)(i.AreaTabs,{plan:u,area:m,onPick:b}):null,(0,v.jsx)(n.default,{testID:"q-table-plan",style:{height:240,borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:j.colours.hairline},children:(0,v.jsx)(o.FloorCanvas,{plan:u,areaId:m,mode:"live",view:w,privacy:!0,fit:"contain",crop:!0,maxH:260,highlight:s.tableReq,onTap:e=>q(e.name)})}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>{const t=k(e.name),a=s.tableReq.indexOf(e.name);return(0,v.jsx)(h.Chip,{label:`${(0,l.tableNumbers)(e.name)}`,sub:t||(0===a?'1st choice':1===a?'2nd choice':`${e.maxSeats} seats`),selected:a>=0,disabled:!!t,onPress:()=>q(e.name)},e.name)})}),s.tableReq.length?(0,v.jsxs)(h.T,{size:14,colour:j.colours.goldLight,children:["Requested: ",s.tableReq.map((e,s)=>`${(0,l.tableNumbers)(e)}${s?' (2nd choice)':''}`).join(', ')]}):(0,v.jsx)(h.Muted,{children:"Tap a table; tap another for a second choice."})]})}},831,[812,814,31,128,884,955,954,1426,818,823,829,1087,819,820,807,832,825,25]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ACTIVE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ANCHORAGE_RESERVABLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"reservablesOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"holdId",{enumerable:!0,get:function(){return s}}),e.stockNeed=a,e.reservedBookingsOn=function(t,r,o,i){return t.filter(t=>t.date===r&&n(t)&&'finished'!==t.status).map(t=>({booking:t,qty:a(t,o)[i]??0})).filter(t=>t.qty>0).sort((t,r)=>t.booking.time.localeCompare(r.booking.time))},e.reservedOn=c,e.usedOn=function(t,r,n){const o={};for(const i of t)if(i.date===r)for(const t of i.holds??[])if(t.served)for(const[r,s]of Object.entries(a({...i,holds:[{...t,served:void 0}]},n)))o[r]=(o[r]??0)+s;return o},e.heldSummary=function(t,r,o){const i={},a={};for(const o of t)if(o.date===r&&n(o))for(const t of o.holds??[])if(!t.served){const r=s(t.id);'item'===t.kind?i[r]=(i[r]??0)+t.qty:a[r]=(a[r]??0)+t.qty}return{platters:Object.values(i).reduce((t,r)=>t+r,0),byItem:i,single:a,stock:c(t,r,o)}},e.holdsText=function(t,r,n){return(t.holds??[]).filter(t=>t.qty>0).map(t=>{const o=s(t.id);return`${'item'===t.kind?l(r.find(t=>t.id===o)?.name??'Reserved item'):n.find(t=>t.key===o)?.name??o} x${t.qty}${t.served?' (served)':''}`}).join(', ')},Object.defineProperty(e,"shortItem",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"needsAllergenSeen",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"needsHoldOk",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"hasAllergens",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"allergenText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"dogCount",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"hasAccess",{enumerable:!0,get:function(){return p}}),e.accessText=function(t){const r=t.access;return r?[r.wheelchair?`${r.wheelchair} wheelchair user${1===r.wheelchair?'':'s'}`:'',r.stepFree?'step-free access':'',r.toilet?'accessible toilet':'',r.assistDog?'assistance dog':'',r.note?.trim()??''].filter(Boolean).join(', '):''},Object.defineProperty(e,"dietText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"accessibleSetUp",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"dogSetUp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"isAccessible",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isDogOk",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dogsAt",{enumerable:!0,get:function(){return P}}),e.tableBlockReason=function(t,n,o,i,s){const a=t.tables.find(t=>t.name===n);return a?a.maxSeats0&&k(t)&&!(0,r.tableDogOk)(t,a)?'No dogs here':s&&O(t)&&!a.accessible?'Not step-free':'':'Not available'},Object.defineProperty(e,"holidayName",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"coverDone",{enumerable:!0,get:function(){return w}}),e.shownStatus=$,e.seatedCoversOn=function(t,r){return t.filter(t=>t.date===r&&['seated','finished'].includes($(t))).reduce((t,r)=>t+(r.partySize||0),0)},e.laterTodayCovers=function(t,r){return t.filter(t=>t.date===r&&!t.walkIn&&'walk-in'!==t.source&&['confirmed','pending'].includes($(t))).reduce((t,r)=>t+(r.partySize||0),0)},Object.defineProperty(e,"laterTodayLine",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"isWalkInBooking",{enumerable:!0,get:function(){return q}}),e.partiesLine=function(t){const r=t.filter(n),o=r.filter(t=>!q(t)).length,i=r.length-o;return`${o} ${1===o?'booking':'bookings'} \xb7 ${i} ${1===i?'walk-in':'walk-ins'}`},Object.defineProperty(e,"COVERS_FOUR_LABELS",{enumerable:!0,get:function(){return N}}),e.coversFour=T,e.coversCard=function(t,r,o){const i=t.filter(t=>t.date===r&&n(t)),s=t=>t.reduce((t,r)=>t+(r.partySize||0),0);return{...T(t,r),booked:s(i.filter(t=>!q(t))),walkIns:s(i.filter(q))}},e.coversToday=function(t,r){return T(t,r)};var t=_r(_d[0]),r=_r(_d[1]);const n=t=>!['cancelled','noshow'].includes(t.status),o=[{id:'seafood-platter-2',name:'Seafood Platter for 2',price:16e3,description:'Whole crab and lobster with all the trimmings, for two to share.',uses:[{key:'crab',qty:1},{key:'lobster',qty:1}],active:!0}],i=t=>(t?.settings.reservables??('anchorage'===t?.id?o:[])).filter(t=>t.active),s=t=>t.startsWith(':')?t.slice(1):t;function a(t,r,n=!1){const o={};for(const i of t.holds??[]){if(i.served&&!n)continue;const t=s(i.id);if('stock'===i.kind)o[t]=(o[t]??0)+i.qty;else for(const n of r.find(r=>r.id===t)?.uses??[])o[n.key]=(o[n.key]??0)+n.qty*i.qty}return o}function c(t,r,o,i){const s={};for(const c of t)if(c.date===r&&n(c)&&'finished'!==c.status&&c.id!==i)for(const[t,r]of Object.entries(a(c,o)))s[t]=(s[t]??0)+r;return s}const l=t=>/platter/i.test(t)?'Platter':t.replace(/ for \d+$/i,''),d=t=>n(t)&&(t.allergies.length>0||!!t.allergyNote?.trim())&&!t.allergyAck,u=t=>n(t)&&(t.holds??[]).some(t=>t.qty>0&&!t.served)&&!t.holdOk,f=t=>t.allergies.length>0||!!t.allergyNote?.trim(),b=r=>[r.allergies.map(r=>(0,t.allergenLabel)(r.allergen)).join(', '),r.allergyNote?.trim()].filter(Boolean).join(' \xb7 ')+(r.allergyPeople?` (${r.allergyPeople} ${1===r.allergyPeople?'person':'people'})`:''),y=t=>t.dogs??(t.dog?1:0),p=t=>!(!t.access||!(t.access.wheelchair||t.access.stepFree||t.access.toilet||t.access.assistDog||t.access.note?.trim()));const h=t=>[t.diet?.vegan?`${t.diet.vegan} vegan`:'',t.diet?.vegetarian?`${t.diet.vegetarian} vegetarian`:''].filter(Boolean).join(', '),O=t=>t.tables.some(t=>t.accessible),k=t=>t.tables.some(t=>void 0!==t.dogOk)||t.areas.some(t=>t.dogs),v=(t,r)=>r.split('+').every(r=>!!t.tables.find(t=>t.name===r.trim())?.accessible),j=(t,n)=>n.split('+').every(n=>{const o=t.tables.find(t=>t.name===n.trim());return!!o&&(0,r.tableDogOk)(t,o)}),P=(t,r,o,i)=>t.filter(t=>t.id!==i&&t.date===r&&t.time===o&&n(t)).reduce((t,r)=>t+y(r),0);const S=t=>t.replace(/\s*\(substitute day\)/gi,'').trim(),w=t=>'finished'===t.status;function $(t){if('seated'===t.status&&t.seatedAt){const r=new Date(t.seatedAt);if((isNaN(r.getTime())?t.date:r.toLocaleDateString('en-CA',{timeZone:'Europe/London'}))t>0?`${t} more ${1===t?'cover':'covers'} booked for later today.`:'No more bookings for later today.',q=t=>!!t.walkIn||'walk-in'===t.source;const N=['Done','Seated','To come','Total'];function T(t,r){const o=t.filter(t=>t.date===r&&n(t)),i=t=>t.reduce((t,r)=>t+(r.partySize||0),0),s=i(o.filter(w)),a=i(o.filter(t=>!w(t)&&'seated'===$(t))),c=i(o.filter(t=>!q(t)&&['confirmed','pending'].includes($(t))));return{done:s,seated:a,toCome:c,total:s+a+c}}},832,[819,1070]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SEASONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hourSetsOf",{enumerable:!0,get:function(){return n}}),e.seasonOn=s,e.kitchenHoursOn=l,e.hoursFor=function(r,n){const u=l(r,n);return u?{open:(0,t.atTime)(n,u[0]),close:(0,t.atTime)(n,u[1])}:null};var t=_r(_d[0]);const r=[{id:'winter',name:'Winter',hours:{0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']}},{id:'summer',name:'Summer',hours:null}],n=t=>t.settings.hourSets??('anchorage'===t.id?r:[]),u=t=>`${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,o=t=>`${t.getFullYear()}-${u(t)}`;function s(t,r){const o=n(t).filter(t=>t.hours);if(!o.length)return null;const s=o.filter(t=>t.start).sort((t,r)=>t.start.localeCompare(r.start));if(s.length<2)return s[0]??o[0];const l=u(r);return[...s].reverse().find(t=>t.start<=l)??s[s.length-1]}function l(t,r){const n=(t.settings.hourOverrides??[]).find(t=>t.date===o(r));if(n)return n.hours;const u=s(t,r);return u?.hours?u.hours[r.getDay()]??null:t.kitchenHours[r.getDay()]??null}},833,[822]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},834,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GoldX=h,_e.GoldClose=j,Object.defineProperty(_e,"TEXT_ONLY_CLOSE",{enumerable:!0,get:function(){return x}}),_e.ToastClose=function({onPress:e,label:o="Close",testID:s,size:l="md",style:c,colour:h}){return x?(0,b.jsx)(t.default,{testID:s,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:[{minWidth:64,minHeight:48,alignItems:'center',justifyContent:'center',paddingHorizontal:8},c],children:(0,b.jsx)(u.Text,{style:{fontSize:16,color:h??n.colours.text},children:"Close"})}):(0,b.jsx)(j,{onPress:e,label:o,testID:s,size:l,style:c})},r(d[0]);var t=e(r(d[1])),o=e(r(d[2])),s=r(d[3]),l=e(s),n=r(d[4]),c=r(d[5]),u=r(d[6]),b=r(d[7]);function h({size:e=16,colour:t=n.colours.gold,stroke:o}){const c=o??(e>=20?2.4:2.2);return(0,b.jsx)(l.default,{width:e,height:e,viewBox:"0 0 24 24",accessible:!1,focusable:!1,pointerEvents:"none",children:(0,b.jsx)(s.Path,{d:"M6 6 L18 18 M18 6 L6 18",stroke:t,strokeWidth:Math.min(4,c*(24/e)),strokeLinecap:"round",fill:"none"})})}const f={sm:32,md:38,lg:46},y={sm:13,md:15,lg:18};function j({onPress:e,label:s="Close",testID:l,size:c="md",style:u,disabled:j,hint:x}){const C=f[c],I=Math.max(44,C+8);return(0,b.jsx)(t.default,{testID:l,accessibilityRole:"button",accessibilityLabel:s,accessibilityHint:x,disabled:j,onPress:e,dataSet:{goldClose:'1'},style:[{width:I,height:I,alignItems:'center',justifyContent:'center',flexShrink:0,opacity:j?.4:1},u],children:({pressed:e,hovered:t})=>(0,b.jsx)(o.default,{style:{width:C,height:C,borderRadius:C/2,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:e||t?n.colours.gold:n.colours.accentBorder,backgroundColor:e?n.colours.goldTint:t?n.colours.accentBg:'rgba(0,0,0,0.18)'},children:(0,b.jsx)(h,{size:y[c],colour:e?n.colours.goldLight:n.colours.gold})})})}const x=['kirkton','abbotsford'].includes(c.VENUE_RID)},835,[31,264,128,989,825,5,874,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return l}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,l=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},836,[995]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:l,declared:s}){return(0,c.jsxs)(a.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,c.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(d.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,n.isLiveVenue)()?null:(0,c.jsx)(d.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,c.jsx)(a.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:t.ALLERGENS.map(e=>{const n=l[e.id],u=s.find(l=>l.allergen===e.id),f='contains'===n?o.colours.redBg:'may'===n?o.colours.amberBg:o.colours.surface2,h='contains'===n?'#FFD9D4':'may'===n?'#FFE2A8':o.colours.muted;return(0,c.jsxs)(a.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:u?2:1,borderColor:u?o.colours.red:o.colours.border},children:[(0,c.jsx)(d.T,{size:14,weight:"medium",colour:n?h:o.colours.text,children:e.label}),(0,c.jsxs)(d.T,{size:13,colour:h,children:['contains'===n?'Contains':'may'===n?'May contain':'Not listed',u?` \xb7 YOUR ALLERGY (${(0,t.severityLabel)(u.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,c.jsxs)(d.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,c.jsx)(a.default,{testID:"allergen-signoff",children:(0,c.jsx)(d.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${u(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,c.jsx)(d.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:l,declared:n,signedOff:s}){const a=Object.entries(l);return a.length?(0,c.jsx)(d.Row,{wrap:!0,gap:5,children:a.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,l])=>{const s=n.some(l=>l.allergen===e);return(0,c.jsx)(d.Badge,{label:`${s?'\u26a0 ':''}${(0,t.allergenLabel)(e)}${'may'===l?' (may)':''}`,kind:s?'contains'===l?'red':'amber':'neutral'},e)})}):(0,c.jsx)(d.Muted,{children:(0,e.noAllergenWords)(s)})};var e=r(_d[0]);r(_d[1]);var l,n=r(_d[2]),s=r(_d[3]),a=(l=s)&&l.__esModule?l:{default:l},t=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]);const u=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},837,[1269,31,1098,128,819,825,818,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BasketButton=function(){const s=(0,l.useBasket)().lines.reduce((e,s)=>e+s.qty,0);return s?(0,c.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Basket, ${s} items`,onPress:()=>e.router.push('/customer/basket'),style:{backgroundColor:u.colours.gold,borderRadius:999,paddingHorizontal:12,paddingVertical:6},children:(0,c.jsxs)(n.T,{weight:"semibold",colour:u.colours.onGold,size:14,children:["Basket \xb7 ",s]})}):null};var e=r(d[0]);r(d[1]);var s,t=r(d[2]),o=(s=t)&&s.__esModule?s:{default:s},l=r(d[3]),u=r(d[4]),n=r(d[5]),c=r(d[6])},838,[805,31,264,823,825,818,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setRecipeCardRepository=function(n){t=n,r.forEach(t=>t())},e.recipeCards=function(){if(!t)throw new Error('Recipe card repository not set up');return t},Object.defineProperty(e,"hasRecipeCards",{enumerable:!0,get:function(){return n}}),e.onRepositorySwap=function(t){return r.add(t),()=>{r.delete(t)}};let t=null;const r=new Set;const n=()=>!!t},839,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Stars=function({value:e,onChange:s,size:n=36}){return(0,c.jsx)(t.Row,{gap:6,children:[1,2,3,4,5].map(u=>(0,c.jsx)(l.default,{disabled:!s,accessibilityRole:"button",accessibilityLabel:`${u} star${u>1?'s':''}`,onPress:()=>s?.(u),hitSlop:4,children:(0,c.jsx)(t.T,{size:n,colour:u<=e?o.colours.gold:'#555',children:"\u2605"})},u))})},r(d[0]);var e,s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),c=r(d[4])},840,[31,264,825,818,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},841,[31,123,264,128,884,818,825,980,1486,1487,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_VENUE_SLUGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LIVE_VENUE_BUILD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return n}});var c=r(d[0]);const b=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"],f=b.includes(c.VENUE_RID),n=c=>b.includes(c)||['6349aa07-3fec-46e9-8c69-7b1b08494793','41ce63ca-ae46-432d-a5ba-25e1b801e64d','43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6','47f86b36-4c99-466a-be9c-30eb3d79f1e1','e0afad1d-cbc1-414a-add6-92e47d302139','24624ea5-d1e3-4182-b0d1-73402b8a1532','1bc2a056-2ef6-4585-abfd-b7d21c84f215',"59766322-119e-4036-a18a-f6909f60a8d2","596c6f7e-9797-4e16-84fe-db4a99fa1bdc","5d500571-e205-4ead-bb58-60e986b6f40e","f43f20ad-55d0-4008-88c8-7738dc1698df","6abc2793-93ab-4e23-a705-b4011a5cc011","78bff97d-5f07-440a-bb99-f6a6118da7a3","cd985ff5-2443-458d-ac8b-342d553628cf","35f870fc-772c-4aad-bb9e-09a9a16bc925","f500ef12-b405-438b-9671-e54289bec5dd"].includes(c)},842,[5]); +__d(function(_g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MockPay=function({visible:e,onClose:h,amount:p,restaurantId:j,allowGiftCard:b=!0,onPaid:x,title:f="Pay"}){const y=(0,o.useRestaurant)(j),g=(0,o.useGiftCards)(j).filter(e=>e.balance>0),[m,w]=(0,s.useState)(),[P,C]=(0,s.useState)('Test card \u2022\u2022\u2022\u2022 4242'),[T,v]=(0,s.useState)(!1),M=g.find(e=>e.code===m),R=M?Math.min(M.balance,p):0,_=p-R;if(!y?.fictional)return(0,u.jsxs)(c.Sheet,{visible:e,onClose:h,title:f,children:[(0,u.jsxs)(c.T,{children:["Online card payment isn\u2019t set up for this yet, so nothing can be paid here. Please ask at the restaurant",y?.phone?` or phone ${y.phone}`:'',"."]}),(0,u.jsx)(c.Button,{kind:"secondary",label:"Close",onPress:h})]});return(0,u.jsxs)(c.Sheet,{visible:e,onClose:h,title:f,children:[(0,u.jsx)(c.DemoPaymentNotice,{}),b&&g.length>0?(0,u.jsxs)(l.default,{style:{gap:6},children:[(0,u.jsx)(c.T,{weight:"semibold",children:"Use a gift card"}),(0,u.jsxs)(c.Row,{wrap:!0,children:[(0,u.jsx)(c.Chip,{label:"None",selected:!m,onPress:()=>w(void 0)}),g.map(e=>(0,u.jsx)(c.Chip,{label:`${e.code.slice(0,8)}\u2026`,sub:`${(0,n.gbp)(e.balance)} left`,selected:m===e.code,onPress:()=>w(e.code)},e.id))]})]}):null,(0,u.jsx)(c.T,{weight:"semibold",children:"Payment method"}),(0,u.jsx)(c.Row,{wrap:!0,children:['Test card \u2022\u2022\u2022\u2022 4242','Apple Pay (test)','Google Pay (test)'].map(e=>(0,u.jsx)(c.Chip,{label:e,selected:P===e,onPress:()=>C(e)},e))}),(0,u.jsxs)(l.default,{style:{gap:2},children:[(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.Muted,{children:"Amount"}),(0,u.jsx)(c.T,{children:(0,n.gbp)(p)})]}),R?(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.Muted,{children:"Gift card"}),(0,u.jsxs)(c.T,{colour:r.colours.ok,children:["\u2212",(0,n.gbp)(R)]})]}):null,(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.T,{weight:"semibold",children:"To pay now"}),(0,u.jsx)(c.T,{weight:"bold",size:20,colour:r.colours.gold,children:(0,n.gbp)(_)})]})]}),T?(0,u.jsx)(t.default,{color:r.colours.gold}):(0,u.jsx)(c.Button,{label:`Pay ${(0,n.gbp)(_)} \u2014 demo`,onPress:()=>{v(!0),setTimeout(()=>{v(!1),x({giftCardCode:m,giftApplied:R,method:P})},700)},testID:"mock-pay-confirm"})]})};var s=_r(d[0]),t=e(_r(d[1])),l=e(_r(d[2])),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7])},843,[31,247,128,823,820,825,818,25]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftLive=function({slug:e,venue:n}){const{info:x,mine:b,err:S,load:w,pay:k}=j(e),[T,P]=(0,t.useState)(null),[D,C]=(0,t.useState)(''),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(''),[I,M]=(0,t.useState)(''),[E,L]=(0,t.useState)(!1),[R,A]=(0,t.useState)(''),[_,H]=(0,t.useState)(null),F=f(e);if(!x)return(0,h.jsx)(a.Screen,{title:"Gift cards",subtitle:n,children:S?(0,h.jsx)(a.Banner,{kind:"warn",title:S}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const N=D?(0,o.poundsToPence)(D)??0:T??x.amounts[1]??x.amounts[0]??0;return(0,h.jsxs)(a.Screen,{title:"Gift cards",subtitle:`${n}: used only at ${n}`,children:[_?(0,h.jsx)(s.default,{testID:"gift-made",children:(0,h.jsx)(a.Card,{highlight:u.colours.gold,children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift card code"}),(0,h.jsx)(a.T,{size:26,weight:"bold",colour:u.colours.gold,center:!0,children:_.code}),(0,h.jsxs)(a.Muted,{center:!0,children:["Shown once and kept on this phone. Write it down or take a screenshot to give it to ",O||'them',"."]}),(0,h.jsxs)(a.Banner,{kind:"warn",title:`Pay ${(0,l.gbp)(_.pence)} at the bar or till`,children:["Show reference ",_.ref,". The card works once staff mark it paid.",k.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"gift",id:_.id,pay:k})]})})}):null,(0,h.jsx)(g,{onDone:w}),(0,h.jsx)(s.default,{testID:"gift-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift cards"}),b.cards.length?b.cards.map(t=>(0,h.jsxs)(s.default,{style:{gap:2},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{style:{flex:1},children:F[t.id]??`\u2022\u2022\u2022\u2022 ${t.last4}`}),(0,h.jsxs)(a.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balancePence)," of ",(0,l.gbp)(t.initialPence)]})]}),(0,h.jsxs)(a.Muted,{size:12,children:[o.STATUS_WORDS[t.status]??t.status,t.expiresAt?` \xb7 use by ${p(t.expiresAt)}`:'','waiting-payment'===t.status?` \xb7 reference ${t.ref}`:'']}),'waiting-payment'===t.status&&_?.id!==t.id?(0,h.jsx)(m,{slug:e,kind:"gift",id:t.id,pay:k}):null]},t.id)):(0,h.jsx)(a.Muted,{children:"None yet."})]})})}),x.giftsOn?(0,h.jsx)(s.default,{testID:"gift-buy",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:8},children:[(0,h.jsx)(a.H2,{children:"Buy a gift card"}),(0,h.jsx)(a.Row,{wrap:!0,children:x.amounts.map(e=>(0,h.jsx)(a.Chip,{label:(0,l.gbp)(e),selected:!D&&N===e,onPress:()=>{C(''),P(e)}},e))}),(0,h.jsx)(a.Field,{label:`Or another amount (\xa3${x.minPence/100} to \xa3${x.maxPence/100})`,keyboardType:"decimal-pad",value:D,onChangeText:C,placeholder:"e.g. 40",testID:"gift-custom"}),(0,h.jsx)(a.Field,{label:"Who it\u2019s for",value:O,onChangeText:$,testID:"gift-recipient"}),(0,h.jsx)(a.Field,{label:"From",value:v,onChangeText:B}),(0,h.jsx)(a.Field,{label:"Message",value:I,onChangeText:M,multiline:!0,placeholder:"Happy birthday!"}),(0,h.jsxs)(a.Muted,{size:12,children:["Use within ",(0,o.expiryWords)(x.expiryMonths)," of paying. Part-use leaves a balance.",x.terms?` ${x.terms}`:'']}),(0,h.jsx)(s.default,{testID:"gift-pay-placeholder",children:(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER})}),R?(0,h.jsx)(a.Banner,{kind:"warn",title:R}):null,(0,h.jsx)(a.Button,{label:E?'Saving\u2026':`Get a ${(0,l.gbp)(N)} gift card, pay at the till`,testID:"gift-buy-btn",disabled:E||Nx.maxPence,onPress:async()=>{L(!0),A('');try{const t=await(0,c.buyGift)(e,{amount:N,recipient:O,from:v,message:I});t.code&&y(e,t.id,t.code),H({id:t.id,code:t.code??'',ref:t.ref,pence:t.initialPence}),w()}catch(e){A((0,r.plainError)(e))}finally{L(!1)}}})]})})}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n} isn\u2019t selling gift cards in the app yet`,children:"Ask at the bar."})]})},_e.ShopLive=function({slug:e,venue:n,guestName:p}){const{info:x,mine:f,err:y,load:b,pay:S}=j(e),[w,k]=(0,t.useState)({}),[T,P]=(0,t.useState)(p),[D,C]=(0,t.useState)(!1),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(null);if(!x)return(0,h.jsx)(a.Screen,{title:"Shop",subtitle:n,children:y?(0,h.jsx)(a.Banner,{kind:"warn",title:y}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const I=Object.entries(w).filter(([,e])=>e>0).map(([e,t])=>({id:e,qty:t})),M=(0,o.basketTotal)(I,x.products);return(0,h.jsxs)(a.Screen,{title:"Shop",subtitle:`${n}: collect at the venue`,children:[v?(0,h.jsxs)(s.default,{testID:"shop-done",children:[(0,h.jsxs)(a.Banner,{kind:"warn",title:`Order ${v.ref}: pay ${(0,l.gbp)(v.total)} at the bar or till`,children:["Staff will have it ready to collect once it\u2019s paid.",S.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"shop",id:v.id,pay:S})]}):null,(0,h.jsx)(g,{onDone:b}),x.shopOn?(0,h.jsxs)(h.Fragment,{children:[x.products.length?x.products.map(e=>(0,h.jsx)(s.default,{testID:`shop-item-${e.id}`,children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,h.jsx)(a.T,{colour:u.colours.gold,children:(0,l.gbp)(e.pricePence)})]}),e.details?(0,h.jsx)(a.Muted,{children:e.details}):null,e.soldOut?(0,h.jsx)(a.Badge,{kind:"amber",label:"Sold out"}):(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(a.Muted,{children:"How many"}),(0,h.jsx)(a.Stepper,{value:w[e.id]??0,min:0,max:20,label:`${e.name} quantity`,onChange:t=>k({...w,[e.id]:t})})]})]})})},e.id)):(0,h.jsx)(a.Muted,{children:"Nothing in the shop yet."}),I.length?(0,h.jsx)(s.default,{testID:"shop-basket",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",children:"Total"}),(0,h.jsx)(a.T,{weight:"semibold",colour:u.colours.gold,children:(0,l.gbp)(M)})]}),(0,h.jsx)(a.Field,{label:"Name for collection",value:T,onChangeText:P,testID:"shop-name"}),(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER}),O?(0,h.jsx)(a.Banner,{kind:"warn",title:O}):null,(0,h.jsx)(a.Button,{label:D?'Sending\u2026':'Order, pay at the till',testID:"shop-order-btn",disabled:D||!T.trim(),onPress:async()=>{C(!0),$('');try{const t=await(0,c.shopOrder)(e,I,T);B({id:t.id,ref:t.ref,total:t.totalPence}),k({}),b()}catch(e){$((0,r.plainError)(e))}finally{C(!1)}}})]})})}):null]}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n}\u2019s shop isn\u2019t open in the app yet`,children:"Ask at the bar."}),f.orders.length?(0,h.jsx)(s.default,{testID:"shop-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsx)(a.H2,{children:"Your shop orders"}),f.orders.map(e=>(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(a.T,{style:{flex:1},children:[e.ref," \xb7 ",e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')]}),(0,h.jsx)(a.Muted,{children:o.STATUS_WORDS[e.status]??e.status})]},e.ref))]})})}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},a=_r(d[2]),l=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]);const p=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},x=e=>`cc-gift-codes:${e}:v1`;function f(e){try{return JSON.parse(globalThis.localStorage?.getItem(x(e))||'{}')}catch{return{}}}function y(e,t,n){try{const s=f(e);s[t]=n,globalThis.localStorage?.setItem(x(e),JSON.stringify(s))}catch{}}function j(e){const[n,s]=(0,t.useState)(null),[a,l]=(0,t.useState)({cards:[],orders:[]}),[o,u]=(0,t.useState)(''),[h,p]=(0,t.useState)({provider:'none',cardOn:!1,testMode:!0}),x=(0,t.useCallback)(()=>{u(''),(0,c.shopPublic)(e).then(s).catch(e=>u((0,r.plainError)(e))),(0,c.myShop)(e).then(l).catch(()=>{}),(0,c.payPublic)(e).then(p)},[e]);return(0,t.useEffect)(()=>{x()},[x]),{info:n,mine:a,err:o,load:x,pay:h}}function g({onDone:e}){const[n,l]=(0,t.useState)('');return(0,t.useEffect)(()=>{const t='undefined'!=typeof window?new URLSearchParams(window.location.search).get('paid'):null;if(!t||!/^[0-9a-f-]{36}$/.test(t))return;let n=0;const s=()=>(0,c.payStatus)(t).then(t=>{l(t.status),'paid'===t.status?e():n++<10&&setTimeout(s,2e3)}).catch(()=>{});s()},[e]),n?(0,h.jsx)(s.default,{testID:"pay-back",children:(0,h.jsx)(a.Banner,{kind:'paid'===n?'success':'warn',title:'paid'===n?'Paid by card (TEST MODE: no real money)':'expired'===n?'The card payment timed out. Pay at the bar or till.':'Checking the card payment\u2026'})}):null}function m({slug:e,kind:n,id:l,pay:o}){const[u,p]=(0,t.useState)(!1),[x,f]=(0,t.useState)('');return o.cardOn?(0,h.jsxs)(s.default,{testID:`pay-card-${n}`,style:{gap:4},children:[(0,h.jsx)(a.Button,{label:u?'Opening card payment\u2026':'Pay by card (TEST MODE)',kind:"secondary",disabled:u,onPress:async()=>{p(!0),f('');try{const t=await(0,c.payStart)(e,n,l);window.location.assign(t.url)}catch(e){f((0,r.plainError)(e))}finally{p(!1)}}}),(0,h.jsx)(a.Muted,{size:12,children:"Test mode: use a Stripe test card. No real money is taken."}),x?(0,h.jsx)(a.Banner,{kind:"warn",title:x}):null]}):null}},844,[31,128,818,820,1072,1073,1074,825,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"guestServer",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"useGuestLoyalty",{enumerable:!0,get:function(){return _}}),e.refreshGuest=async function(t){if(!c())return;_.setState(n=>({loading:{...n.loading,[t]:!0}}));try{const n=await(0,o.rpc)('loyalty_public',{p_venue_slug:t});if(_.setState(r=>({info:{...r.info,[t]:n}})),await(0,o.guestSession)()){const n=await(0,o.rpc)('loyalty_my_card',{p_venue_slug:t});_.setState(r=>({card:{...r.card,[t]:n??null}}))}}finally{_.setState(n=>({loading:{...n.loading,[t]:!1}}))}},e.guestJoin=async function(t,n){if(!await(0,o.guestSession)())throw new Error('No connection. Try again when you are back online.');const r=await(0,o.rpc)('loyalty_guest_join',{p_venue_slug:t,p_name:n.name.trim(),p_phone:n.phone.trim()||null,p_email:n.email.trim()||null,p_consent:n.consent,p_consent_text:n.consentText,p_referral:n.referral?(0,l.cleanCode)(n.referral):null});return p(t,r),r},e.guestClaim=async function(t,n){if(!await(0,o.guestSession)())return{ok:!1,error:'No connection. Try again when you are back online.'};const r=await(0,o.rpc)('loyalty_guest_claim',{p_venue_slug:t,p_code:(0,l.cleanCode)(n)});return r?.error?{ok:!1,error:String(r.error)}:(p(t,r),{ok:!0,card:r,linked:!!r.linked})},e.guestLinkCode=async function(t){return(0,o.rpc)('loyalty_guest_link_code',{p_venue_slug:t})},e.guestLeave=async function(t){await(0,o.rpc)('loyalty_guest_leave',{p_venue_slug:t}),p(t,null)},Object.defineProperty(e,"staffFind",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"staffCard",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"staffStamp",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"staffRedeem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"staffJoin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"staffCode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"staffRemove",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"loyaltySummary",{enumerable:!0,get:function(){return P}}),e.readSettings=async function(){const{data:t,error:n}=await u().from('loyalty_settings').select('*').eq('venue_id',y()).maybeSingle();if(n)throw n;return(0,l.settingsFromRow)(t)},e.saveSettings=async function(t){const{error:n}=await u().from('loyalty_settings').upsert({venue_id:y(),...(0,l.settingsToRow)(t),updated_by:(o.useSync.getState().staffRef??'').slice(0,80)||'manager',updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readOffers=k,e.saveOffer=C,e.watchLoyalty=function(t){if(!f())return()=>{};const n=y();let r=u().channel(`cc-loyalty:${n}:${Math.random().toString(36).slice(2,8)}`);for(const o of['loyalty_settings','loyalty_offers','loyalty_guests','loyalty_stamps','loyalty_rewards','loyalty_referrals'])r=r.on('postgres_changes',{event:'*',schema:'public',table:o,filter:`venue_id=eq.${n}`},()=>t());return r.subscribe(),()=>{try{u().removeChannel(r)}catch{}}},e.migrateLocalOnce=async function(t,n,r){if(!f())return 0;const o=`loyalty:migrated:${y()}`;if(await n(o))return 0;let s=0;if(!(await k()).length)for(const n of t.offers.filter(t=>'offer'===t.kind&&!JSON.stringify(t).includes('(example)')))await C({title:n.title.slice(0,80),details:(n.body??'').slice(0,500),startsOn:null,endsOn:n.until??null,isOn:!!n.live}),s++;return await r(o),s};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=_r(d[3]),s=_r(d[4]),l=_r(d[5]);const u=()=>(0,n.getSupabase)(),c=()=>(0,r.isSupabaseConfigured)()&&!s.PITCH,f=()=>c()&&'staff'===o.useSync.getState().kind&&!!o.useSync.getState().venueId,y=()=>{const t=o.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},_=(0,t.create)(()=>({info:{},card:{},loading:{}}));const p=(t,n)=>_.setState(r=>({card:{...r.card,[t]:n}}));const b=t=>(0,o.rpc)('loyalty_staff_find',{p_venue:y(),p_q:t}),w=t=>(0,o.rpc)('loyalty_staff_card',{p_guest:t}),v=t=>(0,o.rpc)('loyalty_staff_stamp',{p_guest:t}),S=t=>(0,o.rpc)('loyalty_staff_redeem',{p_reward:t}),O=t=>(0,o.rpc)('loyalty_staff_join',{p_venue:y(),p_name:t.name.trim(),p_phone:t.phone.trim()||null,p_email:t.email.trim()||null,p_consent:t.consent,p_consent_text:t.consentText}),h=(t,n)=>(0,o.rpc)('loyalty_staff_code',{p_venue:y(),p_kind:t,p_guest:n??null}),j=t=>(0,o.rpc)('loyalty_staff_remove',{p_guest:t}),P=()=>(0,o.rpc)('loyalty_summary',{p_venue:y()});async function k(){const{data:t,error:n}=await u().from('loyalty_offers').select('*').eq('venue_id',y()).order('created_at');if(n)throw n;return(t??[]).map(l.offerFromRow)}async function C(t){const n={venue_id:y(),title:t.title.trim(),details:t.details.trim(),starts_on:t.startsOn||null,ends_on:t.endsOn||null,is_on:t.isOn,updated_at:(new Date).toISOString()},{error:r}=t.id?await u().from('loyalty_offers').update(n).eq('id',t.id):await u().from('loyalty_offers').insert(n);if(r)throw r}},845,[995,872,1170,824,2,1072]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},862,[31,264,128,288,818,825,1461,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"leaveOn",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"leaveRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return b}}),_e.liveAttendance=function(e){const t=y.get(e);if(t)return t;const n=e.some(e=>e.voided)?e.filter(e=>!e.voided):e;return y.set(e,n),n},Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return P}}),_e.openShiftOf=A,_e.loggedBreakMins=M,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return F}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),n=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,n)=>t&&n.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${n} (${t})`:n},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return Q}});var e,t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),i=_r(_d[3]),s=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=(e=d)&&e.__esModule?e:{default:e},f=_r(_d[8]),u=_r(_d[9]),l=_r(_d[10]),p=_r(_d[11]);const m=(e,t,n)=>e.find(e=>e.staffId===t&&'approved'===e.status&&e.from<=n&&n<=e.to),h={decide:null},g=e=>e.out?e.signOff?'confirmed':'awaiting':'open',b=e=>!!e.out&&!!e.signOff,y=new WeakMap;const k={send:null},I=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,w=e=>{const[t,n,a]=e.split('-').map(Number);return(new Date(t,n-1,a).getDay()+6)%7},E=(e,t)=>{const[n,a,i]=e.split('-').map(Number);return I(new Date(n,a-1,i+t))},S=e=>E(e,-w(e)),O=(e,t)=>e.filter(e=>e.date===t),v=(e,t,n)=>e.find(e=>e.staffId===t&&e.date===n),R=(e,t)=>t?e:e.filter(e=>e.published),_=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],$=1271,L=6,D=['ql-wix-view','ql-wix-edit'],T=e=>D.includes(e.id)||'Website bookings'===e.group,P=[{id:'ql-gmail',label:'Work email (Gmail)',url:'',icon:'\u2709\ufe0f',kind:'gmail',staff:!1,builtIn:!0},{id:'ql-wix-view',label:'View site',url:'https://www.anchoragedunure.com',icon:'\ud83c\udf10',kind:'link',group:'Website bookings',staff:!1,builtIn:!0},{id:'ql-wix-edit',label:'Edit site',url:'https://manage.wix.com',icon:'\ud83d\udd8a\ufe0f',kind:'link',group:'Website bookings',staff:!1,builtIn:!0}];function A(e,t,n){const a=new Date(n).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&a-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function M(e,t=new Date){const n=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():n)-new Date(t.start).getTime()),0)/6e4)}const j=e=>!!e?.breaks?.some(e=>!e.end),N=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,C=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function B(){return l.ROSTER.map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},role:e.role,job:e.job,active:!0,level:e.level,dept:e.dept,salaried:e.salaried,noTax:e.noTax,...U.includes(e.id)?{displayClock:!0}:{}}))}const U=['st-jack'];function V(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const q=()=>{const e={tronc:{method:'hours',points:{FOH:1,Bar:1,Kitchen:.8,KP:.6,Manager:1},includeManagers:!0,includeOwner:!1,custom:{},text:'The Anchorage tipping policy (template)\n\n1. 100% of tips paid by card and cash tips put in the tip jar go to staff. Nothing is deducted.\n2. Tips are pooled and shared by paid hours worked in each pay period (breaks excluded).\n3. The owner does not take a share. Managers share only for hours worked on the floor or in the kitchen.\n4. Tips are paid with wages, no later than the end of the month after the tip was paid.\n5. Tip records are kept for 3 years. Ask a manager for your records at any time.'},troncCash:{},troncHistory:[],troncLog:[],chat:[],chatMuted:{},chatRead:{},referral:{giverReward:'Free dessert',friendReward:'\xa35 off first order',active:!0},referrals:[],reminders:{h24:!0,h2:!0,confirmText:!0},coats:[],merch:[],merchOrders:[],marketingDraft:void 0,socialAccounts:{facebook:!0,instagram:!0,tiktok:!0,youtube:!0},socialPosts:[],socialDraft:void 0,quickLinks:P.map(e=>({...e})),workEmail:'',staff:B(),rosterVersion:l.ROSTER_VERSION,previewRole:'owner',staffAs:l.ROSTER.find(e=>'staff'===e.app)?.id??l.ROSTER[0]?.id??'',offers:[],photos:[],changeRequests:[],changesUsed:2,site:t.VENUE_RID,branding:{},checks:{},lost:[],lostReports:[],campaigns:[],shifts:[],rotaPublished:void 0,leave:[],swaps:[],availability:{},attendance:[],attLog:[],timeRequests:[],geofence:{lat:55.4047,lng:-4.7606,radius:100},simLocation:'venue',consent:{},hourly:V(),payPeriod:'weekly',suppliers:[],supplierOrders:[],staffCanViewSuppliers:!1,readNotes:{},customerTags:{'cust-demo':['Allergy','Regular'],'cr-2':['VIP'],'cr-5':['Takeaway']}};if(s.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE)return{...e,changesUsed:0,customerTags:{},socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1}};if(!t.IS_ISOLATED_VENUE)return e;for(const t of Object.keys(e))Array.isArray(e[t])&&(e[t]=[]);return{...e,site:t.VENUE_RID,staffAs:'',hourly:{},customerTags:{},geofence:{lat:0,lng:0,radius:100},tronc:{...e.tronc,text:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].name+' tipping policy \u2014 to confirm.':t.IS_ABBOTSFORD?'The Abbotsford Hotel tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKTON?'The Kirkton Inn tipping policy \u2014 awaiting venue confirmation.':t.IS_GREENSIDE?'The Greenside Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_WILDINGS?'Wildings Hotel & Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKMICHAEL?"The Kirkmichael Arms tipping policy \u2014 awaiting venue confirmation.":"Souter's Inn tipping policy \u2014 awaiting venue confirmation."},changesUsed:0,socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1},quickLinks:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?[]:t.IS_GREENSIDE?[{id:'greenside-phone',label:'Call 01655 889685',url:'tel:01655889685',icon:'',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_WILDINGS?[{id:'wildings-phone',label:'Call to book',url:'tel:01655331401',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0},{id:'wildings-email',label:'Email to book',url:'mailto:bookings@wildingsrestaurant-hotel.co.uk',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_KIRKMICHAEL?[{id:'kirkmichael-site',label:'Venue website',url:'https://www.kirkmichaelarms.co.uk/',icon:'\ud83c\udf10',kind:'link',group:'Website',staff:!0,builtIn:!0}]:[{id:'souters-book',label:'Guest table requests',url:'https://covercharge-apps.static.hf.space/souters/customer-app/',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}],branding:{[t.VENUE_RID]:{accent:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?a.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},x=(0,f.create)()((0,u.persist)((e,n)=>({...q(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,n,a)=>e(e=>({staff:[...e.staff,{id:N('st'),name:t,role:n,job:a,active:!0,level:W[n]}]})),saveSupplier:t=>e(e=>({suppliers:e.suppliers.some(e=>e.id===t.id)?e.suppliers.map(e=>e.id===t.id?t:e):[...e.suppliers,t]})),setRate:(t,n)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(n))}})),clearRate:t=>e(e=>{const n={...e.hourly};return delete n[t],{hourly:n}}),updateStaff:(t,n)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...n}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:N('of')},...e.offers]})),updateOffer:(t,n)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...n}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:N('ph'),caption:t,tone:C[e.photos.length%C.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,n)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:N('cr'),text:t,at:n,status:'requested'},...e.changeRequests]}),setSite:n=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:n}),setBranding:(t,n)=>e(e=>{const a={...e.branding};return n?a[t]={...a[t],...n}:delete a[t],{branding:a}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:N('sp')},...e.socialPosts]})),setSocialPost:(t,n)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...n}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,n,a)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[n]??[];return{...e,reactions:{...e.reactions,[n]:i.includes(a)?i.filter(e=>e!==a):[...i,a]}}})})),chatSeen:(t,n)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(n))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(n)?e:{...e,seenBy:[...e.seenBy,n]})}:e),chatMarkRead:(t,n)=>e(e=>{const a={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(n))(!a[e]||Date.parse(t)>Date.parse(a[e]))&&(a[e]=t);const i=e=>Math.max(Date.parse(a['*']??'')||0,Date.parse(a[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:a},chat:s}}),chatPatch:(t,n)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...n}:e)})),chatMute:(t,n)=>e(e=>{const a=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),sys:(t,n,a)=>e(e=>({chat:[...e.chat,{id:N('m'),ch:t,from:'system',text:n,at:a,reactions:{},seenBy:[]}]})),tick:(t,n,a,i)=>e(e=>({checks:{...e.checks,[t]:{by:n,at:a,value:i}}})),untick:t=>e(e=>{const n={...e.checks};return delete n[t],{checks:n}}),addLost:t=>e(e=>({lost:[{...t,id:N('lp'),status:'held'},...e.lost]})),setLost:(t,n)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...n}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:N('cp')},...e.campaigns]})),setCampaign:(t,n)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...n}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:w(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:w(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,a)=>{const i=n(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const n=E(t,e),o=E(a,e);i.shifts.filter(e=>e.date===n&&s.has(e.staffId)&&!m(i.leave,e.staffId,o)&&!i.shifts.some(t=>t.staffId===e.staffId&&t.date===o)&&!r.some(t=>t.staffId===e.staffId&&t.date===o)).forEach(e=>r.push({id:(0,p.uuid)(),staffId:e.staffId,date:o,day:w(o),start:e.start,end:e.end,note:e.note,published:!1}))}return r.length&&e({shifts:[...i.shifts,...r]}),r.length},publishWeek:t=>{const n=E(t,6);let a=0;return e(e=>({shifts:e.shifts.map(e=>e.daten||e.published&&!e.changed?e:(a++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),a},removeShift:t=>e(e=>({shifts:e.shifts.filter(e=>e.id!==t)})),markRead:t=>e(e=>({readNotes:{...e.readNotes,...Object.fromEntries(t.map(e=>[e,!0]))}})),toggleTag:(t,n)=>e(e=>{const a=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>{const n={...t,id:(0,p.uuid)(),status:t.status??'pending'};return e(e=>({leave:[n,...e.leave]})),n},setLeave:(t,a)=>{e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:a}:e)}));const i=n().leave.find(e=>e.id===t);i&&h.decide?.(i)},addSwap:t=>e(e=>({swaps:[{...t,id:N('sw'),status:'open'},...e.swaps]})),setSwap:(t,n)=>e(e=>{const a=e.swaps.find(e=>e.id===t);return{shifts:'approved'===n&&a?.toId?e.shifts.map(e=>e.id===a.shiftId?{...e,staffId:a.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:n}:e)}}),toggleAvail:(t,n)=>e(e=>{const a=e.availability[t]??[];return{availability:{...e.availability,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),clock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.filter(e=>e.staffId===t&&e.in&&!e.out&&new Date(i).getTime()-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0];if('in'===a)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:n,in:i,inSite:s}]};const d=e=>e?.map(e=>e.end?e:{...e,end:i});return o?{attendance:e.attendance.map(e=>e.id===o.id?{...e,out:i,outSite:s,breakMins:r??M({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.find(e=>e.id===t),d=e.staff.find(e=>e.id===o?.staffId),c=o?.[n]?new Date(o[n]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[n]:a,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:N('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${n} from ${c} to ${new Date(a).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,n,a)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...n,geo:a?[...e.geo??[],a].slice(-20):e.geo}:e)})),breakToggle:(t,a,i)=>{const s=n(),r=A(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===a?d:!d)return!1;const c='start'===a?[...o,{start:i}]:o.map(e=>e.end?e:{...e,end:i});return e({attendance:s.attendance.map(e=>e.id===r.id?{...e,breaks:c,breakMins:M({breaks:c})}:e)}),!0},adjustBreak:(t,n,a,i,s)=>e(e=>{const r=e.attendance.find(e=>e.id===t),o=e.staff.find(e=>e.id===r?.staffId);return{attendance:e.attendance.map(e=>e.id===t?{...e,breakMins:n,adjusted:{by:a,at:s,reason:i}}:e),attLog:[{id:N('al'),at:s,text:`${a} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${n}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const a=n(),i=t.id?a.attendance.find(e=>e.id===t.id):void 0,s=t.reason.trim();if(s.length<3)return null;if(t.out&&t.out<=t.in)return null;const r=e=>e?new Date(e).toTimeString().slice(0,5):'none',o=(e,n,a)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:n,to:a,reason:s}),d=a.staff.find(e=>e.id===t.staffId)?.name??'staff';let c;const f=[];if(i){const e=[...i.audit??[]];if(i.signOff&&(e.push(o('reopened','Confirmed','Awaiting sign-off')),f.push(`${t.by} reopened ${d}'s confirmed ${i.date} entry`)),i.in!==t.in&&(e.push(o('clock_in',r(i.in),r(t.in))),f.push(`${t.by} changed ${d} clock-in from ${r(i.in)} to ${r(t.in)}: ${s}`)),(i.out??'')!==(t.out??'')&&(e.push(o('clock_out',r(i.out),r(t.out))),f.push(`${t.by} changed ${d} clock-out from ${r(i.out)} to ${r(t.out)}: ${s}`)),(i.breakMins??0)!==t.breakMins&&(e.push(o('break',`${i.breakMins??0}m`,`${t.breakMins}m`)),f.push(`${t.by} changed ${d} break from ${i.breakMins??0}m to ${t.breakMins}m: ${s}`)),e.length===(i.audit??[]).length)return i;const n=t.out?i.breaks?.map(e=>e.end?e:{...e,end:t.out}):i.breaks;c={...i,in:t.in,out:t.out,breakMins:t.breakMins,breaks:n,signOff:void 0,adjusted:{by:t.by,at:t.now,reason:s},audit:e}}else c={id:t.id??(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:s},audit:[o('added',void 0,`${r(t.in)}\u2013${t.out?r(t.out):'open'}, break ${t.breakMins}m`)]},f.push(`${t.by} added ${d}'s ${t.date} entry ${r(t.in)}\u2013${t.out?r(t.out):'open'} (break ${t.breakMins}m): ${s}`);return t.request&&(c={...c,audit:[...c.audit??[],o('request_applied')]}),k.send?.('attendance_override',c,{reason:s}),e(e=>({attendance:i?e.attendance.map(e=>e.id===i.id?c:e):[...e.attendance,c],attLog:[...f.reverse().map(e=>({id:N('al'),at:t.now,text:e})),...e.attLog]})),c},voidEntry:(t,a,i,s,r)=>{const o=n(),d=o.attendance.find(e=>e.id===t);if(!d||d.voided||d.signOff||s.trim().length<3)return!1;const c={...d,voided:{by:a,at:r,reason:s.trim()},audit:[...d.audit??[],{at:r,by:a,byId:i,action:'voided',from:'In hours',to:'Removed',reason:s.trim()}]};k.send?.('attendance_void',c,{reason:s.trim()});const f=o.staff.find(e=>e.id===d.staffId)?.name??'staff';return e({attendance:o.attendance.map(e=>e.id===t?c:e),attLog:[{id:N('al'),at:r,text:`${a} removed ${f}'s ${d.date} shift (kept in the history): ${s.trim()}`},...o.attLog]}),!0},deleteEntry:(t,a,i,s)=>{const r=n(),o=r.attendance.find(e=>e.id===t);if(!o)return{ok:!1,message:'Not found.'};if(o.signOff)return{ok:!1,message:"This shift has been signed off and can't be deleted."};const d={...o,audit:[...o.audit??[],{at:s,by:a,byId:i,action:'voided',from:'In hours',to:'Deleted'}]};k.send?.('attendance_delete',d);const c=r.staff.find(e=>e.id===o.staffId)?.name??'staff';return e({attendance:r.attendance.filter(e=>e.id!==t),attLog:[{id:N('al'),at:s,text:`${a} deleted ${c}'s ${o.date} shift`},...r.attLog]}),{ok:!0}},addPastShift:t=>{if(!t.staffId||!t.in||!t.out||t.out<=t.in)return null;const a=(t.note??'').trim()||'Past shift (historical entry)',i={id:(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:a},signOff:{by:t.by,byId:t.byId,at:t.now},audit:[{at:t.now,by:t.by,byId:t.byId,action:'added',to:`${t.in}\u2013${t.out}, break ${t.breakMins}m`,reason:a},{at:t.now,by:t.by,byId:t.byId,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed',reason:'Historical entry'}]};k.send?.('attendance_add_past',i,{reason:a});const s=n().staff.find(e=>e.id===t.staffId)?.name??'staff';return e(e=>({attendance:[...e.attendance,i],attLog:[{id:N('al'),at:t.now,text:`${t.by} entered ${s}'s past shift on ${t.date}`},...e.attLog]})),i},confirmEntries:(t,a,i,s)=>{const r=n(),o=new Set(t),d=[],c=r.attendance.map(e=>{if(!o.has(e.id)||!e.out||e.signOff)return e;const t={...e,signOff:{by:a,byId:i,at:s},audit:[...e.audit??[],{at:s,by:a,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>k.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:N('al'),at:s,text:`${a} confirmed ${d.length} ${1===d.length?'entry':'entries'} (${[...new Set(d.map(e=>e.date))].join(', ')})`},...r.attLog]}),d.length):0},addTimeRequest:t=>e(e=>({timeRequests:[{...t,id:(0,p.uuid)(),status:'open'},...e.timeRequests]})),resolveTimeRequest:(t,a,i,s)=>{const r=n().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:a,resolvedBy:i,resolvedAt:s};k.send?.('time_request_resolve',o),e(e=>({timeRequests:e.timeRequests.map(e=>e.id===t?o:e)}))},setGeofence:t=>e(e=>({geofence:{...e.geofence,...t}})),setSimLocation:t=>e({simLocation:t}),giveConsent:(t,n)=>e(e=>({consent:{...e.consent,[t]:n}})),resetOwner:()=>e(q()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const n=new Set(e.staff.map(e=>e.id)),a=B().filter(e=>!n.has(e.id));return{staff:a.length?[...e.staff,...a]:e.staff,hourly:{...e.hourly,...V()},rosterVersion:l.ROSTER_VERSION}})}),{name:'covercharge-owner-v1',version:6,storage:(0,u.createJSONStorage)(()=>c.default),migrate:async(e,t)=>{if(s.LIVE_VENUE_BUILD&&e)return await(0,o.archiveChefCache)('owner',e),{...e,...(0,i.stripOwnerLiveSamples)(e)};if(e&&t<2&&Array.isArray(e.quickLinks)&&(e.quickLinks=e.quickLinks.map(e=>D.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=q();Object.assign(e,{staff:t.staff,hourly:t.hourly,shifts:t.shifts,leave:t.leave,swaps:t.swaps,availability:t.availability,attendance:[],attLog:[],consent:{},chat:[],chatMuted:{},troncHistory:[],staffAs:t.staffAs,previewRole:'owner',rosterVersion:l.ROSTER_VERSION,rotaPublished:void 0})}if(e&&t<4){const t=S(I(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:E(t,e.day??0),published:!0}),e.timeRequests=e.timeRequests??[]}return s.LIVE_VENUE_BUILD&&e&&(Object.assign(e,(0,i.stripOwnerLiveSamples)(e)),e.chat=(e.chat||[]).filter(e=>!(0,r.isSeedChefChat)(e)),e.suppliers=(e.suppliers||[]).filter(e=>!/^sup-[1-9]$/.test(e.id)||!/^(Example|Sample)\b/.test(e.name)),e.supplierOrders=(e.supplierOrders||[]).filter(e=>!/\(example\)/i.test(e.by||''))),e}})),K=(e,t,n)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${n(t)}/h`,W={owner:'Owner',manager:'Manager',staff:'Staff'},F={forecasts:e=>'staff'!==e,manage:e=>'staff'!==e,staffAdmin:e=>'owner'===e,billing:e=>'owner'===e,takings:e=>'staff'!==e,publishSocial:e=>'staff'!==e};const G=e=>[e.name.replace(/\s*\([^)]*\)\s*$/,'').replace(' (example)',''),e.nickname??''].map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>[e,e.split(' ')[0]]).filter((e,t,n)=>n.indexOf(e)===t),H=(e,t)=>{const n=t.trim().toLowerCase();if(!n)return!1;const a=G(e);return a.includes(n)||a.includes(n.split(' ')[0])},Q=(e,t)=>{const n=t.trim().toLowerCase();return!n||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(n))}},863,[5,6,1193,1195,842,1085,1198,1190,995,1191,15,1099]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSpecials",{enumerable:!0,get:function(){return _}});var e,t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),n=r(_d[3]),o=r(_d[4]),c=(e=o)&&e.__esModule?e:{default:e},l=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),y=r(_d[9]);const p=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock)}catch{return new Date}};let S=0;const f=()=>`sb-${Date.now().toString(36)}${(S++).toString(36)}`,b=(e,t)=>u.useStore.setState(s=>({audit:[{id:`au-${f()}`,restaurantId:e,at:p().toISOString(),kind:'allergy',text:t},...s.audit].slice(0,300)})),_=(0,l.create)()((0,d.persist)((e,t)=>({...n.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{current:{},history:[]}:(0,h.seedSpecials)(p()),post:(t,s,i,n)=>{e(e=>(0,h.postBoard)(e,t,s,i,n,p(),f())),s.items.length&&b(t,`Specials board: allergens for ${s.items.length} typed special${1===s.items.length?'':'s'} checked and signed off by ${i}`)},clear:(t,s)=>{e(e=>(0,h.clearBoard)(e,t)),b(t,`Specials board cleared by ${s}`)},reuse:(s,i,n,o)=>{const c=t().history.find(e=>e.id===i);e(e=>(0,h.reuseBoard)(e,s,i,n,o,p(),f())),c?.items.length&&b(s,`Specials board re-used: ${c.items.length} typed special${1===c.items.length?'':'s'}, allergens as previously checked, signed off by ${n}`)},remove:t=>e(e=>(0,h.deleteFromHistory)(e,t))}),{name:'covercharge-specials-v1',storage:(0,d.createJSONStorage)(()=>c.default),version:1,partialize:e=>({current:e.current,history:e.history})})),E=async()=>{if(!(0,y.liveData)())return;const e=_.getState(),n=e=>String(e.id).startsWith('sb-seed')&&(!s.LIVE_VENUE_BUILD||(0,t.demoActor)(e.postedBy)&&(!e.allergenCheck||(0,t.demoActor)(e.allergenCheck.by))&&(!e.photo||e.photo===h.SAMPLE_PHOTO)&&e.items.every(e=>/\(sample\)/i.test(e.name))),o=Object.fromEntries(Object.entries(e.current).filter(([,e])=>!(e&&n(e)))),c=e.history.filter(e=>!n(e));Object.keys(o).length===Object.keys(e.current).length&&c.length===e.history.length||(s.LIVE_VENUE_BUILD&&await(0,i.archiveChefCache)('specials',{current:e.current,history:e.history}),_.setState({current:o,history:c}))};(0,y.onDataModeChange)(E);try{_.persist?.onFinishHydration?.(E)}catch{}E()},864,[1085,842,1198,5,1190,995,1191,865,881,1218]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAMPLE_PHOTO",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_MAX",{enumerable:!0,get:function(){return n}}),e.parsePrice=function(t){const n=t.trim().replace(/^\xa3\s*/,'');return n?/^\d{1,3}(\.\d{1,2})?$/.test(n)?Math.round(100*parseFloat(n)):NaN:null},Object.defineProperty(e,"priceText",{enumerable:!0,get:function(){return s}}),e.itemProblems=a,e.draftProblems=i,e.cycleAllergen=function(t,n){const s={...t};s[n]?'contains'===s[n]?s[n]='may':delete s[n]:s[n]='contains';return s},e.postBoard=function(t,n,s,a,l,c,d){const u=i(s);if(u.length)throw new Error(u[0]);const p={id:d,restaurantId:n,photo:s.photo,app:l,postedBy:a,postedAt:c.toISOString(),items:s.items.map(t=>({...t,name:t.name.trim(),description:t.description.trim()})),allergenCheck:s.items.length?{by:a,at:c.toISOString()}:null};return{current:{...t.current,[n]:p},history:o(t.history,t.current[n],n)}},e.clearBoard=function(t,n){return{current:{...t.current,[n]:null},history:o(t.history,t.current[n],n)}},e.reuseBoard=function(t,n,s,a,i,l,c){const d=t.history.find(t=>t.id===s&&t.restaurantId===n);if(!d)return t;const u={...d,id:c,app:i,postedBy:a,postedAt:l.toISOString(),reusedFrom:d.id,allergenCheck:d.items.length?{by:a,at:l.toISOString()}:null},p={...t,history:t.history.filter(t=>t.id!==s)};return{current:{...t.current,[n]:u},history:o(p.history,t.current[n],n)}},e.deleteFromHistory=function(t,n){return{...t,history:t.history.filter(t=>t.id!==n)}},Object.defineProperty(e,"historyFor",{enumerable:!0,get:function(){return l}}),e.whenText=h,Object.defineProperty(e,"isToday",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"freshness",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"lastUpdated",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"boardSummary",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SAMPLE_ITEMS",{enumerable:!0,get:function(){return k}}),e.seedSpecials=function(n){const s=60*n.getHours()+n.getMinutes()>=702?S(n,0,11,42):new Date(n.getTime()-6e5),a=S(n,1,11,20),i=S(n,3,12,5);return{current:{anchorage:{id:'sb-seed-today',restaurantId:'anchorage',photo:null,items:k,postedAt:s.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:{by:'Head Chef (example)',at:s.toISOString()}}},history:[{id:'sb-seed-yday',restaurantId:'anchorage',photo:null,postedAt:a.toISOString(),postedBy:'Duty Manager (example)',app:'managers',allergenCheck:{by:'Duty Manager (example)',at:a.toISOString()},items:[{id:'sp-y1',name:'Pan-fried sea bass, samphire, brown shrimp butter (sample)',description:'Sample dish.',price:2100,allergens:{fish:'contains',crustaceans:'contains',milk:'contains'}},{id:'sp-y2',name:'Smoked haddock fishcake, poached egg (sample)',description:'Sample dish: with wholegrain mustard sauce.',price:1250,allergens:{fish:'contains',eggs:'contains',gluten:'contains',milk:'contains',mustard:'contains'}},{id:'sp-y3',name:'Lemon posset, shortbread (sample)',description:'Sample pudding.',price:750,allergens:{milk:'contains',gluten:'contains'}}]},{id:'sb-seed-photo',restaurantId:'anchorage',photo:t,items:[],postedAt:i.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:null}]}};const t='sample:chalkboard',n=8;const s=t=>null===t?'Ask your server':`\xa3${(t/100).toFixed(2)}`;function a(t){const n=[];t.name.trim().length<3&&n.push('Add a dish name'),null!==t.price&&(!Number.isFinite(t.price)||t.price<=0||t.price>5e4)&&n.push('Check the price');const s=Object.keys(t.allergens).length;return s||t.noAllergens||n.push('Choose its allergens, or tick \u201cNone of the 14\u201d'),s&&t.noAllergens&&n.push('Allergens chosen and \u201cNone of the 14\u201d both ticked'),n}function i(t){const n=[];return t.photo||t.items.length||n.push('Add a photo of the board or type at least one special'),t.items.forEach((t,s)=>a(t).forEach(t=>n.push(`Special ${s+1}: ${t}`))),t.items.length&&!t.allergensChecked&&n.push('Confirm you have checked the allergens'),n}const o=(t,s,a)=>{if(!s)return t;return[...[s,...t.filter(t=>t.restaurantId===a&&t.id!==s.id)].slice(0,n),...t.filter(t=>t.restaurantId!==a)]};const l=(t,n)=>t.history.filter(t=>t.restaurantId===n),c=t=>String(t).padStart(2,'0'),d=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],p=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate();function h(t,n){const s=new Date(t),a=`${c(s.getHours())}:${c(s.getMinutes())}`;if(p(s,n))return`today at ${a}`;const i=new Date(n);return i.setDate(i.getDate()-1),p(s,i)?`yesterday at ${a}`:`${d[s.getDay()]} ${s.getDate()} ${u[s.getMonth()]} at ${a}`}const m=(t,n)=>p(new Date(t),n),y=(t,n)=>`Updated ${h(t.postedAt,n)}`,f=(t,n)=>`Last updated ${h(t.postedAt,n)} by ${t.postedBy}`,b=t=>[t.photo?'Photo':'',t.items.length?`${t.items.length} typed special${1===t.items.length?'':'s'}`:''].filter(Boolean).join(' + '),S=(t,n,s,a)=>{const i=new Date(t);return i.setDate(i.getDate()-n),i.setHours(s,a,0,0),i},k=[{id:'sp-hake',name:'Grilled hake, crushed new potatoes, salsa verde (sample)',description:'Sample dish: day-boat hake, lemon and caper salsa verde.',price:1950,allergens:{fish:'contains',mustard:'contains',sulphites:'may'}},{id:'sp-scallops',name:'Half-shell scallops, garlic and herb butter (sample)',description:'Sample dish: three scallops grilled in the shell, crusty bread.',price:1400,allergens:{molluscs:'contains',milk:'contains',gluten:'contains'}},{id:'sp-crab',name:'Crab and chilli linguine (sample)',description:'Sample dish: brown and white crab meat, chilli, parsley, lemon.',price:1850,allergens:{crustaceans:'contains',gluten:'contains',eggs:'contains',molluscs:'may'}},{id:'sp-mussels',name:'Mussels in cider and leek cream (sample)',description:'Sample dish: rope-grown mussels, dry cider, leeks, cream. Main with chips.',price:1300,allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',celery:'may'}}]},865,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addressWithoutInvite",{enumerable:!0,get:function(){return u.addressWithoutInvite}}),Object.defineProperty(_e,"inviteFromLocation",{enumerable:!0,get:function(){return u.inviteFromLocation}}),Object.defineProperty(_e,"useSession",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"rosterPerson",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"APP_NAME",{enumerable:!0,get:function(){return S}}),_e.sha256Hex=y,_e.inviteFromText=function(e){const t=e.trim(),n=t.match(/[?&#](?:invite|i)=([A-Za-z0-9_-]{10,})/);return n?n[1]:/^[A-Za-z0-9_-]{10,}$/.test(t)?t:null},_e.personForInvite=async function(e){if(a.IS_ISOLATED_VENUE)return;const t=await y(e);return t?l.ROSTER.find(e=>e.tokenHash===t):void 0},Object.defineProperty(_e,"DEVICE_KEY",{enumerable:!0,get:function(){return p}}),_e.deviceId=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(p);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(p,e)}return e}catch{return null}},Object.defineProperty(_e,"PHONE_KEY",{enumerable:!0,get:function(){return I}}),_e.phoneKey=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(I);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(I,e)}return e}catch{return null}},Object.defineProperty(_e,"START_INVITE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"START_HANDOVER",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"START_KITCHEN",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"START_GO",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"START_LOYALTY_CODE",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"START_TABLE_TOKEN",{enumerable:!0,get:function(){return O}}),_e.appUrl=function(e,t){if('undefined'==typeof window||!window.location)return null;const{origin:n,pathname:o}=window.location,i=o.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/),a=i?i[1]:'/';return`${n}${a}${e}-app/index.html${t?`#invite=${encodeURIComponent(t)}`:''}`},_e.levelJob=function(e,t){const n=(e??'').trim(),o=(t??'').trim();return n?!o||o.toLowerCase().startsWith(n.toLowerCase())?o||n:`${n} \xb7 ${o}`:o};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]),a=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]),u=r(d[7]),f=r(d[8]);const w={getItem:e=>{try{if((0,f.isKitchenViaDisplay)())return Promise.resolve('undefined'!=typeof sessionStorage?sessionStorage.getItem((0,f.kitchenSessionStoreName)()):null)}catch{}return n.default.getItem(e)},setItem:(e,t)=>{try{if((0,f.isKitchenViaDisplay)())return sessionStorage.setItem((0,f.kitchenSessionStoreName)(),t),Promise.resolve()}catch{}return n.default.setItem(e,t)},removeItem:e=>{try{(0,f.isKitchenViaDisplay)()&&sessionStorage.removeItem((0,f.kitchenSessionStoreName)())}catch{}return n.default.removeItem(e)}},h=(0,o.create)()((0,i.persist)(e=>({meId:null,welcomed:{},signIn:t=>e({meId:t,signedInAt:(new Date).toISOString()}),signOut:()=>e({meId:null,signedInAt:void 0}),markWelcomed:t=>e(e=>({welcomed:{...e.welcomed,[t]:(new Date).toISOString()}}))}),{name:c.IS_CAR?'covercharge-car-session-v1':'covercharge-session-v1',storage:(0,i.createJSONStorage)(()=>w),version:c.IS_CAR?2:1,partialize:e=>(0,s.persistedSessionSlice)(c.IS_CAR,e),migrate:e=>c.IS_CAR?(0,s.migrateCarSession)(e):e})),m=e=>!a.IS_ISOLATED_VENUE&&e?l.ROSTER.find(t=>t.id===e):void 0,S={owner:'CoverCharge for Managers',staff:'CoverCharge for Staff',chef:'CoverCharge for Head Chef'};async function y(e){const t=globalThis.crypto?.subtle;if(!t)return null;const n=await t.digest('SHA-256',(new TextEncoder).encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,'0')).join('')}const p=(0,a.venueKey)('covercharge-device-id');const I=(0,a.venueKey)('covercharge-phone-key');const v=(()=>{try{if('undefined'==typeof window||!window.location)return null;if(c.IS_CAR){try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(null,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}return null}const e=(0,a.venueKey)(`cc-pending-invite:${c.APP_VARIANT}`);let t=(0,u.inviteFromLocation)(window.location.search,window.location.hash);try{t?localStorage.setItem(e,t):t=localStorage.getItem(e)}catch{}if(t&&!/^[A-Za-z0-9_-]{10,64}$/.test(t)&&(t=null),t&&window.history?.replaceState){const e=()=>{try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};e();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[?&#]invite=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const t of[300,1e3,2500,5e3,1e4,2e4])setTimeout(e,t)}return t}catch{return null}})(),A=(()=>{try{if('undefined'==typeof window||!window.location||c.IS_CAR)return null;const e=(0,u.handoverFromHash)(window.location.hash);if(!e)return null;const t=()=>{try{/[#&]ccchrome=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};t();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[#&]ccchrome=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const e of[300,1e3,2500,5e3])setTimeout(t,e);return e}catch{return null}})(),b=(()=>{try{if('undefined'==typeof window||!window.location||c.IS_CAR)return null;const e=(0,f.kitchenTicketFromHash)(window.location.hash);if(!e)return null;const t=()=>{try{/[#&]cckitchen=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};t();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[#&]cckitchen=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const e of[300,1e3,2500,5e3])setTimeout(t,e);return e}catch{return null}})(),_=(()=>{try{return'undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('go'):null}catch{return null}})(),T=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('loyalty'):null;return e&&/^[A-Za-z0-9-]{4,12}$/.test(e)?e.toUpperCase():null}catch{return null}})(),O=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('table'):null;return e&&/^[A-Za-z2-9]{16}$/.test(e)?e.toUpperCase():null}catch{return null}})()},866,[1190,995,1191,5,807,1275,15,1274,979]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},867,[31,128,878,818,823,866,1072,845,825,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BUILTIN_LOGOS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HERO_LOGOS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"HEADER_LOGO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACCENTS",{enumerable:!0,get:function(){return z}}),_e.useBrandRid=k,_e.useBrand=A,_e.PoweredBy=H,_e.RestaurantLogo=L,_e.RestaurantHero=function({rid:e,size:r=200,showPlace:o=!0}){const c=A(e),u='wildings'===c.rid||'greenside'===c.rid||'kirkton'===c.rid||'abbotsford'===c.rid||(0,t.isQueuedVenue)(c.rid),x='yasmins'===c.rid?c.logo:u?S[c.rid]:c.custom?c.logo:S[c.rid]??c.logo;return(0,p.jsxs)(s.default,{testID:"restaurant-hero",style:{alignItems:'center',gap:6},children:[x?(0,p.jsx)(l.default,{source:x,accessibilityLabel:`${c.name} logo`,style:{width:r,height:r,borderRadius:!u&&c.custom?r/2:0},resizeMode:"contain"}):(0,p.jsx)(L,{rid:c.rid,size:r}),u?null:(0,p.jsx)(n.Text,{testID:"restaurant-hero-name",style:[{fontFamily:f.fonts.semibold,fontSize:26,lineHeight:34,color:f.colours.text,textAlign:'center'},(0,h.webLine)({lineHeight:34},26)],children:c.name}),o&&c.place?(0,p.jsx)(n.Text,{style:[{fontFamily:f.fonts.regular,fontSize:14,lineHeight:20,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:20},14)],children:c.place}):null]})},_e.VenueName=I,_e.RestaurantBrand=function({rid:e,sub:t,size:r=T,nameSuffix:o,beside:l}){const c=A(e);if('display'===x.APP_VARIANT||l)return(0,p.jsx)(s.default,{style:{gap:2,flexShrink:1},children:(0,p.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,p.jsx)(L,{rid:c.rid,size:r}),(0,p.jsxs)(s.default,{style:{flexShrink:1,flex:1,minWidth:0},children:[(0,p.jsx)(I,{name:c.name+(o??''),lines:2,bold:!0}),(0,p.jsx)(s.default,{testID:"display-powered-by",style:{marginLeft:14,marginTop:-1},children:(0,p.jsx)(H,{})}),t?(0,p.jsx)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:c.accentText},(0,h.webLine)({lineHeight:16},12)],children:t}):null]})]})});return(0,p.jsxs)(s.default,{testID:"venue-header-block",dataSet:{centre:'heading'},style:{gap:4,alignItems:'center',alignSelf:'center',maxWidth:420,width:'100%'},children:[(0,p.jsx)(L,{rid:c.rid,size:r}),(0,p.jsx)(I,{name:c.name+(o??'')}),t?(0,p.jsx)(n.Text,{numberOfLines:2,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:16},12)],children:t}):null,(0,p.jsx)(H,{})]})},_e.VenueHeaderBlock=function({rid:e,name:t,badge:r,place:o}){return(0,p.jsxs)(s.default,{testID:"venue-header-block",dataSet:{centre:'heading'},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',alignSelf:'center',gap:12,maxWidth:420,width:'100%'},children:[(0,p.jsx)(L,{rid:e,size:44}),(0,p.jsxs)(s.default,{style:{flexShrink:1,minWidth:0,alignItems:'center',gap:2},children:[(0,p.jsx)(I,{name:t}),(0,p.jsx)(s.default,{testID:"app-badge",accessibilityLabel:`${r} app`,style:{borderWidth:1,borderColor:f.colours.gold,borderRadius:6,paddingHorizontal:6,paddingVertical:1},children:(0,p.jsx)(n.Text,{style:[{fontFamily:f.fonts.bold,fontSize:10,lineHeight:14,color:f.colours.gold,textAlign:'center'},(0,h.webLine)({lineHeight:14},10)],children:r})}),o?(0,p.jsx)(n.Text,{testID:"venue-header-place",dataSet:{centre:'heading'},style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:f.colours.muted,textAlign:'center'},(0,h.webLine)({lineHeight:16},12)],children:o}):null,(0,p.jsx)(H,{})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=e(_r(d[3])),l=e(_r(d[4]));_r(d[5]);var s=e(_r(d[6])),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),x=_r(d[11]),b=_r(d[12]),y=_r(d[13]),j=_r(d[14]),p=_r(d[15]);const w={"3idiots":_r(d[16]),cecchinis:_r(d[17]),mrbasrais:_r(d[18]),yasmins:_r(d[19]),williewastles:_r(d[20]),rupeeroom:_r(d[21]),smokinggoat:_r(d[22]),pizzaioli:_r(d[23]),drunkencoo:_r(d[24]),abbotsford:_r(d[25]),kirkton:_r(d[26]),greenside:_r(d[27]),wildings:_r(d[28]),kirkmichael:_r(d[29]),souters:_r(d[30]),anchorage:_r(d[31]),saltmarsh:_r(d[32]),brae:_r(d[33])},S={"3idiots":_r(d[34]),cecchinis:_r(d[35]),mrbasrais:_r(d[36]),yasmins:_r(d[37]),williewastles:_r(d[38]),rupeeroom:_r(d[39]),smokinggoat:_r(d[40]),pizzaioli:_r(d[41]),drunkencoo:_r(d[42]),abbotsford:_r(d[43]),kirkton:_r(d[44]),greenside:_r(d[45]),wildings:_r(d[46]),kirkmichael:_r(d[47]),souters:_r(d[30]),anchorage:_r(d[48])};y.PITCH&&!y.PITCH_ANCHORAGE&&(delete w.anchorage,delete S.anchorage);const T=48,z=['#CFA45F','#D4AF61','#C9A24A','#E2C489','#F2EDE4','#A88B5A','#B08D57','#D9774B'];function k(e){const t=(0,r.useGlobalSearchParams)(),n=(0,u.useOwner)(e=>e.site),o='string'==typeof t.rid?t.rid:void 0;return b.IS_ISOLATED_VENUE?b.VENUE_RID:e??o??n??b.VENUE_RID}function A(e){const t=k(e),n=(0,c.useStore)(e=>e.restaurants.find(e=>e.id===t)),r=(0,u.useOwner)(e=>e.branding[t]),l=r?.logoUri?{uri:r.logoUri}:w[t],s=r?.accent??f.colours.gold,h=o.default.useMemo(()=>(0,j.checkAccent)(s,f.colours.bg,f.colours.onGold,f.colours.text),[s]);return{rid:t,name:n?.name??'Restaurant',place:n?.location??'',logo:l,accent:s,accentText:h.accentText,onAccent:h.onAccent,custom:!!r?.logoUri}}function H({size:e=10}){return(0,p.jsxs)(n.Text,{accessibilityLabel:"powered by CoverCharge",style:[{fontFamily:f.fonts.regular,fontSize:e,lineHeight:Math.round(1.35*e),color:f.colours.muted,textAlign:'center'},(0,h.webLine)({lineHeight:Math.round(1.35*e)},e)],children:["powered by ",(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.text},children:"Cover"}),(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.gold},children:"Charge"})]})}function L({rid:e,size:t=T}){const r=A(e);if(r.logo)return(0,p.jsx)(l.default,{source:r.logo,accessibilityLabel:`${r.name} logo`,style:{width:t,height:t,borderRadius:r.custom?t/2:0},resizeMode:"contain"});const o=r.name.replace(/^The /,'').split(/\s+/).map(e=>e[0]).join('').slice(0,2).toUpperCase();return(0,p.jsx)(s.default,{accessibilityLabel:`${r.name} logo`,style:{width:t,height:t,borderRadius:t/2,borderWidth:2,borderColor:r.accentText,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.bold,color:r.accentText,fontSize:.36*t},children:o})})}function I({name:e,size:t=17,lines:r,bold:o}){return(0,p.jsx)(n.Text,{testID:"venue-header-name",accessibilityRole:"header",accessibilityLabel:e,numberOfLines:r,style:[{fontFamily:o?f.fonts.bold:f.fonts.semibold,fontSize:t,lineHeight:Math.ceil(1.35*t),color:f.colours.text,textAlign:'center',flexShrink:1,minWidth:0},(0,h.webLine)({lineHeight:Math.ceil(1.35*t)},t),{overflowWrap:'normal',wordBreak:'keep-all'}],children:e})}},868,[6,874,805,31,197,123,128,823,863,825,1348,807,5,2,1346,25,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PUB_LOCATIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"privateClockVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"pubLocation",{enumerable:!0,get:function(){return s}}),e.venueClockArea=function(a,o={}){if((0,t.isQueuedVenue)(a)&&!t.queuedVenues[a].clockArea.on)return(0,n.cleanArea)({...o,on:!0===o.on&&'number'==typeof o.lat&&'number'==typeof o.lng,offRotaPrompt:!1});const l=s(a);if(!l)return(0,n.cleanArea)(o);const c=(0,n.cleanArea)({lat:l.lat,lng:l.lng,radius:150,...o});return{...c,lat:c.lat??l.lat,lng:c.lng??l.lng,on:!0,offRotaPrompt:!1}},e.venueClockGeo=l,e.privateAttendance=function(n,a){if(!o(n)&&!(0,t.isQueuedVenue)(n))return a;const s={...a};for(const t of['lat','lng','latitude','longitude','coords','position','location','acc','dist','accuracy','distance','outSite'])delete s[t];a.geo&&(s.geo=a.geo.map(t=>l(n,t)).filter(t=>!!t));return s};var t=r(d[0]),n=r(d[1]);const a={"3idiots":{name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",lat:55.4650286,lng:-4.6283062,source:"Verified exact-address venue pack"},cecchinis:{name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",lat:55.461505,lng:-4.6345736,source:"Verified exact-address venue pack"},williewastles:{name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",lat:55.4646261,lng:-4.6323929,source:"Verified exact-address venue pack"},smokinggoat:{name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",lat:55.464226,lng:-4.6326035,source:"Verified exact-address venue pack"},drunkencoo:{name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",lat:55.4570308,lng:-4.6294663,source:"Verified exact-address venue pack"},abbotsford:{name:'The Abbotsford Hotel',address:'14 Corsehill Road, Ayr KA7 2ST',lat:55.4488797,lng:-4.6314856,source:'Official FSA1696388, exact address match verified6 Nov2026'},kirkton:{name:'The Kirkton Inn',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',lat:55.3971215,lng:-4.5920177,source:'Public FSA establishment1955433 verified6 November2026'},greenside:{name:'The Greenside Restaurant',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',lat:55.3542369,lng:-4.6851418,source:'Official Find us Google Maps link, place point, verified 6 November 2026'},kirkmichael:{name:'The Kirkmichael Arms',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',lat:55.3458202,lng:-4.6180793,source:'venue-profile.json geo, matched to the venue address'},souters:{name:"Souter\u2019s Inn",address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',lat:55.3297218,lng:-4.7772979,source:'Food Standards Agency establishment 1863840, address matched'}},o=t=>Object.prototype.hasOwnProperty.call(a,t),s=t=>o(t)?a[t]:void 0;function l(n,a){return o(n)||(0,t.isQueuedVenue)(n)?'in'===a.action?{action:'in',at:a.at,inside:a.inside,...a.override?{override:{by:a.override.by,byId:a.override.byId,reason:a.override.reason}}:{}}:void 0:a}},869,[6,870]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_RADIUS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_RADIUS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ACCURACY_CAP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_BREAK_OPTIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_CLOCK_AREA",{enumerable:!0,get:function(){return r}}),e.distanceM=s,Object.defineProperty(e,"validLat",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validLng",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"areaSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"clampRadius",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"accuracyAllowance",{enumerable:!0,get:function(){return p}}),e.isInside=h,e.cleanArea=function(t){const n=(t.breakOptions??a).map(t=>Math.round(Number(t))).filter(t=>Number.isFinite(t)&&t>0&&t<=180);return{...r,...t,lat:c(t.lat)?t.lat:null,lng:l(t.lng)?t.lng:null,radius:f(t.radius??r.radius),on:!1!==t.on,offRotaPrompt:!1!==t.offRotaPrompt,breakOptions:[...new Set(n)].sort((t,n)=>t-n).slice(0,12),offRotaTitle:(t.offRotaTitle??'').trim().slice(0,80)||r.offRotaTitle,offRotaBody:(t.offRotaBody??'').trim().slice(0,160)||r.offRotaBody}},Object.defineProperty(e,"ACTION_WORD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DENIED_TEXT",{enumerable:!0,get:function(){return m}}),e.gate=function(t,n,o,a,r="browser"){if(!t.on||!d(t)){const r={action:n,at:a,inside:null,unchecked:!0};return'object'==typeof o&&Object.assign(r,{lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc)}),{allowed:!0,geo:r,warn:t.on?'The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':void 0}}if('object'!=typeof o){const t='app-phone-off'===r?m['app-phone-off']:'denied'===o?m[r]:'timeout'===o?'Your phone couldn\u2019t find your location in time. Step outside or near a window and try again.':'unsupported'===o?'This phone or browser can\u2019t share its location. Ask a manager to record it for you.':'Your phone couldn\u2019t find your location. Check Location is on, then try again.';return{allowed:!1,message:`You need to be at the venue to ${b[n]}. ${t}`,geo:{action:n,at:a,inside:!1}}}const u=h(t,o),s={action:n,at:a,lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc),dist:u.dist,inside:u.inside};if(u.inside)return{allowed:!0,geo:s};const c=u.dist>=1e3?`${(u.dist/1e3).toFixed(1)} km`:`${u.dist} m`;return{allowed:!1,geo:s,message:`You need to be at the venue to ${b[n]}. You look to be about ${c} away (allowed ${u.limit} m). If you\u2019re at the venue, try again in a moment or ask a manager to record it for you.`}},e.overrideGeo=function(t,n,o,a){const r=a.trim();return r.length<3?null:{action:t,at:n,inside:null,override:{by:o.name,byId:o.id,reason:r.slice(0,200)}}},e.offRotaDue=function(t){return!(!(t.area.offRotaPrompt&&d(t.area)&&t.inside)||t.clockedIn||t.dismissedToday)&&!t.shifts.some(n=>t.nowHours>=n.start-1&&t.nowHours<(n.end<=n.start?n.end+24:n.end))},Object.defineProperty(e,"breakLabel",{enumerable:!0,get:function(){return O}});const t=50,n=2e3,o=50,a=[5,10,15,20,30,45,60],r={lat:null,lng:null,radius:100,on:!0,breakOptions:[...a],offRotaPrompt:!0,offRotaTitle:'Do you want to sign in?',offRotaBody:'Should you be on the rota?'},u=t=>t*Math.PI/180;function s(t,n){const o=u(n.lat-t.lat),a=u(n.lng-t.lng),r=Math.sin(o/2)**2+Math.cos(u(t.lat))*Math.cos(u(n.lat))*Math.sin(a/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(r)))}const c=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-90&&t<=90,l=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-180&&t<=180,d=t=>c(t.lat)&&l(t.lng),f=o=>Number.isFinite(o)?Math.min(n,Math.max(t,Math.round(o))):r.radius,p=t=>Number.isFinite(t)&&t>0?Math.min(t,o):0;function h(t,n){const o=s({lat:t.lat,lng:t.lng},n),a=f(t.radius)+p(n.acc);return{inside:o<=a,dist:Math.round(o),limit:Math.round(a)}}const b={in:'clock in',out:'clock out',break_start:'start a break',break_end:'end your break'},m={browser:'Location is turned off for this browser. Turn it on in your phone\u2019s settings (Location \u203a allow for this browser), then try again.',iphone:'Location is turned off for this app. On your iPhone open Settings \u203a Privacy & Security \u203a Location Services \u203a Safari Websites and choose While Using the App, then try again.',app:'Location is turned off for this app. Tap Open app settings, then Permissions \u203a Location \u203a Allow only while using the app. Then come back and try again.','app-old':'This version of the app can\u2019t use location. Tap Update the app at the bottom of the screen, then tap Allow when your phone asks.','app-phone-off':'Location is switched off on your phone. Tap Open location settings, turn on Use location, then come back and try again.'};const y=t=>Math.round(1e6*t)/1e6;const O=t=>60===t?'1 hour':t%60==0?t/60+" hours":t>60?`${Math.floor(t/60)} h ${t%60} min`:`${t} min`},870,[]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},871,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FETCH_TIMEOUT_MS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"READER_TIMEOUT_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"fetchLimitMs",{enumerable:!0,get:function(){return _}}),_e.fetchWithTimeout=S,_e.getSupabase=function(){if(c)return c;if(!(0,s.isSupabaseConfigured)())throw new Error('Supabase is not configured: set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in .env.local');return c=(0,o.createClient)(s.SUPABASE_URL,s.SUPABASE_ANON_KEY,{auth:{storage:n.default,persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!1,storageKey:`${(0,u.syncNamespace)()}auth`},realtime:{params:{eventsPerSecond:10}},global:{fetch:S}}),c},_e.setSupabaseClient=function(e){c=e};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),u=r(d[3]);let c=null;const f=2e4,l=15e4,b=/\/functions\/v1\/(delivery-read|plan-photo-read)(\?|$)/,_=e=>b.test(e)?l:/\/storage\/v1\//.test(e)?12e4:f;function S(e,t){const n='string'==typeof e?e:e instanceof URL?e.href:e.url,o=_(n);if('undefined'==typeof AbortController)return fetch(e,t);const s=new AbortController,u=t?.signal;u&&(u.aborted?s.abort():u.addEventListener('abort',()=>s.abort(),{once:!0}));const c=setTimeout(()=>s.abort(),o);return fetch(e,{...t,signal:s.signal}).catch(e=>{if(s.signal.aborted&&!u?.aborted)throw new TypeError(`Failed to fetch (network timeout after ${o/1e3} s)`);throw e}).finally(()=>clearTimeout(c))}},872,[1190,1226,1170,1268]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedSessions=o,e.queuedRequestSlots=u,e.queuedRequestError=function(t,o,s,a=new Date){if(o.name.trim().length<2||o.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(o.phone)||!/^[0-9]{7,15}$/.test(o.phone.replace(/\D/g,''))||o.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email))return'Enter your name, phone number and email.';if(o.notes.length>2e3)return'Keep notes under 2000 characters.';const c=(0,n.localDate)(a),d=(0,n.localDate)(new Date(+a+63072e6));if(!o.date||o.dated||!u(t,o.date,s).includes(o.time||''))return'Choose a future date and a time within confirmed kitchen service hours.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return o.date===c&&(o.time||'')<=l?'Choose a future time.':!Number.isInteger(o.covers)||o.covers<1||o.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]),n=r(_d[1]);function o(n){const o=t.queuedVenues[n];return o?.kitchenSessionsByDay??o?.hours.sessionsByDay??void 0}const s=t=>60*+t.slice(0,2)+ +t.slice(3);function u(n,u,a){if(!/^\d{4}-\d{2}-\d{2}$/.test(u))return[];const c=new Date(u+'T12:00:00Z');if(!Number.isFinite(+c)||c.toISOString().slice(0,10)!==u)return[];const d=(a??o(n))?.[c.getUTCDay()];if(!Array.isArray(d))return[];const l=[],f=t.queuedVenues[n]?.booking.lastSittingMinutesBeforeClose??0;for(const t of d){if(!Array.isArray(t)||2!==t.length||!t.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))continue;const n=s(t[0]),o=s(t[1]);if(!(n>=o))for(let t=n;t(0,t.getSupabase)();const s=e=>{const t=String(e?.message||'');return/^(Requests are not enabled|Too many|Please complete|Enter your|Choose |This request|Only this venue)/.test(t)?t:'Unable to send or load requests. Check your connection and try again, or call the hotel.'}},875,[6,872]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_BG",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SOUTERS_SURFACE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_TYPE_SCALE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"soutersFont",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"soutersSurface",{enumerable:!0,get:function(){return f}}),e.soutersInk=function(o){if(!t.IS_SOUTERS)return o;const c=(0,n.normaliseHex)(o);return c?'#A4622E'===c?'#D9AD8A':(0,n.contrast)(c,u)<4.5?'#FFFFFF':o:o};var t=r(d[0]),n=r(d[1]);const u='#56152A',o='#43122F',c=.88,S=n=>t.IS_SOUTERS?Math.round(n*c*100)/100:n,f=n=>t.IS_SOUTERS?o:n},876,[5,1346]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.specialsBoardSpec=function(r,s){return{name:'specials_boards',table:'specials_boards',conflict:'venue_id',deletes:!1,list:()=>[{id:r,board:t.useSpecials.getState().current[r]??null}],key:()=>r,rowKey:()=>r,syncable:t=>!t.board||!String(t.board.id).startsWith('sb-seed'),writable:s,toRow:(t,s)=>({venue_id:s,doc:{board:t.board?{...t.board,restaurantId:r}:null},updated_at:(new Date).toISOString()}),fromRow:t=>({id:r,board:t.doc?.board??null}),apply:s=>{const n=s[0];if(!n)return;const o=n.board;o&&o.restaurantId&&o.restaurantId!==r||t.useSpecials.setState(t=>({current:{...t.current,[r]:o}}))},subscribe:r=>t.useSpecials.subscribe((t,s)=>{t.current!==s.current&&r()})}},Object.defineProperty(e,"specialsSyncOn",{enumerable:!0,get:function(){return c}}),e.watchGuestSpecials=function(c,l=()=>{}){if(!r.RELEASE.specialsSync||!(0,n.isSupabaseConfigured)())return()=>{};let u=!1;const p=async()=>{const r=t.useSpecials.getState().current[c]??null;let n;try{const t=(0,o.getSupabase)(),{data:r,error:l}=await t.rpc('guest_specials',{p_slug:c});if(l)n={ok:!1,message:s.GUEST_SPECIALS_OFFLINE};else if(r&&'object'==typeof r){const t=r,s='string'==typeof t.postedAt?t.postedAt:'',o=Array.isArray(t.items)?t.items:[],l=t.photo??null;n=s||l||o.length?{ok:!0,board:{id:`sb-sync-${c}`,restaurantId:c,photo:l,items:o,postedAt:s||new Date(0).toISOString(),postedBy:'',app:'managers',allergenCheck:null}}:{ok:!0,board:null}}else n={ok:!0,board:null}}catch{n={ok:!1,message:s.GUEST_SPECIALS_OFFLINE}}if(u)return;const p=(0,s.guestSpecialsAfter)(t.useSpecials.getState().current[c]??null,n);p.board!==r&&t.useSpecials.setState(t=>({current:{...t.current,[c]:p.board}})),l(p.note)};p();const S=setInterval(()=>{p()},6e4);return()=>{u=!0,clearInterval(S)}};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]),o=_r(d[4]);const c=()=>r.RELEASE.specialsSync},877,[864,1069,1297,1170,872]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},878,[31,128,1491,825,25]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.forecastToday=function(u,c,h,f,p,v){const k=(0,e.venueBusy)(u,c,p),M=(0,a.examplesAllowed)(),b=(0,n.clampWeeks)(u.settings.forecastMinWeeks),w=M?null:v??(0,n.buildHistory)(u.id,c,h,[],p,b),H=M||!!w?.enough,O=(0,r.hoursFor)(u,p),S=[],C=(0,s.ymd)(p);let I=1;for(const e of f.filter(e=>e.date===C&&(null===e.restaurantId||e.restaurantId===u.id)))S.push(e.title.replace(/\s*\(substitute day\)/gi,'')),!1!==e.busier&&(I*='bank-holiday'===e.kind?1.25:'event'===e.kind?1.15:1.1);if(!O)return{busy:k,open:!1,hours:[],restOfDay:{covers:0,low:0,high:0,takeaway:0,booked:0},flags:S,suggestions:['Kitchen closed today (per listed hours).'],multiplier:I,example:M,enough:H,minWeeks:b};const x=M?o.EXAMPLE_HISTORY[u.id]??o.EXAMPLE_HISTORY.default:H&&w?w:{covers:{},takeaway:{}},E=p.getDay(),N=l(u,p),$=(0,t.lastFoodOn)(u,C);let _=O.close.getMinutes()>0?O.close.getHours():O.close.getHours()-1;if($){const[e,t]=$.time.split(':').map(Number);_=Math.min(_,t>0?e:e-1),'kitchen closes'!==$.reason&&S.push(`Last food orders ${$.time} (${$.reason})`)}const P=c.filter(e=>e.restaurantId===u.id&&e.date===C&&['confirmed','seated','finished'].includes(e.status)),T=P.filter(e=>!e.walkIn&&'finished'!==e.status).map(e=>Number(e.time.slice(0,2))),A=Math.min(N[0],O.open.getHours(),...T),L=Math.max(N[1],_,...T),R=[];for(let e=A;e<=L;e++){const t=e>=O.open.getHours()&&e<=_,o=x.covers[E]?.[e]??0,r=x.takeaway[E]?.[e]??0,a=P.filter(t=>!t.walkIn&&'finished'!==t.status&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),n=P.filter(t=>t.walkIn&&['seated','finished'].includes(t.status)&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),i=t?Math.round(o*u.settings.walkInShare*I):0,c=H&&t?Math.max(0,Math.round(o*I*(1-u.settings.walkInShare))-a):0,l=Math.max(n,i)+c,f=a+l,p=h.filter(t=>t.restaurantId===u.id&&'takeaway'===t.type&&'cancelled'!==t.status&&t.slotTime&&new Date(t.slotTime).getHours()===e&&(0,s.ymd)(new Date(t.slotTime))===C).length,y=t?Math.max(p,Math.round(r*I)):p;R.push({hour:e,booked:a,walkIns:l,covers:f,coversLow:H?Math.round(.8*f):f,coversHigh:H?Math.round(1.2*f):f,takeawayPlaced:p,takeaway:y,historicalCovers:o})}const D=y(u,E);if(H&&D){const e=D-R.reduce((e,t)=>e+t.covers,0),t=R.filter(e=>e.hour>=O.open.getHours()&&e.hour<=_);if(e>0&&t.length){const o=t.map(e=>e.historicalCovers),r=i(e,o.reduce((e,t)=>e+t,0)>0?o:t.map(()=>1));t.forEach((e,t)=>{const o=r[t];o&&(e.floorAdded=o,e.walkIns+=o,e.covers+=o,e.coversHigh=Math.max(e.coversHigh,Math.round(1.2*e.covers)))})}const o=R.reduce((e,t)=>e+t.coversLow,0);if(oMath.max(1,e.covers)));t.forEach((t,o)=>{t.coversLow=Math.min(t.covers,t.coversLow+e[o])})}}const j=p.getHours()+(p.getMinutes()>=30?1:0),W=R.filter(e=>e.hour>=j),F=W[0],B=e=>W.reduce((t,o)=>t+e(o),0),G={covers:B(e=>e.covers),low:B(e=>e.coversLow),high:B(e=>e.coversHigh),takeaway:B(e=>e.takeaway),booked:B(e=>e.booked)},z=[],V=u.settings.capacityPerHour,X=W.reduce((e,t)=>!e||t.covers>e.covers?t:e,void 0);X&&X.covers>=.85*V&&z.push(`Dining room near capacity around ${String(X.hour).padStart(2,'0')}:00 (about ${X.covers} of ${V} covers) \u2014 consider pausing or capping takeaway slots then.`);const Y=W.find(e=>e.historicalCovers>0&&e.covers>1.1*e.historicalCovers);Y&&z.push(`Busier than a usual ${['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][E]} from ${String(Y.hour).padStart(2,'0')}:00 \u2014 consider one more on the floor.`);G.takeaway>=10&&z.push(`About ${G.takeaway} takeaway orders expected \u2014 prep extra haddock and chips.`);H||z.unshift(`Not enough history yet. ${(0,a.notEnoughTip)(b)}`);z.length||z.push('Looks like a normal service \u2014 no action suggested.');return{busy:k,open:!0,nextHour:F,hours:R,restOfDay:G,flags:S,suggestions:z,multiplier:I,example:M,enough:H,minWeeks:b,minCovers:D??void 0}},_e.spread=i,Object.defineProperty(_e,"ANCHORAGE_FORECAST_HOURS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"forecastHoursOf",{enumerable:!0,get:function(){return c}}),_e.forecastWindow=l,Object.defineProperty(_e,"ANCHORAGE_MIN_COVERS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"MIN_COVERS_NOTE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"minCoversOf",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"minCoversOn",{enumerable:!0,get:function(){return y}}),_e.coversRange=function(e,t,o=!0){const r=Math.min(e,t),s=Math.max(e,t),a=r===s?String(r):`${r} to ${s}`;return o?`${a} ${1===s?'Cover':'Covers'}`:a};var e=_r(d[0]),t=_r(d[1]),o=_r(d[2]),r=_r(d[3]),s=_r(d[4]),a=_r(d[5]),n=_r(d[6]);function i(e,t){const o=t.reduce((e,t)=>e+t,0)||1,r=t.map(t=>e*t/o),s=r.map(Math.floor);let a=e-s.reduce((e,t)=>e+t,0);return r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]).forEach(([,e])=>{a>0&&(s[e]++,a--)}),s}const u={0:['12:00','22:00'],1:null,2:null,3:['12:00','22:00'],4:['12:00','22:00'],5:['12:00','22:00'],6:['12:00','22:00']},c=e=>e.settings.forecastHours??('anchorage'===e.id?u:{});function l(e,t){const o=(0,r.hoursFor)(e,t),s=o.close.getMinutes()>0?o.close.getHours():o.close.getHours()-1,a=c(e)[t.getDay()];if(!a)return[o.open.getHours(),s];const[n]=a[0].split(':').map(Number),[i,u]=a[1].split(':').map(Number);return[Math.min(n,o.open.getHours()),Math.max(u>0?i:i-1,s)]}const h={0:50,6:50},f='Gordon, 4 Nov 2026',p=e=>e.settings.minCoversByDay??('anchorage'===e.id?h:{}),y=(e,t)=>{const o=p(e)[t];return o&&o>0?Math.round(o):null}},879,[933,814,1441,833,822,1218,1094]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.estimateWait=function(t,n,u){const o=Math.max(6,Math.round(n/6*u));return t*o}},880,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return y.uuid}}),_e.nowFrom=S,_e.linesFromBasket=w,Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return u.DEMO_CUSTOMER_ID}});var e,t=_r(d[0]),a=_r(d[1]),r=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),o=(e=i)&&e.__esModule?e:{default:e},l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),g=_r(d[9]),m=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),k=_r(d[14]),y=_r(d[15]);const $=(e,t,a)=>e.reduce((e,a)=>a.startsWith(t)?Math.max(e,Number(a.slice(t.length))||0):e,a)+1,I=e=>`${e}-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-3)}`;function S(e){return'live'===e.mode?new Date:new Date(e.simStartMs+(Date.now()-e.anchorRealMs))}function h(){const e=(0,u.defaultSimStart)();return{clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},...(0,u.buildSeed)(e),outbox:[],msgTemplates:{}}}function w(e,t,a){return e.lines.flatMap(e=>{const r=t.find(t=>t.id===e.itemId);if(!r)return[];const n=(0,b.resolveItem)(r),s=(n.optionGroups??[]).flatMap(t=>t.choices.filter(t=>e.choiceIds.includes(t.id))),i=(n.price??0)+s.reduce((e,t)=>e+t.priceDelta,0),o=(0,p.conflictsFor)((0,p.effectiveAllergens)(n,e.choiceIds),a);return[{itemId:n.id,name:n.name,qty:e.qty,unitPrice:i,choices:s.map(e=>e.label),notes:e.notes,contains:o.contains,may:o.may,overridden:!!e.override&&o.contains.every(t=>e.override.allergens.includes(t)),prepMins:n.prepMins,choiceIds:s.map(e=>e.id)}]})}const O=e=>{const t='ABCDEFGHJKLMNPQRSTUVWXYZ23456789',a=()=>Array.from({length:4},()=>t[Math.floor(32*Math.random())]).join('');return`${e}-${a()}-${a()}-${a()}`},C=(0,l.create)()((0,c.persist)((e,t)=>{const a=()=>S(t().clock),r=(t,r,n)=>e(e=>({audit:[{id:I('au'),restaurantId:t,at:a().toISOString(),kind:r,text:n},...e.audit].slice(0,300)})),n=(a,n,s)=>{if(!a||s<=0)return 0;const i=t().giftCards.find(e=>e.code===a&&e.restaurantId===n);if(!i||i.balance<=0)return 0;const o=Math.min(i.balance,s);return e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-o}:e)})),r(n,'giftcard',`Gift card ${a.slice(0,8)}\u2026 redeemed \xa3${(o/100).toFixed(2)} (balance \xa3${((i.balance-o)/100).toFixed(2)})`),o},s=e=>{const a=t().restaurants.find(t=>t.id===e.restaurantId);a&&e.customerId===t().customer.id&&e.subtotal>=a.settings.stampMinSpend&&t().addStamp(e.restaurantId,e.customerId,'takeaway'===e.type?'Takeaway (auto on collection)':'Table QR bill (auto on payment)')},i=e=>(0,f.templatesFor)(t().msgTemplates[e]),o=a=>{a.length&&(e(e=>({outbox:[...a,...e.outbox].slice(0,300)})),(0,f.deliverQueued)(a.filter(e=>'queued'===e.status),(e,a)=>t().updateOutbox(e,a)))},l=(e,r)=>{const n=t().restaurants.find(e=>e.id===r.restaurantId);n&&o((0,f.composeBooking)(e,r,n,i(n.id),a().toISOString()))},c=e=>{const r=t().restaurants.find(t=>t.id===e.restaurantId);r&&o((0,f.composeOrder)(e,r,i(r.id),a().toISOString()))};return{...h(),resetDemo:()=>e(h()),setClockMode:()=>e({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),skipMinutes:()=>{},updateCustomer:t=>e(e=>({customer:{...e.customer,...t}})),setAllergy:(t,a)=>e(e=>{const r=e.customer.allergies.filter(e=>e.allergen!==t);return{customer:{...e.customer,allergies:a?[...r,{allergen:t,severity:a}]:r}}}),startBasket:(t,a,r)=>e(e=>{const n=e.basket.restaurantId===t&&e.basket.mode===a&&e.basket.tableNo===r;return{basket:{restaurantId:t,mode:a,tableNo:r,lines:n?e.basket.lines:[]}}}),addLine:t=>e(e=>({basket:{...e.basket,lines:[...e.basket.lines,{...t,key:I('ln')}]}})),setLineQty:(t,a)=>e(e=>({basket:{...e.basket,lines:a<=0?e.basket.lines.filter(e=>e.key!==t):e.basket.lines.map(e=>e.key===t?{...e,qty:a}:e)}})),overrideLine:(t,r)=>e(e=>({basket:{...e.basket,lines:e.basket.lines.map(e=>e.key===t?{...e,override:{allergens:r,at:a().toISOString()}}:e)}})),clearBasket:()=>e(e=>({basket:{...e.basket,lines:[]}})),placeOrder:({slotTime:n,tip:s,notes:i,phone:o,email:l,customerName:u})=>{const g=t(),m=g.basket,p=m.restaurantId,b=w(m,g.menu,g.customer.allergies),f=b.reduce((e,t)=>e+t.unitPrice*t.qty,0),k='table'===m.mode,I=$(g.orders.filter(e=>e.restaurantId===p).map(e=>e.ref),k?'Q-':'T-',k?g.counters.table:g.counters.order),S=!k,h=f+(S?0:s),O=(u??'').trim()||g.customer.name,C={id:(0,y.uuid)(),ref:`${k?'Q':'T'}-${I}`,restaurantId:p,customerId:g.customer.id,customerName:O,type:m.mode,tableNo:m.tableNo,slotTime:n,lines:b,subtotal:f,tip:S?0:s,giftCardApplied:0,giftCardCode:void 0,total:h,paid:0,status:S?'awaiting_payment':'new',createdAt:a().toISOString(),allergies:g.customer.allergies,readiness:{},notes:i,channel:'app',...'takeaway'===m.mode?{phone:o??g.customer.phone,email:l??g.customer.email}:{}};e(e=>({orders:[C,...e.orders],basket:{...e.basket,lines:[]},counters:k?{...e.counters,table:I}:{...e.counters,order:I}}));const v=b.filter(e=>e.overridden);return r(p,'order',`Order ${C.ref} placed (${k?`Table ${m.tableNo}`:'takeaway'})${v.length?` \u2014 ALLERGY OVERRIDE on ${v.map(e=>e.name).join(', ')}`:''}`),C.allergies.length&&r(p,'allergy',`Allergies declared and confirmed by customer on ${C.ref}: ${C.allergies.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),'awaiting_payment'!==C.status&&c(C),C},setOrderStatus:(a,n,i)=>{const o=t().orders.find(e=>e.id===a);o&&((0,k.statusBlock)(o,n,(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===a?{...e,status:n}:e)})),r(o.restaurantId,'order',`${o.ref} \u2192 ${n}${i?` by ${i}`:''}`),'collected'===n&&'takeaway'===o.type&&s(o)))},ackOrderAllergy:(n,s)=>{const i=t().orders.find(e=>e.id===n);if(!i||!(0,k.canSign)(i,'kitchen',(0,k.linkedBooking)(i,t().bookings)))return;const o={by:s,at:a().toISOString()};e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyAck:o,status:'new'===e.status?'acknowledged':e.status}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 3/5 Kitchen on ${i.ref}: ${s} (chef signed off before cooking)`)},tickOrderAllergy:(n,s,i,o=!0)=>{const l=t().orders.find(e=>e.id===n);if(!l)return;const c={...l.allergyTicks??{}};o?c[s]={by:i,at:a().toISOString()}:delete c[s],e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyTicks:c}:e)})),r(l.restaurantId,'allergy',`${l.ref}: kitchen ${o?'confirmed':'unticked'} ${s} (${i})`)},ackReadiness:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);o&&('cook'===s&&(0,k.statusBlock)(o,'preparing',(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,readiness:{...e.readiness,[s]:{by:i,at:a().toISOString()}},status:'cook'===s&&['new','acknowledged'].includes(e.status)?'preparing':e.status}:e)})),r(o.restaurantId,'order',`${o.ref}: ${'cook'===s?'started cooking':'bagged'} (${i})`)))},handoverCheck:(n,s)=>{const i=t().orders.find(e=>e.id===n);i&&(0,k.canSign)(i,'table',(0,k.linkedBooking)(i,t().bookings))&&(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,handoverCheck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 5/5 Table on ${i.ref}: ${s} (served and checked with the guest; chain complete)`))},signAllergyStep:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o||!i.trim())return!1;const l=(0,k.linkedBooking)(o,t().bookings);if(!(0,k.canSign)(o,s,l))return!1;if('kitchen'===s)return t().ackOrderAllergy(n,i),!0;if('table'===s)return t().handoverCheck(n,i),!0;const c={by:i,at:a().toISOString()};'booked'===s&&l&&l.allergies.length&&!l.allergyAck?e(e=>({bookings:e.bookings.map(e=>e.id===l.id?{...e,allergyAck:c}:e)})):e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyChain:{...e.allergyChain,[s]:c}}:e)}));const u=(0,k.stepInfo)(s);return r(o.restaurantId,'allergy',`Allergen sign-off ${u.n}/5 ${u.label} on ${o.ref}: ${i} (${u.what.toLowerCase()})`),!0},customerSignal:(t,a)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,customerSignal:a}:e)})),setSplit:(t,a,r)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,tip:r,total:e.subtotal+r,split:{ways:a,paidShares:e.split?.paidShares??0}}:e)})),payTable:(a,{shares:i,giftCardCode:o})=>{const l=t().orders.find(e=>e.id===a);if(!l)return;const c=l.split?.ways??1,u=Math.ceil(l.total/c),g=Math.min(c,(l.split?.paidShares??0)+i),m=g>=c,p=m?l.total-l.paid:Math.min(l.total-l.paid,u*i),b=n(o,l.restaurantId,p),f={...l,giftCardApplied:l.giftCardApplied+b,giftCardCode:b?o:l.giftCardCode,paid:l.paid+p,split:{ways:c,paidShares:g},status:m?'closed':l.status};e(e=>({orders:e.orders.map(e=>e.id===a?f:e)})),r(l.restaurantId,'order',`${l.ref} (Table ${l.tableNo}) ${m?'bill paid in full':`share ${g}/${c} paid`} (paid at the till)`),m&&s(f)},createBooking:n=>{const s=$(t().bookings.filter(e=>e.restaurantId===n.restaurantId).map(e=>e.ref),'BK-',t().counters.booking),i=t().restaurants.find(e=>e.id===n.restaurantId)?.settings,o='online'===n.source&&!!i&&(n.partySize>(i.autoAcceptUpTo??7)||!!i.reviewRequests&&!!n.notes.trim()),c={...n,id:(0,y.uuid)(),ref:`BK-${s}`,status:o?'pending':'confirmed',createdAt:a().toISOString()};return e(e=>({bookings:[...e.bookings,c],counters:{...e.counters,booking:s}})),r(c.restaurantId,'booking',`Booking ${o?'request ':''}${c.ref}: ${c.name}, ${c.partySize} on ${c.date} ${c.time}${c.source?` (${c.source})`:''}${c.allergies.length?' \u2014 allergies declared':''}`),l(o?'booking-request':'booking-confirmation',c),c},decideBooking:(n,s,i)=>{const o=t().bookings.find(e=>e.id===n);if(!o||'pending'!==o.status)return;const c={by:i,at:a().toISOString(),outcome:s},u='confirmed'===s?'confirmed':'cancelled';e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:u,decided:c}:e)})),r(o.restaurantId,'booking',`Booking request ${o.ref} (${o.name}, ${o.partySize}) ${s} by ${i}`),l('confirmed'===s?'booking-confirmation':'booking-declined',{...o,status:u})},addOutbox:t=>e(e=>({outbox:[...t,...e.outbox].slice(0,300)})),updateOutbox:(t,a)=>e(e=>({outbox:e.outbox.map(e=>e.id===t?{...e,...a}:e)})),clearOutbox:t=>e(e=>({outbox:e.outbox.filter(e=>e.restaurantId!==t)})),setTemplate:(t,a,r)=>e(e=>{const n={...e.msgTemplates[t]??{}};return null===r?delete n[a]:n[a]={...n[a]??{},...r},{msgTemplates:{...e.msgTemplates,[t]:n}}}),acceptOrder:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o)return!1;const l='new'===o.status&&!!(0,k.statusBlock)(o,'acknowledged',(0,k.linkedBooking)(o,t().bookings)),c=a(),u=i?new Date(c.getTime()+6e4*i).toISOString():o.readyBy;return e(e=>({orders:e.orders.map(e=>e.id===n?{...e,status:'new'!==e.status||l?e.status:'acknowledged',accepted:e.accepted??{by:s,at:c.toISOString()},readyBy:u}:e)})),r(o.restaurantId,'order',`${o.ref} accepted by ${s}${i?`, ready by ${String(new Date(u).getHours()).padStart(2,'0')}:${String(new Date(u).getMinutes()).padStart(2,'0')}`:''}`),!l},setBookingStatus:(n,s)=>{const i=t().bookings.find(e=>e.id===n),o=a().toISOString();e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:s,...'seated'===s?{seatedAt:o}:'finished'===s?{finishedAt:o,table:void 0}:{}}:e)})),i&&r(i.restaurantId,'booking',`${i.ref} ${i.name} \u2192 ${s}`)},seatWalkIn:(n,s,i,o)=>{const l=a(),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,u=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,g=t().bookings.filter(e=>e.restaurantId===n&&e.walkIn&&e.date===c).reduce((e,t)=>Math.max(e,Number(t.ref.slice(2))||0),0)+1,m={id:(0,y.uuid)(),ref:`W-${g}`,restaurantId:n,customerId:null,name:'Walk-in',partySize:s,date:c,time:u,table:i||void 0,allergies:[],notes:(o??'').trim(),status:'seated',security:'none',depositPaid:0,createdAt:l.toISOString(),seatedAt:l.toISOString(),walkIn:!0,source:'walk-in'};return e(e=>({bookings:[...e.bookings,m]})),r(n,'walkin',`Walk-in ${m.ref} seated: ${s} cover(s)${i?`, Table ${i}`:', table to assign'}`),m},setBookingTable:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,table:n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.name} \u2192 ${n?n.includes('+')?`Tables ${n.split('+').join(' + ')}`:`Table ${n}`:'no table'}`)},updateBooking:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,...n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.walkIn?'Walk-in':s.name} moved/updated${n.table?` \u2192 Table ${n.table}`:''}${n.time?` at ${n.time}`:''}${n.durationMins?` for ${n.durationMins} min`:''}`)},undoWalkIn:a=>{const n=t().bookings.find(e=>e.id===a);n&&n.walkIn&&(e(e=>({bookings:e.bookings.filter(e=>e.id!==a)})),r(n.restaurantId,'walkin',`Walk-in ${n.ref} undone`))},ackBookingAllergy:(n,s)=>{const i=t().bookings.find(e=>e.id===n);i&&!i.allergyAck&&(e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,allergyAck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 1/5 Booked on ${i.ref} (${i.name}): ${s} (allergy recorded)`))},joinWaitlist:(n,s,i,o)=>{const l=t().waitlist.filter(e=>e.restaurantId===n).reduce((e,t)=>Math.max(e,t.number),0)+1,c={id:I('wl'),restaurantId:n,number:l,name:s,partySize:i,joinedAt:a().toISOString(),status:'waiting',customerId:o};return e(e=>({waitlist:[...e.waitlist,c]})),r(n,'waitlist',`${s} (${i}) joined the waitlist as #${l}`),c},setWaitlistStatus:(a,n)=>{const s=t().waitlist.find(e=>e.id===a);e(e=>({waitlist:e.waitlist.map(e=>e.id===a?{...e,status:n}:e)})),s&&(r(s.restaurantId,'waitlist',`Waitlist #${s.number} ${s.name} \u2192 ${n}`),'seated'===n&&t().addWalkIn(s.restaurantId,s.partySize))},addWalkIn:(t,a)=>{e(e=>({walkIns:{...e.walkIns,[t]:(e.walkIns[t]??0)+a}})),r(t,'walkin',`Walk-in seated: ${a} cover(s)`)},addStamp:(n,s,i)=>{const o=t().restaurants.find(e=>e.id===n);o&&(e(e=>{const t=e.stampCards.find(e=>e.restaurantId===n&&e.customerId===s),r=t??{restaurantId:n,customerId:s,stamps:0,rewardsAvailable:0,history:[]};let l=r.stamps+1,c=r.rewardsAvailable;l>=o.settings.stampTarget&&(l=0,c+=1);const u={...r,stamps:l,rewardsAvailable:c,history:[{at:a().toISOString(),source:i},...r.history]};return{stampCards:t?e.stampCards.map(e=>e===t?u:e):[...e.stampCards,u]}}),r(n,'stamp',`Stamp added (${i})`))},redeemReward:(t,a)=>{e(e=>({stampCards:e.stampCards.map(e=>e.restaurantId===t&&e.customerId===a&&e.rewardsAvailable>0?{...e,rewardsAvailable:e.rewardsAvailable-1}:e)})),r(t,'stamp','Loyalty reward redeemed')},buyGiftCard:(n,s,i,o)=>{const l=n.slice(0,3).toUpperCase(),c={id:I('gc'),code:O(l),restaurantId:n,initial:s,balance:s,ownerId:t().customer.id,recipientName:i,message:o,createdAt:a().toISOString()};return e(e=>({giftCards:[c,...e.giftCards]})),r(n,'giftcard',`Gift card sold \xa3${(s/100).toFixed(2)} (demo payment)`),c},redeemGiftCard:(a,n,s)=>{const i=t().giftCards.find(e=>e.code.toUpperCase()===a.trim().toUpperCase());return!(!i||n<=0||n>i.balance)&&(e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-n}:e)})),r(i.restaurantId,'giftcard',`Gift card ${i.code} redeemed \xa3${(n/100).toFixed(2)} by ${s}`),!0)},honourLegacyCard:(t,n,s,i)=>{const o={id:I('gc'),code:n.trim().toUpperCase(),restaurantId:t,initial:s,balance:s,ownerId:'legacy',recipientName:'Legacy website bookings gift card',message:`Honoured by ${i}`,createdAt:a().toISOString().slice(0,10),legacy:!0};return e(e=>({giftCards:[o,...e.giftCards]})),r(t,'giftcard',`Legacy website bookings gift card ${o.code} honoured (\xa3${(s/100).toFixed(2)}) by ${i}`),o},addEvent:t=>e(e=>({events:[...e.events,{...t,id:I('ev')}]})),addRating:t=>{e(e=>({ratings:[{...t,id:I('rt'),createdAt:a().toISOString()},...e.ratings],orders:t.orderId?e.orders.map(e=>e.id===t.orderId?{...e,rated:!0}:e):e.orders})),r(t.restaurantId,'rating',`Private rating ${t.stars}/5 from ${t.customerName}`)},updateMenuItem:(a,n)=>{const{name:s,section:i,price:o,allergens:l,allergenNotes:c,...u}=n,g={};void 0!==s&&(g.dish=s),void 0!==i&&(g.section=i),'price'in n&&(g.price=o??null),void 0!==l&&(g.allergens=l),'allergenNotes'in n&&(g.allergenNotes=c);const m='optionGroups'in n,p=(0,b.menuCardBridge)();p&&(Object.keys(g).length||m)&&p.menuEdited(a,g,'CoverCharge for Managers',m);const f=p?u:n;Object.keys(f).length&&e(e=>({menu:e.menu.map(e=>e.id===a?{...e,...f}:e)}));const k=t().menu.find(e=>e.id===a);k&&Object.keys(f).length&&r(k.restaurantId,'menu',`Menu: ${(0,b.resolveItem)(k).name} updated`)},setSignOff:(t,r)=>{const n=(0,b.menuCardBridge)();n?r?n.signOff(t,r):n.menuEdited(t,{},'CoverCharge for Managers',!0):e(e=>({menu:e.menu.map(e=>e.id===t?{...e,signOff:r?{by:r,at:a().toISOString().slice(0,10)}:null}:e)}))},addAudit:(e,t,a)=>r(e,t,a),updateSettings:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,settings:{...e.settings,...a}}:e)})),'takeawayPaused'in a&&r(t,'order',"Takeaway slots "+(a.takeawayPaused?'PAUSED':'resumed'))},addMenuItem:t=>{const a=I('m');return e(e=>({menu:[...e.menu,{...t,id:a}]})),(0,b.menuCardBridge)()?.menuItemAdded({...t,id:a}),r(t.restaurantId,'menu',`Menu: ${t.name} added (recipe card awaiting head chef sign-off)`),a},updateRestaurant:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,...a}:e)})),r(t,'menu',`Restaurant info updated (${Object.keys(a).join(', ')})`)},placeManualOrder:({restaurantId:n,type:s,channel:i,customerName:o,phone:l,email:u,tableNo:g,slotTime:m,lines:f,allergies:k,notes:I,by:S})=>{const h=t(),w=f.flatMap(({itemId:e,qty:t})=>{const a=h.menu.find(t=>t.id===e);if(!a||t<=0)return[];const r=(0,b.resolveItem)(a),n=(0,p.conflictsFor)((0,p.effectiveAllergens)(r),k);return[{itemId:e,name:r.name,qty:t,unitPrice:r.price??0,choices:[],notes:'',contains:n.contains,may:n.may,overridden:!1,prepMins:r.prepMins}]}),O=w.reduce((e,t)=>e+t.unitPrice*t.qty,0),C='table'===s,v=$(h.orders.filter(e=>e.restaurantId===n).map(e=>e.ref),C?'Q-':'T-',C?h.counters.table:h.counters.order),A={id:(0,y.uuid)(),ref:`${C?'Q':'T'}-${v}`,restaurantId:n,customerId:`manual-${i}`,customerName:o||(C?`Table ${g}`:'Walk-in'),type:s,tableNo:g,slotTime:m,lines:w,subtotal:O,tip:0,giftCardApplied:0,total:O,paid:0,status:'new',createdAt:a().toISOString(),allergies:k,readiness:{},notes:I,channel:i,...l?{phone:l}:{},...u?{email:u}:{},...k.length?{allergyChain:{booked:{by:S,at:a().toISOString()}}}:{}};return e(e=>({orders:[A,...e.orders],counters:C?{...e.counters,table:v}:{...e.counters,order:v}})),r(n,'order',`Order ${A.ref} taken by ${S} (${'phone'===i?'phone':'walk-in'===i?'walk-in takeaway':`Table ${g}`})`),k.length&&r(n,'allergy',`Allergen sign-off 1/5 Booked on ${A.ref}: ${S} recorded ${k.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),(l||u)&&c(A),A},ackAlert:(t,r)=>e(e=>({alertAcks:{...e.alertAcks,[t]:{by:r,at:a().toISOString()}}}))}},{name:'covercharge-demo-v1',version:9,migrate:async(e,t)=>{if(!e)return e;if(n.LIVE_VENUE_BUILD)return await(0,s.archiveChefCache)('core',e),Object.assign(e,(0,r.stripCoreLiveSamples)(e)),e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},e;if(e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},t<6){try{e.restaurants=(e.restaurants??[]).map(e=>'saltmarsh'===e?.id?{...e,name:'The Venue'}:e)}catch{}try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e?.id&&JSON.stringify(e.kitchenHours)===JSON.stringify(g.ANCHORAGE_KITCHEN_OLD)?{...e,kitchenHours:g.ANCHORAGE_KITCHEN,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.'}:e)}catch{}}if(t<5)try{e.events=(e.events??[]).map(e=>'string'==typeof e?.title&&/\(substitute day\)/i.test(e.title)?{...e,title:e.title.replace(/\s*\(substitute day\)/gi,'').trim()}:e)}catch{}if(t<4)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id&&e.settings&&!e.settings.pay?{...e,settings:{...e.settings,pay:g.ANCHORAGE_PAY}}:e)}catch{}if(t<3)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id?{...e,settings:{...e.settings,orderAtTable:!1}}:e),e.orders=(e.orders??[]).filter(e=>'ord-seed-3'!==e.id&&'Q-2018'!==e.ref),e.audit=(e.audit??[]).filter(e=>!String(e.text??'').includes('Q-2018'))}catch{}if(t>=2)return e;try{const t=(0,u.buildSeed)((0,u.defaultSimStart)()),a=new Map(t.bookings.map(e=>[e.id,e])),r=new Set((0,m.anchoragePlan)().tables.map(e=>e.name)),n=e=>!e||e.split('+').every(e=>r.has(e));e.bookings=(e.bookings??[]).map(e=>{const t=a.get(e.id);return t?{...e,table:t.table,dog:t.dog,notes:t.notes}:'anchorage'!==e.restaurantId||n(e.table)?e:{...e,table:void 0}})}catch{}return e},merge:(e,r)=>{const n={...r,...e};return a.IS_WILDINGS&&(n.restaurants=n.restaurants.map(t.withWildingsAddress)),n},storage:(0,c.createJSONStorage)(()=>o.default)}))},881,[1194,5,1195,842,1198,1190,995,1191,1207,3,1070,819,1188,827,976,1099]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShallow",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]);function o(e){const t=u.default.useRef(void 0);return u=>{const o=e(u);return(0,n.shallow)(t.current,o)?t.current:t.current=o}}},884,[31,1217]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLE_ORDER_DEFAULT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"cleanToken",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"isTableNo",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fromRow",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"toRow",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"hm",{enumerable:!0,get:function(){return l}}),_e.openAt=function(e,t){const r=a(t),n=e.openFrom?a(e.openFrom):null,o=e.lastOrders?a(e.lastOrders):null;return null!==n&&null!==o?n<=o?r>=n&&r=n||r=n:null===o||r{const t=(e??'').trim().toUpperCase();return/^[A-Z2-9]{16}$/.test(t)?t:null},r=e=>/^[0-9]{1,4}$/.test(e),n=t=>t?{on:!!t.is_on,tables:Array.isArray(t.tables)?t.tables.map(String):null,staffAccept:!1!==t.staff_accept,openFrom:t.open_from?String(t.open_from).slice(0,5):null,lastOrders:t.last_orders?String(t.last_orders).slice(0,5):null,guestTip:t.guest_tip??''}:{...e},o=e=>({is_on:e.on,tables:e.tables&&e.tables.length?e.tables.filter(r):null,staff_accept:e.staffAccept,open_from:e.openFrom,last_orders:e.lastOrders,guest_tip:e.guestTip.slice(0,300)}),a=e=>{const[t,r]=e.split(':').map(Number);return 60*t+r},l=e=>`${String(Math.floor(e/60)%24).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`;const s=(e,t)=>e.reduce((e,r)=>e+r.qty*(t.find(e=>e.id===r.id)?.pricePence??0),0),u=(e,t,r)=>e.map(e=>t.find(t=>t.id===e.id)).filter(e=>!!e&&(e.allergens.some(e=>r.includes(e))||e.mayContain.some(e=>r.includes(e)))),c=(e,t)=>`${e.replace(/\/$/,'')}/t?k=${t}`,f=(e,t)=>`${e.replace(/\/$/,'')}/customer-app/index.html?table=${t}`,p=e=>{const t=e.trim();return t.length>=2&&t.length<=40&&/\p{L}/u.test(t)},b=e=>{const t=e.trim();return!t||/^\+?[0-9][0-9 ()-]{6,19}$/.test(t)},m=e=>'table'===e.type&&'table-qr'===e.channel,y=e=>m(e)&&!!e.held&&!e.accepted&&'cancelled'!==e.status,h=e=>!y(e),O=e=>'cancelled'===e.status?e.cancelReason?`Cancelled: ${e.cancelReason}`:'Cancelled by the staff.':e.held&&!e.accepted?'Sent. Waiting for a member of staff to accept it.':'served'===e.status||'collected'===e.status||'closed'===e.status?'Served. Enjoy!':'ready'===e.status?'Ready: on its way to your table.':'Accepted: the kitchen has your order.',P=['Sold out','Wrong table','Sent twice','Kitchen closed','Guest asked to cancel'],j='Pay at the bar or with your server. Paying by card from your phone is coming later.'},887,[]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.venueBusy=function(n,s,a){const d=(0,t.ymd)(new Date(a.getTime()-48384e5)),r=(0,t.ymd)(a),u=n.settings.busyLearningSince,o=u&&/^\d{4}-\d{2}-\d{2}$/.test(u)&&u>d?u:d,l=new Map,y=new Set,c=new Set,h=new Set;for(const a of s){if(h.has(a.id)||a.restaurantId!==n.id||a.date=r||!['confirmed','seated','finished'].includes(a.status)||!Number.isFinite(a.partySize)||a.partySize<=0)continue;h.add(a.id),y.add(a.date);const s=new Date(a.date+'T12:00:00');s.setDate(s.getDate()-(s.getDay()+6)%7),c.add((0,t.ymd)(s));const d=a.date+'T'+a.time.slice(0,2);l.set(d,(l.get(d)??0)+a.partySize)}const w=[...l.values()].sort((t,n)=>t-n),f=[...y].sort(),M=(f.length?Math.round((new Date(r+'T12:00:00').getTime()-new Date(f[0]+'T12:00:00').getTime())/864e5):0)>=28&&c.size>=4&&y.size>=16&&w.length>=40,b=n.settings.busyCoversPerHour,v=Number.isFinite(b)&&b>=1?Math.round(b):30,S=M&&!1!==n.settings.busyLearning,z=S?Math.max(1,Math.ceil(w[Math.ceil(.85*w.length)-1])):v,D=Math.max(1,Math.ceil(z/2));return{busy:z,steady:D,learned:S,weeks:c.size,enough:M,words:`Busy level: ${z} Covers an hour (${S?`learned from your last ${c.size} weeks`:null!=b?'set by you':'starting level'})`}},e.hourlyBand=function(t,n){return t>=n?'Busy':t>=Math.ceil(n/2)?'Steady':'Quiet'};var t=_r(_d[0])},933,[822]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEEN",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOUTERS_GUIDE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"KIRKMICHAEL_GUIDE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WILDINGS_GUIDE",{enumerable:!0,get:function(){return o}}),_e.guideCalendarEvents=function(e,t){return e.events.filter(e=>e.date).map(e=>({id:`${t}-ev-${e.date}-${e.title.toLowerCase().replace(/[^a-z0-9]+/g,'-').slice(0,40)}`,restaurantId:t,date:e.date,title:e.title,kind:'event',description:`${e.when}. ${e.detail}`,example:!1,source:e.source,time:e.time}))};const e='10 November 2026',t={id:'souters',name:"Souter's Inn",place:'Kirkoswald, Ayrshire',about:["Souter's Inn is a restaurant and bar in the village of Kirkoswald, Ayrshire. The official site describes a cosy country welcome and menus built around regional produce, with a bar, an ice cream shop and cake corner, and an upstairs dining room for private events.","The building stands on the site of the school house that Robert Burns attended in 1772, according to the official about page. Souter Johnnie's house and the old parish church and graveyard, known from Tam o' Shanter, are nearby.",'The official menu page says the inn can seat up to 130 diners. It also has a takeaway menu and lists breakfast every day.'],hoursTitle:'Opening hours',hoursLines:['Open daily from 9am, seven days a week.','Breakfast: 9am\u201311.45am, Monday to Sunday.','\xc0 la carte, children\u2019s, vegetarian and takeaway menus: 12 noon\u20139pm, Monday to Sunday.','Desserts: 9am\u20139pm, Monday to Sunday.','Meat Feast menu: every Tuesday, 12 noon\u20139pm.'],hoursNotes:['These kitchen hours are from the official menu page, checked 10 November 2026. The official homepage also says the inn is open daily from 9am.','Destination South Ayrshire, checked the same day, lists the inn open 9am\u20139pm, seven days a week, and says food is served all day.','Christmas Day and other festive closing times were not published on the official site on 10 November 2026. Bar last orders are not listed separately from the 9pm food hours.'],hoursSource:'https://www.soutersinn.com/menu and https://www.soutersinn.com/ (10 November 2026); Destination South Ayrshire listing also checked the same day.',festive:{title:'Festive flavours, from 1 December',lines:['Festive dishes are served from 1 December, alongside the usual menu.','A set festive menu is offered for tables of 10 or more: two courses \xa329.95 or three courses \xa335.95, Monday to Sunday 12 noon\u20139pm, with crackers included. Coffee or tea with a mince pie is \xa33.00.'],source:'https://www.soutersinn.com/ and the Festive Menu PDF linked from https://www.soutersinn.com/menu (10 November 2026).'},eventsIntro:'The official What\u2019s On page describes regular quiz nights and live music, but on 10 November 2026 the only dated listing was already in the past. Upcoming details below are taken from the official homepage and festive menu. Call 01655 760653 to ask about dates.',events:[{title:'Festive dishes and set festive menu',when:'From 1 December 2026',date:'2026-12-01',detail:'Festive dishes join the usual menu from 1 December. The set festive menu is for tables of 10 or more, two courses \xa329.95 or three courses \xa335.95, 12 noon\u20139pm, crackers included.',source:'https://www.soutersinn.com/ and festive menu PDF (10 November 2026).'}],regularEvents:[{title:'Meat Feast Tuesdays',detail:'Every Tuesday, 12 noon\u20139pm, with a dedicated meat feast menu.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Quiz nights and live music',detail:'The official What\u2019s On page says quiz nights and weekend live music are a regular part of the calendar. No future dates were published on 10 November 2026 \u2014 call to ask what\u2019s next.',source:'https://www.soutersinn.com/whatson (10 November 2026).'}],address:'47 Main Road, Kirkoswald, Ayrshire KA19 8HY',phone:'01655 760653',email:'souters@southernayr.com',website:'https://www.soutersinn.com/',websiteLabel:'soutersinn.com',socials:[{label:'Facebook',url:'https://www.facebook.com/soutersinn'},{label:'Instagram',url:'https://www.instagram.com/soutersinn/'},{label:'TikTok',url:'https://www.tiktok.com/@souters_inn'}],mapQuery:'Souter\'s Inn, 47 Main Road, Kirkoswald, KA19 8HY',booking:['Send a table request in this app, or call 01655 760653. Staff will confirm. No payment is taken here.','A general table deposit and cancellation policy was not published on the official website on 10 November 2026.'],policies:[{title:'Allergens',body:'Menus can change with the season and fresh produce. Please tell waiting staff about allergens or other dietary needs before you order.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Parking and access',body:'Destination South Ayrshire, checked 10 November 2026, lists parking, blue badge parking, disabled access, free Wi-Fi, and a welcome for walkers and cyclists. The official website does not spell these out itself.',source:'https://destinationsouthayrshire.co.uk/eat-and-drink/souters-inn/ (10 November 2026).'},{title:'Children',body:'A children\u2019s menu is served Monday to Sunday, 12 noon\u20139pm.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Dogs',body:'A dog policy was not published on the official website or the Destination South Ayrshire listing on 10 November 2026. Please call to ask.',source:'Official site and Destination South Ayrshire, 10 November 2026.'}],drinks:{title:'The bar',body:'The official menu page describes a bar with wines, ales, whiskies and cocktails. A priced drinks list was not published on the pages checked on 10 November 2026.',source:'https://www.soutersinn.com/menu (10 November 2026).'},awards:['TripAdvisor Travellers\u2019 Choice 2026, and 4.3 out of 5 from 1,119 TripAdvisor reviews, checked 10 November 2026.'],reviews:[{summary:'4.3 out of 5 from 1,119 reviews on TripAdvisor, and a Travellers\u2019 Choice award in 2026.',source:'TripAdvisor listing for Souter\u2019s Inn, Kirkoswald, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g3649164-d6729564-Reviews-Souter_s_Inn-Kirkoswald_South_Ayrshire_Ayrshire_Scotland.html',quotes:[{text:'Absolute perfection from start to finish! \u2026 The atmosphere is warm and welcoming, and the service was top-notch right from the moment we walked through the door.',by:'Anna',date:'6 October 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'},{text:'The staff were superb, the ambiance was amazing. By far the best pub food I have ever had. Could not fault this establishment at all.',by:'johnhK5391CS',date:'28 September 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'},{text:'Really put these guys to the test today, table of 12 from toddlers to grandparents, everyone enjoyed their food, service was fantastic.',by:'Kate',date:'9 October 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'}]}],functions:[{title:'Upstairs private dining',body:'The official functions page says the upstairs room comfortably seats 45, or 60 standing, with its own private bar. It is offered for birthdays, family dinners, funeral gatherings, baby showers, ticketed events and live music, with options from afternoon tea and buffets to three-course menus.',source:'https://www.soutersinn.com/functions (10 November 2026).'},{title:'Mezzanine seating',body:'The official menu page describes the upper mezzanine as a private dining area with its own oak bar, overlooking the patisserie and the lower bar, and says it can seat up to 70 guests. That figure differs from the 45 seated / 60 standing numbers on the functions page. Both are from the official site; please ask the venue which applies to your booking.',source:'https://www.soutersinn.com/menu and https://www.soutersinn.com/functions (10 November 2026).'}],giftVouchers:'Gift vouchers are listed on the official website. Call 01655 760653 or use the Gift Voucher link on soutersinn.com to ask. No payment is taken in this app.',photos:[{file:'gallery-1.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7160-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'gallery-2.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7187-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'gallery-3.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7218-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'upstairs-1.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+1-1920w.jpg',page:'https://www.soutersinn.com/functions'},{file:'upstairs-2.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+2-1920w.jpg',page:'https://www.soutersinn.com/functions'},{file:'upstairs-3.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+3-1920w.jpg',page:'https://www.soutersinn.com/functions'}],gaps:['Christmas Day and other festive closing times not published on the official site (10 November 2026).','Dog policy not published.','Priced wine, ale and cocktail lists not on the official pages checked.','A general table deposit policy was not published (ticketed events have used a deposit in the past).','Bar last orders not listed separately.','A current VisitScotland listing was not retrieved today (the page request failed).','No live Google review count was confirmed today \u2014 TripAdvisor figures were used instead.'],conflicts:['Functions page: upstairs seats 45, or 60 standing. Menu page: mezzanine seats up to 70. Prefer neither figure alone \u2014 both are official; shown together.','Official about page: Burns attended the school house in 1772. Destination South Ayrshire says 1775. The app uses 1772 from the official site.']},s={id:'kirkmichael',name:'The Kirkmichael Arms',place:'Kirkmichael, Ayrshire',about:['The Kirkmichael Arms is a Michelin-listed restaurant and bar in the village of Kirkmichael, South Ayrshire. The official site says it has been a pub since 1700, and names it Best Scottish Pub at The Scotsman Scran Awards 2025.','Chef and owner Justin Galea, who trained in Melbourne, took the pub on sight unseen after it closed in 2023, when two locals set out to bring it back as the heart of the village. The Herald has named him one of the 50 most exciting chefs working in Scotland.','The kitchen smokes its own salmon, churns butter, cures bacon and bakes bread, drawing on Scottish produce with classical French technique and occasional Asian influences. The official site is clear that it is still a proper pub \u2014 Sunday lunch, a pint by the fire, or a full dinner.'],hoursTitle:'Opening hours',hoursLines:['Monday to Wednesday: closed.','Thursday to Sunday: from 1pm, until 10.30pm.'],hoursNotes:['The visible official website copy, checked 10 November 2026, says \u201cThursday to Sunday from 1pm\u201d and does not print a closing time. The same official homepage publishes hours data of 13:00\u201322:30 on those days, which is what is shown above.','Kitchen last orders are not listed separately from closing time.','Opening times between Christmas and New Year were still \u201cto be confirmed\u201d on the official Christmas 2026 page (updated 9 October 2026, checked 10 November 2026). The restaurant is closed on Christmas Day.'],hoursSource:'https://www.kirkmichaelarms.co.uk/ (visible copy and published hours data, 10 November 2026).',festive:{title:'Christmas and New Year 2026',lines:['Christmas Day boxes, for cooking at home, can be collected on Wednesday 23 December: \xa3205 feeds 4, or \xa3310 feeds 6, paid when you order. Email enquiries@thekirkmichaelarms.co.uk. Optional extras include beech-smoked salmon at \xa310 per 100g and bottled cocktails at \xa335\u2013\xa340.','Friday 11 December: Secret Santa name share. Friday 18 December: Christmas quiz, Secret Santa and pub Christmas party. Saturday 19 December: carol night, with loaded hot chocolate, mulled wine and mince pies. Sunday 20 December: Unofficial Christmas Lunch (also the Sunday carvery).','Christmas Eve (24 December): \xe0 la carte, no set festive menu. Christmas Day: restaurant closed. Boxing Day (26 December): dinner. Sunday 27 December: open as normal. New Year\u2019s Eve (31 December): \xa3125 per person.','Sunday carvery from 1pm on 6, 13, 20 and 27 December. Private Christmas parties and pub buyouts are available \u2014 email to discuss.'],source:'https://www.kirkmichaelarms.co.uk/wilderness-journal/best-christmas-dining-ayrshire (updated 9 October 2026, checked 10 November 2026).'},eventsIntro:'The official bar page mentions quiz nights and open-mic jams as part of pub life, without a dated public calendar beyond the Christmas 2026 lineup below.',events:[{title:'Secret Santa name share',when:'Friday 11 December 2026',date:'2026-12-11',detail:'Share your name for the Secret Santa, or drop your name and gift in any time before 18 December.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas quiz, Secret Santa and pub party',when:'Friday 18 December 2026',date:'2026-12-18',detail:'Festive quiz and the Matt Davey Secret Santa Extravaganza, with a stick-or-twist gift draw.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Carol night at the Arms',when:'Saturday 19 December 2026',date:'2026-12-19',detail:'Christmas music by the fire, with loaded hot chocolate, mulled wine and mince pies.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Unofficial Christmas Lunch and Sunday carvery',when:'Sunday 20 December 2026, from 1pm',date:'2026-12-20',time:'13:00',detail:'A proper Christmas roast on the Sunday before Christmas Day, and a Sunday carvery from 1pm.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas box collection',when:'Wednesday 23 December 2026',date:'2026-12-23',detail:'Collect Christmas Day boxes ordered in advance (\xa3205 for 4 or \xa3310 for 6). Restaurant is closed on Christmas Day.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas Eve dining',when:'Thursday 24 December 2026',date:'2026-12-24',detail:'\xc0 la carte, with no set Christmas menu.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Boxing Day dinner',when:'Saturday 26 December 2026',date:'2026-12-26',detail:'Open for dinner on Boxing Day.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Sunday carvery',when:'Sunday 27 December 2026, from 1pm',date:'2026-12-27',time:'13:00',detail:'Open as normal, with Sunday carvery from 1pm.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'New Year\u2019s Eve',when:'Thursday 31 December 2026',date:'2026-12-31',detail:'New Year\u2019s Eve, \xa3125 per person. Opening times earlier in that week were still to be confirmed.',source:'Official Christmas 2026 page, checked 10 November 2026.'}],regularEvents:[{title:'Quiz nights and open-mic jams',detail:'The official bar page lists quiz nights and open-mic jams as part of regular pub life. No separate future dates were published on 10 November 2026, apart from the Christmas quiz on 18 December.',source:'https://www.kirkmichaelarms.co.uk/bar (10 November 2026).'},{title:'Sunday carvery',detail:'Sunday carvery is a regular service. In December 2026 it is from 1pm on the 6th, 13th, 20th and 27th.',source:'Official Christmas 2026 page and Sunday carvery journal, 10 November 2026.'},{title:'Whisky tasting',detail:'The official site has a whisky tasting page and describes a carefully chosen malt list. Ask staff about current tastings and prices \u2014 many list prices were unpublished on the sample drinks menus.',source:'https://www.kirkmichaelarms.co.uk/ (10 November 2026).'}],address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',phone:'01655 750 200',email:'enquiries@thekirkmichaelarms.co.uk',website:'https://www.kirkmichaelarms.co.uk/',websiteLabel:'kirkmichaelarms.co.uk',socials:[{label:'Facebook',url:'https://www.facebook.com/kirkmichaelarms/'},{label:'Instagram',url:'https://www.instagram.com/kirkmichaelarms_unfiltered/'}],mapQuery:'The Kirkmichael Arms, 3-5 Straiton Road, Kirkmichael, KA19 7PH',booking:['Send a table request in this app, or call 01655 750 200, or email enquiries@thekirkmichaelarms.co.uk. Staff will confirm. No payment is taken here.','The official website, checked 10 November 2026, says: if you cancel less than 48 hours before your booking, or do not show up, there is a \xa325 charge per person. Parties of 6 or more are asked for a \xa315 per person deposit, redeemed when you visit.','Pub buyouts: Monday to Thursday \xa33,500; Friday to Sunday \xa35,000. Email for availability.'],policies:[{title:'Cancellation and deposits',body:'The venue\u2019s own website says a \xa325 per person charge applies if you cancel less than 48 hours before your booking or do not show up. Larger parties of 6 or more are asked to pay a \xa315 per person deposit, redeemed at the time of your visit. No deposit is taken in this app.',source:'https://www.kirkmichaelarms.co.uk/booking (10 November 2026).'},{title:'Dogs',body:'The official Sunday carvery journal says dogs are welcome in the pub area, and that there is no dress code.',source:'https://www.kirkmichaelarms.co.uk/wilderness-journal/best-sunday-carvery-ayrshire (10 November 2026).'},{title:'Children',body:'A sample children\u2019s menu is published, at \xa314.95 for three courses.',source:'https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'},{title:'Parking',body:'The official Sunday carvery journal says there is plenty of parking in the village. A dedicated venue car park is not described on the official pages checked.',source:'Official Sunday carvery journal, 10 November 2026.'},{title:'Accessibility',body:'An accessibility statement was not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Allergens',body:'Please speak to staff about allergens. Allergen information was not published on the sample menus checked on 10 November 2026.',source:'https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'}],drinks:{title:'The bar',body:'The official bar page describes a proper pub, with local beers, carefully chosen wines and malts, quiz nights and open-mic jams. Sample whisky and wine menus are on the official menus page; many prices were unpublished (ask staff).',source:'https://www.kirkmichaelarms.co.uk/bar and https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'},awards:['Best Scottish Pub, The Scotsman Scran Awards 2025 (official site, 10 November 2026).','Michelin-listed / Michelin-recommended (official site, 10 November 2026).','Justin Galea named among The Herald\u2019s 50 most exciting chefs in Scotland (official site, 10 November 2026).'],reviews:[{summary:'4.6 out of 5 from 700 reviews on TripAdvisor, checked 10 November 2026.',source:'TripAdvisor listing for The Kirkmichael Arms, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g551837-d2637644-Reviews-The_Kirkmichael_Arms-Maybole_South_Ayrshire_Ayrshire_Scotland.html',quotes:[]}],functions:[{title:'Private Christmas parties and pub buyouts',body:'The official Christmas page says larger gatherings can have a dedicated space and festive menus, and that pub buyouts are offered. The official booking page lists buyout rates of \xa33,500 Monday to Thursday and \xa35,000 Friday to Sunday.',source:'Official Christmas 2026 page and https://www.kirkmichaelarms.co.uk/booking (10 November 2026).'}],photos:[{file:'exterior.jpg',alt:'The Kirkmichael Arms, from the official website',source:'https://www.kirkmichaelarms.co.uk/photos/Kirkmichael%20Arms-20_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/'},{file:'interior.jpg',alt:'Inside The Kirkmichael Arms, from the official website',source:'https://www.kirkmichaelarms.co.uk/photos/Kirkmichael%20Arms-895_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/'},{file:'bar.jpg',alt:'The bar at The Kirkmichael Arms',source:'https://www.kirkmichaelarms.co.uk/photos/bar/Kirkmichael-Arms-825.jpg',page:'https://www.kirkmichaelarms.co.uk/bar'},{file:'restaurant.jpg',alt:'The restaurant at The Kirkmichael Arms',source:'https://www.kirkmichaelarms.co.uk/photos/restaurant/Kirkmichael-Arms-412_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/restaurant'},{file:'story.jpg',alt:'The Kirkmichael Arms, from the official story page',source:'https://cdn.sanity.io/images/1er2n88p/production/6f2f9988ce1bf9df9c63a12af667ae89d5442bfb-1600x1067.jpg',page:'https://www.kirkmichaelarms.co.uk/our-story'},{file:'contact.jpg',alt:'The Kirkmichael Arms, from the official contact page',source:'https://www.kirkmichaelarms.co.uk/photos/contact/Kirkmichael%20Arms-544.jpg',page:'https://www.kirkmichaelarms.co.uk/contact'}],gaps:['Kitchen last orders not published separately.','Hours between Christmas and New Year still to be confirmed on the official Christmas page.','Accessibility details not published.','No official guest quotes on the website \u2014 only the TripAdvisor rating is shown.','A live Google review count was not confirmed today.','VisitScotland listing not confirmed today.','Many whisky and wine prices unpublished on the sample drinks menus.'],conflicts:['Visible official copy says \u201cfrom 1pm\u201d; official hours data on the same homepage lists 13:00\u201322:30. The app shows both, and uses 22:30 as the published close.']},o={id:'wildings',name:'Wildings Hotel & Restaurant',place:'Maidens, Ayrshire',about:['Wildings is a family-run hotel and restaurant in the harbour village of Maidens, on the Ayrshire coast, looking out over the Firth of Clyde towards Arran. The official site says it has two contemporary restaurants and 11 comfortable bedrooms, many with sea views.','It is run by the Sage family, now in its second generation. The official homepage names the owners as Dorothy, Sonya and Nicola. They describe warm hospitality and food made from local, seasonal produce from land and sea.','The village sits by a sandy beach and a historic harbour, with Culzean Castle and Country Park along the coast and golf courses nearby.'],hoursTitle:'Kitchen hours',hoursLines:['Lunch, Monday to Saturday: 12 noon\u20132pm.','Sunday lunch: 12 noon\u20132.30pm.','Dinner, every day: 6pm\u20139pm.'],hoursNotes:['These hours are from the official homepage, checked 10 November 2026. The kitchen is closed between lunch and dinner.','The lunch menu PDF still prints Sunday lunch as 12 noon\u20132.00pm, which is earlier than the website\u2019s 2.30pm. The app follows the official website for hours, and notes the PDF difference.','Bar opening hours, and Christmas or other seasonal closing times, were not published on the official pages checked on 10 November 2026. Please call 01655 331 401 to ask.'],hoursSource:'https://www.wildingshotel.com/ (10 November 2026). Lunch PDF conflict noted from the official menus linked at https://www.wildingshotel.com/team.',eventsIntro:'No dated public events, quiz nights or festive opening hours were published on the official pages checked on 10 November 2026. Call or email to ask about private dining, celebrations and seasonal hours.',events:[],regularEvents:[],address:'Maidens Rd, Maidens, Girvan, KA26 9NR',phone:'01655 331 401',email:'bookings@wildingsrestaurant-hotel.co.uk',website:'https://www.wildingshotel.com/',websiteLabel:'wildingshotel.com',socials:[{label:'Facebook',url:'https://www.facebook.com/profile.php?id=100057663900963'},{label:'Instagram',url:'https://www.instagram.com/wildingsmaidens/'}],mapQuery:'Wildings Hotel, Maidens Rd, Maidens, Girvan, KA26 9NR',booking:['Send a table or room request in this app, or call 01655 331 401, or email bookings@wildingsrestaurant-hotel.co.uk. Staff will confirm. No payment is taken here.','A deposit or cancellation policy was not published on the official website on 10 November 2026.','Visit Girvan, a local guide checked the same day, says booking is essential, especially at weekends, in summer and during busy golf events on the coast, and that hours can shift seasonally \u2014 confirm when you book.'],policies:[{title:'Allergens',body:'Please tell the person taking your order about any allergies. The official menus say the venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.',source:'Official menu PDFs linked from https://www.wildingshotel.com/team (10 November 2026).'},{title:'Parties of six or more',body:'Parties of six or more: no separate or split bills.',source:'Official menu PDFs, 10 November 2026.'},{title:'Children',body:'A children\u2019s menu is offered for under 11s, at \xa39 for one course, \xa310 for two courses or \xa311 for three courses, with extra servings at \xa33.95.',source:'Official kids menu PDF, 10 November 2026.'},{title:'Parking',body:'The official website does not itself describe parking. A guest testimonial on the official homepage mentions \u201cplenty of parking\u201d. TripAdvisor\u2019s hotel listing, checked 10 November 2026, lists free parking. Visit Girvan says parking is at the Harbour Road car park.',source:'Official homepage testimonial; TripAdvisor hotel listing; https://www.girvanholidayhome.co.uk/wildings-restaurant-maidens.html (all 10 November 2026).'},{title:'Dogs',body:'A dog policy was not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Accessibility',body:'Accessibility details were not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Check-in and check-out',body:'Check-in and check-out times were not published on the official website on 10 November 2026. Please ask the hotel when you book.',source:'Official site, 10 November 2026.'}],drinks:{title:'Drinks',body:'A guest testimonial on the official homepage mentions a good selection of alcoholic and non-alcoholic drinks. A priced wine or bar list was not published on the official pages checked on 10 November 2026. Ask staff.',source:'https://www.wildingshotel.com/ (10 November 2026).'},awards:[],reviews:[{summary:'On TripAdvisor, checked 10 November 2026: the restaurant listing is 4.4 out of 5 from 1,326 reviews, and the hotel listing is 4.6 out of 5 from 89 reviews.',source:'TripAdvisor restaurant and hotel listings for Wildings, Maidens, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g947977-d951940-Reviews-Wildings_Hotel_and_Restaurant-Maidens_South_Ayrshire_Ayrshire_Scotland.html',quotes:[{text:'Huge room (room 2), lovely view of the seafront \u2026 Room was comfortable and warm. Always amazing food expertly prepared \u2026 Staff are all friendly and chatty \u2026 plenty of parking.',by:'Lynn Pope',source:'Testimonial on https://www.wildingshotel.com/ (10 November 2026).'}]}],rooms:{intro:'The official site lists 11 bedrooms, including single, double, king, twin and family rooms, many with sea views and a full Scottish breakfast included. Call reception on 01655 331 401, or email, to enquire.',items:[{name:'Double room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'King room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'Twin room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'Family room',price:'From \xa3205',note:'Including full Scottish breakfast.'}],source:'https://www.wildingshotel.com/prices (10 November 2026).',notes:['Single rooms are mentioned on the official accommodation page, but no single-room price was published on 10 November 2026 \u2014 please call to ask.','Prices can change. Confirm with the hotel when you book.']},functions:[{title:'Private dining',body:'The official website shows a private dining room among its restaurant photographs. No published capacity, hire rate or wedding package was found on the official pages checked on 10 November 2026. Call or email to ask.',source:'https://www.wildingshotel.com/ (10 November 2026).'}],photos:[{file:'exterior.jpg',alt:'The exterior of Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/out1-508w.jpg',page:'https://www.wildingshotel.com/'},{file:'room.jpg',alt:'A bedroom at Wildings, from the official accommodation page',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Room+Wildings+edit-680w.png',page:'https://www.wildingshotel.com/prices'},{file:'booths.jpg',alt:'Restaurant booths at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+boths+in+restaurant-1920w.png',page:'https://www.wildingshotel.com/'},{file:'restaurant.jpg',alt:'The main restaurant at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+main+restaurant-1920w.png',page:'https://www.wildingshotel.com/'},{file:'private-dining.jpg',alt:'Private dining at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+restaurant+private-1920w.png',page:'https://www.wildingshotel.com/'},{file:'fish.jpg',alt:'A fish dish at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Fish+close+up+widlings-1920w.png',page:'https://www.wildingshotel.com/'}],gaps:['Bar hours not published.','Christmas and seasonal hours not published.','Dog policy, accessibility, and official check-in / check-out times not published.','Single-room price not published.','No priced drinks list.','No official events calendar found.','A live Google review count was not confirmed today.','VisitScotland listing not confirmed today.'],conflicts:['Official footer and contact page use Maidens Rd, Maidens, Girvan, KA26 9NR. TripAdvisor listings (hotel and restaurant) and some older pages use Harbour Road, same postcode. The app uses Maidens Rd from the official site.','Official website Sunday lunch to 2.30pm; official lunch PDF still says 12 noon\u20132.00pm. The app follows the website for hours.']}},934,[]); +__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])},935,[31,1070,825,818,25]); +__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])},936,[992,953]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},937,[31,128,1420,825,990,818,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:l,inStaffApp:n,shiftManager:a,big:o,testID:d}){const[h,p]=(0,t.useState)(!1),x=(0,u.useSession)(e=>e.meId),y=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:n,role:l,shiftManager:a})||x&&!(0,m.canChangeBookings)(y)?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S.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:()=>p(!0),style:{minHeight:o?64:44}}),h?(0,$.jsx)(F,{rid:e,id:s.id,who:i,onClose:()=>p(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:l,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,n.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,$.jsx)(F,{rid:e,id:o,who:i,hidePrivate:a,onClose:l}):(0,$.jsxs)(S.Sheet,{visible:!0,onClose:l,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,$.jsx)(S.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${N(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}, ${N(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,$.jsx)(S.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,$.jsx)(S.Button,{kind:"ghost",label:"Close",onPress:l,style:{minHeight:44}})]})},_e.EditBookingSheet=F;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),l=(e=i)&&e.__esModule?e:{default:e},n=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),u=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),C=_r(_d[19]),f=_r(_d[20]),I=_r(_d[21]),w=_r(_d[22]),k=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]);const P=/^([01]\d|2[0-3]):[0-5]\d$/,O=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const N=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,j.ymd)(s)?'Tomorrow':B(e)};const E=e=>e?(e/100).toFixed(e%100?2:0):'',W=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},B=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',z=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')}`:''},R=e=>e.charAt(0).toUpperCase()+e.slice(1);function L({title:e,children:t,testID:s}){return(0,$.jsxs)(l.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:y.colours.hairline,alignItems:'stretch'},children:[(0,$.jsx)(S.T,{size:17,weight:"semibold",center:!0,colour:y.colours.goldLight,children:e}),t]})}const A=({label:e,value:t,onChange:s,max:i=20,testID:l})=>(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,children:e}),(0,$.jsx)(S.Stepper,{testID:l,value:t,min:0,max:i,onChange:s,label:e})]});function F({rid:e,id:i,who:u,onClose:b,hidePrivate:m=!1}){(0,I.useBlurOutside)();const N=(0,n.useBookings)(e),F=N.find(e=>e.id===i),M=(0,d.useRestaurant)(e),H=(0,a.usePlan)(e),_=(0,o.useBlocks)(e=>e.blocks),[V,Y]=(0,t.useState)(F?(0,c.draftOf)(F):null),[G,U]=(0,t.useState)(null),[q,X]=(0,t.useState)(null),[K,Q]=(0,t.useState)(E(F?(0,c.draftOf)(F).depositDue:0)),[J,Z]=(0,t.useState)(E(F?(0,c.draftOf)(F).depositAmount:0)),[ee,te]=(0,t.useState)(B(F?(0,c.draftOf)(F).depositDate:''));if(!F||!V||!M)return null;const se=e=>{U(null),X(null),Y({...V,...e})},ie=(0,k.depositOf)(M.settings),le=e=>{const t=e.partySize??V.partySize,s=Math.min(e.children??V.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(F)&&V.depositOn&&!V.depositPaid&&W(K||'0')===(0,k.depositDue)(ie,V.partySize,V.children??0)){const e=(0,k.depositDue)(ie,t,s);e>0&&Q(E(e))}se({...e,children:s})},ne=O(V.time),ae=P.test(ne),oe=V.area?H.areas.filter(e=>e.name===V.area).map(e=>e.id):null,de=e=>!oe||e.split('+').every(e=>oe.includes(H.tables.find(t=>t.name===e)?.areaId??'')),re=(0,x.tableOptions)(H,N.filter(e=>e.date===V.date),V.table).filter(e=>de(e)||e===V.table),ce=!(V.depositOn&&(Number.isNaN(W(K||'0'))||V.depositPaid&&(Number.isNaN(W(J||'0'))||ee.trim()&&!z(ee)))),he={...V,time:ne,depositDue:W(K||'0')||0,depositAmount:W(J||'0')||0,depositDate:z(ee)},pe=(0,c.changedFields)(F,he),ue=M.settings.turnMins??90,ge=async()=>{const t=(0,c.editPatch)(F,he,{by:u||'Team member',app:r.APP_VARIANT});if(Object.keys(t).length&&await n.repo.bookings.update(F.id,t),'seated'===F.status&&'table'in t&&t.table!==F.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(F.table),l=s(t.table),n=a.useFloor.getState(),o=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!l.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),l.forEach(t=>n.setLive(e,t,{stage:o,dirty:!1}))}X(`Saved. Changed: ${(0,c.editedWords)(pe)}.`),U(null),b()},be=V.allergies??[],me=e=>se({allergyNone:!1,allergies:be.some(t=>t.allergen===e)?be.filter(t=>t.allergen!==e):[...be,{allergen:e,severity:'allergy'}]}),xe=(0,c.historyLines)(F);return(0,$.jsxs)(S.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${F.name} \xb7 ${F.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,$.jsx)(l.default,{style:{alignItems:'center'},children:(0,$.jsx)(v.DepositChip,{b:F,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(F)?(0,$.jsx)(l.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,$.jsxs)(L,{title:"Deposit",testID:"edit-section-deposit",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"No deposit",selected:!V.depositOn,testID:"edit-deposit-none",onPress:()=>se({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,$.jsx)(S.Chip,{label:"Deposit due",selected:!!V.depositOn&&!V.depositPaid&&!V.depositWaived,testID:"edit-deposit-due",onPress:()=>se({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,$.jsx)(S.Chip,{label:"Deposit paid",selected:!!V.depositOn&&!!V.depositPaid,testID:"edit-deposit-paid",onPress:()=>{J||Z(K),ee||te(B((0,j.ymd)(new Date))),se({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),V.depositOn&&!V.depositPaid&&V.depositWaived?(0,$.jsx)(S.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),V.depositOn&&!V.depositPaid&&V.depositWaived?(0,$.jsxs)(S.T,{size:15,center:!0,colour:y.colours.goldLight,testID:"edit-deposit-waived-by",children:[F.depositWaived?.by?(0,k.waiverText)(F.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,V.depositWaived||pe.includes('deposit')?null:(0,$.jsx)(l.default,{style:{alignItems:'center'},children:(0,$.jsx)(w.WaiveDepositButton,{b:F,who:u,onDone:e=>Y({...V,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e})})}),V.depositOn?(0,$.jsx)(S.Field,{label:"Deposit due (\xa3)",value:K,onChangeText:e=>{Q(e),se({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,V.depositOn&&V.depositPaid?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S.Field,{label:"Amount paid (\xa3)",value:J,onChangeText:e=>{Z(e),se({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"How was it paid?"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,$.jsx)(S.Chip,{label:R(e),selected:V.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>se({depositMethod:e})},e))}),(0,$.jsx)(S.Field,{label:"Date paid (DD/MM/YYYY)",value:ee,onChangeText:e=>{te((0,s.slashDate)(e,ee)),se({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),ee.trim()&&!z(ee)?(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ce?null:(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,$.jsx)(S.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,$.jsxs)(L,{title:"When",testID:"edit-section-when",children:[(0,$.jsx)(D.BookingDatePicker,{r:M,today:new Date,value:V.date,onChange:e=>se({date:e})}),(0,$.jsx)(S.Field,{label:"Time (24-hour, for example 19:15)",value:V.time,onChangeText:e=>se({time:e}),testID:"edit-time"}),ae?null:(0,$.jsx)(S.T,{size:15,colour:y.colours.amber,children:"Write the time like 19:15."}),(0,$.jsx)(C.AdultsChildren,{value:(0,f.peopleOf)(V.partySize,V.children),onChange:e=>le(e),depositsOn:ie.on&&ie.perPersonPence>0,testID:"edit-people"}),(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,children:"Table time"}),(0,$.jsx)(S.Stepper,{testID:"edit-duration",value:V.duration||0,min:0,max:360,step:15,onChange:e=>se({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,$.jsxs)(L,{title:"Where",testID:"edit-section-where",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"Any area",selected:!V.area,testID:"edit-area-any",onPress:()=>se({area:''})}),H.areas.map(e=>(0,$.jsx)(S.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:V.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>se({area:e.name})},e.id))]}),(0,$.jsx)(S.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(V.table)}),(0,x.splitChoices)(V.table).length?(0,$.jsxs)(l.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:"Split the joined tables"}),(0,$.jsx)(S.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,x.splitChoices)(V.table).map(e=>(0,$.jsx)(S.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>se({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,$.jsxs)(S.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Button,{kind:V.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(V.table?'':', chosen'),onPress:()=>se({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),re.map(e=>(0,$.jsx)(S.Button,{kind:e===V.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===V.table?', chosen':''}`,onPress:()=>se({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,$.jsxs)(L,{title:"Guest",testID:"edit-section-guest",children:[(0,$.jsx)(S.Field,{label:"Name",value:V.name,onChangeText:e=>se({name:e}),testID:"edit-name"}),(0,$.jsx)(S.Field,{label:"Phone",value:V.phone,onChangeText:e=>se({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,$.jsx)(S.Field,{label:"Email",value:V.email,onChangeText:e=>se({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"Booked by"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:V.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>se({source:e.id})},e.id))}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(V.tags??[]).includes(e);return(0,$.jsx)(S.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>se({tags:t?(V.tags??[]).filter(t=>t!==e):[...V.tags??[],e].sort()})},e)})})]}),(0,$.jsxs)(L,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,$.jsx)(A,{label:"Dogs",value:V.dogs??0,max:6,onChange:e=>se({dogs:e}),testID:"edit-dogs"}),(0,$.jsx)(A,{label:"High chairs",value:V.highChairs??0,max:10,onChange:e=>se({highChairs:e}),testID:"edit-high-chairs"}),(0,$.jsx)(A,{label:"Wheelchair users",value:V.wheelchair??0,max:10,onChange:e=>se({wheelchair:e}),testID:"edit-wheelchair"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"Occasion"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:(V.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>se({occasion:e.id})},e.id||'none'))})]}),(0,$.jsxs)(L,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"No allergies",selected:!!V.allergyNone&&!be.length,testID:"edit-allergy-none",onPress:()=>se({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,$.jsx)(S.Chip,{label:e.short,selected:be.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>me(e.id)},e.id))]}),be.map(e=>(0,$.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,$.jsxs)(S.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,$.jsx)(S.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>se({allergies:be.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,$.jsx)(S.Field,{label:"Anything else about allergies",value:V.allergyNote,onChangeText:e=>se({allergyNote:e}),testID:"edit-allergy-note"}),pe.includes('allergies')&&be.length?(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,$.jsx)(A,{label:"Vegan",value:V.vegan??0,max:V.partySize,onChange:e=>se({vegan:e}),testID:"edit-vegan"}),(0,$.jsx)(A,{label:"Vegetarian",value:V.vegetarian??0,max:V.partySize,onChange:e=>se({vegetarian:e}),testID:"edit-vegetarian"})]}),(V.holds??[]).length||(F.holds??[]).some(e=>e.qty>0&&!e.served)?(0,$.jsxs)(L,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,$.jsx)(S.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(V.holds??[]).map(e=>{const t=(0,h.reservablesOf)(M),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),n=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,$.jsxs)(l.default,{testID:n,style:{gap:6,width:'100%'},children:[(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,$.jsx)(S.Stepper,{testID:n,value:e.qty,min:0,max:20,onChange:t=>se({holds:(0,c.setEditableHoldQty)(V.holds??[],e.kind,e.id,t)}),label:i})]}),(0,$.jsx)(S.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${n}-remove`,onPress:()=>se({holds:(0,c.removeEditableHold)(V.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(V.holds??[]).length?null:(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==F.status?(0,$.jsxs)(L,{title:"Status",testID:"edit-section-status",children:[(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:V.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>se({status:e.id})},e.id))}),(0,$.jsx)(S.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,$.jsx)(L,{title:"Notes",testID:"edit-section-notes",children:(0,$.jsx)(S.Field,{label:"Notes",value:V.notes,onChangeText:e=>se({notes:e}),placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),G?(0,$.jsxs)(l.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg},children:[G.map(e=>(0,$.jsx)(S.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,$.jsx)(S.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,q?(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:q}):null,(0,$.jsxs)(S.Row,{gap:8,wrap:!0,children:[(0,$.jsx)(S.Button,{label:G?'Save anyway':'Save changes',testID:"edit-save",disabled:!ae||!ce||V.name.trim().length<1||!pe.length,onPress:()=>{const t=ae?(0,o.blockAt)(_,e,V.date,ne):void 0,s=(0,c.editWarnings)(F,he,N,t,ue,H);!s.length||G?ge():U(s)},style:{minHeight:56,flex:1}}),(0,$.jsx)(S.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),xe.length?(0,$.jsx)(L,{title:"Changes",testID:"edit-history",children:xe.slice(0,12).map((e,t)=>(0,$.jsx)(S.T,{size:14,center:!0,colour:y.colours.muted,children:e},t))}):null,(0,$.jsx)(T.CancelBookingButton,{rid:e,b:F,name:F.name,big:!0,onDone:()=>b()}),(0,$.jsx)(T.ReinstateBookingButton,{b:F,name:F.name,today:(0,j.ymd)(new Date),onDone:()=>b()})]})}},938,[31,834,128,823,829,828,1082,807,817,832,819,866,863,992,1420,825,822,1425,994,1422,1423,1424,1077,14,991,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useScreensaverAsleep",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"useDisplayToolsH",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(0,t.create)(t=>({asleep:!1,set:n=>t({asleep:n})})),s=(0,t.create)(()=>({h:65}))},939,[995]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),u=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),f=(0,n.useOwner)(e=>e.staff),x=(0,r.workingNow)(u,f,t),b=(0,r.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:b,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'center',flexShrink:1,minWidth:0},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'center',alignItems:'center',minWidth:0},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:o.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:o.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'center',alignItems:'center',flexShrink:1,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:o.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:o.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:b,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:o.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:o.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:o.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:o.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),h=_r(d[7])},940,[31,128,953,863,1476,825,818,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},941,[874,31,128,818,823,942,863,984,982,983,881,825,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOut",{enumerable:!0,get:function(){return f}}),_e.setSoldOutBy=m,_e.setSoldOut=function(e,t,n){if(!o.useStore.getState().menu.find(t=>t.id===e))return;n&&m(n);p.add(e);try{o.useStore.getState().updateMenuItem(e,{soldOut:t})}finally{p.delete(e)}},_e.soldOutNow=function(e,t=c()){return(0,i.activeSoldOut)(f.getState().entries,e,t)},_e.linkSoldOut=h,_e.useSoldOutLink=function(e,t,n=!0){const r=_r(d[9]);r.useEffect(()=>{n&&h({adopt:e})},[e,n]),r.useEffect(()=>{n&&m(t)},[t,n])};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),a=_r(d[2]),i=_r(d[3]),s=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]);const c=()=>{try{return(0,o.nowFrom)(o.useStore.getState().clock)}catch{return new Date}},f=(0,r.create)()((0,a.persist)((e,t)=>({entries:[],adopted:{},mark:(t,n,r,a)=>{const u=c(),l=o.useStore.getState().restaurants.find(e=>e.id===t),f=(0,i.soldOutSettingsOf)(l?.settings?.soldOut),S=l?(0,s.hoursFor)(l,u)?.close??null:null,m=(0,i.clearAfterFor)(u,f,S),p={rid:t,itemId:n,name:r.slice(0,120),on:!0,at:u.toISOString(),by:a.slice(0,80),clearAfter:m?.toISOString(),auto:!1,kept:!1};e(e=>({entries:[...e.entries.filter(e=>!(e.rid===t&&e.itemId===n)),p]}))},back:(n,r,a)=>{const i=t().entries.find(e=>e.rid===n&&e.itemId===r);i&&i.on&&e(e=>({entries:e.entries.map(e=>e===i?{...e,on:!1,at:c().toISOString(),by:a.slice(0,80),clearAfter:void 0,kept:!0}:e)}))},expire:(n,r)=>{const a=(0,i.expiredSoldOut)(t().entries,n,r);if(!a.length)return 0;const s=new Set(a.map(e=>e.itemId));return e(e=>({entries:e.entries.map(e=>e.rid===n&&s.has(e.itemId)?{...e,on:!1,by:'Cleared automatically',clearAfter:void 0}:e)})),a.length}}),{name:'covercharge-soldout-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default),partialize:e=>({entries:e.entries.slice(-500),adopted:e.adopted})}));let S='Staff';function m(e){e&&(S=e.replace(' (example)',''))}const p=new Set;let O=null;function h(e){if(O)return O;let t=!1;const n=(e=o.useStore.getState().menu)=>new Map(e.map(e=>[e.id,e.soldOut]));let r=n();if(e.adopt){const e={...f.getState().adopted},t=[];for(const t of o.useStore.getState().menu)e[t.restaurantId];for(const t of o.useStore.getState().menu)e[t.restaurantId]=!0;f.setState(n=>({entries:[...n.entries,...t],adopted:e}))}const a=()=>{const e=c(),a=f.getState().entries,i=o.useStore.getState().menu,s=new Map;for(const t of a){const n=t.on&&(!t.clearAfter||new Date(t.clearAfter).getTime()>e.getTime());s.set(`${t.rid}|${t.itemId}`,n)}const u=i.filter(e=>s.has(`${e.restaurantId}|${e.id}`)&&s.get(`${e.restaurantId}|${e.id}`)!==e.soldOut);if(u.length){t=!0;try{const e=new Map(u.map(e=>[e.id,s.get(`${e.restaurantId}|${e.id}`)]));o.useStore.setState(t=>({menu:t.menu.map(t=>e.has(t.id)?{...t,soldOut:e.get(t.id)}:t)}))}finally{t=!1,r=n()}}},i=o.useStore.subscribe((e,i)=>{if(e.menu===i.menu)return;const s=n(e.menu);let o=!1;if(!t)for(const t of e.menu){const e=r.get(t.id);void 0!==e&&e!==t.soldOut&&(p.has(t.id)?t.soldOut?f.getState().mark(t.restaurantId,t.id,t.name,S):f.getState().back(t.restaurantId,t.id,S):o=!0)}r=s,o&&setTimeout(a,0)}),s=f.subscribe((e,t)=>{e.entries!==t.entries&&a()}),u=()=>{const e=c(),t=new Set(f.getState().entries.filter(e=>e.on).map(e=>e.rid));for(const n of t)f.getState().expire(n,e)};u(),a();const l=setInterval(u,3e4);let m=null;if(e.adopt)try{m=_r(d[8],"./autoSoldOutStore").startAutoSoldOut()}catch{m=null}return O=()=>{i(),s(),clearInterval(l),m&&m(),O=null},O}u.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchLive=e=>(0,l.setLiveData)(!!e),globalThis.__pitchSoldOut=e=>{const t=o.useStore.getState(),n=t.restaurants[0]?.id;if(!n)return;const r=t.menu.filter(e=>e.restaurantId===n&&!e.hidden),a=['Sticky toffee pudding','Cullen skink','Fish supper','Steak pie','Haggis bon bons','Cranachan','Lemon tart','Mussels','Scampi','Venison burger','Chips (large)','Oysters','Lobster thermidor','Crab claws','Tablet ice cream','Beef shin','Smoked salmon','Cheeseboard','Halibut','Clootie dumpling'],i=(new Date).toISOString(),s=Array.from({length:e},(e,t)=>r[t]?{id:r[t].id,name:r[t].name}:{id:`pitch-so-${t}`,name:a[t%a.length]});f.setState(e=>({entries:[...e.entries.filter(e=>e.rid!==n||!s.some(t=>t.id===e.itemId)).map(e=>e.rid===n?{...e,on:!1}:e),...s.map(e=>({rid:n,itemId:e.id,name:e.name,on:!0,at:i,by:'Chef'}))]}))})},942,[1190,995,1191,984,833,881,2,1218,982,31]); +__d(function(g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dismissNotice",{enumerable:!0,get:function(){return u.dismissNotice}}),Object.defineProperty(_e,"notify",{enumerable:!0,get:function(){return u.notify}}),Object.defineProperty(_e,"useSliders",{enumerable:!0,get:function(){return u.useSliders}}),Object.defineProperty(_e,"SLIDER",{enumerable:!0,get:function(){return j}}),_e.SliderButton=k,_e.SliderCard=C,_e.SliderHost=function(){y();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(0,t.useEffect)(()=>{if(p)return window.ccSlider=e=>(0,u.notify)(e),()=>{delete window.ccSlider}},[]),(0,t.useEffect)(()=>{if(o.current&&clearTimeout(o.current),!n)return;const e=void 0!==n.timeoutMs?n.timeoutMs:n.actions?.length||n.content?null:6e3;return e&&(o.current=setTimeout(()=>u.useSliders.getState().dismiss(n.id),e)),()=>{o.current&&clearTimeout(o.current)}},[n?.id,n?.timeoutMs]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!p||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=p?'fixed':'absolute';return(0,f.jsxs)(f.Fragment,{children:[n.modal?(0,f.jsx)(s.default,{...x('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,f.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...p?{bottom:l?`${12+l}px`:'calc(12px + env(safe-area-inset-bottom))'}:{}},children:(0,f.jsx)(C,{n:n,waiting:e.length-1,onClose:()=>u.useSliders.getState().dismiss(n.id)},n.id+':'+(n.seq??0))})]})};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=e(r(d[4])),l=e(r(d[5])),c=r(d[6]),a=r(d[7]),u=r(d[8]),b=r(d[9]),f=r(d[10]);const p='undefined'!=typeof document,h="\n[data-ccsl=\"in\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccsl-in{from{opacity:0;transform:translate3d(0,110%,0)}to{opacity:1;transform:none}}\n[data-ccsl=\"urgent\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both,ccsl-red 1.6s ease-in-out .45s infinite}\n@keyframes ccsl-red{0%,100%{box-shadow:0 10px 30px rgba(0,0,0,.6),0 0 0 1px rgba(255,107,94,.55)}50%{box-shadow:0 10px 40px rgba(0,0,0,.6),0 0 0 2px #FF6B5E,0 0 34px rgba(255,107,94,.45)}}\n[data-ccsl=\"dim\"]{animation:ccsl-dim .3s ease both}\n@keyframes ccsl-dim{from{opacity:0}to{opacity:1}}\n@media (prefers-reduced-motion: reduce){[data-ccsl]{animation:none !important}}\n",x=e=>p?{dataSet:{ccsl:e}}:{};function y(){(0,t.useEffect)(()=>{if(!p||document.getElementById('cc-slider-css'))return;const e=document.createElement('style');e.id='cc-slider-css',e.textContent=h,document.head.appendChild(e)},[])}const j={bg:'#17140F',border:'rgba(207,164,95,.55)',text:'#F5F1E8',quiet:'#A89A80',gold:c.colours.gold,ink:'#17130D'},w=(e="normal")=>'urgent'===e?c.colours.red:'warn'===e?c.colours.amber:c.colours.gold,S=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':j.border;function k({a:e,onDone:t,big:o}){const s=e.kind??'primary';return(0,f.jsx)(n.default,{testID:e.testID,accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{try{e.onPress?.()}finally{e.keepOpen||t()}},style:({pressed:e})=>({minHeight:o?56:44,minWidth:44,paddingHorizontal:'ghost'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?j.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,f.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?j.ink:'danger'===s?c.colours.red:j.quiet,children:e.label})})}function C({n:e,onClose:t,waiting:n=0,maxWidth:c=520}){y();const u=e.tone??'normal',h=w(u),C=e.content,z=!!e.big,{height:I}=(0,l.default)(),D=e.actions??[];return(0,f.jsxs)(s.default,{testID:e.testID??'cc-slider',accessibilityRole:"summary",accessibilityLabel:`${e.kicker?e.kicker+': ':''}${e.title}`,...x('urgent'===u?'urgent':'in'),style:{width:'100%',maxWidth:z?Math.max(c,900):c,alignSelf:'center',borderRadius:14,backgroundColor:j.bg,borderWidth:1,borderColor:S(u),overflow:'hidden',...p?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,f.jsx)(s.default,{style:{position:'absolute',left:0,top:0,bottom:0,width:5,backgroundColor:h}}):null,(0,f.jsxs)(o.default,{style:{maxHeight:Math.max(220,I-40)},contentContainerStyle:{paddingVertical:z?18:12,paddingLeft:'normal'!==u?z?24:18:z?20:14,paddingRight:z?20:14,gap:z?10:6},children:[(0,f.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:12},children:[e.icon?(0,f.jsx)(a.T,{size:z?34:22,children:e.icon}):null,(0,f.jsxs)(s.default,{style:{flex:1,gap:2},children:[e.kicker?(0,f.jsx)(a.T,{size:z?15:11,weight:"bold",colour:h,style:{letterSpacing:1.4},children:e.kicker}):null,(0,f.jsx)(a.T,{size:z?24:15,weight:"medium",colour:j.text,children:e.title}),e.body?(0,f.jsx)(a.T,{size:z?18:13,colour:j.quiet,children:e.body}):null]}),D.length||C?null:(0,f.jsx)(b.ToastClose,{testID:"cc-slider-ok",label:`Close: ${e.title}`,onPress:t,size:z?'lg':'md',colour:j.quiet})]}),C?(0,f.jsx)(C,{close:t}):null,D.length?(0,f.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:D.map(e=>(0,f.jsx)(k,{a:e,onDone:t,big:z},e.label))}):null,n>0?(0,f.jsxs)(a.T,{size:z?14:11,colour:j.quiet,center:!0,style:{alignSelf:'stretch'},children:[n," more waiting"]}):null]})]})}},943,[31,123,264,152,128,288,825,818,980,835,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CoversToday=function({rid:e,onPress:p,big:x,sound:$,testID:v="covers-today",day:j,compact:C=!1,snug:w=!1,tight:T=!1,aside:k}){const D=(0,c.useBookings)(e),S=(0,c.useNow)(3e4),I=(0,h.venueYmd)(S),L=j&&j!==I?j:I,_=L!==I,M=(0,u.coversFour)(D,L),R=(0,y.dayWord)(L,I),z=/^(Today|Yesterday|Tomorrow)$/.test(R),O=`COVERS ${R.toUpperCase()}`,P=_?`${z?`${R}\u2019s`:R} bookings \u203a`:'Today\u2019s bookings \u203a',W=_?`${z?`${R}, `:''}${(0,y.dayLong)(L)}`:'today',E=(0,o.useLiveState)();if('ready'!==E)return(0,f.jsx)(o.LiveWait,{state:E,title:"Covers today",testID:`${v}-wait`});const F=x?64:T?28:w?36:44,V=M.total?Math.min(1,M.done/M.total):0,Y=(e,o,t,c)=>(0,f.jsxs)(s.default,{style:{flex:1,alignItems:'center',gap:T?2:w?4:6,minWidth:0},children:[(0,f.jsx)(l.SplitFlap,{value:o,height:F,colour:t,testID:`covers-${c}`,sound:$}),(0,f.jsx)(n.T,{size:T?11:x||C?14:12,weight:"semibold",colour:b.colours.muted,numberOfLines:1,center:C||T,style:{letterSpacing:.4},children:e})]});return(0,f.jsxs)(t.default,{testID:v,dataSet:{centreExempt:'dashboard-card'},accessibilityRole:"button",disabled:!p,onPress:p,accessibilityLabel:`Covers ${W}: ${M.done} done, ${M.seated} seated, ${M.toCome} to come, ${M.total} total.${p?` Opens ${_?'that day\u2019s':'today\u2019s'} bookings.`:''}`,style:({pressed:e})=>({backgroundColor:e?b.colours.tilePressed:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:T?6:16,...w&&!T?{paddingVertical:8,paddingHorizontal:10}:null,gap:T?4:w?8:12}),children:[T?null:(0,f.jsxs)(s.default,{style:{flexDirection:C?'column':'row',justifyContent:'space-between',alignItems:'center',gap:C?w?2:6:void 0},children:[(0,f.jsx)(n.T,{center:C,size:C?16:12,weight:"semibold",colour:b.colours.goldMuted,style:{letterSpacing:1.6},children:O}),p?(0,f.jsx)(n.T,{center:C,size:C?14:12,colour:b.colours.muted,children:P}):null]}),(0,f.jsxs)(s.default,{style:{flexDirection:'row',gap:8},children:[Y('Done',M.done,b.colours.text,'done'),Y('Seated',M.seated,b.colours.text,'seated'),Y('To come',M.toCome,b.colours.text,'tocome'),Y('Total',M.total,b.colours.goldLight,'total')]}),T?null:(0,f.jsx)(s.default,{style:{height:4,borderRadius:2,backgroundColor:'rgba(255,255,255,0.06)',overflow:'hidden'},children:(0,f.jsx)(s.default,{style:{width:`${Math.round(100*V)}%`,height:4,backgroundColor:b.colours.gold,borderRadius:2}})})]})},r(d[0]);var o=r(d[1]),t=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),b=r(d[10]),f=r(d[11])},944,[31,1388,264,128,1413,818,823,832,822,967,825,25]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},945,[812,967,944,994,31,128,995,818,823,832,833,814,822,825,1409,993,1080,25]); +__d(function(_g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setDisplaySilent",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"soundAllowed",{enumerable:!0,get:function(){return u}}),e.chime=function(t="bright"){if(!u())return void l('__ccChimesBlocked');try{const n=o();if(!n)return;('bright'===t?[880,1318.5]:[659.3]).forEach((o,c)=>{const i=n.currentTime+.16*c,u=n.createOscillator(),l=n.createGain();u.type='sine',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime('bright'===t?.12:.07,i+.02),l.gain.exponentialRampToValueAtTime(1e-4,i+.9),u.connect(l).connect(n.destination),u.start(i),u.stop(i+.95)}),l('__ccChimes')}catch{}},Object.defineProperty(e,"LOW_CHIME_MIN",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"LOW_CHIME_MAX",{enumerable:!0,get:function(){return d}}),e.lowChime=function(t=0){if(!u())return void l('__ccChimesBlocked');const n=s+.095*Math.max(0,Math.min(1,t));'undefined'!=typeof window&&(window.__ccLowChimeLevels=[...window.__ccLowChimeLevels??[],Math.round(1e3*n)/1e3].slice(-40));try{const t=o();if(!t)return;[220,164.8].forEach((o,c)=>{const i=t.currentTime+.42*c,u=t.createOscillator(),l=t.createGain(),s=t.createBiquadFilter?.();u.type='triangle',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime(n,i+.12),l.gain.exponentialRampToValueAtTime(1e-4,i+1.6),s?(s.type='lowpass',s.frequency.value=900,u.connect(s).connect(l).connect(t.destination)):u.connect(l).connect(t.destination),u.start(i),u.stop(i+1.7)}),l('__ccLowChimes')}catch{}},Object.defineProperty(e,"flapSoundOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setFlapSound",{enumerable:!0,get:function(){return w}}),e.flapClick=function(){if('display'!==t.APP_VARIANT&&!c)return;if(!p())return;try{const t=o();if(!t)return;const n=t.currentTime,c=Math.floor(.03*t.sampleRate),i=t.createBuffer(1,c,t.sampleRate),u=i.getChannelData(0);for(let t=0;t{if('undefined'==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;return t?(n||(n=new t),'suspended'===n.state&&n.resume?.().catch?.(()=>{}),n):null};if('undefined'!=typeof window){const t=()=>{try{o()}catch{}window.removeEventListener('pointerdown',t)};window.addEventListener('pointerdown',t)}let c=!1;const i=t=>{c=t},u=()=>'display'!==t.APP_VARIANT&&!c,l=t=>{'undefined'!=typeof window&&(window[t]=(window[t]??0)+1)};const s=.015,d=.11;const f='cc-flap-sound',p=()=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(f)}catch{return!1}},w=t=>{try{localStorage.setItem(f,t?'1':'0')}catch{}}},946,[123,807]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},947,[812,31,980,823,832,822,946]); +__d(function(g,r,i,a,_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()})}},948,[805,31,288,128,995,807,953,1172,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},949,[31,128,989,825,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},950,[31,807,1486]); +__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'},951,[825]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=A,_e.resetTableLive=W,_e.seatBookingNow=E,_e.finishBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'finished'),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=H,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=Y,_e.WalkInSheet=U,_e.WalkInMatchPrompt=Q,_e.AssignTableSheet=V,_e.undoNotice=G,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[i,n]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>n({b:e}),combineTables:e=>n({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(U,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:G}):null,l?(0,L.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,L.jsx)(V,{booking:i.b,combine:i.combine,onClose:()=>n(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=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),B=_r(_d[28]),z=_r(_d[29]),O=_r(_d[30]),N=_r(_d[31]),M=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function A(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function E(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)}function H(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=A(e),a=(0,v.useFloor)(t=>t.live[e])??{},i=(0,v.usePlan)(e),n=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(n,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(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,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function Y({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=i?6:8,f=i?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(n??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],n=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!n,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,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?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:n?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:n?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function U({onClose:e,onSeated:a,wide:i,initialTable:n}){const{rid:r,r:d,now:x}=(0,y.useCtx)(15e3),T=H(r,x),[I,$]=(0,c.useState)(2),[P,B]=(0,c.useState)(!1),[z,N]=(0,c.useState)(n??null),R=(0,v.usePlan)(r),A=(0,k.useBookings)(r),_=(0,D.useBlocks)(e=>e.blocks),U=(0,D.closedAreasAt)(_,r,(0,w.ymd)(x),(0,w.hm)(x)),V=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(T).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(R,A.filter(e=>e.date===(0,w.ymd)(x)),e,I,x,(0,j.turnFor)(I,d.settings.turnMins),90,void 0,{closed:U})?.table??null},[R,A,T,I,U.size,x.getTime()]);(0,c.useEffect)(()=>{z&&(0,v.tablesOf)(z).some(e=>'Closed'===T[e]?.label)&&N(null)},[z,U.size]);const[G,K]=(0,c.useState)(!1),[X,J]=(0,c.useState)(''),Z=(e,t=String(e),s=()=>{B(!1),$(e)})=>{const o='9+'===t?P:!P&&I===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},ee=(0,L.jsx)(s.PartySizeInput,{value:I,onChange:$,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),te=(0,L.jsxs)(m.default,{style:{gap:8,width:i?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>Z(e)),Z(9,'9+',()=>{B(!0),$(e=>e>=9?e:9)})]}),P?ee:null]}),[se,oe]=(0,c.useState)(!1),[le,ae]=(0,c.useState)(null),ie=async(t=z,s=!1)=>{if(!se&&(0,M.guardBookingChange)(F)){if(!s){const e=(0,O.bookingsNearWalkIn)(A,x,I);if(e.length)return void ae({at:t,list:e})}oe(!0);try{const s=await k.repo.bookings.seatWalkIn(r,I,t??void 0,X);W(r,t??void 0),a(s),e()}finally{oe(!1)}}},ne=async(t,s)=>{if(!se&&(0,M.guardBookingChange)(F)){oe(!0);try{const o=s??t.table??null;o&&o!==t.table&&await k.repo.bookings.assignTable(t.id,o),await E(r,{...t,table:o??void 0}),(0,u.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})`}),ae(null),e()}finally{oe(!1)}}},re=(0,L.jsxs)(m.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),z?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>N(null)}):null]}),(0,L.jsx)(Y,{use:T,value:z,onPick:e=>{T[e]&&!T[e].busy?ie(e):N(z===e?null:e)},big:i,dense:i,best:V,bestSet:(0,h.bestTables)(R)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",V&&!z?` (suggested for ${I}: ${(0,l.tableNumbers)(V)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(x)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${I} ${1===I?'person':'people'}${z?` \xb7 ${(0,l.tableNumbers)(z)}`:''}`,disabled:se,onPress:()=>{ie()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[te,re]}):(0,L.jsxs)(L.Fragment,{children:[te,re]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[G?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:X,onChangeText:J,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>K(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),le?(0,L.jsx)(Q,{list:le.list,busy:se,onYes:e=>{ne(e,le.at)},onNo:()=>{const e=le.at;ae(null),ie(e,!0)},onClose:()=>ae(null)}):null]})}function Q({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,L.jsx)(C.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,L.jsxs)(m.default,{style:{gap:14},children:[e.map((e,o)=>(0,L.jsxs)(m.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,L.jsx)(m.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:26,weight:"bold",colour:S.colours.goldLight,testID:"walkin-match-question",children:(0,O.walkInMatchQuestion)(e)})}),e.table?(0,L.jsxs)(C.T,{size:17,colour:S.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,L.jsx)(C.T,{size:17,colour:S.colours.text,children:e.ref}),(0,L.jsx)(C.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,L.jsx)(C.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,y.useCtx)(15e3),n=H(o,i),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(i)),t,e.partySize,i,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,i.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),$=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,P=D.reduce((e,t)=>e+$(t),0),B=D.length>0&&P{if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},O=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${P} seats for ${e.partySize} Covers`:'No tables picked yet'})}),B?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-P," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:O,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(Y,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function G(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:O}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[A,W]=(0,c.useState)(ee.blocks),[_,Y]=(0,c.useState)(!1),[q,U]=(0,c.useState)(''),[Q,V]=(0,c.useState)(2),[G,K]=(0,c.useState)(0),X=Math.min(G,Math.max(0,Q-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ie,ne]=(0,c.useState)('phone'),[re,de]=(0,c.useState)((0,$.emptyNeeds)()),ue=(0,$.needsMissing)(re),[ce,be]=(0,c.useState)(null),ge=(0,v.usePlan)(b),he=(0,z.dogSetUp)(ge),pe=!0===re.dog&&he,me=re.dog?re.dogs:0,fe=(0,w.parseYmd)(A),ye=(0,j.turnFor)(Q,h.settings.turnMins),ke=E.filter(e=>e.date===A),xe=e=>(0,j.freeTablesAt)(ge,ke,Q,new Date(`${A}${(0,l.tableNumbers)(e)}:00`),ye,h.settings.turnMins,{dog:!0,closed:(0,D.closedAreasAt)(H,b,A,e)}),je=pe&&J?xe(J):[];(0,c.useEffect)(()=>{be(null)},[pe,J,Q]);const we=(0,x.bookingSlots)(h,fe,e=>E.filter(t=>t.date===A&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Q,A===(0,w.ymd)(p)?p:(0,w.addMins)(fe,0),e=>E.filter(t=>t.date===A&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Se=(0,T.guestPhone)(se),[Te,Ce]=(0,c.useState)(!1),ve=J?we.find(e=>e.time===J):void 0,De=ve&&ve.left=2&&!!J&&(!$e||Te)&&(0,o.validParty)(Q)&&Se.ok&&(0,T.emailOk)(le)&&(!Pe||Be&&_)&&(!pe||je.length>0)&&!ze,Ne=re.wheelchair>0||re.stepFree;return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(fe)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)($.FirstQuestions,{rid:b,value:re,onChange:de,party:Q,audience:"staff"}),re.dog&&!he?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:A,onChange:e=>{e!==A&&(W(e),Z(null),Y(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===ie,onPress:()=>ne('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===ie,onPress:()=>ne('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:U,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Se.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Se.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,L.jsx)(n.AdultsChildren,{value:(0,r.peopleOf)(Q,X),onChange:e=>{V(e.partySize),K(e.children),Ce(!1)},depositsOn:(0,i.depositOf)(h.settings).on&&(0,i.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:we.map(e=>{const t=pe&&e.available&&!xe(e.time).length||!(0,$.dogTimeOk)(h,E,A,e.time,me);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,A,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),Y(!1),Ce(!1)}},e.time)})}),$e?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[De?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Q,De.left,De.time)}):null,Ie?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ie.time,Ie.cap)}):null,(0,L.jsx)(C.Chip,{label:Te?'Booking over the limit: on':'Book anyway (over the limit)',selected:Te,onPress:()=>Ce(e=>!e),testID:"nb-over-ok"})]}):null,pe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",ge.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),je.length?(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:je.slice(0,10).map((e,t)=>(0,L.jsx)(C.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${Ne&&(0,z.accessibleSetUp)(ge)&&!(0,z.isAccessible)(ge,e.table)?' \xb7 not step-free':''}`,selected:(ce??je[0].table)===e.table,onPress:()=>be(e.table)},e.table))}):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Q," at ",J,". Try another time."]})]}):null,Pe?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Pe.from,"\u2013",Pe.to,Pe.reason?` (${Pe.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:_?'Manager override on':'Override and book anyway',selected:_,onPress:()=>Y(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,we.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(fe)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)($.MoreQuestions,{rid:b,r:h,value:re,onChange:de,party:Q,date:A,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ne&&!(0,z.accessibleSetUp)(ge)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:P.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(h.settings),Q,X))," (",(0,a.gbp)((0,i.depositOf)(h.settings).perPersonPence)," per adult for ",(0,i.depositOf)(h.settings).fromParty,"+",X?`; ${X} ${1===X?'child':'children'} free`:'; children free',"). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsxs)(C.Muted,{children:["The guest gets a confirmation text",le.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ze?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:ue.length?ue[0]:'Save booking',testID:"nb-save",disabled:!Oe,onPress:()=>{if(A<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,$.needsPatch)(re),s=re.tableReq.find(e=>!pe||je.some(t=>t.table===e)),o=pe?null:(0,N.requestedFreeTable)(re.tableReq,{date:A,time:J,partySize:Q},ge.tables.map(e=>e.name),ke,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Q,date:A,time:J,notes:ee.trim(),security:(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?'deposit':'none',depositPaid:0,...X?{children:X}:{},...(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?{depositDue:(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X),depositPolicy:(0,i.depositWords)((0,i.depositOf)(h.settings),Q,h.name,X).join(' '),depositRefundable:(0,i.depositOf)(h.settings).refundable,depositCutoffHours:(0,i.depositOf)(h.settings).cutoffHours}:{},phone:Se.pretty,email:le.trim()||void 0,source:ie,...e,...we.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...pe?{table:ce??s??je[0]?.table}:o?{table:o}:{}}).then(e=>(0,B.postNewBookingToKitchen)(e,O)).catch(()=>{}),u?.({date:A,time:J,name:q.trim()}),t()}})]})}},952,[874,813,1174,812,820,14,1422,1423,1424,943,31,1070,264,128,807,953,823,821,830,822,825,827,818,829,828,1425,831,817,993,832,1427,960,959,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtH",{enumerable:!0,get:function(){return d.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return d.fmtHDay}}),Object.defineProperty(_e,"authorityRole",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return b}}),_e.useShiftManager=h,_e.useSignedIn=S,_e.useCtx=function(e=1e4){const u=(0,t.useContext)(y),i=(0,r.useOwner)(e=>e.site),f=(0,r.useOwner)(e=>e.previewRole),c=(0,r.useOwner)(e=>e.staffAs),d=S(),l=u||'staff'===o.APP_VARIANT,D=(0,t.useContext)(b),O=h(),A=o.IS_CAR?'owner':l?D&&O?'manager':'staff':d?w(f,p(d)):f,I=(0,r.useOwner)(e=>e.staff),R=(0,n.useRestaurant)(i),M=(0,n.useNow)(e),C=o.IS_CAR?s.CAR_DEVICE_ID:d?d.id:l&&c?c:m[A],P=o.IS_CAR?s.CAR_ACTOR:I.find(e=>e.id===C)?.name??'Team member';return{rid:i,r:R,now:M,role:A,me:P,meId:C,today:(0,a.venueYmd)(M),signedIn:!o.IS_CAR&&!!d}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return A}}),_e.ensureAttendance=function(t,n){if(e.LIVE_VENUE_BUILD||(0,u.isLive)())return;const o=r.useOwner.getState(),s=[],i=o.staff.find(e=>e.active&&'manager'===e.role)??o.staff.find(e=>e.active&&'owner'===e.role),f=new Date(n);f.setDate(n.getDate()-O(n));const c=(0,a.ymd)(f),d=(0,a.ymd)(new Date(f.getFullYear(),f.getMonth(),f.getDate()+6)),m=(e,t,n)=>{const r=new Date(e);return r.setHours(0,0,0,0),r.setMinutes(Math.round(60*t)+n),r.toISOString()};for(let e=42;e>=1;e--){const t=new Date(n);t.setDate(t.getDate()-e);const r=(0,a.ymd)(t);if(o.attendance.some(e=>e.date===r))continue;const u=o.shifts.filter(e=>e.date===r&&!1!==e.published);(u.length?u:o.shifts.filter(e=>e.day===O(t)&&e.date>=c&&e.date<=d&&!1!==e.published)).forEach((n,a)=>{const o=e=>Math.round((7*r.charCodeAt(9)+13*a+e)%17-5),u=n.end-n.start,f=u>8?30:u>6?20:0,c=e>2&&i?{signOff:{by:i.name,byId:i.id,at:m(t,34,a)}}:{};s.push({id:`at-${r}-${n.staffId}`,staffId:n.staffId,date:r,in:m(t,n.start,o(1)),out:m(t,n.end,o(2)),inSite:!0,outSite:!0,breakMins:f,...c})})}s.length&&r.useOwner.setState({attendance:[...r.useOwner.getState().attendance,...s]})},_e.paidMins=function(e,t){if(!e.in)return{worked:0,brk:0,paid:0};const n=Math.max(0,Math.round(((e.out?new Date(e.out):t).getTime()-new Date(e.in).getTime())/6e4)),r=e.breakMins??0;return{worked:n,brk:r,paid:Math.max(0,n-r)}},Object.defineProperty(_e,"hmDur",{enumerable:!0,get:function(){return I}}),_e.payRange=function(e,t,n){const r=new Date(n);if(r.setHours(0,0,0,0),'monthly'===e){const e=new Date(r.getFullYear(),r.getMonth()+t,1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{s:e,e:n,key:`m-${(0,a.ymd)(e)}`}}const o='weekly'===e?7:14,s=new Date(r);s.setDate(r.getDate()-O(r));let u=new Date(s);if('fortnightly'===e){const e=new Date(2026,0,5);(Math.round((s.getTime()-e.getTime())/6048e5)%2+2)%2==1&&u.setDate(u.getDate()-7)}u.setDate(u.getDate()+t*o);const i=new Date(u);return i.setDate(u.getDate()+o-1),{s:u,e:i,key:`${e[0]}-${(0,a.ymd)(u)}`}},_e.useHourly=function(){const e=S(),t=(0,r.useOwner)(e=>e.hourly);return o.IS_CAR||e?t:R};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),r=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]),u=_r(_d[7]),i=_r(_d[8]),f=_r(_d[9]),c=_r(_d[10]),d=_r(_d[11]);const m={owner:c.ROSTER.find(e=>'owner'===e.role)?.id??'',manager:c.ROSTER.find(e=>'manager'===e.role)?.id??'',staff:c.ROSTER.find(e=>'staff'===e.app)?.id??''},l={staff:0,manager:1,owner:2},p=e=>e.ownerAccess?'owner':e.managerAccess&&'staff'===e.role?'manager':e.role,w=(e,t)=>l[e]>l[t]?t:e,y=(0,t.createContext)(!1),D=()=>(0,t.useContext)(y),b=(0,t.createContext)(!1);function h(){const e=(0,t.useContext)(y)||'staff'===o.APP_VARIANT,n=S(),r=(0,u.useSync)(e=>!!e.venueId&&'staff'===e.kind),a=(0,u.useSync)(e=>e.perms);return(0,i.shiftManagerOn)({inStaffApp:e,managerAccess:n?.managerAccess,role:n?.role,app:(0,f.rosterPerson)(n?.id)?.app,live:r,perms:a})}function S(){const e=(0,f.useSession)(e=>e.meId),t=(0,r.useOwner)(e=>e.staff);return e?t.find(t=>t.id===e&&t.active):void 0}const O=e=>(e.getDay()+6)%7,A=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const I=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const R={}},953,[842,31,823,863,822,807,977,824,1101,866,15,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,"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,'+')}},954,[876,812,985,31,119,123,128,829,830,825,818,993,1070,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"areaMarks",{enumerable:!0,get:function(){return n}}),_e.AreaTabs=function({plan:o,area:e,onPick:u,counts:a,closed:b}){return(0,c.jsx)(t.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:o.areas.map(o=>{const h=o.id===e,f=b?.has(o.id);return(0,c.jsx)(l.default,{testID:`area-${o.id}`,accessibilityRole:"tab",accessibilityLabel:`Area ${o.name}${o.dogs?', dogs allowed':''}${o.outdoor?', outdoor':''}${f?', closed for weather':''}`,accessibilityState:{selected:h},onPress:()=>u(o.id),style:{maxWidth:'100%',minWidth:0,flexShrink:1,minHeight:48,paddingHorizontal:16,borderRadius:24,borderWidth:1.5,borderColor:h?s.colours.gold:f?s.colours.blue:s.colours.border,backgroundColor:h?s.colours.gold:s.colours.surface,justifyContent:'center'},children:(0,c.jsxs)(t.T,{weight:"semibold",size:15,colour:h?s.colours.onGold:s.colours.text,children:[o.name,n(o),f?(0,c.jsx)(t.T,{size:12,colour:h?s.colours.onGold:s.colours.blue,children:" closed"}):null,a?.[o.id]?(0,c.jsxs)(t.T,{size:12,colour:h?s.colours.onGold:s.colours.muted,children:[" ",a[o.id]]}):null]})},o.id)})})},r(d[0]);var o,e=r(d[1]),l=(o=e)&&o.__esModule?o:{default:o},s=r(d[2]),t=r(d[3]),c=r(d[4]);const n=o=>`${o.dogs?' \ud83d\udc3e':''}${o.outdoor?' \ud83c\udf26':''}`},955,[31,264,825,818,25]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=R,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),N=a.now,F=e=>l({t:'set',p:e}),[H,O]=(0,i.useState)(e.startStep??'areas'),[U,G]=(0,i.useState)(e.initial.areas[0]?.id??''),[_,K]=(0,i.useState)(null),X=(0,w.useOwner)(e=>e.site),J=(0,y.useFloor)(e=>e.settings[X]),Y=!1!==J?.gridSnap,Z=(0,j.gridOf)(J?.gridSize),[q,V]=(0,i.useState)(null),[Q,ee]=(0,i.useState)(null),[se,te]=(0,i.useState)(null),ae=(0,T.useSync)(e=>e.venueId),le=e.role??'staff',[oe,ne]=(0,i.useState)(''),{width:re,height:ie}=(0,c.default)(),de=re>=900,ue=a.past.length>0||JSON.stringify(N)!==JSON.stringify(e.initial),ce=(0,b.planCounts)(N);(0,i.useEffect)(()=>{N.areas.some(e=>e.id===U)||G(N.areas[0]?.id??'')},[N.areas,U]),(0,i.useEffect)(()=>{oe&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:oe,timeoutMs:3500,testID:'plan-toast'}),ne(''))},[oe]);const he='table'===_?.kind?N.tables.find(e=>e.id===_.id):void 0,be='fixture'===_?.kind?(N.fixtures??[]).find(e=>e.id===_.id):void 0,ge=(e,s)=>{const t=N.tables.find(s=>s.id===e),a=t&&s.name&&s.name!==t.name?N.joins.map(e=>({...e,tables:e.tables.map(e=>e===t.name?s.name:e)})):N.joins,l=t&&s.name&&s.name!==t.name?N.areas.map(e=>e.best?.includes(t.name)?{...e,best:e.best.map(e=>e===t.name?s.name:e)}:e):N.areas;F({...N,areas:l,joins:a,tables:N.tables.map(t=>t.id===e?{...t,...s}:t)})},pe=e=>{const s=N.tables.find(s=>s.id===e);F({...N,tables:N.tables.filter(s=>s.id!==e),joins:N.joins.filter(e=>!s||!e.tables.includes(s.name))}),K(null)},me=e=>{const s=b.FIXTURES.find(s=>s.id===e),t={id:(0,b.fid)('fx'),areaId:U,kind:e,x:25*Math.round((b.PLAN_W-s.w)/50),y:25,w:s.w,h:s.h};F({...N,fixtures:[...N.fixtures??[],t]}),K({kind:'fixture',id:t.id})},xe=e=>{const s=(0,j.tidyArea)(N,e,Z),t=(0,j.movedCount)(N,s);t?(F(s),ne(`Tidied: ${t} table${1===t?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):ne('Already tidy: every table is on the grid and lined up.')},fe=e=>{const s=(0,b.autoArrange)(N.tables.filter(s=>s.areaId===e),$(N,e));F({...N,tables:[...N.tables.filter(s=>s.areaId!==e),...s]}),ne('Layout tidied. Undo if you preferred it before.')};(0,i.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const s=e.target?.tagName;if('INPUT'===s||'TEXTAREA'===s)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==H||!_)return;const t=e.altKey?1:Y?Z:5,a={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowUp:[0,-t],ArrowDown:[0,t]}[e.key];a&&(e.preventDefault(),je(_.kind,_.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===_.kind?pe(_.id):(F({...N,fixtures:(N.fixtures??[]).filter(e=>e.id!==_.id)}),K(null))),'r'===e.key.toLowerCase()&&ye(_.kind,_.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const je=(e,s,t,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(b.PLAN_W-e.w,l?e.x+t:t)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});F('table'===e?{...N,tables:N.tables.map(e=>e.id===s?{...e,...o(e)}:e)}:{...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?{...e,...o(e)}:e)})},ye=(e,s)=>{F('table'===e?{...N,tables:N.tables.map(e=>e.id===s?(0,b.rotate90)(e):e)}:{...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?(0,b.rotate90)(e):e)})},we='display'===e.mode;return(0,I.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[we?(0,I.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,I.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,I.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,I.jsx)(h.default,{style:{backgroundColor:(0,s.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,I.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,I.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,I.jsxs)(h.default,{style:{marginRight:6},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,I.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,I.jsx)(x.Row,{gap:6,children:k.map(e=>{const s=e.id===H;return(0,I.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{O(e.id),K(null),V(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:s?p.colours.gold:p.colours.border,backgroundColor:s?p.colours.goldTint:'transparent'},children:[(0,I.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:s?p.colours.gold:p.colours.surface2},children:(0,I.jsx)(x.T,{size:13,weight:"bold",colour:s?p.colours.onGold:p.colours.muted,children:e.n})}),(0,I.jsx)(x.T,{weight:"semibold",size:15,colour:s?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,I.jsx)(h.default,{style:{flex:1}}),(0,I.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,I.jsxs)(x.T,{weight:"bold",size:16,children:[ce.tables," tables \xb7 ",ce.seats," seats"]}),(0,I.jsxs)(x.Muted,{size:12,children:[N.areas.length," area",1===N.areas.length?'':'s',ue?' \xb7 unsaved changes':'']})]}),(0,I.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,I.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,I.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>ue?ee({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,I.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!ue,onPress:()=>ee({title:'Save changes to the table plan?',body:`${ce.tables} tables \xb7 ${ce.seats} seats across ${N.areas.length} area${1===N.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(R(N))}),style:{minHeight:44}}),ae?(0,I.jsx)(S.NamedPlanButtons,{onSaveAs:()=>te('save'),onList:()=>te('list')}):null]}),(0,I.jsxs)(h.default,{style:{flex:1},children:['areas'===H?(0,I.jsx)(M,{plan:N,set:F,confirm:ee,wide:de,next:()=>O('tables'),toast:ne}):null,'tables'===H?(0,I.jsx)(E,{plan:N,set:F,area:U,setArea:G,addTables:(e,s)=>{let t={...N,areas:[...N.areas],tables:[...N.tables]};const a=new Set(t.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const s of e){if(a.has(s.name)){l.push(s.name);continue}let e=U;if(s.area){const a=t.areas.find(e=>e.name.toLowerCase()===s.area.toLowerCase());a?e=a.id:(e=A(t,s.area),t.areas.push({id:e,name:s.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(s.name,e,s.seats,P(t,e)),[d]=(0,b.placeNew)(t.tables.filter(s=>s.areaId===e),[i],(t.fixtures??[]).filter(s=>s.areaId===e));t.tables.push(d),a.add(s.name),n.add(e),o++}if(s)for(const e of n){const s=t.tables.filter(s=>s.areaId===e),a=(0,b.autoArrange)(s,$(t,e));t={...t,tables:[...t.tables.filter(s=>s.areaId!==e),...a]}}return o&&F(t),ne(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:pe,patch:ge,wide:de,next:()=>O('arrange'),back:()=>O('areas')}):null,'arrange'===H?(0,I.jsxs)(h.default,{style:{flex:1,flexDirection:de?'row':'column'},children:[(0,I.jsxs)(h.default,{style:{flex:1,padding:10,gap:8,minHeight:de?void 0:Math.min(420,.5*ie)},children:[(0,I.jsx)(L,{plan:N,area:U,onPick:e=>{G(e),K(null),V(null)}}),q?(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,I.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(N.tables.find(e=>e.id===q)?.name),"."]}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>V(null)})]}):null,(0,I.jsx)(f.DesignerCanvas,{plan:N,areaId:U,sel:_,onSelect:e=>{if(q&&'table'===e?.kind&&e.id!==q){const s=N.tables.find(e=>e.id===q),t=N.tables.find(s=>s.id===e.id),a=N.joins.find(e=>e.tables.includes(s.name)),l=a?N.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,t.name])].sort((e,s)=>(0,b.numOf)(e)-(0,b.numOf)(s))}:e).filter(e=>e===a||!e.tables.includes(t.name)):[...N.joins.filter(e=>!e.tables.includes(t.name)),{id:(0,b.fid)('j'),tables:[s.name,t.name].sort((e,s)=>(0,b.numOf)(e)-(0,b.numOf)(s))}];return F({...N,joins:l}),V(null),ne(`Joined: book as ${l.find(e=>e.tables.includes(s.name)).tables.join('+')}`),void K(e)}V(null),K(e)},snapOn:Y,grid:Z,joinFrom:q,onMove:(e,s,t,a)=>je(e,s,t,a),onResize:(e,s,t,a)=>{if('table'===e){const e=N.tables.find(e=>e.id===s);if('round'===e.shape){const l=Math.max(t,a);ge(s,{w:l,h:l,x:e.x,y:e.y})}else ge(s,{w:t,h:a,shape:t===a?'square':'rect',x:e.x,y:e.y})}else F({...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?{...e,w:t,h:a}:e)})}}),(0,I.jsxs)(x.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",Y?`tables snap to a ${Z} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,I.jsx)(u.default,{style:{width:de?330:void 0,flexGrow:de?0:1,flexShrink:0,flexBasis:de?330:void 0,borderLeftWidth:de?1:0,borderTopWidth:de?0:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:he?(0,I.jsx)(W,{t:he,plan:N,patch:e=>ge(he.id,e),rotate:()=>ye('table',he.id),remove:()=>pe(he.id),duplicate:()=>{const e=z(N),s={...he,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[t]=(0,b.placeNew)(N.tables.filter(e=>e.areaId===he.areaId),[s],(N.fixtures??[]).filter(e=>e.areaId===he.areaId));F({...N,tables:[...N.tables,t]}),K({kind:'table',id:t.id}),ne(`${(0,o.tableNumbers)(e)} added`)},join:()=>V(he.id),split:e=>F({...N,joins:N.joins.filter(s=>s.id!==e)}),moveArea:e=>{const[s]=(0,b.placeNew)(N.tables.filter(s=>s.areaId===e),[{...he,areaId:e,sectionId:P(N,e)}],(N.fixtures??[]).filter(s=>s.areaId===e));F({...N,tables:N.tables.map(e=>e.id===he.id?s:e)}),G(e)},onDone:()=>K(null),toast:ne}):be?(0,I.jsxs)(h.default,{style:{gap:10},children:[(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===be.kind)?.label}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>K(null)})]}),(0,I.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,I.jsx)(x.Chip,{label:e.label,selected:be.kind===e.id,onPress:()=>F({...N,fixtures:(N.fixtures??[]).map(s=>s.id===be.id?{...s,kind:e.id}:s)})},e.id))}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>ye('fixture',be.id)}),(0,I.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{F({...N,fixtures:(N.fixtures??[]).filter(e=>e.id!==be.id)}),K(null)}})]}):(0,I.jsxs)(h.default,{style:{gap:12},children:[(0,I.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",N.areas.find(e=>e.id===U)?.name??'']}),(0,I.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,I.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=z(N),s=(0,b.newTable)(e,U,4,P(N,U)),[t]=(0,b.placeNew)(N.tables.filter(e=>e.areaId===U),[s],(N.fixtures??[]).filter(e=>e.areaId===U));F({...N,tables:[...N.tables,t]}),K({kind:'table',id:t.id})}}),(0,I.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,I.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,I.jsx)(x.Chip,{label:e.label,onPress:()=>me(e.id)})},e.id))}),(0,I.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>xe(U)}),(0,I.jsx)(x.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>fe(U)}),(0,I.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:e=>y.useFloor.getState().setSettings(X,{...y.DEFAULT_SETTINGS,...J??{},gridSnap:e})}),(0,I.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:N.areas.map(e=>{const s=(0,b.planCounts)(N,e.id);return(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsxs)(x.T,{size:14,children:[e.name,(0,C.areaMarks)(e)]}),(0,I.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})})]})})]}):null]}),Q?(0,I.jsx)(h.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,I.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,I.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:Q.title}),(0,I.jsx)(t.GoldClose,{onPress:()=>ee(null),label:"Close",testID:"designer-confirm-close"})]}),(0,I.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:Q.body}),(0,I.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ee(null)}),(0,I.jsx)(x.Button,{kind:Q.danger?'danger':'primary',label:Q.ok,testID:"confirm-ok",onPress:()=>{const e=Q;ee(null),e.run()}})]})]})}):null,'save'===se&&ae?(0,I.jsx)(S.SaveAsPlanDialog,{venueId:ae,plan:R(N),onClose:()=>te(null),onSaved:()=>te(null),toast:ne}):null,'list'===se&&ae?(0,I.jsx)(S.SavedPlansDialog,{venueId:ae,mode:e.mode,role:le,isCar:v.IS_CAR,onClose:()=>te(null),onLive:s=>{l({t:'reset',p:s}),e.onLiveChange?.(s),te(null)},toast:ne}):null]})};var s=r(_d[0]),t=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(r(_d[11])),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),C=r(_d[19]),S=r(_d[20]),T=r(_d[21]),v=r(_d[22]),I=r(_d[23]);const k=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(e,s){return'set'===s.t?{past:[...e.past,e.now].slice(-80),now:s.p,future:[]}:'undo'===s.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===s.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:s.p,future:[]}}function R(e){const s=new Set(e.tables.map(e=>e.name)),t=[...e.sections];for(const s of e.areas)t.some(e=>e.id===`s-${s.id}`)||e.tables.some(e=>e.areaId===s.id&&e.sectionId)||t.push({id:`s-${s.id}`,name:s.name,colour:'#CFA45F',server:''});return{...e,sections:t,fixtures:(e.fixtures??[]).filter(s=>e.areas.some(e=>e.id===s.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>s.has(e)))}}const z=e=>{let s=1;const t=new Set(e.tables.map(e=>e.name));for(;t.has(String(s));)s++;return String(s)},P=(e,s)=>e.tables.find(e=>e.areaId===s)?.sectionId??`s-${s}`,$=(e,s)=>(e.fixtures??[]).some(e=>e.areaId===s&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,s)=>{let t=(0,b.slug)(s),a=2;for(;e.areas.some(e=>e.id===t);)t=`${(0,b.slug)(s)}-${a++}`;return t};function B({label:e,glyph:s,onPress:a,disabled:l}){return(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===s?(0,I.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,I.jsx)(t.GoldX,{size:14}),(0,I.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,I.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[s,(0,I.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:s,onPick:t}){return(0,I.jsx)(u.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===s,o=(0,b.planCounts)(e,a.id);return(0,I.jsx)(d.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>t(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,I.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,C.areaMarks)(a)," ",(0,I.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function M({plan:e,set:s,confirm:t,wide:l,next:n,toast:c}){const[f,j]=(0,i.useState)(''),y=(t,a)=>s({...e,areas:e.areas.map(e=>e.id===t?{...e,...a}:e)}),w=(t,a)=>{const l=[...e.areas],o=t+a;o<0||o>=l.length||([l[t],l[o]]=[l[o],l[t]],s({...e,areas:l}))},C=()=>{const t=f.trim();if(!t)return;if(e.areas.some(e=>e.name.toLowerCase()===t.toLowerCase()))return void c(`There's already an area called ${t}`);const a=A(e,t);s({...e,areas:[...e.areas,{id:a,name:t,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:t,colour:'#CFA45F',server:''}]}),j('')};return(0,I.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,I.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,I.jsx)(x.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,I.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(F,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,I.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,I.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,I.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,I.jsx)(x.Row,{gap:8,children:(0,I.jsx)(F,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,I.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),N.map(t=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===t;return(0,I.jsx)(d.default,{testID:`area-colour-${a.id}-${t.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${t}`,onPress:()=>s({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:t}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:t}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:t,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},t)})]}),(()=>{const s=e.tables.filter(e=>e.areaId===a.id).sort((e,s)=>e.name.localeCompare(s.name,void 0,{numeric:!0})),t=a.best??[];return s.length?(0,I.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:s.map(e=>(0,I.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:t.includes(e.name),onPress:()=>y(a.id,{best:t.includes(e.name)?t.filter(s=>s!==e.name):[...t,e.name]})},e.id))}),(0,I.jsx)(x.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,I.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,I.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,I.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,I.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,I.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>t({title:`Remove ${a.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>s({...e,areas:e.areas.filter(e=>e.id!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,I.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,I.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,I.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,I.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,I.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,I.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>t({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{s(e.make()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,I.jsx)(x.T,{weight:"semibold",children:e.name}),(0,I.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const N=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function F({value:e,onCommit:s,label:t="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,I.jsx)(a.TextInput,{accessibilityLabel:t,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>s(o.trim()),onSubmitEditing:()=>s(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function E({plan:e,set:s,area:t,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[S,T]=(0,i.useState)(4),[v,k]=(0,i.useState)(''),[D,R]=(0,i.useState)(!0),P=(0,i.useMemo)(()=>(0,b.parseTableList)(v),[v]),$=e.tables.filter(e=>e.areaId===t).sort(b.byNumber),A=z(e),M=e.areas.find(e=>e.id===t),N=(e,s)=>{const t=(0,b.sizeFor)(s),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(e.id,{maxSeats:s,minSeats:Math.min(e.minSeats,s),...l?{}:'round'===e.shape?{w:t.h,h:t.h}:{w:t.w,h:t.h,shape:t.shape}})};return(0,I.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,I.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,I.jsx)(L,{plan:e,area:t,onPick:l}),(0,I.jsxs)(x.Muted,{children:[M?`${M.name}${M.dogs?' \xb7 dogs allowed':''}${M.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,I.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:$.length?$.map((e,s)=>(0,I.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:s?1:0,borderColor:p.colours.border},children:[(0,I.jsxs)(h.default,{style:{width:92},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,I.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,I.jsx)(h.default,{style:{flex:1},children:(0,I.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:s=>N(e,s)})}),(0,I.jsx)(x.Muted,{children:"seats"}),(0,I.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,I.jsx)(h.default,{style:{padding:16},children:(0,I.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,I.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,I.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,I.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",M?.name]}),(0,I.jsxs)(x.Row,{gap:10,children:[(0,I.jsxs)(h.default,{style:{width:120},children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,I.jsx)(a.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:A,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,I.jsxs)(h.default,{children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,I.jsx)(x.Stepper,{value:S,min:1,max:20,label:"seats",onChange:T})]})]}),(0,I.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||A)}`,testID:"add-table",onPress:()=>{n([{name:(w||A).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,I.jsx)(x.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,I.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:v,onChangeText:k,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),v.trim()?(0,I.jsxs)(x.T,{size:14,colour:P.items.length?p.colours.ok:p.colours.amber,children:["Found ",P.items.length," table",1===P.items.length?'':'s'," \xb7 ",P.items.reduce((e,s)=>e+s.seats,0)," seats",P.skipped.length?` \xb7 couldn't read: ${P.skipped.slice(0,2).join('; ')}`:'']}):null,(0,I.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:D,onChange:R}),(0,I.jsx)(x.Button,{label:P.items.length?`Add ${P.items.length} tables`:'Add tables',testID:"paste-add",disabled:!P.items.length,onPress:()=>{n(P.items,D)&&k('')}})]})]})]})}function W({t:e,plan:s,patch:t,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,i.useState)(e.name);(0,i.useEffect)(()=>S(e.name),[e.id,e.name]);const T=s.joins.find(s=>s.tables.includes(e.name)),v=()=>{const a=C.trim().toUpperCase();if(a&&a!==e.name)return s.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void S(e.name)):void t({name:a})};return(0,I.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,I.jsx)(l.TableNumberWarning,{plan:s}),(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,I.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:v,onSubmitEditing:v,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,I.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:s=>t({maxSeats:s,minSeats:Math.min(e.minSeats,s)})})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,I.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>t({minSeats:e})})]}),(0,I.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,I.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const s=Math.max(e.w,e.h);t({shape:'square',w:s,h:s})}}),(0,I.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const s=Math.max(e.w,e.h);t({shape:'round',w:s,h:s})}}),(0,I.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const s=(0,b.sizeFor)(Math.max(5,e.maxSeats));t({shape:'rect',w:e.h>e.w?e.w:s.w,h:e.h>e.w?s.w:s.h})}}),(0,I.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const s=(0,b.sizeFor)(e.maxSeats);t({shape:s.shape,w:s.w,h:s.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),T?(0,I.jsxs)(h.default,{style:{gap:6},children:[(0,I.jsxs)(x.T,{size:14,children:["Joined with ",T.tables.filter(s=>s!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,I.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(T.tables.join('+'))})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(T.id),style:{flex:1}})]})]}):(0,I.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,I.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>t({online:e})}),s.areas.length>1?(0,I.jsxs)(h.default,{style:{gap:6},children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:s.areas.map(s=>(0,I.jsx)(x.Chip,{label:s.name,selected:s.id===e.areaId,onPress:()=>s.id!==e.areaId&&j(s.id)},s.id))})]}):null,(0,I.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},956,[876,835,874,935,812,943,31,123,264,152,288,128,1070,825,818,1527,1528,829,863,955,1530,824,807,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"saverConnected",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"SAVER_BUCKET",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useSaverCfg",{enumerable:!0,get:function(){return S}}),_e.loadSaver=v,_e.saveSaver=async function(e,t){const n=f();if(!n)return void S.getState().set(e);const{error:o}=await l().from('display_screensaver').upsert({venue_id:n,...(0,u.saverToRow)(e),updated_at:(new Date).toISOString(),updated_by:t.slice(0,80)});if(o)throw o;S.getState().set(e)},_e.watchSaver=y,_e.uploadSaverPhoto=async function(e,t){const n=f();if(!n)throw new Error('Photos need the venue connection.');if(t>=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},957,[31,995,872,824,987]); +__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})]})]})}},958,[991,31,128,823,829,960,825,818,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.guardBookingChange=w,_e.saveTablesReported=async function(e,t,n,o,s,u){if(!w(u,{b:t,tables:n}))return!1;const v=n.length?(0,h.notSavedWhat)({...t,name:o,table:n.join('+')}):`Taking the table off ${o}`;u(`Saving ${v}\u2026`);try{await(0,b.saveBookingTables)(e,t,n)}catch(e){const t=`${v} did not save: ${String(e?.message??e).slice(0,120)}`;return u(t),(0,l.announce)(t),!1}const y=await(0,c.waitForBookingSave)(t.id);if('saved'===y.state||'local'===y.state){const e=(0,r.savedWords)(o,t.partySize,n,s);return u(e),(0,l.announce)(e),!0}const k='waiting'===y.state?`${v}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${v} did not save. ${f("why"in y?y.why:"the shared system did not take it")}. Tap the red banner to try again.`;return u(k),(0,l.announce)(k),!1},_e.reportBookingSave=async function(e,t,n,o){const s=await(0,c.waitForBookingSave)(e);if('saved'===s.state||'local'===s.state)return o(t),(0,l.announce)(t),!0;const r='waiting'===s.state?`${n}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${n} did not save. ${f('why'in s?s.why:'the shared system did not take it')}. Tap the red banner to try again.`;return o(r),(0,l.announce)(r),!1},_e.BookingSaveBanner=function({rid:e,testID:r="booking-save-banner",margin:c}){const b=(0,h.useBookingSaves)(e=>e.notSaved),w=(0,s.useBookings)(e).filter(e=>b[e.id]).map(e=>void 0!==b[e.id].want?{...e,table:b[e.id].want||void 0}:e),{msg:S,retry:$}=k(),m=(0,t.useRef)(''),p=w.map(e=>(0,h.notSavedLine)(e)),B=w.map(e=>e.id).sort().join(',');if((0,t.useEffect)(()=>{B&&B!==m.current&&(0,l.announce)(1===w.length?p[0]:`${w.length} booking changes did not save. Tap the red banner to try again.`),m.current=B},[B]),!w.length)return null;const j=1===w.length?p[0]:`${w.length} booking changes did not save. Tap to try again.`;return(0,y.jsx)(n.default,{testID:r,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${j}${w.length>1?` ${w.map(e=>(0,h.notSavedWhat)(e)).join('. ')}.`:''} ${f(b[w[0].id].why)}.`,onPress:$,style:{...c??{},alignSelf:'stretch',gap:4,padding:12,borderRadius:12,borderWidth:2,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:(0,y.jsxs)(o.default,{accessibilityRole:"alert",style:{alignItems:'center',gap:4},children:[(0,y.jsx)(v.T,{testID:`${r}-title`,size:17,weight:"semibold",center:!0,colour:"#FFD2CC",children:j}),w.length>1?w.slice(0,6).map(e=>(0,y.jsx)(v.T,{testID:`${r}-line`,size:15,center:!0,colour:"#FFD2CC",children:(0,h.notSavedWhat)(e)},e.id)):null,(0,y.jsx)(v.T,{testID:`${r}-why`,size:14,center:!0,colour:"#FFB3AA",children:w.length>1?`${f(b[w[0].id].why)}${w.length>6?` \xb7 and ${w.length-6} more`:''}`:f(b[w[0].id].why)}),S?(0,y.jsx)(v.T,{testID:`${r}-msg`,size:14,center:!0,colour:u.colours.goldLight,children:S}):null]})})},_e.BookingNotSavedLine=function({b:e}){const t=(0,h.useBookingSaves)(t=>t.notSaved[e.id]),{msg:o,retry:s}=k();if(!t)return null;void 0!==t.want&&(e={...e,table:t.want||void 0});return(0,y.jsxs)(n.default,{testID:`booking-not-saved-${e.id}`,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${(0,h.notSavedLine)(e)} ${f(t.why)}.`,onPress:s,style:{alignSelf:'stretch',padding:8,borderRadius:10,borderWidth:1.5,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:[(0,y.jsx)(v.T,{size:15,weight:"semibold",center:!0,colour:"#FFD2CC",children:(0,h.notSavedLine)(e)}),o?(0,y.jsx)(v.T,{size:13,center:!0,colour:u.colours.goldLight,children:o}):null]})};var t=_r(d[0]),n=e(_r(d[1])),o=e(_r(d[2])),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),b=_r(d[9]),v=_r(d[10]),y=_r(d[11]);const f=e=>e.charAt(0).toUpperCase()+e.slice(1);function w(e,t){const n=(0,c.bookingSaveBlocker)();if(!n)return!0;t&&h.useBookingSaves.getState().mark({id:t.b.id,table:t.b.walkIn?'walk_ins':'bookings',why:n,...t.tables?{want:t.tables.join('+')}:{}});const o=`${t?(0,h.notSavedWhat)({...t.b,...t.tables?{table:t.tables.join('+')||void 0}:{}}):'This change'} did not save: ${n}.`;return e?.(o),(0,l.announce)(o),!1}function k(){const[e,n]=(0,t.useState)('');return{msg:e,retry:async()=>{n('Saving\u2026'),(0,l.announce)('Saving');const e=await(0,c.saveBookingsNow)(!0),t=e?`Not saved: ${e}.`:h.useBookingSaves.getState().count()?'Sent again. The banner clears when the shared system takes it.':'Nothing is left waiting. Check the plan and make the change again if it is not there.';n(t),(0,l.announce)(t)}}}},959,[31,264,128,823,960,1421,824,1285,825,990,818,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=u,e.requestedFreeTable=function(t,n,a,s,l=90){const o={id:n.id??'new',status:'confirmed',...n};for(const n of t)if(a.includes(n)&&!u(o,[n],s,l).length)return n;return null},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=c,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${c(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${c(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${c(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))}function c(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},960,[812,830]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},961,[812,1041,31,123,264,128,989,823,825,818,1478,943,963,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"unconfirmedTakeaways",{enumerable:!0,get:function(){return x}}),_e.useBuildingChime=function(e,s=4e3,i=6e4){const o=(0,a.useAlerts)(e=>e.prefs.muted);(0,t.useEffect)(()=>{if(!e||o)return;const t=Date.now(),l=()=>(0,c.lowChime)(Math.min(1,(Date.now()-t)/i));l();const n=setInterval(l,s);return()=>clearInterval(n)},[e,o,s,i])},_e.TakeawayFacts=b,_e.TakeawayTakeover=function({rid:e,me:i}){const o=(0,l.useOrders)(e),n=x(o),a=n[0],c=s.default.useRef(i);return c.current=i,(0,t.useEffect)(()=>{a?(0,f.notify)({id:'takeaway-takeover',tone:a.allergies.length?'urgent':'warn',modal:!0,big:!0,testID:'takeaway-takeover',icon:'\ud83e\udd61',kicker:'NEW TAKEAWAY ORDER',title:`Order ${a.ref}: read it, then tap Confirm`,body:"This stays on screen until someone confirms."+(n.length>1?` ${n.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,j.jsx)(y,{rid:e,id:a.id,me:c.current})}):(0,f.dismissNotice)('takeaway-takeover')},[a?.id,n.length,e]),(0,t.useEffect)(()=>()=>(0,f.dismissNotice)('takeaway-takeover'),[]),null};var t=r(d[0]),s=e(t),i=e(r(d[1])),o=e(r(d[2])),l=r(d[3]),n=r(d[4]),a=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),j=r(d[10]);const w=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'As soon as possible',x=e=>e.filter(e=>'takeaway'===e.type&&'new'===e.status&&!e.accepted).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function b({o:e,big:t,personal:s=!0}){const o=t?1:.8;return(0,j.jsxs)(i.default,{style:{gap:10},children:[(0,j.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:18},children:[(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Collection"}),(0,j.jsx)(h.T,{size:34*o,weight:"bold",colour:u.colours.goldLight,children:w(e.slotTime)})]}),s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Customer"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.customerName})]}):null,s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Phone"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.phone??'Not given'})]}):null,(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Order"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.ref})]})]}),e.allergies.length?(0,j.jsxs)(i.default,{testID:"takeover-allergy",style:{backgroundColor:'#7A140D',borderRadius:12,padding:12,borderWidth:2,borderColor:'#FFB3AB'},children:[(0,j.jsxs)(h.T,{size:22*o,weight:"bold",colour:"#FFFFFF",children:["\u26a0 ALLERGY: ",e.allergies.map(e=>`${(0,n.allergenLabel)(e.allergen)} (${(0,n.severityLabel)(e.severity)})`).join(', ')]}),e.lines.filter(e=>e.overridden).map((e,t)=>(0,j.jsxs)(h.T,{size:16*o,weight:"semibold",colour:"#FFE3DF",children:["Customer overrode a warning: ",e.name," contains ",e.contains.map(n.allergenLabel).join(', ')]},t))]}):(0,j.jsx)(h.T,{size:16*o,colour:u.colours.ok,children:"No allergies declared"}),(0,j.jsx)(i.default,{style:{gap:4},children:e.lines.map((e,t)=>(0,j.jsxs)(h.T,{size:22*o,weight:"semibold",children:[e.qty," \xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 \u201c${e.notes}\u201d`:'']},t))})]})}function y({rid:e,id:t,me:s}){const n=(0,l.useOrders)(e).find(e=>e.id===t),{width:a}=(0,o.default)();return n?(0,j.jsxs)(i.default,{style:{gap:12},children:[(0,j.jsx)(b,{o:n,big:a>=700}),(0,j.jsx)(h.Button,{label:`Confirm order ${n.ref}`,testID:"takeover-confirm",onPress:()=>{l.repo.orders.accept(n.id,s)},style:{minHeight:72,borderRadius:14}})]}):null}},962,[31,128,288,823,819,963,946,825,818,943,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},963,[1479,1480,1482,1481,1483,946,1484]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'Closed for weather':'For weather',accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),I=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{testID:"block-today",title:"Today",sub:T?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!T,onPress:()=>m('today')}),(0,f.jsx)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},964,[812,31,1460,973,264,128,828,829,833,822,825,818,1084,1535,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:w,now:b,turnBase:v,blocks:M=[],height:T=150,forecastNote:$,emptyText:D,past:A,closed:k,compact:C=!1,dense:I=!1,bare:z=!1,fill:F=!1,fit:L=!1,tight:S=!1,live:_=!1}){const[H,O]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),P=j.getTime()-18e5,E=w.getTime()+36e5,R=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(P),new Date(E),v),[e,P,E,v]),X=60*j.getHours()+j.getMinutes(),U=60*w.getHours()+w.getMinutes(),W=(0,t.useMemo)(()=>(0,f.chartBands)(M,X,U),[M,X,U]),G=new Date(j);G.setHours(0,0,0,0);const V=e=>G.getTime()+6e4*e,Y=Math.max(8,...R.map(e=>e.covers)),Z=R.reduce((e,t)=>!t.covers||(0,f.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),W)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),q=L&&N?Math.max(24,Math.floor(N)):Math.max(48,T-m.AXIS_BAND),J=I?8:16,K=Math.max(10,H-28-8),Q=Math.max(10,q-J-6),ee=e=>28+(e-P)/(E-P)*K,te=e=>J+Q-e/(1.15*Y)*Q,se=[];for(let e=new Date(P);e.getTime()<=E;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=P&&t.getTime()<=E&&se.push(t.getTime())}const ie=_?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ne=Math.min(E,Math.max(P,b.getTime())),oe=k?null:_?{t:ne,covers:ie,text:(0,m.seatedNowText)(ie)}:Z,le=H?(0,m.layoutChart)({width:H,height:q,t0:P,t1:E,hours:se,busiest:oe}):{hours:[],busiest:null},re=R.map((e,t)=>`${t?'L':'M'}${ee(e.t).toFixed(1)},${te(e.covers).toFixed(1)}`).join(' '),ae=F&&re&&R.length>1?`${re} L${ee(R[R.length-1].t).toFixed(1)},${te(0).toFixed(1)} L${ee(R[0].t).toFixed(1)},${te(0).toFixed(1)} Z`:'',de=(0,i.coversFour)(e,e[0]?.date??''),he=`Total ${de.total} ${1===de.total?'Cover':'Covers'}`,ue=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,ce=le.busiest?.text??(k?'':_?(0,m.seatedNowText)(ie):Z?(0,m.busiestText)(Z.t,Z.covers):''),xe=W.map(e=>e.spoken).join('. '),ge=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(w)}.${ce?` ${ce}.`:''}${xe?` ${xe}.`:''}`,me=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(n.default,{testID:"day-graph",style:[h.look.panel,L?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:z?4:I?2:10,paddingBottom:z?2:6,backgroundColor:c.colours.bg}],children:[z?null:C?(0,y.jsxs)(n.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(d.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(d.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:he})]}):(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(d.T,{size:I?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(d.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:he})]}),z||S?null:k?$?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:$}):null:(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),$?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:$}):(0,y.jsx)(n.default,{style:{flex:1}}),(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(w)]})]}),(0,y.jsx)(n.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ge,onLayout:e=>{O(e.nativeEvent.layout.width),L&&B(e.nativeEvent.layout.height)},style:L?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,T-m.AXIS_BAND),minHeight:24,overflow:'hidden'}:{height:q,minHeight:q},children:H?(0,y.jsxs)(l.default,{width:H,height:q,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${me}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${me}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),W.map((e,t)=>(0,y.jsx)(o.Rect,{x:ee(V(e.fromMin)),y:J,width:Math.max(3,ee(V(e.toMin))-ee(V(e.fromMin))),height:Q,fill:`url(#${me}-${e.strength})`},`${e.fromMin}-${t}`)),ae?(0,y.jsx)(o.Path,{d:ae,fill:"#3A2F1E",stroke:"none"}):null,re?(0,y.jsx)(o.Path,{d:re,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,k?null:[j,w].map((e,t)=>(0,y.jsx)(o.Line,{x1:ee(e.getTime()),x2:ee(e.getTime()),y1:J,y2:J+Q,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:le.busiest.x+le.busiest.w/2,y:le.busiest.y+le.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:le.busiest.text}):null,ue?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+K/2,y:J+Q/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null}),(0,y.jsxs)(n.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(d.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),le.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,H)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,H-t),s));return(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':it.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},966,[]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_BACK",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"DAY_AHEAD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"DAY_IDLE_MS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"dayOffset",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"shiftDay",{enumerable:!0,get:function(){return y}}),_e.dayWord=f,Object.defineProperty(_e,"dayLong",{enumerable:!0,get:function(){return p}}),_e.bookingsForDay=function(e,t,o){return e.filter(e=>e.date===t&&(0,n.ACTIVE)(e))},_e.dayCovers=function(e,t,o){return(0,n.coversFour)(e,t)},_e.DaySwitch=function({day:e,today:n,onDay:b,back:x=c,ahead:j=u,idPrefix:$="display-day",stacked:D=!1,header:w=!1,onPickDate:C}){const P=h(e,n),k=t=>{const o=y(e,t);b(o===n?null:o)},L=y(e,-1),I=y(e,1),v=0!==P,T=(e,o,n,s,c)=>(0,d.jsx)(t.default,{testID:c,accessibilityRole:"button",accessibilityLabel:o,accessibilityState:{disabled:s},disabled:s,onPress:n,style:({pressed:e})=>({minHeight:44,minWidth:w?44:D?140:92,flex:D?1:void 0,paddingHorizontal:w?8:D?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,opacity:s?.35:1,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:(0,d.jsx)(i.T,{center:D,size:D?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:D?void 0:1,children:e})}),O=f(e,n),W=C?(0,d.jsx)(t.default,{testID:`${$}-cal`,accessibilityRole:"button",accessibilityLabel:"Pick a date from the calendar",onPress:C,style:({pressed:e})=>({minHeight:44,minWidth:w?44:D?140:92,flex:D?1:void 0,paddingHorizontal:w?8:D?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:w?(0,d.jsxs)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{width:18,height:16,borderWidth:1.5,borderColor:l.colours.goldLight,borderRadius:3,overflow:'hidden'},children:[(0,d.jsx)(o.default,{style:{height:4,backgroundColor:l.colours.goldLight}}),(0,d.jsx)(o.default,{style:{flex:1,flexDirection:'row',flexWrap:'wrap',padding:1.5,gap:1.5,justifyContent:'center',alignContent:'center'},children:[0,1,2,3].map(e=>(0,d.jsx)(o.default,{style:{width:3,height:3,backgroundColor:l.colours.goldLight}},e))})]}):(0,d.jsx)(i.T,{center:D,size:D?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:1,children:"Calendar"})}):null;return D?(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1,borderColor:v?l.colours.gold:l.colours.hairline,backgroundColor:v?l.colours.goldTint:l.colours.surface},children:[(0,d.jsxs)(o.default,{testID:`${$}-label`,accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${O}, ${p(e)}`,style:{gap:2,alignItems:'center'},children:[(0,d.jsx)(i.T,{center:!0,size:20,weight:"semibold",colour:l.colours.goldLight,children:O}),(0,d.jsx)(i.T,{center:!0,size:16,children:p(e)})]}),(0,d.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),T('Today','Back to today',()=>b(null),!1,'back-to-today'),W,T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]})]}):w?(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,flexShrink:1,minWidth:0},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),(0,d.jsx)(t.default,{testID:`${$}-label`,accessibilityRole:v||C?'button':'text',disabled:!v&&!C,onPress:()=>v?b(null):C?.(),accessibilityLabel:v?`Showing ${O===(0,s.niceDate)((0,s.parseYmd)(e))?'':`${O}, `}${p(e)}. Back to today`:C?`Showing today, ${p(e)}. Open the calendar to pick a date`:`Showing today, ${p(e)}`,style:({pressed:e})=>({minWidth:72,maxWidth:220,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:8,borderWidth:v?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:v?l.colours.goldTint:'transparent'}),children:(0,d.jsx)(i.T,{size:14,weight:"semibold",colour:v?l.colours.gold:l.colours.text,numberOfLines:1,children:v&&O!==(0,s.niceDate)((0,s.parseYmd)(e))?`${O} \xb7 ${(0,s.niceDate)((0,s.parseYmd)(e))}`:O})}),W,T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]}):(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:8},children:[(0,d.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),(0,d.jsxs)(t.default,{testID:`${$}-label`,accessibilityRole:v||C?'button':'text',disabled:!v&&!C,onPress:()=>v?b(null):C?.(),accessibilityLabel:v?`Showing ${O===(0,s.niceDate)((0,s.parseYmd)(e))?'':`${O}, `}${p(e)}. Back to today`:C?`Showing today, ${p(e)}. Open the calendar to pick a date`:`Showing today, ${p(e)}`,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:6,borderWidth:v?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:v?l.colours.goldTint:'transparent'}),children:[(0,d.jsx)(i.T,{size:15,weight:"semibold",colour:v?l.colours.gold:l.colours.text,numberOfLines:1,children:v&&O!==(0,s.niceDate)((0,s.parseYmd)(e))?`${O} \xb7 ${(0,s.niceDate)((0,s.parseYmd)(e))}`:O}),v?(0,d.jsx)(i.T,{size:11,colour:l.colours.muted,numberOfLines:1,children:"Tap for today"}):null]}),T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]}),W?(0,d.jsx)(o.default,{style:{alignItems:'center'},children:W}):null]})},r(_d[0]);var t=e(r(_d[1])),o=e(r(_d[2])),i=r(_d[3]),n=r(_d[4]),s=r(_d[5]),l=r(_d[6]),d=r(_d[7]);const c=365,u=365,b=12e4,h=(e,t)=>Math.round(((0,s.parseYmd)(e).getTime()-(0,s.parseYmd)(t).getTime())/864e5),y=(e,t)=>(0,s.ymd)((0,s.addMins)((0,s.parseYmd)(e),1440*t+120));function f(e,t){const o=h(e,t);return 0===o?'Today':-1===o?'Yesterday':1===o?'Tomorrow':(0,s.niceDate)((0,s.parseYmd)(e))}const p=e=>(0,s.parseYmd)(e).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},967,[31,264,128,818,832,822,825,25]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CalendarGlyph=function({colour:e=o.colours.goldLight,size:t=18}){const s=Math.max(2,Math.round(.16*t));return(0,u.jsxs)(l.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{width:t,height:t-2,borderWidth:1.5,borderColor:e,borderRadius:3,overflow:'hidden',backgroundColor:'transparent'},children:[(0,u.jsx)(l.default,{style:{height:Math.max(3,Math.round(.22*t)),backgroundColor:e}}),(0,u.jsx)(l.default,{style:{flex:1,flexDirection:'row',flexWrap:'wrap',padding:2,gap:2,justifyContent:'center',alignContent:'center'},children:Array.from({length:4},(t,i)=>(0,u.jsx)(l.default,{style:{width:s,height:s,borderRadius:.5,backgroundColor:e,opacity:.9}},i))})]})},_e.DisplayCalendar=function({visible:e,today:b,day:f,bookings:x,restaurant:p,now:j,onDay:D,onClose:w,back:C=d.DAY_BACK,ahead:I=d.DAY_AHEAD,idPrefix:T="display-cal",showBusy:_=!0,sheetTestID:S}){const[$,v]=(0,t.useState)(f.slice(0,7)),[B,k]=(0,t.useState)(0);(0,t.useEffect)(()=>{e&&v(f.slice(0,7))},[e,f]);const R=(0,n.venueBusy)(p,x,j??new Date).busy,E=(0,c.monthCells)($),P=(0,c.shiftMonth)($,-1),L=(0,c.shiftMonth)($,1),O=(0,c.monthInRange)(P,b,C,I),Y=(0,c.monthInRange)(L,b,C,I),M=B/7,N=e=>M>=46?e.slice(0,3):e.slice(0,2),A=e=>{D(e===b?null:e),w()},U=(0,c.quickJumps)(b);return(0,u.jsx)(i.Sheet,{visible:e,onClose:w,title:"Pick a date",centerTitle:!0,maxWidth:560,testID:S??T,footer:(0,u.jsxs)(l.default,{style:{gap:10,alignItems:'center'},children:[(0,u.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:U.map(e=>{const t=(0,c.inDisplayRange)(e.date,b,C,I);return(0,u.jsx)(i.Chip,{label:e.label,selected:f===e.date,disabled:!t,testID:`${T}-jump-${e.id}`,accessibilityLabel:`${e.label}, ${(0,c.longDay)(e.date)}${t?'':', not available'}`,onPress:()=>{t&&(v(e.date.slice(0,7)),A(e.date))}},e.id)})}),(0,u.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:(0,u.jsx)(i.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close calendar",testID:`${T}-close`,onPress:w})})]}),children:(0,u.jsxs)(l.default,{style:{gap:10,alignItems:'stretch'},children:[(0,u.jsx)(i.T,{size:22,weight:"bold",colour:o.colours.goldLight,center:!0,accessibilityRole:"header",testID:`${T}-month`,children:(0,c.monthName)($)}),(0,u.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Previous month",accessibilityLabel:O?`Previous month, ${(0,c.monthName)(P)}`:`Previous month, ${(0,c.monthName)(P)}, not available`,disabled:!O,testID:`${T}-prev`,onPress:()=>v(P)}),(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Next month",accessibilityLabel:Y?`Next month, ${(0,c.monthName)(L)}`:`Next month, ${(0,c.monthName)(L)}, not available`,disabled:!Y,testID:`${T}-next`,onPress:()=>v(L)})]}),(0,u.jsxs)(l.default,{onLayout:e=>k(e.nativeEvent.layout.width),style:{width:'100%'},children:[(0,u.jsx)(l.default,{style:{flexDirection:'row'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:h.map(e=>(0,u.jsx)(l.default,{style:{width:'14.2857%',alignItems:'center'},children:(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,center:!0,children:N(e)})},e))}),(0,u.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},testID:`${T}-grid`,children:E.map((e,t)=>{if(!e)return(0,u.jsx)(l.default,{style:{width:'14.2857%',height:56}},`blank-${t}`);const n=(0,c.inDisplayRange)(e,b,C,I),d=e===f,h=(0,c.dayIsClosed)(p,e),j=_?(0,c.dayCoversTotal)(x,e):0,D=_?(0,c.dayBusyTier)(j,R,(0,c.serviceHoursOf)(p,e)):'none';return(0,u.jsxs)(s.default,{testID:`${T}-${e}`,accessibilityRole:"button",accessibilityLabel:(0,c.calendarDayLabel)(e,b,f,j,D,h,_),accessibilityState:{selected:d,disabled:!n},disabled:!n,onPress:()=>A(e),style:{width:'14.2857%',height:56,minHeight:56,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:d||e===b?1.5:0,borderColor:o.colours.gold,backgroundColor:d?o.colours.goldTint:'transparent',opacity:n?h?.45:1:.3},children:[(0,u.jsx)(i.T,{size:17,weight:d||e===b?'bold':'regular',colour:d?o.colours.goldLight:h?o.colours.muted:o.colours.text,center:!0,children:Number(e.slice(8))}),_?(0,u.jsx)(y,{tier:D}):null]},e)})})]}),(0,u.jsx)(l.default,{testID:`${T}-key`,children:(0,u.jsxs)(i.Row,{wrap:!0,gap:12,style:{justifyContent:'center',paddingTop:2},children:[_?[['silver','Quiet'],['bronze','Steady'],['gold','Busy']].map(([e,t])=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,u.jsx)(l.default,{style:{width:c.BUSY_DOT_SIZE[e],height:c.BUSY_DOT_SIZE[e],borderRadius:c.BUSY_DOT_SIZE[e]/2,backgroundColor:c.BUSY_DOT[e]}}),(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,children:t})]},e)):null,(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,children:"Closed days are faded"})]})})]})})};var t=r(_d[0]),s=e(r(_d[1])),l=e(r(_d[2])),i=r(_d[3]),n=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]);const h=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];function y({tier:e}){const t=c.BUSY_DOT_SIZE[e];return'none'===e?(0,u.jsx)(l.default,{style:{width:c.BUSY_DOT_SIZE.gold,height:c.BUSY_DOT_SIZE.gold,marginTop:2}}):(0,u.jsx)(l.default,{testID:`busy-dot-${e}`,style:{width:t,height:t,borderRadius:t/2,marginTop:2,backgroundColor:c.BUSY_DOT[e]}})}},968,[31,264,128,818,933,825,967,1410,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))}},969,[]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},970,[812,988]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},971,[31,264,128,818,970,825,949,25]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){if(t&&t.length&&o)return t.find(t=>t.staffId===n&&'approved'===t.status&&t.from<=o&&o<=t.to)}Object.defineProperty(e,'__esModule',{value:!0}),e.leaveCovering=t,Object.defineProperty(e,"coveredByLeave",{enumerable:!0,get:function(){return n}}),e.workingShifts=function(t,o){return o&&o.length?t.filter(t=>!n(o,t)):t},e.leaveLabel=function(t){return/sick|ill/i.test(t?.reason??'')?'Off sick':'On holiday'},e.leaveNote=function(t){return['Approved time off',t.reason&&'Holiday'!==t.reason?t.reason:'',t.decidedBy?`approved by ${t.decidedBy.replace(' (example)','')}`:''].filter(Boolean).join(' \xb7 ')};const n=(n,o)=>!!t(n,o.staffId,o.date)},972,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},973,[5,1342,1193,876,123,1345]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d}){const m=(0,h.useShellfish)(e,t,s),b=$(e),[f,p]=(0,o.useState)(!1),k=T(e,m.items.find(e=>e.supplierId)?.supplierId),x=(0,r.useLiveState)();if('ready'!==x)return(0,j.jsx)(r.LiveWait,{state:x,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!m.items.length)return null;const v=m.items.filter(e=>m.isLow(e.key)),w=m.items.length<=3?m.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:v.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,m.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",w]}),(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:m.items.map(t=>{const s=m.counts[t.key]??0,o=m.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),b[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,b[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-b[t.key]))]}):null]},t.key)})})]}),!n&&v.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",v.map(t=>`${(0,u.fmtStockCount)(e,t,m.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:k?`Order from ${k} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||v.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:k?`${k} order sheet \u203a`:'Order sheets \u203a'})}),f?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>p(!1),onOrder:l?()=>{p(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},974,[1086,807,31,1388,973,197,264,128,1456,818,1089,1087,1088,825,823,832,822,1421,824,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyChain=j,_e.BookingAllergyChain=function({b:l,me:t,readOnly:k}){const p=(0,i.useOrders)(l.restaurantId),S=(0,o.useStore)(e=>e.ackBookingAllergy);if(!l.allergies.length)return null;const A=p.find(e=>e.allergies.length&&!['cancelled','closed'].includes(e.status)&&(e.bookingId===l.id||!e.bookingId&&(0,c.linkedBooking)(e,[l])?.id===l.id));if(A)return(0,h.jsx)(j,{o:A,me:t,readOnly:k,compact:!0});const I={booked:l.allergyAck,ordered:void 0,kitchen:void 0,pass:void 0,table:void 0};return(0,h.jsxs)(s.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:l.allergyAck?u.colours.border:u.colours.red,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(n.T,{size:13,weight:"semibold",colour:"#FFD9D4",children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(n.Badge,{kind:l.allergyAck?'amber':'red',label:(l.allergyAck?1:0)+" of 5"})]}),(0,h.jsx)(y,{chain:I,next:l.allergyAck?null:'booked',testID:`allergy-steps-${l.ref}`}),l.allergyAck?(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:l.allergyAck.by,size:20,ring:!1}),(0,h.jsxs)(n.Muted,{style:{flex:1},children:["1. Booked: ",b(l.allergyAck.by)," at ",x(l.allergyAck.at),". Steps 2 to 5 are signed on the table's order."]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(n.T,{size:13,children:"Next: 1. Booked. Allergy recorded (who took it)."}),k?null:(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(n.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off Booked on ${l.ref}`,disabled:!t.trim(),onPress:()=>S(l.id,t)}),(0,h.jsxs)(n.Muted,{children:["as ",b(t)]})]})]})]})};var e=r(d[0]);r(d[1]);var l,t=r(d[2]),s=(l=t)&&l.__esModule?l:{default:l},n=r(d[3]),i=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]),h=r(d[9]);const x=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),b=e=>e.replace(' (example)','');function y({chain:e,next:l,testID:t}){return(0,h.jsx)(s.default,{testID:t,accessibilityLabel:`Allergen sign-off ${c.CHAIN_STEPS.filter(l=>e[l.id]).length} of 5`,style:{flexDirection:'row',alignItems:'flex-start'},children:c.CHAIN_STEPS.map((t,i)=>{const o=!!e[t.id],f=l===t.id,y=o?u.colours.ok:f?u.colours.gold:u.colours.border,j=0===i?'flex-start':i===c.CHAIN_STEPS.length-1?'flex-end':'center',k=(0,h.jsxs)(s.default,{style:{width:'200%',alignSelf:j,alignItems:j},children:[(0,h.jsx)(n.T,{size:11,weight:f?'semibold':'regular',colour:o?u.colours.text:f?u.colours.gold:u.colours.muted,style:{textAlign:0===i?'left':i===c.CHAIN_STEPS.length-1?'right':'center'},children:t.label}),e[t.id]?(0,h.jsxs)(n.T,{size:10,colour:u.colours.muted,numberOfLines:1,style:{textAlign:0===i?'left':i===c.CHAIN_STEPS.length-1?'right':'center'},children:[b(e[t.id].by).split(' ')[0]," ",x(e[t.id].at)]}):null]}),p=i%2==1;return(0,h.jsxs)(s.default,{style:{flex:1,alignItems:'center'},children:[(0,h.jsx)(s.default,{style:{minHeight:30,justifyContent:'flex-end',alignSelf:'stretch',alignItems:j},children:p?k:null}),(0,h.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',width:'100%',marginVertical:2},children:[(0,h.jsx)(s.default,{style:{flex:1,height:2,backgroundColor:i?o||f?y:u.colours.border:'transparent'}}),(0,h.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,borderWidth:2,borderColor:y,backgroundColor:o?u.colours.ok:'transparent',alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(n.T,{size:12,weight:"bold",colour:o?'#0B0B0B':f?u.colours.gold:u.colours.muted,children:o?'\u2713':String(t.n)})}),(0,h.jsx)(s.default,{style:{flex:1,height:2,backgroundColor:i<4?o?u.colours.ok:u.colours.border:'transparent'}})]}),(0,h.jsx)(s.default,{style:{minHeight:30,alignSelf:'stretch',alignItems:j},children:p?null:k})]},t.id)})})}function j({o:l,me:t,readOnly:j,compact:k}){const p=(0,i.useBookings)(l.restaurantId),S=(0,o.useStore)(e=>e.signAllergyStep);if(!l.allergies.length)return null;const A=(0,c.linkedBooking)(l,p),I=(0,c.orderChain)(l,A),C=(0,c.nextStep)(l,A),w=c.CHAIN_STEPS.filter(e=>I[e.id]).length,T=C?(0,c.stepInfo)(C):null,B='table'===C&&!['ready','served','collected'].includes(l.status);return(0,h.jsxs)(s.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:C?u.colours.red:u.colours.ok,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(n.T,{size:13,weight:"semibold",colour:C?'#FFD9D4':'#E2C489',children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(n.Badge,{kind:C?'red':'ok',label:C?`${w} of 5`:'Complete'})]}),(0,h.jsx)(y,{chain:I,next:C,testID:`allergy-steps-${l.ref}`}),k?null:c.CHAIN_STEPS.filter(e=>I[e.id]).map(e=>(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:I[e.id].by,size:20,ring:!1}),(0,h.jsxs)(n.Muted,{style:{flex:1},children:[e.n,". ",e.label,": ",b(I[e.id].by)," at ",x(I[e.id].at)]})]},e.id)),T?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(n.T,{size:13,children:["Next: ",T.n,". ",T.label,". ",T.what,"."]}),j?null:(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(n.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off ${T.label} on ${l.ref}`,disabled:!t.trim()||B,onPress:()=>S(l.id,C,t)}),(0,h.jsxs)(n.Muted,{children:["as ",b(t)]})]}),B?(0,h.jsx)(n.Muted,{children:"Signed off at the pass. The table step is signed when the dish is served."}):(0,h.jsx)(n.Muted,{children:"The ticket can't move on until this step is signed off."})]}):(0,h.jsx)(n.Muted,{children:"All five steps signed off. The full chain is in the allergen audit log."})]})}},975,[876,31,128,818,1082,881,976,825,996,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CHAIN_STEPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"stepInfo",{enumerable:!0,get:function(){return t}}),e.linkedBooking=l,e.orderChain=o,e.nextStep=s,Object.defineProperty(e,"doneCount",{enumerable:!0,get:function(){return c}}),e.canSign=function(n,t,l){return s(n,l)===t},e.statusBlock=function(n,l,s){if(!n.allergies.length||'cancelled'===l)return null;const c=o(n,s),u=n=>c[n]?null:`${t(n).n}. ${t(n).label} needs signing off first`;return'acknowledged'===l||'preparing'===l||'ready'===l?u('booked')??u('ordered')??u('kitchen'):'served'===l?u('booked')??u('ordered')??u('kitchen')??u('pass'):'collected'===l||'closed'===l?u('booked')??u('ordered')??u('kitchen')??u('pass')??u('table'):null},e.chainNeedsAction=function(n,t){const o=s(n,l(n,t));return!(!o||'table'===o&&!['ready','served'].includes(n.status))},e.bookingNeedsAction=function(n,t){return n.allergies.length>0&&!n.allergyAck&&!t.some(t=>t.allergies.length&&l(t,[n])?.id===n.id)};const n=[{id:'booked',n:1,label:'Booked',what:'Allergy recorded (who took it)'},{id:'ordered',n:2,label:'Ordered',what:'Server confirms with the guest'},{id:'kitchen',n:3,label:'Kitchen',what:'Chef signs off before cooking'},{id:'pass',n:4,label:'Pass',what:'Checked before it leaves the pass'},{id:'table',n:5,label:'Table',what:'Server signs off when served'}],t=t=>n.find(n=>n.id===t);function l(n,t){return n.bookingId?t.find(t=>t.id===n.bookingId):'table'===n.type&&n.tableNo?t.find(t=>t.restaurantId===n.restaurantId&&'seated'===t.status&&!!t.table&&t.table.split('+').includes(String(n.tableNo))):void 0}function o(n,t){return{booked:n.allergyChain?.booked??(t?.allergies.length?t.allergyAck:void 0),ordered:n.allergyChain?.ordered,kitchen:n.allergyAck,pass:n.allergyChain?.pass,table:n.handoverCheck}}function s(t,l){if(!t.allergies.length)return null;const s=o(t,l);return n.find(n=>!s[n.id])?.id??null}const c=(t,l)=>{const s=o(t,l);return n.filter(n=>s[n.id]).length}},976,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_ACTOR",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CAR_DEVICE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"CAR_DEFAULT_LABEL",{enumerable:!0,get:function(){return u}}),e.carDeviceIdentity=c,e.actorStamp=function(t){if(t.isCar)return r;if((0,n.isKitchenViaDisplay)())return(0,n.kitchenActor)();if('device'===t.kind)return'Display';return t.staffRef&&String(t.staffRef).trim()||t.fallback||'Staff'},e.migrateCarStaffIdentity=function(n){return n?.venueId?c({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,label:n.label}):null},e.carPairApproved=function(n){return'approved'===String(n?.status??'')&&!(!n?.venue_id&&!n?.venueId)};var n=_r(d[0]);const r='Car',t='car-device',u='Tesla';function c(n){return{kind:'device',venueId:String(n.venue_id??n.venueId??''),venueSlug:String(n.venue_slug??n.venueSlug??'anchorage'),venueName:String(n.venue_name??n.venueName??'The Anchorage'),canWrite:!0,role:'owner',displayName:r,label:n.label&&String(n.label).trim()||u}}},977,[979]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ROLE_BADGES",{enumerable:!0,get:function(){return n}}),e.cleanBadge=t,Object.defineProperty(e,"badgeSpoken",{enumerable:!0,get:function(){return o}}),e.assignShiftBadge=function(n,o,c){const s=t(c);return n.map(n=>n.id===o?{...n,badge:s,changed:!!n.published||n.changed}:n)};const n=['Bar','Floor','Upstairs KP','Downstairs KP','Sauce','Larder'];function t(t){const o=String(t??'').trim().toLowerCase();return n.find(n=>n.toLowerCase()===o)}const o=n=>t(n)?`, on ${t(n)}`:''},978,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KITCHEN_TICKET_RE",{enumerable:!0,get:function(){return t}}),e.kitchenTicketFromHash=function(n){const c=(n||'').match(/[#&]cckitchen=([A-Za-z0-9_-]{24,64})(?:&|$)/);return c&&t.test(c[1])?c[1]:null},e.chefKitchenUrl=function(t,n){const c=t.includes('?')?t.replace('?','?from=display&'):t.replace(/(#|$)/,'?from=display$1'),[s,o]=c.split('#'),u=(o||'').split('&').filter(t=>t&&!t.startsWith('cckitchen=')).join('&');return`${s}#cckitchen=${n}${u?`&${u}`:''}`},e.markKitchenViaDisplay=function(t,s){try{if('undefined'==typeof sessionStorage)return;t?(sessionStorage.setItem(n,'1'),s&&sessionStorage.setItem('cc-kitchen-actor',String(s).slice(0,60))):(sessionStorage.removeItem(n),sessionStorage.removeItem('cc-kitchen-actor'),sessionStorage.removeItem(c))}catch{}},e.isKitchenViaDisplay=function(){try{return'undefined'!=typeof sessionStorage&&'1'===sessionStorage.getItem(n)}catch{return!1}},e.kitchenActor=function(){try{return`${('undefined'!=typeof sessionStorage?sessionStorage.getItem('cc-kitchen-actor'):null)||'Head Chef'} via Display`.slice(0,80)}catch{return'Head Chef via Display'}},e.kitchenSessionStoreName=function(){return c};const t=/^[A-Za-z0-9_-]{24,64}$/,n='cc-kitchen-via-display',c='covercharge-kitchen-session-v1'},979,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSliders",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"notify",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"dismissNotice",{enumerable:!0,get:function(){return c}});var t=r(d[0]);let u=0;const s=t=>'urgent'===t.tone?0:'warn'===t.tone?1:2,n=(0,t.create)()((t,n)=>({queue:[],push:n=>t(t=>{const o=t.queue.find(t=>t.id===n.id),c=o?t.queue.map(t=>t.id===n.id?{...n,seq:o.seq}:t):[...t.queue,{...n,seq:++u}];return{queue:(f=c,[...f].sort((t,u)=>s(t)-s(u)||(t.seq??0)-(u.seq??0))).slice(0,40)};var f}),dismiss:u=>{const s=n().queue.find(t=>t.id===u);if(s){t(t=>({queue:t.queue.filter(t=>t.id!==u)}));try{s.onClose?.()}catch{}}},dismissWhere:t=>{for(const u of n().queue.filter(t))n().dismiss(u.id)}})),o=t=>n.getState().push(t),c=t=>n.getState().dismiss(t)},980,[995]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"pinProblem",{enumerable:!0,get:function(){return r.pinProblem}}),Object.defineProperty(_e,"ERROR_TEXT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"errorText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useDisplayTiles",{enumerable:!0,get:function(){return u}}),_e.refreshTiles=async function(){const e=await l('display_staff_list',{});Array.isArray(e)&&u.setState({tiles:e,at:Date.now()});const t=await l('display_pin_lengths',{});t&&'object'==typeof t&&!('ok'in t)&&u.setState({lens:t})},_e.refreshManagers=async function(){const e=await l('display_managers',{});Array.isArray(e)&&u.setState({managers:e})},Object.defineProperty(_e,"displayClock",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"displayChangePin",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"displayAddTemp",{enumerable:!0,get:function(){return y}}),_e.setStaffPin=async function(e,n,a=4){const o=_();if(!o)return{ok:!1,error:'Sign in to the venue to set PINs (they are kept on the server only).'};const s=(0,r.pinProblem)(n,a);if(s)return{ok:!1,error:s};try{const{error:r}=await(0,t.getSupabase)().rpc('set_staff_pin',{p_venue:o,p_staff_ref:e,p_pin:n});return r?{ok:!1,error:r.message.replace(/^.*?:\s*(?=The PIN|Pick a PIN)/,'')}:{ok:!0}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},_e.addTempStaff=async function(e){const n=_();if(!n)return{ok:!1,error:'Sign in to the venue to add temp staff (the code is made and kept on the server).'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc('add_temp_staff',{p_venue:n,p_name:e.name,p_dept:e.dept??null,p_rate:e.rate??null,p_until:e.until||null});return a?{ok:!1,error:a.message}:{ok:!0,...r}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},Object.defineProperty(_e,"usePinStatus",{enumerable:!0,get:function(){return k}}),_e.refreshPinStatus=async function(){const e=_();if(!e)return;try{const{data:n}=await(0,t.getSupabase)().rpc('staff_pin_status',{p_venue:e});Array.isArray(n)&&k.setState(Object.fromEntries(n.map(e=>[e.staff_ref,{hasPin:e.has_pin,locked:e.locked}])),!0)}catch{}},_e.localTiles=function(e,t){return e.filter(e=>e.active&&e.displayClock&&!(e.temp&&e.tempUntil&&e.tempUntil({ref:e.id,name:e.name,nickname:e.nickname,dept:e.dept,temp:!!e.temp})).sort((e,t)=>Number(!!e.temp)-Number(!!t.temp)||e.name.localeCompare(t.name))},Object.defineProperty(_e,"displayBlockChange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"displayBlockEdit",{enumerable:!0,get:function(){return h}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]),a=_r(d[4]),o=_r(d[5]);const s={wrong:'That PIN is not right. Try again.',locked:'Too many wrong tries. Locked for 15 minutes, or ask a manager to reset your PIN.',nopin:'No PIN set yet. Ask a manager to set one in Staff & roles.',notallowed:'This person can\u2019t clock in at the Display. A manager can turn it on in Staff & roles.',already:'Already clocked in.',notin:'Not clocked in yet.',onbreak:'Already on a break.',notmanager:'Only an owner or manager can add temp staff.',format:'The new PIN must be 4 to 8 digits (6 or more for managers and owners).',weak:'Pick a PIN that is harder to guess (not all the same digit or a run like 1234).',devicelocked:'Too many wrong PINs on this Display. Wait 15 minutes, then try again.',unpaired:'Pair this Display first (Settings \u203a Devices on the Managers app), then try again.',offline:'No connection. Try again in a moment.'},c=(e,t)=>'format'===e&&t?.min?`The new PIN must be ${t.min} to 8 digits.`:s[e??'']??(e||'Something went wrong. Try again.'),p=()=>'device'===n.useSync.getState().kind&&!!n.useSync.getState().venueId;async function l(e,n){if(a.PITCH)return(0,o.pitchClock)(e,n);if(!p())return{ok:!1,error:'unpaired'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc(e,n);return a?{ok:!1,error:/paired Display/.test(a.message)?'unpaired':a.message}:r}catch{return{ok:!1,error:'offline'}}}const u=(0,e.create)(()=>({tiles:null,managers:[],lens:{}}));const f=(e,t,n,r={})=>l('display_clock',{p_staff_ref:e,p_pin:t,p_action:n,p_break_mins:r.breakMins??null,p_off_rota:!!r.offRota}),m=(e,t,n)=>l('display_change_pin',{p_staff_ref:e,p_old:t,p_new:n}),y=(e,t,n)=>l('display_add_temp',{p_manager_ref:e,p_manager_pin:t,p_name:n.name,p_dept:n.dept??null,p_rate:n.rate??null,p_until:n.until||null}),_=()=>'staff'===n.useSync.getState().kind?n.useSync.getState().venueId:void 0;const k=(0,e.create)(()=>({}));const b=(e,t,n,r,a)=>l('display_block_change',{p_manager_ref:e,p_manager_pin:t,p_block_id:n,p_action:r,p_doc:a}),h=(e,t,n,r)=>l('display_block_edit',{p_block_id:e,p_action:t,p_doc:n,p_by:r})},981,[995,872,824,1525,2,1526]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOutLinks",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isAutoLink",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"autoSync",{enumerable:!0,get:function(){return v}}),_e.itemsFor=b,_e.dishUsesFor=p,_e.countsFor=O,_e.reasonFor=function(e,t,n){const s=n??p(e).find(e=>e.id===t)?.uses??[],r=O(e),i=c.useStore.getState().menu.find(e=>e.id===t)?.name??'';return(0,u.dishReason)(i,(0,u.shortOf)(s,r),r,b(e))},_e.runAutoSoldOut=y,_e.startAutoSoldOut=function(){if(w)return w;let e=null;const t=()=>{e||(e=setTimeout(()=>{e=null,y()},400))},n=[d.useShellStore.subscribe((e,n)=>{e.events===n.events&&e.server===n.server&&e.items===n.items||t()}),h.subscribe(t),S.useCardStore.subscribe((e,n)=>{e.cards!==n.cards&&t()}),c.useStore.subscribe((e,n)=>{e.menu===n.menu&&e.restaurants===n.restaurants||t()}),f.useSoldOut.subscribe((e,n)=>{e.entries!==n.entries&&t()})],s=setInterval(t,6e4);return t(),w=()=>{n.forEach(e=>e()),clearInterval(s),e&&clearTimeout(e),w=null},w},_e.useAutoSoldOutView=function(e){const t=(0,c.useStore)(e=>e.menu),n=h(e=>e.links),s=(0,S.useCardStore)(e=>e.cards),r=(0,d.useShellStore)(t=>t.items[e]);(0,d.useShellStore)(e=>e.events),(0,d.useShellStore)(t=>t.server[e]);const i=(r??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active})),o=p(e,t,n,s,i),l=O(e);return{dishes:o,counts:l,items:i,reason:e=>{const t=o.find(t=>t.id===e);return t?(0,u.dishReason)(t.name,(0,u.shortOf)(t.uses,l),l,i):''},links:n}};var e,t=_r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[1]),r=_r(_d[2]),u=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),S=_r(_d[9]),f=_r(_d[10]);const m=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},h=(0,s.create)()((0,r.persist)(e=>({links:[],setLink:(t,n,s,r)=>e(e=>{const u=e.links.filter(e=>!(e.rid===t&&e.itemId===n));return{links:[...u,{rid:t,itemId:n,uses:s?s.filter(e=>e.qty>0).slice(0,10):[],at:m().toISOString(),by:r.slice(0,80),...s?{}:{auto:!0}}]}})}),{name:'covercharge-soldout-links-v1',version:1,storage:(0,r.createJSONStorage)(()=>n.default)})),k=e=>!!e&&!0===e.auto,v={soldOutRead:new Set,linksRead:new Set};function b(e){return(d.useShellStore.getState().items[e]??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active}))}function p(e,t=c.useStore.getState().menu,n=h.getState().links,s=S.useCardStore.getState().cards,r=b(e)){const i=[];for(const o of t){if(o.restaurantId!==e||o.hidden)continue;const t=s.find(t=>t.restaurantId===e&&t.menuItemId===o.id),l=n.find(t=>t.rid===e&&t.itemId===o.id),c=(0,u.inferUses)(o,t,r),d=k(l)?c:(0,u.usesFor)(o,l,t,r);i.push({id:o.id,name:o.name,uses:d.uses,source:d.source,guess:c.uses})}return i}function O(e){return(0,d.venueCounts)(d.useShellStore.getState(),e)}function I(e){const t={};for(const n of d.useShellStore.getState().events)n.rid===e&&(!t[n.kind]||n.at>t[n.kind])&&(t[n.kind]=n.at);return t}function y(e=m()){const t=c.useStore.getState();let n=0;for(const s of t.restaurants){const t=s.id;if((0,o.liveData)()&&(!d.useShellStore.getState().server[t]||!v.soldOutRead.has(t)||!v.linksRead.has(t)))continue;const r=(0,i.soldOutSettingsOf)(s.settings?.soldOut).auto,l=p(t),c=(0,u.planAuto)({rid:t,enabled:r,dishes:l,counts:O(t),entries:f.useSoldOut.getState().entries,lastChange:I(t),now:e});if(!c.mark.length&&!c.clear.length)continue;const S=e.toISOString();f.useSoldOut.setState(e=>{const n=new Set(c.clear),s=new Map(c.mark.map(e=>[e.itemId,e.name])),r=e.entries.filter(e=>!(e.rid===t&&s.has(e.itemId))).map(e=>e.rid===t&&n.has(e.itemId)?{...e,on:!1,at:S,by:'Count back up',kept:!1,clearAfter:void 0}:e);return{entries:[...r,...c.mark.map(e=>({rid:t,itemId:e.itemId,name:e.name.slice(0,120),on:!0,at:S,by:'Live count',auto:!0,kept:!1}))]}}),n+=c.mark.length+c.clear.length}return n}let w=null;l.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchCounts=e=>{const t=c.useStore.getState().restaurants[0]?.id;if(!t)return;const n=O(t),s=m().toISOString(),r=Object.entries(e).filter(([e,t])=>(n[e]??0)!==t).map(([e,r],u)=>({id:`pitch-count-${Date.now()}-${u}`,rid:t,kind:e,delta:r-(n[e]??0),reason:'count',by:'Chef',app:'chef',at:s}));return r.length&&d.useShellStore.setState(e=>({events:[...e.events,...r]})),y()})},982,[1190,995,1191,983,984,1218,2,881,1087,1168,942]); +__d(function(_g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.parseQty=i,_e.inferUses=u,_e.usesFor=function(e,t,n,o){const s=new Set(o.filter(e=>!1!==e.active).map(e=>e.key));return t?{uses:t.uses.filter(e=>s.has(e.key)&&e.qty>0),source:t.uses.length?'link':'none'}:u(e,n,o)},_e.shortOf=c,_e.shortReason=f,_e.dishReason=function(e,t,n,o){if(!t.length)return'';const i=e.replace(/\([^)]*\)/g,'').trim(),a=e=>{const t=o.find(t=>t.key===e);return!!t&&new RegExp(`\\b(${s(t)})$`,'i').test(i)},l=t.filter(e=>!a(e.key));return l.length?f(l,n,o):t.some(e=>(n[e.key]??0)>0)?'not enough left':'none left'},Object.defineProperty(_e,"withReason",{enumerable:!0,get:function(){return h}}),_e.usesText=function(e,t){return e.length?e.map(e=>{const n=t.find(t=>t.key===e.key),o=(n?.name??e.key).toLowerCase(),s=(n?.plural??`${o}s`).toLowerCase();return`${.5===e.qty?'\xbd':Number.isInteger(e.qty)?String(e.qty):`${Math.floor(e.qty)}\xbd`} ${e.qty>1?s:o}`}).join(', '):'Not linked to the counts'},_e.planAuto=function(e){const{rid:t,enabled:n,dishes:o,counts:s,entries:i,lastChange:a,now:l}=e,u={mark:[],clear:[]},f=new Map(i.filter(e=>e.rid===t).map(e=>[e.itemId,e])),h=l.getTime(),m=e=>e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>h),d=new Set;for(const e of o){d.add(e.id);const t=f.get(e.id),o=n?c(e.uses,s):[];if(o.length){if(t&&m(t))continue;if(t&&t.kept){const e=o.map(e=>a[e.key]??'').sort().pop()??'';if(!e||e<=t.at)continue}u.mark.push({itemId:e.id,name:e.name})}else t&&t.auto&&m(t)&&u.clear.push(e.id)}for(const e of f.values())e.auto&&m(e)&&!d.has(e.itemId)&&u.clear.push(e.itemId);return u};const e='meat|bisque|stock|cakes?|claws?|sauce|butter|oil|paste|salad|mayo|mayonnaise|thermidor|tails?|bon|croquettes?|p\xe2t\xe9|pate|rolls?|soup|linguine|ravioli',t=/^(g|kg|gram|grams|ml|l|litre|litres|oz|lb|lbs|cl)$/i,n={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,half:.5,'\xbd':.5},o=e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&'),s=e=>{const t=new Set([e.name,e.plural].map(e=>e.trim().toLowerCase()).filter(Boolean));for(const e of[...t])e.endsWith('s')?t.add(e.slice(0,-1)):t.add(e+'s');return[...t].sort((e,t)=>t.length-e.length).map(o).join('|')};function i(e){const t=(e||'').trim().toLowerCase();if(!t)return 1;if(/^\xbd$|^half\b/.test(t))return.5;const o=t.match(/^(\d+(?:\.\d+)?)\s*(\xbd)?/);if(o)return Number(o[1])+(o[2]?.5:0);const s=t.split(/\s+/)[0];return n[s]??1}const a=(e,t)=>'half'===e.unit?Math.max(.5,Math.round(2*t)/2):Math.max(1,Math.round(t)),l=e=>(e.optionGroups??[]).some(e=>e.choices.some(e=>/\bhalf\b/i.test(e.label)));function u(n,o,u){const c=u.filter(e=>!1!==e.active&&'kg'!==e.unit),f=(e,t)=>({source:e,uses:t.map(t=>{const o=c.find(e=>e.key===t.key),s='half'===o.unit&&l(n)&&'description'!==e?.5:t.qty;return{key:t.key,qty:a(o,s)}})});if(o){const e=[];for(const n of c){const a=new RegExp(`\\b(${s(n)})\\b`,'i'),l=o.ingredients.find(e=>a.test(e.name)&&!t.test((e.unit||'').trim())&&!/\b(meat|stock|bisque|oil|butter|paste)\b/i.test(e.name));l&&e.push({key:n.key,qty:i(`${l.qty} ${l.unit}`)})}if(e.length)return f('card',e)}const h=n.description??'';{const t=[];for(const n of c){const o=new RegExp(`\\b(half an?|a|an|one|two|three|four|five|six|\\d+(?:\\.\\d+)?|\xbd)\\s+(?:(?:whole|fresh|live|dressed|local)\\s+)?(?:[A-Za-z'\u2019-]+\\s+){0,2}?(${s(n)})\\b(?!\\s+(?:${e}))`,'i'),a=h.match(o);a&&t.push({key:n.key,qty:i(a[1])})}if(t.length)return f('description',t)}{const e=n.name.replace(/\([^)]*\)/g,'').trim(),t=[];for(const n of c)new RegExp(`\\b(${s(n)})$`,'i').test(e)&&t.push({key:n.key,qty:1});if(t.length)return f('name',t)}return{uses:[],source:'none'}}function c(e,t){return e.filter(e=>(t[e.key]??0)(n.find(t=>t.key===e)?.name??e).toLowerCase(),s=e.filter(e=>(t[e.key]??0)<=0).map(e=>o(e.key)),i=e.filter(e=>(t[e.key]??0)>0).map(e=>o(e.key)),a=e=>e.length<=2?e.join(' or '):`${e.slice(0,-1).join(', ')} or ${e[e.length-1]}`;return[s.length?`no ${a(s)}`:'',i.length?`not enough ${a(i)}`:''].filter(Boolean).join(', ')}const h=(e,t)=>t?`${e.replace(/\s*\([^)]*\)\s*$/,'').trim()||e} (${t})`:e},983,[]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SOLD_OUT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOLD_OUT_CLEAR_LABEL",{enumerable:!0,get:function(){return t}}),_e.soldOutSettingsOf=function(t){const n='morning'===t?.clear||'manual'===t?.clear||'close'===t?.clear?t.clear:e.clear,o=/^([01]\d|2[0-3]):[0-5]\d$/.test(t?.morningAt??'')?t.morningAt:e.morningAt;return{clear:n,morningAt:o,auto:!1!==t?.auto}},_e.clearAfterFor=function(e,t,o){if('manual'===t.clear)return;const c=(()=>{const o=n(e,t.morningAt);return ee.getTime()?o:c},_e.activeSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>o)).sort((e,t)=>t.at.localeCompare(e.at)||e.name.localeCompare(t.name))},_e.expiredSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&!!e.clearAfter&&new Date(e.clearAfter).getTime()<=o)},_e.stripText=o,_e.stripNeedsTicker=function(e,t,n){return o(e).length*n*.56>Math.max(0,t-150)},_e.soldOutCount=function(e){return 1===e?'1 dish sold out':`${e} dishes sold out`};const e={clear:'close',morningAt:'05:00',auto:!0},t={close:'When the kitchen closes',morning:'Next morning',manual:'Only when someone taps Back on'};const n=(e,t,n=0)=>{const[o,c]=t.split(':').map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+n,o,c,0,0)};function o(e){return e.join(' \xb7 ')}},984,[]); +__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(0,n.sha256HexSync)(`cc-wake:${i}:${t}`),o={pinHash:a(t,i),pinSalt:i,pinLen:4,pinDefault:!0};function u(){const n=globalThis.crypto,t=new Uint8Array(12);if(n?.getRandomValues)n.getRandomValues(t);else for(let n=0;nn.toString(16).padStart(2,'0')).join('')}const l=(n,t)=>a(t,n.pinSalt)===n.pinHash},986,[1278]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/(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])},988,[819]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n.default}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=(t=e)&&t.__esModule?t:{default:t}},989,[1319]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,s,t){const l=(0,p.tableKey)(t),o=(0,g.tablesOf)(s.table);await h.repo.bookings.update(s.id,(0,y.tablePatch)(l||null)),'seated'===s.status&&s.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(s=>g.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0})),l&&(0,j.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:j=90,onClose:$,onSaved:w,onPickOnPlan:T,canClear:L=!0}){const S=(0,g.usePlan)(e),P=(0,h.useBookings)(e),[W,z]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),D=(0,l.useMemo)(()=>(0,p.pickGroups)(S),[S]),I=P.filter(e=>e.date===y.date),B=(0,p.seatsOf)(S,W),R=(0,p.seatLine)(B.total,y.partySize),O=(0,p.pickClashes)(y,W,I,j),M=e=>(0,p.pickClashes)(y,[e],I,j)[0]?.with,N=(0,p.tableKey)(W)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,m.useBlocks)(e=>e.blocks),A=(0,m.blockAt)(_,e,y.date,y.time),[F,G]=(0,l.useState)(null),Y=e=>{G(null),z(s=>(0,p.toggleTable)(s,e))},[K]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{K&&(0,c.announce)(`Tables can't be saved: ${K}.`)},[K]);const[E,H]=(0,l.useState)(!1),U=async s=>{(0,o.guardBookingChange)(w,{b:y,tables:s})?(H(!0),$(),await(0,o.saveTablesReported)(e,y,s,f,(0,p.seatsOf)(S,s).total,e=>w?.(e))):$()},V=(0,v.jsxs)(u.default,{style:{gap:8},children:[(0,v.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(W)} picked. ${R.text}.`,children:[(0,v.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(W)}),(0,v.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:R.text})]}),A?(0,v.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,v.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,O.length?(0,v.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(O)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,v.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(O)," You can still save."]})}):null,F?(0,v.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:F,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,v.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:F}),(0,v.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,v.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(W)} for ${f}, ${y.partySize} people`,disabled:E,onPress:()=>{U(W)},style:[C,{flexGrow:1}]}),(0,v.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>G(null),style:C})]})]}):null,(0,v.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[F?null:(0,v.jsx)(x.Button,{testID:"table-pick-save",label:E?'Saving\u2026':O.length?'Save anyway':'Save tables',disabled:!N||!W.length||E,accessibilityLabel:`${O.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(W)} for ${f}. ${R.text}.${O.length?` ${(0,p.clashWords)(O)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(w,{b:y,tables:W}))return void $();const e=(0,p.overCapacityAsk)(W,B.total,y.partySize);!e||F?U(W):G(e)},style:[C,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&L?(0,v.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:E,onPress:()=>U([]),style:C}):null,(0,v.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:C})]})]});return(0,v.jsxs)(x.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:V,children:[(0,v.jsx)(s.TableNumberWarning,{plan:S}),K?(0,v.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${K}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,v.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${K}.`})}):null,(0,v.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),T?(0,v.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>T(W),style:C}):null,D.map(e=>(0,v.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,v.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,v.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const s=W.includes(e.name),l=M(e.name);return(0,v.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:s},'aria-checked':s,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,s,l),onPress:()=>Y(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?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!s?'dashed':'solid',backgroundColor:s?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,v.jsx)(x.T,{size:18,weight:"semibold",colour:s?k.colours.onGold:k.colours.text,children:(0,t.tableNumbers)(e.name)}),(0,v.jsxs)(x.T,{size:14,colour:s?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),D.length?null:(0,v.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var s=r(d[0]),t=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),m=r(d[16]),v=r(d[17]);const C={minHeight:56}},990,[935,812,31,959,824,1421,264,128,823,829,1420,960,825,822,818,952,828,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})]})]})}},991,[31,128,823,829,1420,969,960,825,866,863,807,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"BOOKING_VIEW_ONLY",{enumerable:!0,get:function(){return n}}),e.isKitchenPorter=o,e.canChangeBookings=function(n){return!n||(!('owner'!==n.role&&'manager'!==n.role&&!n.ownerAccess&&!n.managerAccess)||('boolean'==typeof n.bookingWrite?n.bookingWrite:!o(n)))},Object.defineProperty(e,"BOOKING_CHANGE_ACTIONS",{enumerable:!0,get:function(){return t}});const n='View only. Ask a manager to change bookings.';function o(n){return!(!n||'staff'!==n.role)&&/porter|KP/i.test(n.job??'')}const t=new Set(['add_walkin','seat_booking','finish_booking','no_show','cancel_booking','move_booking','change_booking','decide_booking','block_table','waitlist_seat'])},992,[]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenBar=p,_e.NeedsPills=k,_e.BookingNeeds=x,Object.defineProperty(_e,"needsIcons",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"confirmHolds",{enumerable:!0,get:function(){return S}}),_e.serveHolds=y,_e.postNewBookingToKitchen=function(e,t){if(!t||'system'===t)return;const s=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),l=[],r=`${e.name}, ${(0,c.niceDate)((0,c.parseYmd)(e.date)).slice(0,3)} ${e.time}${e.table?`, table ${e.table}`:''}`;if((e.holds??[]).filter(e=>e.qty>0).length){const t=I(e.restaurantId);l.push(`${(0,u.holdsText)(e,(0,u.reservablesOf)(s),t)} reserved: ${r}. Tap Platter OK in the Head Chef app.`)}(0,u.hasAllergens)(e)&&l.push(`\u26a0\ufe0f Allergens: ${(0,u.allergenText)(e)} \u2014 ${r}. Please sign \u2018Allergens seen\u2019.`);if(!l.length)return;a.useOwner.getState().chatSend({ch:'kitchen',from:t,text:l.join('\n'),at:(new Date).toISOString()})},_e.useKitchenTodo=D,_e.KitchenSignoffs=function({rid:t,today:s,by:a,app:f,canConfirm:p=!0,showAll:k}){const j=D(t,s),I=(0,o.useBookings)(t),T=(0,o.useRestaurant)(t),O=(0,n.useStockItems)(t),$=(0,u.reservablesOf)(T),A=I.filter(e=>e.date===s&&!['cancelled','noshow'].includes(e.status)&&(e.holds??[]).some(e=>e.qty>0)),C=k?[...j,...A.filter(e=>!j.includes(e))]:j;return C.length?(0,b.jsxs)(l.default,{testID:"kitchen-signoffs",style:{gap:10,padding:16,borderRadius:16,borderWidth:1.5,borderColor:j.length?h.colours.amber:h.colours.hairline,backgroundColor:h.colours.surface},children:[(0,b.jsx)(r.T,{size:12,weight:"semibold",colour:j.length?h.colours.amber:h.colours.goldMuted,style:{letterSpacing:1.6},children:j.length?`KITCHEN SIGN-OFF NEEDED (${j.length})`:'RESERVED TODAY'}),C.map(t=>(0,b.jsxs)(l.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:h.colours.hairline},testID:`signoff-${t.ref}`,children:[(0,b.jsxs)(r.T,{weight:"semibold",children:[t.name," \xb7 ",t.partySize," Covers \xb7 ",t.date===s?'Today':(0,c.niceDate)((0,c.parseYmd)(t.date))," ",t.time,t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:'']}),(0,b.jsx)(x,{b:t}),p?(0,b.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,u.needsAllergenSeen)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"danger",label:"Allergens seen",testID:`allergens-seen-${t.ref}`,onPress:()=>o.useStore.getState().ackBookingAllergy(t.id,a)}):null,(0,u.needsHoldOk)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"success",label:/platter/i.test((0,u.holdsText)(t,$,O))?'Platter OK':'Reservation OK',testID:`platter-ok-${t.ref}`,onPress:()=>S(t.id,a)}):null,t.date===s&&t.holdOk&&(t.holds??[]).some(e=>!e.served)&&['seated','confirmed'].includes(t.status)?(0,b.jsx)(r.Button,{small:!0,kind:"secondary",label:"Served",testID:`served-${t.ref}`,onPress:()=>y(t,a,f)}):null]}):(0,b.jsx)(r.Muted,{children:"The kitchen signs these off."})]},t.id))]}):null},_e.PlattersBooked=function({rid:e,date:t,label:s}){const a=(0,o.useBookings)(e),c=(0,o.useRestaurant)(e),f=(0,n.useStockItems)(e),p=(0,u.heldSummary)(a,t,(0,u.reservablesOf)(c)),k=Object.entries(p.stock).filter(([,e])=>e>0).map(([e,t])=>`${t} ${(f.find(t=>t.key===e)?.name??e).toLowerCase()}`);return p.platters||k.length?(0,b.jsx)(l.default,{testID:"platters-booked",children:(0,b.jsxs)(r.T,{weight:"semibold",colour:h.colours.goldLight,children:[s??'Platters booked',": ",p.platters,k.length?` (${k.join(', ')})`:'']})}):null};var e=_r(d[0]);_r(d[1]);var t,s=_r(d[2]),l=(t=s)&&t.__esModule?t:{default:t},r=_r(d[3]),o=_r(d[4]),n=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);const f=({label:e,bg:t,fg:s,border:o,testID:n})=>(0,b.jsx)(l.default,{testID:n,style:{backgroundColor:t,borderColor:o,borderWidth:1,borderRadius:999,paddingHorizontal:9,paddingVertical:2},children:(0,b.jsx)(r.T,{size:13,weight:"semibold",colour:s,children:e})});function p({b:e,big:t}){return(0,u.hasAllergens)(e)?(0,b.jsxs)(l.default,{testID:`allergen-bar-${e.ref}`,style:{backgroundColor:h.colours.redSolid,borderRadius:10,paddingHorizontal:10,paddingVertical:t?8:5,gap:2},children:[(0,b.jsxs)(r.T,{size:t?16:13,weight:"bold",colour:"#FFFFFF",children:["\u26a0\ufe0f ALLERGENS: ",(0,u.allergenText)(e)]}),e.allergyAck?(0,b.jsxs)(r.T,{size:12,colour:"#FFE3DF",children:["Seen by kitchen: ",e.allergyAck.by]}):(0,b.jsx)(r.T,{size:12,colour:"#FFE3DF",children:"Kitchen hasn\u2019t signed \u2018Allergens seen\u2019 yet"})]}):null}function k({b:t,r:s}){const l=(0,n.useStockItems)(t.restaurantId),o=(0,u.reservablesOf)(s),a=(t.holds??[]).some(e=>e.qty>0),c=[];return t.drinksOnly&&c.push((0,b.jsx)(f,{testID:"pill-drinks",label:"\ud83c\udf77 Drinks only (after last food orders)",bg:h.colours.surface2,fg:h.colours.goldLight,border:h.colours.accentBorder},"x")),(0,u.hasAccess)(t)&&c.push((0,b.jsx)(f,{testID:"pill-access",label:`\u267f ${(0,u.accessText)(t)}`,bg:h.colours.blueBg,fg:"#E2C489",border:h.colours.blue},"a")),(0,u.dogCount)(t)&&c.push((0,b.jsx)(f,{testID:"pill-dog",label:"\ud83d\udc15 "+((0,u.dogCount)(t)>1?`${(0,u.dogCount)(t)} dogs`:'Dog'),bg:h.colours.surface2,fg:h.colours.text,border:h.colours.hairline},"d")),(0,u.dietText)(t)&&c.push((0,b.jsx)(f,{testID:"pill-veg",label:`\u24cb ${(0,u.dietText)(t)}`,bg:"#2A2216",fg:"#E2C489",border:"#CFA45F"},"v")),a&&c.push(t.holdOk?(0,b.jsx)(f,{testID:"pill-platter",label:`\u2713 ${(0,u.holdsText)(t,o,l)} \xb7 confirmed`,bg:h.colours.okBg,fg:"#E2C489",border:h.colours.ok},"h"):(0,b.jsx)(f,{testID:"pill-platter",label:`\ud83e\udd9e ${(0,u.holdsText)(t,o,l)} \xb7 awaiting kitchen`,bg:h.colours.amberBg,fg:"#FFE2A8",border:h.colours.amber},"h")),t.tableReq?.length&&c.push((0,b.jsx)(f,{testID:"pill-request",label:`Requested: ${t.tableReq.map(t=>`${(0,e.tableNumbers)(t)}`).join(' or ')}`,bg:h.colours.goldTint,fg:h.colours.goldLight,border:h.colours.accentBorder},"t")),c.length?(0,b.jsx)(r.Row,{wrap:!0,gap:6,children:c}):null}function x({b:e,big:t}){const s=(0,o.useRestaurant)(e.restaurantId);return(0,b.jsxs)(l.default,{style:{gap:6},children:[(0,b.jsx)(p,{b:e,big:t}),(0,b.jsx)(k,{b:e,r:s})]})}const j=e=>[(0,u.hasAllergens)(e)?'\u26a0\ufe0f':'',(0,u.hasAccess)(e)?'\u267f':'',(0,u.dogCount)(e)?'\ud83d\udc15':'',(0,u.dietText)(e)?'\u24cb':'',(e.holds??[]).some(e=>e.qty>0)?e.holdOk?'\ud83e\udd9e\u2713':'\ud83e\udd9e':''].filter(Boolean).join(' '),S=(e,t)=>o.useStore.getState().updateBooking(e,{holdOk:{by:t,at:(new Date).toISOString()}});function y(e,t,s){const l=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),r=(0,u.stockNeed)(e,(0,u.reservablesOf)(l));for(const[l,o]of Object.entries(r))o>0&&n.shellfish.append({rid:e.restaurantId,kind:l,delta:-o,reason:'sold',by:t,app:s});const a=(new Date).toISOString();o.useStore.getState().updateBooking(e.id,{holds:(e.holds??[]).map(e=>e.served?e:{...e,served:{by:t,at:a}})})}const I=e=>n.useShellStore.getState().items[e]??[];function D(e,t){return(0,o.useBookings)(e).filter(e=>e.date>=t&&!e.walkIn&&((0,u.needsAllergenSeen)(e)||(0,u.needsHoldOk)(e))).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time))}},993,[812,31,128,818,823,1087,863,832,822,825,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},994,[31,128,14,825,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})},995,[1205,1206]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function i(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_AVATARS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"AVATAR_BGS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"AVATAR_RINGS",{enumerable:!0,get:function(){return j}}),_e.specFor=E,_e.AvatarArt=$,_e.AvatarLook=v,_e.useStaffMember=M,_e.StaffAvatar=function({id:i,name:t,size:s=34,ring:c=!0}){const f=M(i,t),h=f?.id??i,u=(0,n.useAvatars)(i=>h?i.photos[h]:void 0),F=(0,o.useSetup)(i=>h?i.looks[h]:void 0),j=`${(f?.name??t??'Team member').replace(' (example)','')}'s avatar`;return(0,y.jsx)(r.default,{testID:h?`avatar-${h}`:'avatar',accessibilityLabel:j,accessibilityRole:"image",style:{width:s,height:s,borderRadius:s/2,overflow:'hidden',borderWidth:c?Math.max(1,s/22):0,borderColor:x.colours.gold,backgroundColor:(0,e.soutersSurface)('#111')},children:u?(0,y.jsx)(l.default,{source:{uri:u.dataUrl},style:{width:'100%',height:'100%'},accessibilityIgnoresInvertColors:!0}):(0,y.jsx)(v,{look:F,id:h,name:f?.name??t,size:s-(c?2*Math.max(1,s/22):0)})})};var e=_r(d[0]);_r(d[1]);var l=i(_r(d[2])),r=i(_r(d[3])),t=_r(d[4]),s=i(t),c=_r(d[5]),n=_r(d[6]),o=_r(d[7]),x=_r(d[8]),f=_r(d[9]),h=_r(d[10]),y=_r(d[11]);const u=Object.fromEntries(h.ROSTER.map(i=>[i.id,i.avatar])),F=['#2A2520','#B89A72','#D9A441','#4A3F35','#3A3029','#8A6A3B'],j=['#E9B949','#CFA45F'],C=F,p=['#F1C7A5','#E8B48F','#C68B5E','#8D5B3E','#F4D2B8','#A86B45'],A=['#2B1B12','#7A4E2A','#151515','#C2462E','#D9B26A'],b=['quiff','flip','crop','beehive','bob','curls'],k=i=>{let e=7;for(const l of i)e=31*e+l.charCodeAt(0)>>>0;return e};function E(i,e){if(i&&u[i])return u[i];const l=k(i||e||'crew');return{bg:C[l%6],ring:j[l%2],skin:p[(l>>3)%6],hair:A[(l>>6)%5],hairStyle:b[(l>>9)%6],suit:'#F2EAD8',antenna:['ball','star','none'][(l>>12)%3]}}const O=(i,e,l)=>`M${i} ${e-l} Q${i+.18*l} ${e-.18*l} ${i+l} ${e} Q${i+.18*l} ${e+.18*l} ${i} ${e+l} Q${i-.18*l} ${e+.18*l} ${i-l} ${e} Q${i-.18*l} ${e-.18*l} ${i} ${e-l}Z`;function $({spec:i,size:e=40}){const l=i,r='#1B1B1B',c='flip'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M29 50 C26 30 40 22 50 22 C60 22 74 30 71 50 C75 56 79 60 76 65 C72 60 69 58 66 57 L34 57 C31 58 28 60 24 65 C21 60 25 56 29 50Z",fill:l.hair}):'bob'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M30 58 C27 32 40 24 50 24 C60 24 73 32 70 58 L66 60 L34 60Z",fill:l.hair}):'beehive'===l.hairStyle?(0,y.jsxs)(t.G,{children:[(0,y.jsx)(t.Ellipse,{cx:50,cy:25,rx:15,ry:14,fill:l.hair}),(0,y.jsx)(t.Path,{d:"M31 54 C28 34 40 27 50 27 C60 27 72 34 69 54 Z",fill:l.hair})]}):'curls'===l.hairStyle?(0,y.jsx)(t.G,{children:[[34,34],[40,27],[50,24],[60,27],[66,34],[69,43],[31,43]].map(([i,e],r)=>(0,y.jsx)(t.Circle,{cx:i,cy:e,r:7,fill:l.hair},r))}):null,n='quiff'===l.hairStyle?(0,y.jsxs)(t.G,{children:[(0,y.jsx)(t.Path,{d:"M32 42 C31 27 43 23 51 25 C61 22 70 30 68 42 C63 35 57 33 50 34 C43 34 37 37 32 42Z",fill:l.hair}),(0,y.jsx)(t.Path,{d:"M46 26 C51 14 66 14 66 23 C61 20 54 21 50 28Z",fill:l.hair})]}):'crop'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M32 42 C31 28 42 25 50 25 C58 25 69 28 68 42 C64 36 58 33 50 33 C42 33 36 36 32 42Z",fill:l.hair}):'curls'===l.hairStyle?null:(0,y.jsx)(t.Path,{d:"M32 43 C33 30 42 27 50 27 C58 27 67 30 68 43 C61 38 57 33 51 33 C47 37 39 41 32 43Z",fill:l.hair});return(0,y.jsxs)(s.default,{width:e,height:e,viewBox:"0 0 100 100",children:[(0,y.jsx)(t.Circle,{cx:50,cy:50,r:50,fill:l.bg}),(0,y.jsx)(t.Ellipse,{cx:50,cy:50,rx:46,ry:13,fill:"none",stroke:"#FFF4E0",strokeOpacity:.28,strokeWidth:1.6,transform:"rotate(-28 50 50)"}),(0,y.jsx)(t.Path,{d:O(16,24,6),fill:"#FFF4E0",fillOpacity:.85}),(0,y.jsx)(t.Path,{d:O(84,34,4),fill:"#FFF4E0",fillOpacity:.7}),(0,y.jsx)(t.Circle,{cx:80,cy:16,r:1.6,fill:"#FFF4E0",fillOpacity:.8}),(0,y.jsx)(t.Circle,{cx:22,cy:70,r:1.3,fill:"#FFF4E0",fillOpacity:.6}),(0,y.jsx)(t.Path,{d:"M12 100 C14 82 31 74 50 74 C69 74 86 82 88 100 Z",fill:l.suit}),(0,y.jsx)(t.Path,{d:"M36 100 L40 84 L50 90 L60 84 L64 100Z",fill:l.ring,fillOpacity:.35}),(0,y.jsx)(t.Rect,{x:44,y:60,width:12,height:12,fill:l.skin}),c,(0,y.jsx)(t.Ellipse,{cx:50,cy:46,rx:17,ry:18.5,fill:l.skin}),n,l.specs?(0,y.jsxs)(t.G,{stroke:r,strokeWidth:1.6,fill:"#FFFFFF",fillOpacity:.25,children:[(0,y.jsx)(t.Rect,{x:37,y:42,width:11,height:8,rx:4}),(0,y.jsx)(t.Rect,{x:52,y:42,width:11,height:8,rx:4}),(0,y.jsx)(t.Line,{x1:48,y1:45,x2:52,y2:45})]}):null,(0,y.jsx)(t.Ellipse,{cx:42.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,y.jsx)(t.Ellipse,{cx:57.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,y.jsx)(t.Circle,{cx:43.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,y.jsx)(t.Circle,{cx:58.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,y.jsx)(t.Circle,{cx:38,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,y.jsx)(t.Circle,{cx:62,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,y.jsx)(t.Path,{d:"M44.5 55 Q50 60 55.5 55",stroke:r,strokeWidth:1.8,fill:"none",strokeLinecap:"round"}),(0,y.jsx)(t.Ellipse,{cx:50,cy:74,rx:21,ry:5.5,fill:l.ring}),(0,y.jsx)(t.Ellipse,{cx:50,cy:73,rx:16,ry:3,fill:"#000000",fillOpacity:.18}),(0,y.jsx)(t.Circle,{cx:50,cy:88,r:4,fill:l.ring}),(0,y.jsx)(t.Circle,{cx:50,cy:88,r:1.6,fill:l.bg}),(0,y.jsx)(t.Circle,{cx:50,cy:45,r:29,fill:"#FFF4E0",fillOpacity:.1,stroke:"#FFF4E0",strokeOpacity:.85,strokeWidth:2}),(0,y.jsx)(t.Path,{d:"M29 36 A23 23 0 0 1 41 22",stroke:"#FFFFFF",strokeOpacity:.85,strokeWidth:3.2,fill:"none",strokeLinecap:"round"}),(0,y.jsx)(t.Circle,{cx:28.5,cy:42,r:1.5,fill:"#FFFFFF",fillOpacity:.85}),'none'!==l.antenna?(0,y.jsx)(t.Line,{x1:50,y1:16,x2:50,y2:8,stroke:l.ring,strokeWidth:2}):null,'ball'===l.antenna?(0,y.jsx)(t.Circle,{cx:50,cy:6.5,r:3.3,fill:l.ring}):'star'===l.antenna?(0,y.jsx)(t.Path,{d:O(50,6.5,4.5),fill:l.ring}):null]})}function v({look:i,id:e,name:r,size:t=40}){const s=null!=i&&i>=1e3?f.AVATAR_OPTIONS.find(e=>e.look===i):void 0;return s?(0,y.jsx)(l.default,{source:{uri:s.dataUrl},style:{width:t,height:t},accessibilityLabel:s.name}):(0,y.jsx)($,{spec:null!=i?E(`${e??r}#look${i}`):E(e,r),size:t})}const P=i=>(i??'').replace(' (example)','').trim().toLowerCase();function M(i,e){const l=(0,c.useOwner)(i=>i.staff);return i?l.find(e=>e.id===i):e?l.find(i=>P(i.name)===P(e)):void 0}},996,[876,31,197,128,989,863,1225,1096,825,1384,15,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"notifSeedId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"headChefId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"gmId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"seedsFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useNotifs",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),p=r(d[5]),f=r(d[6]),c=r(d[7]);const l=(e,t)=>(0,o.uuidFrom)(`sched-notif:${t}:${e}`),S=()=>p.ROSTER.find(e=>'Head Chef'===e.level)?.id??p.ROSTER.find(e=>'chef'===e.app)?.id??'',b=()=>p.ROSTER.find(e=>'Manager'===e.level)?.id??'',h=e=>'anchorage'===e?(0,u.anchorageSeeds)(t=>l(e,t),S(),b()):[],O=()=>(new Date).toISOString(),v=(0,s.create)()((0,n.persist)((e,t)=>({items:[],snooze:{},ensure:i=>{const s=t().items,n=s.map(e=>(0,c.fixSupplierNames)(e.title)!==e.title||(0,c.fixSupplierNames)(e.message)!==e.message?{...e,title:(0,c.fixSupplierNames)(e.title),message:(0,c.fixSupplierNames)(e.message),updatedAt:O()}:e);n.some((e,t)=>e!==s[t])&&e({items:n});const o=new Set(t().items.map(e=>e.id)),u=h(i).filter(e=>!o.has(e.id)).map(e=>({...e,rid:i}));u.length&&e(e=>({items:[...e.items,...u]}))},add:(t,i)=>{const s=(0,f.uuid)();return e(e=>({items:[...e.items,{...i,id:s,rid:t,updatedAt:O()}]})),s},update:(t,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...i,updatedAt:O()}:e)})),remove:t=>e(e=>({items:e.items.flatMap(e=>e.id!==t?[e]:e.seed?[{...e,removed:!0,paused:!0,updatedAt:O()}]:[])})),resetSeeds:t=>{const i=new Map(h(t).map(e=>[e.id,e]));e(e=>{const s=e.items.map(e=>i.has(e.id)?{...i.get(e.id),rid:t,updatedAt:O()}:e),n=new Set(s.map(e=>e.id));return{items:[...s,...[...i.values()].filter(e=>!n.has(e.id)).map(e=>({...e,rid:t,updatedAt:O()}))]}})},setSnooze:(t,i)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[t,i]])}))}),{name:'covercharge-sched-notifs-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)}))},997,[1190,995,1191,1179,999,15,1099,1292]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"chairsId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rulesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useReminders",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"rulesOf",{enumerable:!0,get:function(){return A}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},n=_r(d[1]),s=_r(d[2]),u=_r(d[3]),o=_r(d[4]),l=_r(d[5]);const c=e=>(0,u.uuidFrom)(`reminder:chairs:${e}`),p=e=>(0,u.uuidFrom)(`break-rules:${e}`),f=()=>(new Date).toISOString(),b=(0,n.create)()((0,s.persist)((e,r)=>({reminders:[],rules:{},done:[],snooze:{},ensure:t=>{const n=r(),s={};n.reminders.some(e=>e.id===c(t))||(s.reminders=[...n.reminders,{...(0,o.defaultChairs)(c(t),t),rid:t}]),n.rules[t]||(s.rules={...n.rules,[t]:{...o.DEFAULT_BREAK_RULES,id:p(t)}}),Object.keys(s).length&&e(s)},add:(r,t)=>{const n=(0,l.uuid)();return e(e=>({reminders:[...e.reminders,{...t,id:n,rid:r,updatedAt:f()}]})),n},update:(r,t)=>e(e=>({reminders:e.reminders.map(e=>e.id===r?{...e,...t,updatedAt:f()}:e)})),remove:r=>e(e=>({reminders:e.reminders.flatMap(e=>e.id!==r?[e]:e.builtIn?[{...e,removed:!0,paused:!0,updatedAt:f()}]:[])})),resetReminder:r=>e(e=>({reminders:e.reminders.map(e=>e.id===r&&'chairs'===e.builtIn?{...(0,o.defaultChairs)(r,e.rid),rid:e.rid,updatedAt:f()}:e)})),setRules:(r,t)=>e(e=>({rules:{...e.rules,[r]:{...(0,o.clampRules)({...e.rules[r]??o.DEFAULT_BREAK_RULES,...t}),id:p(r),updatedAt:f()}}})),resetRules:r=>e(e=>({rules:{...e.rules,[r]:{...o.DEFAULT_BREAK_RULES,id:p(r),updatedAt:f()}}})),markDone:r=>e(e=>({done:[{...r,id:(0,l.uuid)(),at:r.at??f()},...e.done].slice(0,400)})),setSnooze:(r,t)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[r,t]])}))}),{name:'covercharge-reminders-v1',version:1,storage:(0,s.createJSONStorage)(()=>t.default)})),A=e=>(0,o.clampRules)(b.getState().rules[e]??o.DEFAULT_BREAK_RULES)},998,[1190,995,1191,1179,1183,1099]); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_FILTER_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOTIF_DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOTIF_GROUP_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"IN_APP_WINDOW_MINS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PUSH_WINDOW_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KITCHEN_OPEN_DAYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"TITLE_MAX",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MESSAGE_MAX",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validHm",{enumerable:!0,get:function(){return u}}),e.ukNow=p,Object.defineProperty(e,"timeOn",{enumerable:!0,get:function(){return m}}),e.notifDue=function(t,n,r=s){const o=p(n),d=m(t,o.dow);if(t.paused||t.removed||!u(d)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd,at:d};const f=l(d);return{due:o.mins>=f&&o.minst.days.includes(n));if(!r.length)return'No days ticked';const s=new Map;for(const n of r){const r=m(t,n);s.set(r,[...s.get(r)??[],n])}const o=t=>7===t.length?'Every day':t.map(t=>n[t]).join(', ');return[...s.entries()].map(([t,n])=>`${o(n)} at ${t}`).join('; ')+' (UK time)'},e.validateNotif=function(t){if(!t.title.trim())return'Give it a name.';if(t.title.length>f)return`Keep the name under ${f} letters.`;if(!t.message.trim())return'Type the message people will see.';if(t.message.length>c)return`Keep the message under ${c} letters.`;if(!u(t.time))return'Type the time as HH:MM, e.g. 21:00.';for(const n of Object.values(t.dayTimes??{}))if(!u(n))return'Type each day\u2019s time as HH:MM.';return t.days.length?t.recipients.staff.length||t.recipients.groups.length||(t.recipients.onShiftIn??[]).length?t.sendBy.inApp||t.sendBy.push?null:'Choose how to send it.':'Tick at least one person or group.':'Tick at least one day.'},e.anchorageSeeds=function(t,n,r){const s={staff:[n,r].filter(Boolean),groups:[]},o={inApp:!0,push:!0};return[{id:t('mills-milk'),seed:'mills-milk',title:'Mills milk order',message:'Make sure an order before 9:30',days:[...d],time:'21:00',dayTimes:{5:'20:55',0:'20:55'},recipients:s,sendBy:o},{id:t('peronis'),seed:'peronis',title:"Pieroni's order",message:"order Pieroni's by phone",days:[...d],time:'21:05',recipients:s,sendBy:o},{id:t('veg-second'),seed:'veg-second',title:'Veg order',message:'Order veg on the app before 11 PM',days:[...d],time:'21:15',recipients:s,sendBy:o},{id:t('reeds'),seed:'reeds',title:'Reids order',message:'Order Reids',days:[3,4],time:'21:25',recipients:s,sendBy:o},{id:t('spezbona'),seed:'spezbona',title:'Spes Bona order',message:'Do we need anything from Spes Bona for this week? Message Anna if we do for Friday delivery.',days:[3],time:'15:00',recipients:s,sendBy:o},{id:t('olsens'),seed:'olsens',title:"Olsen's order",message:"Place Olsen's order before 3:30 PM. By phone.",days:[2],time:'13:00',recipients:{staff:[r],groups:[]},sendBy:o},{id:t('allsons-list'),seed:'allsons-list',title:'Alsons drinks list',message:'Add anything extra to the Alsons drinks list.',days:[0],time:'20:00',recipients:{staff:['st-finn'],groups:[]},sendBy:o,open:{page:'orderlists',list:'allsons'}},{id:t('tea-towels'),seed:'tea-towels',title:'Tea towels',message:'Put a load of tea towels on to wash.',days:[...d],time:'15:00',recipients:{staff:[],groups:[],onShiftIn:['kp'],fallback:{staff:[],groups:['head_chef']}},sendBy:o},{id:t('rota-upload'),seed:'rota-upload',title:'Rota upload',message:"Make sure you have uploaded next week's rota.",days:[0],time:'20:50',recipients:s,sendBy:o}]};const t={kitchen:'On shift: Kitchen',foh:'On shift: Front of house',bar:'On shift: Bar',kp:'On shift: KPs',chefs:'On shift: Chefs'},n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],r={on_shift:'Everyone on shift',everyone:'Everyone',managers:'Owners and managers',head_chef:'Head Chef',kitchen:'Kitchen team',foh:'Front of house'},s=120,o=15,d=[3,4,5,6,0],f=60,c=160,u=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t),l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));function p(t){const r='number'==typeof t?new Date(t):t,s={};for(const t of new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(r))s[t.type]=t.value;return{dow:n.indexOf(String(s.weekday).slice(0,3)),mins:60*Number(s.hour)+Number(s.minute),ymd:`${s.year}-${s.month}-${s.day}`}}const m=(t,n)=>{const r=t.dayTimes?.[String(n)];return r&&u(r)?r:t.time};const h=t=>t.open?`./?open=${t.open.page}${t.open.list?`&list=${encodeURIComponent(t.open.list)}`:''}`:'./',y=(t,n)=>`${t.id}:${n}`,g=t=>(t??'').toLowerCase(),b=t=>t.level?['owner','manager'].includes(g(t.level)):['owner','manager'].includes(g(t.role)),O=t=>'head_chef'===g(t.role)||'head chef'===g(t.level)||'chef'===g(t.app)||/head chef/.test(g(t.job)),P=t=>'kitchen'===g(t.department)||/chef|kitchen|kp|porter/.test(g(t.job))||O(t),k=t=>/\bkp\b|kitchen porter/.test(g(t.job));function j(t,n){const r=g(n.department);return'kitchen'===t?P(n):'kp'===t?k(n):'chefs'===t?O(n)||/chef|commis/.test(g(n.job)):'bar'===t?'bar'===r||/\bbar/.test(g(n.job)):'front of house'===r||!r&&!P(n)&&!b(n)}function _(t,n,r=[]){const s=v(t.recipients,n,r),o=t.recipients.fallback;return s.length||!o?s:v({staff:o.staff,groups:o.groups},n,r)}const w=(t,n,r=[])=>!!t.recipients.fallback&&!v(t.recipients,n,r).length;function v(t,n,r){const s=t,o=n.filter(t=>!1!==t.active),d=new Set;for(const t of s.staff)o.some(n=>n.id===t)&&d.add(t);for(const t of s.groups)for(const n of o)('everyone'===t||'on_shift'===t&&r.includes(n.id)||'managers'===t&&b(n)||'head_chef'===t&&O(n)||'kitchen'===t&&P(n)||'foh'===t&&!P(n)&&!b(n))&&d.add(n.id);for(const t of s.onShiftIn??[])for(const n of o)r.includes(n.id)&&j(t,n)&&d.add(n.id);return[...d].sort()}const M=t=>({id:t.external_ref,role:t.roles?.key??void 0,job:t.job_title??'',department:t.department??'',active:!1!==t.active}),T=(t,n,r,s=[])=>_(t,r,s).includes(n)},999,[]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shiftNow=k,e.useShiftReminders=function({rid:c,staffId:u,name:h,kitchen:b,onStartBreak:S}){const D=(0,t.useRef)(S);D.current=S;const v=(0,t.useRef)(h);v.current=h;const I=(0,s.useReminders)(t=>`${t.reminders.length}:${t.done.length}:${JSON.stringify(t.rules[c]??{})}:${t.reminders.map(t=>t.updatedAt??'').join()}`),w=(0,r.useOwner)(t=>`${t.attendance.length}:${t.shifts.length}:${t.leave.length}`);(0,t.useEffect)(()=>{s.useReminders.getState().ensure(c);const t=()=>{const t=f(),{att:h,shift:S,on:I}=k(u,t),w=s.useReminders.getState();if(!I||!u)return w.reminders.forEach(t=>(0,a.dismissNotice)(`rem:${t.id}`)),void(0,a.dismissNotice)('break-reminder');const $=(0,s.rulesOf)(c),R=h?.in?new Date(h.in).getTime():void 0,p=!!h?.breaks?.length,y=`break:${h?.id??S?.id??''}`,M=(0,o.breakDue)({now:t,clockIn:R,shiftStart:S?l(S.date,S.start):void 0,shiftEnd:S?l(S.date,S.end):void 0,rotaBreak:void 0!==S?.breakAt?l(S.date,S.breakAt):void 0,hadBreak:p,rules:$},w.snooze[y]??0);if(M){const r=R??(S?l(S.date,S.start):t);(0,a.notify)({id:'break-reminder',tone:3===M.stage?'warn':'normal',icon:'\ud83e\uded6',kicker:'BREAK REMINDER',testID:'break-reminder',timeoutMs:null,title:M.label,body:`${R?'Clocked in':'Shift started'} at ${m(r)}. ${3===M.stage?'':'Over 6 hours needs a 20-minute break.'}`.trim(),actions:[{label:'Start break',testID:'break-reminder-start',onPress:()=>{if(!h)return D.current?.(),void(0,a.notify)({id:'break-clock-first',title:'Clock in first, then tap Start break.',body:'Your break is started from the clock screen.',timeoutMs:6e3});const t=new Date(f()).toISOString();(0,n.clockAction)('break_start',{rid:c,staffId:u,date:t.slice(0,10),at:t}).then(t=>{t.ok||(0,a.notify)({id:'break-blocked',tone:'warn',title:'Break not started',body:t.message,timeoutMs:1e4}),D.current?.()})}},{label:'Later',kind:'ghost',testID:'break-reminder-later',onPress:()=>{s.useReminders.getState().setSnooze(y,f()+6e4*$.snoozeMins),(0,a.dismissNotice)('break-reminder')}}]})}else(0,a.dismissNotice)('break-reminder');const N=r.useOwner.getState().staff.find(t=>t.id===u),O=b??(0,d.inKitchen)(N);for(const n of w.reminders){if(n.rid!==c)continue;const r=`rem:${n.id}`;if(n.removed||!(0,o.audienceMatch)(n.audience,O)){(0,a.dismissNotice)(r);continue}const{due:d,forDate:m}=(0,o.reminderDue)(n,t),l=w.done.find(t=>t.reminderId===n.id&&t.forDate===m),k=`rem:${n.id}:${m}`;!d||l||(w.snooze[k]??0)>t?(0,a.dismissNotice)(r):(0,a.notify)({id:r,icon:'\ud83e\ude91',kicker:'REMINDER',title:n.text,testID:'venue-reminder',timeoutMs:null,body:`For everyone on shift${'all'===n.audience?'':'kitchen'===n.audience?' in the kitchen':' front of house'}. Tap Done once it\u2019s done.`,actions:[{label:'Done',testID:'venue-reminder-done',onPress:()=>s.useReminders.getState().markDone({rid:c,reminderId:n.id,forDate:m,at:new Date(f()).toISOString(),staffRef:u,staffName:v.current.replace(' (example)','')})},{label:'Later',kind:'ghost',onPress:()=>s.useReminders.getState().setSnooze(k,f()+6e4*$.snoozeMins)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[c,u,I,w,b])};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]);const f=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock).getTime()}catch{return Date.now()}},m=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=(t,n)=>{const[r,s,o]=t.split('-').map(Number);return new Date(r,s-1,o,Math.floor(n),Math.round(n%1*60)).getTime()};function k(t,n){const s=r.useOwner.getState(),a=(0,r.openShiftOf)(s.attendance,t,new Date(n)),d=(0,o.ukClock)(n).ymd,c=(0,u.workingShifts)(s.shifts,s.leave),f=c.find(r=>r.staffId===t&&r.date===d&&!1!==r.published&&l(r.date,r.start)<=n&&nn.staffId===t&&n.date===d&&!1!==n.published):void 0),m=!a&&!!f&&s.attendance.some(n=>n.staffId===t&&n.date===d&&!!n.out&&new Date(n.out).getTime()>=l(f.date,f.start));return{att:a,shift:f,on:!!a||!!f&&!m}}},1000,[31,1178,863,998,1183,980,1192,881,972]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"START_PAIR",{enumerable:!0,get:function(){return t}});const t=(()=>{try{if('undefined'==typeof window||!window.location)return null;const t=new URL(window.location.href),n=new URLSearchParams(t.hash.replace(/^#/,'')),c=t.searchParams.get('pair')||n.get('pair');if(!c)return null;t.searchParams.delete('pair'),n.delete('pair');const o=n.toString();return window.history.replaceState(null,'',t.pathname+(t.search?t.search:'')+(o?`#${o}`:'')),c}catch{return null}})()},1001,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1040,[31,128,953,825,818,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCKED_STEPS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"BLOCKED_INTRO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"BLOCKED_SPOKEN",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"STILL_OFF",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"ALERTS_PROMPT_ON",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"usePushPrompt",{enumerable:!0,get:function(){return O}}),_e.bannerFor=L,_e.titleFor=R,_e.chromeUrlFor=B,_e.AlertsBanner=function(){const e=O(e=>e.mode);if(!e)return null;const{line:n,action:o}=L(e);return(0,C.jsxs)(r.default,{testID:"alerts-banner",accessibilityRole:"button",accessibilityLabel:`${n} ${o}.`,accessibilityHint:"Opens the steps",onPress:()=>O.setState({open:!0}),style:{alignSelf:'center',maxWidth:420,width:'100%',minHeight:48,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1,borderColor:l.colours.accentBorder,backgroundColor:l.colours.surface2},children:[(0,C.jsx)(H,{size:18}),(0,C.jsxs)(t.Text,{testID:"alerts-banner-text",style:{color:'#F2E6C9',fontSize:15,textAlign:'center',flexShrink:1},children:[n," ",(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontWeight:'700',textDecorationLine:'underline'},children:o})]})]})},_e.PushPrompt=function(){const e=(0,s.useSync)(e=>e.kind),u=(0,s.useSync)(e=>e.staffRef),p=(0,s.useSync)(e=>e.venueId),b=O(e=>e.mode),m=O(e=>e.open),x=e=>O.setState(e?{mode:e}:{mode:null,open:!1}),[w,A]=(0,n.useState)(null),[L,_]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!k.includes(f.APP_VARIANT)||!P)return;if(h.PITCH)return globalThis.__pitchPushPrompt=e=>{A(null),O.setState({mode:e,open:!!e})},void(globalThis.__pitchPushBanner=e=>{A(null),O.setState({mode:e,open:!1})});if('staff'!==e||!u||!p)return;let t=!0;const n=async()=>{let e='unsupported';if(!(0,c.inApkWebView)()){try{e=await(0,c.pushState)()}catch{return}if(!t)return;if('on'===e)return x(null),void(0,c.resaveIfAllowed)().catch(()=>{});if('off'===e&&'undefined'!=typeof Notification&&'granted'===Notification.permission){let e=!1;try{e=await(0,c.resaveIfAllowed)()}catch{}if(!t)return;if(e)return void x(null)}}const n=z(e);t&&(n&&Date.now()-D()>I?O.setState({mode:n}):x(null))};n();const o=()=>{'undefined'!=typeof document&&'visible'===document.visibilityState&&n()};try{document.addEventListener('visibilitychange',o)}catch{}return()=>{t=!1;try{document.removeEventListener('visibilitychange',o)}catch{}}},[e,u,p]),!b||!m)return null;const F=R(b),N={minHeight:64,borderRadius:16,justifyContent:'center',alignItems:'center',paddingHorizontal:20,backgroundColor:l.colours.gold,alignSelf:'stretch'},W=(e,n)=>(0,C.jsxs)(i.default,{style:{flexDirection:'row',gap:12,alignItems:'center',alignSelf:'stretch'},children:[(0,C.jsx)(i.default,{style:{width:30,height:30,borderRadius:15,borderWidth:1.5,borderColor:l.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontSize:15,fontWeight:'700'},children:e})}),(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,flex:1,lineHeight:22},children:n})]},e);return(0,C.jsx)(i.default,{testID:"alerts-prompt-backdrop",style:{position:'fixed',left:0,right:0,top:0,bottom:0,zIndex:2147483100,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:18},children:(0,C.jsxs)(i.default,{testID:"alerts-prompt",accessibilityRole:'dialog',accessibilityLabel:F,style:{width:'100%',maxWidth:380,backgroundColor:l.colours.surface2,borderColor:l.colours.accentBorder,borderWidth:1,borderRadius:22,paddingHorizontal:22,paddingTop:22,paddingBottom:18,alignItems:'center',gap:14,shadowColor:'#000',shadowOpacity:.5,shadowRadius:24,shadowOffset:{width:0,height:10}},children:[(0,C.jsx)(i.default,{style:{position:'absolute',top:10,right:10},children:(0,C.jsx)(y.GoldClose,{testID:"alerts-prompt-close",label:"Close",onPress:()=>{A(null),O.setState({open:!1})}})}),(0,C.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1.5,borderColor:l.colours.gold,alignItems:'center',justifyContent:'center',marginTop:6},children:(0,C.jsx)(H,{})}),(0,C.jsx)(t.Text,{testID:"alerts-prompt-title",accessibilityRole:"header",style:{color:l.colours.goldLight,fontSize:22,fontWeight:'700',textAlign:'center',lineHeight:28,paddingHorizontal:8},children:F}),'off'===b?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(r.default,{testID:"alerts-prompt-turn-on",accessibilityRole:"button",disabled:L,accessibilityState:{disabled:L,busy:L},accessibilityLabel:"Turn on alerts. Your phone will then ask to allow notifications: tap Allow.",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{const e=await(0,c.turnOnPush)();if(e.ok)return void x(null);A(e.message);const t=z(await(0,c.pushState)());x(t||null)}catch{A('Could not turn on alerts. Please try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Turning on\u2026':'Turn on alerts'})}),(0,C.jsxs)(t.Text,{testID:"alerts-prompt-allow",style:{color:'#F2E6C9',fontSize:17,textAlign:'center'},children:["When your phone asks, tap ",(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontWeight:'700'},children:"Allow"}),"."]})]}):null,'blocked'===b?(0,C.jsxs)(i.default,{testID:"alerts-prompt-blocked",accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"assertive",accessibilityLabel:j,style:{alignSelf:'stretch',gap:8},children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:17,textAlign:'center'},children:T}),S.map((e,t)=>W(t+1,e))]}):null,'blocked'===b?(0,C.jsx)(r.default,{testID:"alerts-prompt-recheck",accessibilityRole:"button",disabled:L,accessibilityState:{disabled:L,busy:L},accessibilityLabel:"I\u2019ve allowed it. Check again.",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{if('blocked'===await(0,c.pushState)())return void A(v);const e=await(0,c.turnOnPush)();if(e.ok)return void x(null);A(e.message);const t=z(await(0,c.pushState)());x(t)}catch{A('Could not check alerts. Please try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Checking\u2026':'I\u2019ve allowed it, check again'})}):null,'ios'===b?(0,C.jsxs)(i.default,{testID:"alerts-prompt-ios",style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,textAlign:'center'},children:"iPhone only sends alerts to apps on the Home Screen. First:"}),W(1,'Tap the Share button (the square with the arrow) in Safari.'),W(2,'Tap Add to Home Screen, then Add.'),W(3,'Open CoverCharge from your Home Screen.'),W(4,'Tap Turn on alerts, then Allow.')]}):null,'apk'===b||'webview'===b?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,textAlign:'center'},children:'apk'===b?'The phone app can\u2019t show alerts when it\u2019s closed. Chrome can. You\u2019ll stay signed in as you.':'This browser can\u2019t get alerts. Open CoverCharge in Chrome.'}),(0,C.jsx)(r.default,{testID:"alerts-prompt-open-chrome",accessibilityRole:"button",disabled:L,accessibilityLabel:"Open CoverCharge in Chrome to turn on alerts",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{let e=null;if('apk'===b){const t=await(0,s.makeChromeHandover)();if(!t.ok)return void A(t.message);e=t.code}const t=B(window.location.href,e,'apk'===b);if(h.PITCH)return A('Opening Chrome\u2026'),void(globalThis.__pitchLastChromeUrl=t);A('Opening Chrome\u2026 Then tap Turn on alerts there, and Allow.');try{window.location.href=t}catch{await o.default.openURL(t)}}catch{A('Could not open Chrome. Check your connection and try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Opening\u2026':'Open in Chrome'})}),(0,C.jsx)(t.Text,{style:{color:'#CFC6B4',fontSize:14,textAlign:'center'},children:"In Chrome: tap Turn on alerts, then Allow."})]}):null,w?(0,C.jsx)(i.default,{accessibilityLiveRegion:"assertive",accessibilityRole:'alert',children:(0,C.jsx)(t.Text,{testID:"alerts-prompt-msg",style:{color:l.colours.goldLight,fontSize:15,textAlign:'center'},children:w})}):null,(0,C.jsx)(r.default,{testID:"alerts-prompt-later",accessibilityRole:"button",accessibilityLabel:"Not now. Hide this until tomorrow",onPress:()=>{E(),A(null),x(null)},style:{minHeight:48,justifyContent:'center',paddingHorizontal:24},children:(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontSize:17,textDecorationLine:'underline'},children:"Not now"})})]})})};var t=_r(d[0]),n=_r(d[1]),o=e(_r(d[2]));_r(d[3]);var r=e(_r(d[4])),i=e(_r(d[5])),l=_r(d[6]),s=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),f=_r(d[11]),p=_r(d[12]),b=_r(d[13]),y=_r(d[14]),m=_r(d[15]),x=e(m),C=_r(d[16]);const w='cc-alerts-prompt-v1',S=['In Chrome, tap the three dots at the top right, then Settings.','Tap Site settings, then Notifications.','Find CoverCharge (covercharge-apps) under Blocked, tap it, and choose Allow.','Come back here and tap \u201cI\u2019ve allowed it, check again\u201d.'],T='Chrome has alerts switched off for CoverCharge on this phone, so the app can\u2019t ask again. To switch them back on:',j=`${T} ${S.map((e,t)=>`${t+1}. ${e}`).join(' ')}`,v='Alerts are still off in Chrome. Follow the steps above, then tap check again.',I=864e5,k=['owner','staff','chef'],P=!(b.IS_ISOLATED_VENUE||b.IS_QUEUED_VENUE||b.IS_GREENSIDE||b.IS_ABBOTSFORD||b.IS_KIRKTON),A=k.includes(f.APP_VARIANT)&&P&&!h.PITCH,O=(0,u.create)(()=>({mode:null,open:!1}));function L(e){return{line:'Alerts are off on this phone.',action:'off'===e?'Tap to turn on':'ios'===e?'Tap to see how':'apk'===e||'webview'===e?'Tap to open in Chrome':'Tap to fix'}}function R(e){return'apk'===e||'webview'===e?'Open CoverCharge in Chrome to turn on alerts':'ios'===e?'Add CoverCharge to your Home Screen':'blocked'===e?'Turn alerts back on in Chrome':'Turn on alerts so you don\u2019t miss orders and reminders'}const _=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent);function D(){try{const e=JSON.parse(localStorage.getItem(w)||'{}');return Number(e.later||0)}catch{return 0}}function E(){try{localStorage.setItem(w,JSON.stringify({later:Date.now(),version:p.APP_VERSION}))}catch{}}function z(e){return _()?'apk':(0,c.inApkWebView)()?'webview':'off'===e?'off':'blocked'===e?'blocked':'ios-home-screen'===e?'ios':null}function B(e,t,n){const o=new URL(e),r=`${o.origin}${o.pathname.replace(/[^/]*$/,'')}index.html${t?`#ccchrome=${t}`:''}`;return n?`googlechrome://navigate?url=${encodeURIComponent(r)}`:`intent://${o.host}${o.pathname.replace(/[^/]*$/,'')}index.html#Intent;scheme=https;package=com.android.chrome;end`}function H({size:e=32}={}){return(0,C.jsxs)(x.default,{width:e,height:e,viewBox:"0 0 24 24",accessible:!1,pointerEvents:"none",children:[(0,C.jsx)(m.Path,{d:"M6 16 V11 a6 6 0 0 1 12 0 V16 l1.5 2 H4.5 Z",stroke:l.colours.gold,strokeWidth:1.7,strokeLinejoin:"round",fill:"none"}),(0,C.jsx)(m.Path,{d:"M10 20.5 a2 2 0 0 0 4 0",stroke:l.colours.gold,strokeWidth:1.7,strokeLinecap:"round",fill:"none"})]})}},1041,[874,31,240,123,264,128,825,824,1389,995,2,807,1044,5,835,989,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"currentScrollY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"screenGeneration",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"restoreScroll",{enumerable:!0,get:function(){return o}}),_e.useScrollMemory=function(u){const c=(0,e.useRef)(0),o=(0,e.useRef)(0),l=(0,e.useRef)(0),s=(0,e.useRef)(0),f=(0,e.useRef)(0),v=(0,e.useRef)(null),y=(0,e.useRef)([]),h=()=>{y.current.forEach(clearTimeout),y.current=[]},b=()=>{const e=v.current;null!=e&&(u.current?.scrollTo({y:e,animated:!1}),f.current-s.current>=e-2&&(c.current=e,o.current=e,v.current=null,h()))},p=(0,e.useCallback)(e=>{if(h(),v.current=Math.max(0,e),e<=0)return v.current=null,u.current?.scrollTo({y:0,animated:!1}),c.current=0,void(o.current=0);for(const e of[0,30,80,160,320,600,1e3,1600,2500])y.current.push(setTimeout(b,e));y.current.push(setTimeout(()=>{v.current=null},2600))},[]);t={y:()=>o.current,restore:p};const R=(0,e.useCallback)(()=>{n++;return o.current},[]);return{props:{scrollEventThrottle:32,onScroll:e=>{const t=e.nativeEvent.contentOffset.y;c.current=t,s.current=e.nativeEvent.layoutMeasurement.height,f.current=e.nativeEvent.contentSize.height,Date.now()-l.current>250&&null==v.current&&(o.current=t)},onScrollBeginDrag:()=>{v.current=null,h()},onContentSizeChange:(e,t)=>{f.current=t,l.current=Date.now(),b()},onLayout:e=>{s.current=e.nativeEvent.layout.height}},restore:p,leave:R}};var e=r(d[0]);let t=null,n=0;const u=()=>t?t.y():0,c=()=>n,o=e=>t?.restore(e)},1042,[31]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBackLayers",{enumerable:!0,get:function(){return f}}),_e.runBackLayer=function(){const e=f.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(e,n,o=!0){const s=(0,t.useRef)(n);s.current=n,(0,t.useEffect)(()=>{if(!e)return;const t=++y,n=(0,u.currentScrollY)(),l=(0,u.screenGeneration)();return f.setState(e=>({layers:[...e.layers,{id:t,fn:()=>s.current(),own:o}]})),()=>{f.setState(e=>({layers:e.layers.filter(e=>e.id!==t)})),(0,u.screenGeneration)()===l&&(0,u.restoreScroll)(n)}},[e,o])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"BACK_GUTTER",{enumerable:!0,get:function(){return w}}),_e.BackTitleRow=function({back:e,onBack:n,title:s}){const[l,u]=(0,t.useState)(0),[f,y]=(0,t.useState)({w:96,h:48}),[p,b]=(0,t.useState)(0),S=Array.from(new Set(String(s??'').split(/\s+/).filter(Boolean)));String(s??'').length>=20&&S.length>=3&&S.push('00000000');const v=Math.max(w,Math.ceil(f.w)+4),j=e&&l>0&&l-2*v0&&(0===l||0===p);return(0,h.jsxs)(o.default,{testID:"screen-title-row",onLayout:e=>u(Math.round(e.nativeEvent.layout.width)),style:{minHeight:44,justifyContent:'center',alignItems:'center',paddingHorizontal:e&&!j?v:0,paddingTop:j?f.h:0},children:[e?(0,h.jsx)(o.default,{style:{position:'absolute',left:0,top:0},onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width),n=Math.round(e.nativeEvent.layout.height);y(e=>e.w===t&&e.h===n?e:{w:t,h:n})},children:(0,h.jsx)(g,{onPress:n})}):null,(0,h.jsx)(c.T,{size:22,weight:"bold",center:!0,style:B?{opacity:0}:void 0,accessibilityRole:"header",children:s}),e&&S.length?(0,h.jsx)(o.default,{"aria-hidden":!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{position:'absolute',left:0,top:0,opacity:0,alignItems:'flex-start'},onLayout:e=>b(Math.ceil(e.nativeEvent.layout.width)),children:S.map(e=>(0,h.jsx)(c.T,{size:22,weight:"bold",numberOfLines:1,style:{alignSelf:'flex-start'},children:e},e))}):null]})},_e.BackButton=g,_e.useWebBack=function(e){const n=(0,t.useRef)(e);n.current=e,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.history?.pushState)return;const e=()=>{try{window.history.pushState({...window.history.state??{},ccBack:Date.now()},'',window.location.href)}catch{}};e();const t=t=>{n.current()&&(t.stopImmediatePropagation?.(),e())};return window.addEventListener('popstate',t,!0),()=>window.removeEventListener('popstate',t,!0)},[])};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]);const f=(0,s.create)(()=>({layers:[]}));let y=0;const p=()=>f(e=>e.layers.some(e=>e.own)),w=100;function g({onPress:e,testID:t="screen-back",label:o="Back"}){return(0,h.jsx)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,h.jsxs)(c.T,{size:18,weight:"semibold",colour:l.colours.gold,children:["\u2039 ",o]})})}},1043,[31,123,264,128,995,825,818,1042,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.184'},1044,[]); +__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()})},1045,[31,1075]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTasksProgress=function(e,s){const t=(0,r.useDailyTasks)(t=>t.people[(0,r.personKey)(e,s)]?.tasks)??[],i=(0,r.useDailyTasks)(e=>e.ticks),{ymd:l,dow:o}=T();return(0,c.progress)(t,i,s,l,o)},_e.DailyTasksEditor=j,_e.MyTasksToday=function({rid:e,staffId:s,name:t,onShift:i}){const u=(0,r.useDailyTasks)(t=>t.people[(0,r.personKey)(e,s)]?.tasks)??[],h=(0,r.useDailyTasks)(e=>e.ticks),{ymd:y,dow:x}=T(),p=(0,c.tasksFor)(u,x);if(!s||!p.length)return null;const f=(0,c.progress)(u,h,s,y,x);return(0,k.jsx)(o.default,{testID:"my-tasks-today",children:(0,k.jsxs)(n.Card,{children:[(0,k.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(n.T,{weight:"semibold",colour:d.colours.gold,children:"My tasks today"}),(0,k.jsx)(n.Badge,{kind:f.done===f.total?'gold':'neutral',label:`${f.done} of ${f.total}`})]}),i?null:(0,k.jsx)(n.Muted,{size:12,children:"You\u2019re not on shift right now. You can still tick these when you are."}),p.map(c=>{const u=h.find(t=>t.id===(0,r.tickId)(e,s,c.id,y));return(0,k.jsxs)(l.default,{testID:`my-task-${c.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:!!u},disabled:!i,onPress:()=>r.useDailyTasks.getState().toggleTick(e,s,c.id,y,{id:s,name:t.replace(' (example)','')}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:8,opacity:i?1:.6},children:[(0,k.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:1.5,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:u?'#2a2414':'transparent'},children:u?(0,k.jsx)(n.T,{colour:d.colours.gold,children:"\u2713"}):null}),(0,k.jsxs)(o.default,{style:{flex:1},children:[(0,k.jsx)(n.T,{style:{textDecorationLine:u?'line-through':'none'},children:c.text}),u?(0,k.jsxs)(n.Muted,{size:12,children:["Done at ",b(u.at)]}):null]})]},c.id)}),(0,k.jsx)(n.Muted,{size:12,children:"Tip: tick each one as you finish it. Your manager sees how you\u2019re getting on. They start fresh every day."})]})})},_e.TaskLibrarySettings=function({rid:e}){(0,i.useEffect)(()=>{r.useDailyTasks.getState().ensure(e)},[e]);const t=(0,r.useDailyTasks)(s=>s.library[e]?.items)??[],[l,u]=(0,i.useState)(''),[h,x]=(0,i.useState)({}),f=r.useDailyTasks.getState(),b=s=>f.setLibrary(e,s);return(0,k.jsxs)(o.default,{style:{gap:8},testID:"task-library",children:[(0,k.jsx)(n.Muted,{size:13,children:"Tip: these are quick picks when you add someone\u2019s daily tasks (Staff & roles \u203a a person \u203a Daily tasks). You can always type a new one there too."}),t.map((e,i)=>(0,k.jsxs)(n.Row,{gap:6,style:{opacity:e.archived?.5:1},children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:`Rename ${e.text}`,value:h[e.id]??e.text,onChangeText:s=>x(t=>({...t,[e.id]:s})),onBlur:()=>{const s=(0,c.cleanTaskText)(h[e.id]??'');s&&s!==e.text&&b(t.map(t=>t.id===e.id?{...t,text:s}:t))},style:{...p,flex:1,minWidth:0}}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2191",disabled:0===i,onPress:()=>b((0,c.move)(t,i,-1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2193",disabled:i===t.length-1,onPress:()=>b((0,c.move)(t,i,1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>b(t.map(s=>s.id===e.id?{...s,archived:!s.archived}:s))})]},e.id)),(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:"New library task",testID:"task-lib-new",value:l,onChangeText:u,placeholder:"e.g. Check the beer garden",placeholderTextColor:d.colours.muted,style:{...p,flex:1}}),(0,k.jsx)(n.Button,{small:!0,label:"Add",disabled:!(0,c.cleanTaskText)(l),onPress:()=>{b([...t,{id:(0,y.uuid)(),text:(0,c.cleanTaskText)(l)}]),u('')}})]})]})},_e.KitchenTeamTasks=function({rid:e,actor:s}){const t=(0,x.useOwner)(e=>e.staff).filter(e=>e.active&&s&&(0,c.canEditTasks)(s,e));return(0,k.jsxs)(o.default,{style:{gap:10},testID:"kitchen-team-tasks",children:[(0,k.jsx)(n.Muted,{size:13,children:"Tip: set the daily tasks for your kitchen team here. They see them as \u2018My tasks today\u2019 when they\u2019re on shift and tick them off. Your own list and front of house lists are set by a manager."}),s?null:(0,k.jsx)(n.Muted,{children:"Sign in to change your team\u2019s tasks."}),s&&!t.length?(0,k.jsx)(n.Muted,{children:"No kitchen staff found. A manager can set each person\u2019s department in Staff & roles."}):null,t.map(t=>(0,k.jsxs)(n.Card,{children:[(0,k.jsx)(n.T,{weight:"semibold",children:(0,x.staffLabel)(t).replace(' (example)','')}),(0,k.jsxs)(n.Muted,{size:12,children:[t.job,t.dept?` \xb7 ${t.dept}`:'']}),(0,k.jsx)(j,{rid:e,person:t,actor:s})]},t.id))]})};var s=_r(_d[0]),t=_r(_d[1]),i=_r(_d[2]),l=e(_r(_d[3])),o=e(_r(_d[4])),n=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),k=_r(_d[13]);const p={minHeight:42,borderRadius:10,borderWidth:1,borderColor:d.colours.hairline,backgroundColor:d.colours.surface2,color:d.colours.text,paddingHorizontal:10,fontSize:15},f=[1,2,3,4,5,6,0],b=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),T=(e=Date.now())=>{const s=(0,u.ukClock)(e);return{ymd:s.ymd,dow:new Date(`${s.ymd}T12:00:00Z`).getUTCDay()}};function j({rid:e,person:u,actor:y}){(0,i.useEffect)(()=>{r.useDailyTasks.getState().ensure(e)},[e]);const x=(0,r.useDailyTasks)(s=>s.people[(0,r.personKey)(e,u.id)]?.tasks)??[],j=((0,r.useDailyTasks)(s=>s.library[e]?.items)??[]).filter(e=>!e.archived),w=(0,r.useDailyTasks)(e=>e.ticks),[D,v]=(0,i.useState)(!1),[C,S]=(0,i.useState)(''),[$,I]=(0,i.useState)(null),M=r.useDailyTasks.getState(),P=(0,c.canEditTasks)(y,u),{ymd:R,dow:L}=T(),z=(0,c.progress)(x,w,u.id,R,L),B=s=>M.setTasks(e,u.id,s),A=e=>{const s=x;B(x.filter(s=>s.id!==e.id)),(0,h.notify)({id:`task-undo-${e.id}`,title:`Removed \u201c${e.text}\u201d`,timeoutMs:8e3,actions:[{label:'Undo',testID:'task-undo',onPress:()=>B(s)}]})};return(0,k.jsxs)(o.default,{testID:`tasks-${u.id}`,style:{gap:6},children:[(0,k.jsx)(l.default,{accessibilityRole:"button",testID:`tasks-open-${u.id}`,onPress:()=>v(!D),children:(0,k.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(n.T,{weight:"semibold",colour:d.colours.gold,children:["Daily tasks ",D?'\u25b4':'\u25be']}),(0,k.jsx)(n.Muted,{size:12,children:x.length?`${z.done} of ${z.total} done today`:'None yet'})]})}),D?(0,k.jsxs)(o.default,{style:{gap:6},children:[x.map((s,i)=>{const l=w.find(t=>t.id===(0,r.tickId)(e,u.id,s.id,R));return(0,k.jsxs)(o.default,{testID:`task-row-${i}`,style:{borderTopWidth:1,borderColor:d.colours.hairline,paddingTop:6,gap:4},children:[(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsxs)(n.T,{style:{flex:1},colour:l?d.colours.gold:d.colours.text,children:[l?'\u2713 ':'',s.text]}),P?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2191",accessibilityLabel:`Move ${s.text} up`,disabled:0===i,onPress:()=>B((0,c.move)(x,i,-1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2193",accessibilityLabel:`Move ${s.text} down`,disabled:i===x.length-1,onPress:()=>B((0,c.move)(x,i,1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"Days",onPress:()=>I($===s.id?null:s.id)}),(0,k.jsx)(t.GoldClose,{size:"sm",testID:`task-remove-${i}`,label:`Remove ${s.text}`,onPress:()=>A(s)})]}):null]}),(0,k.jsxs)(n.Muted,{size:12,children:[s.days?.length?s.days.map(e=>c.TASK_DAY_NAMES[e]).join(', '):'Every day',l?` \xb7 ticked by ${l.byName.split(' ')[0]} at ${b(l.at)}`:'']}),$===s.id?(0,k.jsx)(n.Row,{wrap:!0,gap:4,children:f.map(e=>{const t=!!s.days?.includes(e);return(0,k.jsx)(n.Chip,{label:c.TASK_DAY_NAMES[e],selected:t,onPress:()=>B(x.map(i=>i.id===s.id?{...i,days:t?(i.days??[]).filter(s=>s!==e):[...i.days??[],e].sort()}:i))},e)})}):null]},s.id)}),P?(0,k.jsxs)(o.default,{style:{gap:6},children:[(0,k.jsx)(n.Row,{wrap:!0,gap:4,children:j.filter(e=>!x.some(s=>s.text.toLowerCase()===e.text.toLowerCase())).slice(0,12).map(s=>(0,k.jsx)(n.Chip,{testID:"task-lib-chip",label:`${s.text}`,onPress:()=>M.addTask(e,u.id,s.text,s.id)},s.id))}),(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:"New task",testID:`task-new-${u.id}`,value:C,onChangeText:S,placeholder:"Type a task, e.g. Restock the bar fridges",placeholderTextColor:d.colours.muted,style:{...p,flex:1},onSubmitEditing:()=>{(0,c.cleanTaskText)(C)&&(M.addTask(e,u.id,C),S(''))}}),(0,k.jsx)(n.Button,{small:!0,testID:`task-add-${u.id}`,label:"Add",disabled:!(0,c.cleanTaskText)(C),onPress:()=>{M.addTask(e,u.id,C),S('')}})]})]}):(0,k.jsx)(n.Muted,{size:12,children:'staff'===y?.role?'You can\u2019t change this list.':''})]}):null]})}},1046,[874,835,31,264,128,818,825,1181,1182,1183,980,1099,863,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.readBack=B,_e.ReviewSheet=L,_e.Bars=z,_e.CashCharts=A,_e.CashUpScreen=function(e){return e.closer?(0,$.jsx)(N,{rid:e.rid,tonight:e.today,who:e.who}):(0,$.jsx)(E,{...e})},_e.CloserCashUp=N,_e.PastDayCard=O,_e.TodaysTipsCard=function({rid:e,today:t,big:s}){const a=(0,f.useTipsShow)(e),o=(0,f.useCashUp)(e=>e.tips).filter(s=>s.rid===e&&(s.date===t||s.date===(0,x.addDaysYmd)(t,-1))).sort((e,t)=>t.date.localeCompare(e.date))[0],l=G(o?.total??0);return a.showToday&&o?(0,$.jsx)(p.Card,{highlight:y.colours.gold,children:(0,$.jsxs)(c.default,{testID:"todays-tips",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,$.jsx)(Y,{n:Math.ceil(o.total/25)}),(0,$.jsxs)(c.default,{style:{flex:1,gap:2},children:[(0,$.jsx)(p.T,{size:12,weight:"semibold",colour:y.colours.gold,style:{letterSpacing:1.5},children:o.date===t?'TODAY\u2019S TIPS':'LAST NIGHT\u2019S TIPS'}),(0,$.jsx)(p.T,{size:s?40:32,weight:"bold",colour:y.colours.goldLight,children:P(l)}),(0,$.jsxs)(p.Muted,{children:["Cash + card tips for the whole team \xb7 ",M(o.date),". Thank you, everyone."]})]})]})}):null},_e.TipsPotCard=V,_e.postTipsNotice=K,_e.latestDayTips=Z,_e.useTipsPosted=function(e,t,s=!0){const a=(0,f.useCashUp)(e=>e.tips),o=(0,f.useTipsShow)(e);(0,l.useEffect)(()=>{if(!s||!o.showToday)return;const l=Z(a,e,t);l&&K(e,l.date,l.total,t)},[e,t,a,o.showToday,s])},_e.CashUpSettings=function({rid:e}){const t=U(e),s=(t,s)=>f.useCashUp.getState().setFields(e,t,s),l=(e,l)=>(0,$.jsxs)(c.default,{style:{gap:6},children:[(0,$.jsx)(p.T,{weight:"semibold",children:l}),t[e].map((l,n)=>(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(o.TextInput,{testID:`cf-${e}-${l.key}`,value:l.label,onChangeText:a=>s(e,t[e].map((e,t)=>t===n?{...e,label:a.slice(0,40)}:e)),style:{flex:1,minHeight:38,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',color:y.colours.text,paddingHorizontal:8}}),(0,$.jsx)(p.Muted,{children:'money'===l.kind?'\xa3':'number'===l.kind?'#':'text'}),l.fixed?(0,$.jsx)(p.Muted,{children:"needed"}):(0,$.jsx)(a.GoldClose,{size:"sm",label:`Remove ${l.label}`,onPress:()=>s(e,t[e].filter((e,t)=>t!==n))})]},l.key)),(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"secondary",label:"Money figure",onPress:()=>s(e,[...t[e],{key:`f${Date.now().toString(36)}`,label:'New figure',kind:'money'}])}),(0,$.jsx)(p.Button,{small:!0,kind:"secondary",label:"Number",onPress:()=>s(e,[...t[e],{key:`n${Date.now().toString(36)}`,label:'New number',kind:'number'}])})]})]});return(0,$.jsxs)(c.default,{testID:"cashup-settings",style:{gap:12},children:[(0,$.jsx)(p.Muted,{children:"Tip: match these to the boxes on your paper cash up sheet and till printout. Cash tips total and Card tips total are needed for Today\u2019s tips and the Tips pot."}),l('cashFields','Cash up sheet'),l('salesFields','Weekly sales report')]})},_e.TipsSettings=function({rid:e}){const t=(0,f.useTipsShow)(e);return(0,$.jsxs)(c.default,{testID:"tips-settings",style:{gap:8},children:[(0,$.jsx)(p.Muted,{children:"Staff only ever see the team total: never anyone\u2019s share or pay. The Display never shows tips or money."}),(0,$.jsx)(p.Toggle,{testID:"tips-show-today",label:"Show Today\u2019s tips in the staff apps",value:t.showToday,onChange:t=>f.useCashUp.getState().setShow(e,{showToday:t})}),(0,$.jsx)(p.Toggle,{testID:"tips-show-pot",label:"Show the Tips pot in the staff apps",value:t.showPot,onChange:t=>f.useCashUp.getState().setShow(e,{showPot:t})})]})};var t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),n=e(_r(_d[5])),r=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),h=e(_r(_d[9])),c=e(_r(_d[10])),u=e(_r(_d[11])),p=_r(_d[12]),y=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),k=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]),T=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),I=_r(_d[26]),$=_r(_d[27]);const P=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,M=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function B(e){const t=t=>'number'==typeof e[t]?e[t]:null,s=(0,x.combinedTips)(e);return[['Gross',t('gross')],['card',t('card')],['cash',t('cash')],['tips',s],['food',t('food')],['drink',t('drink')]].filter(([,e])=>null!=e).map(([e,t])=>`${e} ${P(t)}`).join(', ')}function R({p:e,h:s}){const[a,o]=(0,l.useState)(e.startsWith('data:')?e:null),n=e.startsWith('data:')||(0,w.photosAllowed)();return(0,l.useEffect)(()=>{!a&&n&&(0,w.photoUrl)(e).then(o)},[e,n]),n?a?(0,$.jsx)(d.default,{source:{uri:a},style:{width:'100%',height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#111')},resizeMode:"contain"}):(0,$.jsx)(c.default,{style:{height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(p.Muted,{children:"Photo"})}):(0,$.jsx)(c.default,{testID:"photo-owners-only",accessible:!0,accessibilityLabel:"Taking-sheet photo. Only owners can view saved photos.",style:{height:Math.min(s,90),borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center',padding:10},children:(0,$.jsx)(p.Muted,{center:!0,children:"Photo saved. Only owners can view it."})})}function L({draft:e,fields:t,onClose:s,onConfirm:n,keyLabel:r,onKey:i,keyChoices:d}){const{width:h,height:f}=(0,u.default)(),m=h>=820;e.only&&(t=t.filter(t=>e.only.includes(t.key)));const[k,b]=(0,l.useState)(()=>Object.fromEntries(t.map(t=>[t.key,(0,x.isBlank)(e.vals[t.key])?'':String(e.vals[t.key])]))),[j,w]=(0,l.useState)(()=>e.categories.map(e=>({name:e.name,amount:String(e.amount)}))),[C,T]=(0,l.useState)(!1),v=Object.fromEntries(t.map(e=>[e.key,'text'===e.kind?k[e.key]?.trim()||null:(0,x.parseAmount)(k[e.key]??'',e.kind)])),S=t.filter(e=>'text'!==e.kind&&(k[e.key]??'').trim()&&null==v[e.key]).map(e=>e.key),D=(0,x.missing)(t,v),I=j.map(e=>({name:e.name.trim(),amount:(0,x.parseAmount)(e.amount)})).filter(e=>e.name),P=I.some(e=>null==e.amount),M=e=>({minHeight:42,borderRadius:10,borderWidth:e?2:1,borderColor:e?y.colours.amber:'rgba(255,255,255,0.15)',backgroundColor:e?'rgba(232,168,56,0.08)':'#141312',color:y.colours.text,paddingHorizontal:10,fontSize:17}),B=(0,$.jsx)(c.default,{testID:"review-photos",style:{gap:8,flex:m?1:void 0},children:e.photos.length?e.photos.map((t,s)=>(0,$.jsx)(R,{p:t,h:m?Math.max(300,.62*f/Math.min(2,e.photos.length)):260},s)):(0,$.jsx)(p.Muted,{children:"No photo: typed by hand."})}),L=(0,$.jsxs)(c.default,{testID:"review-fields",style:{gap:8,flex:m?1:void 0},children:[(0,$.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(p.Muted,{children:r}),d.map(t=>(0,$.jsx)(p.Chip,{label:t.label,selected:e.key===t.value,onPress:()=>i(t.value)},t.value))]}),t.map(e=>{const t='text'!==e.kind&&!(k[e.key]??'').trim()||S.includes(e.key);return(0,$.jsxs)(c.default,{style:{gap:3},children:[(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.T,{weight:"semibold",size:14,children:e.label}),t&&'text'!==e.kind?(0,$.jsx)(p.Badge,{kind:"amber",label:S.includes(e.key)?'Check this':'Not read: type it'}):null]}),(0,$.jsx)(o.TextInput,{testID:`review-${e.key}`,value:k[e.key]??'',onChangeText:t=>b(s=>({...s,[e.key]:t})),keyboardType:'text'===e.kind?'default':'decimal-pad',placeholder:'money'===e.kind?'\xa3':'number'===e.kind?'Number':'Optional',placeholderTextColor:"#777",style:M(t)})]},e.key)}),'sales'===e.kind?(0,$.jsxs)(c.default,{testID:"review-categories",style:{gap:6},children:[(0,$.jsx)(p.T,{weight:"semibold",size:14,children:"Sales by category (if the printout has them)"}),j.map((e,t)=>(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(o.TextInput,{value:e.name,onChangeText:e=>w(s=>s.map((s,a)=>a===t?{...s,name:e}:s)),placeholder:"e.g. Food",placeholderTextColor:"#777",style:[M(!1),{flex:2}]}),(0,$.jsx)(o.TextInput,{value:e.amount,onChangeText:e=>w(s=>s.map((s,a)=>a===t?{...s,amount:e}:s)),placeholder:"\xa3",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:[M(!e.amount.trim()||null==(0,x.parseAmount)(e.amount)),{flex:1}]}),(0,$.jsx)(a.GoldClose,{size:"sm",label:"Remove category",onPress:()=>w(e=>e.filter((e,s)=>s!==t))})]},t)),(0,$.jsx)(p.Button,{small:!0,kind:"secondary",testID:"review-add-cat",label:"Add a category",onPress:()=>w(e=>[...e,{name:'',amount:''}])})]}):null]});return(0,$.jsxs)(p.Sheet,{visible:!0,onClose:s,title:'cashup'===e.kind?'Check the cash up':'Check the weekly sales',maxWidth:1100,testID:"review-sheet",children:[(0,$.jsx)(p.Muted,{children:"Tip: check each figure against the photo. Nothing is saved until you tap Confirm. Amber boxes weren\u2019t read: type them, or leave them blank if the sheet doesn\u2019t have them."}),'edit'===e.reader||e.only?null:e.reader?(0,$.jsx)(p.Banner,{kind:"info",title:"Read from the photo",children:e.note}):e.photos.length?(0,$.jsx)(p.Banner,{kind:"info",title:"Type it from the photo",children:e.note}):null,m?(0,$.jsxs)(c.default,{style:{flexDirection:'row',gap:14},children:[B,L]}):(0,$.jsxs)($.Fragment,{children:[B,L]}),D.length?(0,$.jsxs)(p.Muted,{children:[D.length," figure",1===D.length?'':'s'," still blank. Blank means \u201cnot on the sheet\u201d, never zero."]}):null,(0,$.jsxs)(p.Row,{gap:8,children:[(0,$.jsx)(p.Button,{testID:"review-confirm",label:C?'Saving\u2026':'Confirm and save',disabled:C||!!S.length||P||!t.some(e=>'text'!==e.kind&&null!=v[e.key]),onPress:async()=>{T(!0),await n(v,I.map(e=>({name:e.name,amount:e.amount}))),T(!1)}}),(0,$.jsx)(p.Button,{kind:"secondary",label:"Cancel",onPress:s})]})]})}function z({data:e,height:t=140,testID:s,fmt:a=P}){const o=Math.max(1,...e.map(e=>e.value??0));return(0,$.jsxs)(c.default,{testID:s,style:{gap:4},children:[(0,$.jsx)(c.default,{style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:t},children:e.map((e,s)=>(0,$.jsxs)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'flex-end',height:t},children:[null!=e.value?(0,$.jsx)(p.T,{size:9,colour:y.colours.muted,children:a(e.value).replace('.00','')}):null,(0,$.jsx)(c.default,{style:{width:'80%',height:null==e.value?2:Math.max(3,e.value/o*(t-16)),borderRadius:4,backgroundColor:null==e.value?'#333':e.hi?y.colours.goldLight:y.colours.gold,opacity:null==e.value?.6:1}})]},s))}),(0,$.jsx)(c.default,{style:{flexDirection:'row',gap:4},children:e.map((e,t)=>(0,$.jsx)(p.T,{size:9,colour:y.colours.muted,style:{flex:1,textAlign:'center'},children:e.label},t))})]})}function A({rid:e,today:s}){const a=(0,f.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e),o=(0,f.useCashUp)(e=>e.sales).filter(t=>t.rid===e),l=(0,x.dailySeries)(a,s,14),n=(0,x.dailySeries)(a,s,14,x.combinedTips),r=(0,x.weekStartOf)(s),i=Array.from({length:8},(e,t)=>(0,x.addDaysYmd)(r,7*(t-7))).map(e=>{const t=o.find(t=>t.weekStart===e&&t.confirmedAt),s=t?.vals.net;return{label:M(e).split(' ').slice(1).join(' '),value:'number'==typeof s?s:null,hi:e===r}}),d=[...o].filter(e=>e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0],h=d?(0,x.weekCompare)(o,d.weekStart):null,u=d?.categories??[],m=Math.max(1,...u.map(e=>e.amount)),k=d?(0,x.weekCompare)(o,d.weekStart,'covers'):null;return(0,$.jsxs)(c.default,{testID:"cash-charts",style:{gap:12},children:[(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Takings, last 14 days"}),(0,$.jsx)(p.Muted,{children:"Card + cash from confirmed cash ups. A grey line means no cash up that day."}),(0,$.jsx)(z,{testID:"chart-daily",data:l.map(e=>({label:M(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Tips, last 14 days"}),(0,$.jsx)(p.Muted,{children:"Cash + card tips, team total."}),(0,$.jsx)(z,{testID:"chart-tips",height:100,data:n.map(e=>({label:M(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Weekly net sales"}),h&&null!=h.now?(0,$.jsx)(c.default,{testID:"week-compare",children:(0,$.jsxs)(p.T,{size:15,children:["Week of ",M(d.weekStart),": ",P(h.now),null!=h.prev?` \xb7 week before ${P(h.prev)}`:'',null!=h.change?` \xb7 ${h.change>=0?'\u25b2':'\u25bc'} ${Math.abs(h.change)}%`:'']})}):(0,$.jsx)(p.Muted,{children:"No weekly sales report yet."}),k&&null!=k.now?(0,$.jsxs)(p.Muted,{children:["Covers ",k.now,null!=k.prev?` (week before ${k.prev})`:'']}):null,(0,$.jsx)(z,{testID:"chart-weekly",data:i})]}),u.length?(0,$.jsxs)(p.Card,{children:[(0,$.jsxs)(p.T,{weight:"semibold",children:["By category, week of ",M(d.weekStart)]}),(0,$.jsx)(c.default,{testID:"chart-categories",style:{gap:6},children:u.map(e=>(0,$.jsxs)(c.default,{style:{gap:2},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(p.T,{size:14,children:e.name}),(0,$.jsx)(p.T,{size:14,colour:y.colours.goldLight,children:P(e.amount)})]}),(0,$.jsx)(c.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2826')},children:(0,$.jsx)(c.default,{style:{width:e.amount/m*100+"%",height:10,borderRadius:5,backgroundColor:y.colours.gold}})})]},e.name))})]}):null]})}function U(e){const t=(0,f.useCashSettings)(e),s=(0,m.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings.cashUpRecord);return(0,l.useMemo)(()=>({...t,record:s,cashFields:(0,x.cashFieldsForRecord)(t.cashFields,s)}),[t,s])}const F=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}):'',W=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`;function N({rid:e,tonight:t,who:s}){const a=U(e),o=(0,f.useCashUp)(e=>e.cashUps).find(s=>s.rid===e&&s.date===t),[r,i]=(0,l.useState)(null),[d,u]=(0,l.useState)(null),[m,k]=(0,l.useState)(!1),b=!!o?.confirmedAt,j=async e=>{if(b)return;const s=e?await(0,w.pickPhotos)({source:e}):[];if(e&&!s.length)return void u('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');let o,l={vals:{},reader:null,note:'Type the figures from the sheet.'};s.length&&(k(!0),u('Reading the photo\u2026'),o=await Promise.all(s.map((e,s)=>(0,w.uploadPhoto)('cashup',t,e,s))),l=await(0,C.readSheet)('cashup',o.filter(e=>!!e),a.cashFields),k(!1),u(null)),i({kind:'cashup',key:t,photos:s,vals:l.vals,categories:[],unread:(0,x.missing)(a.cashFields,l.vals),note:l.note,reader:l.reader,uploaded:o})},T=async a=>{if(!r||b)return void i(null);const o=r.uploaded&&r.uploaded.length===r.photos.length?r.uploaded:await Promise.all(r.photos.map((e,s)=>(0,w.uploadPhoto)('cashup',t,e,s))),l=r.photos.map((e,t)=>o[t]??e);f.useCashUp.getState().saveCashUp({rid:e,date:t,vals:a,photos:l,confirmedBy:s.name,confirmedAt:(new Date).toISOString(),readBy:r.reader});const d=B(a);u(`Tonight\u2019s cash up is saved and signed off${d?`: ${d}`:''}.${o.some(e=>null==e)&&r.photos.length?' The photo will be sent when this phone is back online.':''}`);try{n.default.announceForAccessibility?.(`Saved and signed off. ${d}`)}catch{}i(null)};return(0,$.jsxs)(c.default,{testID:"cashup-screen",style:{gap:12,alignItems:'center',width:'100%'},children:[d?(0,$.jsx)(p.Banner,{kind:"info",children:d}):null,(0,$.jsx)(p.Card,{highlight:y.colours.gold,children:(0,$.jsxs)(c.default,{testID:"closer-cashup",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:20,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Tonight\u2019s cash up"}),(0,$.jsxs)(p.T,{center:!0,size:15,colour:y.colours.muted,testID:"closer-day",children:[M(t)," \xb7 ",W(t)]}),b?(0,$.jsxs)(c.default,{testID:"closer-done",accessible:!0,accessibilityLabel:`Tonight's cash up is done. Submitted by ${o?.confirmedBy??'someone'} at ${F(o?.confirmedAt)}. ${B(o.vals)}. It is signed off. If something is wrong, ask an owner to unlock it.`,style:{alignItems:'center',gap:6,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:18,weight:"semibold",colour:y.colours.goldLight,children:"Done and signed off"}),(0,$.jsxs)(p.T,{center:!0,size:15,children:["Submitted by ",o?.confirmedBy??'\u2014'," at ",F(o?.confirmedAt)]}),(0,$.jsx)(p.T,{center:!0,size:15,children:B(o.vals)||'No figures'}),o.photos.length?(0,$.jsxs)(p.Muted,{center:!0,size:13,children:[o.photos.length," photo",o.photos.length>1?'s':''," of the taking sheet sent to the owners."]}):null,(0,$.jsx)(p.Muted,{center:!0,size:13,children:"If something is wrong, ask an owner to unlock it."})]}):(0,$.jsxs)($.Fragment,{children:[a.record?.length?(0,$.jsxs)(c.default,{testID:"cashup-record",accessibilityLabel:`What to record at nightly cash up. ${a.record.join(', ')}`,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"What to record"}),a.record.map(e=>(0,$.jsx)(p.T,{center:!0,children:e},e))]}):null,(0,$.jsx)(h.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:m,onPress:()=>{j('camera')},style:({pressed:e})=>({minHeight:64,width:'100%',borderRadius:16,backgroundColor:e?y.colours.goldLight:y.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:m?.5:1}),children:(0,$.jsx)(p.T,{center:!0,size:20,weight:"semibold",colour:y.colours.onGold,children:m?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,$.jsx)(p.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{j('gallery')}}),(0,$.jsx)(p.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{j(null)}})]}),(0,$.jsx)(p.Muted,{center:!0,size:13,children:"Check the figures, then Confirm. Once confirmed it\u2019s signed off, and the photo goes to the owners only."})]})]})}),(0,$.jsx)(p.Muted,{center:!0,size:12,testID:"closer-note",children:"You can do tonight\u2019s cash up only. Past takings, charts and sales reports are for owners and managers."}),r?(0,$.jsx)(L,{draft:r,fields:a.cashFields,onClose:()=>i(null),onConfirm:e=>T(e),keyLabel:"Day",keyChoices:[{label:'Tonight',value:t}],onKey:()=>{}},`closer-${r.photos.length}`):null]})}function E({rid:e,today:t,canEdit:s,who:a,chartsOnly:o,backdate:r}){const i=U(e),d=(0,f.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e).sort((e,t)=>t.date.localeCompare(e.date)),u=(0,f.useCashUp)(e=>e.sales).filter(t=>t.rid===e).sort((e,t)=>t.weekStart.localeCompare(e.weekStart)),[m,k]=(0,l.useState)(null),[b,j]=(0,l.useState)(null),D=(0,v.useLockedFor)(e),[I,R]=(0,l.useState)(!1),[z,F]=(0,l.useState)(null),W=async(e,s,a,o)=>{const l=a??('cashup'===e?t:(0,x.weekStartOf)((0,x.addDaysYmd)(t,-7)));if(D(e,l))return void j((0,v.lockedMessage)(e,l));const n=s?await(0,w.pickPhotos)({source:s}):[];if(s&&!n.length)return void j('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');const r='cashup'===e?i.cashFields:i.salesFields;let h,c={vals:{},reader:null,note:'Type the figures from the sheet.',categories:[]};n.length&&(R(!0),j('Reading the photo\u2026'),h=await Promise.all(n.map((t,s)=>(0,w.uploadPhoto)(e,l,t,s))),c=await(0,C.readSheet)(e,h.filter(e=>!!e),r),R(!1),j(null));const u=o&&'cashup'===e?d.find(e=>e.date===l)?.vals:void 0;k({kind:e,key:l,photos:n,vals:u?{...c.vals,...u}:c.vals,categories:c.categories??[],unread:(0,x.missing)(r,c.vals),note:c.note,reader:o?'edit':c.reader,uploaded:h,only:o})},N=[0,1,2].map(e=>({label:0===e?'Today':1===e?'Yesterday':M((0,x.addDaysYmd)(t,-e)),value:(0,x.addDaysYmd)(t,-e)}));'cashup'!==m?.kind||N.some(e=>e.value===m.key)||N.push({label:M(m.key),value:m.key});const E=[0,1,2].map(e=>{const s=(0,x.weekStartOf)((0,x.addDaysYmd)(t,-7*e));return{label:0===e?'This week':1===e?'Last week':`w/c ${M(s)}`,value:s}});return(0,$.jsxs)(c.default,{testID:"cashup-screen",style:{gap:12},children:[(0,$.jsx)(p.Muted,{children:"Tip: at the end of the night, tap Take a picture of the taking sheet: the figures are filled in from the photo for you to check beside it, then Confirm. Bigger venues can Upload a spreadsheet (CSV or Excel) for one night or several. Gross takings feed Spend per head. Head Chefs can see the graphs."}),b?(0,$.jsx)(p.Banner,{kind:"info",children:b}):null,(0,$.jsx)(V,{rid:e,today:t,manage:s,who:a}),s&&!o?(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"End of night cash up"}),i.record?.length?(0,$.jsxs)(c.default,{testID:"cashup-record",accessibilityLabel:`What to record at nightly cash up. ${i.record.join(', ')}`,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"What to record at nightly cash up"}),i.record.map(e=>(0,$.jsx)(p.T,{center:!0,children:e},e))]}):null,(0,$.jsx)(h.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:I,onPress:()=>{W('cashup','camera')},style:({pressed:e})=>({minHeight:64,borderRadius:16,backgroundColor:e?y.colours.goldLight:y.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:I?.5:1}),children:(0,$.jsx)(p.T,{size:20,weight:"semibold",colour:y.colours.onGold,children:I?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(p.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{W('cashup','gallery')}}),(0,$.jsx)(p.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{W('cashup',null)}}),(0,$.jsx)(p.Button,{testID:"cashup-sheet",kind:"secondary",label:"Upload a spreadsheet",accessibilityLabel:"Upload a spreadsheet of takings, CSV or Excel, for one night or several",onPress:async()=>{const e=await(0,T.pickSpreadsheet)();e&&('error'in e?j(e.error):F(e))}}),(0,$.jsx)(p.Button,{testID:"cashup-takings",kind:"secondary",label:"Enter takings",accessibilityLabel:"Enter tonight's takings: gross, and food and drink if you have them",onPress:()=>{W('cashup',null,t,x.TAKINGS_KEYS)}})]}),(0,$.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"Weekly sales report"}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(p.Button,{testID:"upload-sales",label:"Upload weekly sales report",onPress:()=>{W('sales','camera')}}),(0,$.jsx)(p.Button,{testID:"sales-gallery",kind:"secondary",label:"Choose from gallery",onPress:()=>{W('sales','gallery')}}),(0,$.jsx)(p.Button,{testID:"sales-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{W('sales',null)}})]}),(0,$.jsx)(p.Muted,{children:"Several pages? Pick them all at once. Fields can be changed in Settings \u203a Advanced \u203a Cash up."})]}):null,s&&r&&!o?(0,$.jsx)(O,{today:t,has:e=>d.some(t=>t.date===e),paid:t=>(0,S.paidOutFor)(t,f.useCashUp.getState().pot,e),onOpen:e=>{if(D('cashup',e))return void j((0,v.lockedMessage)('cashup',e));const t=d.find(t=>t.date===e);k({kind:'cashup',key:e,photos:t?.photos??[],vals:t?.vals??{},categories:[],unread:[],note:t?'':'Type the figures for that day.',reader:'edit'})}}):null,(0,$.jsx)(A,{rid:e,today:t}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Recent cash ups"}),d.length?d.slice(0,10).map(e=>(0,$.jsxs)(c.default,{testID:`cashup-row-${e.date}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)',gap:2},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(p.T,{weight:"semibold",children:M(e.date)}),(0,$.jsx)(p.T,{colour:y.colours.goldLight,children:P((0,x.takings)(e.vals))})]}),(0,$.jsx)(p.Muted,{children:i.cashFields.filter(e=>'text'!==e.kind&&'card'!==e.key&&'cash'!==e.key).map(t=>`${t.label} ${(0,x.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?P(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),(0,$.jsxs)(p.Muted,{children:["Confirmed by ",e.confirmedBy??'\u2014',e.photos.length?` \xb7 ${e.photos.length} photo${e.photos.length>1?'s':''}`:'']}),(0,S.historyLines)(e.vals).slice(0,3).map(t=>(0,$.jsx)(p.Muted,{size:12,testID:`cashup-later-${e.date}`,children:t},t)),s&&!D('cashup',e.date)?(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit",onPress:()=>k({kind:'cashup',key:e.date,photos:e.photos,vals:e.vals,categories:[],unread:[],note:'',reader:'edit'})}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:`takings-edit-${e.date}`,label:null==(0,x.grossOf)(e.vals)?'Add takings':'Edit takings',onPress:()=>k({kind:'cashup',key:e.date,photos:[],vals:e.vals,categories:[],unread:[],note:'',reader:'edit',only:x.TAKINGS_KEYS})})]}):null,s?(0,$.jsx)(v.CashLockControls,{kind:"cashup",item:e,label:M(e.date)}):null]},e.id)):(0,$.jsx)(p.Muted,{children:"None yet."})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Weekly sales reports"}),u.length?u.slice(0,8).map(e=>(0,$.jsxs)(c.default,{style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(p.T,{weight:"semibold",children:["w/c ",M(e.weekStart)]}),(0,$.jsx)(p.T,{colour:y.colours.goldLight,children:P('number'==typeof e.vals.net?e.vals.net:null)})]}),(0,$.jsx)(p.Muted,{children:i.salesFields.filter(e=>'net'!==e.key).map(t=>`${t.label} ${(0,x.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?P(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),s?(0,$.jsx)(v.CashLockControls,{kind:"sales",item:e,label:`w/c ${M(e.weekStart)}`}):null]},e.id)):(0,$.jsx)(p.Muted,{children:"None yet."})]}),z?(0,$.jsx)(T.SpreadsheetImport,{rid:e,file:z,who:a,locked:e=>D('cashup',e),onClose:()=>F(null),onSaved:e=>{j(e),F(null)}}):null,m?(0,$.jsx)(L,{draft:m,fields:'cashup'===m.kind?i.cashFields:i.salesFields,onClose:()=>k(null),onConfirm:async(s,o)=>{if(!m)return;if(D(m.kind,m.key))return j((0,v.lockedMessage)(m.kind,m.key)),void k(null);const l=m.uploaded&&m.uploaded.length===m.photos.length?m.uploaded:await Promise.all(m.photos.map((e,t)=>(0,w.uploadPhoto)(m.kind,m.key,e,t))),r=m.photos.map((e,t)=>l[t]??e),i=(new Date).toISOString();if('cashup'===m.kind){const o=d.find(e=>e.date===m.key),l=m.only&&o?{...o.vals,...s}:s,h=m.keynull==e)&&m.photos.length&&j(e=>`${e??''} The photo is kept on this device only (not signed in or offline).`),k(null)},keyLabel:'cashup'===m.kind?'Day':'Week starting',keyChoices:'cashup'===m.kind?N:E,onKey:e=>k({...m,key:e})},`${m.kind}-${m.photos.length}`):null]})}function O({today:e,has:t,paid:a,onOpen:o}){const[n,r]=(0,l.useState)((0,x.addDaysYmd)(e,-1)),[i,d]=(0,l.useState)((0,I.ukHistoryDate)((0,x.addDaysYmd)(e,-1))),[h,u]=(0,l.useState)(!1),f=(0,I.parseHistoryInput)(i)??'',m=(0,S.backdateProblem)(f,e),k=m?n:f,b=!m&&t(k),j=m?null:a(k),w=e=>{r(e),d((0,I.ukHistoryDate)(e))};return(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsxs)(c.default,{testID:"cashup-backdate",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:20,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Cash up for another day"}),(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.text,children:"Missed a night? Enter or correct takings and tips for any past day. It counts on that day everywhere."}),(0,$.jsx)(c.default,{style:{width:'100%',maxWidth:360},children:(0,$.jsx)(p.Field,{label:"Day (DD/MM/YYYY)",value:i,onChangeText:e=>d((0,s.slashDate)(e,i)),placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"cashup-backdate-date",style:{textAlign:'center'},accessibilityLabel:"Day of the cash up, as day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1})}),m?(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.amber,testID:"cashup-backdate-problem",children:m}):(0,$.jsx)(c.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cashup-backdate-status",children:(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.goldLight,children:b?`There is already a cash up for ${M(k)}: it opens for editing.`:`No cash up yet for ${M(k)}.`})}),j?(0,$.jsx)(c.default,{testID:"cashup-backdate-paid",style:{borderWidth:1,borderColor:y.colours.amber,borderRadius:10,padding:10,maxWidth:520},children:(0,$.jsxs)(p.T,{center:!0,size:14,colour:y.colours.amber,children:["Tips up to ",M(j.throughDate)," were already paid out. Tips you add for this day won\u2019t be in the pot automatically: add a correction in the Tips pot if they should still be shared."]})}):null,(0,$.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center'},children:[(0,$.jsx)(p.Button,{kind:"secondary",label:"Pick a date",testID:"cashup-backdate-pick",accessibilityLabel:`Pick a day from a calendar. Now ${m?'no valid day':M(k)}`,onPress:()=>u(!0),style:{minHeight:56}}),(0,$.jsx)(p.Button,{label:m?'Open cash up':b?`Edit cash up for ${M(k)}`:`Add cash up for ${M(k)}`,testID:"cashup-backdate-open",disabled:!!m,accessibilityLabel:m?'Open cash up, enter a valid past day first':`${b?'Edit':'Add'} the cash up for ${M(k)}`,onPress:()=>{w(k),o(k)},style:{minHeight:56}})]}),(0,$.jsxs)(p.Muted,{center:!0,children:["Saved with your name and the time, e.g. \u201cAdded later by you, ",M(e),"\u201d. Nothing is sent to anyone."]})]}),(0,$.jsx)(D.LookBackCalendar,{visible:h,today:e,selected:m?n:k,purpose:"Cash up for another day",idPrefix:"cashup-backdate",onClose:()=>u(!1),onPick:e=>{w(e),u(!1)}})]})}function Y({n:e,testID:t}){const s=Math.max(1,Math.min(14,e));return(0,$.jsx)(c.default,{testID:t,style:{width:64,height:114,justifyContent:'flex-end'},children:Array.from({length:s}).map((e,t)=>(0,$.jsx)(H,{delay:50*t},t))})}function H({delay:e}){const t=(0,l.useRef)(new r.default.Value(1)).current;return(0,l.useEffect)(()=>{r.default.timing(t,{toValue:0,duration:420,delay:e,easing:i.default.out(i.default.back(1.6)),useNativeDriver:!1}).start()},[]),(0,$.jsx)(r.default.View,{style:{height:7,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[0,-120]})}],opacity:t.interpolate({inputRange:[0,1],outputRange:[1,0]})},children:(0,$.jsx)(c.default,{style:{width:60,height:12,borderRadius:30,backgroundColor:y.colours.gold,borderWidth:1,borderColor:y.colours.goldLight}})})}function G(e){const[t,s]=(0,l.useState)(e),a=(0,l.useRef)(e);return(0,l.useEffect)(()=>{const t=a.current,o=e;if(t===o)return;const l=Date.now(),n=setInterval(()=>{const e=Math.min(1,(Date.now()-l)/1200);s(Math.round(100*(t+(o-t)*(1-Math.pow(1-e,3))))/100),e>=1&&(clearInterval(n),a.current=o)},40);return()=>clearInterval(n)},[e]),t}function V({rid:e,today:t,manage:s,who:a,big:o}){const n=(0,f.useTipsShow)(e),r=(0,f.useCashUp)(e=>e.tips).filter(t=>t.rid===e),i=(0,f.useCashUp)(e=>e.pot).filter(t=>t.rid===e),d=(0,b.useVenuePay)(e).pay,h=(0,k.tipsPeriod)(d,t),u=(0,l.useMemo)(()=>(0,x.tipsPot)(r,i,h.start,t),[r,i,h.start,t]),m=G(u.total),[j,w]=(0,l.useState)(null);return n.showPot||s?(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsxs)(c.default,{testID:"tips-pot",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,$.jsx)(Y,{n:Math.ceil(u.total/100),testID:"tips-pot-coins"},u.total),(0,$.jsxs)(c.default,{style:{flex:1,gap:2},children:[(0,$.jsx)(p.T,{size:12,weight:"semibold",colour:y.colours.gold,style:{letterSpacing:1.5},children:"TIPS POT"}),(0,$.jsx)(p.T,{size:o?40:32,weight:"bold",colour:y.colours.goldLight,children:P(m)}),(0,$.jsxs)(p.Muted,{children:["Tips held for the team since ",M(u.from),h.payday?` \xb7 next tip payday ${M(h.payday)}`:'',". Confirmed cash ups only.",n.showPot?'':' (Hidden from staff.)']})]})]}),s?(0,$.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"secondary",testID:"pot-payout",label:"Mark payout done",onPress:()=>w('payout')}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:"pot-correct",label:"Correct an entry",onPress:()=>w('correct')}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:"pot-history",label:"Past pots",onPress:()=>w('history')})]}):null,'payout'===j?(0,$.jsxs)(p.Sheet,{visible:!0,onClose:()=>w(null),title:"Mark payout done",maxWidth:520,testID:"pot-payout-sheet",children:[(0,$.jsxs)(p.T,{children:["Pay out ",P(u.total)," (tips from ",M(u.from)," to ",M(t),")?"]}),(0,$.jsx)(p.Muted,{children:"The pot goes back to \xa30.00 for the next period. This is logged and kept in Past pots. No money is moved by the app."}),(0,$.jsx)(p.Button,{testID:"pot-payout-confirm",label:"Yes, payout done",onPress:()=>{f.useCashUp.getState().addPotEvent({rid:e,kind:'payout',throughDate:t,amount:u.total,by:a?.name??'Manager'}),w(null)}})]}):null,'correct'===j?(0,$.jsx)(_,{rid:e,today:t,who:a,onClose:()=>w(null)}):null,'history'===j?(0,$.jsxs)(p.Sheet,{visible:!0,onClose:()=>w(null),title:"Past pots and corrections",maxWidth:560,testID:"pot-history-sheet",children:[u.history.length||i.some(e=>'correction'===e.kind)?null:(0,$.jsx)(p.Muted,{children:"No payouts or corrections yet."}),i.slice().sort((e,t)=>t.at.localeCompare(e.at)).map(e=>(0,$.jsxs)(c.default,{style:{paddingVertical:4},children:[(0,$.jsx)(p.T,{weight:"semibold",children:'payout'===e.kind?`Paid out ${P(e.amount)}`:`Correction ${e.amount>=0?'+':'\u2212'}${P(Math.abs(e.amount))} for ${M(e.forDate)}`}),(0,$.jsxs)(p.Muted,{children:['payout'===e.kind?`Tips to ${M(e.throughDate)}`:`\u201c${e.reason}\u201d`," \xb7 ",e.by," \xb7 ",new Date(e.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]})]},e.id))]}):null]}):null}function _({rid:e,today:s,who:a,onClose:n}){const[r,i]=(0,l.useState)(s),[d,h]=(0,l.useState)(''),[c,u]=(0,l.useState)(''),m=(0,x.parseAmount)(d),k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',backgroundColor:(0,t.soutersSurface)('#141312'),color:y.colours.text,paddingHorizontal:10,fontSize:16};return(0,$.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Correct an entry",maxWidth:520,testID:"pot-correct-sheet",children:[(0,$.jsx)(p.Muted,{children:"Tip: add or take off an amount for a day (use a minus for less, e.g. -5). Every correction is logged with your name and the reason."}),(0,$.jsx)(p.Row,{wrap:!0,gap:6,children:[0,1,2,3].map(e=>{const t=(0,x.addDaysYmd)(s,-e);return(0,$.jsx)(p.Chip,{label:0===e?'Today':M(t),selected:r===t,onPress:()=>i(t)},t)})}),(0,$.jsx)(o.TextInput,{testID:"pot-correct-amount",value:d,onChangeText:h,placeholder:"\xa3 e.g. -5.00",placeholderTextColor:"#777",keyboardType:"numbers-and-punctuation",style:k}),(0,$.jsx)(o.TextInput,{testID:"pot-correct-reason",value:c,onChangeText:u,placeholder:"Reason (required)",placeholderTextColor:"#777",maxLength:200,style:k}),(0,$.jsx)(p.Button,{testID:"pot-correct-save",label:"Save correction",disabled:null==m||0===m||!c.trim(),onPress:()=>{f.useCashUp.getState().addPotEvent({rid:e,kind:'correction',forDate:r,amount:m,reason:c.trim(),by:a?.name??'Manager'}),n()}})]})}function K(e,t,s,a){if(!Number.isFinite(s))return;const o=`${e}:${t}`;f.useCashUp.getState().seen[o]!==s&&(f.useCashUp.getState().markSeen(o,s),(0,j.notify)({id:`tips-${o}`,icon:'\ud83e\ude99',kicker:'TIPS',title:`${t===a?'Today\u2019s':'Last night\u2019s'} tips: ${P(s)}`,body:'Cash + card tips for the whole team. Added to the Tips pot. Thank you, everyone.',testID:'tips-notice',timeoutMs:12e3,actions:[{label:'Nice',testID:'tips-notice-ok',onPress:()=>{}}]}))}function Z(e,t,s){return e.filter(e=>e.rid===t&&e.date>=(0,x.addDaysYmd)(s,-1)&&e.date<=s).sort((e,t)=>t.date.localeCompare(e.date))[0]}},1047,[876,834,835,874,31,119,121,225,197,264,128,288,818,825,1049,881,13,1184,1185,980,1071,1402,1403,1406,1407,1408,1176,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useCashAccess",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"hasCashUpAccess",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({byRef:{},mine:null,loaded:!1,takings:null,tradingDate:null,photos:null})),n=()=>!0===t.getState().mine},1048,[995]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"cashUpId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"salesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"cashSettingsId",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"defaultCashSettings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useCashUp",{enumerable:!0,get:function(){return b}}),_e.forgetPastTakings=function(e,t){const s=b.getState(),n=s.cashUps.filter(s=>s.rid!==e||s.date===t),r=s.sales.filter(t=>t.rid!==e);n.length===s.cashUps.length&&r.length===s.sales.length||b.setState({cashUps:n,sales:r})},Object.defineProperty(_e,"useCashSettings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useTipsShow",{enumerable:!0,get:function(){return y}});var t=e(_r(d[0])),s=e(_r(d[1])),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]),u=_r(d[5]),l=_r(d[6]);const c=(e,t)=>(0,o.uuidFrom)(`cashup:${e}:${t}`),p=(e,t)=>(0,o.uuidFrom)(`sales:${e}:${t}`),h=e=>(0,o.uuidFrom)(`cashup-settings:${e}`),f=e=>({id:h(e),cashFields:u.DEFAULT_CASHUP_FIELDS.map(e=>({...e})),salesFields:u.DEFAULT_SALES_FIELDS.map(e=>({...e}))}),S=e=>{const t='number'==typeof e.vals.cashTips?e.vals.cashTips:null,s='number'==typeof e.vals.cardTips?e.vals.cardTips:null;return!e.confirmedAt||null==t&&null==s?null:{rid:e.rid,date:e.date,total:Math.round(100*((t??0)+(s??0)))/100,postedAt:e.confirmedAt,postedBy:e.confirmedBy}},b=(0,n.create)()((0,r.persist)((e,t)=>({cashUps:[],sales:[],tips:[],pot:[],settings:{},show:{},seen:{},saveCashUp:t=>{const s={...t,id:c(t.rid,t.date)},n=S(s);return e(e=>({cashUps:[s,...e.cashUps.filter(e=>e.id!==s.id)],tips:n?[n,...e.tips.filter(e=>!(e.rid===n.rid&&e.date===n.date))]:e.tips})),s},saveSales:t=>{const s={...t,id:p(t.rid,t.weekStart)};return e(e=>({sales:[s,...e.sales.filter(e=>e.id!==s.id)]})),s},setFields:(t,s,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??f(t),[s]:n,updatedAt:(new Date).toISOString()}}})),resetFields:t=>e(e=>({settings:{...e.settings,[t]:{...f(t),updatedAt:(new Date).toISOString()}}})),setShow:(t,s)=>e(e=>({show:{...e.show,[t]:{...e.show[t]??{showToday:!0,showPot:!0},...s}}})),addPotEvent:t=>e(e=>({pot:[{...t,id:(0,l.uuid)(),at:(new Date).toISOString()},...e.pot]})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:s}}))}),{name:'covercharge-cashup-v1',storage:(0,r.createJSONStorage)(()=>s.default),partialize:e=>({...e,cashUps:e.cashUps.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))})),sales:e.sales.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))}))})}));const w=e=>{const s=b(t=>t.settings[e])??f(e);return t.default.useMemo(()=>({...s,cashFields:(0,u.withTakingsFields)(s.cashFields)}),[s])},y=e=>b(t=>t.show[e])??{showToday:!0,showPot:!0}},1049,[31,1190,995,1191,1179,13,1099]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PERM_CATALOG",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PERM_KEYS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PERM_GROUPS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"permLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ROLE_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ROLE_LABEL",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ownerLevel",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"has",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ticks",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"toggle",{enumerable:!0,get:function(){return f}}),e.effectivePerms=function(t,n,a){const o=[...new Set([...t,...n])];return(o.includes('*')?o:o.filter(t=>!a.includes(t))).sort()},e.tickSource=function(t,n){return t.extra.includes(n)?'extra':t.removed.includes(n)&&!t.base.includes('*')?'removed':c(t.base,n)?'role':'off'},Object.defineProperty(e,"SOURCE_WORDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"isCloser",{enumerable:!0,get:function(){return p}}),e.tradingDay=function(t=new Date,n="Europe/London"){const a=new Date(t.getTime()-216e5),o=new Intl.DateTimeFormat('en-GB',{timeZone:n,year:'numeric',month:'2-digit',day:'2-digit'}).formatToParts(a),s=t=>o.find(n=>n.type===t)?.value??'';return`${s('year')}-${s('month')}-${s('day')}`},Object.defineProperty(e,"ukDay",{enumerable:!0,get:function(){return b}}),e.logWords=function(t){const n=t=>Array.isArray(t)?t:[],a=t=>t&&'object'==typeof t&&!Array.isArray(t)?t:{};let s=[],u=[];if('role'===t.target_kind){const a=n(t.before),o=n(t.after);s=o.filter(t=>!a.includes(t)),u=a.filter(t=>!o.includes(t))}else{const o=a(t.before),l=a(t.after),c=n(o.extra),g=n(l.extra),f=n(o.removed),d=n(l.removed);s=[...g.filter(t=>!c.includes(t)),...f.filter(t=>!d.includes(t))],u=[...d.filter(t=>!f.includes(t)),...c.filter(t=>!g.includes(t))]}const c='role'===t.target_kind?`${l[t.target_ref??'']??t.target_name??'Role'} role`:t.target_name??'Someone',g=[...s.map(t=>`+ ${o(t)}`),...u.map(t=>`\u2212 ${o(t)}`)];return`${t.changed_by_name??'Admin'}: ${c}${g.length?`, ${g.join(', ')}`:', back to their role'}`},e.logWhen=function(t){const n=new Date(t);return new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',year:'numeric',hour:'2-digit',minute:'2-digit',hour12:!1}).format(n).replace(',','')};const t=[{key:'bookings.manage',label:'Take and change bookings',group:'Bookings & floor'},{key:'bookings.settings',label:'Booking settings: times, tables and blocks',group:'Bookings & floor'},{key:'floor.manage',label:'Edit the table plan and seat tables',group:'Bookings & floor'},{key:'orders.manage',label:'Kitchen and table orders',group:'Bookings & floor'},{key:'stock.manage',label:'Stock and deliveries',group:'Kitchen & stock'},{key:'suppliers.manage',label:'Suppliers',group:'Kitchen & stock'},{key:'suppliers.order',label:'Order from suppliers',group:'Kitchen & stock'},{key:'recipes.edit',label:'Edit recipe cards and allergens',group:'Kitchen & stock'},{key:'recipes.signoff',label:'Sign off recipe cards',group:'Kitchen & stock'},{key:'attendance.view',label:'See everyone\u2019s hours',group:'Team'},{key:'rota.manage',label:'Make the rota and approve timesheets',group:'Team'},{key:'rota.kitchen',label:'Make the kitchen rota (kitchen team only)',group:'Team',note:'Add, change and publish shifts for the kitchen team in the Head Chef app. No hours, pay or takings.'},{key:'rota.swap',label:'Approve shift swaps',group:'Team'},{key:'shift.manager',label:'Shift manager features in the Staff app',group:'Team'},{key:'staff.manage',label:'Add staff and change their details',group:'Team'},{key:'takings.view',label:'See takings, past cash ups and sales reports',group:'Money',note:'Without this, \u201cCan use cash up\u201d is tonight\u2019s cash up only.'},{key:'wages.view',label:'See pay and wages',group:'Money'},{key:'wages.manage',label:'Change pay, cash-up settings and any day\u2019s cash up',group:'Money'},{key:'venue.settings',label:'Change venue settings',group:'Venue'},{key:'devices.manage',label:'Pair and remove screens',group:'Venue'},{key:'outbox.view',label:'See messages sent to guests',group:'Venue'}],n=t.map(t=>t.key),a=[...new Set(t.map(t=>t.group))],o=n=>t.find(t=>t.key===n)?.label??n,s=['owner','manager','supervisor','head_chef','staff'],l={owner:'Owner',manager:'Manager',supervisor:'Supervisor',head_chef:'Head Chef',staff:'Staff'},u=t=>t.includes('*'),c=(t,n)=>t.includes('*')||t.includes(n),g=t=>u(t)?[...n]:n.filter(n=>t.includes(n)),f=(t,n,a)=>(a?[...new Set([...t,n])]:t.filter(t=>t!==n)).sort();const d={role:'from their role',extra:'added just for them',removed:'taken off just for them',off:'off'},p=t=>t.cashUp&&!t.takings;const b=t=>/^\d{4}-\d{2}-\d{2}$/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t},1050,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtDate",{enumerable:!0,get:function(){return j}}),_e.SignOffLine=$,_e.CardView=P,_e.CardEditor=R,_e.RecipeCards=function({rid:e,actor:s,mode:l}){const h=(0,a.useRecipeCards)(e),u=(0,n.useMemo)(()=>h.filter(e=>!c.OFF_CARD_LIST.has(e.menuItemId)),[h]),[p,x]=(0,n.useState)(''),[b,j]=(0,n.useState)([]),[C,w]=(0,n.useState)('free-from'),[I,$]=(0,n.useState)('all'),[D,T]=(0,n.useState)(null),[k,S]=(0,n.useState)(null),v='edit'===l&&(0,m.canEditCards)(s.role),B=v?u:u.filter(e=>!!e.signOff),L=(0,n.useMemo)(()=>{const e='all'===I?B:B.filter(e=>(0,m.cardState)(e)===I);return(0,m.filterCards)(e,p,b,C).slice().sort((e,t)=>e.section.localeCompare(t.section)||M(e.dish).localeCompare(M(t.dish)))},[B,p,b,C,I]),O=u.filter(e=>!e.signOff).length,A=D?u.find(e=>e.id===D):void 0,N=k&&'new'!==k?u.find(e=>e.id===k)??null:null,z=e=>j(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,y.jsxs)(r.default,{testID:"recipe-cards",style:{gap:12},children:['read'===l?(0,y.jsx)(d.Banner,{kind:"info",title:"Read-only",children:"Signed-off recipe cards only. The head chef keeps these up to date."}):(0,y.jsx)(d.Muted,{center:!0,children:(0,m.maySignOff)(s,{createdBy:s.name,createdByRole:s.role})?'You can add, edit and sign off cards. A card goes live once it is signed off. Editing a card clears the sign-off.':'You can add and edit cards. The Head Chef, an owner or a manager signs it off before it goes live. Editing a card clears the sign-off.'}),u.some(e=>'example'===e.origin)?(0,y.jsx)(d.Banner,{kind:"example",title:"Example data",children:"Cards marked \u201cExample data\u201d are made-up examples to show how recipe cards work. Replace them with your own dishes."}):null,v?(0,y.jsx)(d.Button,{testID:"new-card",label:"New recipe card",onPress:()=>S('new')}):null,(0,y.jsx)(t.TextInput,{testID:"card-search",accessibilityLabel:"Search recipe cards",value:p,onChangeText:x,placeholder:"Search dishes or ingredients",placeholderTextColor:"#7D776C",style:d.styles.input}),(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.T,{size:o.font.small,colour:o.colours.muted,children:"Allergens:"}),(0,y.jsx)(d.Chip,{label:"Free from",selected:'free-from'===C,onPress:()=>w('free-from')}),(0,y.jsx)(d.Chip,{label:"Contains",selected:'contains'===C,onPress:()=>w('contains')}),b.length?(0,y.jsx)(d.Chip,{label:"Clear",onPress:()=>j([])}):null]}),(0,y.jsx)(d.Row,{gap:6,wrap:!0,children:f.ALLERGENS.map(e=>(0,y.jsx)(i.default,{testID:`filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:b.includes(e.id)},onPress:()=>z(e.id),style:{paddingVertical:5,paddingHorizontal:10,minHeight:44,minWidth:44,justifyContent:'center',borderRadius:14,borderWidth:1,borderColor:b.includes(e.id)?o.colours.gold:o.colours.border,backgroundColor:b.includes(e.id)?o.colours.gold:'transparent'},children:(0,y.jsx)(d.T,{size:13,colour:b.includes(e.id)?o.colours.onGold:o.colours.text,children:e.short})},e.id))}),v?(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.Chip,{label:`All (${u.length})`,selected:'all'===I,onPress:()=>$('all')}),(0,y.jsx)(d.Chip,{label:`Awaiting sign-off (${O})`,selected:'awaiting'===I,onPress:()=>$('awaiting')}),(0,y.jsx)(d.Chip,{label:`Signed off (${u.length-O})`,selected:'signed-off'===I,onPress:()=>$('signed-off')})]}):null,(0,y.jsx)(r.default,{testID:"card-count",children:(0,y.jsxs)(d.Muted,{center:!0,children:[L.length," ",1===L.length?'card':'cards',b.length?` ${'free-from'===C?'free from':'containing'} ${b.map(f.allergenLabel).join('free-from'===C?' and ':' or ')}`:'']})}),L.map(e=>(0,y.jsx)(E,{c:e,actor:s,mode:l,editable:v,onPress:()=>T(e.id)},e.id)),L.length?null:(0,y.jsx)(r.default,{testID:"cards-empty",style:{alignItems:'center',paddingVertical:16},children:(0,y.jsx)(d.T,{center:!0,colour:o.colours.muted,children:u.length?'No cards match.':'No recipe cards yet.'})}),(0,y.jsx)(d.Sheet,{visible:!!A&&!k,onClose:()=>T(null),title:A?.dish??'',maxWidth:640,testID:"card-sheet",children:A?(0,y.jsx)(P,{card:A,mode:l,actor:'read'===l?{...s,role:'staff'}:s,onEdit:v?()=>S(A.id):void 0}):null}),(0,y.jsx)(d.Sheet,{visible:!!k,onClose:()=>S(null),title:'new'===k?'New recipe card':`Edit: ${N?.dish??''}`,maxWidth:680,testID:"editor-sheet",children:k?(0,y.jsx)(R,{rid:e,card:N,actor:s,onDone:e=>{S(null),T(e)}},k):null})]})},Object.defineProperty(_e,"addedLabel",{enumerable:!0,get:function(){return m.addedLabel}}),Object.defineProperty(_e,"allergenSentence",{enumerable:!0,get:function(){return m.allergenSentence}}),Object.defineProperty(_e,"unsignedOldestFirst",{enumerable:!0,get:function(){return m.unsignedOldestFirst}}),_e.useUnsignedDishes=O,_e.UnsignedDishList=function({rid:e,actor:t,onClose:s,onOpenCards:l}){const i=O(e),c=(0,a.useRecipeCards)(e),[f,p]=(0,n.useState)(null),[x,b]=(0,n.useState)(null),[j,C]=(0,n.useState)(null);(0,h.useBackLayer)(!0,s);const w=x?c.find(e=>e.id===x):void 0,I=j?c.find(e=>e.id===j)??null:null,$=async e=>{try{await(0,u.recipeCards)().signOff(e.id,t),p(null)}catch(t){p({id:e.id,text:t?.message??'Could not sign off.'})}};return(0,y.jsxs)(r.default,{testID:"unsigned-list",style:{gap:12,alignItems:'stretch'},children:[(0,y.jsx)(h.BackButton,{onPress:s,testID:"unsigned-back"}),(0,y.jsx)(d.T,{center:!0,size:22,weight:"bold",colour:o.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Dishes not signed off"}),(0,y.jsx)(d.Muted,{center:!0,testID:"unsigned-status",children:i.length?`${i.length} ${1===i.length?'dish':'dishes'} waiting, oldest first.`:'Every dish is signed off.'}),i.map(({item:e,card:s,at:n})=>{const i=(0,m.allergenSentence)(s?s.allergens:e.allergens),a=!!s&&(0,m.maySignOff)(t,s),c=s?(0,m.signOffBlock)(s):null;return(0,y.jsxs)(d.Card,{highlight:o.colours.amber,style:{alignItems:'center',gap:8},children:[(0,y.jsxs)(r.default,{testID:`unsigned-row-${e.id}`,accessible:!0,accessibilityLabel:`${e.name}, ${(0,m.addedLabel)(n)}, ${i}`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,y.jsx)(d.T,{center:!0,weight:"bold",size:18,children:e.name}),(0,y.jsx)(d.T,{center:!0,children:(0,m.addedLabel)(n)}),(0,y.jsx)(d.Muted,{center:!0,children:i})]}),s&&a&&!c?(0,y.jsx)(d.Button,{testID:`unsigned-sign-${e.id}`,kind:"success",label:"Sign off",accessibilityLabel:`Sign off ${e.name} as ${t.name}`,onPress:()=>$(s),style:{alignSelf:'stretch'}}):null,s&&a&&c?(0,y.jsx)(d.Muted,{center:!0,children:c}):null,s&&!a?(0,y.jsx)(d.Muted,{center:!0,children:"Only the Head Chef, an owner or a manager can sign it off."}):null,s?(0,y.jsx)(d.Button,{small:!0,kind:"secondary",testID:`unsigned-open-${e.id}`,label:a&&c?'Check the recipe card':'Open recipe card',accessibilityLabel:`Open the recipe card for ${e.name}`,onPress:()=>b(s.id),style:{alignSelf:'stretch'}}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d.Muted,{center:!0,children:"No recipe card yet."}),l?(0,y.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open recipe cards",onPress:l,style:{alignSelf:'stretch'}}):null]}),f&&s&&f.id===s.id?(0,y.jsx)(d.Banner,{kind:"danger",children:f.text}):null]},e.id)}),(0,y.jsx)(d.Sheet,{visible:!!w&&!j,onClose:()=>b(null),title:w?.dish??'',maxWidth:640,testID:"unsigned-card-sheet",children:w?(0,y.jsx)(P,{card:w,actor:t,onEdit:(0,m.canEditCards)(t.role)?()=>C(w.id):void 0}):null}),(0,y.jsx)(d.Sheet,{visible:!!j,onClose:()=>C(null),title:`Edit: ${I?.dish??''}`,maxWidth:680,testID:"unsigned-editor-sheet",children:j&&I?(0,y.jsx)(R,{rid:e,card:I,actor:t,onDone:e=>{C(null),b(e)}},j):null})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),l=e(_r(_d[3])),i=e(_r(_d[4])),r=e(_r(_d[5])),o=_r(_d[6]),d=_r(_d[7]),a=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]);const j=e=>{const t=new Date(e.length<=10?`${e}T12:00:00`:e);return isNaN(+t)?e:t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})},C=e=>`\xa3${(Math.round(e)/100).toFixed(2)}`,w=e=>null==e?'Price on the board':C(e),I={example:p.EXAMPLE_TAG,imported:'Imported from the menu',new:null};function $({card:e,testID:t}){return e.signOff?(0,y.jsx)(r.default,{testID:t??'card-signed-off',accessibilityLabel:`Signed off by ${e.signOff.by}, ${j(e.signOff.at)}`,style:{alignItems:'center',gap:4,width:'100%'},children:(0,y.jsxs)(d.T,{center:!0,weight:"bold",colour:o.colours.gold,children:["Signed off by ",e.signOff.by,", ",j(e.signOff.at)]})}):(0,y.jsxs)(r.default,{testID:t??'card-signed-off',accessibilityLabel:"Not signed off yet",style:{alignItems:'center',gap:4,width:'100%'},children:[(0,y.jsx)(d.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:m.STATE_LABEL.awaiting}),(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,children:c.portionCardItemIds.includes(e.menuItemId)?'A portion card for the kitchen. The dish on the menu is not changed by this card.':e.wasLive?'Edited since the last sign-off. Guests see it as awaiting sign-off until a chef signs it again.':'This dish stays off the menu until a chef signs it off.'})]})}function D({dish:e,photo:t,height:s=180,pending:n,index:i,total:a,radius:c=12}){const h=n?{uri:n}:t?(0,u.recipeCards)().photoSource(t):null,f=i&&a?`Photo ${i} of ${a}`:'Plating photo';return h?(0,y.jsx)(l.default,{testID:i?`card-photo-${i}`:'card-photo',accessibilityLabel:`${f}${e?`: ${e}`:''}`,source:h,style:{width:'100%',height:s,borderRadius:c,backgroundColor:o.colours.surface2},resizeMode:"cover"}):(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:"No plating photo yet"+(e?`, ${e}`:''),style:{width:'100%',height:s,borderRadius:c,backgroundColor:o.colours.goldTint,alignItems:'center',justifyContent:'center',borderWidth:1.5,borderColor:o.colours.gold,gap:2},children:[(0,y.jsx)(d.T,{center:!0,size:Math.min(64,Math.max(30,Math.round(.38*s))),weight:"bold",colour:o.colours.gold,children:(e.trim()[0]??'?').toUpperCase()}),s>=120?(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:o.colours.goldLight,children:"No plating photo yet"}):null]})}function T({map:e}){const t=f.ALLERGENS.filter(t=>e[t.id]).map(e=>e.id);return t.length?(0,y.jsx)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:t.map(t=>{const s='may'===e[t],n=s?`May contain ${(0,f.allergenLabel)(t).toLowerCase()}`:(0,f.allergenLabel)(t);return(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:s?n:`Contains ${(0,f.allergenLabel)(t).toLowerCase()}`,style:{paddingHorizontal:12,paddingVertical:6,borderRadius:999,borderWidth:1.5,borderColor:s?o.colours.amber:o.colours.gold,backgroundColor:s?'transparent':o.colours.gold,maxWidth:'100%'},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"semibold",center:!0,colour:s?o.colours.amber:o.colours.onGold,children:n})},t)})}):(0,y.jsx)(d.Muted,{center:!0,children:"None of the UK 14 allergens."})}const k=({label:e,gold:t,testID:s})=>(0,y.jsx)(r.default,{testID:s,style:{paddingHorizontal:12,paddingVertical:5,borderRadius:999,borderWidth:1,borderColor:t?o.colours.gold:o.colours.accentBorder,backgroundColor:t?o.colours.goldTint:o.colours.surface,maxWidth:'100%'},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"medium",center:!0,colour:t?o.colours.goldLight:o.colours.text,children:e})}),S=({title:e})=>(0,y.jsxs)(r.default,{style:{width:'100%',alignItems:'center',gap:4,paddingTop:4},children:[(0,y.jsx)(d.T,{size:13,weight:"semibold",center:!0,colour:o.colours.goldMuted,accessibilityRole:"header",children:e.toUpperCase()}),(0,y.jsx)(r.default,{style:{width:36,height:2,borderRadius:1,backgroundColor:o.colours.gold}})]});function P({card:e,actor:t,onEdit:s,mode:l="edit"}){const[i,a]=(0,n.useState)(null),c=(0,m.signOffBlock)(e),h=I[e.origin],f=(0,m.cardPhotos)(e),p=(0,m.maySignOff)(t,e),x=(0,b.useCardCosting)(e,t.role,l);return(0,y.jsxs)(r.default,{testID:"card-view",style:{gap:12,alignItems:'center',width:'100%'},children:[f.length?(0,y.jsx)(D,{dish:e.dish,photo:f[0],height:220,index:1,total:f.length,radius:18}):(0,y.jsx)(D,{dish:e.dish,height:180,radius:18}),f.length>1?(0,y.jsx)(d.Row,{gap:8,style:{width:'100%'},children:f.slice(1).map((t,s)=>(0,y.jsx)(r.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(D,{dish:e.dish,photo:t,height:72,index:s+2,total:f.length})},t))}):null,(0,y.jsx)(d.T,{center:!0,size:26,weight:"bold",colour:o.colours.gold,accessibilityRole:"header",children:e.dish}),(0,y.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[h?(0,y.jsx)(d.Badge,{label:h,kind:'example'===e.origin?'blue':'neutral'}):null,(0,y.jsx)(k,{label:e.section,gold:!0}),(0,y.jsx)(k,{label:w(e.price)}),x&&x.summary.lines.length?(0,y.jsx)(k,{testID:"card-yield",label:x.summary.batch/Math.max(1,x.summary.perPortion||1)>1.5?`Makes ${Math.round(x.summary.batch/x.summary.perPortion)} portions`:'1 portion'}):null]}),(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:`Created by ${e.createdBy||'not recorded'}`,style:{width:'100%',alignItems:'center'},children:(0,y.jsxs)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,testID:"card-created-by",children:["Created by ",e.createdBy||'Not recorded']})}),(0,y.jsx)(r.default,{style:{width:'100%',paddingVertical:8,paddingHorizontal:10,borderRadius:14,borderWidth:1,borderColor:e.signOff?o.colours.accentBorder:o.colours.amber,backgroundColor:e.signOff?o.colours.accentBg:o.colours.amberBg},children:(0,y.jsx)($,{card:e,testID:"card-status"})}),(0,y.jsx)(S,{title:"Allergens"}),(0,y.jsx)(r.default,{testID:"card-allergens",style:{width:'100%'},children:(0,y.jsx)(T,{map:e.allergens})}),e.allergenNotes?(0,y.jsx)(d.Muted,{center:!0,children:e.allergenNotes}):null,e.allergensConfirmed?(0,y.jsxs)(d.Muted,{center:!0,children:["Allergen list confirmed by ",e.allergensConfirmed.by," on ",j(e.allergensConfirmed.at),"."]}):null,(0,y.jsx)(S,{title:"Ingredients"}),e.ingredients.length?(0,y.jsx)(r.default,{testID:"card-ingredients",style:{width:'100%',borderRadius:14,borderWidth:1,borderColor:o.colours.border,backgroundColor:o.colours.surface,overflow:'hidden'},children:e.ingredients.map((e,t)=>{const s=[e.qty,e.unit].filter(Boolean).join(' '),n=x?.byRecipeIng[e.id];return(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}${s?`, ${s}`:''}${n?`, ${C(n.cost)}`:''}`,style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:10,paddingHorizontal:12,borderTopWidth:t?1:0,borderColor:o.colours.border,minHeight:48},children:[(0,y.jsx)(d.T,{style:{flex:1,minWidth:0},children:e.name}),(0,y.jsxs)(r.default,{style:{alignItems:'flex-end',flexShrink:0,maxWidth:'40%'},children:[(0,y.jsx)(d.T,{weight:"semibold",colour:o.colours.goldLight,style:{textAlign:'right'},children:s||'\u2013'}),n?(0,y.jsx)(d.T,{size:o.font.small,colour:o.colours.muted,style:{textAlign:'right'},children:C(n.cost)}):null]})]},e.id)})}):(0,y.jsx)(d.Muted,{center:!0,children:"No ingredients on this card yet."}),(0,y.jsx)(S,{title:"Method"}),e.steps.length?(0,y.jsx)(r.default,{testID:"card-method",style:{width:'100%',gap:10},children:e.steps.map((e,t)=>(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`Step ${t+1}. ${e}`,style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,y.jsx)(r.default,{style:{width:32,height:32,borderRadius:16,borderWidth:1.5,borderColor:o.colours.gold,backgroundColor:o.colours.goldTint,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"bold",colour:o.colours.gold,children:t+1})}),(0,y.jsx)(d.T,{style:{flex:1,minWidth:0,paddingTop:4},children:e})]},t))}):(0,y.jsxs)(d.Muted,{center:!0,children:["No method yet.",(0,m.canEditCards)(t.role)?' Tap Edit to add the steps.':'']}),(0,y.jsx)(b.CardGpPanel,{card:e,actor:t,mode:l}),(0,y.jsxs)(d.Muted,{center:!0,children:["Version ",e.version," \xb7 last changed ",j(e.updatedAt)," by ",e.updatedBy]}),(0,m.canEditCards)(t.role)&&s?(0,y.jsx)(d.Button,{testID:"edit-card",kind:"secondary",label:"Edit card",accessibilityLabel:`Edit ${e.dish}`,onPress:s,style:{alignSelf:'stretch'}}):null,p&&!e.signOff?(0,y.jsxs)(r.default,{style:{gap:6,width:'100%'},children:[c?(0,y.jsx)(d.Banner,{kind:"warn",title:"Not ready to sign off",children:c}):null,(0,y.jsx)(d.Button,{testID:"sign-off",kind:"success",label:`Sign off as ${t.name}`,accessibilityLabel:`Sign off ${e.dish} as ${t.name}`,disabled:!!c,onPress:async()=>{try{await(0,u.recipeCards)().signOff(e.id,t),a(null)}catch(e){a(e?.message??'Could not sign off.')}}})]}):null,!(0,m.canEditCards)(t.role)||p||e.signOff?null:(0,y.jsx)(d.Banner,{kind:"info",title:"Sign-off",children:"Only the Head Chef, an owner or a manager can sign it off."}),i?(0,y.jsx)(d.Banner,{kind:"danger",children:i}):null]})}const v=()=>`i-${Math.random().toString(36).slice(2,9)}`,B=(e,t,s)=>e?{id:e.id,dish:e.dish,section:e.section,price:null==e.price?'':(e.price/100).toFixed(2),description:'',createdBy:e.createdBy??'',ingredients:e.ingredients.map(e=>({...e})),steps:[...e.steps],allergens:{...e.allergens},dismissed:[...e.dismissed],allergenNotes:e.allergenNotes??'',photos:(0,m.cardPhotos)(e),pending:[],confirm:!!e.allergensConfirmed}:{id:(0,m.uuid)(),dish:'',section:t,price:'',description:'',createdBy:s,ingredients:[{id:v(),name:'',qty:'',unit:''}],steps:[''],allergens:{},dismissed:[],allergenNotes:'',photos:[],pending:[],confirm:!1},L=e=>{const t=e.replace(/[\xa3\s]/g,'');if(!t)return null;const s=Number(t);return isFinite(s)&&s>=0?Math.round(100*s):'bad'};function R({rid:e,card:l,actor:c,onDone:h}){const p=(0,a.useRestaurant)(e),b=p?.sections??['Mains'],[j,C]=(0,n.useState)(()=>B(l,b[0]??'Mains',c.name)),[w,I]=(0,n.useState)(null),[$,T]=(0,n.useState)(null),[k,S]=(0,n.useState)(!1),P=e=>C(t=>({...t,...e})),R=j.ingredients.filter(e=>e.name.trim()),M={ingredients:R,allergens:j.allergens,dismissed:j.dismissed},O=(0,m.suggestAllergens)(R),E=(0,m.unresolved)(M),A=e=>{const t=j.allergens[e],s={...j.allergens};t?'contains'===t?s[e]='may':delete s[e]:s[e]='contains',P({allergens:s,dismissed:j.dismissed.filter(t=>t!==e),confirm:!1})},N=e=>{const t={...j.allergens};delete t[e],P({allergens:t,dismissed:[...new Set([...j.dismissed,e])],confirm:!1})},z=(e,t)=>P({ingredients:j.ingredients.map((s,n)=>n===e?{...s,...t}:s),confirm:!1}),W=(e,t)=>P({steps:j.steps.map((s,n)=>n===e?t:s)}),H=(e,t)=>{const s=[...j.steps],n=e+t;n<0||n>=s.length||([s[e],s[n]]=[s[n],s[e]],P({steps:s}))},_=j.photos.length+j.pending.length,F=async e=>{if(T(null),_>=m.MAX_RECIPE_PHOTOS)T('A card can hold 5 photos.');else try{const t=await(0,x.capturePlatingPhoto)(e);t&&(P({pending:[...j.pending,t]}),T(`Photo ${_+1} of ${m.MAX_RECIPE_PHOTOS}. Compressed on this device: ${t.width}\xd7${t.height}, ${(0,x.kb)(t.bytes)}${t.originalBytes?` (was ${(0,x.kb)(t.originalBytes)})`:''}.`))}catch(e){T(e?.message??'Could not read that photo.')}},[G,V]=(0,n.useState)(!1),U=j.dish||l?.dish||'this dish';return(0,y.jsxs)(r.default,{testID:"card-editor",style:{gap:12},children:[l?.signOff?(0,y.jsx)(d.Banner,{kind:"warn",title:"Saving a change clears the sign-off",children:"This card is signed off. Any change you save clears it until the Head Chef, an owner or a manager signs it off again."}):null,(0,y.jsx)(d.Field,{testID:"dish-name",label:"Dish name",value:j.dish,onChangeText:e=>P({dish:e}),placeholder:"e.g. Cullen skink"}),(0,y.jsx)(d.Field,{testID:"card-created-by-field",label:"Created by",value:j.createdBy,onChangeText:e=>P({createdBy:e}),placeholder:"Chef's name"}),l?null:(0,y.jsx)(d.Field,{testID:"dish-description",label:"Menu description (optional)",value:j.description,onChangeText:e=>P({description:e}),placeholder:"What guests read on the menu"}),(0,y.jsx)(d.T,{size:o.font.small,weight:"medium",colour:o.colours.muted,children:"Menu section"}),(0,y.jsx)(d.Row,{wrap:!0,gap:6,children:b.map(e=>(0,y.jsx)(d.Chip,{label:e,selected:j.section===e,onPress:()=>P({section:e})},e))}),(0,y.jsx)(d.Field,{testID:"dish-price",label:"Price (\xa3)",value:j.price,onChangeText:e=>P({price:e}),placeholder:"Blank = price on the board",keyboardType:"decimal-pad"}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Photos"}),(0,y.jsx)(d.T,{center:!0,colour:o.colours.muted,children:"Up to 5 photos."}),(0,y.jsxs)(r.default,{testID:"card-photos",style:{gap:10,width:'100%',alignItems:'center'},children:[j.photos.map((e,t)=>(0,y.jsxs)(r.default,{style:{width:'100%',gap:6,alignItems:'center'},children:[(0,y.jsx)(D,{dish:U,photo:e,height:160,index:t+1,total:_||j.photos.length}),(0,y.jsx)(d.Button,{testID:`photo-remove-${t+1}`,kind:"ghost",label:`Remove photo ${t+1}`,accessibilityLabel:`Remove photo ${t+1} of ${U}`,onPress:()=>P({photos:j.photos.filter((e,s)=>s!==t)})})]},e)),j.pending.map((e,t)=>(0,y.jsxs)(r.default,{style:{width:'100%',gap:6,alignItems:'center'},children:[(0,y.jsx)(D,{dish:U,pending:e.dataUrl,height:160,index:j.photos.length+t+1,total:_}),(0,y.jsx)(d.Button,{testID:`photo-remove-new-${t+1}`,kind:"ghost",label:`Remove photo ${j.photos.length+t+1}`,accessibilityLabel:`Remove new photo ${j.photos.length+t+1}`,onPress:()=>P({pending:j.pending.filter((e,s)=>s!==t)})})]},`new-${t}`)),_?null:(0,y.jsx)(D,{dish:U,height:160})]}),(0,y.jsx)(d.Button,{testID:"photo-camera",kind:"secondary",label:"Take photo",accessibilityLabel:"Take a photo for this recipe card",disabled:_>=m.MAX_RECIPE_PHOTOS,onPress:()=>F('camera')}),(0,y.jsx)(d.Button,{testID:"photo-library",kind:"secondary",label:"Choose photo",accessibilityLabel:"Choose a photo for this recipe card",disabled:_>=m.MAX_RECIPE_PHOTOS,onPress:()=>F('library')}),$?(0,y.jsx)(r.default,{testID:"photo-info",children:(0,y.jsx)(d.Muted,{center:!0,children:$})}):(0,y.jsx)(d.Muted,{center:!0,children:'shared'===(0,u.recipeCards)().mode?'Photos are shrunk on this device, then shared with the team. Staff and guests only see them once the card is signed off.':'Photos are shrunk on this device before they are saved.'}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Ingredients"}),(0,y.jsx)(d.Muted,{children:"Quantity, unit and ingredient. We suggest allergens from the ingredient names."}),j.ingredients.map((e,n)=>{const l=e.name.trim()?(0,m.suggestAllergens)([e]):[];return(0,y.jsxs)(r.default,{style:{gap:4},children:[(0,y.jsxs)(d.Row,{gap:6,children:[(0,y.jsx)(t.TextInput,{testID:`ing-qty-${n}`,accessibilityLabel:`Quantity ${n+1}`,value:e.qty,onChangeText:e=>z(n,{qty:e}),placeholder:"Qty",placeholderTextColor:"#7D776C",style:[d.styles.input,{width:64}]}),(0,y.jsx)(t.TextInput,{testID:`ing-unit-${n}`,accessibilityLabel:`Unit ${n+1}`,value:e.unit,onChangeText:e=>z(n,{unit:e}),placeholder:"g / ml / each",placeholderTextColor:"#7D776C",style:[d.styles.input,{width:92}]}),(0,y.jsx)(t.TextInput,{testID:`ing-name-${n}`,accessibilityLabel:`Ingredient ${n+1}`,value:e.name,onChangeText:e=>z(n,{name:e}),placeholder:"Ingredient",placeholderTextColor:"#7D776C",style:[d.styles.input,{flex:1}]}),(0,y.jsx)(s.GoldClose,{size:"sm",label:`Remove ingredient ${n+1}`,onPress:()=>P({ingredients:j.ingredients.filter((e,t)=>t!==n)})})]}),l.length?(0,y.jsxs)(d.Muted,{children:["Suggests: ",l.map(f.allergenLabel).join(', ')]}):null]},e.id)}),(0,y.jsx)(d.Button,{testID:"ing-add",small:!0,kind:"ghost",label:"Add ingredient",onPress:()=>P({ingredients:[...j.ingredients,{id:v(),name:'',qty:'',unit:''}]})}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Method"}),j.steps.map((e,n)=>(0,y.jsxs)(d.Row,{gap:6,style:{alignItems:'flex-start'},children:[(0,y.jsx)(d.T,{colour:o.colours.gold,style:{width:20,paddingTop:10},children:n+1}),(0,y.jsx)(t.TextInput,{testID:`step-${n}`,accessibilityLabel:`Step ${n+1}`,value:e,onChangeText:e=>W(n,e),multiline:!0,placeholder:"Describe this step",placeholderTextColor:"#7D776C",style:[d.styles.input,{flex:1,minHeight:56,textAlignVertical:'top'}]}),(0,y.jsxs)(r.default,{style:{gap:4},children:[(0,y.jsx)(i.default,{accessibilityLabel:`Move step ${n+1} up`,onPress:()=>H(n,-1),hitSlop:6,children:(0,y.jsx)(d.T,{colour:o.colours.muted,children:"\u25b2"})}),(0,y.jsx)(i.default,{accessibilityLabel:`Move step ${n+1} down`,onPress:()=>H(n,1),hitSlop:6,children:(0,y.jsx)(d.T,{colour:o.colours.muted,children:"\u25bc"})}),(0,y.jsx)(s.GoldClose,{size:"sm",label:`Remove step ${n+1}`,onPress:()=>P({steps:j.steps.filter((e,t)=>t!==n)})})]})]},n)),(0,y.jsx)(d.Button,{testID:"step-add",small:!0,kind:"ghost",label:"Add step",onPress:()=>P({steps:[...j.steps,'']})}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Allergens (UK 14)"}),(0,y.jsx)(d.Muted,{children:"Tap to cycle: contains \u2192 may contain \u2192 none. Suggested allergens are marked \u201c?\u201d until you add or rule them out."}),E.length?(0,y.jsxs)(r.default,{testID:"allergen-suggestions",style:{gap:6},children:[(0,y.jsx)(d.Banner,{kind:"warn",title:`Check ${E.length} suggested allergen${1===E.length?'':'s'}`,children:E.map(e=>`${(0,f.allergenLabel)(e)} (from ${(0,m.suggestedBy)(R,e).join(', ')})`).join('; ')}),E.map(e=>(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.T,{style:{flex:1},children:(0,f.allergenLabel)(e)}),(0,y.jsx)(d.Button,{testID:`suggest-add-${e}`,small:!0,label:"Contains",onPress:()=>P({allergens:{...j.allergens,[e]:'contains'},confirm:!1})}),(0,y.jsx)(d.Button,{testID:`suggest-may-${e}`,small:!0,kind:"secondary",label:"May contain",onPress:()=>P({allergens:{...j.allergens,[e]:'may'},confirm:!1})}),(0,y.jsx)(d.Button,{testID:`suggest-dismiss-${e}`,small:!0,kind:"ghost",label:"Not in this dish",onPress:()=>N(e)})]},e)),(0,y.jsx)(d.Button,{testID:"apply-suggestions",small:!0,kind:"secondary",label:"Add all suggestions as \u2018contains\u2019",onPress:()=>{const e={...j.allergens};E.forEach(t=>{e[t]='contains'}),P({allergens:e,confirm:!1})}})]}):null,(0,y.jsx)(d.Row,{wrap:!0,gap:6,children:f.ALLERGENS.map(e=>{const t=j.allergens[e.id],s=O.includes(e.id)&&!t&&!j.dismissed.includes(e.id),n='contains'===t?o.colours.redBg:'may'===t?o.colours.amberBg:o.colours.surface2,l='contains'===t?o.colours.red:'may'===t?o.colours.amber:s?o.colours.gold:o.colours.border;return(0,y.jsx)(i.default,{testID:`allergen-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.short}: ${'contains'===t?'contains':'may'===t?'may contain':'not marked'}`,onPress:()=>A(e.id),style:{paddingVertical:6,paddingHorizontal:10,borderRadius:16,borderWidth:s?2:1,borderStyle:s?'dashed':'solid',borderColor:l,backgroundColor:n},children:(0,y.jsxs)(d.T,{size:o.font.small,colour:'contains'===t?'#FFD9D4':'may'===t?'#FFE2A8':o.colours.text,children:[e.short,'may'===t?' (may)':'',s?' ?':'']})},e.id)})}),j.dismissed.length?(0,y.jsxs)(d.Muted,{children:["Ruled out: ",j.dismissed.map(f.allergenLabel).join(', ')]}):null,(0,y.jsx)(d.Field,{testID:"allergen-notes",label:"Allergen notes (optional)",value:j.allergenNotes,onChangeText:e=>P({allergenNotes:e}),placeholder:"e.g. Cooked in the shared fryer"}),(0,y.jsxs)(i.default,{testID:"confirm-allergens",accessibilityRole:"checkbox",accessibilityState:{checked:j.confirm,disabled:E.length>0},disabled:E.length>0,onPress:()=>P({confirm:!j.confirm}),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:j.confirm?o.colours.ok:o.colours.border,opacity:E.length?.5:1},children:[(0,y.jsx)(r.default,{style:{width:22,height:22,borderRadius:4,borderWidth:2,borderColor:j.confirm?o.colours.ok:o.colours.muted,alignItems:'center',justifyContent:'center',backgroundColor:j.confirm?o.colours.okBg:'transparent'},children:j.confirm?(0,y.jsx)(d.T,{colour:o.colours.ok,children:"\u2713"}):null}),(0,y.jsx)(d.T,{style:{flex:1},children:E.length?'Check the suggested allergens above first':`I have checked the allergen list against the ingredients (${c.name})`})]}),w?(0,y.jsx)(d.Banner,{kind:"danger",children:w}):null,(0,y.jsx)(d.Button,{testID:"card-save",label:G?'Saving\u2026':l?'Save changes':'Save card',disabled:G,onPress:async()=>{I(null);const t=L(j.price);if(!j.dish.trim())return I('Give the dish a name.');if('bad'===t)return I('Price should be in pounds, e.g. 14.50 (or leave it blank for "price on the board").');const s=(0,u.recipeCards)();V(!0);try{const n=[...j.photos];for(const t of j.pending){if(n.length>=m.MAX_RECIPE_PHOTOS)break;n.push(await s.savePhoto(e,j.id,t))}const i=j.steps.map(e=>e.trim()).filter(Boolean),r=j.createdBy.trim(),o={dish:j.dish.trim(),section:j.section,price:t,ingredients:R.map(e=>({...e,name:e.name.trim(),qty:e.qty.trim(),unit:e.unit.trim()})),steps:i,allergens:j.allergens,dismissed:j.dismissed,allergenNotes:j.allergenNotes.trim()||void 0,photo:n[0],photos:n,createdBy:r||void 0};if(l)await s.update(l.id,{...o,confirmAllergens:j.confirm},c),h(l.id);else{const t=await s.create(e,{...o,id:j.id,description:j.description.trim()||void 0},c);j.confirm&&await s.update(t.id,{confirmAllergens:!0},c),h(t.id)}}catch(e){I(e?.message??'Could not save the card.')}finally{V(!1)}}}),(0,y.jsx)(d.Muted,{center:!0,children:(0,m.maySignOff)(c,{createdBy:j.createdBy||c.name,createdByRole:c.role})?'After saving, sign the card off so it goes live.':'After saving, the Head Chef, an owner or a manager signs it off before it goes live.'}),l?k?(0,y.jsxs)(d.Row,{gap:8,children:[(0,y.jsx)(d.Button,{testID:"card-delete-yes",small:!0,kind:"danger",label:"Yes, remove this dish",onPress:async()=>{if(l)try{await(0,u.recipeCards)().remove(l.id,c),h(null)}catch(e){I(e?.message??'Could not remove the card.')}}}),(0,y.jsx)(d.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>S(!1)})]}):(0,y.jsx)(d.Button,{testID:"card-delete",small:!0,kind:"ghost",label:"Remove card and dish from the menu",onPress:()=>S(!0)}):null]})}const M=e=>e.replace(/ \xb7 Starter$/,' \xb7 1').replace(/ \xb7 Main$/,' \xb7 2');function O(e){const t=(0,a.useAllMenu)(e),s=(0,a.useRecipeCards)(e);return(0,n.useMemo)(()=>{const e=new Map(s.map(e=>[e.menuItemId,e]));return(0,m.unsignedOldestFirst)(t,t=>e.get(t.id)??(t.recipeCardId?s.find(e=>e.id===t.recipeCardId):void 0))},[t,s])}function E({c:e,actor:t,mode:s,editable:n,onPress:l}){const a=(0,m.cardPhotos)(e),c=(0,b.useCardCosting)(e,'read'===s?'staff':t.role,s),h=f.ALLERGENS.filter(t=>e.allergens[t.id]).length,u=c?.summary.gp,x=c?.summary.tone,C='ok'===x?o.colours.ok:'amber'===x?o.colours.amber:'red'===x?o.colours.red:o.colours.muted,I=`${e.dish}, ${e.section}, ${w(e.price)}, ${h?`${h} allergen${1===h?'':'s'}`:'no allergens marked'}${null!=u?`, GP ${u.toFixed(1)} percent`:''}, created by ${e.createdBy||'not recorded'}, ${e.signOff?`signed off by ${e.signOff.by}`:'awaiting sign-off'}`;return(0,y.jsxs)(i.default,{testID:`card-${e.menuItemId}`,accessibilityRole:"button",accessibilityLabel:I,onPress:l,style:({pressed:t})=>({width:'100%',minHeight:48,flexDirection:'row',gap:12,alignItems:'center',padding:10,borderRadius:18,borderWidth:1,borderColor:!e.signOff&&n?o.colours.amber:o.colours.accentBorder,backgroundColor:t?o.colours.tilePressed:o.colours.tile}),children:[(0,y.jsx)(r.default,{style:{width:84,flexShrink:0},children:(0,y.jsx)(D,{dish:e.dish,photo:a[0],height:84,radius:14})}),(0,y.jsxs)(r.default,{style:{flex:1,minWidth:0,gap:4,alignItems:'center'},children:[(0,y.jsx)(d.T,{center:!0,weight:"bold",size:18,colour:o.colours.gold,children:e.dish}),(0,y.jsxs)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,children:[e.section," \xb7 ",w(e.price),'example'===e.origin?` \xb7 ${p.EXAMPLE_TAG}`:'']}),(0,y.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,y.jsx)(k,{label:h?`${h} allergen${1===h?'':'s'}`:'No allergens marked'}),null!=u?(0,y.jsx)(r.default,{testID:`card-gp-${e.menuItemId}`,style:{paddingHorizontal:10,paddingVertical:4,borderRadius:999,borderWidth:1.5,borderColor:C},children:(0,y.jsxs)(d.T,{size:o.font.small,weight:"bold",colour:C,children:["GP ",u.toFixed(1),"%"]})}):null]}),(0,y.jsxs)(d.T,{center:!0,size:o.font.small,testID:`card-created-${e.menuItemId}`,children:["Created by ",e.createdBy||'Not recorded']}),(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:e.signOff?o.colours.goldLight:o.colours.amber,children:e.signOff?`Signed off by ${e.signOff.by}, ${j(e.signOff.at)}`:m.STATE_LABEL.awaiting})]})]})}},1051,[874,835,31,197,264,128,825,818,823,1448,1043,839,819,1179,1219,1416,1449,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1052,[874,31,264,128,818,825,863,881,1082,1276,1277,25]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ChatAsCtx",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return w.dmId}}),Object.defineProperty(_e,"inChannel",{enumerable:!0,get:function(){return w.inChannel}}),_e.autoPost=function(e,t){const n=new Date(globalThis.__ccNow??Date.now()).toISOString();(Array.isArray(e)?e:[e]).forEach(e=>f.useOwner.getState().sys(e,t,n))},_e.ensureChat=D,_e.useChatUnread=A,Object.defineProperty(_e,"DISPLAY_DEVICE_ID",{enumerable:!0,get:function(){return B}}),_e.chatSender=L,_e.Chat=function({go:e}){return(0,O.jsx)(z,{children:(0,O.jsx)(K,{go:e})})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),a=r(d[3]),o=r(d[4]),i=r(d[5]),l=r(d[6]),c=e(r(d[7])),h=e(r(d[8])),u=e(r(d[9])),m=r(d[10]),f=r(d[11]),p=r(d[12]),b=r(d[13]),x=r(d[14]),j=r(d[15]),y=r(d[16]),w=r(d[17]),C=r(d[18]),v=r(d[19]),S=r(d[20]),k=r(d[21]),O=r(d[22]);const R=(0,i.createContext)(null);function I(e){const t=(0,x.useCtx)(e),n=(0,i.useContext)(R);return n?{...t,meId:n.meId,role:n.role}:t}const T=[{id:'all',name:'Team',icon:'\ud83d\udce2'},{id:'kitchen',name:'Kitchen',icon:'\ud83c\udf73',pinned:!0},{id:'foh',name:'Front of house',icon:'\ud83c\udf7d\ufe0f'},{id:'managers',name:'Managers',icon:'\ud83d\udd11'}],M=[],P=e=>(e??'').replace(' (example)','');function D(e){if(a.LIVE_VENUE_BUILD)return;if(o.IS_WILDINGS)return;const t=f.useOwner.getState();if(t.chat.some(e=>'m-seed-all'===e.id&&/this phone only/.test(e.text??''))&&f.useOwner.getState().chatPatch('m-seed-all',{text:'Welcome to the team chat on CoverCharge.'}),t.chat.length)return;const n=(t,n,s,a={})=>{return{id:`m-seed-${t}`,ch:t,from:'system',text:s,at:(o=n,new Date(e.getTime()-6e4*o).toISOString()),reactions:{},seenBy:[],...a};var o};f.useOwner.setState({chat:[n('all',5,'Welcome to the team chat on CoverCharge.',{pinned:!0}),n('kitchen',4,'Kitchen channel: Head Chef, kitchen team and managers.'),n('foh',3,'Front of house channel: front of house, bar and managers.'),n('managers',2,'Managers channel: owners, managers and the supervisor only.')]})}function A(){const{meId:e}=I(3e4),{role:t}=I(3e4),n=(0,f.useOwner)(e=>e.chat),s=(0,f.useOwner)(e=>e.staff),a=(0,f.useOwner)(t=>t.chatMuted[e]??M),o=(0,i.useMemo)(()=>E(s,e,t),[s,e,t]);return(0,i.useMemo)(()=>{const t={};return n.forEach(n=>{n.removed||n.from===e||n.seenBy.includes(e)||!(0,w.inChannel)(n.ch,o)||(t[n.ch]=(t[n.ch]??0)+1)}),{by:t,total:Object.entries(t).filter(([e])=>!a.includes(e)).reduce((e,[,t])=>e+t,0)}},[n,e,a,o])}function E(e,t,n){if(t===j.CAR_DEVICE_ID)return{id:t,name:j.CAR_ACTOR,role:'owner',job:'',active:!0,level:'Owner',dept:''};if('display-device'===t)return{id:t,name:'Display',role:'owner',job:'',active:!0,level:'Owner',dept:''};const s=e.find(e=>e.id===t);return s||!t?s:{id:t,name:'You',role:n,job:'',active:!0,level:'owner'===n?'Owner':'manager'===n?'Manager':'Staff',dept:''}}const B='display-device';function L(e,t){return e===j.CAR_DEVICE_ID?{id:e,name:j.CAR_ACTOR,role:'owner',job:'',active:!0,level:'Owner',dept:''}:e===B?{id:e,name:'Display',role:'owner',job:'',active:!0,level:'Owner',dept:''}:t.find(t=>t.id===e)}class z extends i.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message??e)}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.err&&this.setState({err:null})}render(){return this.state.err?(0,O.jsxs)(u.default,{style:{gap:10},testID:"chat-error",children:[(0,O.jsx)(m.Banner,{kind:"warn",title:"Chat couldn\u2019t open",children:"Something went wrong showing this chat. Your messages are still saved on this phone. Go back and try again; if it keeps happening, close and reopen the app."}),(0,O.jsx)(m.Button,{kind:"secondary",label:"Back to chats",onPress:()=>{this.setState({err:null}),this.props.onBack?.()}})]}):this.props.children}}const $={owner:b.colours.gold,manager:b.colours.blue,staff:'#7a6f5c'};function _({s:e,size:t=34}){return e?(0,O.jsx)(y.StaffAvatar,{id:e.id,size:t}):(0,O.jsx)(u.default,{style:{width:t,height:t,borderRadius:t/2,backgroundColor:(0,n.soutersSurface)('#333'),alignItems:'center',justifyContent:'center'},children:(0,O.jsx)(m.T,{size:.38*t,weight:"bold",colour:"#111",children:"CC"})})}const N=[{caption:'Specials board',tone:'#4A3A22'},{caption:'Plating: Cullen skink',tone:'#3E2A2A'},{caption:'Delivery arrived',tone:'#40362A'},{caption:'Spillage by the bar',tone:'#2E2E40'}],W=['\ud83d\udc4d','\u2764\ufe0f','\ud83d\ude04','\ud83d\udc4f','\ud83d\udd25'];function H({ch:e,go:a,back:o}){const{now:j,meId:S,role:R,today:M}=I(1e4),D=(0,f.useOwner)(e=>e.staff),A=(0,f.useOwner)(e=>e.chat),E=(0,f.useOwner)(e=>e.shifts),B=(0,f.useOwner)(e=>e.leave),z=A.filter(t=>t.ch===e).sort((e,t)=>e.at.localeCompare(t.at)),[H,K]=(D.find(e=>e.id===S),(0,i.useState)('')),[V,U]=(0,i.useState)(null),[Y,q]=(0,i.useState)(!1),[F,G]=(0,i.useState)(!1),J=e.startsWith('dm:')?e.split(':').slice(1).length:D.filter(t=>t.active&&(0,w.inChannel)(e,t)).length;(0,i.useEffect)(()=>{const t=f.useOwner.getState().chat.some(t=>t.ch===e&&t.from!==S&&!t.seenBy.includes(S));f.useOwner.getState().chatSeen(e,S),t&&(0,v.markChatRead)(S,e)},[e,S,z.length]);const Q=t=>f.useOwner.getState().chatSend({ch:e,from:S,at:j.toISOString(),...t});(0,l.useBackLayer)(!0,o);const X=z.filter(e=>e.pinned&&!e.removed),Z=e.startsWith('dm:')?D.find(t=>t.id===e.split(':').slice(1).find(e=>e!==S)):void 0,ee=Z?.name.replace(' (example)','')??T.find(t=>t.id===e)?.name??'Private message',te=t.AVATAR_OPTIONS.find(t=>t.id===('kitchen'===e?'spatula':'bar'===e?'espresso-martini':'waves')),ne=(0,C.useChatSync)(e=>e.synced),se=(0,k.workingShifts)(E,B).filter(e=>e.staffId===S&&e.published&&e.date>=M).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,10);return(0,O.jsxs)(u.default,{style:{gap:8},children:[(0,O.jsxs)(u.default,{testID:"chat-thread-header",style:{gap:6,alignItems:'center'},children:[(0,O.jsx)(u.default,{style:{alignSelf:'flex-start'},children:(0,O.jsx)(l.BackButton,{onPress:o,testID:"chat-thread-back"})}),Z?(0,O.jsx)(y.StaffAvatar,{id:Z.id,size:88}):(0,O.jsx)(c.default,{testID:"chat-group-avatar",source:{uri:te.dataUrl},style:{width:88,height:88},accessibilityLabel:`${ee} group avatar`}),(0,O.jsx)(m.T,{center:!0,weight:"semibold",size:22,children:ee}),(0,O.jsxs)(m.Muted,{center:!0,children:[J," ",1===J?'member':'members']})]}),X.map(e=>(0,O.jsxs)(m.Card,{highlight:b.colours.gold,children:[(0,O.jsxs)(m.T,{size:12,colour:b.colours.gold,children:["\ud83d\udccc ",'system'===e.from?'Pinned note':`Pinned by ${P(D.find(t=>t.id===e.from)?.name)}`]}),(0,O.jsx)(m.T,{size:14,children:e.text})]},e.id)),z.map((t,s)=>{const o=L(t.from,D),i=t.from===S,l=t.seenBy.filter(e=>e!==t.from).length,c=0===s||t.at.slice(0,10)!==z[s-1].at.slice(0,10);return'system'===t.from?(0,O.jsxs)(u.default,{style:{alignItems:'center',gap:2},children:[c?(0,O.jsx)(m.Muted,{children:(0,p.niceDate)(new Date(t.at))}):null,(0,O.jsx)(u.default,{style:{backgroundColor:(0,n.soutersSurface)('#1c1a14'),borderRadius:10,paddingHorizontal:10,paddingVertical:5,borderWidth:1,borderColor:b.colours.border},children:(0,O.jsxs)(m.T,{size:13,colour:/Allergy|86|Sold out/.test(t.text??'')?b.colours.amber:b.colours.muted,children:["CoverCharge \xb7 ",t.text," \xb7 ",(0,p.hm)(new Date(t.at))]})})]},t.id):(0,O.jsxs)(u.default,{style:{gap:2},children:[c?(0,O.jsx)(m.Muted,{center:!0,children:(0,p.niceDate)(new Date(t.at))}):null,(0,O.jsxs)(m.Row,{style:{alignItems:'flex-start',flexDirection:i?'row-reverse':'row'},children:[(0,O.jsx)(_,{s:o}),(0,O.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:`Message from ${o?.name}`,onPress:()=>U(V===t.id?null:t.id),style:{maxWidth:'78%',backgroundColor:i?'#3a2f12':b.colours.surface,borderRadius:14,padding:9,borderWidth:1,borderColor:t.pinned?b.colours.gold:b.colours.border,gap:3},children:[(0,O.jsxs)(m.Row,{gap:6,children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:o?$[o.role]:b.colours.muted,children:P(o?.name)}),(0,O.jsxs)(m.T,{size:11,colour:b.colours.muted,children:[o?f.ROLE_LABEL[o.role]:''," \xb7 ",(0,p.hm)(new Date(t.at))]})]}),t.removed?(0,O.jsx)(m.T,{size:14,colour:b.colours.muted,children:"Message removed by the owner"}):(0,O.jsxs)(O.Fragment,{children:[t.photo?(0,O.jsx)(u.default,{style:{width:200,height:120,borderRadius:10,backgroundColor:t.photo.tone,justifyContent:'flex-end',padding:6},children:(0,O.jsxs)(m.T,{size:12,children:[t.photo.caption," (example image)"]})}):null,t.text?(0,O.jsx)(m.T,{size:15,children:t.text}):null,'cover'===t.action?(0,O.jsx)(m.Button,{small:!0,kind:"secondary",label:"Open cover requests on the rota",onPress:()=>a('more','rota')}):null]}),Object.entries(t.reactions).filter(([,e])=>e.length).length?(0,O.jsx)(m.Row,{wrap:!0,gap:4,children:Object.entries(t.reactions).filter(([,e])=>e.length).map(([e,t])=>(0,O.jsx)(u.default,{style:{borderRadius:10,paddingHorizontal:6,backgroundColor:t.includes(S)?'#4a3c16':'#222'},children:(0,O.jsxs)(m.T,{size:12,children:[e," ",t.length]})},e))}):null,i?(0,O.jsx)(m.T,{size:11,colour:b.colours.muted,children:l?`Seen by ${l}`:'Sent'}):null]})]}),V!==t.id||t.removed?null:(0,O.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:i?'flex-end':'flex-start',paddingLeft:i?0:40},children:[W.map(e=>(0,O.jsx)(h.default,{accessibilityLabel:`React ${e}`,onPress:()=>{f.useOwner.getState().chatReact(t.id,e,S),U(null)},style:{padding:4},children:(0,O.jsx)(m.T,{size:20,children:e})},e)),'staff'===R||e.startsWith('dm:')?null:(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:t.pinned?'Unpin':'Pin',onPress:()=>{f.useOwner.getState().chatPatch(t.id,{pinned:!t.pinned}),U(null)}}),'owner'!==R||i?null:(0,O.jsx)(m.Button,{small:!0,kind:"danger",label:"Remove",onPress:()=>{f.useOwner.getState().chatPatch(t.id,{removed:!0,pinned:!1}),U(null)}})]})]},t.id)}),(0,O.jsxs)(m.Row,{gap:6,children:[(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Send a photo",onPress:()=>q(!0),style:{padding:8},children:(0,O.jsx)(m.T,{size:20,children:"\ud83c\udf9e\ufe0f"})}),(0,O.jsx)(s.TextInput,{accessibilityLabel:"Message",placeholder:`Message ${ee}`,placeholderTextColor:"#7D776C",value:H,onChangeText:K,style:[m.styles.input,{flex:1,minWidth:0,width:0}]}),(0,O.jsx)(m.Button,{small:!0,label:"Send",disabled:!H.trim(),onPress:()=>{Q({text:H.trim()}),K('')}})]}),(0,O.jsx)(m.Row,{wrap:!0,gap:6,children:(0,O.jsx)(m.Button,{small:!0,kind:"secondary",label:"Ask for shift cover",onPress:()=>G(!0)})}),ne?null:(0,O.jsx)(m.Muted,{center:!0,children:"Not shared yet: this message stays on this phone only. Nobody else will see it."}),(0,O.jsx)(m.Sheet,{visible:Y,onClose:()=>q(!1),title:"Send a photo",children:(0,O.jsx)(m.Row,{wrap:!0,gap:8,children:N.map(e=>(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.caption,onPress:()=>{Q({photo:e}),q(!1)},style:{width:'47%',height:100,borderRadius:10,backgroundColor:e.tone,justifyContent:'flex-end',padding:6},children:(0,O.jsx)(m.T,{size:12,children:e.caption})},e.caption))})}),(0,O.jsxs)(m.Sheet,{visible:F,onClose:()=>G(!1),title:"Ask for shift cover",children:[se.length?null:(0,O.jsx)(m.Muted,{children:"You have no shifts on the rota this week."}),se.map(e=>(0,O.jsx)(m.Button,{kind:"secondary",label:`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`,onPress:()=>{const t=`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`;f.useOwner.getState().addSwap({shiftId:e.id,fromId:S,kind:'cover',note:`Cover asked in chat for ${t}`}),Q({text:`Can anyone cover my ${t} shift? I\u2019ve added a cover request on the rota.`,action:'cover'}),G(!1)}},e.id)),(0,O.jsx)(m.Muted,{children:"Creates a cover request in Rota \u203a Swaps & leave for a manager to approve."})]})]})}function K({go:e}){const{now:t,meId:s,role:a}=I(3e4),o=(0,f.useOwner)(e=>e.staff),l=(0,f.useOwner)(e=>e.chat),c=(0,f.useOwner)(e=>e.chatMuted[s]??M),{by:x,total:j}=A(),y=(0,C.useChatSync)(e=>e.synced),k=(0,C.useChatSync)(e=>e.error),R=(0,w.useKitchenExtra)(e=>e.extra),[B,$]=(0,i.useState)(null),[N,W]=(0,i.useState)(!1),[K,V]=(0,i.useState)(!1);(0,i.useEffect)(()=>{D(t)},[]),(0,i.useEffect)(()=>{$(null)},[s]);const U=(0,S.useChatOpen)(e=>e.ch);(0,i.useEffect)(()=>{if(!U)return;const e=U.startsWith('dm:')||T.some(e=>e.id===U)?U:null;e&&(0,w.inChannel)(e,E(o,s,a))&&$(e),S.useChatOpen.getState().request(void 0)},[U,s,a,o]);const Y=E(o,s,a);if(B)return(0,O.jsx)(z,{resetKey:B,onBack:()=>$(null),children:(0,O.jsx)(H,{ch:B,go:e,back:()=>$(null)})});const q=e=>l.filter(t=>t.ch===e).sort((e,t)=>t.at.localeCompare(e.at))[0],F=o.filter(e=>e.active&&e.id!==s).map(e=>{const t=(0,w.dmId)(s,e.id);return{x:e,id:t,u:x[t]??0,l:q(t)?.at??''}}).sort((e,t)=>t.u-e.u||t.l.localeCompare(e.l)||P(e.x.name).localeCompare(P(t.x.name))),G='owner'===a||'manager'===a,J=({id:e,name:t,icon:s,avatar:a})=>{const i=q(e),l=x[e]??0,f=c.includes(e);return(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:`Open ${t}`,onPress:()=>$(e),style:{padding:12,borderTopWidth:1,borderColor:b.colours.border},children:(0,O.jsxs)(m.Row,{children:[a?(0,O.jsx)(_,{s:a}):(0,O.jsx)(u.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:(0,n.soutersSurface)('#222'),alignItems:'center',justifyContent:'center'},children:(0,O.jsx)(m.T,{size:16,children:s})}),(0,O.jsxs)(u.default,{style:{flex:1},children:[(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{weight:l?'bold':'medium',children:[t,f?' \ud83d\udd15':'']}),i?(0,O.jsx)(m.Muted,{children:(0,p.hm)(new Date(i.at))}):null]}),(0,O.jsx)(m.Muted,{numberOfLines:1,children:i?i.removed?'Message removed':`${'system'===i.from?'CoverCharge':P(L(i.from,o)?.name)}: ${i.text??'Photo'}`:'No messages yet'})]}),l?(0,O.jsx)(u.default,{style:{backgroundColor:f?'#555':b.colours.red,borderRadius:10,minWidth:20,height:20,alignItems:'center',justifyContent:'center',paddingHorizontal:5},children:(0,O.jsx)(m.T,{size:11,weight:"bold",children:l})}):null]})})};return(0,O.jsxs)(u.default,{style:{gap:10},children:[y?(0,O.jsx)(u.default,{testID:"chat-synced",children:(0,O.jsx)(m.Muted,{children:"\u2713 Shared with the team: messages reach everyone in the chat on their own phone."})}):(0,O.jsx)(m.Banner,{kind:"warn",title:"On this device only for now",children:"You\u2019re not connected with your personal link (or chat sharing isn\u2019t switched on yet), so anything you send stays on this device and nobody else will see it. Open your personal invite link to share chat with the team. Use your usual group chat for anything urgent."}),y&&k?(0,O.jsx)(u.default,{testID:"chat-sync-error",children:(0,O.jsx)(m.Banner,{kind:"warn",title:"Can\u2019t reach the server right now",children:"Showing the messages on this phone. New messages will be sent and others\u2019 messages will appear when the connection is back; it retries automatically."})}):null,(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.Muted,{children:["Signed in as ",P(Y?.name)," (",'Head Chef'===Y?.level?'Head Chef':f.ROLE_LABEL[a],")"]}),(0,O.jsxs)(m.Row,{gap:6,children:[j||Object.keys(x).length?(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"chat-mark-all",accessibilityLabel:"Mark all chats as read",onPress:()=>(0,v.markChatRead)(s,'*')}):null,(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:"Chat settings",onPress:()=>V(!0)})]})]}),(0,O.jsxs)(u.default,{style:{borderRadius:14,borderWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface,overflow:'hidden'},children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{padding:10},children:"TEAM CHATS"}),T.filter(e=>'all'===e.id||(0,w.inChannel)(e.id,Y)).map(e=>(0,O.jsx)(J,{id:e.id,name:e.pinned?`${e.name} \ud83d\udccc`:e.name,icon:e.icon},e.id))]}),(0,O.jsxs)(u.default,{style:{borderRadius:14,borderWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface,overflow:'hidden'},children:[(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between',padding:10},children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:b.colours.gold,children:"PRIVATE MESSAGES"}),(0,O.jsx)(m.Button,{small:!0,kind:"success",label:"New message",testID:"chat-new-pm",onPress:()=>W(!0)})]}),F.map(e=>(0,O.jsx)(J,{id:e.id,name:P(e.x.name),avatar:e.x},e.id)),F.length?null:(0,O.jsx)(m.Muted,{style:{padding:10},children:"Nobody else on the team yet."})]}),(0,O.jsx)(m.Muted,{children:"Private messages can only be read by the two people in them; owners and managers can\u2019t read other people\u2019s private messages. The Kitchen chat is for owners, managers, head chefs and kitchen staff, and can\u2019t be left."}),(0,O.jsx)(m.Sheet,{visible:N,onClose:()=>W(!1),title:"New private message",children:o.filter(e=>e.active&&e.id!==s).map(e=>(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:`Message ${e.name}`,onPress:()=>{W(!1),$((0,w.dmId)(s,e.id))},style:{paddingVertical:8},children:(0,O.jsxs)(m.Row,{children:[(0,O.jsx)(_,{s:e}),(0,O.jsxs)(u.default,{children:[(0,O.jsx)(m.T,{children:P(e.name)}),(0,O.jsxs)(m.Muted,{children:[f.ROLE_LABEL[e.role]," \xb7 ",e.job]})]})]})},e.id))}),(0,O.jsxs)(m.Sheet,{visible:K,onClose:()=>V(!1),title:"Chat settings",children:[(0,O.jsx)(m.Banner,{kind:"info",title:"Privacy",children:"Chat is for work. Managers and the owner see messages in the channels they belong to and the owner can remove messages in group chats. Private messages can only be read by the two people in them: the server enforces this, so nobody else (not even the owner) can read them. Don\u2019t share customer card or health details beyond what\u2019s needed for service."}),(0,O.jsx)(m.T,{weight:"semibold",children:"Mute channels"}),T.filter(e=>(0,w.inChannel)(e.id,Y)).map(e=>(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{children:[e.icon," ",e.name]}),(0,O.jsx)(m.Toggle,{label:`Mute ${e.name}`,value:c.includes(e.id),onChange:()=>f.useOwner.getState().chatMute(s,e.id)})]},e.id)),(0,O.jsx)(m.Muted,{children:"Muted channels don\u2019t count towards the tab badge. The Kitchen chat can be muted but not left."}),G?(0,O.jsxs)(u.default,{style:{gap:6},testID:"kitchen-members",children:[(0,O.jsx)(m.T,{weight:"semibold",children:"Kitchen chat members"}),(0,O.jsxs)(m.Muted,{children:["Automatic: owners, managers, head chefs and kitchen staff (chefs, kitchen porters). Change who else is in it here",y?'':'; saved on this device for now',"."]}),o.filter(e=>e.active).map(e=>{const t=R[e.id]??(0,w.kitchenByRule)(e);return(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{children:[P(e.name),null!=R[e.id]?' (changed)':'']}),(0,O.jsx)(m.Toggle,{label:`Kitchen chat: ${P(e.name)}`,value:t,onChange:t=>w.useKitchenExtra.getState().set(e.id,t===(0,w.kitchenByRule)(e)?null:t)})]},e.id)})]}):null]})]})}},1053,[1384,876,874,842,5,31,1043,197,264,128,818,863,822,825,953,977,996,1192,1296,824,1418,972,25]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SNOOZE_MINS",{enumerable:!0,get:function(){return S}}),e.useScheduledNotices=function({rid:u,staffId:S,name:w,onOpen:D}){const I=(0,t.useRef)(w);I.current=w;const N=(0,t.useRef)(D);N.current=D,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.location?.search)return;const t=new URLSearchParams(window.location.search);if('orderlists'===t.get('open'))o.useListOpen.getState().request(t.get('list')??void 0),setTimeout(()=>N.current?.('orderlists'),0);else if('chat'===t.get('open'))c.useChatOpen.getState().request(t.get('ch')??void 0),setTimeout(()=>N.current?.('chat'),0);else{const s=t.get('open');s&&v.includes(s)&&setTimeout(()=>N.current?.(s),0)}},[]);const O=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),b=(0,d.useReminders)(t=>t.done.length);(0,t.useEffect)(()=>{s.useNotifs.getState().ensure(u);const t=()=>{const t=h(),c=s.useNotifs.getState(),v=n.useOwner.getState().staff.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),w=v.filter(s=>!1!==s.active&&(0,p.shiftNow)(s.id,t).on).map(t=>t.id);for(const n of c.items){if(n.rid!==u)continue;const p=`sched:${n.id}`;if(!S||n.removed||n.paused||!n.sendBy.inApp||!(0,f.isRecipient)(n,S,v,w)){(0,l.dismissNotice)(p);continue}const{due:D,forDate:O}=(0,f.notifDue)(n,t),b=d.useReminders.getState().done.find(t=>t.reminderId===n.id&&t.forDate===O),R=`sched:${n.id}:${O}`;!D||b||(c.snooze[R]??0)>t?(0,l.dismissNotice)(p):(0,l.notify)({id:p,icon:'\ud83d\udd14',kicker:'NOTICE',title:n.title,body:n.message,testID:'sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'sched-notice-done',onPress:()=>d.useReminders.getState().markDone({rid:u,reminderId:n.id,forDate:O,at:new Date(h()).toISOString(),staffRef:S,staffName:I.current.replace(' (example)','')})},...'orderlists'===n.open?.page&&N.current?[{label:'Open list',testID:'sched-notice-open',onPress:()=>{o.useListOpen.getState().request(n.open?.list),N.current?.('orderlists')}}]:[],{label:'Later',kind:'ghost',testID:'sched-notice-later',onPress:()=>s.useNotifs.getState().setSnooze(R,h()+9e5)}]})}};t();const c=setInterval(t,2e4);return()=>clearInterval(c)},[u,S,O,b])};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),u=r(_d[6]),f=r(_d[7]),l=r(_d[8]),p=r(_d[9]);const h=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock).getTime()}catch{return Date.now()}},S=15,v=['bookings','rota','notifications','chat']},1054,[31,997,863,1058,1418,998,881,999,980,1000]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1055,[869,31,1294,863,881,870,1183,871,980,1178]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ListBadge=C,_e.OrderListsScreen=function({rid:e,who:t,editor:s,today:i}){(0,o.useEffect)(()=>{x.useOrderLists.getState().ensure(e)},[e]);const d=(0,x.useOrderLists)(e=>e.lists).filter(t=>t.rid===e&&!t.archived),n=(0,x.useOrderLists)(e=>e.items);(0,x.useOrderLists)(t=>t.settings[e]);const l=(0,x.orderSettingsOf)(e).allowStaff,h=(0,x.useListOpen)(e=>e.seed),[y,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(!h)return;const e=d.find(e=>e.seed===h);e&&(j(e.id),x.useListOpen.getState().request(void 0))},[h,d.length]);const f=s||l;if(!s&&!l)return(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{children:"Order lists are for managers and the Head Chef here."}),(0,w.jsx)(c.Muted,{children:"Ask a manager to switch on \u201cLet all staff add items\u201d."})]});const b=d.find(e=>e.id===y);if(b)return(0,w.jsx)($,{rid:e,list:b,editor:s,canAdd:f,who:t,today:i,onBack:()=>j(null)});const I=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"order-lists",children:[(0,w.jsxs)(c.Muted,{size:13,children:["Tip: add what\u2019s running low as you notice it. ",s?'On the day, tick what you got, then Finish order.':'A manager or the Head Chef places the order.']}),d.map(t=>{const s=(0,p.liveItems)(n.filter(t=>t.rid===e),t.id).filter(e=>'open'===e.status).length;return(0,w.jsx)(c.Card,{onPress:()=>j(t.id),children:(0,w.jsx)(u.default,{testID:`order-list-card-${t.seed??t.id}`,children:(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,i,I)})]}),(0,w.jsx)(c.Badge,{kind:s?'gold':'neutral',label:`${s} to get`})]})})},t.id)}),d.length?null:(0,w.jsx)(c.Muted,{children:"No order lists yet. Add one in Settings \u203a Advanced \u203a Order lists."})]})};var t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),o=r(_d[3]),d=e(r(_d[4])),n=e(r(_d[5]));r(_d[6]);var l=e(r(_d[7])),u=e(r(_d[8])),c=r(_d[9]),h=r(_d[10]),x=r(_d[11]),p=r(_d[12]),y=r(_d[13]),j=r(_d[14]),f=r(_d[15]),b=r(_d[16]),w=r(_d[17]);const I={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},L=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',v=e=>e.replace(' (example)','').split(' ')[0];function C({list:e,size:s=40}){const i=(0,f.useLogoCache)(t=>t.byList[e.id]),[n,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let t=!0;return!i&&e.logo&&(0,b.orderLogoUrl)(e.logo).then(e=>{t&&l(e)}),()=>{t=!1}},[e.logo,i]);const x=i??n;return x?(0,w.jsx)(d.default,{testID:`list-logo-${e.seed??e.id}`,source:{uri:x},accessibilityLabel:`${e.name} logo`,style:{width:s,height:s,borderRadius:s/2,borderWidth:1,borderColor:h.colours.gold}}):(0,w.jsx)(u.default,{testID:`list-initials-${e.seed??e.id}`,accessibilityLabel:`${e.name}`,style:{width:s,height:s,borderRadius:s/2,backgroundColor:(0,t.soutersSurface)('#1c1a16'),borderWidth:1,borderColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(c.T,{size:.38*s,weight:"bold",colour:h.colours.gold,children:(0,p.initials)(e.name)})})}function D({phone:e}){const t=(0,p.telHref)(e);if(!e||!t)return null;return'undefined'!=typeof navigator&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?(0,w.jsx)(l.default,{testID:"list-phone",accessibilityRole:"link",onPress:()=>{n.default.openURL(t)},children:(0,w.jsxs)(c.T,{colour:h.colours.gold,children:["\ud83d\udcde Call ",e]})}):(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(u.default,{testID:"list-phone",children:(0,w.jsxs)(c.T,{children:["\ud83d\udcde ",e]})}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"list-phone-copy",label:"Copy",onPress:()=>{navigator.clipboard?.writeText(e).then(()=>(0,y.notify)({id:'copied',title:'Number copied',timeoutMs:3e3}))}})]})}function T({list:e}){const t=x.useOrderLists.getState(),s=(0,f.useLogoCache)(t=>!!t.byList[e.id])||!!e.logo,i=async s=>{try{const i=await(0,j.capturePlatingPhoto)(s);if(!i)return;const o=await(0,f.squareLogo)(i.dataUrl,256);f.useLogoCache.getState().put(e.id,o);const d=await(0,b.uploadOrderLogo)(e.id,o);if(d.ok){const s=e.logo;t.updateList(e.id,{logo:d.path}),s&&(0,b.removeOrderLogo)(s)}else'offline'!==d.message&&(0,y.notify)({id:'logo',tone:'warn',title:'Logo saved on this device only',body:d.message,timeoutMs:7e3})}catch(e){(0,y.notify)({id:'logo',tone:'warn',title:'Couldn\u2019t use that picture',body:String(e.message),timeoutMs:7e3})}};return(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-camera",label:s?'Replace: take photo':'Logo: take photo',onPress:()=>{i('camera')}}),(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-library",label:s?'Replace: choose':'Logo: choose image',onPress:()=>{i('library')}}),s?(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"logo-remove",label:"Remove logo",onPress:()=>{f.useLogoCache.getState().drop(e.id),e.logo&&(0,b.removeOrderLogo)(e.logo),t.updateList(e.id,{logo:void 0})}}):null]})}function S({rid:e,list:t,who:i}){const[d,n]=(0,o.useState)(''),[l,y]=(0,o.useState)('1'),[j,f]=(0,o.useState)(''),[b,L]=(0,o.useState)(''),[C,D]=(0,o.useState)(null),T=x.useOrderLists.getState(),S=Number(l.replace(',','.')),B=d.trim().length>0&&(0,p.validQty)(S),$=()=>{n(''),y('1'),L(''),D(null)};return(0,w.jsxs)(u.default,{testID:"order-add",style:{gap:6},children:[(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Item",testID:"order-add-name",value:d,onChangeText:n,placeholder:"Item, e.g. Tennent\u2019s",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Quantity",testID:"order-add-qty",value:l,onChangeText:y,keyboardType:"decimal-pad",style:{...I,width:64,borderColor:(0,p.validQty)(S)?h.colours.hairline:h.colours.red}})]}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:p.UNITS.map(e=>(0,w.jsx)(c.Chip,{label:e||'no unit',selected:j===e,onPress:()=>f(e)},e||'none'))}),(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Note",testID:"order-add-note",value:b,onChangeText:L,placeholder:"Note (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(c.Button,{testID:"order-add-save",label:"Add",disabled:!B,onPress:()=>{const s=(0,p.findDuplicate)(T.items.filter(t=>t.rid===e),t.id,d,j);s?D(s):(T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$())}})]}),(0,w.jsxs)(c.Sheet,{visible:!!C,onClose:()=>D(null),title:"Already on the list",testID:"order-dup",children:[(0,w.jsx)(c.T,{children:C?`${C.name}: ${(0,p.qtyText)(C)} (added by ${v(C.addedByName)})`:''}),(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(c.Button,{testID:"order-dup-bump",label:`Add ${l} more`,onPress:()=>{C&&T.bump(C.id,S,i),$()}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Add as separate item",onPress:()=>{T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$()}})]})]})]})}function B({item:e,editor:t,who:s}){const i=x.useOrderLists.getState(),o='got'===e.status?h.colours.gold:'missing'===e.status?h.colours.amber:h.colours.text;return(0,w.jsxs)(u.default,{testID:`order-item-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.hairline,paddingVertical:8,gap:4},children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",colour:o,style:{flex:1,textDecorationLine:'got'===e.status?'line-through':'none'},children:e.name}),(0,w.jsx)(c.T,{weight:"semibold",children:(0,p.qtyText)(e)})]}),e.note?(0,w.jsxs)(c.Muted,{size:12,children:["Note: ",e.note]}):null,(0,w.jsxs)(c.Muted,{size:12,children:["Added by ",v(e.addedByName)," \xb7 ",L(e.addedAt),e.bumps?.length?` \xb7 +${e.bumps.map(e=>`${e.qty} ${v(e.name)}`).join(', ')}`:'',e.carried?' \xb7 carried over':'']}),'open'!==e.status?(0,w.jsxs)(c.Muted,{size:12,children:['got'===e.status?'Got / ordered':'Missing / not in stock'," \xb7 ",e.statusBy," ",L(e.statusAt)]}):null,t?(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Chip,{testID:`order-got-${e.id}`,label:"\u2713 Got / ordered",selected:'got'===e.status,onPress:()=>i.setStatus(e.id,'got'===e.status?'open':'got',s)}),(0,w.jsx)(c.Chip,{testID:`order-missing-${e.id}`,label:"Missing / not in stock",selected:'missing'===e.status,onPress:()=>i.setStatus(e.id,'missing'===e.status?'open':'missing',s)}),(0,w.jsx)(c.Chip,{testID:`order-remove-${e.id}`,label:"Remove",onPress:()=>{i.removeItem(e.id),(0,y.notify)({id:`undo-${e.id}`,title:`Removed ${e.name}`,timeoutMs:8e3,actions:[{label:'Undo',testID:'order-undo',onPress:()=>i.undoRemove(e.id)}]})}})]}):null]})}function $({rid:e,list:t,editor:d,canAdd:n,who:l,today:j,onBack:f}){(0,i.useBackLayer)(!0,f);const b=(0,x.useOrderLists)(e=>e.items),$=(0,x.useOrderLists)(e=>e.history).filter(e=>e.listId===t.id),P=(0,p.liveItems)(b.filter(t=>t.rid===e),t.id),[k,R]=(0,o.useState)(!1),[O,M]=(0,o.useState)(!1),[A,z]=(0,o.useState)(t.phone??''),N=x.useOrderLists.getState(),q=P.filter(e=>'got'!==e.status).length,H=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:`order-list-${t.seed??t.id}`,children:[(0,w.jsx)(i.BackButton,{onPress:f,testID:"order-list-back"}),(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t,size:48}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{size:18,weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,j,H)})]})]}),(0,w.jsx)(D,{phone:t.phone}),'trip'===t.kind&&d?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(c.Muted,{size:12,children:"Trip day for this trip"}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:[1,2,3,4,5,6,0].map(e=>(0,w.jsx)(c.Chip,{testID:`trip-day-${e}`,label:p.DAY_FULL[e].slice(0,3),selected:(t.tripDay??H)===e,onPress:()=>N.updateList(t.id,{tripDay:e})},e))})]}):null,d?(0,w.jsxs)(u.default,{style:{gap:6},children:[(0,w.jsx)(c.Row,{gap:6,children:(0,w.jsx)(s.TextInput,{accessibilityLabel:"Phone number",testID:"list-phone-edit",value:A,onChangeText:z,onBlur:()=>N.updateList(t.id,{phone:A.trim()||void 0}),placeholder:"Phone (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}})}),(0,w.jsx)(T,{list:t})]}):null]}),n?(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{weight:"semibold",children:"Add to this list"}),(0,w.jsx)(S,{rid:e,list:t,who:l})]}):null,(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",children:"On the list"}),(0,w.jsx)(c.Badge,{kind:"neutral",label:`${P.length}`})]}),P.length?P.map(e=>(0,w.jsx)(B,{item:e,editor:d,who:l},e.id)):(0,w.jsx)(c.Muted,{children:"Nothing on this list yet."}),d&&P.length?(0,w.jsx)(c.Button,{testID:"order-finish",label:"Finish order",onPress:()=>R(!0)}):null]}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"order-history",label:O?'Hide history \u25b4':`History (${$.length}) \u25be`,onPress:()=>M(!O)}),O?$.map(e=>(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.T,{weight:"semibold",children:[L(e.finishedAt)," \xb7 ",v(e.finishedByName)]}),(0,w.jsx)(c.Muted,{size:12,children:e.items.map(e=>`${e.name} ${(0,p.qtyText)(e)}${'missing'===e.status?' (missing)':'open'===e.status?' (not got)':''}`).join(' \xb7 ')}),e.carried?(0,w.jsxs)(c.Muted,{size:12,children:[e.carried," carried over"]}):null]},e.id)):null,(0,w.jsxs)(c.Sheet,{visible:k,onClose:()=>R(!1),title:"Finish this order?",testID:"order-finish-sheet",children:[(0,w.jsxs)(c.T,{children:[P.length-q," got or ordered",q?`, ${q} not got (missing or still open)`:'',"."]}),(0,w.jsx)(c.Muted,{children:"It goes into History with today\u2019s date and your name."}),q?(0,w.jsxs)(c.T,{weight:"semibold",children:["Carry over the ",q," not got to the next order?"]}):null,(0,w.jsxs)(c.Row,{wrap:!0,gap:8,children:[q?(0,w.jsx)(c.Button,{testID:"order-finish-carry",label:"Finish and carry over",onPress:()=>{N.finish(e,t.id,!0,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,body:`${q} carried over`,timeoutMs:6e3})}}):null,(0,w.jsx)(c.Button,{testID:"order-finish-clear",kind:q?'secondary':'primary',label:q?'Finish, don\u2019t carry over':'Finish order',onPress:()=>{N.finish(e,t.id,!1,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,timeoutMs:6e3})}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>R(!1)})]})]})]})}},1056,[876,874,1043,31,197,240,123,264,128,818,825,1058,1293,980,1416,1417,824,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PhoneAlerts=function({what:e="reminders and alerts set for you"}){const[s,h]=(0,t.useState)(null),[u,p]=(0,t.useState)(null),[y,f]=(0,t.useState)(null);(0,t.useEffect)(()=>{let e=!0;return(0,r.inApkWebView)()?h('apk'):(0,r.pushState)().then(t=>{e&&h(t)}).catch(()=>{e&&p('Could not check alerts. Try again.')}),()=>{e=!1}},[]);const b='on'===s?'Alerts are on for this phone.':'blocked'===s?i.BLOCKED_INTRO:'ios-home-screen'===s?'iPhone: add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.':'unsupported'===s?'This browser can\u2019t get alerts when the phone is locked. Open CoverCharge in Chrome.':null;return(0,c.jsxs)(n.default,{testID:"phone-alerts",style:{gap:10,alignItems:'center'},children:[(0,c.jsxs)(l.T,{center:!0,size:16,children:["Get the ",e," on this phone, even when the app is closed."]}),'apk'===s?(0,c.jsx)(l.T,{size:18,weight:"bold",colour:o.colours.gold,center:!0,testID:"alerts-open-chrome",children:"Open CoverCharge in Chrome to turn on alerts"}):null,b?(0,c.jsx)(l.T,{center:!0,size:15,testID:"alerts-status",children:b}):null,'off'===s?(0,c.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,c.jsx)(l.Button,{label:"Turn on alerts",testID:"turn-on-alerts",accessibilityLabel:"Turn on alerts. Your phone will then ask to allow notifications: tap Allow.",style:{minHeight:64,minWidth:260},onPress:async()=>{p(null);try{const e=await(0,r.turnOnPush)();p(e.message),e.ok?h('on'):h(await(0,r.pushState)())}catch{p('Could not turn on alerts. Please try again.')}}}),(0,c.jsx)(l.T,{size:16,center:!0,testID:"alerts-allow-line",children:"When your phone asks, tap Allow."})]}):null,'blocked'===s?(0,c.jsx)(n.default,{style:{gap:6,alignItems:'center',alignSelf:'stretch'},testID:"alerts-blocked-steps",accessible:!0,accessibilityLabel:i.BLOCKED_SPOKEN,children:i.BLOCKED_STEPS.map((e,t)=>(0,c.jsx)(l.T,{size:15,center:!0,children:`${t+1}. ${e}`},t))}):null,'blocked'===s?(0,c.jsx)(l.Button,{label:"I\u2019ve allowed it, check again",testID:"alerts-recheck",accessibilityLabel:"I\u2019ve allowed it. Check again.",style:{minHeight:64,minWidth:260},onPress:async()=>{p(null);try{if('blocked'===await(0,r.pushState)())return void p(i.STILL_OFF);const e=await(0,r.turnOnPush)();p(e.message),h(e.ok?'on':await(0,r.pushState)())}catch{p('Could not check alerts. Please try again.')}}}):null,'on'===s?(0,c.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,c.jsx)(l.Button,{label:"Send me a test notification",testID:"push-test",accessibilityLabel:"Send me a test notification. It goes only to your own phone.",style:{minHeight:56,minWidth:260},onPress:async()=>{f('Sending\u2026'),f((await(0,r.sendTestPush)()).message)}}),y?(0,c.jsx)(n.default,{accessibilityLiveRegion:"polite",children:(0,c.jsx)(l.T,{size:15,center:!0,testID:"push-test-msg",children:y})}):null,(0,c.jsx)(l.Button,{small:!0,kind:"ghost",label:"Turn off alerts on this phone",testID:"turn-off-alerts",onPress:async()=>{const e=await(0,r.turnOffPush)();p(e.message),h(await(0,r.pushState)())}})]}):null,u?(0,c.jsx)(n.default,{accessibilityLiveRegion:"assertive",accessibilityRole:'alert',children:(0,c.jsx)(l.T,{size:15,center:!0,testID:"push-msg",children:u})}):null,(0,c.jsx)(l.Muted,{center:!0,size:13,children:"For this phone only. Each person turns it on on their own phone."})]})};var e,t=_r(d[0]),s=_r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(d[2]),i=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6])},1057,[31,128,818,1041,825,1389,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"orderListSeedId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"orderListSettingsId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"orderListSeeds",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useOrderLists",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"orderSettingsOf",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"useListOpen",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),p=r(d[5]),l=r(d[6]);const c=(e,t)=>(0,u.uuidFrom)(`order-list:${t}:${e}`),S=e=>(0,u.uuidFrom)(`order-list-settings:${e}`),f=e=>'anchorage'===e?[{id:c(e,'allsons'),seed:'allsons',name:'Alsons (drinks)',kind:'running'},{id:c(e,'cash-carry'),seed:'cash-carry',name:'Cash and carry',kind:'trip',tripDay:5}]:[],A=()=>(new Date).toISOString(),O=(0,i.create)()((0,n.persist)((e,t)=>({lists:[],items:[],history:[],settings:{},ensure:s=>{const i=t(),n=new Set(i.lists.map(e=>e.id)),u=f(s).filter(e=>!n.has(e.id)).map(e=>({...e,rid:s})),p={},c=i.lists.map(e=>(0,l.fixSupplierNames)(e.name)!==e.name?{...e,name:(0,l.fixSupplierNames)(e.name),updatedAt:A()}:e);c.some((e,t)=>e!==i.lists[t])&&(p.lists=c),u.length&&(p.lists=[...p.lists??i.lists,...u]),i.settings[s]||(p.settings={...i.settings,[s]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(s)}}),Object.keys(p).length&&e(p)},addList:(t,s)=>{const i=(0,p.uuid)();return e(e=>({lists:[...e.lists,{...s,id:i,rid:t,updatedAt:A()}]})),i},updateList:(t,s)=>e(e=>({lists:e.lists.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),addItem:(t,s)=>{const i=(0,p.uuid)(),n=s.addedAt??A();return e(e=>({items:[...e.items,{...s,id:i,rid:t,status:'open',addedAt:n,updatedAt:n}]})),i},bump:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...(0,o.bumpQty)(e,s,i.id,i.name,A()),rid:e.rid}:e)})),updateItem:(t,s)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),setStatus:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,status:s,statusBy:'open'===s?void 0:i.name,statusAt:'open'===s?void 0:A(),updatedAt:A()}:e)})),removeItem:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!0,updatedAt:A()}:e)})),undoRemove:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!1,updatedAt:A()}:e)})),finish:(s,i,n,u)=>{const l=t().lists.find(e=>e.id===i);if(!l)return null;const c=A(),{round:S,drop:f,carriedOver:O}=(0,o.finishOrder)(l,t().items,n,u,c,p.uuid),_=new Set(f),y=new Map(O.map(e=>[e.id,e])),T={...S,rid:s};return e(e=>({items:e.items.filter(e=>!_.has(e.id)).map(e=>y.has(e.id)?{...y.get(e.id),rid:e.rid}:e),history:[T,...e.history].slice(0,300),lists:e.lists.map(e=>e.id===i?{...e,nextTrip:void 0,updatedAt:c}:e)})),T},setSettings:(t,s)=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,...e.settings[t],...s,id:S(t),updatedAt:A()}}})),resetSettings:t=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(t),updatedAt:A()}}}))}),{name:'covercharge-order-lists-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)})),_=e=>({...o.DEFAULT_ORDER_LIST_SETTINGS,...O.getState().settings[e]}),y=(0,i.create)()(e=>({request:t=>e({seed:t})}))},1058,[1190,995,1191,1179,1293,1099,1292]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return E}}),_e.personFromStaff=H,_e.signInWithText=V,_e.SignInWithLink=z,_e.signInWithHandover=F,_e.useSignedOutGate=function(){const e=(0,k.useSession)(e=>e.meId),n=(0,b.useSync)(e=>'device'===e.kind&&!!e.venueId);return h.IS_CAR?!S.PITCH&&!n:C.includes(h.APP_VARIANT)&&!S.PITCH&&!e&&!K()},_e.InviteGate=function(){const[e,N]=(0,u.useState)(k.useSession.persist.hasHydrated()),[H,V]=(0,u.useState)(k.START_INVITE||k.START_HANDOVER||k.START_KITCHEN?'checking':'done'),[L,U]=(0,u.useState)(null),[G,B]=(0,u.useState)(null),[Y,$]=(0,u.useState)(0),[X,Q]=(0,u.useState)(!1),[q,J]=(0,u.useState)(null),Z=(0,k.useSession)(e=>e.meId),ee=(0,k.useSession)(e=>!Z||!!e.welcomed[Z]);if((0,u.useEffect)(()=>{const e=k.useSession.persist.onFinishHydration(()=>N(!0));return k.useSession.persist.hasHydrated()&&N(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!C.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=k.useSession.getState().meId;if(k.START_KITCHEN&&'chef'===h.APP_VARIANT&&!e){const e=await(0,b.claimDisplayKitchen)(k.START_KITCHEN);if(!t)return;if('ok'===e.status&&e.id.staffRef){(0,y.markKitchenViaDisplay)(!0,e.id.displayName),M(e.id);try{k.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void V('done')}return U('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void V('done')}if(k.START_HANDOVER&&!k.START_INVITE&&!W){W=!0;const n=await(0,b.claimChromeHandover)(k.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef)M(n.id);else if('refused'===n.status&&!e)return B(n.message),void V('done')}if(k.START_INVITE&&!(e&&await(0,b.signedInHereAs)(e)&&await(0,b.rememberedInviteHere)(k.START_INVITE))){const e=await D(k.START_INVITE,e=>{t&&B(e)});if(!t)return;if('refused'===e.kind)return B(e.message),void V('done');if('offline'===e.kind)return Q(!0),void(n=setTimeout(()=>{t&&$(e=>e+1)},1e4));if(Q(!1),'bad'===e.kind)return void V('bad')}const s=O(k.useSession.getState().meId),o=s&&!1!==w.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)k.useSession.getState().signOut();else if(s&&!R(s)&&!k.START_INVITE&&await(0,b.signedInHereAs)(s.id)){if(await(0,b.forgetSignInHere)(),!t)return;k.useSession.getState().signOut(),J(E(s.app))}else if(s&&!R(s)){const e=(0,k.appUrl)(s.app,k.START_INVITE);if(e)return void window.location.replace(e)}V('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,Y]),!C.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(t.QueuedVenueWelcome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?'This link cannot be used here. Ask your authorised manager.':X?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(o.GreensideStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(r.AbbotsfordStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?'This link cannot be used here. Ask your authorised manager.':X?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(l.KirktonStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(s.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Z){const t=s.IsolatedStaffHome,o=k.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(t,{app:o,message:l})})}if(X)return _('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===H)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if(h.IS_OWNER_DESKTOP&&!Z&&!S.PITCH&&!K())return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(p.DesktopSignIn,{onCode:F,refused:G})});if((0,A.inPhoneApp)()&&!Z&&!S.PITCH)return G&&/already been used/i.test(G)?_(P,'invite-app-used'):G&&(0,x.isPhoneLinked)(G)?_(x.PHONE_LINKED_TEXT,'invite-phone-linked'):G?_(G,'invite-app-refused'):_(v,'invite-app-notsetup');if('bad'===H)return(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,j.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,j.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V('done')}),(0,j.jsx)(I.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(G&&!Z&&(0,x.isPhoneLinked)(G))return(0,j.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${x.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,j.jsx)(I.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,j.jsx)(I.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,j.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(G&&!Z)return(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,j.jsx)(I.Muted,{center:!0,children:G}),(0,j.jsx)(I.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,j.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>B(null)})]});if(q&&!Z)return(0,j.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,j.jsx)(I.Muted,{center:!0,children:q}),(0,j.jsx)(z,{})]});if(L&&!Z){const e=/expired/i.test(L);return(0,j.jsxs)(f.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,j.jsx)(I.Muted,{center:!0,children:L}),(0,j.jsx)(I.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!Z&&!S.PITCH&&!K())return(0,j.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:G?'This link can\u2019t be used here':'Sign in to CoverCharge'}),G?(0,j.jsx)(I.Muted,{center:!0,children:G}):null,(0,j.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,j.jsx)(z,{})]});const ne=(0,k.rosterPerson)(Z);return ne&&!ee&&R(ne)&&!(0,y.isKitchenViaDisplay)()?(0,j.jsx)(T.LaunchWelcome,{p:ne,onDone:()=>k.useSession.getState().markWelcomed(ne.id)}):null};var n=_r(d[0]),t=_r(d[1]),s=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),I=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]),w=_r(d[21]),j=_r(d[22]);const P='This app copy has already been set up on another phone. Ask your manager for a new link.',v='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',_=(e,n)=>(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e})}),C=['owner','staff','chef'],R=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,E=e=>`You now use ${k.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function N(e){k.useSession.getState().signIn(e.id);const n=w.useOwner.getState();w.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function H(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const O=e=>{const n=(0,k.rosterPerson)(e);if(n)return n;const t=e?w.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?H(t):void 0};async function D(e,n){const t=await(0,k.personForInvite)(e);if(t)return N(t),R(t)?((0,b.claimInvite)(e).then(e=>{if('refused'===e.status&&k.useSession.getState().meId===t.id&&(k.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==k.useSession.getState().meId){const n=O(e.id.staffRef);n&&N(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const s=await(0,b.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=O(s.id.staffRef)??H({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return N(o),{kind:'ok',p:o}}async function V(e,n=()=>{}){const t=(0,k.inviteFromText)(e);if(!t)return'bad';const s=await D(t,n);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!R(o)){const e=(0,k.appUrl)(o.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,s]=(0,u.useState)('');return(0,j.jsxs)(f.default,{style:{gap:6},children:[(0,j.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,j.jsx)(I.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await V(e,s);s('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,j.jsx)(I.T,{size:13,colour:m.colours.red,children:t}):null]})}function M(e){if(!e.staffRef)return;N(O(e.staffRef)??H({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function F(e){const n=await(0,b.claimChromeHandover)(e);return'ok'===n.status?n.id.staffRef?(M(n.id),'ok'):'bad':'refused'===n.status?{refused:n.message}:'offline'===n.status?'offline':'bad'}let W=!1;const K=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1059,[5,1537,1538,1539,1540,1541,31,123,47,128,807,1542,866,825,1544,818,824,979,2,1412,1274,863,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1060,[31,264,207,128,288,825,1461,25]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=j,_e.periodPay=T,_e.MyHoursPay=C,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),j=(0,a.useOwner)(e=>e.staff),k=(0,i.useMemo)(()=>j.filter(e=>e.active),[j]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:M,rid:v}=(0,y.useCtx)(6e4),N=(0,b.useVenuePay)(v).pay,[B,O]=(0,i.useState)(-1),[L,$]=(0,i.useState)(null),[S,H]=(0,i.useState)(''),[I,W]=(0,i.useState)(null),E=(0,i.useMemo)(()=>k.map(e=>({...T(e.id,B,M,R,D[e.id]??0,N,z),person:e})),[k,B,R,D,N,z]),_=E.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),V=E[0]?.label??'',F=k.find(e=>e.id===L),G=Math.round(100*Number(S));return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,f.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,f.jsx)(P,{label:V,offset:B,setOffset:O,badge:0===B?'Current period':void 0}),(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),E.map(e=>(0,f.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>W(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,f.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:x(e.person.name)}),c&&e.person.noTax?(0,f.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),H(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,f.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]$(null),title:`Hourly rate: ${x(F?.name)}`,children:[(0,f.jsx)(l.Muted,{children:F?`${F.level??a.ROLE_LABEL[F.role]} \xb7 ${F.job}${F.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(F,D[F.id],u.gbp)}`:''}),(0,f.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",value:S,onChangeText:H,style:l.styles.input}),Number.isFinite(G)&&G>0&&G{a.useOwner.getState().setRate(L,G),$(null)}}),L&&null!=D[L]?(0,f.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(L),$(null)}}):null]}),(0,f.jsx)(l.Sheet,{visible:!!I,onClose:()=>W(null),title:`What ${x(k.find(e=>e.id===I)?.name)} sees`,children:I?(0,f.jsx)(C,{staffId:I}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const x=e=>(e??'').replace(' (example)',''),w='Before tax and deductions, estimate';function j(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>T(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function T(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function P({label:e,offset:s,setOffset:t,badge:i}){return(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,f.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e}),i?(0,f.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function C({staffId:e}){const{meId:s,now:C,rid:k}=(0,y.useCtx)(6e4),D=e??s,R=(0,b.useVenuePay)(k).pay,z=(0,a.useOwner)(e=>e.staff).find(e=>e.id===D),M=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[D]??0,O=null!=N[D],[L,$]=(0,i.useState)(0),S=j(D,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...T(D,e,C,M,B,R,v)})),[D,M,B,R,v]);return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Banner,{kind:"info",title:w,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,f.jsxs)(l.Muted,{children:[x(z?.name)," \xb7 ",z?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",R.wagePayDay,[1,21,31].includes(R.wagePayDay)?'st':[2,22].includes(R.wagePayDay)?'nd':[3,23].includes(R.wagePayDay)?'rd':'th',", cut-off the ",R.wageCutoffDay,[1,21].includes(R.wageCutoffDay)?'st':[2,22].includes(R.wageCutoffDay)?'nd':[3,23].includes(R.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,f.jsx)(P,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Confirmed paid hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,f.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Gross pay from hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Tips allocated"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,f.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,f.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,f.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,f.jsxs)(l.Muted,{children:[w,". Tips are shown separately and only once a tip period is approved."]})]}),(0,f.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,f.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,f.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,f.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,f.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,f.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,f.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,f.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,f.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,f.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,f.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,f.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.label}),(0,f.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,f.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",w.toLowerCase()]})]})},e.o))]})}},1061,[874,1459,31,264,128,288,818,863,820,822,825,1078,953,1185,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,v=(0,f.tipsPeriod)(w,S.start,1),z=(0,f.wagePeriod)(w,D.start,1),H=e=>{l({...a,...e}),x(null)};return(0,M.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,M.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,M.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,M.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,M.jsx)(h.Chip,{label:$[e],selected:a.tipsFrequency===e,onPress:()=>H({tipsFrequency:e})},e))}),(0,M.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,M.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,M.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,M.jsxs)(h.Row,{children:[(0,M.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>H({tipsEndsDaysBefore:e})}),(0,M.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,M.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,M.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>H({wagePayDay:e})})]}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,M.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>H({wageCutoffDay:e})})]}),(0,M.jsxs)(h.Muted,{children:["Period runs the ",R(a.wageCutoffDay)," to the ",R(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,M.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,M.jsx)(h.Chip,{label:B[e],selected:(a.weekendRule??'none')===e,onPress:()=>H({weekendRule:e})},e))})]}),(0,M.jsx)(T.SectionHead,{title:"Preview"}),(0,M.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,M.jsx)(I,{label:"Next tips payday",day:S.payday,period:S}),(0,M.jsx)(I,{label:"Then",day:v.payday,period:v}),(0,M.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,M.jsx)(I,{label:"Next payday",day:D.payday,period:D}),(0,M.jsx)(I,{label:"Then",day:z.payday,period:z})]}),(0,M.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,M.jsx)(h.Banner,{kind:"success",title:y}):null,(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=H,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return V}}),_e.summaryTable=E,_e.detailTable=Y,_e.copyText=G,_e.periodOptions=U,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:$}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:$,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:W}=(0,k.useVenuePay)(s),L=(0,y.useOwner)(e=>e.staff),N=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),J=(0,P.useHourly)(),K=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,M.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,M.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,M.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>U(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>H(ye,L,N,r,J),[ye.key,L,N,J,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage($)?(0,M.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===W?(0,M.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,M.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,M.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,M.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,M.jsx)(_,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,M.jsx)(h.Card,{highlight:b.colours.gold,children:(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,M.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,M.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,M.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,M.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,M.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,M.jsx)(v.HoursExport,{}),B?(0,M.jsx)(i.default,{style:{alignItems:'center'},children:(0,M.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,M.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,M.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,M.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,M.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,M.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await G(F(E(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,V(E(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,V(Y(ge))),Te('CSV downloaded (one line per shift).')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=E(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,M.jsx)(h.Banner,{kind:"success",title:he}):null,K?(0,M.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,M.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,M.jsx)(u.HoursSummaryCard,{name:A(e.person),role:O(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,M.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${A(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,M.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,M.jsx)(o.WideTable,{children:(0,M.jsxs)(i.default,{testID:"hours-table",children:[(0,M.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,M.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:q[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,M.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,M.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${A(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,M.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,M.jsxs)(i.default,{style:{width:q[0]},children:[(0,M.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",A(e.person)]}),(0,M.jsx)(h.Muted,{children:O(e.person)})]}),(0,M.jsx)(h.T,{size:14,style:{width:q[1]},children:e.shifts}),(0,M.jsx)(h.T,{size:14,weight:"semibold",style:{width:q[2]},children:(0,l.durText)(e.confirmed)}),(0,M.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:q[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,M.jsx)(h.T,{size:14,style:{width:q[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,M.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:q[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,M.jsxs)(h.T,{size:14,weight:"semibold",style:{width:q[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,M.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,M.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:q[0]},children:["Total (",ge.length,")"]}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[1]},children:me.s}),(0,M.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:q[2]},children:(0,l.durText)(me.c)}),(0,M.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:q[3]},children:(0,l.durText)(me.p)}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,M.jsx)(h.T,{size:14,style:{width:q[5]},children:" "}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,M.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,M.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,M.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,M.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,M.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,M.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,v]=(0,n.useState)(0),$=(0,f.tipsPeriod)(u,S.period.start,D),[B,R]=(0,n.useState)(''),[I,z]=(0,n.useState)({}),[L,N]=(0,n.useState)(null),E=(0,n.useMemo)(()=>H($,p,T,a,{}),[$.key,p,T]),Y=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>I[e.id]??Y(e),_=E.filter(e=>e.confirmed>0||e.pending>0),q=Math.round(100*Number(B.replace(/[\xa3,\s]/g,''))),J=Number.isFinite(q)&&q>0&&q<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(B),K=_.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:Q}=(0,w.allocate)(J?q:0,K.map(e=>e.confirmed)),X={};K.forEach((e,s)=>{X[e.person.id]=Q[s]});const Z=K.reduce((e,s)=>e+s.confirmed,0),ee=Object.values(X).reduce((e,s)=>e+s,0),se=_.filter(e=>e.pending>0&&!U(e.person)),te=se.reduce((e,s)=>e+s.pending,0),oe=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],..._.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[A(e.person),O(e.person),(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&Z?(e.confirmed/Z*100).toFixed(2):'0.00',s?W(X[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(Z),(0,f.hMm)(Z),Z?'100.00':'0.00',W(ee)]],ne=e=>{N(e),setTimeout(()=>N(null),6e3)};return(0,M.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,M.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,M.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,M.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>v(D-1)}),(0,M.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,M.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)($.start,$.end)}),(0,M.jsxs)(h.Muted,{children:[(0,f.ukDate)($.start)," to ",(0,f.ukDate)($.end)," \xb7 ",$.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)($.payday)]}),0===D?(0,M.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>v(D+1)})]}),(0,M.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,M.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,M.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,M.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,M.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:B,onChangeText:R,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),B&&!J?(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,M.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),se.length?(0,M.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,M.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,M.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(te)," not approved yet"]}),(0,M.jsxs)(h.T,{size:14,children:[se.map(e=>`${A(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):_.length?(0,M.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,M.jsx)(o.WideTable,{children:(0,M.jsxs)(i.default,{testID:"tips-table",children:[(0,M.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,M.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),_.map(e=>{const s=U(e.person),t=X[e.person.id]??0;return(0,M.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,M.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${A(e.person)}`,onPress:()=>z({...I,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,M.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,M.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,M.jsxs)(i.default,{style:{width:150},children:[(0,M.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:A(e.person)}),(0,M.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':O(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,M.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,M.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&Z?`${(e.confirmed/Z*100).toFixed(1)}%`:'\u2013'}),(0,M.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,M.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,M.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",K.length," people)"]}),(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(Z)," h"]}),(0,M.jsx)(h.T,{size:14,style:{width:64},children:Z?'100%':'\u2013'}),(0,M.jsx)(h.T,{size:15,weight:"bold",colour:J&&ee===q?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(ee)})]})]})}),_.length?null:(0,M.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),J&&Z?(0,M.jsxs)(h.Muted,{children:["Check: ",K.length," shares add up to ",(0,x.gbp)(ee)," of ",(0,x.gbp)(q)," ",ee===q?'\u2713':'',". \xa3",(q/100/(Z/60)).toFixed(4)," per confirmed hour."]}):null,(0,M.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!J,onPress:async()=>{const e=await G(F(oe()));ne(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!J,onPress:()=>{(0,j.downloadText)(`tips-${$.start}-to-${$.end}.csv`,V(oe())),ne('CSV downloaded.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!J,onPress:()=>{const e=oe();(0,j.printTable)(`Tips ${(0,f.rangeText)($.start,$.end)} (paid ${(0,f.dayMonth)($.payday)})`,`Total ${(0,x.gbp)(q)} shared by confirmed hours${se.length?` \xb7 WARNING ${(0,f.decH)(te)} h not signed off`:''}`,e[0],e.slice(1))}})]}),L?(0,M.jsx)(h.Banner,{kind:"success",title:L}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,M.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,M.jsx)(r.CardHeading,{right:'none'===n?(0,M.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:["Next tips payday: ",(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,M.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:["Next payday: ",(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,M.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,M.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,M.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,M.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?H(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,M.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,M.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,M.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,M.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,M.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,M.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,M.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),v=_r(_d[26]),M=_r(_d[27]);const $={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},B={none:'Keep the date',before:'Friday before',after:'Monday after'};const R=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function I({label:e,day:s,period:t}){return(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:[e,": ",(0,M.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,M.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const z=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function H(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:z(e.in),outT:z(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const O=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,A=e=>e.name.replace(' (example)',''),W=e=>null==e?'':(e/100).toFixed(2),L=e=>e.replace(/[\t\r\n]+/g,' '),N=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,F=e=>e.map(e=>e.map(L).join('\t')).join('\n'),V=e=>e.map(e=>e.map(N).join(',')).join('\r\n');function E(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[A(e.person),O(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[W(e.rate),W(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',W(d.g)]:[]]]}function Y(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[A(e.person),O(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function G(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function U(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function _({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,M.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,M.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,M.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,M.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,M.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const q=[150,54,100,90,48,62,70]},1062,[874,834,1459,31,1460,123,264,288,128,1462,1463,1464,818,881,863,820,1184,825,1386,1064,1078,953,1185,1465,807,1466,1470,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ee,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return se}}),_e.rotaGrid=ne,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:o}=(0,$.useCtx)(6e4),i=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),r=(0,s.useOwner)(e=>e.shifts),d=(0,$.useHourly)(),u=(0,s.useOwner)(e=>e.availability),m=(0,s.useOwner)(e=>e.leave),x=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[I,M]=(0,l.useState)(0),B=(0,Y.useDateCalendar)(),[P,R]=(0,l.useState)(null),[A,z]=(0,l.useState)(null),[H,W]=(0,l.useState)(null),[F,G]=(0,l.useState)('week'),[Q,ie]=(0,l.useState)(!1),le=(0,$.useSignedIn)()?.name??'',re='staff'!==n,de=(0,C.addMins)(Z(t),7*I*1440);de.setHours(0,0,0,0);const ce=ee(de),ue=ce.sales,he='none'===ce.mode,fe=Array.from({length:7},(e,t)=>{const s=new Date(de);return s.setDate(de.getDate()+t),(0,C.ymd)(s)}),me=(0,s.visibleShifts)(r,re).filter(e=>e.date>=fe[0]&&e.date<=fe[6]),ge=(()=>{const e=new Date(de);return e.setDate(e.getDate()-7),(0,C.ymd)(e)})(),pe=me.filter(e=>!e.published||e.changed).length,xe=r.filter(e=>e.date>=ge&&e.date!!(0,s.leaveOn)(m,e,t),je=fe.map(e=>(0,g.workingShifts)(me,m).filter(t=>t.date===e).reduce((e,t)=>{return e+(X(s=t)-J(X(s)))*(d[s.staffId]??0);var s},0)),we=je.reduce((e,t)=>e+t,0),ye=ue.reduce((e,t)=>e+t,0),ke=(e,t)=>t?Math.round(e/t*100):0,Ie=re?i:i.filter(e=>e.id===o),Se=(0,a.useNarrow)(),Ce=Math.max(0,fe.indexOf((0,C.ymd)(t))),[De,ve]=(0,l.useState)(null),Te=De??Ce,$e=(e,t)=>!Se||t===Te,[Oe,Me]=(0,l.useState)(0),Be=ne(Oe,Se?1:7),Pe=Be.cell,Re=Be.name;return(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Week",selected:'week'===F,onPress:()=>G('week')}),(0,V.jsx)(f.Chip,{label:`Swaps & time off (${x.filter(e=>'open'===e.status).length+m.filter(e=>'pending'===e.status).length})`,selected:'requests'===F,onPress:()=>G('requests')}),(0,V.jsx)(f.Chip,{label:"Availability",selected:'availability'===F,onPress:()=>G('availability')})]}),'week'===F?(0,V.jsxs)(V.Fragment,{children:[!re&&o?(0,V.jsx)(k.RequestTimeOff,{meId:o,me:le,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,V.jsx)(h.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,V.jsx)(f.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,N.timeSheetLabel)(fe[0],fe[6]),onPress:()=>{(0,N.setHoursPreset)(fe[0],fe[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,V.jsxs)(h.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Oe?Math.min(Oe,Be.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{M(I-1),R(null)},style:{minWidth:96}}),(0,V.jsxs)(h.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,V.jsxs)(f.T,{weight:"semibold",center:!0,children:["Week of ",(0,C.niceDate)(de)]}),(0,V.jsxs)(f.Muted,{center:!0,children:[0===I?'This week':1===I?'Next week':-1===I?'Last week':I>0?`In ${I} weeks`:-I+" weeks ago",re?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{M(I+1),R(null)},style:{minWidth:96}})]}),(0,V.jsx)(h.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:B.openCal,style:{minWidth:96}})}),(0,V.jsx)(Y.AppDateCalendar,{visible:B.calOpen,today:(0,C.ymd)(t),day:(0,C.ymd)(de),idPrefix:"rota-cal",onClose:B.closeCal,onDay:e=>{M((0,Y.weekOffsetOf)(e??(0,C.ymd)(t),(0,C.ymd)(t))),R(null)}}),re?(0,V.jsxs)(f.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,V.jsx)(f.Button,{small:!0,kind:"secondary",label:"Copy last week"+(xe?` (${xe})`:''),disabled:!xe,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(ge,fe[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,V.jsx)(f.Button,{small:!0,kind:"success",label:pe?`Publish ${pe} ${1===pe?'change':'changes'}`:'Week published',disabled:!pe,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(fe[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),pe?(0,V.jsx)(f.Badge,{kind:"amber",label:`${pe} unpublished`}):me.length?(0,V.jsx)(f.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,P?(0,V.jsx)(f.Banner,{kind:"success",title:P}):null,Se?(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:$.DAY3.map((e,t)=>q.IS_CAR?(0,V.jsx)(f.Button,{kind:t===Te?'primary':'secondary',label:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}`,accessibilityLabel:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}${t===Te?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>ve(t),style:{minHeight:64,minWidth:96}},e):(0,V.jsx)(f.Chip,{label:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}`,selected:t===Te,onPress:()=>ve(t)},e))}):null,(0,V.jsx)(h.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Oe)>1&&Me(t)},style:{alignSelf:'stretch'},children:(0,V.jsx)(oe,{fits:Se||Be.fits,children:(0,V.jsxs)(h.default,{testID:"rota-grid",style:{gap:se,width:Be.width,alignSelf:'center'},children:[(0,V.jsxs)(h.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:se,backgroundColor:D.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:D.colours.hairline,zIndex:5},Se||Be.fits?ae:null],children:[(0,V.jsx)(h.default,{style:{width:Re,justifyContent:'center'},children:(0,V.jsx)(f.T,{size:11,weight:"semibold",colour:D.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),$.DAY3.map((e,s)=>(0,V.jsx)(h.default,{testID:"rota-date",style:{width:Pe,alignItems:'center'},children:(0,V.jsxs)(f.T,{size:Be.big?13:12,weight:"semibold",center:!0,colour:fe[s]===(0,C.ymd)(t)?D.colours.gold:D.colours.text,children:[e," ",(0,C.parseYmd)(fe[s]).getDate()]})},e)).filter($e)]}),Ie.map(e=>(0,V.jsxs)(h.default,{testID:"rota-row",style:{flexDirection:'row',gap:se,alignItems:'center'},children:[(0,V.jsxs)(h.default,{testID:"rota-name",style:{width:Re,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,V.jsx)(O.StaffAvatar,{id:e.id,size:28}),(0,V.jsxs)(h.default,{style:{flex:1,minWidth:0},children:[(0,V.jsx)(f.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,V.jsx)(f.T,{size:11,colour:D.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),$.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(me,e.id,fe[n]),o=(u[e.id]??[]).includes(n),i=be(e.id,fe[n]),l=(0,p.rotaCellWorked)(a,b,e.id,fe[n],re),r=!(!re||!l.workedLine&&!l.onShiftNow);return(0,V.jsxs)(c.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${$.DAY3[n]}, ${l.speech}${(0,E.badgeSpoken)(a?.badge)}${i?', on time off':''}${o?', unavailable':''}`,disabled:!re,onPress:()=>{a?W({staffId:e.id,date:fe[n],shift:a}):z({staffId:e.id,date:fe[n]})},style:({pressed:e})=>({width:Pe,minHeight:q.IS_CAR?64:r?80:52,height:r||(0,E.cleanBadge)(a?.badge)||q.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:l.differs?D.colours.amber:a?a.published?D.colours.gold:D.colours.amber:D.colours.border,backgroundColor:e?D.colours.goldTint:a?a.published?'#2b2414':'#241f14':i?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,E.cleanBadge)(a?.badge)?6:0}),children:[a?(0,V.jsxs)(f.T,{size:Be.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,$.fmtH)(a.start),"\u2013",(0,$.fmtH)(a.end)]}):l.workedLine?null:(0,V.jsx)(f.T,{size:12,center:!0,colour:D.colours.muted,children:i?'Off':o?'Unavail.':re?'Add':'\u2013'}),(0,E.cleanBadge)(a?.badge)?(0,V.jsx)(h.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:D.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,V.jsx)(f.T,{size:10,weight:"semibold",colour:D.colours.gold,center:!0,numberOfLines:1,children:(0,E.cleanBadge)(a?.badge)})}):null,l.workedLine?(0,V.jsx)(f.T,{testID:"rota-worked",size:10,colour:l.differs?D.colours.amber:D.colours.goldLight,center:!0,children:l.workedLine}):null,l.onShiftNow?(0,V.jsx)(f.T,{testID:"rota-on-shift-now",size:10,colour:D.colours.goldLight,center:!0,children:"On shift now"}):null,l.diffLabel?(0,V.jsx)(f.T,{size:10,colour:D.colours.amber,center:!0,children:l.diffLabel}):null,a&&i?(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.blue,children:(0,g.leaveLabel)((0,s.leaveOn)(m,e.id,fe[n])).toLowerCase()}):a&&o?(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.red,children:"unavailable"}):!a||!re||a.published&&!a.changed||l.workedLine||l.onShiftNow?null:(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter($e)]},e.id)),re?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se,marginTop:4},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:"Labour"})}),je.map((e,t)=>(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,children:(0,S.gbp)(e).replace('.00','')})},t)).filter($e)]}),he?null:(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:'example'===ce.mode?'Fcst sales (ex.)':'Fcst sales'})}),ue.map((e,t)=>(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,colour:D.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter($e)]}),he?null:(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:"Labour %"})}),je.map((e,t)=>{const s=ke(e,ue[t]);return(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,weight:"semibold",colour:ue[t]?s>32?D.colours.red:s>26?D.colours.amber:D.colours.ok:D.colours.muted,children:ue[t]?`${s}%`:'\u2013'})},t)}).filter($e)]})]}):null]})})}),!re&&o?(0,V.jsx)(h.default,{testID:"rota-team-on",children:(0,V.jsx)(f.Card,{children:fe.map((e,t)=>(0,V.jsx)(j.TeamOnDay,{date:e,meId:o,label:(0,C.niceDate)((0,C.parseYmd)(e))},e)).filter($e)})}):null,re&&he?(0,V.jsx)(f.Card,{children:(0,V.jsxs)(h.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Labour this week"}),(0,V.jsx)(h.default,{testID:"labour-week-cost",children:(0,V.jsx)(f.T,{weight:"semibold",children:(0,S.gbp)(we)})})]}),(0,V.jsxs)(f.Muted,{children:[(0,S.gbp)(we)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,V.jsx)(f.T,{weight:"semibold",colour:D.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,V.jsx)(f.Muted,{children:`Forecasts start once CoverCharge has ${1===ce.weeks?'1 week':`${ce.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ce.booked?(0,V.jsx)(h.default,{testID:"labour-booked",children:(0,V.jsxs)(f.T,{children:["Booked so far: ",ce.booked," Covers this week"]})}):null]})}):null,re&&!he?(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,V.jsxs)(f.Row,{gap:6,children:['example'===ce.mode?(0,V.jsx)(L.ExampleBadge,{}):null,(0,V.jsx)(f.Badge,{kind:ke(we,ye)>30?'red':'ok',label:`${ke(we,ye)}% this week`})]})]}),(0,V.jsxs)(f.Muted,{children:[(0,S.gbp)(we)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,S.gbp)(ye)," forecast sales. Target 25\u201330%. ",'example'===ce.mode?'Example figures: forecast sales use an example spend per cover.':'Forecast sales are your average takings for each weekday from your cash-ups.']}),(()=>{const e=ke(je[5],ue[5]);return e&&e<24?(0,V.jsxs)(f.T,{size:14,colour:D.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,re?(0,V.jsx)(f.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===F?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v.SectionHead,{title:"Shift swaps & cover"}),x.filter(e=>re||e.fromId===o||e.toId===o).map(e=>{const t=r.find(t=>t.id===e.shiftId),n=i.find(t=>t.id===e.fromId),a=i.find(t=>t.id===e.toId);return(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,V.jsx)(f.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,V.jsxs)(f.Muted,{children:[t?`${$.DAY3[t.day]} ${(0,$.fmtH)(t.start)}\u2013${(0,$.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&re?(0,V.jsxs)(f.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:i.filter(e=>U(n,e)).map(t=>(0,V.jsx)(f.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,V.jsx)(f.Button,{small:!0,label:"Approve",disabled:!e.toId||!U(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(i.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,T.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${$.DAY3[t.day]} ${(0,$.fmtH)(t.start)}\u2013${(0,$.fmtH)(t.end)})`:''}`)}}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),re?null:(0,V.jsxs)(f.Card,{children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,V.jsx)(f.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,V.jsx)(f.Muted,{testID:"swap-dept-note",children:(0,w.isAnchorageVenue)(y.VENUE_RID)?w.ANCHORAGE_SWAP_NOTE:K(i.find(e=>e.id===o))?w.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),me.filter(e=>e.staffId===o).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=x.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,V.jsxs)(h.default,{style:{gap:4,paddingVertical:4},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:14,weight:"medium",children:[$.DAY3[e.day]," ",(0,$.fmtH)(e.start),"\u2013",(0,$.fmtH)(e.end),(0,E.cleanBadge)(e.badge)?` \xb7 ${(0,E.cleanBadge)(e.badge)}`:'']}),t?(0,V.jsx)(f.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:o,kind:'cover',note:'Can anyone cover?'}),(0,T.autoPost)('all',`Cover needed: ${$.DAY3[e.day]} ${(0,$.fmtH)(e.start)}\u2013${(0,$.fmtH)(e.end)} (${(i.find(e=>e.id===o)?.name??'').replace(' (example)','')})`)}}),i.filter(e=>U(i.find(e=>e.id===o),e)).map(t=>(0,V.jsx)(f.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:o,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),me.some(e=>e.staffId===o)?null:(0,V.jsx)(f.Muted,{children:"No shifts on the rota this week."})]}),(0,V.jsx)(v.SectionHead,{title:"Holiday & time off"}),re?(0,V.jsx)(f.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>ie(!0)}):o?(0,V.jsx)(k.RequestTimeOff,{meId:o,me:le,testID:"rota-requests-time-off"}):null,m.filter(e=>re||e.staffId===o).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,V.jsx)(f.Card,{children:(0,V.jsxs)(h.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:(i.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,V.jsx)(f.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,V.jsxs)(f.Muted,{children:[(0,k.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&re?(0,V.jsxs)(f.Row,{gap:6,style:{justifyContent:'center'},children:[(0,V.jsx)(f.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),re&&o?(0,V.jsx)(k.TimeOffSheet,{visible:Q,onClose:()=>ie(!1),meId:o,me:le,manager:!0}):null]}):null,'availability'===F?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(f.Muted,{children:["Days each person can\u2019t work. ",re?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ie.filter(e=>'owner'!==e.role||!re).map(e=>(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{gap:8,children:[(0,V.jsx)(O.StaffAvatar,{id:e.id,size:30}),(0,V.jsx)(f.T,{weight:"semibold",children:e.name})]}),(0,V.jsx)(f.Row,{wrap:!0,gap:4,children:$.DAY3.map((t,n)=>{const a=(u[e.id]??[]).includes(n);return(0,V.jsx)(f.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,H?(0,V.jsx)(_.AssignRoleSheet,{name:(i.find(e=>e.id===H.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,C.niceDate)((0,C.parseYmd)(H.date))} \xb7 ${(0,$.fmtH)(H.shift.start)}\u2013${(0,$.fmtH)(H.shift.end)}`,current:H.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,E.assignShiftBadge)(s.useOwner.getState().shifts,H.shift.id,e)),W(null)},onEditTimes:()=>{z(H),W(null)},onClose:()=>W(null)}):null,A?(0,V.jsx)(te,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:a,meId:u,me:m,r:g,rid:p}=(0,$.useCtx)(5e3),x=((0,M.useClockArea)(e=>e.areas[p]),(0,M.areaOf)(p));const j=(0,B.privateClockVenue)(p),[w,y]=(0,l.useState)(!1),k=(0,s.useOwner)(e=>e.consent[u]),I=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),S=(0,s.useOwner)(e=>e.shifts),[v,T]=(0,l.useState)(!1),[L,H]=(0,l.useState)(null),[N,W]=(0,l.useState)(null),[Y,F]=(0,l.useState)(void 0),[E,_]=(0,l.useState)(null),[q,K]=(0,l.useState)(!1),[U,G]=(0,l.useState)(null),Q=I.filter(t=>t.staffId===u&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],X=Q&&(0,s.isOnBreak)(Q)?Q.breaks[Q.breaks.length-1]:void 0,J=(0,s.visibleShifts)(S,'staff'!==a).find(e=>e.staffId===u&&e.date===t),Z='staff'!==a,ee=Q?(0,$.paidMins)({in:Q.in},e).worked:0,te=x.on&&(0,P.areaSet)(x),se=Q?.geo?.[Q.geo.length-1],ne=I.filter(e=>e.staffId===u&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],ae=(0,r.useClockNotSent)(Q?.id??E?.id??ne?.id),[oe,re]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if(ae)re(!0);else if(oe){const e=setTimeout(()=>re(!1),6e3);return()=>clearTimeout(e)}},[ae]);const de=!ae&&oe,ce=async(s,n={})=>{H(s),W(null),F(void 0);const a=await(0,R.clockAction)(s,{rid:p,staffId:u,date:t,at:new Date(e.getTime()).toISOString(),...n});return H(null),a.ok?('out'===s&&a.att&&(_(a.att),(0,i.hrSettingsOf)(g.settings?.hr).on&&!o.useHr.getState().hasAnswered(p,a.att.id)&&G(a.att)),'in'===s&&_(null),a.att&&(0,r.markClockUnsent)(a.att.id),!0):(W(a.message),F(a.fix),(0,A.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return k?(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.Row,{gap:10,style:{flex:1},children:[(0,V.jsx)(O.StaffAvatar,{id:u,size:48}),(0,V.jsx)(f.T,{weight:"semibold",style:{flex:1},children:m})]}),(0,V.jsx)(f.Badge,{kind:Q?'ok':'neutral',label:Q?`On shift since ${(0,C.hm)(new Date(Q.in))}`:'Not clocked in'})]}),(0,V.jsx)(f.Muted,{children:J?`Today's shift: ${(0,$.fmtH)(J.start)}\u2013${(0,$.fmtH)(J.end)}`:'No shift on the rota today'}),(0,V.jsx)(h.default,{testID:"clock-area-line",children:(0,V.jsx)(f.T,{size:14,colour:D.colours.muted,children:te?j?`Location is checked only when you choose Clock in, at ${g.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${g.name}.`:x.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),se&&!0===se.inside&&null!=se.dist?(0,V.jsxs)(f.Muted,{children:["Last check: at the venue (about ",se.dist," m from the centre)."]}):null,Q?(0,V.jsx)(f.T,{size:30,weight:"bold",center:!0,children:(0,$.hmDur)(ee)}):null,Q&&X?(0,V.jsx)(h.default,{testID:"on-break",children:(0,V.jsxs)(f.T,{size:15,weight:"semibold",colour:D.colours.gold,center:!0,children:["On a break since ",(0,C.hm)(new Date(X.start))," \xb7 ",(0,s.loggedBreakMins)(Q,e)," min so far"]})}):null,Q?(0,V.jsxs)(V.Fragment,{children:[X?(0,V.jsx)(f.Button,{testID:"break-end",kind:"success",label:'break_end'===L?'Checking your location\u2026':'End break',disabled:!!L,onPress:()=>{ce('break_end')}}):(0,V.jsx)(f.Button,{testID:"break-start",kind:"secondary",label:'break_start'===L?'Checking your location\u2026':'Start break',disabled:!!L,onPress:()=>{ce('break_start')}}),(0,V.jsx)(f.Button,{testID:"clock-out",kind:"danger",label:'out'===L?'Checking your location\u2026':'Clock out',disabled:!!L,onPress:()=>{Q.breaks?.length?ce('out'):(W(null),T(!0))}})]}):(0,V.jsx)(f.Button,{testID:"clock-in",kind:"success",label:'in'===L?'Checking your location\u2026':'Clock in',disabled:!!L,onPress:()=>{j?y(!0):ce('in')}}),ae?(0,V.jsxs)(h.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,V.jsx)(f.T,{size:18,weight:"bold",colour:D.colours.gold,center:!0,children:"Not sent yet"}),(0,V.jsx)(f.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,V.jsx)(f.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{d.mutationQueue.retryNow()}})]}):de?(0,V.jsx)(h.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,V.jsx)(f.T,{size:14,colour:D.colours.ok,center:!0,children:"\u2713 Sent"})}):null,Q?.breaks?.length?(0,V.jsxs)(f.Muted,{center:!0,children:["Breaks today: ",Q.breaks.map(e=>`${(0,C.hm)(new Date(e.start))}\u2013${e.end?(0,C.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(Q,e)," min)"]}):null,N?(0,V.jsx)(h.default,{testID:"clock-message",children:(0,V.jsx)(f.Banner,{kind:"warn",title:"Not recorded",children:N})}):null,N&&'settings'===Y?(0,V.jsx)(f.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:z.openAppSettings}):null,N&&'location'===Y?(0,V.jsx)(f.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:z.openLocationSettings}):null,N&&'update'===Y?(0,V.jsx)(f.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:z.checkAppUpdate}):null]}),Z&&!(0,P.areaSet)(x)?(0,V.jsx)(h.default,{testID:"clock-area-warning",children:(0,V.jsx)(f.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,V.jsx)(c.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>K(!0),style:{alignSelf:'center',padding:6},children:(0,V.jsx)(f.T,{size:14,colour:D.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,V.jsx)(le,{onClose:()=>K(!1)}):null,(0,V.jsx)(b.BreakRoomCard,{staffId:u,name:m,now:e}),E?(()=>{const t=(0,$.paidMins)(E,e);return(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsxs)(f.T,{weight:"semibold",colour:D.colours.gold,children:["Clocked out at ",(0,C.hm)(new Date(E.out))]}),(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["Clocked ",(0,$.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,$.hmDur)(t.paid)]}),(0,V.jsxs)(f.Muted,{children:["In ",(0,C.hm)(new Date(E.in))," \xb7 out ",(0,C.hm)(new Date(E.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",E.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,V.jsx)(f.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,V.jsx)(f.Sheet,{visible:w,onClose:()=>y(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,V.jsxs)(h.default,{style:{gap:12},children:[(0,V.jsxs)(f.T,{children:["We check once that you are at ",g.name,", within about ",x.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,V.jsx)(f.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,V.jsx)(f.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{y(!1),ce('in')}}),(0,V.jsx)(f.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>y(!1)})]})}),Z?(0,V.jsx)(ie,{rid:p,today:t,now:e}):null,U?(0,V.jsx)(n.ShiftCheckout,{rid:p,shiftKey:U.id,day:U.date,meId:u,onClose:()=>G(null)}):null,(0,V.jsx)(f.Sheet,{visible:v,onClose:()=>T(!1),title:"Did you take a break? If so, how long?",children:(0,V.jsxs)(h.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,V.jsx)(f.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,V.jsx)(f.Chip,{testID:`forgot-break-${e}`,label:(0,P.breakLabel)(e),disabled:e>=ee,onPress:()=>{T(!1),ce('out',{addedBreak:e})}},e))}),(0,V.jsx)(f.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{T(!1),ce('out',{breakMins:0})}}),ee>360?(0,V.jsx)(f.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,V.jsx)(f.Muted,{children:j?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,V.jsx)(h.default,{style:{gap:10},children:(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsx)(f.T,{weight:"semibold",colour:D.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(f.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",g.name,", within about ",x.radius," m."]}),(0,V.jsx)(f.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,V.jsxs)(V.Fragment,{children:[" ",(0,V.jsxs)(f.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,V.jsx)(f.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",g.name," (within about ",x.radius," m)."]}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,V.jsx)(f.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(u,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,$.useCtx)(3e4);return s!=='staff'?(0,V.jsx)(de,{now:e,today:t,meId:n}):(0,V.jsx)(re,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]);_r(_d[9]);var c=e(_r(_d[10])),u=e(_r(_d[11])),h=e(_r(_d[12])),f=_r(_d[13]),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),B=_r(_d[32]),P=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),W=_r(_d[40]),Y=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),V=_r(_d[46]);const K=e=>(0,w.deptKey)(e?.dept),U=(e,t)=>(0,w.canSwapWith)(e,t,y.VENUE_RID),G=2650,Q=1900,X=e=>e.end-e.start,J=e=>e>8?.5:e>6?.3333333333333333:0,Z=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,$.weekday)(e)),t};function ee(e){const{rid:t,r:s,now:n}=(0,$.useCtx)(6e4),a=(0,m.useBookings)(t),o=(0,m.useOrders)(t),i=(0,m.useEvents)(t),r=(0,L.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,C.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),n=a.filter(e=>!e.walkIn&&'confirmed'===e.status&&t.some(t=>(0,C.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,H.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:l,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:l,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:l,booked:n,sales:t.map(e=>{const t=(0,I.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*G+t.restOfDay.takeaway*Q:0})}},[s,a,o,i,r,(0,C.ymd)(e)])}function te({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,l.useState)(e.shift?.start??12),[i,r]=(0,l.useState)(e.shift?.end??20),[d,c]=(0,l.useState)(e.shift?.breakAt),[u,m]=(0,l.useState)((0,E.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,V.jsxs)(f.Sheet,{visible:!0,onClose:t,title:(0,F.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,V.jsx)(f.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,k.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,V.jsx)(f.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,V.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,V.jsx)(f.Chip,{label:"None",selected:!u,onPress:()=>m(void 0),testID:"shift-badge-none"}),E.ROLE_BADGES.map(e=>(0,V.jsx)(f.Chip,{label:e,selected:u===e,onPress:()=>m(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,V.jsx)(f.Chip,{label:`${e} ${(0,$.fmtH)(t)}\u2013${(0,$.fmtH)(s)}`,selected:a===t&&i===s,onPress:()=>{o(t),r(s)}},e))}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{children:"Start"}),(0,V.jsx)(f.Stepper,{testID:"shift-start",value:a,step:.5,min:F.SHIFT_MIN_START,max:i-1,onChange:o,format:$.fmtH,label:"Start time"})]}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,V.jsx)(f.T,{children:"End"}),(0,V.jsxs)(h.default,{style:{alignItems:'flex-end'},children:[(0,V.jsx)(f.Stepper,{testID:"shift-end",value:i,step:.5,min:a+1,max:F.SHIFT_MAX_END,onChange:r,format:$.fmtH,label:"End time"}),i>=24?(0,V.jsx)(f.Muted,{children:"next day"}):null]})]}),(0,V.jsxs)(f.Muted,{children:[(i-a).toFixed(1),"h scheduled",J(i-a)?`, ${Math.round(60*J(i-a))}m planned break`:'']}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,V.jsx)(f.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,V.jsx)(f.Chip,{label:"Set a break time",onPress:()=>c(Math.min(i-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(i-a)/2)))/4)))}):(0,V.jsxs)(f.Row,{gap:6,children:[(0,V.jsx)(f.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:i-.25,onChange:c,format:$.fmtH,label:"Break time"}),(0,V.jsx)(f.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,V.jsx)(f.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,V.jsx)(f.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:i,breakAt:g?d:void 0,badge:(0,E.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:i,...void 0!==d&&g?{breakAt:d}:{},...(0,E.cleanBadge)(u)?{badge:(0,E.cleanBadge)(u)}:{}}),t()}}),(0,V.jsx)(f.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,V.jsx)(f.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const se=6;function ne(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*se:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+se),big:o>=104,fits:!e||s+t*(o+se)<=e}}const ae={position:'sticky',top:0};function oe({fits:e,children:t}){return e?(0,V.jsx)(h.default,{style:{alignItems:'center'},children:t}):(0,V.jsx)(u.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function ie({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),i=(0,$.useSignedIn)(),{me:r,meId:d}=(0,$.useCtx)(3e4),[c,u]=(0,l.useState)(null),[h,m]=(0,l.useState)(''),[g,p]=(0,l.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,R.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:i?.id??d,name:i?.name??r},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,A.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),p(null)};return(0,V.jsxs)(f.Card,{children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Record it for someone"}),(0,V.jsx)(f.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:a.map(e=>(0,V.jsx)(f.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:x?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,V.jsx)(f.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,V.jsx)(f.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,V.jsx)(f.T,{size:13,colour:D.colours.red,children:g}):null]}):null]})}function le({onClose:e}){const{now:t,today:n,meId:a}=(0,$.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),i=(0,s.useOwner)(e=>e.shifts),r=Array.from({length:7},(e,t)=>(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(n),1440*-t))),[d,c]=(0,l.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(i,!1).find(e=>e.staffId===a&&e.date===d),[m,g]=(0,l.useState)(u&&!u.out?'out':'in'),[p,b]=(0,l.useState)(h?Math.round(60*h.start):720),[j,w]=(0,l.useState)(h?Math.round(60*h.end):1200),[y,k]=(0,l.useState)(''),[I,S]=(0,l.useState)(!1),v=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==m,O='in'!==m,M=T&&O&&j<=p,B=(e,t)=>(0,V.jsx)(f.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,V.jsxs)(f.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,V.jsx)(f.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,V.jsx)(f.Button,{label:"Done",onPress:e})]}):(0,V.jsxs)(f.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,V.jsx)(f.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:r.map(e=>(0,V.jsx)(f.Chip,{label:e===n?'Today':(0,C.niceDate)((0,C.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,V.jsxs)(f.Muted,{children:[h?`Your rota that day: ${(0,$.fmtH)(h.start)}\u2013${(0,$.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,C.hm)(new Date(u.in))}\u2013${u.out?(0,C.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Forgot to clock in",selected:'in'===m,onPress:()=>g('in')}),(0,V.jsx)(f.Chip,{label:"Forgot to clock out",selected:'out'===m,onPress:()=>g('out')}),(0,V.jsx)(f.Chip,{label:"Forgot both",selected:'both'===m,onPress:()=>g('both')})]}),T?(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["In ",v(p)]}),B(b,p)]}):null,O?(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["Out ",v(j),j>=1440?' (next day)':'']}),B(w,j)]}):null,M?(0,V.jsx)(f.T,{size:13,colour:D.colours.red,children:"Clock-out must be after clock-in."}):null,(0,V.jsx)(f.Field,{label:"Note for your manager (optional)",value:y,onChangeText:k,placeholder:"e.g. phone died",maxLength:200}),(0,V.jsx)(f.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:m,suggestedIn:T?(0,x.isoAt)(d,p):void 0,suggestedOut:O?(0,x.isoAt)(d,j):void 0,note:y.trim(),at:t.toISOString()}),S(!0)}})]})}function re(){const{now:e,today:t,meId:n}=(0,$.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),i=(0,s.useOwner)(e=>e.timeRequests),[r,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),m=(0,C.ymd)(Z(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=m),b=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),w=i.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,V.jsxs)(h.default,{style:{gap:10},testID:"my-timesheet",children:[(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,V.jsxs)(h.default,{children:[(0,V.jsx)(f.T,{size:12,colour:D.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,V.jsx)(f.T,{size:28,weight:"bold",colour:D.colours.ok,children:(0,$.hmDur)(b)})]}),(0,V.jsxs)(h.default,{style:{alignItems:'flex-end'},children:[(0,V.jsx)(f.T,{size:12,colour:D.colours.muted,children:"PENDING SIGN-OFF"}),(0,V.jsx)(f.T,{size:18,weight:"semibold",colour:j?D.colours.amber:D.colours.muted,children:(0,$.hmDur)(j)})]})]}),(0,V.jsx)(f.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,V.jsx)(f.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,V.jsx)(v.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,V.jsxs)(h.default,{style:{flex:1},children:[(0,V.jsxs)(f.T,{size:14,children:[(0,C.niceDate)((0,C.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,V.jsxs)(f.Muted,{children:[e.suggestedIn?`in ${(0,C.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,C.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,V.jsx)(f.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,V.jsx)(v.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,$.paidMins)(t,e),i=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,V.jsxs)(f.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(h.default,{style:{flex:1},children:[(0,V.jsx)(f.T,{weight:"semibold",children:(0,C.niceDate)((0,C.parseYmd)(t.date))}),(0,V.jsxs)(f.Muted,{children:[(0,C.hm)(new Date(t.in)),"\u2013",t.out?(0,C.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,$.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,$.fmtH)(n.start)}\u2013${(0,$.fmtH)(n.end)}`:'']})]}),(0,V.jsx)(f.Badge,{kind:(0,x.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,x.statusLabel)(t)})]}),i?(0,V.jsxs)(f.T,{size:13,colour:D.colours.gold,children:["Adjusted by ",i.by.replace(' (example)',''),i.reason?`: ${i.reason}`:'']}):null,t.signOff?(0,V.jsxs)(f.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,V.jsx)(x.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,V.jsx)(f.Muted,{children:"No clocked shifts yet."}),r?(0,V.jsx)(le,{onClose:()=>d(!1)}):null]})}function de({now:e,today:n}){const o=(0,s.useOwner)(e=>e.staff),i=(0,s.useOwner)(e=>e.shifts),r=(0,$.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),u=(0,s.useOwner)(e=>e.timeRequests),m=(0,s.useOwner)(e=>e.leave),p=(0,s.useOwner)(e=>e.attLog),[b,j]=(0,l.useState)(n),[w,y]=(0,l.useState)(null),[k,I]=(0,l.useState)(!1),[T,M]=(0,l.useState)(!1),B=!!(0,$.useSignedIn)(),P=T?(0,N.pastWeekDays)(b,n):Array.from({length:7},(e,t)=>(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===b&&e.in),A=i.filter(e=>e.date===b&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>P.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),Y=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),F=L.reduce((t,s)=>t+(0,$.paidMins)(s,e).paid/60*(r[s.staffId]??0),0),E=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=o.find(e=>e.id===t.staffId),a=(0,s.shiftOf)(i,t.staffId,t.date),l=(0,$.paidMins)(t,e),d=r[t.staffId]??0;return`${n?.name},${t.date},${a?`${(0,$.fmtH)(a.start)}-${(0,$.fmtH)(a.end)}`:'-'},${(0,C.hm)(new Date(t.in))},${(0,C.hm)(new Date(t.out))},${l.brk},${(l.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(l.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==r[t.staffId]?'Rate not set':n?.noTax&&B?'No tax deducted':''}`}));return(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsx)(W.HoursDayPicker,{testID:"ts-pick",date:b,today:n,custom:T,onDate:e=>{j(e),M(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),M(!1)}}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:P.map(e=>(0,V.jsx)(f.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,N.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':T?(0,N.chipDay)(e):(0,C.niceDate)((0,C.parseYmd)(e)).slice(0,6).trim(),selected:b===e,onPress:()=>j(e)},e))}),(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",testID:"ts-week-title",children:T?(0,N.weekTitle)(b,n):'Last 7 days'}),(0,V.jsx)(f.Badge,{kind:"ok",label:`${(0,$.hmDur)(H)} confirmed`})]}),Y?(0,V.jsxs)(f.T,{size:13,colour:D.colours.amber,children:[(0,$.hmDur)(Y)," pending sign-off (not counted yet)"]}):null,(0,V.jsxs)(f.Muted,{children:["Labour cost ",(0,S.gbp)(Math.round(F))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,V.jsx)(a.WideTable,{children:(0,V.jsxs)(h.default,{style:{gap:2},children:[(0,V.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:D.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,V.jsx)(f.T,{size:12,weight:"semibold",colour:D.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const l=o.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(i,t.staffId,b),d=(0,$.paidMins)(t,e),h=(0,x.flagsFor)(t,r,e,n,u).map(e=>e.label);return(0,V.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,V.jsxs)(f.Row,{gap:4,style:{width:110},children:[(0,V.jsx)(O.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,V.jsx)(f.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:l?.name.replace(' (example)','')})]}),(0,V.jsx)(f.T,{size:12,style:{width:86},colour:D.colours.muted,children:r?`${(0,$.fmtH)(r.start)}\u2013${(0,$.fmtH)(r.end)}`:'\u2013'}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:(0,C.hm)(new Date(t.in))}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:t.out?(0,C.hm)(new Date(t.out)):'on'}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,V.jsx)(f.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,$.hmDur)(d.paid):`${(0,$.hmDur)(d.worked)}\u2026`}),(0,V.jsx)(f.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?D.colours.ok:'open'===(0,s.attStatus)(t)?D.colours.blue:D.colours.amber,children:(0,x.statusLabel)(t)}),(0,V.jsx)(f.T,{size:11,style:{width:140},colour:h.length?D.colours.amber:D.colours.ok,children:h.join(', ')||'OK'}),(0,V.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${l?.name}`,onPress:()=>y(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,V.jsx)(f.T,{size:12,colour:D.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,V.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,V.jsx)(f.T,{size:12,style:{width:110},children:o.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,V.jsxs)(f.T,{size:12,style:{width:86},colour:D.colours.muted,children:[(0,$.fmtH)(t.start),"\u2013",(0,$.fmtH)(t.end)]}),(()=>{const s=(0,g.leaveCovering)(m,t.staffId,t.date);return s?(0,V.jsxs)(f.T,{size:12,colour:D.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,g.leaveLabel)(s)," (rota covered)"]}):(0,V.jsx)(f.T,{size:12,colour:b===n&&60*t.start>60*e.getHours()+e.getMinutes()?D.colours.muted:D.colours.red,children:b===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,V.jsx)(f.Muted,{children:"No shifts or clock records for this day."}),(0,V.jsx)(f.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,V.jsx)(f.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,V.jsx)(v.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,V.jsxs)(f.Muted,{children:[(0,C.niceDate)(new Date(e.at))," ",(0,C.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,V.jsx)(f.Muted,{children:"No manual changes yet."}),w?(0,V.jsx)(x.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>y(null)}):null,(0,V.jsxs)(f.Sheet,{visible:k,onClose:()=>I(!1),title:"Payroll export",children:[(0,V.jsxs)(f.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",Y?`${(0,$.hmDur)(Y)} still pending sign-off is left out.`:'']}),(0,V.jsxs)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[E.slice(0,14).map((e,t)=>(0,V.jsx)(f.T,{size:10,colour:t?D.colours.text:D.colours.gold,children:e},t)),E.length>14?(0,V.jsxs)(f.Muted,{children:["\u2026 ",E.length-14," more rows"]}):null]}),(0,V.jsxs)(f.Muted,{children:[E.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1063,[876,863,1052,1459,1276,1277,31,1045,1075,123,264,152,128,818,823,972,1472,1464,1090,1473,1102,5,1103,879,820,822,825,1078,1053,953,996,1294,869,870,1178,980,1412,1093,1094,1467,1469,1409,1100,978,1474,807,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return O}}),_e.allocate=D,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:v,role:P,meId:B,me:F}=(0,x.useCtx)(6e4),R=(0,u.useOwner)(e=>e.staff),N=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),A=(0,u.useOwner)(e=>e.shifts),L=(0,u.useOwner)(e=>e.tronc),z=(0,u.useOwner)(e=>e.troncCash),_=(0,u.useOwner)(e=>e.troncHistory),V=(0,u.useOwner)(e=>e.troncLog),U=(0,c.useOrders)(C),q=(0,j.useVenuePay)(C).pay,[H,W]=(0,i.useState)(-1),[Y,K]=(0,i.useState)(''),[G,Q]=(0,i.useState)(!1),[J,X]=(0,i.useState)(!1),[Z,ee]=(0,i.useState)(L.text),[te,se]=(0,i.useState)(null),oe='staff'!==P,ie='owner'===P,{s:ne,e:re,key:le}=(0,j.venueRange)(q,'tips',H,S),ae=`${(0,h.niceDate)(ne)} \u2013 ${(0,h.niceDate)(re)} ${re.getFullYear()}`,de=_.find(e=>e.key===le),ce=e=>u.useOwner.getState().setOwner({tronc:{...L,...e}}),ue=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),pe=Math.round((re.getTime()-ne.getTime())/864e5)+1,he=(0,i.useMemo)(()=>{let e=U.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(ne)&&e.createdAt.slice(0,10)<=(0,h.ymd)(re)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!ue)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[le,U.length,ue]),me=(0,T.useCashUp)(e=>e.cashUps),fe=Math.round(100*(0,k.cashUpTipsBetween)(me,C,(0,h.ymd)(ne),(0,h.ymd)(re))),ye=z[le]??0,ge=de?de.pot:he+fe+ye,xe=(0,i.useMemo)(()=>{const e={};for(let t=0;tv)break;const o=(0,h.ymd)(s);R.forEach(t=>{const s=N.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[le,N.length,A.length,R.length]),je=R.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&L.includeManagers||'owner'===e.role&&L.includeOwner)),be=(0,i.useMemo)(()=>{if(de)return de.rows;const e=je.map(e=>{const t=(xe[e.id]?.paid??0)/60,s=L.points[O(e)]??1;return'hours'===L.method?t:'points'===L.method?t*s:'equal'===L.method?t>0?1:0:L.custom[e.id]??0}),{amounts:t}=D(ge,e),s=e.reduce((e,t)=>e+t,0);return je.map((o,i)=>({staffId:o.id,hours:(xe[o.id]?.paid??0)/60,points:L.points[O(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[de,je.map(e=>e.id).join(),xe,L,ge]),we=be.reduce((e,t)=>e+t.amount,0),Te=de?0:(()=>{const e=be.map(e=>e.pct);return D(ge,e).remainder})(),Ce=Object.entries(L.custom).filter(([e])=>je.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),Se='custom'===L.method&&Math.abs(Ce-100)>.01,ke=new Date(re.getFullYear(),re.getMonth()+2,0),ve=[..._].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==_.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),Me=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(be.map(e=>{const t=R.find(t=>t.id===e.staffId);return`${I(t.name)},${O(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(we/100).toFixed(2)}`]);return oe?(0,M.jsxs)(l.default,{style:{gap:10},children:[(0,M.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,M.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,M.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>W(H-1)}),(0,M.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,M.jsx)(d.T,{weight:"semibold",children:ae}),de?(0,M.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${de.lockedAt}`}):H>=0?(0,M.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,M.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:H>=0,onPress:()=>W(H+1)})]}),(0,M.jsxs)(d.Card,{children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Card tips on orders"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.card:he)})]}),(0,M.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.cashUps??0:fe)})]})}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Other cash tips"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.cash:ye)})]}),de?null:(0,M.jsxs)(d.Row,{gap:6,children:[(0,M.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:Y,onChangeText:K,style:[d.styles.input,{flex:1}]}),(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(Y)>=0)||''===Y.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{...z,[le]:Math.round(100*Number(Y))}}),K('')}})]}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,M.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(ge)})]}),(0,M.jsx)(d.Muted,{children:ue?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),de?(0,M.jsxs)(d.Muted,{children:["Locked with method: ",$[de.method],"."]}):(0,M.jsxs)(d.Card,{children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,M.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys($).map(e=>(0,M.jsx)(d.Chip,{label:$[e],selected:L.method===e,onPress:()=>ie&&ce({method:e})},e))}),ie?null:(0,M.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===L.method?Object.entries(L.points).map(([e,t])=>(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:e}),(0,M.jsx)(d.Row,{gap:6,children:(0,M.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ie&&ce({points:{...L.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===L.method?(0,M.jsxs)(M.Fragment,{children:[je.map(e=>(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{style:{flex:1},children:I(e.name)}),(0,M.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(L.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ce({custom:{...L.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ce({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,M.jsxs)(d.T,{size:13,colour:Se?m.colours.red:m.colours.ok,children:["Total ",Ce.toFixed(1),"%",Se?' (must be 100%)':' \u2713']})]}):null,(0,M.jsx)(d.Toggle,{label:"Include managers",value:L.includeManagers,onChange:e=>ie&&ce({includeManagers:e})}),(0,M.jsx)(d.Toggle,{label:"Include owner",value:L.includeOwner,onChange:e=>ie&&ce({includeOwner:e})}),L.includeOwner?(0,M.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,M.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[be.map(e=>{const t=R.find(t=>t.id===e.staffId);return(0,M.jsxs)(d.Card,{children:[(0,M.jsxs)(d.T,{center:!0,weight:"semibold",children:[I(t?.name),xe[e.staffId]?.est&&!de?'*':'']}),(0,M.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,M.jsxs)(d.T,{center:!0,children:["Points: ",'points'===L.method||'points'===de?.method?e.points.toFixed(1):'\u2013']}),(0,M.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,M.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,M.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(we)]})]}):(0,M.jsx)(r.default,{horizontal:!0,children:(0,M.jsxs)(l.default,{children:[(0,M.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,M.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),be.map(e=>{const t=R.find(t=>t.id===e.staffId);return(0,M.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,M.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[I(t?.name),xe[e.staffId]?.est&&!de?'*':'']}),(0,M.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,M.jsx)(d.T,{size:13,style:{width:54},children:'points'===L.method||'points'===de?.method?e.points.toFixed(1):'\u2013'}),(0,M.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,M.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,M.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,M.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,M.jsx)(d.T,{size:13,weight:"bold",colour:we===ge?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(we)})]})]})}),(0,M.jsxs)(d.Muted,{children:[we===ge?`\u2713 Total equals the pot (${(0,p.gbp)(ge)}).`:'\u2717 Total does not equal the pot.',Te?` Rounding: ${Te}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),de?null:(0,M.jsx)(d.Button,{label:"Approve & lock period",disabled:!ie||H>=0||Se||we!==ge||ge<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${le}`,key:le,label:ae,end:(0,h.ymd)(re),pot:ge,card:he,cash:ye,cashUps:fe,method:L.method,rows:be,lockedAt:e,by:F};u.useOwner.getState().setOwner({troncHistory:[t,..._],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${F} approved & locked tips for ${ae}: ${(0,p.gbp)(ge)} split ${$[L.method].toLowerCase()} between ${be.filter(e=>e.amount>0).length} staff`},...V]})}}),!de&&H>=0?(0,M.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ie||de?null:(0,M.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,M.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>Q(!0)}),de?(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:de.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!de.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${ae} approved: ${(0,p.gbp)(de.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:_.map(e=>e.id===de.id?{...e,shared:(0,h.niceDate)(S)}:e)}),se('Posted to All staff chat.')}}):null]}),te?(0,M.jsx)(d.Banner,{kind:"info",title:te}):null,(0,M.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,M.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(ge)} = allocated ${(0,p.gbp)(we)}`],[L.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(ke)} ${ke.getFullYear()}`],[!0,'Tip records kept for 3 years',`${_.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${V.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,M.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,M.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,M.jsxs)(l.default,{style:{flex:1},children:[(0,M.jsx)(d.T,{size:14,children:t}),(0,M.jsx)(d.Muted,{children:s})]})]},String(t))),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{ee(L.text),X(!0)}})]}),(0,M.jsx)(y.SectionHead,{title:"Tip history & audit log"}),_.map(e=>(0,M.jsxs)(d.Card,{children:[(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{weight:"semibold",children:e.label}),(0,M.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,M.jsxs)(d.Muted,{children:[$[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),V.map(e=>(0,M.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),_.length||V.length?null:(0,M.jsx)(d.Muted,{children:"No approved periods yet."}),(0,M.jsxs)(d.Sheet,{visible:G,onClose:()=>Q(!1),title:"Tips summary export",children:[(0,M.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,M.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Me.map((e,t)=>(0,M.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,M.jsxs)(d.Muted,{children:[ae," \xb7 ",$[de?.method??L.method]]})]}),(0,M.jsxs)(d.Sheet,{visible:J,onClose:()=>X(!1),title:"Tipping policy",children:[(0,M.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ie,value:Z,onChangeText:ee,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ie?(0,M.jsx)(d.Button,{label:"Save policy",onPress:()=>{ce({text:Z}),X(!1)}}):null,(0,M.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,M.jsx)(E,{})},_e.useStaffTips=N,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=N(e,t);(0,i.useEffect)(()=>{if(!o.showToday||F()||P.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=N(e,t),r=`Tip pot this period, ${B(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${B(i)}`;return(0,M.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,M.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,M.jsx)(A,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,M.jsx)(A,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=E;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),v=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);const $={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},O=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',I=e=>(e??'').replace(' (example)','');function D(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const B=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function F(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const R={pot:186.4,today:48.5};function N(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,v.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||P.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),F()?{pot:R.pot,today:R.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function A({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${B(s)}`;return(0,M.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,M.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,M.jsx)(d.Muted,{center:!0,children:o}):(0,M.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:B(s)})]})}function E(e={}){const t=(0,x.useCtx)(6e4),s=N(t.rid,t.today);return(0,M.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,M.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,M.jsx)(A,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,M.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,M.jsx)(A,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1064,[876,874,842,31,264,152,128,288,818,823,863,820,822,825,1053,1078,953,1185,1091,824,1049,1047,13,1407,1184,2,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1065,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1066,[]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},1067,[31,197,123,264,128,818,996,1385,1225,825,1386,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1068,[874,31,264,128,818,825,829,5,986,807,824,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RELEASE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"nightlyEmailAllowed",{enumerable:!0,get:function(){return t}});const n={specialsSync:!0,nightlyEmail:!1,nightlyPush:!1,supportSync:!0,planPhoto:!0},t=(t,l)=>'anchorage'!==t&&l&&n.nightlyEmail},1069,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},1070,[812,18]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photosAllowed=function(){const t=a.useSync.getState();return'staff'!==t.kind||!t.venueId||'off'===t.mode||'local'===t.mode||t.perms.includes('*')},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600,n=.78){return new Promise((r,o)=>{const c=URL.createObjectURL(t),i=new Image;i.onload=()=>{const t=Math.min(1,a/Math.max(i.width,i.height)),o=document.createElement('canvas');o.width=Math.round(i.width*t),o.height=Math.round(i.height*t),o.getContext('2d').drawImage(i,0,0,o.width,o.height),URL.revokeObjectURL(c),r(o.toDataURL('image/jpeg',n))},i.onerror=()=>{URL.revokeObjectURL(c),o(new Error('not an image'))},i.src=c})}},1071,[123,872,824,1097]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_LOYALTY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"consentText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"prettyCardNo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"cleanCode",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"cardQr",{enumerable:!0,get:function(){return s}}),_e.readCardQr=function(e){const r=/^covercharge:card:[^:]+:([A-Za-z0-9-]{8,9})$/.exec(e.trim());return r?n(r[1]):null},Object.defineProperty(_e,"codeQr",{enumerable:!0,get:function(){return o}}),_e.checkSettings=function(e){return!Number.isInteger(e.stampsNeeded)||e.stampsNeeded<2||e.stampsNeeded>30?'Stamps needed must be between 2 and 30.':e.reward.trim()?e.reward.length>80?'Keep the reward under 80 letters.':e.gapMinutes<0||e.gapMinutes>1440?'Time between stamps must be 0 to 24 hours.':e.maxPerDay<1||e.maxPerDay>10?'Stamps a day must be 1 to 10.':!Number.isInteger(e.stampExpiryDays)||e.stampExpiryDays<0||e.stampExpiryDays>1095?'Stamps last 0 (never run out) to 1095 days.':!Number.isInteger(e.rewardExpiryDays)||e.rewardExpiryDays<0||e.rewardExpiryDays>1095?'Rewards last 0 (never run out) to 1095 days.':!e.referralOn||e.referralGiver.trim()&&e.referralFriend.trim()?e.referralMonthlyCap<0||e.referralMonthlyCap>50?'Friend rewards a month must be 0 to 50.':null:'Say what both people get before you switch Bring a friend on.':'Say what the reward is, for example Free dessert.'},_e.checkOffer=function(e){if(!e.title.trim())return'Give the offer a title.';if(e.title.length>80)return'Keep the title under 80 letters.';if(e.details.length>500)return'Keep the details under 500 letters.';const r=/^\d{4}-\d{2}-\d{2}$/;return e.startsOn&&!r.test(e.startsOn)?'Start date should look like 2026-11-30.':e.endsOn&&!r.test(e.endsOn)?'End date should look like 2026-11-30.':e.startsOn&&e.endsOn&&e.endsOn`I agree to ${e} keeping my name and the phone or email I give, only to run my stamp card and offers here. I can leave at any time and my details are removed.`,t=e=>e&&8===e.length?`${e.slice(0,4)}-${e.slice(4)}`:e,n=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,''),s=(e,r)=>`covercharge:card:${e}:${r}`;const o=(e,r,t)=>`${e.replace(/\/$/,'')}/customer/${r}/loyalty?code=${t}`;const l=(e,r)=>e.isOn&&(!e.startsOn||e.startsOn<=r)&&(!e.endsOn||e.endsOn>=r),p=r=>r?{saved:!!r.updated_by,cardOn:!!r.card_on,stampsNeeded:r.stamps_needed??8,reward:r.reward??'',stampExpiryDays:r.stamp_expiry_days??0,rewardExpiryDays:r.reward_expiry_days??0,gapMinutes:r.gap_minutes??60,maxPerDay:r.max_per_day??1,referralOn:!!r.referral_on,referralGiver:r.referral_giver??'',referralFriend:r.referral_friend??'',referralMonthlyCap:r.referral_monthly_cap??5}:{...e},u=e=>({card_on:e.cardOn,stamps_needed:e.stampsNeeded,reward:e.reward.trim(),stamp_expiry_days:e.stampExpiryDays,reward_expiry_days:e.rewardExpiryDays,gap_minutes:e.gapMinutes,max_per_day:e.maxPerDay,referral_on:e.referralOn,referral_giver:e.referralGiver.trim(),referral_friend:e.referralFriend.trim(),referral_monthly_cap:e.referralMonthlyCap}),y=e=>({id:String(e.id),title:e.title??'',details:e.details??'',startsOn:e.starts_on??null,endsOn:e.ends_on??null,isOn:!1!==e.is_on})},1072,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOP_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PAY_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"cleanGiftCode",{enumerable:!0,get:function(){return o}}),e.prettyGiftCode=function(t){const n=o(t);return 16===n.length?n.match(/.{4}/g).join('-'):n},e.poundsToPence=i,e.redeemKey=function(t=Math.random){const n='abcdefghijkmnpqrstuvwxyz23456789';let r='r-';for(let o=0;o<20;o++)r+=n[Math.floor(32*t())%32];return r},Object.defineProperty(e,"expiryWords",{enumerable:!0,get:function(){return c}}),e.amountsFromText=function(t){const n=t.split(/[,\s]+/).filter(Boolean).map(i);return!n.length||n.length>6||n.some(t=>null===t||t<100)?null:[...new Set(n)].sort((t,n)=>t-n)},e.basketTotal=function(t,n){return t.reduce((t,r)=>t+(n.find(t=>t.id===r.id)?.pricePence??0)*r.qty,0)},Object.defineProperty(e,"settingsFromRow",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"settingsToRow",{enumerable:!0,get:function(){return a}});const t={giftsOn:!1,shopOn:!1,expiryMonths:24,amounts:[2500,5e3,1e4],minPence:500,maxPence:25e3,terms:''},n='Gift cards are sold through your website. You can also pay at the bar or till.',r={'waiting-payment':'Waiting for payment at the till',active:'Ready to use',used:'Used up',expired:'Expired',void:'Cancelled',paid:'Paid',ready:'Ready to collect',collected:'Collected',cancelled:'Cancelled'},o=t=>(t??'').toUpperCase().replace(/[^A-Z0-9]/g,'');function i(t){const n=(t??'').trim().replace(/^\xa3/,'');return/^\d{1,4}(\.\d{1,2})?$/.test(n)?Math.round(100*Number(n)):null}const c=t=>t%12==0?`${t/12} year${12===t?'':'s'}`:`${t} months`;const s=n=>n?{giftsOn:!!n.gifts_on,shopOn:!!n.shop_on,expiryMonths:n.expiry_months??24,amounts:n.amounts??t.amounts,minPence:n.min_pence??500,maxPence:n.max_pence??25e3,terms:n.terms??''}:{...t},a=t=>({gifts_on:t.giftsOn,shop_on:t.shopOn,expiry_months:t.expiryMonths,amounts:t.amounts,min_pence:t.minPence,max_pence:t.maxPence,terms:t.terms})},1073,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shopPublic",{enumerable:!0,get:function(){return p}}),e.myShop=async function(t){return await(0,n.guestSession)()?(0,n.rpc)('guest_my_shop',{p_slug:t}):{cards:[],orders:[]}},e.buyGift=async function(t,o){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_gift_buy',{p_slug:t,p_amount:o.amount,p_recipient:o.recipient,p_from:o.from,p_message:o.message})},e.shopOrder=async function(t,o,c){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_shop_order',{p_slug:t,p_lines:o,p_name:c})},Object.defineProperty(e,"giftCheck",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"giftRedeem",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"giftActivate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"giftIssue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"giftHonourWix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"giftVoid",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"giftSummary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"shopStatus",{enumerable:!0,get:function(){return v}}),e.waitingCards=async function(){const{data:t,error:n}=await c().from('gift_cards').select('id,last4,ref,initial_pence,balance_pence,status,source,recipient_name,issued_at,expires_at').eq('venue_id',s()).order('issued_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.shopOrders=async function(){const{data:t,error:n}=await c().from('shop_orders').select('*').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.readShopSettings=async function(){const{data:t,error:n}=await c().from('shop_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return(0,o.settingsFromRow)(t)},e.saveShopSettings=async function(t){const{error:n}=await c().from('shop_settings').upsert({venue_id:s(),...(0,o.settingsToRow)(t),updated_by:u(),updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readProducts=async function(){const{data:t,error:n}=await c().from('shop_products').select('*').eq('venue_id',s()).order('sort').order('name');if(n)throw n;return t??[]},e.saveProduct=async function(t){const n={venue_id:s(),name:t.name.trim(),details:t.details.trim(),price_pence:t.pricePence,stock:t.stock,is_live:t.live,updated_by:u(),updated_at:(new Date).toISOString()},{error:o}=t.id?await c().from('shop_products').update(n).eq('id',t.id):await c().from('shop_products').insert(n);if(o)throw o},Object.defineProperty(e,"payPublic",{enumerable:!0,get:function(){return S}}),e.payStart=async function(t,o,s){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const u='undefined'!=typeof window?window.location.href.split('?')[0]:'',{data:p,error:_}=await c().functions.invoke('pay-checkout',{body:{slug:t,kind:o,target:s,successUrl:u,cancelUrl:u}});if(_||!p?.url)throw new Error(p?.error??'Card payment isn\u2019t available yet. Pay at the bar or till.');if(!/^https:\/\/checkout\.stripe\.com\//.test(p.url))throw new Error('Card payment isn\u2019t available yet. Pay at the bar or till.');return p},Object.defineProperty(e,"payStatus",{enumerable:!0,get:function(){return P}}),e.readPaySettings=async function(){const{data:t,error:n}=await c().from('payment_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return{provider:t?.provider??'none',cardOn:!!t?.card_on,account:t?.stripe_account_id??''}},Object.defineProperty(e,"savePaySettings",{enumerable:!0,get:function(){return O}}),e.recentPayments=async function(){const{data:t,error:n}=await c().from('payments').select('id,kind,amount_pence,status,provider,created_at,paid_at').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(20);if(n)throw n;return t??[]};var t=r(d[0]),n=r(d[1]),o=r(d[2]);const c=()=>(0,t.getSupabase)(),s=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},u=()=>(n.useSync.getState().staffRef??'').slice(0,80)||null,p=t=>(0,n.rpc)('shop_public',{p_slug:t});const _=t=>(0,n.rpc)('staff_gift_check',{p_venue:s(),p_code:t}),f=(t,o,c,u)=>(0,n.rpc)('staff_gift_redeem',{p_venue:s(),p_code:t,p_amount:o,p_key:c,p_by:u}),y=(t,o)=>(0,n.rpc)('staff_gift_activate',{p_card:t,p_by:o}),l=(t,o,c)=>(0,n.rpc)('staff_gift_issue',{p_venue:s(),p_amount:t,p_recipient:o,p_by:c}),b=(t,o,c)=>(0,n.rpc)('staff_gift_honour_wix',{p_venue:s(),p_code:t,p_balance:o,p_by:c}),w=(t,o,c)=>(0,n.rpc)('staff_gift_void',{p_card:t,p_reason:o,p_by:c}),h=()=>(0,n.rpc)('staff_gift_summary',{p_venue:s()}),v=(t,o,c,s)=>(0,n.rpc)('staff_shop_status',{p_order:t,p_status:o,p_reason:c,p_by:s});const S=async t=>{try{return await(0,n.rpc)('pay_public',{p_slug:t})}catch{return{provider:'none',cardOn:!1,testMode:!0}}};const P=t=>(0,n.rpc)('guest_pay_status',{p_payment:t});const O=t=>(0,n.rpc)('staff_payment_settings_save',{p_venue:s(),p_provider:t.provider,p_card_on:t.cardOn,p_account:t.account,p_by:u()})},1074,[872,824,1073]); +__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},1075,[1279,1268,1280]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.refreshCashAccess=r,e.setStaffCashUp=async function(o,c){const u=s.useSync.getState().venueId;if(!u)return{ok:!1,error:'Not connected. Try again when the app is online.'};const f=(0,t.getSupabase)();try{const{data:t}=await f.from('staff').select('id').eq('venue_id',u).eq('external_ref',o).maybeSingle();if(!t?.id)return{ok:!1,error:'This person isn\u2019t on the shared team list yet.'};const{error:s}=await f.rpc('set_staff_cash_up',{p_staff:t.id,p_on:c});return s?{ok:!1,error:/owner or manager/i.test(s.message)?'Only an owner or manager can change this.':'Could not save. Try again.'}:(n.useCashAccess.setState(t=>({byRef:{...t.byRef,[o]:c}})),r(),{ok:!0})}catch{return{ok:!1,error:'Could not save. Try again when the app is online.'}}};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]);async function r(){const r=s.useSync.getState().venueId;if(!r||'staff'!==s.useSync.getState().kind)return;const o=(0,t.getSupabase)();try{const[{data:t},{data:s},c]=await Promise.all([o.rpc('my_cash_up_access',{p_venue:r}),o.from('staff').select('external_ref, can_cash_up').eq('venue_id',r),o.rpc('my_cash_up_scope',{p_venue:r}).then(t=>t,()=>({data:null}))]),u=c?.data??null;u&&'boolean'==typeof u.takings&&n.useCashAccess.setState({takings:u.takings,tradingDate:'string'==typeof u.tradingDate?u.tradingDate:null,photos:!0===u.photos});const f={};if(Array.isArray(s))for(const t of s)t.external_ref&&(f[t.external_ref]=!!t.can_cash_up);n.useCashAccess.setState({mine:'boolean'==typeof t?t:n.useCashAccess.getState().mine,byRef:Array.isArray(s)?f:n.useCashAccess.getState().byRef,loaded:!0})}catch{}}},1076,[872,824,1048]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1077,[31,128,823,807,817,14,1421,825,818,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RID",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return d}}),_e.nextStatus=function(e){return'new'===e.status||'acknowledged'===e.status?{to:'preparing',label:'Start preparing'}:'preparing'===e.status?{to:'ready',label:'takeaway'===e.type?'Mark ready (notify customer)':'Mark ready'}:'ready'===e.status?'takeaway'===e.type?{to:'collected',label:'Collected'}:{to:'served',label:'Served'}:null},Object.defineProperty(_e,"LIVE",{enumerable:!0,get:function(){return u}}),_e.busyLevel=b,_e.restOfDayLevel=function(e,t){const r=e.hours.filter(t=>!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1078,[31,264,128,818,825,5,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return m}}),_e.BookingsDayNav=function({today:e,date:s,onDate:u,sub:c,count:y}){const[p,D]=(0,t.useState)(sb(e,6)?s:e),[w,h]=(0,t.useState)(!1),f=Array.from({length:7},(e,t)=>b(p,t)),j=e=>{u(e),f.includes(e)||D(e)},$=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':k(t);return(0,d.jsxs)(o.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,d.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${m(b(p,-7))}`,onPress:()=>{D(b(p,-7)),u(b(p,-7))}}),(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${m(b(p,7))}`,onPress:()=>{D(b(p,7)),u(b(p,7))}}),s!==e?(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${m(e)}`,onPress:()=>{D(e),u(e),h(!1)}}):null,(0,d.jsx)(n.Button,{small:!0,kind:"ghost",label:w?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>h(!0)})]}),(0,d.jsx)(l.AppDateCalendar,{visible:w,today:e,day:s,showBusy:!0,onDay:t=>{const s=t??e;j(s),D(s)},onClose:()=>h(!1),idPrefix:"bookings-cal"}),(0,d.jsx)(n.Row,{wrap:!0,gap:6,children:f.map(e=>(0,d.jsx)(n.Chip,{label:$(e),sub:c(e),selected:s===e,onPress:()=>u(e)},e))}),(0,d.jsx)(o.default,{testID:"bookings-day-title",children:(0,d.jsxs)(n.T,{size:17,weight:"semibold",colour:i.colours.goldLight,children:[m(s),sString(e).padStart(2,'0');function b(e,t){const[s,o,n]=e.split('-').map(Number),l=new Date(Date.UTC(s,o-1,n+t,12));return`${l.getUTCFullYear()}-${y(l.getUTCMonth()+1)}-${y(l.getUTCDate())}`}const p=e=>{const[t,s,o]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,o,12)).getUTCDay()+6)%7},m=e=>{const[t,s,o]=e.split('-').map(Number);return`${c[p(e)]} ${o} ${u[s-1]} ${t}`},k=e=>{const[,t,s]=e.split('-').map(Number);return`${c[p(e)].slice(0,3)} ${s} ${u[t-1].slice(0,3)}`}},1079,[31,128,818,1409,825,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1080,[31,818,823,826,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1081,[]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return n.useStore}}),_e.useNow=function(e=1e4){const r=(0,n.useStore)(e=>e.clock),[,u]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=setInterval(()=>u(e=>e+1),e);return()=>clearInterval(t)},[e]),(0,n.nowFrom)(r)},Object.defineProperty(_e,"useRestaurant",{enumerable:!0,get:function(){return a}}),_e.useRecipeCards=c,_e.useAllMenu=f,_e.useMenu=function(e){const r=f(e);return(0,t.useMemo)(()=>r.filter(e=>!e.hidden),[r])},Object.defineProperty(_e,"useCustomer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBasket",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useOrders",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"useOrderAtTable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useOrder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useBookings",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useWaitlist",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useEvents",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"useStampCard",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useGiftCards",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useRatings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"useAudit",{enumerable:!0,get:function(){return v}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),u=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]);_r(_d[7]);const a=e=>(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)),l=e=>(0,o.recipeCards)().subscribe(e),d=[];function c(e){return(0,t.useSyncExternalStore)(l,()=>e?(0,o.recipeCards)().list(e):d,()=>e?(0,o.recipeCards)().list(e):d)}function f(e){const u=(0,n.useStore)((0,r.useShallow)(t=>t.menu.filter(t=>t.restaurantId===e))),o=c(e);return(0,t.useMemo)(()=>(0,s.resolveMenu)(u),[u,o])}const b=()=>(0,n.useStore)(e=>e.customer),S=()=>(0,n.useStore)(e=>e.basket),g=(e,t)=>'table'!==t.type||(0,u.orderAtTableOn)(e.restaurants.find(e=>e.id===t.restaurantId)),m=e=>(0,n.useStore)((0,r.useShallow)(t=>t.orders.filter(r=>(!e||r.restaurantId===e)&&g(t,r)))),p=e=>(0,n.useStore)(t=>(0,u.orderAtTableOn)(t.restaurants.find(t=>t.id===e))),O=e=>(0,n.useStore)(t=>t.orders.find(t=>t.id===e)),y=e=>(0,n.useStore)((0,r.useShallow)(t=>e?t.bookings.filter(t=>t.restaurantId===e):t.bookings)),w=e=>(0,n.useStore)((0,r.useShallow)(t=>t.waitlist.filter(t=>t.restaurantId===e))),I=[],j=u=>{const s=(0,n.useStore)((0,r.useShallow)(e=>e.events.filter(e=>null===e.restaurantId||e.restaurantId===u))),o=(0,n.useStore)(e=>e.restaurants.find(e=>e.id===u)),a=o?(0,e.regularEventsOf)(o):I,l=(new Date).toISOString().slice(0,7);return(0,t.useMemo)(()=>{if(!u||!a.length)return s;const t=new Date,r=new Date(t.getFullYear(),t.getMonth()-2,1),n=new Date(t.getFullYear()+1,t.getMonth()+1,0),o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`;return[...s,...(0,e.expandEvents)(u,a,o(r),o(n))]},[s,a,u,l])},P=e=>(0,n.useStore)(t=>t.stampCards.find(r=>r.restaurantId===e&&r.customerId===t.customer.id)),h=e=>(0,n.useStore)((0,r.useShallow)(t=>t.giftCards.filter(r=>(!e||r.restaurantId===e)&&r.ownerId===t.customer.id))),M=e=>(0,n.useStore)((0,r.useShallow)(t=>t.ratings.filter(t=>t.restaurantId===e))),v=e=>(0,n.useStore)((0,r.useShallow)(t=>t.audit.filter(t=>t.restaurantId===e)))},1082,[814,31,884,881,1350,1188,839,1168]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"METHOD_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY3",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAYS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"wd",{enumerable:!0,get:function(){return i}}),e.dayRange=function(t){const n=[...new Set(t)].sort((t,n)=>t-n);if(!n.length)return'';if(7===n.length)return'every day';return n.every((t,o)=>o===0||t===n[o-1]+1)&&n.length>=3?`${o[n[0]]} to ${o[n[n.length-1]]}`:n.map(t=>o[t]).join(', ')},e.nextDelivery=a,Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return d}}),e.remindersFor=function(t,n,o={}){const d=i(n);return t.filter(t=>t.orderDays.includes(d)).flatMap(t=>{if(o[t.id]&&new Date(o[t.id]).toDateString()===n.toDateString())return[];let d=!1;if(/^\d\d:\d\d$/.test(t.cutoff)){const[o,s]=t.cutoff.split(':').map(Number),i=new Date(n);i.setHours(o,s,0,0),d=n>i}const l=a(t,n),c=t.reminder||`Order ${t.name} today${l?` for ${s[i(l)]}`:''}`;return[{supplierId:t.id,name:t.name,text:`${c}${t.cutoff?d?` (cut-off ${t.cutoff} passed)`:` by ${t.cutoff}`:''}`,tone:d?'red':'amber',cutoffPassed:d}]})},e.orderLines=function(n,o,s,i=""){const a=n.items.filter(t=>(o[t.id]??0)>0).map(n=>`${(0,t.fishInStone)(i,n)?(0,t.fishQtyText)(i,n,o[n.id]):`${l(o[n.id])} ${n.unit}`} ${n.name}`.replace(/\s+/g,' ').trim());return s.split('\n').map(t=>t.trim()).filter(Boolean).forEach(t=>a.push(t)),a},e.orderMessage=function(t,n,o,s,i,l){const c=a(t,l);return[`Hi ${t.contact||t.name.split(' (')[0]}, order from ${n}${o?`, ${o}`:''}${c?` for ${d(c)}`:''}:`,...s.map(t=>`- ${t}`),'',`Thanks, ${i}`].join('\n')},e.intlDigits=c,Object.defineProperty(e,"smsLink",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"waLink",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"telLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"sid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_SHEETS",{enumerable:!0,get:function(){return k}});var t=r(_d[0]);const n={online:'Online',phone:'Phone',text:'Text message',whatsapp:'WhatsApp',tbc:'To be decided'},o=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],s=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],i=t=>(t.getDay()+6)%7;function a(t,n){const o=null!=t.deliversOn?[t.deliversOn]:t.deliveryDays;if(!o.length)return null;for(let t=1;t<=7;t++){const s=new Date(n);if(s.setDate(s.getDate()+t),o.includes(i(s)))return s}return null}const d=t=>t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});const l=t=>Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,'');function c(t){const n=t.replace(/[^\d+]/g,'').replace(/^\+/,'');return n.startsWith('00')?n.slice(2):n.startsWith('0')?`44${n.slice(1)}`:n}const u=(t,n)=>`sms:${t.replace(/[^\d+]/g,'')}?&body=${encodeURIComponent(n)}`,m=(t,n)=>`https://wa.me/${c(t)}?text=${encodeURIComponent(n)}`,f=t=>`tel:${t.replace(/[^\d+]/g,'')}`;let p=0;const h=(t="os")=>`${t}-${Date.now().toString(36)}${(p++).toString(36)}`,y=(t,n,o)=>({id:t,name:n,unit:o}),b=t=>({number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:'',...t}),k=[b({id:'os-reids',name:'Reids',goods:'Dry goods and frozen',method:'online',urlLabel:'Open Coldweb',deliveryDays:[0,1,2,3,4],frequency:'Order on Coldweb',items:[y('rd-chips','Frozen chips','boxes'),y('rd-oil','Fryer oil','tubs'),y('rd-flour','Flour','bags'),y('rd-rice','Rice','bags'),y('rd-peas','Frozen peas','bags')],notes:'Order on their Coldweb ordering site. Add the Coldweb link in Managers \u203a Settings \u203a Supplier order sheets, or here.'}),b({id:'os-veg',name:'Veg',goods:'Fruit and veg (supplier to be added)',method:'tbc',placeholder:!0,frequency:'To be added by Gordon',notes:'Placeholder: Gordon will add the veg supplier, how to order and delivery days.'}),b({id:'os-peroni',name:'J. Pieroni & Sons',goods:'Seafood (fish merchant, Ayr)',method:'phone',url:'https://pieronis.com',urlLabel:'Open pieronis.com',deliveryDays:[0,1,2,3,4,5],frequency:'Phone order',items:[y('pa-haddock','Haddock fillets','kg'),y('pa-mussels','Mussels','kg'),y('pa-scallops','Scallops','kg'),y('pa-salmon','Salmon','kg')],notes:'Phone order. Press Call, then read the order from the screen.'}),b({id:'os-spesbona',name:'Spes Bona',goods:'Langoustines and smoked haddock',method:'text',orderDays:[2],deliversOn:4,deliveryDays:[4],frequency:'Text on Wednesday for Friday',reminder:'Text Spes Bona today for Friday\u2019s langoustines and smoked haddock',items:[y('sb-langs','Langoustines','kg'),y('sb-smoked','Smoked haddock','kg')]}),b({id:'os-tarelgin',name:'Tarelgin',goods:'Butcher',method:'text',frequency:'Text order',items:[y('tg-steak','Ribeye steaks',''),y('tg-mince','Steak mince','kg'),y('tg-chicken','Chicken breasts',''),y('tg-sausage','Sausages','kg')]}),b({id:'os-mills',name:'Mills',goods:'Milk',method:'whatsapp',frequency:'WhatsApp message',items:[y('ml-milk','Milk','litres'),y('ml-cream','Double cream','litres'),y('ml-butter','Butter','kg')]}),b({id:'os-kittyfisher',name:'Kittyfisher boat (Big Sean)',goods:'Lobsters and crabs',method:'text',contact:'Sean',frequency:'Whenever stock is low',shellfish:!0,items:[y('kf-lobster','Lobsters',''),y('kf-crab','Crabs','')],notes:'Text Big Sean whenever the lobster or crab count runs low.'}),b({id:'os-lionsmane',name:'Lion\u2019s mane mushroom',goods:'Lion\u2019s mane mushrooms',method:'online',urlLabel:'Open seller',frequency:'Weekly or fortnightly',priceCapPerKg:2500,seller:'Cheapest UK seller (to be chosen)',items:[y('lm-kg','Lion\u2019s mane mushroom','kg')],notes:'Order online from the cheapest UK seller under the price cap. Check the price per kg before you buy.'})]},1083,[1086]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1084,[1533,1099,812,31,119,257,264,152,128,823,828,829,1534,822,825,1043,818,1535,981,824,936,25]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isAnchorage",{enumerable:!0,get:function(){return r}}),e.isBarFridge=n,Object.defineProperty(e,"chefCanSee",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"demoActor",{enumerable:!0,get:function(){return s}}),e.hasRealSignature=c,Object.defineProperty(e,"PLACEHOLDER_AUTHOR",{enumerable:!0,get:function(){return f}}),e.isPlaceholderCard=u,e.isDemoCard=function(t){return!c(t)&&(['example','sample','demo'].includes(t.origin||'')||s(t.updatedBy)||u(t))},Object.defineProperty(e,"isSeedChefChat",{enumerable:!0,get:function(){return m}});const t='6349aa07-3fec-46e9-8c69-7b1b08494793',r=r=>'anchorage'===r||r===t;function n(t){if('string'==typeof t)return/\bbar[\s_-]*(?:fridge|refrigerat)|\b(?:fridge|refrigerator)[\s_-]*(?:in[\s_-]*the[\s_-]*)?bar\b|^cp-bar$/i.test(t);if(!t||'object'!=typeof t)return!1;const r=t;if(n(['name','label','kind','unit','location','storage','storageLocation'].map(t=>r[t]).filter(t=>'string'==typeof t).join(' ')))return!0;return(['name','label'].some(t=>'string'==typeof r[t]&&''!==r[t].trim())?[]:['id','key','pointId']).concat(['name','label','unit','location','storage','storageLocation','aliases']).some(t=>Array.isArray(r[t])?r[t].some(n):'string'==typeof r[t]&&n(r[t]))}const o=(t,o)=>!r(t)||!n(o),s=t=>'string'==typeof t&&/(?:\b(?:example|sample|demo)\b)/i.test(t);function c(t){return[t.signOff?.by,t.allergensConfirmed?.by].some(t=>!!t&&!s(t))}const f='CoverCharge, for Head Chef sign-off';function u(t){return!c(t)&&(t.updatedBy||'').startsWith('CoverCharge')&&(!t.createdBy||t.createdBy.startsWith('CoverCharge'))}const l={'m-seed-all':'Welcome to the team chat on CoverCharge.','m-seed-kitchen':'Kitchen channel: Head Chef, kitchen team and managers.','m-seed-foh':'Front of house channel: front of house, bar and managers.','m-seed-managers':'Managers channel: owners, managers and the supervisor only.'},m=t=>'system'===t.from&&(!!l[t.id]&&l[t.id]===t.text||'m-seed-all'===t.id&&/this phone only/.test(t.text||''))},1085,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KG_PER_STONE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"HALF_STONE_KG",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isFishName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fishInStone",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"halfStone",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toStone",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"fromStone",{enumerable:!0,get:function(){return c}}),e.stoneText=b,e.stoneSpeech=h,Object.defineProperty(e,"fishQtyText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"fishQtySpeech",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantityStep",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"stepQuantity",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"inputQuantity",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"quantityUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"displayedCost",{enumerable:!0,get:function(){return k}}),e.parseStoneAmount=function(t){if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.toLowerCase().trim();if(/\b(?:kg|kilos?|kilograms?|grams?)\b/.test(n))return;const i=n.match(/(?:^|\s)(\d+(?:[.,]\d+)?)(\xbd)?(?:\s*(?:stone|st)\b|$)/);if(i)return Number(i[1].replace(',','.'))+(i[2]?.5:0);const o=n.match(/\b(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)(?: and a half)?(?: stone| st|$)/);return o?l.indexOf(o[1])+(/and a half/.test(o[0])?.5:0):/(?:^|\s)(?:\xbd|(?:a )?half(?: a)?)(?: stone| st|$)/.test(n)?.5:void 0};var t=r(d[0]);const n=6.35029318,i=3.17514659,o=(t="")=>!/\b(?:vegan|vegetarian|banana|blossom|mushroom|sauce|stock|oil)\b|\(vg\)/i.test(t)&&/\b(?:fish|haddock|salmon|cod|hake|halibut|plaice|sole|turbot|trout|mackerel|monkfish|seabass|sea bass|seabream|sea bream|tuna|pollock|coley|whiting|sardines?|anchov(?:y|ies)|herring)\b/i.test(t),u=(n,i)=>(0,t.isAnchorage)(n)&&/^(kg|kilos?|kilograms?|st|stone)$/i.test(i.unit||'')&&o(i.name),s=t=>Math.round(2*(t+Number.EPSILON))/2,f=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t/n,c=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t*n;function b(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'\u2212':''}${n%1?`${i||''}\xbd`:i} stone`}const l=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'];function h(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'minus ':''}${n%1?i?`${l[i]||i} and a half`:'half a':l[i]||i} stone`}const y=(t,n,i)=>u(t,n)?b(f(i,n.unit)):`${i} ${n.unit||''}`.trim(),p=(t,n,i)=>u(t,n)?h(f(i,n.unit)):y(t,n,i),O=(t,n)=>u(t,n)?c(.5,n.unit):'kg'===n.unit?.5:1,v=(t,n,i,o)=>u(t,n)?c(Math.max(0,s(f(i,n.unit))+.5*o),n.unit):Math.max(0,i+o*O(t,n)),P=(t,n,i)=>u(t,n)?c(s(i),n.unit):i,j=(t,n)=>u(t,n)?'stone':n.unit||'',k=(t,n,i)=>u(t,n)?i*c(1,n.unit):i},1086,[1085]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShellStore",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"localShellfish",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"shellfish",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"useStockItems",{enumerable:!0,get:function(){return O}}),_e.venueCounts=w,_e.useShellfish=function(e,t,s,o){const a=O(e,!1,o).filter(t=>'chef'!==s||(0,n.chefCanSee)(e,t)),d=_(t=>!!t.server[e]),u=_((0,l.useShallow)(t=>{const s=t.items[e]??[],n=new Set(s.filter(e=>o?e.group!==o:!!e.group).map(e=>e.key));return t.events.filter(s=>s.rid===e&&(!t.server[e]||I(s))&&!n.has(s.kind))})),c=_((0,l.useShallow)(t=>w(t,e))),p=(0,f.lastUndoable)(u),v=e=>a.find(t=>t.key===e);return{items:a,events:u,counts:c,undoable:p,synced:d,itemOf:v,isLow:e=>(0,f.isLowItem)(v(e),c[e]??0),sell:(n,o=!1)=>{const a=v(n),d=a&&(0,i.fishInStone)(e,a)?i.HALF_STONE_KG:o?.5:1;return!((c[n]??0){i>0&&E.append({rid:e,kind:n,delta:i,reason:'delivery',by:t,app:s})},recount:(n,i)=>{const o=i-(c[n]??0);o&&E.append({rid:e,kind:n,delta:o,reason:'count',by:t,app:s})},undoLast:()=>{p&&E.append({rid:e,kind:p.kind,delta:-p.delta,reason:'undo',by:t,app:s,undoes:p.id})}}};var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),i=r(_d[3]),o=r(_d[4]),a=r(_d[5]),d=(e=a)&&e.__esModule?e:{default:e};r(_d[6]);var u=r(_d[7]),c=r(_d[8]),l=r(_d[9]),f=r(_d[10]),p=r(_d[11]),v=r(_d[12]);const S=()=>{try{return(0,v.nowFrom)(v.useStore.getState().clock)}catch{return new Date}},h='covercharge-shellfish-v1',y='anchorage',_=(0,u.create)()((0,c.persist)(e=>({events:[],items:o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))},server:{},saveItem:(t,s)=>e(e=>{const n=e.items[t]??[];return{items:{...e.items,[t]:n.some(e=>e.key===s.key)?n.map(e=>e.key===s.key?s:e):[...n,s]}}}),removeItem:(t,s)=>e(e=>({items:{...e.items,[t]:(e.items[t]??[]).filter(e=>e.key!==s)}}))}),{name:h,storage:(0,c.createJSONStorage)(()=>d.default),version:4,partialize:e=>({events:e.events,items:e.items,server:e.server}),migrate:async e=>{t.LIVE_VENUE_BUILD&&e&&await(0,s.archiveChefCache)('tracked-stock',e);const n=e??{};return{events:(i=n.events,(i??[]).filter(e=>!e.id.startsWith('sf-seed-'))),items:n.items??(o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))}),server:n.server??{}};var i}})),b={list:e=>_.getState().events.filter(t=>t.rid===e),append:e=>{const t={...e,id:(0,p.uuid)(),at:e.at??S().toISOString()};return _.setState(e=>({events:[t,...e.events].slice(0,500)})),t},subscribe:e=>_.subscribe(e)},E=b;'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===h&&_.persist.rehydrate()});const k=[],O=(e,t=!1,s)=>{const n=_(t=>t.items[e])??k;return t?n:n.filter(e=>e.active&&(s?e.group===s:!e.group)).sort((e,t)=>e.sort-t.sort)},I=e=>!e.id.startsWith('sf-');function w(e,t){const s=e.items[t]??[],n=e.server[t],i=e.events.filter(e=>e.rid===t);if(!n)return(0,f.countsOf)(i,s);const o=new Set(n.seen),a=new Date(Date.now()-2592e5).toISOString();return(0,f.countsOf)(i.filter(e=>I(e)&&!o.has(e.id)&&e.at>=a),s,n.counts)}},1087,[842,1198,1085,1086,5,1190,123,995,1191,884,1089,1099,881]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOrderSheets",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useSheets",{enumerable:!0,get:function(){return f}});var e,s=r(d[0]),t=r(d[1]),h=r(d[2]),n=r(d[3]),o=(e=n)&&e.__esModule?e:{default:e},c=r(d[4]),i=r(d[5]),u=r(d[6]);const p=()=>h.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{}:{anchorage:u.ANCHORAGE_SHEETS.filter(e=>!e.placeholder).map(e=>({...e,items:e.items.map(e=>({...e}))}))},l=(0,c.create)()((0,i.persist)(e=>({sheets:p(),opened:{},upsert:(s,t)=>e(e=>{const h=e.sheets[s]??[];return{sheets:{...e.sheets,[s]:h.some(e=>e.id===t.id)?h.map(e=>e.id===t.id?t:e):[...h,t]}}}),patch:(s,t,h)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).map(e=>e.id===t?{...e,...h}:e)}})),remove:(s,t)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).filter(e=>e.id!==t)}})),markOpened:(s,t)=>e(e=>({opened:{...e.opened,[s]:t}})),reset:s=>e(e=>({sheets:{...e.sheets,[s]:'anchorage'===s&&p().anchorage||[]}}))}),{name:'covercharge-ordersheets-v1',storage:(0,i.createJSONStorage)(()=>o.default),version:3,migrate:async e=>{const h=e;return s.LIVE_VENUE_BUILD?(await(0,t.archiveChefCache)('order-sheets',h),{...h,sheets:{...h.sheets,anchorage:(h.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}}):h}})),_=[],f=e=>l(s=>s.sheets[e])??_},1088,[842,1198,5,1190,995,1191,1083]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANCHORAGE_STOCK",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"stockKey",{enumerable:!0,get:function(){return n}}),_e.countsOf=function(e,t=[],n={}){const u={...n};for(const e of t)u[e.key]=u[e.key]??0;for(const t of e)u[t.kind]=(u[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(u).map(([e,t])=>[e,o(i.get(e),t)]))},_e.lastUndoable=function(e){const t=new Set(e.filter(e=>e.undoes).map(e=>e.undoes));return e.find(e=>'undo'!==e.reason&&'count'!==e.reason&&!t.has(e.id))},Object.defineProperty(_e,"fmtCount",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isLowItem",{enumerable:!0,get:function(){return c}}),_e.describe=function(e,t){const n=(t?.name??e.kind).toLowerCase(),o=(t?.plural??`${e.kind}s`).toLowerCase(),s=t?i(e.rid,t,Math.abs(e.delta)):u(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${s} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${s} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${s} ${n})`:`Count: ${s} ${o}`},Object.defineProperty(_e,"isRoastItem",{enumerable:!0,get:function(){return l}}),_e.isSundayIn=function(e,t="Europe/London"){try{return'Sun'===new Intl.DateTimeFormat('en-GB',{weekday:'short',timeZone:t}).format(e)}catch{return 0===e.getDay()}};var e=r(_d[0]);const t=[{key:'lobster',name:'Lobster',plural:'Lobsters',unit:'half',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd9e',sort:1,active:!0},{key:'crab',name:'Crab',plural:'Crabs',unit:'whole',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd80',sort:2,active:!0}],n=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,40)||'item',o=(e,t)=>Math.max(0,'kg'===e?.unit?t:'half'===e?.unit?Math.round(2*t)/2:Math.round(t));const u=e=>{const t=Math.floor(e);return e-t>=.5?t?`${t}\xbd`:'\xbd':String(t)},i=(t,n,o)=>'kg'===n.unit?(0,e.fishQtyText)(t,n,o):u(o),s=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):u(o),c=(e,t)=>t<=(e?.lowAt??4);const l=e=>'roast'===e.group},1089,[1086]); +__d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.useGameClock=I,_e.usePlayable=function(e,t){return(0,y.gamePlayable)(I(e,t))},Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return C}}),_e.gameBase=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return C(e?.settings?.gameUrl)??v},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,b.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=I(e,s),u=(0,y.gamePlayable)(c);return n?(0,w.jsxs)(d.Card,{children:[(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(d.T,{size:13,colour:u?x.colours.ok:x.colours.muted,children:u?'Open':'Locked'})]}),(0,w.jsx)(d.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),u?null:(0,w.jsx)(d.Muted,{testID:"break-room-locked-text",children:y.GAME_LOCKED_TEXT}),(0,w.jsx)(d.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,w.jsx)(R,{staffId:e,name:t,playable:u,clock:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return T}}),_e.BreakRoom=R;var t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),n=e(r),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),c=e(_r(_d[6])),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),m=_r(_d[10]),y=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),p=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]),x=_r(_d[17]),w=_r(_d[18]);function I(e,t){const s=(0,m.useOwner)(e=>e.attendance);return(0,y.gameClock)(s,e,t)}const v='https://lennys-kitchen-chaos-13e285.deed.page/',C=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function S(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const T=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:I,playable:R,clock:P,onClose:L,car:M}){const D=(0,m.useOwner)(e=>e.staff),O=(0,f.useAvatars)(e=>e.photos),_=(0,h.useSetup)(e=>e.looks),z=(0,r.useRef)(null),[N,U]=(0,r.useState)({}),[A,B]=(0,r.useState)(!1),[G,q]=(0,r.useState)(null),H=(0,b.useStore)(e=>C(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??v),V=(0,r.useMemo)(()=>S(H),[H]),W=V?.origin??'',$=(0,j.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),K=!(!$||!e||$===e),X=K?null:$??e??null,Y=T(I),[F,J]=(0,r.useState)(''),[Q,Z]=(0,r.useState)(null),ee=(0,r.useRef)(null),te=(0,r.useRef)(0),se=(0,r.useRef)(null),re=(0,r.useRef)(R);re.current=R;const ne=(0,r.useMemo)(()=>D.filter(e=>e.active&&!e.name.includes('(example)')),[D]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const s of ne){const r=null!=_[s.id]&&_[s.id]>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===_[s.id]):void 0;if(r){e[s.id]=r.dataUrl;continue}const n=document.getElementById(`cc-av-${s.id}`)?.querySelector('svg');n&&(e[s.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n.outerHTML.includes('xmlns')?n.outerHTML:n.outerHTML.replace('clearTimeout(e)},[ne,_]);const oe=(0,r.useMemo)(()=>ne.map(e=>{const t=O[e.id]?.dataUrl??N[e.id],s={id:e.id,name:T(e.name),role:e.job||e.level||e.role};return t&&(s.avatarUrl=t),s}),[ne,O,N]),le=(0,r.useCallback)(e=>{try{W&&z.current?.contentWindow?.postMessage(e,W)}catch{}},[W]);return(0,r.useEffect)(()=>{const e=async e=>{if(!W||e.origin!==W||e.source!==z.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return q('string'==typeof t.version?String(t.version).slice(0,12):null),void B(!0);const s=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.listScores)(s,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!X||'string'==typeof e.staffId&&e.staffId!==X)return void le({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,k.listScores)(s,10),id:null}});const r='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.submitScore)(s,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:r,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:X,name:Y})})}'lenny:roundAbandoned'===t.type&&J('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&J(''),'lenny:progress'===t.type&&X&&t.staffId===X&&(0,k.saveProgress)(X,t.progress),'lenny:gameComplete'===t.type&&X&&t.staffId===X&&J(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[le,X,Y,W]),(0,r.useEffect)(()=>{B(!1),ee.current=null,se.current=null},[V?.src]),(0,r.useEffect)(()=>{if(!A)return;const e=e=>{se.current!==e&&(se.current=e,le({type:'lenny:setPlayable',playable:e}))},t=K?null:`${X??''}|${Y}`;if(t&&ee.current===t)return void e(R);const s=++te.current;ee.current=null,se.current&&e(!1),t&&(0,k.loadProgress)(X).catch(()=>null).then(r=>{s===te.current&&(le({type:'lenny:setPlayer',name:Y,staffId:X,...r?{progress:r}:{}}),ee.current=t,e(re.current))})},[A,K,X,Y,R,le]),(0,r.useEffect)(()=>{A&&le({type:'lenny:setRoster',staff:oe})},[A,oe,le]),(0,r.useEffect)(()=>{A&&null!==Q&&le({type:'lenny:setMuted',muted:Q})},[A,Q,le]),(0,w.jsx)(o.default,{visible:!0,animationType:"slide",onRequestClose:L,children:(0,w.jsxs)(c.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,s.soutersSurface)('#000')},children:[M?(0,w.jsx)(E,{status:K?'Switching player\u2026':R?'Parked only \xb7 enjoy!':'Game locked',muted:!!Q,onPause:()=>le({type:'lenny:pause'}),onMute:()=>Z(!Q),onClose:L}):(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:x.colours.bg},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(c.default,{testID:R&&!K?'break-playable':'break-locked',accessibilityLabel:G?`Game version ${G}`:void 0,children:(0,w.jsx)(d.T,{size:13,colour:R?x.colours.ok:x.colours.gold,children:K?'Switching player\u2026':R?'off'===P?'Off shift: enjoy!':'On your break: enjoy!':'Game locked'})}),(0,w.jsxs)(d.Row,{gap:4,children:[(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:Q?'Turn sound and voice on':'Mute sound and voice',onPress:()=>Z(!Q),style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:Q?'Sound on':'Mute'})}),(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",onPress:L,style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:"Close"})})]})]}),R||K?null:(0,w.jsx)(c.default,{testID:"break-locked-text",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.text,children:y.GAME_LOCKED_TEXT})}),F?(0,w.jsx)(c.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.muted,children:F})}):null,V?n.default.createElement('iframe',{ref:z,src:V.src,key:V.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,w.jsx)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(d.Muted,{children:"The Break room opens in the web app."})}),(0,w.jsx)(c.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:ne.map(e=>(0,w.jsx)(c.default,{nativeID:`cc-av-${e.id}`,children:(0,w.jsx)(u.AvatarLook,{look:_[e.id],id:e.id,name:e.name,size:96})},e.id))})]})})}function E({status:e,muted:t,onPause:s,onMute:r,onClose:n}){const o={minHeight:72,minWidth:150,paddingHorizontal:22,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'};return(0,w.jsxs)(c.default,{testID:"car-game-bar",style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:16,paddingVertical:10,backgroundColor:x.colours.bg,borderBottomWidth:1,borderColor:x.colours.border},children:[(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",accessibilityLabel:"Close the game",onPress:n,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Close"})}),(0,w.jsx)(l.default,{testID:"car-game-pause",accessibilityRole:"button",accessibilityLabel:"Pause the game",onPress:s,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Pause"})}),(0,w.jsxs)(c.default,{style:{flex:1,alignItems:'center',minWidth:0},children:[(0,w.jsx)(d.T,{size:22,weight:"semibold",center:!0,numberOfLines:1,children:"Lenny\u2019s Kitchen Chaos"}),(0,w.jsx)(d.T,{size:15,colour:x.colours.goldLight,center:!0,numberOfLines:1,children:`${e} \xb7 touch the big buttons on the game`})]}),(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:t?'Turn sound and voice on':'Mute sound and voice',onPress:r,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:t?'Sound on':'Mute'})}),(0,w.jsx)(c.default,{testID:"car-game-parked",style:{...o,minWidth:0,borderColor:x.colours.goldMuted,backgroundColor:'rgba(201,162,74,0.12)'},children:(0,w.jsx)(d.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:"PARKED ONLY"})})]})}},1090,[1384,876,31,257,123,264,128,996,818,1225,863,1451,1096,881,5,1452,824,825,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hash",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return r}}),_e.revenueHistory=function(e,t,r=28){const s=[];if(!(0,a.examplesAllowed)())return s;for(let a=r;a>=1;a--){const r=(0,o.addMins)(t,1440*-a),i=!!e.kitchenHours[r.getDay()],d=[1.05,0,0,.6,.7,1,1.2][r.getDay()]*('anchorage'===e.id?1:.6),l=t=>.85+.3*n((0,o.ymd)(r)+t+e.id),u=i?Math.round(24e4*d*l('d')):0,c=i?Math.round(95e3*d*l('t')):0,p=i?Math.round(52e3*d*l('q')):0;s.push({date:r,label:(0,o.niceDate)(r).slice(0,6),byChannel:{'Dine-in':u,Takeaway:c,'Table QR':p},total:u+c+p,covers:i?Math.round(150*d*l('c')):0})}return s},_e.dishStats=function(e){return(0,a.examplesAllowed)()?e.filter(e=>null!=e.price).map(e=>{const t=Math.round(20+260*n(e.id+'s')),o=.24+.22*n(e.id+'c'),a=e.price??0,r=Math.round(a*(1-o));return{item:e,sold:t,revenue:t*a,costPct:o,margin:r,gp:r*t}}):[]},_e.quadrant=function(e,t,o,a){return e>=o?t>=a?'Star':'Plough horse':t>=a?'Puzzle':'Dog'},Object.defineProperty(_e,"QUADRANT_TIP",{enumerable:!0,get:function(){return s}}),_e.crmCustomers=function(){return(0,a.examplesAllowed)()?i.map((e,t)=>{const o=n(e+t);return{id:0===t?'cust-demo':`cr-${t}`,name:`${e} ${d[t]}${0===t?'':' (example)'}`,phone:`07700 900${String(100+7*t).slice(-3)}`,visits:1+Math.round(18*o),lastVisit:`${1+Math.round(27*o)} days ago`,spend:Math.round(3e3+6e4*o),allergies:0===t?['Crustaceans (anaphylaxis)','Mustard']:o>.8?['Gluten (coeliac)']:o<.1?['Peanuts']:[],stamps:0===t?5:Math.round(7*o),optIn:o>.25,channel:r[Math.floor(3*o)%3],birthday:o>.6?`${1+Math.round(27*o)} Nov`:void 0}}):[]},Object.defineProperty(_e,"STOCK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"stockList",{enumerable:!0,get:function(){return u}}),_e.insights=function(e,n,r,s,i,d,u){const p=[];if(!(0,a.examplesAllowed)())return c(e,n,r,s,i,d,u);const h=new Date(d);h.setDate(h.getDate()+((6-h.getDay()+7)%7||7)),h.setHours(0,0,0,0);const b=(0,t.forecastToday)(e,n,r,s,h),m=Math.round(b.restOfDay.covers/Math.max(1,b.multiplier)),y=Math.max(35,Math.round(100*(b.multiplier-1))+35);p.push({id:'sat',icon:'\ud83d\udcc8',tone:'gold',title:`${(0,o.niceDate)(h)} forecast +${y}%: add 1 server 6\u20139pm`,body:`Example: about ${Math.round(m*(1+y/100))} covers expected vs about ${m} on a usual Saturday (bookings pace + Halloween weekend flag).`,action:{label:'Open rota',tab:'more',sub:'rota'}});const f=(0,t.forecastToday)(e,n,r,s,d),v=l[0],w=Math.ceil((f.restOfDay.covers+2*f.restOfDay.takeaway)*v.perCover);p.push({id:'haddock',icon:'\ud83d\udc1f',tone:'red',title:`Haddock low: ${v.onHand} portions left`,body:`Tonight\u2019s forecast needs about ${w}. Call the supplier before 18:00 or mark the fish supper sold out at ${v.onHand} sold.`,action:{label:'Prep list',tab:'more',sub:'prep'}});const k=s.find(e=>/Burns/.test(e.title));if(k){const e=Math.max(1,Math.round((new Date(k.date).getTime()-d.getTime())/6048e5));p.push({id:'burns',icon:'\ud83e\udd43',tone:'blue',title:`Burns Night in ${e} weeks: open bookings?`,body:'Last year\u2019s equivalent nights sold out about 3 weeks ahead (example). Publish the set menu and push to opted-in regulars.',action:{label:'Plan campaign',tab:'more',sub:'marketing'}})}const M=n.filter(e=>e.date===(0,o.venueYmd)(d)&&'noshow'===e.status).length;p.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:M?`${M} no-show today: deposits for 6+?`:'Deposits for bigger tables (example)',body:'Deposits are set per venue in Settings \u203a Advanced \u203a Deposits. Consider them on Fri/Sat after 19:00.',action:{label:'Bookings',tab:'bookings'}});const C=i.filter(e=>e.stars<=2).length;C&&p.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${C} low rating this week: cold chips at collection`,body:'Readiness alerts now time bagging 5 min before pickup. Reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});return p.push({id:'commission',icon:'\ud83d\udcb7',tone:'ok',title:'You kept about \xa31,240 in commission this month',body:'Example: \xa34,140 of direct takeaway orders that would have cost about 30% on delivery apps.',action:{label:'Analytics',tab:'more',sub:'analytics'}}),p.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${u} covers so far today`,body:'Lobster special is the top add-on tonight. Suggest it with the scallops (example).'}),p};var e=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]);const n=e=>{let t=2166136261;for(let o=0;o>>0)/4294967295},r=['Dine-in','Takeaway','Table QR'];const s={Star:'Keep: high margin and popular. Feature it.','Plough horse':'Popular, low margin: nudge the price or trim the cost.',Puzzle:'High margin, few sales: promote it or rename it.',Dog:'Low margin, few sales: consider removing it.'},i=['Alex','Fiona','Iain','Morag','Callum','Eilidh','Ross','Kirsty','Euan','Shona','Hamish','Isla','Craig','Ailsa','Neil','Catriona'],d=['Morgan','Campbell','Fraser','McLeod','Kerr','Wallace','Boyd','Hamilton','Stewart','Murray','Paterson','Duncan','Gilmour','Reid','Ross','Grant'];const l=[{cat:'Fish & seafood',id:'haddock',name:'Haddock fillets',unit:'portions',onHand:8,perCover:.22,par:40},{cat:'Fruit & veg',id:'chips',name:'Chipping potatoes',unit:'kg',onHand:25,perCover:.18,par:40},{cat:'Fish & seafood',id:'langoustine',name:'Langoustines',unit:'kg',onHand:4,perCover:.03,par:6},{cat:'Fish & seafood',id:'mussels',name:'Mussels',unit:'kg',onHand:10,perCover:.05,par:12},{cat:'Fish & seafood',id:'scallops',name:'Scallops',unit:'portions',onHand:14,perCover:.06,par:20},{cat:'Meat',id:'beef',name:'Burger patties',unit:'each',onHand:30,perCover:.1,par:40},{cat:'Fruit & veg',id:'peas',name:'Garden peas',unit:'kg',onHand:6,perCover:.04,par:8},{cat:'Dairy',id:'tartare',name:'House tartare sauce',unit:'tubs',onHand:5,perCover:.05,par:10}],u=()=>(0,a.examplesAllowed)()?l:[];function c(a,n,r,s,i,d,l){const u=[],c=(0,t.forecastToday)(a,n,r,s,d);c.enough||u.push({id:'history',icon:'\ud83d\udcc5',tone:'gold',title:'Not enough history yet',body:c.suggestions[0]?.replace(/^Not enough history yet\. /,'')??'',action:{label:'Settings \u203a Advanced',tab:'more',sub:'advanced'}});const p=(0,o.ymd)(d),h=n.filter(e=>e.date===p&&'noshow'===e.status).length;h&&u.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:`${h} no-show${1===h?'':'s'} today`,body:'Think about a deposit for larger parties (Settings \u203a Advanced \u203a Deposits).',action:{label:'Bookings',tab:'bookings'}});const b=i.filter(e=>e.stars<=2).length;b&&u.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${b} low rating${1===b?'':'s'} to read`,body:'Read what they said, reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});const m=s.filter(e=>e.date>=p).sort((e,t)=>e.date.localeCompare(t.date))[0];return m&&u.push({id:'event',icon:'\ud83d\udcc5',tone:'blue',title:`Coming up: ${m.title}`,body:`${(0,o.niceDate)(new Date(m.date+'T12:00:00'))}. Check your rota and think about a promo.`,action:{label:'Forecast',tab:'forecast'}}),u.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${l} covers so far today`,body:`Seated bookings and walk-ins recorded in CoverCharge today. ${(0,e.laterTodayLine)((0,e.laterTodayCovers)(n,p))}`}),u}},1091,[832,879,822,1218]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useExamples",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const l=()=>(0,t.useSyncExternalStore)(n.onDataModeChange,n.examplesAllowed,n.examplesAllowed)},1092,[31,1218]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useRealHistory=function(e,t){const o=(0,c.useExamples)(),n=(0,r.useBookings)(e),l=(0,r.useOrders)(e),f=(0,u.useCashUp)(e=>e.cashUps),y=(0,k.clampWeeks)((0,h.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings.forecastMinWeeks)),b=t.toDateString();return(0,s.useMemo)(()=>o?null:(0,k.buildHistory)(e,n,l,f.map(e=>({rid:e.rid,date:e.date,takings:(0,p.takings)(e.vals)})),t,y),[o,e,n,l,f,y,b])},Object.defineProperty(_e,"ExampleBadge",{enumerable:!0,get:function(){return b}}),_e.NotEnoughHistory=function({weeks:e,booked:s,what:t="Forecasts",testID:r="not-enough-history"}){return(0,y.jsx)(n.Card,{children:(0,y.jsxs)(o.default,{testID:r,style:{gap:6},children:[(0,y.jsx)(n.T,{weight:"semibold",colour:f.colours.gold,children:"Not enough history yet"}),(0,y.jsx)(n.Muted,{children:'Forecasts'===t?(0,l.notEnoughTip)(e):`${t} start once CoverCharge has ${1===e?'1 week':`${e} weeks`} of your bookings and cash-ups.`}),s?(0,y.jsx)(o.default,{testID:`${r}-booked`,children:(0,y.jsxs)(n.T,{children:["Booked so far: ",s," Covers"]})}):null,(0,y.jsx)(n.Muted,{children:"Tip: upload or add your bookings and do the cash up each night. Managers can change how much history is needed in Settings \u203a Advanced."})]})})};var e,s=_r(d[0]),t=_r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=_r(d[2]),r=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),p=_r(d[8]),k=_r(d[9]),f=_r(d[10]),y=_r(d[11]);const b=()=>(0,y.jsx)(n.Badge,{kind:"amber",label:l.EXAMPLE_LABEL.toUpperCase()})},1093,[31,128,818,823,1049,1218,1092,881,13,1094,825,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_MIN_WEEKS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"clampWeeks",{enumerable:!0,get:function(){return o}}),e.buildHistory=function(o,a,c,u,d,f=n){const l=(0,t.ymd)(d),y=(0,t.ymd)(new Date(d.getTime()-48384e5)),h=t=>t>=y&&tt.rid===o&&h(t.date));for(const t of k)D.add(t.date);const T=[...D].sort(),w=T.length?s(T[0],l):0,j=w>=7*f&&T.length>=2*f,O=t=>{const n={},o={};for(const t of T){const n=new Date(t+'T12:00:00').getDay();o[n]=(o[n]??0)+1}for(const[o,s]of Object.entries(t)){const t=new Date(o+'T12:00:00').getDay();n[t]??={};for(const[o,a]of Object.entries(s))n[t][Number(o)]=(n[t][Number(o)]??0)+a}for(const t of Object.keys(n))for(const s of Object.keys(n[+t]))n[+t][+s]=n[+t][+s]/(o[+t]||1);return n},M=Array.from({length:7},()=>[]);for(const t of k)'number'==typeof t.takings&&t.takings>0&&M[new Date(t.date+'T12:00:00').getDay()].push(Math.round(100*t.takings));const N=M.map(t=>t.length?Math.round(t.reduce((t,n)=>t+n,0)/t.length):null),_=k.filter(t=>'number'==typeof t.takings&&t.takings>0),E=(_.length?s(_.map(t=>t.date).sort()[0],l):0)>=7*f&&_.length>=2*f;return{covers:O(b),takeaway:O(p),days:T.length,spanDays:w,enough:j,minWeeks:f,takingsByDay:N,cashUps:_.length,salesEnough:E}};var t=r(_d[0]);const n=2,o=t=>{const o=Math.round(Number(t));return Number.isFinite(o)&&o>=1&&o<=8?o:n},s=(t,n)=>Math.round((new Date(n+'T12:00:00').getTime()-new Date(t+'T12:00:00').getTime())/864e5)},1094,[822]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1095,[876,31,121,225,123,128,288,989,818,874,825,1445,25]); +__d(function(_g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SETUP_STEPS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ACCESS_LEVELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ACCESS_ROLE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"ACCESS_APP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"accessOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PERMS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"DEFAULT_PERMS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"DEFAULT_GRADES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useSetup",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useSiteSetup",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"HOME_SETUP_NAGS_OFF",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"homeSetupNagsHidden",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"setupProgress",{enumerable:!0,get:function(){return v}});var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e},i=_r(d[2]),s=_r(d[3]);const o=[{id:'venue',title:'Venue details & logo',sub:'Name, address, phone, your logo and order at table'},{id:'hours',title:'Opening hours',sub:'When the kitchen is open each day'},{id:'plan',title:'Areas & table plan',sub:'Your areas, tables and seats'},{id:'paygrades',title:'Staff pay rates',sub:'Name, age, role and hourly rate; tap to edit'},{id:'staff',title:'Add staff',sub:'Name, role, access, pay and avatar'},{id:'permissions',title:'Permissions',sub:'What each access level can do'},{id:'email',title:'Link email',sub:'Your work email address'},{id:'website',title:'Link website',sub:'Your website and booking link'},{id:'invites',title:'Staff invite links',sub:'Personal links for each person'}],l=['Owner','Manager','Supervisor','Head Chef','Staff'],u={Owner:'owner',Manager:'manager',Supervisor:'manager','Head Chef':'staff',Staff:'staff'},c={Owner:'Managers',Manager:'Managers',Supervisor:'Managers','Head Chef':'Head Chef',Staff:'Staff'},f=(e,t)=>l.includes(e??'')?e:'owner'===t?'Owner':'manager'===t?'Manager':'Staff',b=[{id:'bookings',label:'Take and change bookings'},{id:'walkins',label:'Seat walk-ins'},{id:'block',label:'Block bookings and close the garden'},{id:'tableplan',label:'Edit the table plan'},{id:'kitchen',label:'Kitchen tickets and allergy ticks'},{id:'menu',label:'Edit the menu and allergens'},{id:'rota',label:'Make the rota'},{id:'timesheets',label:'Approve timesheets'},{id:'pay',label:'See pay and wages'},{id:'takings',label:'See takings and reports'},{id:'staff',label:'Add staff and change access'},{id:'settings',label:'Change venue settings'},{id:'billing',label:'Plan and billing'}],p=e=>Object.fromEntries(b.map(t=>[t.id,e])),g=e=>({...p(!1),...Object.fromEntries(e.map(e=>[e,!0]))}),S={Owner:p(!0),Manager:{...p(!0),staff:!1,billing:!1},Supervisor:g(['bookings','walkins','block','tableplan','kitchen','rota']),'Head Chef':g(['kitchen','menu','rota']),Staff:g(['bookings','walkins'])},h=[{id:'pg-foh',name:'Front of house',pence:1271},{id:'pg-bar',name:'Bar team',pence:1271},{id:'pg-kp',name:'Kitchen porter',pence:1271},{id:'pg-cdp',name:'Chef de partie',pence:1450},{id:'pg-sup',name:'Supervisor',pence:1400}],k=()=>({done:{},grades:h.map(e=>({...e})),staffGrade:{},perms:JSON.parse(JSON.stringify(S)),email:'',website:'',bookingUrl:'',invites:{}}),O=(0,i.create)()((0,s.persist)((e,t)=>({sites:{},looks:{},patch:(t,n)=>e(e=>({sites:{...e.sites,[t]:{...e.sites[t]??k(),...n}}})),markDone:(e,n,r=!0)=>{const i={...(t().sites[e]??k()).done};r?i[n]=(new Date).toISOString():delete i[n],t().patch(e,{done:i})},setPerm:(e,n,r,i)=>{const s=t().sites[e]??k();'Owner'!==n&&t().patch(e,{perms:{...s.perms,[n]:{...s.perms[n],[r]:i}}})},resetPerms:e=>t().patch(e,{perms:JSON.parse(JSON.stringify(S))}),setLook:(t,n)=>e(e=>{const r={...e.looks};return null==n?delete r[t]:r[t]=n,{looks:r}})}),{name:'covercharge-setup-v1',storage:(0,s.createJSONStorage)(()=>r.default),version:1})),P=e=>{const n=O(t=>t.sites[e])??y,r=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return{...n,email:r??n.email}},y=k(),E=['anchorage'],w=e=>E.includes(e),v=e=>{const t=o.filter(t=>e.done[t.id]).length;return{done:t,total:o.length,pct:t/o.length}}},1096,[881,1190,995,1191]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1097,[571,1399,1401,1400]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1098,[2,824]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"uuid",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isUuid",{enumerable:!0,get:function(){return t}});const x=()=>globalThis.crypto&&'randomUUID'in globalThis.crypto?globalThis.crypto.randomUUID():'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,x=>{const t=16*Math.random()|0;return('x'===x?t:3&t|8).toString(16)}),t=x=>'string'==typeof x&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)},1099,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"fmtH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fmtHDay",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SHIFT_MIN_START",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MAX_END",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shiftTitle",{enumerable:!0,get:function(){return f}});var t=r(d[0]);const n=t=>{const n=(Math.round(60*t)%1440+1440)%1440;return`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`},u=t=>`${n(t)}${t>=24?' (next day)':''}`,o=7,c=28,f=(n,u)=>`${n.replace(' (example)','')} \xb7 ${(0,t.niceDate)((0,t.parseYmd)(u))}`},1100,[822]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return c}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(t,s,o){const c=t.find(n=>n.id===s);return t.filter(t=>(0,n.canSwapWith)(c,t,o))};var n=r(d[0]);const t=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],s=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],o=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],c='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1101,[1102]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"deptKey",{enumerable:!0,get:function(){return n}}),e.sameDept=function(t,a){const o=n(t?.dept),s=n(a?.dept);return!!o&&o===s},Object.defineProperty(e,"teamKey",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ANCHORAGE_VENUE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_SWAP_EDGES",{enumerable:!0,get:function(){return s}}),e.isAnchorageVenue=d,e.canSwapWith=function(t,n,o){if(!t||!n||!1===t.active||!1===n.active||'owner'===t.role||'owner'===n.role)return!1;const c=l(t),f=l(n);if(!c.length||!f.length||c.some(t=>f.includes(t)))return!1;if(d(o))return s.some(([t,n])=>c.includes(t)&&f.includes(n)||c.includes(n)&&f.includes(t));const b=a(t.dept),u=a(n.dept);return!!b&&b===u},Object.defineProperty(e,"SWAP_DEPT_NOTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"ANCHORAGE_SWAP_NOTE",{enumerable:!0,get:function(){return u}}),e.teamOnDay=function(a,o,s,c){const f=o.find(t=>t.id===c),d=new Map;for(const f of a){if(f.date!==s||!0!==f.published||f.staffId===c)continue;const a=o.find(t=>t.id===f.staffId);if(!a||!1===a.active)continue;const l=String(a.dept??'').trim()||'Department not set',b=n(a.dept)||p,u=d.get(b)??{dept:l,people:[]};u.people.push({id:a.id,name:g(a.name),job:String(a.job??'').trim(),start:f.start,end:f.end,times:`${(0,t.fmtH)(f.start)}\u2013${(0,t.fmtH)(f.end)}`}),d.set(b,u)}const l=n(f?.dept);return[...d.entries()].sort(([t],[n])=>t===l?-1:n===l||t===p?1:n===p?-1:t.localeCompare(n)).map(([,t])=>({...t,people:t.people.sort((t,n)=>t.start-n.start||t.name.localeCompare(n.name))}))},e.teamOnDaySpoken=function(n,a){return a.length?`${n}, also on. `+a.map(n=>`${n.dept}: `+n.people.map(n=>`${n.name}${n.job?`, ${n.job}`:''}, ${(0,t.fmtH)(n.start)} to ${(0,t.fmtH)(n.end)}`).join('; ')).join('. ')+'.':`${n}: nobody else is on the rota.`};var t=r(_d[0]);const n=t=>String(t??'').trim().toLowerCase().replace(/\s+/g,' ');const a=t=>{const a=n(t);return'bar'===a||'foh'===a?'front of house':a},o='6349aa07-3fec-46e9-8c69-7b1b08494793',s=[['st-finn','st-agate'],['st-finn','st-eilidh'],['st-agate','st-eilidh'],['st-gabrielle','st-emily'],['st-gabrielle','st-agate'],['st-emily','st-agate'],['st-gordon','st-lenny'],['st-gordon','st-bisto'],['st-mia','st-lillie']],c={'st-finn':'0db9c5d4-f989-4ce8-838a-54c7735f83f0','st-agate':'fce268d0-63ab-42cd-a298-68e3ec5bcae4','st-eilidh':'88f41ae2-dd2f-41c2-b75d-fa735a77e703','st-gabrielle':'71174004-40de-4477-a157-04858a009baa','st-emily':'6b6f09b4-a65e-4390-b86e-b8c57eabe178','st-gordon':'456e0738-dea5-47a8-813e-7b13a0e6c10e','st-lenny':'4dfc8938-7c90-4667-92d2-410807f791f8','st-bisto':'ea2e4b54-ce06-465a-b796-4fa7cde99004','st-mia':'260f4c7b-e78a-45ba-9f8e-f6e33921762b','st-lillie':'636735ff-0d19-4c47-9bfa-3e13c261acc2','st-jack':'ce6f4391-ec69-4782-aac6-8500eb899cc2','st-cameron':'683888b9-2b3d-4225-b028-12cf577decbb','st-harvey':'3ad10d28-78c0-457d-9238-f4a27fb30170','st-james':'6ffe4ae0-2bc1-4355-b3b5-f6e79884d0dc','st-tracy':'79fbfe9e-1d64-412c-a191-42e94b35c1c7'},f=Object.fromEntries(Object.entries(c).map(([t,n])=>[n,t]));function d(t){const n=String(t??'').trim().toLowerCase();return'anchorage'===n||n===o}function l(t){if(!t)return[];const n=[t.id,t.ref,t.externalRef].map(t=>String(t??'').trim().toLowerCase()).filter(Boolean),a=new Set(n);for(const t of n){const n=c[t]?t:f[t];n&&(a.add(n),a.add(c[n]))}return[...a]}const b='Swaps and cover stay in your department. Bar counts as front of house. A manager can still move a shift on the rota.',u='You can only swap with the people named for you. A manager can still move a shift on the rota.',p='\0unset',g=t=>t.replace(/\s*\(example\)$/,'').trim()},1102,[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,"daysBetween",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rangeLabel",{enumerable:!0,get:function(){return h}}),_e.TimeOffSheet=b,_e.RequestTimeOff=function({meId:e,me:s,testID:l="request-time-off"}){const[d,f]=(0,t.useState)(!1),m=(0,o.ymd)(new Date),u=(0,r.useOwner)(e=>e.leave).filter(t=>t.staffId===e&&t.to>=m).sort((e,t)=>e.from.localeCompare(t.from));return(0,i.jsxs)(n.Card,{children:[(0,i.jsxs)(a.default,{testID:l,style:{gap:8,alignItems:'stretch'},children:[(0,i.jsx)(n.Button,{label:"Request time off",sub:"Holiday, appointments, days you can\u2019t work",testID:`${l}-open`,onPress:()=>f(!0)}),u.map(e=>(0,i.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:8,children:[(0,i.jsxs)(n.T,{size:14,style:{flex:1},children:[h(e.from,e.to)," \xb7 ",e.reason]}),(0,i.jsx)(n.Badge,{kind:'approved'===e.status?'ok':'declined'===e.status?'red':'amber',label:y(e.status)})]},e.id))]}),(0,i.jsx)(b,{visible:d,onClose:()=>f(!1),meId:e,me:s})]})};var t=_r(_d[0]),s=e(_r(_d[1])),a=e(_r(_d[2])),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),i=_r(_d[7]);const d=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['January','February','March','April','May','June','July','August','September','October','November','December'],m=['Holiday','Appointment','Family','Other'],u=e=>(e??'').replace(' (example)',''),c=(e,t)=>Math.round(((0,o.parseYmd)(t).getTime()-(0,o.parseYmd)(e).getTime())/864e5)+1,h=(e,t)=>e===t?(0,o.niceDateYear)((0,o.parseYmd)(e)):`${(0,o.niceDateYear)((0,o.parseYmd)(e))} to ${(0,o.niceDateYear)((0,o.parseYmd)(t))}`,y=e=>'approved'===e?'Approved':'declined'===e?'Declined':'Waiting for a manager';function p({from:e,to:r,onChange:m,today:u}){const c=(0,o.parseYmd)(e||u),[h,y]=(0,t.useState)({y:c.getFullYear(),m:c.getMonth()}),p=(new Date(h.y,h.m,1).getDay()+6)%7,b=new Date(h.y,h.m+1,0).getDate(),x=[...Array(p).fill(null),...Array.from({length:b},(e,t)=>(0,o.ymd)(new Date(h.y,h.m,t+1)))],j=(0,o.parseYmd)(u),w=h.y>j.getFullYear()||h.y===j.getFullYear()&&h.m>j.getMonth(),D=e=>y(({y:t,m:s})=>{const a=new Date(t,s+e,1);return{y:a.getFullYear(),m:a.getMonth()}}),I=t=>{!e||e&&r||tD(-1)}),(0,i.jsxs)(n.T,{weight:"semibold",testID:"time-off-month",children:[f[h.m]," ",h.y]}),(0,i.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u203a",accessibilityLabel:"Next month",testID:"time-off-next-month",onPress:()=>D(1)})]}),(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:d.map(e=>(0,i.jsx)(a.default,{style:{flex:1,alignItems:'center'},children:(0,i.jsx)(n.Muted,{children:e})},e))}),Array.from({length:Math.ceil(x.length/7)},(t,d)=>(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:Array.from({length:7},(t,f)=>{const m=x[7*d+f];if(!m)return(0,i.jsx)(a.default,{style:{flex:1,height:40}},f);const c=me&&mI(m),style:{flex:1,height:40,margin:1,borderRadius:8,alignItems:'center',justifyContent:'center',backgroundColor:h?l.colours.gold:y?'#3a3020':'transparent',opacity:c?.35:1},children:(0,i.jsx)(n.T,{size:14,weight:h?'semibold':'regular',colour:h?'#1a1407':l.colours.text,children:Number(m.slice(8))})},f)})},d))]})}function b({visible:e,onClose:s,meId:l,me:d,manager:f}){const y=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),b=(0,o.ymd)(new Date),[x,j]=(0,t.useState)(f?'':l),[w,D]=(0,t.useState)(''),[I,v]=(0,t.useState)(''),[S,Y]=(0,t.useState)('Holiday'),[C,T]=(0,t.useState)(null),M=I||w,A=!!x&&!!w&&M>=w,P=()=>{T(null),s()};return(0,i.jsx)(n.Sheet,{visible:e,onClose:P,title:f?'Add time off':'Request time off',testID:"time-off-sheet",children:C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Banner,{kind:"success",title:C}),(0,i.jsx)(n.Button,{label:"Done",testID:"time-off-done",onPress:P})]}):(0,i.jsxs)(i.Fragment,{children:[f?(0,i.jsxs)(a.default,{style:{gap:6},children:[(0,i.jsx)(n.T,{weight:"semibold",children:"Who\u2019s off?"}),(0,i.jsx)(n.Row,{wrap:!0,gap:6,children:y.filter(e=>'owner'!==e.role).map(e=>(0,i.jsx)(n.Chip,{testID:`time-off-who-${e.id}`,label:u(e.name),selected:x===e.id,onPress:()=>j(e.id)},e.id))})]}):null,(0,i.jsx)(n.Muted,{center:!0,children:w?I?'Tap a day to start again.':'Now tap your last day off (or tap Send for just that day).':'Tap your first day off.'}),(0,i.jsx)(p,{from:w,to:I,today:b,onChange:(e,t)=>{D(e),v(t)}}),w?(0,i.jsxs)(n.T,{center:!0,weight:"semibold",testID:"time-off-summary",children:[h(w,M)," \xb7 ",c(w,M)," ",1===c(w,M)?'day':'days']}):null,(0,i.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:m.map(e=>(0,i.jsx)(n.Chip,{label:e,selected:S===e,onPress:()=>Y(e)},e))}),(0,i.jsx)(n.Button,{label:f?'Add time off':'Send request',testID:"time-off-send",disabled:!A,onPress:()=>{const e=r.useOwner.getState().addLeave({staffId:x,from:w,to:M,reason:S,by:u(d),...f?{status:'approved',decidedBy:u(d)}:{}}),t=u(y.find(e=>e.id===x)?.name);T(f?`${t} is off ${h(e.from,e.to)}. It shows on the rota now.`:`Sent: ${h(e.from,e.to)}. A manager will approve it, and you\u2019ll see it here.`),D(''),v('')}}),(0,i.jsx)(n.Muted,{center:!0,children:f?'Approved straight away. The rota shows them off and Copy last week won\u2019t give them shifts on those days.':'Your manager sees it in Rota \u203a Swaps & time off and approves it. Nothing is sent by text or email.'})]})})}},1103,[31,264,128,818,863,822,825,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},1164,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.fromDisplayFlag=y,_e.displayUrlFrom=m,_e.openedFromDisplay=function(){return b},_e.BackToDisplayButton=I,_e.BackToDisplay=function(){const e=(0,p.useSession)(e=>e.meId),[n,s]=(0,t.useState)(!1),c=(0,t.useRef)(Date.now());return(0,t.useEffect)(()=>{if(!b||!(0,f.isKitchenViaDisplay)()||'undefined'==typeof window)return;const e=()=>{c.current=Date.now()};for(const t of['pointerdown','keydown','touchstart'])window.addEventListener(t,e,!0);const t=window.setInterval(()=>{Date.now()-c.current>D&&!n&&(s(!0),v())},5e3);return()=>{for(const t of['pointerdown','keydown','touchstart'])window.removeEventListener(t,e,!0);window.clearInterval(t)}},[n]),b?e?null:(0,h.jsx)(o.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,top:12,alignItems:'center',zIndex:9999},children:(0,h.jsx)(I,{})}):null};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),c=r(d[5]),l=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),h=r(d[10]);const w='cc-from-display';function y(e,t){try{const n=new URL(e),o=new URLSearchParams(n.hash.replace(/^#/,''));return'display'===n.searchParams.get('from')||'display'===o.get('from')||'1'===t}catch{return'1'===t}}function m(e){const t=new URL(e),n=t.pathname.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/);return`${t.origin}${n?n[1]:'/'}display-app/index.html`}const b=(()=>{if('undefined'==typeof window||'chef'!==s.APP_VARIANT)return!1;let e=null;try{e=window.sessionStorage.getItem(w)}catch{}const t=y(window.location.href,e);if(t)try{window.sessionStorage.setItem(w,'1')}catch{}return t})(),D=12e4;async function v(){if((0,f.isKitchenViaDisplay)()){try{await(0,u.endDisplayKitchen)()}catch{}try{p.useSession.getState().signOut()}catch{}(0,f.markKitchenViaDisplay)(!1)}try{window.sessionStorage.removeItem(w)}catch{}window.location.assign(m(window.location.href))}function I({compact:e}={}){const[o,s]=(0,t.useState)(!1);if(!b)return null;const u=e?48:56;return(0,h.jsx)(n.default,{testID:"back-to-display",accessibilityRole:"button",accessibilityLabel:"Back to Display",accessibilityHint:"Leaves the Head Chef app and opens the Display again",onPress:()=>{s(!0),v()},style:({pressed:t})=>({minHeight:u,minWidth:e?180:220,paddingHorizontal:e?16:22,borderRadius:u/2,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:t?c.colours.goldLight:c.colours.gold,borderWidth:2,borderColor:c.colours.bg}),children:(0,h.jsx)(l.T,{size:e?15:18,weight:"bold",colour:c.colours.bg,center:!0,children:o?'Opening the Display\u2026':'Back to Display'})})}},1165,[31,123,264,128,807,825,818,824,979,866,25]); +__d(function(g,r,_i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return l}}),_e.quietly=async function(e){u++;try{await e()}finally{u--;for(const e of p)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return w}}),_e.venueChannel=function(e,t,n,s){let i=o().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:o}of t)i=i.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${o??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return i.subscribe(e=>s(e)),i},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return n.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]),i=r(d[4]);const o=()=>(0,t.getSupabase)(),h=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(h).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${h(t[e])}`).join(',')}}`},c=e=>{const t=h(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},l=5;let u=0;const p=new Set;const f=()=>u>0;class w{known={};last=new Map;lastRev=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}unsubDone=null;async start(){this.known=await s.kv.get(this.kvKey,{}),this.snapshotLocal(),p.add(this),this.spec.writeBeforeRead&&this.pushUrgent(),this.unsub=this.spec.subscribe(()=>{u>0?this.snapshotLocal():this.applying||!this.reconciled&&!this.spec.writeBeforeRead||this.pushLocalChanges()}),this.unsubDone=i.mutationQueue.onDone(e=>{if(e.table!==this.spec.table||e.venueId!==this.venueId)return;const t=this.spec.list().find(t=>this.spec.key(t)===e.rowKey);t&&(this.known[this.spec.key(t)]=this.kh(t),this.saveKnown())})}pushUrgent(){const e=this.spec;if(e.writable())for(const t of e.list()){const n=e.key(t);!e.syncable(t)||e.urgent&&!e.urgent(t)||this.pending(n)||this.known[n]===this.kh(t)||this.write(t)}}unsavedKeys(){const e=this.spec;return e.list().filter(t=>e.syncable(t)&&(!e.inWindow||e.inWindow(t))&&this.known[e.key(t)]!==this.kh(t)&&!this.pending(e.key(t))).map(t=>e.key(t))}resendUnsaved(e=()=>!1){const t=this.spec;if(!t.writable())return 0;const n=new Set(this.unsavedKeys().filter(t=>!e(t)));let s=0;for(const e of t.list())n.has(t.key(e))&&(this.write(e),s++);return s}stop(){this.unsub?.(),this.unsub=null,this.unsubDone?.(),this.unsubDone=null,p.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}rev(e){return this.spec.revision?this.spec.revision(e):c(e)}kh(e){return this.spec.knownByRevision?this.rev(e):c(e)}snapshotLocal(){const e=this.spec.list();this.last=new Map(e.map(e=>[this.spec.key(e),c(e)])),this.lastRev=new Map(e.map(e=>[this.spec.key(e),this.rev(e)]))}saveKnown(){s.kv.set(this.kvKey,this.known)}pending(e){return i.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){const t=()=>{let e=o().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);return this.spec.filter&&(e=this.spec.filter(e)),e},n=['bookings','walk_ins','temp_readings','temp_units'].includes(this.spec.table)?await(0,e.readPages)(async(e,n)=>{const{data:s,error:i}=await t().order('id').range(e,n);if(i)throw i;return s??[]}):await(async()=>{const{data:e,error:n}=await t().limit(2e3);if(n)throw n;return e??[]})();this.merge(n,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(n)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],h=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),h=n.fromRow(t);if(!h)continue;i.add(e),p.push(h);const l=c(h),f=this.kh(h),w=s.get(e);if(!this.pending(e)){if(w){const t=this.kh(w);if(this.rev(w)===this.rev(h)){this.known[e]=f,c(w)!==l&&o.push(h);continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(w)){u.push(w);continue}}o.push(h),this.known[e]=f}}const f=n.authoritative?.(e)??null,w=[];for(const[e,t]of s)i.has(e)||this.pending(e)||(!f||!f(t)||n.writable()&&n.syncable(t)||n.inWindow&&!n.inWindow(t)?n.syncable(t)&&(n.inWindow&&!n.inWindow(t)||(this.known[e]?h.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t))):w.push(e));!e.length&&n.keepOnEmpty?.()&&(h.length=0,w.length=0);const v=this.massOk;if(this.massOk=!1,h.length>l&&!v)this.ev.onSuspect?.(n.name,`read would remove ${h.length} of ${s.size}`),h.length=0,u.length=0;else for(const e of h)delete this.known[e];for(const e of w)delete this.known[e],h.push(e);this.applyRemote(o,h);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=c(i);this.known[s]=this.kh(i),this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=c(s),i=this.rev(s);if(this.last.get(n)===t)continue;const o=this.lastRev.get(n);this.last.set(n,t),this.lastRev.set(n,i),void 0!==o&&o===i||(e.syncable(s)&&e.writable()&&this.known[n]!==this.kh(s)&&(!this.pending(n)||e.writeBeforeRead)?this.write(s):e.syncable(s)&&!e.writable()&&this.known[n]!==this.kh(s)&&this.ev.onSkipped?.(e.name,n))}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e),this.lastRev.delete(e);const s=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&s.length>l)return this.ev.onSuspect?.(e.name,`${s.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of s)delete this.known[t],i.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let s;try{s=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if('update'===t.mode){const e=t.venueColumn??'venue_id';i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:s,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:s,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1166,[1282,872,1279,1268,1075]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"SEED_CARD_COSTS",{enumerable:!0,get:function(){return A}}),_e.stripGpSamples=b,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return P}}),_e.useGpCalcView=function(){const e=P();return(0,i.useMemo)(()=>t.LIVE_VENUE_BUILD?{...e,...b(e)}:e,[e])},Object.defineProperty(_e,"GP_TABLES",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"GP_EPOCH",{enumerable:!0,get:function(){return E}}),_e.gpSyncItems=D,_e.gpSyncFromRow=L,_e.mergeGpItems=N,_e.gpSyncSpec=function(e,t){const i=C[e];return{name:i,table:i,deletes:!1,list:()=>D(P.getState(),e),key:e=>e.id,rowKey:t=>String('ing'===e?t.local_id:t.id),syncable:t=>'ing'===e?t.id.length>0&&t.id.length<=80:(0,u.isUuid)(t.id),writable:t,toRow:(t,i)=>({id:'ing'===e?(0,u.isUuid)(t.id)?t.id:(0,p.uuidFrom)(`gi:${i}:${t.id}`):t.id,venue_id:i,...'ing'===e?{local_id:t.id,name:String(t.doc?.name??'').slice(0,120)}:{},doc:_(t),updated_at:t.updatedAt,deleted_at:t.deletedAt??null}),fromRow:t=>L(e,t),apply:(t,i)=>P.setState(n=>N(n,e,t,i)),subscribe:t=>P.subscribe((i,n)=>{i.gone===n.gone&&('ing'===e?i.ingredients===n.ingredients:i[w[e]]===n[w[e]])||t()})}};var e,t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),d=(e=r)&&e.__esModule?e:{default:e},a=_r(_d[5]),c=_r(_d[6]),o=_r(_d[7]),p=_r(_d[8]),u=_r(_d[9]),l=_r(_d[10]),f=_r(_d[11]);let h=0;const m=e=>`${e}-${Date.now().toString(36)}${(h++).toString(36)}`,S=(e,t,i,n,s,r=0,d=[])=>({id:e,name:t,packSize:i,packUnit:n,packPrice:s,wastePct:r,allergens:d}),k=e=>new Date(Date.now()-864e5*e).toISOString(),y={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},v=[S('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),S('gi-potato','Potatoes (chipping)',25,'kg',1600,20),S('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),S('gi-oil','Rapeseed oil',20,'L',3200),S('gi-peas','Garden peas (frozen)',2.5,'kg',450),S('gi-lemon','Lemons',80,'each',1600),S('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),S('gi-capers','Capers',1,'kg',900,0,['sulphites']),S('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),S('gi-steak','Braising steak',5,'kg',6e3,10),S('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),S('gi-onion','Onions',10,'kg',1e3,10),S('gi-stock','Beef stock',1,'L',350,0,['celery']),S('gi-chicken','Chicken breast',5,'kg',4750),S('gi-leaves','Cos lettuce',12,'each',960,15),S('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),S('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),S('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),S('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),S('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),S('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs']),{...S('gi-haddock-stone','Haddock (by the stone)',1,'stone',11e3,0,['fish']),servings:30,servingName:'serving',supplier:'Local fish merchant',updatedAt:'2026-11-02T09:00:00.000Z'},{...S('gi-chicken-case','Chicken breast (5 kg case)',5,'kg',4e3),servings:25,servingName:'breast',supplier:'Butcher',updatedAt:'2026-11-02T09:00:00.000Z'}].map(e=>({...e,prices:(y[e.id]??[e.packPrice]).map((e,t,i)=>({p:e,at:k(7*(i.length-t))}))})),I=(e,t,i,n,s,r,d,a="")=>({id:e,name:t,category:i,lines:n.map(([e,t,i])=>({ingId:e,qty:t,unit:i})),portions:s,target:70,menuPrice:r,status:d,description:a,allergens:[]}),O=[I('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),I('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),I('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),I('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),I('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),I('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')],A={[(0,p.uuidFrom)('card:anchorage:a-fishsupper')]:{portions:1,lines:[{ingId:'gi-haddock-stone',qty:1,unit:'serving',recipeIngId:'a-fishsupper-i0'},{ingId:'gi-batter',qty:80,unit:'g',recipeIngId:'a-fishsupper-i1'},{ingId:'gi-potato',qty:250,unit:'g',recipeIngId:'a-fishsupper-i3'},{ingId:'gi-peas',qty:80,unit:'g',recipeIngId:'a-fishsupper-i4'},{ingId:'gi-mayo',qty:40,unit:'ml',recipeIngId:'a-fishsupper-i6'},{ingId:'gi-lemon',qty:.25,unit:'each',recipeIngId:'a-fishsupper-i7'}]}};function b(e){const t=e=>O.some(t=>t.id===e.id&&JSON.stringify(t)===JSON.stringify(e))||/\(example\)/i.test(e.name),i=new Set(e.dishes.filter(e=>!t(e)).map(e=>e.id));let n=!0;for(;n;){n=!1;for(const t of e.dishes.filter(e=>i.has(e.id)))for(const e of t.lines)e.ingId.startsWith('dish:')&&!i.has(e.ingId.slice(5))&&(i.add(e.ingId.slice(5)),n=!0)}const s=e.dishes.filter(e=>i.has(e.id)),r=new Set(s.flatMap(e=>e.lines.map(e=>e.ingId))),d=e=>{const t=v.find(t=>t.id===e.id);if(!t)return!1;const i=({prices:e,...t})=>JSON.stringify(t);return i(t)===i(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(t.prices?.map(e=>e.p)))},a=Object.fromEntries(Object.entries(e.cardCosts??{}).filter(([e,t])=>!(A[e]&&JSON.stringify(A[e])===JSON.stringify(t))));return Object.values(a).forEach(e=>e.lines.forEach(e=>r.add(e.ingId))),{dishes:s,ingredients:e.ingredients.filter(e=>r.has(e.id)||!d(e)),cardCosts:a}}const P=(0,a.create)()((0,c.persist)((e,i)=>({ingredients:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:v,dishes:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:O,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],cardCosts:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:A,gone:{},saveCardCost:(t,i)=>e(e=>{const n={...e.gone};return delete n[`card:${t}`],{cardCosts:{...e.cardCosts,[t]:{...i,updatedAt:(new Date).toISOString()}},gone:n}}),removeCardCost:t=>e(e=>{if(!e.cardCosts[t])return{};const{[t]:i,...n}=e.cardCosts;return{cardCosts:n,gone:{...e.gone,[`card:${t}`]:(new Date).toISOString()}}}),removeIngredient:t=>e(e=>({ingredients:e.ingredients.filter(e=>e.id!==t),gone:{...e.gone,[`ing:${t}`]:(new Date).toISOString()}})),saveIngredient:t=>{const n=i(),s=n.ingredients.find(e=>e.id===t.id),r=n.ingredients.map(e=>e.id===t.id?t:e);let d=n.alerts;if(s&&(s.packPrice!==t.packPrice||s.packSize!==t.packSize||s.wastePct!==t.wastePct)){const e=n.settings.vatPct,i=n.dishes.filter(e=>e.menuPrice).map(t=>{const i=(0,o.gpOf)((0,o.portionCost)(t,n.ingredients,n.dishes),t.menuPrice,e).gpPct,s=(0,o.gpOf)((0,o.portionCost)(t,r,n.dishes),t.menuPrice,e).gpPct;return{id:t.id,name:t.name,before:i,after:s,belowTarget:se.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),c=(a(t)-a(s))/a(s)*100;i.length&&(d=[{id:m('ma'),at:(new Date).toISOString(),ingredient:t.name,change:`${c>=0?'+':''}${c.toFixed(0)}%`,dishes:i},...d].slice(0,20))}const a=s&&JSON.stringify({...s,updatedAt:void 0})!==JSON.stringify({...t,updatedAt:void 0});e({ingredients:a?r.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):r,alerts:d})},addPricePaid:(e,t,n)=>{const s=i(),r=s.ingredients.find(t=>t.id===e);if(!(r&&t>0))return;const d=[...r.prices?.length?r.prices:[{p:r.packPrice,at:''}],{p:Math.round(t),at:n??(new Date).toISOString()}].slice(-20),a={...r,prices:d};i().saveIngredient({...a,packPrice:(0,o.costingPrice)(a,s.settings.priceBasis,s.settings.avgOf??5)})},addIngredient:t=>{const i=m('gi');return e(e=>({ingredients:[...e.ingredients,{updatedAt:(new Date).toISOString(),...t,id:i}]})),i},saveDish:t=>e(e=>({dishes:e.dishes.some(e=>e.id===t.id)?e.dishes.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):[{...t,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:t=>e(e=>({dishes:e.dishes.filter(e=>e.id!==t)})),setSettings:t=>{const n={...i().settings,...t};if(e({settings:n}),void 0!==t.priceBasis||void 0!==t.avgOf)for(const e of i().ingredients){const t=(0,o.costingPrice)(e,n.priceBasis,n.avgOf??5);t!==e.packPrice&&i().saveIngredient({...e,packPrice:t})}},dismissAlert:t=>e(e=>({alerts:e.alerts.filter(e=>e.id!==t)})),deliveries:{},counts:{},saveDelivery:(t,n)=>{const s=i(),r=(new Date).toISOString(),d=s.deliveries[t.id],a=n?(0,f.gpImpact)(s.ingredients,s.cardCosts??{},n,s.settings,t,d).snap:t.gp??d?.gp,{ingredients:c,lines:o}=(0,l.applyDelivery)(s.ingredients,t,s.settings,()=>m('gi'),r,d),p={...t,lines:o,updatedAt:r,...a?{gp:{...a,at:r}}:{}},u={...s.gone};return delete u[`del:${t.id}`],e({ingredients:c,deliveries:{...s.deliveries,[t.id]:p},gone:u}),p},removeDelivery:t=>e(e=>{if(!e.deliveries[t])return{};const{[t]:i,...n}=e.deliveries;return{deliveries:n,ingredients:(0,l.removeDeliveryPrices)(e.ingredients,t,e.settings,void 0,e.deliveries[t]),gone:{...e.gone,[`del:${t}`]:(new Date).toISOString()}}}),saveCount:t=>e(e=>{const i={...e.gone};return delete i[`count:${t.id}`],{counts:{...e.counts,[t.id]:{...t,updatedAt:(new Date).toISOString()}},gone:i}}),removeCount:t=>e(e=>{if(!e.counts[t])return{};const{[t]:i,...n}=e.counts;return{counts:n,gone:{...e.gone,[`count:${t}`]:(new Date).toISOString()}}})}),{name:'covercharge-gpcalc-v1',storage:(0,c.createJSONStorage)(()=>d.default),version:4,migrate:async(e,i)=>(t.LIVE_VENUE_BUILD&&e&&(await(0,n.archiveChefCache)('gpcalc',e),e={...e,...b({...e,dishes:e.dishes||[],ingredients:e.ingredients||[],cardCosts:e.cardCosts||{}})}),i<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e&&!e.cardCosts&&(e.cardCosts={}),e&&!e.gone&&(e.gone={}),e&&!e.deliveries&&(e.deliveries={}),e&&!e.counts&&(e.counts={}),e)}));'undefined'!=typeof window&&'undefined'!=typeof document&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,s.venueKey)('covercharge-gpcalc-v1')&&P.persist.rehydrate()});const w={card:'cardCosts',del:'deliveries',count:'counts'},C={ing:'ingredient_prices',card:'card_costs',del:'kitchen_deliveries',count:'kitchen_stock_counts'},E='1970-01-01T00:00:00.000Z',_=e=>JSON.parse(JSON.stringify(e));function D(e,t){const i=b(e),n='ing'===t?i.ingredients.map(e=>({id:e.id,updatedAt:e.updatedAt??E,doc:_({...e,updatedAt:e.updatedAt??E})})):Object.entries('card'===t?i.cardCosts:e[w[t]]??{}).map(([e,t])=>({id:e,updatedAt:t.updatedAt??E,doc:_({...t,updatedAt:t.updatedAt??E})})),s=new Set(n.map(e=>e.id)),r=Object.entries(e.gone??{}).filter(([e])=>e.startsWith(`${t}:`)).map(([e,i])=>({id:e.slice(t.length+1),updatedAt:i,deletedAt:i})).filter(e=>!s.has(e.id));return[...n,...r]}function L(e,t){const i=t?.doc,n=String('ing'===e?t?.local_id??'':t?.id??'');if(!i||'object'!=typeof i||i.id!==n||'string'!=typeof i.updatedAt||!n)return null;if(i.deletedAt)return'string'==typeof i.deletedAt?{id:n,updatedAt:i.updatedAt,deletedAt:i.deletedAt}:null;const s=i.doc;return s&&'object'==typeof s&&('ing'!==e||'string'==typeof s.name&&s.id===n&&Number(s.packSize)>0&&'string'==typeof s.packUnit&&Number.isFinite(Number(s.packPrice)))&&('ing'===e||Array.isArray(s.lines))&&('del'!==e&&'count'!==e||'string'==typeof s.date&&s.id===n)?{id:n,updatedAt:i.updatedAt,doc:i.doc}:null}function N(e,t,i,n){const s={...e.gone??{}},r=new Map('ing'===t?e.ingredients.map(e=>[e.id,e]):Object.entries(e[w[t]]??{})),d=[];for(const e of i){const i=`${t}:${e.id}`,n=r.get(e.id),a=n?n.updatedAt??E:void 0,c=s[i];if(e.deletedAt){if(n&&a>e.deletedAt)continue;r.delete(e.id),(!c||ce.updatedAt)continue;if(n&&a>e.updatedAt)continue;const o='ing'===t?{...e.doc,id:e.id,updatedAt:e.updatedAt}:{...e.doc,updatedAt:e.updatedAt};n?r.set(e.id,o):d.push([e.id,o]),delete s[i]}for(const e of n)r.delete(e),delete s[`${t}:${e}`];if('ing'===t){return{ingredients:[...r.values(),...d.map(([,e])=>e)],gone:s}}return{[w[t]]:Object.fromEntries([...r.entries(),...d]),gone:s}}},1167,[842,31,1198,5,1190,995,1191,1271,1179,1099,1272,1273]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCardStore",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"photoStorageFull",{enumerable:!0,get:function(){return C}}),_e.setStoragePhotoResolver=function(e){V=e},_e.cachePhotoAs=function(e,t){if(E.getState().photos[e]===t)return;E.setState(r=>({photos:{...r.photos,[e]:t}}))},Object.defineProperty(_e,"readLocalPhoto",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"localRecipeCards",{enumerable:!0,get:function(){return M}}),_e.ensureCards=F;var e,t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),s=_r(d[3]),a=_r(d[4]),o=_r(d[5]),c=(e=o)&&e.__esModule?e:{default:e};_r(d[6]);var u=_r(d[7]),l=_r(d[8]),f=_r(d[9]),m=_r(d[10]),h=_r(d[11]),p=_r(d[12]),S=_r(d[13]);const I='covercharge-recipecards-v1',y='covercharge-recipephotos-v1',O=()=>{try{return(0,S.nowFrom)(S.useStore.getState().clock)}catch{return new Date}},w=(0,u.create)()((0,l.persist)(()=>({cards:[],removed:[],log:[]}),{name:I,storage:(0,l.createJSONStorage)(()=>c.default),version:3,migrate:async e=>{const n=e;return t.LIVE_VENUE_BUILD?(await(0,r.archiveChefCache)('recipe-cards',n),{...n,cards:n.cards.filter(e=>!(0,s.isDemoCard)(e)),log:n.log.filter(e=>!(0,s.demoActor)(e.by))}):n}}));let b=!1;const v={getItem:e=>c.default.getItem(e),setItem:async(e,t)=>{try{await c.default.setItem(e,t),b=!1}catch{b=!0}},removeItem:e=>c.default.removeItem(e)},C=()=>b,E=(0,u.create)()((0,l.persist)(()=>({photos:{}}),{name:y,storage:(0,l.createJSONStorage)(()=>v),version:1})),_={lobster:_r(d[14]),skink:_r(d[15]),fishsupper:_r(d[16]),moules:_r(d[17]),stp:_r(d[18])};let A=0;const B=(e,t,r,n=t)=>{const s={id:`cl-${Date.now().toString(36)}${(A++).toString(36)}`,cardId:e.id,rid:e.restaurantId,at:O().toISOString(),by:t,text:n===t?r:`${r} (${n})`};w.setState(e=>({log:[s,...e.log].slice(0,300)}));try{S.useStore.getState().addAudit(e.restaurantId,'menu',`Recipe card: ${e.dish}: ${r} (${n})`)}catch{}},L=e=>w.setState(t=>({cards:t.cards.some(t=>t.id===e.id)?t.cards.map(t=>t.id===e.id?e:t):[...t.cards,e]}));let P=null,D=null;function U(){const e=w.getState().cards,r=t.LIVE_VENUE_BUILD?e.filter(e=>!(0,s.isDemoCard)(e)).map(e=>({...e,signOff:(0,s.demoActor)(e.signOff?.by)?null:e.signOff,allergensConfirmed:(0,s.demoActor)(e.allergensConfirmed?.by)?void 0:e.allergensConfirmed})):e;if(!D||P!==e){P=e;const t=new Map,n=new Map;for(const e of r)t.set(e.restaurantId,[...t.get(e.restaurantId)??[],e]),n.set(e.menuItemId,e);D={cards:r,byRid:t,byItem:n}}return D}const N=[];function R(e){if(!(0,f.canEditCards)(e.role))throw new Error('Only the head chef and managers can edit recipe cards.')}let V=null;const $=e=>E.getState().photos[e],M={mode:'local',list:e=>U().byRid.get(e)??N,get:e=>U().cards.find(t=>t.id===e),byMenuItem:e=>U().byItem.get(e),subscribe:e=>{const t=w.subscribe(e),r=E.subscribe(e);return()=>{t(),r()}},async create(e,t,r){R(r);const n=O().toISOString();k=!0;let s=t.menuItemId;try{s||(s=S.useStore.getState().addMenuItem({restaurantId:e,section:t.section,name:t.dish,description:t.description??'',price:t.price,dietary:[],allergens:t.allergens??{},prepMins:12,soldOut:!1,signOff:null}));const a=(0,f.cardPhotos)(t),o=t.createdBy?.trim()||r.name,c={id:t.id??(0,f.uuid)(),restaurantId:e,menuItemId:s,dish:t.dish,section:t.section,price:t.price,photo:a[0],photos:a,createdBy:o,createdByRole:t.createdByRole??(o===r.name?r.role:void 0),ingredients:t.ingredients??[],steps:t.steps??[],allergens:t.allergens??{},dismissed:t.dismissed??[],allergenNotes:t.allergenNotes,signOff:null,wasLive:!1,origin:'new',version:1,createdAt:n,updatedAt:n,updatedBy:r.name};return w.setState(e=>({cards:[...e.cards.filter(e=>e.menuItemId!==c.menuItemId),c]})),B(c,r.name,'card created, awaiting sign-off'),c}finally{k=!1}},async update(e,t,r){R(r);const n=M.get(e);if(!n)throw new Error('Card not found');const s=(0,f.editCard)(n,t,r.name,O().toISOString());return s.changed&&(L(s.card),B(s.card,r.name,s.resetSignOff?'edited, sign-off reset to Awaiting sign-off':t.confirmAllergens&&1===Object.keys(t).length?'allergens confirmed':'edited')),s.card},async signOff(e,t){const r=M.get(e);if(!r)throw new Error('Card not found');if(!(0,f.maySignOff)(t,r))throw new Error('Only the Head Chef, an owner or a manager can sign it off.');const n=(0,f.signOffBlock)(r);if(n)throw new Error(n);const s=(0,f.signOffCard)(r,t.name,O().toISOString());return L(s),B(s,t.name,'signed off',(0,f.signerLabel)(t)),s},async remove(e,t){R(t);const r=M.get(e);r&&(w.setState(t=>({cards:t.cards.filter(t=>t.id!==e),removed:[...t.removed,r.menuItemId]})),S.useStore.setState(e=>({menu:e.menu.map(e=>e.id===r.menuItemId?{...e,hidden:!0}:e)})),B(r,t.name,'card removed (dish hidden from the menu)'))},async savePhoto(e,t,r){const n=`local:${t}:${Date.now().toString(36)}`;return E.setState(e=>({photos:{...e.photos,[n]:r.dataUrl}})),n},photoSource(e){if(!e)return null;if(e.startsWith('asset:'))return _[e.slice(6)]??null;if(e.startsWith('local:')){const t=E.getState().photos[e];return t?{uri:t}:null}if(/^(https?:|data:)/.test(e))return{uri:e};const t=E.getState().photos[e];if(t)return{uri:t};const r=V?.(e);return r?{uri:r}:null}};let k=!1,j=!1;function F(){if(k)return;const e=S.useStore.getState().menu,{cards:r,removed:o}=w.getState(),c=new Set(r.map(e=>e.menuItemId)),u=e.filter(e=>!c.has(e.id)&&!o.includes(e.id)),l=O().toISOString();if(r.some(e=>(0,s.isPlaceholderCard)(e))&&w.setState(e=>({cards:e.cards.filter(e=>!(0,s.isPlaceholderCard)(e))})),!u.length)return;const f=a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD||!(0,n.examplesAllowed)()?[]:(0,p.exampleCards)(u),m=new Set(f.map(e=>e.menuItemId)),h=[...f,...u.filter(e=>!m.has(e.id)).map(e=>(0,p.importedCard)(t.LIVE_VENUE_BUILD&&(0,s.demoActor)(e.signOff?.by)?{...e,signOff:null}:e,l))];w.setState(e=>({cards:[...e.cards,...h]}))}(0,h.setMenuCardBridge)({cardFor:e=>U().byItem.get(e),menuItemAdded:e=>{if(k||!j)return;const t=O().toISOString(),r={...(0,p.importedCard)(e,t),id:(0,f.uuid)(),signOff:null,allergensConfirmed:void 0,wasLive:!1,origin:'new',updatedBy:'Added to the menu'};L(r),B(r,r.updatedBy,'card created from the menu, awaiting sign-off')},menuEdited:(e,t,r,n)=>{const s=U().byItem.get(e);if(!s)return;let a=(0,f.editCard)(s,t,r,O().toISOString()).card;n&&a.signOff&&(a={...a,signOff:null,version:a.version+1,updatedAt:O().toISOString(),updatedBy:r}),a!==s&&(L(a),B(a,r,s.signOff&&!a.signOff?'edited from the menu, sign-off reset':'edited from the menu'))},signOff:(e,t)=>{const r=U().byItem.get(e);r&&M.signOff(r.id,{name:t,role:'head-chef'}).catch(()=>{})}}),(0,m.setRecipeCardRepository)(M);const x=e=>new Promise(t=>{e.hasHydrated()?t():e.onFinishHydration(()=>t())});Promise.all([x(S.useStore.persist),x(w.persist)]).then(()=>{j=!0,F(),S.useStore.subscribe((e,t)=>{e.menu!==t.menu&&F()})}),'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===(0,a.venueKey)(I)&&w.persist.rehydrate(),e.key===(0,a.venueKey)(y)&&E.persist.rehydrate()})},1168,[842,1198,1218,1085,5,1190,123,995,1191,1179,839,1188,1219,881,1220,1221,1222,1223,1224]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SYNC_STALE_MS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"READ_GIVE_UP_MS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"FAST_GIVE_UP_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"RETRY_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"LIVE_DOWN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"SILENT_MS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REBUILD_GAP_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"HEARTBEAT_MS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"TICK_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"SLEEP_GAP_MS",{enumerable:!0,get:function(){return b}}),_e.syncStale=function(t,n,s=e){const o='string'==typeof t?Date.parse(t):t??0;return!o||!Number.isFinite(o)||n-o>s},_e.superviseSync=function(e){const t=e.now??(()=>Date.now()),d=e.setInterval??((e,t)=>setInterval(e,t)),h=e.clearInterval??(e=>clearInterval(e)),S=e.setTimeout??((e,t)=>setTimeout(e,t));let _=!1,v=!1;const y={fastReads:0,fullReads:0,rebuilds:0,wakes:0,authRefreshes:0,heartbeats:0,givenUp:0};let p=0,E=0,P=0,w=0,A=t(),M=0;const O=async t=>{try{await t()}catch(n){if(!e.isAuthError(n))throw n;y.authRefreshes++,await e.refreshAuth(),await t()}},R=()=>{if(_)return;if(p&&t()-p{e.markServer(),e.flush()},()=>{v||_||(v=!0,S(()=>{v=!1,R()},s))}).finally(()=>{p===o&&(p=0)})},j=()=>{if(E&&t()-E<6e4)return;E&&y.givenUp++;const n=E=t();y.fullReads++,O(e.readAll).then(()=>{e.flush()},()=>{}).finally(()=>{E===n&&(E=0)})},I=t=>{e.wake?.(),R(),j(),e.flush()},L=[d(R,e.fastMs),d(j,6e4),d(()=>{const n=t();n-A>b&&(y.wakes++,I()),A=n,'SUBSCRIBED'===e.realtime()?w=0:w||(w=n);const s=e.lastServerAt()?n-e.lastServerAt():0;(w&&n-w>o||s>u)&&(t()-P=f&&e.heartbeat&&(M=t(),y.heartbeats++,e.heartbeat().catch(()=>{}))},l)],T=()=>{e.doc&&'hidden'===e.doc.visibilityState||I()},U=()=>I();e.doc?.addEventListener?.('visibilitychange',T);for(const t of['online','focus','pageshow'])e.win?.addEventListener?.(t,U);return{kick:I,stats:()=>({...y}),stop:()=>{_=!0;for(const e of L)h(e);e.doc?.removeEventListener?.('visibilitychange',T);for(const t of['online','focus','pageshow'])e.win?.removeEventListener?.(t,U)}}};const e=6e4,t=3e4,n=1e4,s=2e3,o=45e3,u=9e4,c=12e4,f=6e4,l=5e3,b=2e4},1169,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPABASE_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SUPABASE_ANON_KEY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isSupabaseConfigured",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"REALTIME_TABLES",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n="https://rowdoidkftriylijobuy.supabase.co",o="sb_publishable_rPm723MQz6FwmFVHy6e1SA_ko-_-6GR",u=()=>!t.PITCH&&n.startsWith('https://')&&o.length>20,s=['bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_counts']},1170,[2]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOON_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"setVenueWords",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"getVenueWords",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"setSessionMender",{enumerable:!0,get:function(){return l}}),e.askServer=async function o(c,u,p,l,f=!0){try{const b=(0,t.getSupabase)().functions.invoke(n,{body:{app:c,text:u,tools:p,...l?{receipt:l,spoken:!0,vocab:s}:{}}}),k=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),1e4)),{data:w,error:v}=await Promise.race([b,k]);return f&&'identity'===w?.reason&&await y()?o(c,u,p,l,!1):v||!w||!0!==w.ready||w.busy?{kind:'soon'}:w.call?.name?{kind:'call',name:String(w.call.name),args:w.call.args??{}}:'string'==typeof w.text&&w.text.trim()?{kind:'text',text:w.text.trim()}:{kind:'soon'}}catch{return{kind:'soon'}}},e.transcribe=async function n(o,c,u=8e3,p=!0){try{const l=/mp4|m4a|aac/.test(c.type)?'m4a':/ogg/.test(c.type)?'ogg':/wav/.test(c.type)?'wav':'webm',b=new FormData;b.append('app',o),s.length&&b.append('keyterms',JSON.stringify(s)),b.append('file',c,`speech.${l}`);const k=(0,t.getSupabase)().functions.invoke(f,{body:b}),w=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),u)),{data:v,error:x}=await Promise.race([k,w]);return x?{ok:!1,reason:'timeout'===String(x?.message)?'timeout':'offline'}:!0===v?.ok?{ok:!0,text:String(v.text??''),receipt:'string'==typeof v.receipt?v.receipt:void 0}:p&&'identity'===v?.reason&&await y()?n(o,c,u,!1):{ok:!1,reason:String(v?.reason??'busy'),text:'string'==typeof v?.text?v.text:void 0}}catch{return{ok:!1,reason:'offline'}}};var t=r(d[0]);const n='voice-assistant',o='Voice assistant is switching on soon. Until then I can do the everyday things, for example';let s=[];const c=t=>{s=t.slice(0,100)},u=()=>s;let p=null;const l=t=>{p=t};async function y(){try{return!!p&&await p()}catch{return!1}}const f='voice-transcribe'},1171,[872]); +__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}}},1172,[1190,995,1191]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"desktopStt",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"desktopSttState",{enumerable:!0,get:function(){return u}}),_e.warmDesktopStt=function(){o()&&l()},Object.defineProperty(_e,"cleanHeard",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"tabletWithoutMic",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canRecord",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"canListen",{enumerable:!0,get:function(){return w}}),_e.micPermission=b,Object.defineProperty(_e,"RATE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PRE_ROLL_MS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"HANG_MS",{enumerable:!0,get:function(){return A}}),_e.releaseMic=O,Object.defineProperty(_e,"echoWanted",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"micConstraints",{enumerable:!0,get:function(){return j}}),_e.warmMic=async function(){try{if(o()||!y())return;if(!S&&'granted'!==await b())return;if(await D(),C){C.armedUntil=Date.now()+1500;try{C.ctx.resume?.()}catch{}}x()}catch{}},_e.disarmMic=function(){C&&!C.rec&&(C.armedUntil=0,C.ring=[],C.ringLen=0)},_e.askMic=async function(){try{return await D(),x(),!0}catch{return!1}},_e.wavOf=L,Object.defineProperty(_e,"MAX_CLIP_MS",{enumerable:!0,get:function(){return _}}),_e.listen=B,Object.defineProperty(_e,"CloudRecognition",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"speechRecognizer",{enumerable:!0,get:function(){return N}}),_e.levelMeter=async function(e){const t=n()?.navigator?.mediaDevices,r=n()?.AudioContext||n()?.webkitAudioContext;if(!t?.getUserMedia||!r)return()=>{};let o,i,a=0,c=!1;try{if(o=await t.getUserMedia({audio:!0}),c)return o.getTracks().forEach(e=>e.stop()),()=>{};i=new r;const s=i.createMediaStreamSource(o),u=i.createAnalyser();u.fftSize=512,s.connect(u);const l=new Uint8Array(u.fftSize),d=()=>{u.getByteTimeDomainData(l);let t=0;for(let e=0;e{}}return()=>{c=!0;try{n().cancelAnimationFrame(a)}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}}},_e.yesNo=function(e){const t=e.toLowerCase().trim().replace(/[.!,]/g,'');return/^(yes|yeah|yep|yup|aye|confirm|confirmed|do it|go ahead|correct|that's right|ok|okay|yes please)\b/.test(t)?'yes':/^(no|nope|cancel|stop|don't|do not|wrong|never mind)\b/.test(t)?'no':null},Object.defineProperty(_e,"buzz",{enumerable:!0,get:function(){return W}});var e=_r(_d[0]),t=_r(_d[1]);const n=()=>'undefined'==typeof window?void 0:window,r=()=>n()?.ccDesktop,o=()=>!!r()?.stt&&!!r()?.sttWorker;let i=null,a=0;const c=new Map;let s='cold';const u=()=>s;function l(){if(i)return i;const e=n()?.Worker,t=r()?.sttWorker;return e&&t?(i=new e(t,{type:'module'}),s='loading',i.onmessage=e=>{const t=e.data??{};if(t.ready)return void(s='ready');t.failed&&(s='failed');const n=c.get(t.id);n&&(c.delete(t.id),n(t))},i.onerror=()=>{s='failed',c.forEach(e=>e({error:'stt-failed'})),c.clear()},i.postMessage({warm:!0}),i):null}const d=e=>e.replace(/\[[^\]]*\]|\([^)]*\)/g,' ').replace(/\s+/g,' ').trim();function f(e,t){let o,i,s,u,f=!1,p=!1;const y=[];let w=16e3;const b=()=>{try{s?.disconnect(),u?.disconnect()}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}if(p)return;const n=y.reduce((e,t)=>e+t.length,0);if(n<.35*w)return void t('');const r=new Float32Array(n);let f=0;for(const e of y)r.set(e,f),f+=e.length;const b=16e3===w?r:h(r,w,16e3),v=l();if(!v)return void t('','stt-failed');e('Turning speech into text on this Mac\u2026');const M=++a;c.set(M,e=>t(d(e.text??''),e.error)),v.postMessage({id:M,audio:b},[b.buffer])};return(async()=>{try{if(r()?.askMic){if(!await r().askMic())return void t('','not-allowed')}if(o=await n().navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),f)return void b();const e=n().AudioContext||n().webkitAudioContext;try{i=new e({sampleRate:16e3})}catch{i=new e}w=i.sampleRate,u=i.createMediaStreamSource(o),s=i.createScriptProcessor(4096,1,1),s.onaudioprocess=e=>{f||y.push(new Float32Array(e.inputBuffer.getChannelData(0)))},u.connect(s),s.connect(i.destination),l()}catch(e){t('','NotAllowedError'===e?.name?'not-allowed':'audio-capture')}})(),{stop:()=>{f||(f=!0,b())},abort:()=>{p=!0,f=!0,b()}}}function h(e,t,n){const r=Math.round(e.length*n/t),o=new Float32Array(r),i=t/n;for(let t=0;t{const e=String(n()?.navigator?.userAgent??'');return/CoverChargeTablet\//.test(e)&&!/CoverChargeTablet\/[\d.]+ mic/.test(e)},y=()=>!p()&&!(!n()?.MediaRecorder||!n()?.navigator?.mediaDevices?.getUserMedia),w=()=>o()||y();async function b(){try{const e=n()?.navigator?.permissions?.query;if(!e)return'unknown';const t=await Promise.race([n().navigator.permissions.query({name:'microphone'}),new Promise(e=>setTimeout(()=>e(null),1500))]);return'granted'===t?.state||'denied'===t?.state||'prompt'===t?.state?t.state:'unknown'}catch{return'unknown'}}const v=16e3,M=500,A=450;let P,S=null,T=!1,k=!1,C=null;function U(){const e=C;if(C=null,e){try{e.node.disconnect(),e.src.disconnect()}catch{}try{e.ctx.close()}catch{}e.ring=[],e.rec=null}}function O(){clearTimeout(P),U();try{S?.getTracks().forEach(e=>e.stop())}catch{}S=null}const x=()=>{clearTimeout(P),P=setTimeout(O,/iPhone|iPad|iPod|Macintosh/.test(String(n()?.navigator?.userAgent??''))&&!r()?.mac?6e5:6e4)},R=()=>!1,j=(e=R())=>({audio:{channelCount:{ideal:1},sampleRate:{ideal:v},sampleSize:{ideal:16},echoCancellation:e,noiseSuppression:!0,autoGainControl:!0}});async function D(){clearTimeout(P);const e=R();if(S&&T===e&&S.getAudioTracks().some(e=>'live'===e.readyState))return S;if(S&&O(),S=await n().navigator.mediaDevices.getUserMedia(j(e)),T=e,!k){k=!0;try{n().document.addEventListener('visibilitychange',()=>{'hidden'===n().document.visibilityState&&O()})}catch{}}return E(S),S}function E(e){U();try{const t=n().AudioContext||n().webkitAudioContext;if(!t)return;let r;try{r=new t({sampleRate:v})}catch{r=new t}const o=r.createMediaStreamSource(e),i=r.createScriptProcessor(2048,1,1),a={ctx:r,node:i,src:o,rate:r.sampleRate,ring:[],ringLen:0,rec:null,frames:0,armedUntil:0,level:()=>{}},c=Math.round(.5*a.rate);i.onaudioprocess=e=>{const t=new Float32Array(e.inputBuffer.getChannelData(0));if(a.frames+=t.length,a.rec&&a.rec.push(t),!a.rec&&Date.now()>a.armedUntil)return a.ring=[],void(a.ringLen=0);for(a.ring.push(t),a.ringLen+=t.length;a.ring.length>1&&a.ringLen-a.ring[0].length>=c;)a.ringLen-=a.ring[0].length,a.ring.shift();let n=0;for(let e=0;ee+t.length,0),r=new Float32Array(n);let o=0;for(const t of e)r.set(t,o),o+=t.length;const i=t===v?r:h(r,t,v),a=new ArrayBuffer(44+2*i.length),c=new DataView(a),s=(e,t)=>{for(let n=0;n{clearTimeout(c),clearTimeout(s),S&&(S.rec=null,S.level=()=>{}),x()},k=(e,t,n)=>{h||f||(h=!0,o(e,t,n))};let U=!1;const O=async()=>{if(U)return;U=!0;const n=b,o=S?S.frames-P:0;if(T(),f)return;const i=Date.now()-y,a=!!n&&n.length>0&&o/M*1e3>.6*i?L(n,M):new Blob(w,{type:(p?.mimeType||w[0]?.type||'audio/webm').split(';')[0]});if(i<350||a.size<500)return void k('');r('Turning speech into text\u2026');const c=await(0,e.transcribe)(t,a);c.ok?k(c.text.trim(),void 0,{receipt:c.receipt}):k('',c.reason,{message:c.text})};(async()=>{try{const e=await D();if(d)return T(),void k('');if(S=C,S){try{S.ctx.resume?.()}catch{}b=[...S.ring],M=S.rate,P=S.frames-S.ringLen,S.rec=b,S.level=e=>{i?.(e),a&&!d&&(e>.12?(u=!0,l=0):u&&e<.05&&(l=l||Date.now(),Date.now()-l>1500&&j()))}}const t=F();p=new(n().MediaRecorder)(e,t?{mimeType:t,audioBitsPerSecond:48e3}:void 0),p.ondataavailable=e=>{e.data?.size&&w.push(e.data)},p.onstop=()=>{O()},p.onerror=()=>{b?.length?O():(T(),k('','audio-capture'))},p.start(),y=Date.now(),c=setTimeout(()=>{r('That\u2019s the 30-second limit. Sending now\u2026'),R()},_)}catch(e){T(),k('','NotAllowedError'===e?.name||'SecurityError'===e?.name?'not-allowed':'audio-capture')}})();const R=()=>{try{p&&'inactive'!==p.state?p.stop():O()}catch{O()}},j=()=>{d||(d=!0,p&&(s=setTimeout(R,a?0:A)))};return{stop:j,abort:()=>{f=!0,d=!0,clearTimeout(s);try{p&&'inactive'!==p.state&&p.stop()}catch{}T()}}}function B(e,t,n="owner",r,i=!1){return o()?f(e,t):y()?z(n,e,t,r,i):null}class I{lang='en-GB';interimResults=!1;continuous=!1;maxAlternatives=1;onresult=null;onerror=null;onend=null;l=null;start(){const e='customer'===t.APP_VARIANT?'owner':t.APP_VARIANT;if(this.l=B(()=>{},(e,t)=>{if(this.l=null,t)this.onerror?.({error:t});else if(e){const t=Object.assign([{transcript:e,confidence:1}],{isFinal:!0});this.onresult?.({resultIndex:0,results:[t]})}this.onend?.()},e,void 0,!0),!this.l)throw new Error('not-supported')}stop(){this.l?.stop()}abort(){const e=this.l;this.l=null,e?.abort(),e&&this.onend?.()}}const N=()=>w()?I:null;const W=(e=30)=>{try{n()?.navigator?.vibrate?.(e)}catch{}}},1173,[1171,807]); +__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.`},1174,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.currentCanChangeBookings=function(){const o=t.useSession.getState().meId;if(!o)return!0;const u=n.useOwner.getState().staff.find(n=>n.id===o&&n.active);return(0,s.canChangeBookings)(u)};var n=r(d[0]),t=r(d[1]),s=r(d[2])},1175,[863,866,992]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s}/${n}/${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1176,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const f=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),k=c(t),h=k&&(0,n.validPastDate)(o,u)?`${f}:${o}:${y}`:'',[p,v]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void v({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&v({key:h,data:t,error:''})}).catch(t=>{e&&v({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:k,data:h&&p.key===h?p.data:null,error:h&&p.key===h?p.error:''}},_e.kitchenHistoryAccess=y,_e.lookupKitchenHistory=f,_e.useKitchenHistory=function(t,o,u,c,l=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),h=y(t),p=h&&(0,n.validPastDate)(o,c)&&(0,n.validPastDate)(u,c)&&o<=u?`${k}:${o}:${u}:${l}`:'',[v,w]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!p)return void w({key:'',data:null,error:''});let e=!0;return f(t,o,u).then(t=>{e&&w({key:p,data:t,error:''})}).catch(t=>{e&&w({key:p,data:null,error:t.message})}),()=>{e=!1}},[p,t,o,u]),{allowed:h,data:p&&v.key===p?v.data:null,error:p&&v.key===p?v.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:f}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(f||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}function y(e){const t=s.useSync.getState();return'staff'===t.kind&&t.venueSlug===e&&!!t.venueId&&['*','staff.manage','recipes.signoff','recipes.edit'].some(e=>t.perms.includes(e))}async function f(e,t,n){if(!y(e))throw new Error('Booking history needs the Head Chef app signed in to the venue.');const o=(0,u.getSupabase)(),{data:c,error:l}=await o.rpc('kitchen_booking_history',{p_venue:s.useSync.getState().venueId,p_from:t,p_to:n});if(l||!c||!Array.isArray(c.days))throw new Error('Booking history could not be loaded. Check the connection and try again.');return c}},1177,[31,807,1176,822,824,872]); +__d(function(_g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.clockAction=async function(n,u){if((0,t.privateClockVenue)(u.rid)&&'in'!==n)return c(n,u,{action:n,at:u.at,inside:null,unchecked:!0});const f=(0,a.areaOf)(u.rid),k=f.on&&null!=f.lat&&null!=f.lng,l=k?await(u.fixFn??r.getFix)():'unavailable';if((0,t.privateClockVenue)(u.rid)&&'object'==typeof l&&(!Number.isFinite(l.acc)||l.acc>150))return{ok:!1,message:'Your phone\u2019s location is not accurate enough to confirm you are at the pub. Enable precise location, step near a window and try again, or ask a manager to record your clock-in with a reason.'};const g=k&&'object'!=typeof l?(0,s.locWhere)():'browser',p=(0,o.gate)(f,n,k?l:'unavailable',u.at,g);if(!p.allowed){const a='object'==typeof l?void 0:'app'===g&&'denied'===l?'settings':'app-phone-off'===g?'location':'app-old'===g&&'denied'===l?'update':void 0;return'update'===a&&(0,s.checkAppUpdate)(),{ok:!1,message:(p.message??'You need to be at the venue.')+((0,t.privateClockVenue)(u.rid)?' Ask a manager to record your clock-in with a reason using Record it for someone.':''),fix:a}}const w=c(n,u,p.geo);return w.ok&&p.warn?{...w,warn:p.warn}:w},e.managerClockAction=function(t,a,r,s){const u=(0,o.overrideGeo)(t,a.at,r,s);if(!u)return{ok:!1,message:'Type a short reason (at least 3 letters).'};const f=n.useOwner.getState().staff.find(t=>t.id===a.staffId)?.name??'staff',k=c(t,a,u,{adjusted:{by:r.name,at:a.at,reason:u.override.reason}});if(k.ok){const o={in:'clocked in',out:'clocked out',break_start:'started a break for',break_end:'ended a break for'}[t],s=`${r.name} ${o} ${f} (manager, no location check): ${u.override.reason}`;n.useOwner.setState(t=>({attLog:[{id:`al-${Date.now().toString(36)}`,at:a.at,text:s},...t.attLog]}))}return k};var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),o=_r(d[3]),r=_r(d[4]),s=_r(d[5]);function c(a,o,r,s={}){const c=(0,t.venueClockGeo)(o.rid,r),u=c?!1!==c.inside:void 0,f=n.useOwner.getState(),k=(0,n.openShiftOf)(f.attendance,o.staffId,o.at);if('in'===a){if(k)return{ok:!1,message:'You\u2019re already clocked in.'};f.clock(o.staffId,o.date,'in',o.at,u);const t=(0,n.openShiftOf)(n.useOwner.getState().attendance,o.staffId,o.at);return t&&n.useOwner.getState().patchAttendance(t.id,{...o.offRota?{offRota:!0}:{},...s},c),{ok:!0,att:t&&n.useOwner.getState().attendance.find(a=>a.id===t.id)}}if(!k)return{ok:!1,message:'You\u2019re not clocked in.'};if('out'===a){let t=o.breakMins;if(o.addedBreak&&o.addedBreak>0&&!k.breaks?.length){const a=new Date(o.at).getTime(),r=new Date(Math.max(new Date(k.in).getTime(),a-6e4*o.addedBreak)).toISOString();n.useOwner.getState().patchAttendance(k.id,{breaks:[{start:r,end:o.at}],breakAddedAtClockOut:o.addedBreak}),t=Math.round((a-new Date(r).getTime())/6e4)}return n.useOwner.getState().clock(o.staffId,o.date,'out',o.at,u,t),n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}}return n.useOwner.getState().breakToggle(o.staffId,'break_start'===a?'start':'end',o.at)?(n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}):{ok:!1,message:'break_start'===a?'You\u2019re already on a break.':'You\u2019re not on a break.'}}},1178,[869,1294,863,870,871,1412]); +__d(function(_g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canEditCards",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canSignOffCards",{enumerable:!0,get:function(){return r}}),e.maySignOff=function(t,n){return'staff'!==t.role&&('head-chef'===t.role||('head-chef'===t.actual||!('owner'!==t.role&&'manager'!==t.role||'owner'!==t.actual&&'manager'!==t.actual)||!!n.createdBy&&t.name.trim()===n.createdBy.trim()&&'head-chef'===n.createdByRole))},Object.defineProperty(e,"SIGNER_ROLE_LABEL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"signerLabel",{enumerable:!0,get:function(){return o}}),e.cardActorFor=function(t,n,r){const i=r?'Head Chef'===r.level&&'staff'===r.role?'head-chef':r.role:n;return{name:t,role:n,actual:i}},Object.defineProperty(e,"MAX_RECIPE_PHOTOS",{enumerable:!0,get:function(){return a}}),e.cardPhotos=s,e.suggestForIngredient=d,e.suggestAllergens=u,Object.defineProperty(e,"suggestedBy",{enumerable:!0,get:function(){return f}}),e.unresolved=g,e.applySuggestions=function(t){const n={...t.allergens};for(const r of g(t))n[r]='contains';return n},Object.defineProperty(e,"cardState",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"STATE_LABEL",{enumerable:!0,get:function(){return h}}),e.signOffBlock=function(t){if(!t.dish.trim())return'Give the dish a name first.';const n=g(t);return n.length?`Check the suggested allergens first: ${n.map(p).join(', ')}.`:t.allergensConfirmed?null:'Confirm the allergen list first.'},Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"CONTENT_FIELDS",{enumerable:!0,get:function(){return y}}),e.editCard=function(t,n,r,i){const{confirmAllergens:o,...a}=n,l={...a};l.photos&&_(s({photo:l.photo??t.photo,photos:l.photos}),s(t))&&(delete l.photos,void 0!==l.photo&&l.photo!==(t.photo??s(t)[0])||delete l.photo);const c=Object.keys(l).filter(n=>!_(l[n],t[n]));let d={...t};for(const t of c)d[t]=l[t];const f=c.some(t=>'allergens'===t||'dismissed'===t||'ingredients'===t);f&&!_(u(d.ingredients),u(t.ingredients))&&(d.allergensConfirmed=void 0);f&&(c.includes('allergens')||c.includes('dismissed'))&&(d.allergensConfirmed=void 0);let m=!1;!o||d.allergensConfirmed||g(d).length||(d.allergensConfirmed={by:r,at:i},m=!0);const h=c.length>0||m,p=c.length>0&&!!t.signOff;if(!h)return{card:t,changed:!1,resetSignOff:!1};c.length&&(d={...d,signOff:null,version:t.version+1});return{card:{...d,updatedAt:i,updatedBy:r},changed:h,resetSignOff:p}},e.signOffCard=function(t,n,r){return{...t,signOff:{by:n,at:r},wasLive:!0,updatedAt:r,updatedBy:n}},e.unsignedOldestFirst=function(t,n){return t.filter(t=>!t.signOff).map((t,r)=>{const i=n(t);return{item:t,card:i,at:i?.createdAt||null,order:r}}).sort((t,n)=>(t.at&&n.at?t.at.localeCompare(n.at):t.at?-1:n.at?1:0)||t.order-n.order)},e.addedLabel=function(t){const n=t?new Date(t.length<=10?`${t}T12:00:00`:t):null;return n&&!isNaN(+n)?`Added ${n.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}`:'Date not recorded'},e.allergenSentence=function(n){const r=t.ALLERGENS.filter(t=>'contains'===n[t.id]).map(t=>t.short.toLowerCase()),i=t.ALLERGENS.filter(t=>'may'===n[t.id]).map(t=>t.short.toLowerCase());return r.length||i.length?[r.length?`Contains ${r.join(', ')}.`:'',i.length?`May contain ${i.join(', ')}.`:''].filter(Boolean).join(' '):'No allergens listed yet.'},Object.defineProperty(e,"isRetiredMiniAnchors",{enumerable:!0,get:function(){return O}}),e.overlayItem=function(t,n){return n?{...t,name:n.dish,section:n.section,price:n.price,allergens:n.allergens,allergenNotes:n.allergenNotes,signOff:n.signOff?{by:n.signOff.by,at:n.signOff.at.slice(0,10)}:null,hidden:t.hidden||!n.signOff&&!n.wasLive||O(t.id)||O(n.menuItemId),recipeCardId:n.id}:O(t.id)?{...t,hidden:!0}:t},e.dishesFor=function(t,n){const r=t.filter(t=>!t.hidden),i=r.filter(t=>n.some(n=>'contains'===t.allergens[n])),o=r.filter(t=>!i.includes(t)&&n.some(n=>'may'===t.allergens[n])),a=r.filter(t=>!i.includes(t)&&!o.includes(t));return{contains:i,may:o,free:a}},e.filterCards=function(t,n,r,i="free-from"){const o=n.toLowerCase().split(/\s+/).filter(Boolean);return t.filter(t=>{const n=[t.dish,t.section,...t.ingredients.map(t=>t.name)].join(' ').toLowerCase();return!!o.every(t=>n.includes(t))&&(!r.length||('free-from'===i?r.every(n=>!t.allergens[n]):r.some(n=>!!t.allergens[n])))})},e.uuid=function(){const t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();const n=Array.from({length:16},()=>Math.floor(256*Math.random()));n[6]=15&n[6]|64,n[8]=63&n[8]|128;const r=n.map(t=>t.toString(16).padStart(2,'0')).join('');return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`},e.uuidFrom=function(t){let n='';for(let r=0;r<4;r++){let i=2166136261^2654435761*r;for(let n=0;n>>0;n+=i.toString(16).padStart(8,'0')}const r=n.slice(0,12)+'4'+n.slice(13,16)+(3&parseInt(n[16],16)|8).toString(16)+n.slice(17,32);return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`},Object.defineProperty(e,"RECIPE_CARD_EXTRA_COLUMNS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STEP_SEP",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"photoPath",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"RECIPE_PHOTO_BUCKET",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"RECIPE_CARD_TABLE",{enumerable:!0,get:function(){return S}}),e.cardToRow=function(t,n){return{row:{id:t.id,venue_id:n,dish:t.dish,ingredients:t.ingredients.map(({name:t,qty:n,unit:r,allergens:i})=>({name:t,qty:n,unit:r,...i?.length?{allergens:i}:{}})),method:t.steps.join(w),allergens:b(t.allergens,'contains'),may_contain:b(t.allergens,'may'),photo_url:!t.photo||t.photo.startsWith('local:')||t.photo.startsWith('asset:')?null:t.photo,signed_off_by:t.signOff?.by??null,signed_off_at:t.signOff?.at??null,updated_at:t.updatedAt},extra:{menu_item_id:t.menuItemId,section:t.section,price_pence:t.price,dismissed:t.dismissed,allergen_notes:t.allergenNotes??null,allergens_confirmed_by:t.allergensConfirmed?.by??null,allergens_confirmed_at:t.allergensConfirmed?.at??null,was_live:t.wasLive,origin:t.origin,version:t.version,updated_by:t.updatedBy}}},e.rowToCard=function(t,n,r={}){const i={};t.may_contain.forEach(t=>{i[t]='may'}),t.allergens.forEach(t=>{i[t]='contains'});const o=t.updated_at??(new Date).toISOString();return{id:t.id,restaurantId:n,menuItemId:r.menu_item_id??t.id,dish:t.dish,section:r.section??'Mains',price:r.price_pence??null,photo:t.photo_url??void 0,ingredients:t.ingredients.map((n,r)=>({id:`${t.id}-i${r}`,...n})),steps:t.method?t.method.split(w).filter(t=>t.trim()):[],allergens:i,dismissed:r.dismissed??[],allergenNotes:r.allergen_notes??void 0,allergensConfirmed:r.allergens_confirmed_by?{by:r.allergens_confirmed_by,at:r.allergens_confirmed_at}:void 0,signOff:t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:t.signed_off_at}:null,wasLive:r.was_live??!!t.signed_off_by,origin:r.origin??'new',version:r.version??1,createdAt:o,updatedAt:o,updatedBy:r.updated_by??''}};var t=_r(_d[0]);const n=t=>'head-chef'===t||'manager'===t||'owner'===t,r=t=>'head-chef'===t||'manager'===t||'owner'===t;const i={'head-chef':'Head Chef',manager:'Manager',owner:'Owner',staff:'Staff'},o=t=>`${t.name}, ${i[t.actual??t.role]}`;const a=5;function s(t){const n=(t.photos??[]).filter(t=>!!t);return[...t.photo&&!n.includes(t.photo)?[t.photo]:[],...n].slice(0,a)}const l=[[/\b(flour(?!y)|wheat|bread|crumb|panko|pastry|brioche|buns?\b|crouton|crostini|batter|beer|ale\b|lager|stout|barley|malt|rye|spelt|oat|couscous|semolina|pasta|penne|macaroni|spaghetti|noodle|biscuit|sponge|crumble|roux|tempura|digestive|self.raising)/i,['gluten']],[/\b(prawn|langoustine|lobster|crab|shrimp|crayfish|scampi|shellfish)/i,['crustaceans']],[/\b(mussel|scallop|clam|cockle|squid|calamari|octopus|whelk|winkle|oyster(?! mushroom)|oyster sauce)/i,['molluscs']],[/\b(egg|mayonnaise|mayo|aioli|tartare|hollandaise|meringue|custard|brioche|bearnaise)/i,['eggs']],[/\b(fish(?!er)|haddock|cod|salmon|hake|anchov|tuna|mackerel|trout|sea bass|monkfish|pollock|halibut|kipper|worcester|fish sauce|caesar)/i,['fish']],[/\b(peanut|groundnut|satay)/i,['peanuts']],[/\b(almond|hazelnut|walnut|cashew|pecan|pistachio|macadamia|brazil nut|praline|frangipane|marzipan|pesto)/i,['treenuts']],[/\b(soy|soya|tofu|edamame|miso|tamari|tempeh)/i,['soya']],[/\b(milk|butter(?!nut)|cream|cheese|cheddar|parmesan|mozzarella|brie|yoghurt|yogurt|cr[e\xe8]me|ghee|ice cream|custard|butterscotch|toffee|fudge|buttermilk|mascarpone|ricotta|whey)/i,['milk']],[/\b(celery|celeriac|stock cube|beef stock|chicken stock|veg(etable)? stock)/i,['celery']],[/\b(mustard|dijon|vinaigrette|piccalilli)/i,['mustard']],[/\b(sesame|tahini|hummus|houmous)/i,['sesame']],[/\b(wine|vinegar|dried apricot|dried fruit|sulphite|sulfite|prosecco|cider|port\b|sherry|dates?\b|raisin|sultana)/i,['sulphites']],[/\blupin/i,['lupin']]],c=[[/gluten.free|\bgf\b/i,'gluten'],[/dairy.free|vegan (butter|cheese|cream)|oat milk|plant.based/i,'milk'],[/egg.free|vegan mayo/i,'eggs']];function d(n){const r=new Set(n.allergens??[]);for(const[t,i]of l)t.test(n.name)&&i.forEach(t=>r.add(t));for(const[t,i]of c)t.test(n.name)&&!(n.allergens??[]).includes(i)&&r.delete(i);return t.ALLERGENS.map(t=>t.id).filter(t=>r.has(t))}function u(n){const r=new Set(n.flatMap(d));return t.ALLERGENS.map(t=>t.id).filter(t=>r.has(t))}const f=(t,n)=>t.filter(t=>d(t).includes(n)).map(t=>t.name);function g(t){return u(t.ingredients).filter(n=>!t.allergens[n]&&!t.dismissed.includes(n))}const m=t=>t.signOff?'signed-off':'awaiting',h={'signed-off':'Signed off',awaiting:'Awaiting sign-off'};const p=n=>t.ALLERGENS.find(t=>t.id===n)?.short??n,b=(n,r)=>t.ALLERGENS.filter(t=>r?n[t.id]===r:!!n[t.id]).map(t=>t.id),y=['dish','section','price','photo','photos','createdBy','ingredients','steps','allergens','dismissed','allergenNotes'],_=(t,n)=>JSON.stringify(t??null)===JSON.stringify(n??null);const O=t=>'a-mini'===t;const v={menu_item_id:'text',section:'text',price_pence:'integer null',dismissed:'text[]',allergen_notes:'text',allergens_confirmed_by:'text',allergens_confirmed_at:'timestamptz',was_live:'boolean',origin:'text',version:'integer',updated_by:'text'},w='\n',E=(t,n)=>`${t}/${n.id}-v${n.version}.jpg`,C='recipe-photos',S='recipe_cards'},1179,[819]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ACCIDENT_CATEGORIES",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"RIDDOR_CATEGORIES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"sid",{enumerable:!0,get:function(){return u}}),_e.isSeedAccident=S,_e.upgradeTempUnits=k,Object.defineProperty(_e,"useSafety",{enumerable:!0,get:function(){return w}});var e,t=r(_d[0]),i=r(_d[1]),n=r(_d[2]),a=r(_d[3]),s=(e=a)&&e.__esModule?e:{default:e},o=r(_d[4]),d=r(_d[5]),c=r(_d[6]);const l=['Near miss','Slip, trip or fall','Cut','Burn or scald','Manual handling','Struck by an object','Allergic reaction','Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days','Other'],p=['Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days'];let f=0;const u=e=>`${e}-${Date.now().toString(36)}${(f++).toString(36)}`,h=(e,t,i)=>({id:e,when:t,location:'',person:'',personType:'Staff',category:'Near miss',what:'',injury:'None',firstAid:'None needed',witnesses:'',reportedBy:'',reportedById:'',app:'staff',createdAt:`${t}:00`,...i});function y(){const e=new Date,t=(t,i)=>{const n=new Date(e);return n.setDate(n.getDate()-t),`${n.toISOString().slice(0,10)}T${i}`};return[h('acc-ex1',t(3,'19:40'),{location:'Kitchen pass',person:'Server (example)',category:'Near miss',what:'Example: water on the floor by the pass after the glass washer leaked. Nobody slipped.',firstAid:'None needed',witnesses:'Bar (example)',reportedBy:'Server (example)',reportedById:'st-4',app:'staff'}),h('acc-ex2',t(6,'12:15'),{location:'Kitchen: fryer section',person:'Head Chef (example)',category:'Burn or scald',what:'Example: splash of hot oil on the back of the hand while changing the basket.',injury:'Small burn, back of left hand',firstAid:'Cooled under running water for 20 minutes, sterile dressing',witnesses:'None',reportedBy:'Head Chef (example)',reportedById:'st-3',app:'chef'})]}function S(e){const t=({when:e,createdAt:t,...i})=>JSON.stringify(i);return y().some(i=>i.id===e.id&&t(i)===t(e))}function k(e){const t=Object.fromEntries(c.DEFAULT_POINTS.map(e=>[e.id,e])),i=new Set(['cp-prep','cp-bar','cp-freezer']);let n=e.map(e=>'cp-walkin'===e.id?{...e,archived:!0,due:[],aliases:[]}:i.has(e.id)?{...e,name:t[e.id].name,location:t[e.id].location,kind:t[e.id].kind,max:t[e.id].max,due:t[e.id].due,aliases:t[e.id].aliases,archived:!1}:e);const a=new Set(n.map(e=>e.id)),s=c.DEFAULT_POINTS.filter(e=>!a.has(e.id)),o=c.DEFAULT_POINTS.filter(e=>s.includes(e)&&('fridge'===e.kind||'freezer'===e.kind)),d=s.filter(e=>!o.includes(e));let l=-1;n.forEach((e,t)=>{'fridge'!==e.kind&&'freezer'!==e.kind||(l=t)}),n=[...n.slice(0,l+1),...o,...n.slice(l+1),...d];const p=n.filter(e=>'fridge'===e.kind||'freezer'===e.kind),f=[...p.filter(e=>'fridge'===e.kind),...p.filter(e=>'freezer'===e.kind)];let u=0;return n.map(e=>'fridge'===e.kind||'freezer'===e.kind?f[u++]:e)}const w=(0,o.create)()((0,d.persist)(e=>({points:c.DEFAULT_POINTS,entries:[],accidents:n.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:y(),probes:[],diary:[],daySigns:[],weekly:[],inspectorSends:[],logInspectorSend:t=>e(e=>({inspectorSends:[{...t,id:u('ins')},...e.inspectorSends??[]]})),addNote:t=>e(e=>({diary:[{...t,id:u('dn')},...e.diary??[]]})),signDay:t=>e(e=>({daySigns:[...(e.daySigns??[]).filter(e=>e.date!==t.date),t]})),signWeek:t=>e(e=>({weekly:[{...t,id:u('wk')},...(e.weekly??[]).filter(e=>e.week!==t.week)]})),addProbe:t=>e(e=>({probes:[...e.probes??[],{...t,id:u('pr'),status:'not-connected'}]})),removeProbe:t=>e(e=>({probes:(e.probes??[]).filter(e=>e.id!==t)})),addEntries:t=>e(e=>({entries:[...t.map(e=>({...e,id:`${u('hc')}${Math.random().toString(36).slice(2,7)}`})),...e.entries]})),setPoint:(t,i)=>e(e=>({points:e.points.map(e=>e.id===t?{...e,...i}:e)})),addPoint:t=>e(e=>({points:[...e.points,{...t,id:`${u('cp')}${Math.random().toString(36).slice(2,6)}`}]})),resetPoints:()=>e({points:c.DEFAULT_POINTS}),addAccident:t=>e(e=>({accidents:[{...t,id:u('acc'),createdAt:(new Date).toISOString()},...e.accidents]})),setRiddorNote:(t,i)=>e(e=>({accidents:e.accidents.map(e=>e.id===t?{...e,riddorNote:i}:e)}))}),{name:'covercharge-safety-v1',storage:(0,d.createJSONStorage)(()=>s.default),version:5,migrate:async(e,n)=>{if(t.LIVE_VENUE_BUILD&&e&&await(0,i.archiveChefCache)('safety',e),e&&n<2){const t=new Set((e.points??[]).map(e=>e.id));e.points=[...e.points??[],...c.DEFAULT_POINTS.filter(e=>!t.has(e.id))],e.diary=e.diary??[],e.daySigns=e.daySigns??[],e.weekly=e.weekly??[]}return e&&n<5&&(e.points=k(e.points??[])),t.LIVE_VENUE_BUILD&&e&&(e.accidents=(e.accidents||[]).filter(e=>!S(e))),e}}))},1180,[842,1198,5,1190,995,1191,1187]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"libraryRowId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"personRowId",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"tickId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"personKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"useDailyTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"tasksOf",{enumerable:!0,get:function(){return O}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]);const l=e=>(0,o.uuidFrom)(`daily-task-library:${e}`),y=(e,t)=>(0,o.uuidFrom)(`daily-tasks:${e}:${t}`),b=(e,t,i,s)=>(0,o.uuidFrom)(`daily-task-tick:${e}:${(0,u.tickKey)(t,i,s)}`),f=()=>(new Date).toISOString(),k=(e,t)=>`${e}|${t}`,p=e=>u.DEFAULT_LIBRARY.map((t,i)=>({id:(0,o.uuidFrom)(`daily-task-lib:${e}:${i}`),text:t})),L=(0,s.create)()((0,n.persist)((e,t)=>({library:{},people:{},ticks:[],ensure:i=>{t().library[i]||e(e=>({library:{...e.library,[i]:{items:p(i)}}}))},setLibrary:(t,i)=>e(e=>({library:{...e.library,[t]:{items:i,updatedAt:f()}}})),addLibrary:(e,i)=>{const s=(0,u.cleanTaskText)(i);if(!s)return;const n=t().library[e]?.items??p(e);n.some(e=>e.text.toLowerCase()===s.toLowerCase()&&!e.archived)||t().setLibrary(e,[...n,{id:(0,c.uuid)(),text:s}])},setTasks:(t,i,s)=>e(e=>({people:{...e.people,[k(t,i)]:{tasks:s,updatedAt:f()}}})),addTask:(e,i,s,n)=>{const o=(0,u.cleanTaskText)(s);if(!o)return;const l=t().people[k(e,i)]?.tasks??[];l.some(e=>e.text.toLowerCase()===o.toLowerCase())||t().setTasks(e,i,[...l,{id:(0,c.uuid)(),text:o,...n?{libraryId:n}:{}}])},toggleTick:(t,i,s,n,o)=>e(e=>{const u=b(t,i,s,n);if(e.ticks.some(e=>e.id===u))return{ticks:e.ticks.filter(e=>e.id!==u)};const c=new Date(Date.now()-12096e5).toISOString().slice(0,10);return{ticks:[...e.ticks.filter(e=>e.forDate>=c),{id:u,rid:t,staffRef:i,taskId:s,forDate:n,byRef:o.id,byName:o.name,at:f()}]}}),resetLibrary:e=>t().setLibrary(e,p(e))}),{name:'covercharge-daily-tasks-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)})),O=(e,t)=>L.getState().people[k(e,t)]?.tasks??[]},1181,[1190,995,1191,1179,1182,1099]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TASK_MAX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanTaskText",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"appliesOn",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tasksFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"tickKey",{enumerable:!0,get:function(){return u}}),e.progress=function(t,n,o,u,c){const s=i(t,c),f=new Set(n.filter(t=>t.staffRef===o&&t.forDate===u).map(t=>t.taskId));return{done:s.filter(t=>f.has(t.id)).length,total:s.length}},e.move=function(t,n,o){const i=n+o;if(n<0||i<0||n>=t.length||i>=t.length)return t;const u=[...t];return[u[n],u[i]]=[u[i],u[n]],u},Object.defineProperty(e,"hasTask",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_LIBRARY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TASK_DAY_NAMES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isHeadChefP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isKitchenP",{enumerable:!0,get:function(){return d}}),e.canEditTasks=function(t,n){return!!t&&('owner'===t.role||'manager'===t.role||!!l(t)&&(t.id!==n.id&&'staff'===n.role&&!l(n)&&d(n)))};const t=80,n=n=>n.replace(/\s+/g,' ').trim().slice(0,t),o=(t,n)=>!t.days||0===t.days.length||t.days.includes(n),i=(t,n)=>t.filter(t=>o(t,n)),u=(t,n,o)=>`${t}|${n}|${o}`;const c=(t,o)=>t.some(t=>t.text.toLowerCase()===n(o).toLowerCase()),s=['Restock the bar fridges','Wipe down the menus','Check the toilets','Set the tables','Polish glasses','Empty the bins','Clean the coffee machine','Take out the recycling'],f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=t=>'staff'===t.role&&('Head Chef'===t.level||/^head chef/i.test(t.job??'')),d=t=>'kitchen'===(t.dept??'').trim().toLowerCase()},1182,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LEGAL_LIMIT_MINS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_BREAK_RULES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"REMINDER_WINDOW_MINS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CHAIRS_TEXT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ANCHORAGE_CHAIRS_DAYS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultChairs",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AUDIENCE_LABEL",{enumerable:!0,get:function(){return s}}),e.clampRules=c,Object.defineProperty(e,"validTime",{enumerable:!0,get:function(){return d}}),e.ukClock=l,e.reminderDue=function(t,n){const i=l(n);if(t.paused||!d(t.time)||!t.days.includes(i.dow))return{due:!1,forDate:i.ymd};const o=f(t.time);return{due:i.mins>=o&&i.mins=t.shiftEnd))return null;const r=b(t).filter(n=>n.at<=t.now),i=r.length?r[r.length-1]:null;if(!i)return null;if(t.nowr?i:null}return i};const t=360,n={on:!0,afterMins:240,repeatMins:30,snoozeMins:15},r=180,i='Time to put the chairs up on the tables',o=[4,0],a=(t,n)=>'anchorage'===n?{id:t,text:i,days:[...o],time:'21:00',audience:'all',builtIn:'chairs',push:!0}:{id:t,text:i,days:[5,0],time:'21:00',audience:'all',builtIn:'chairs'},u=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],s={all:'Everyone on shift',foh:'Front of house',kitchen:'Kitchen'};function c(r){const i=(t,n,r,i)=>{const o=Math.round(Number(t));return Number.isFinite(o)?Math.min(i,Math.max(r,o)):n};return{on:!1!==r.on,afterMins:i(r.afterMins,n.afterMins,30,t),repeatMins:i(r.repeatMins,n.repeatMins,5,120),snoozeMins:i(r.snoozeMins,n.snoozeMins,5,60)}}const d=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t);function l(t){const n='number'==typeof t?new Date(t):t,r=Object.fromEntries(new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(n).map(t=>[t.type,t.value]));return{dow:u.indexOf(String(r.weekday).slice(0,3)),mins:60*Number(r.hour)+Number(r.minute),ymd:`${r.year}-${r.month}-${r.day}`}}const f=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));const m=(t,n)=>'all'===t||('kitchen'===t?n:!n);function b(t){const n=c(t.rules),r=t.clockIn??t.shiftStart;if(!n.on||void 0===r||t.hadBreak)return[];const i=r+216e5,o=Math.min(void 0!==t.rotaBreak&&t.rotaBreak>r?t.rotaBreak:r+6e4*n.afterMins,i),a=[{stage:1,at:o,label:void 0!==t.rotaBreak&&t.rotaBreak>r&&t.rotaBreak<=i?'Your break on the rota is now.':'Time for your break.'}],u=o+6e4*n.repeatMins;return a.push({stage:2,at:u,label:'Reminder: you haven\u2019t had your break yet.'}),i>u&&a.push({stage:3,at:i,label:'You\u2019ve worked 6 hours without a break. You need a 20-minute break (UK law).'}),a}},1183,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1184,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1185,[31,1082,1186,1391,1184]); +__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1186,[1190,995,1191]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"KIND_LABEL",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TEMP_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"isTempKind",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"SECTIONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"SECTION_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"sectionOf",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"initialsOf",{enumerable:!0,get:function(){return l}}),_e.unitAliases=u,Object.defineProperty(_e,"DEFAULT_POINTS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"limitText",{enumerable:!0,get:function(){return f}}),_e.inRange=p,_e.spokenNumber=y,_e.parseQuick=function(e,n){const r=n.filter(e=>!e.archived);return e.split(/[,;\n]+|\s+and\s+|\.\s+/i).map(e=>e.trim()).filter(Boolean).map(e=>{const n=e.toLowerCase().replace(/[\u2010\u2013]/g,'-').replace(/-(?!\d)/g,' '),o=` ${n.replace(/[^a-z0-9.\- ]/g,' ').replace(/\s+/g,' ')} `;let a,s=0,l='';for(const e of r)for(const n of[e.name.toLowerCase(),...e.aliases]){const t=n.replace(/-/g,' ').replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim();t&&o.includes(` ${t} `)&&t.length>s&&(a=e,s=t.length,l=t)}const c=y(l?n.replace(new RegExp(`(^|[^a-z0-9])${l.split(' ').map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&')).join('[^a-z0-9]+')}(?=$|[^a-z0-9])`),'$1 '):n);return/ (walk ?in|cold room) /.test(o)&&!/(walk|cold room)/.test(l)?{text:e,value:null,problem:'The walk-in is a dry store, not on the temperature log. Pick a fridge or freezer below.'}:a?t(a.kind)?null==c?{text:e,point:a,value:null,problem:'No temperature heard \u2014 type it in.'}:{text:e,point:a,value:c}:{text:e,point:a,value:null}:{text:e,value:c,problem:'Not sure which check this is \u2014 pick it below or type it.'}})},_e.missedChecks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const s of e){if(s.archived)continue;const e=s.due.filter(e=>k(e)<=o);if(!e.length)continue;const l=e[e.length-1],c=r.getTime()+6e4*k(e[0])-108e5,d=n.filter(e=>e.pointId===s.id&&new Date(e.at).getTime()>=c&&new Date(e.at).getTime()<=t.getTime()),u=e.length;d.lengthe.map(w).join(',')).join('\r\n')+'\r\n'},Object.defineProperty(_e,"SLOTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"SLOT_LABEL",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"SLOT_HINT",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"slotOf",{enumerable:!0,get:function(){return $}}),_e.todayTasks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const s of e){const e=s.archived?[]:[...s.due].sort();if(!e.length)continue;const l=r.getTime()+6e4*k(e[0])-108e5,c=n.filter(e=>e.pointId===s.id&&new Date(e.at).getTime()>=l&&new Date(e.at).getTime()<=t.getTime()).reverse().sort((e,n)=>e.at.localeCompare(n.at));e.forEach((e,n)=>{const t=c[n],r=k(e),l=t?'done':o>=r?'overdue':o>=r-60?'due':'upcoming';a.push({key:`${s.id}@${e}`,point:s,due:e,slot:$(e),status:l,entry:t})})}return a.sort((e,n)=>e.due.localeCompare(n.due)||e.point.name.localeCompare(n.point.name))},_e.unitStatus=function(e,n,t){const r=n.filter(n=>n.pointId===e.id&&null!=n.value).reverse().sort((e,n)=>e.at.localeCompare(n.at)),o=r[r.length-1];if(!o)return{rag:'none',history:r,why:'No readings yet'};const a=o.value;if(!p(e,a))return{rag:'red',latest:o,history:r,why:'Out of range'};const s=new Date(t);if(s.setHours(0,0,0,0),new Date(o.at).getTime()e.max-1||null!=e.min&&an.includes(e),r=['cross','cleaning','chilling','cooking','management'],o={cross:'Cross-contamination & allergens',cleaning:'Cleaning',chilling:'Chilled storage & cooling',cooking:'Cooking, reheating & hot holding',management:'Management & records'},a={fridge:'chilling',freezer:'chilling',cool:'chilling',delivery:'chilling',cook:'cooking',hothold:'cooking',cleaning:'cleaning',allergen:'cross',check:'management'},s=e=>e.section??a[e.kind],l=e=>e.replace(' (example)','').split(/\s+/).filter(Boolean).map(e=>e[0]).join('').slice(0,3).toUpperCase(),c={1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten'},d={1:'first',2:'second',3:'third',4:'fourth',5:'fifth',6:'sixth',7:'seventh',8:'eighth',9:'ninth',10:'tenth'};function u(e,n){const t=e.trim().toLowerCase().replace(/\s+/g,' ');if(!t)return[];const r=(n??'').trim().toLowerCase(),o=t.replace(/^(downstairs|upstairs|kitchen|cellar|basement|back|front|bar)\s+/,'').replace(r&&t.startsWith(r+' ')?new RegExp('^'+r.replace(/[.*+?^${}()|[\]\\]/g,'\\$&')+'\\s+'):/^$/,''),a=new Set([t,o]);for(const e of[t,o]){const n=e.match(/^(.*\S)\s+(\d{1,2})$/);n&&c[n[2]]&&(a.add(`${n[1]} ${c[n[2]]}`),a.add(`${n[1]} number ${n[2]}`),e!==o||/\s/.test(n[1])||a.add(`${d[n[2]]} ${n[1]}`))}return[...a].filter(Boolean)}const m=[{id:'cp-walkin',name:'Walk-in fridge',kind:'fridge',max:5,due:[],aliases:[],archived:!0},{id:'cp-prep',name:'Downstairs fridge 1',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 1')},{id:'cp-bar',name:'Downstairs fridge 2',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 2')},{id:'cp-fridge3',name:'Downstairs fridge 3',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 3')},{id:'cp-fridge4',name:'Upstairs fridge 4',location:'Upstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Upstairs fridge 4')},{id:'cp-freezer',name:'Downstairs freezer 1',location:'Downstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Downstairs freezer 1')},{id:'cp-freezer2',name:'Upstairs freezer 2',location:'Upstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Upstairs freezer 2')},{id:'cp-freezer3',name:'Upstairs freezer 3',location:'Upstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Upstairs freezer 3')},{id:'cp-cook',name:'Cooking: core temperature',kind:'cook',min:75,due:[],aliases:['core','cook','cooking','probe']},{id:'cp-cool',name:'Cooling: within 90 minutes',kind:'cool',max:8,due:[],aliases:['cooling','cool']},{id:'cp-hothold',name:'Hot hold: bain-marie',kind:'hothold',min:63,due:['18:00'],aliases:['hot hold','bain marie','bain-marie','hothold']},{id:'cp-del-chill',name:'Delivery: chilled',kind:'delivery',max:8,due:[],aliases:['chilled delivery','delivery chilled','delivery']},{id:'cp-del-frozen',name:'Delivery: frozen',kind:'delivery',max:-15,due:[],aliases:['frozen delivery','delivery frozen']},{id:'cp-clean',name:'Close-down clean signed off',kind:'cleaning',due:['23:00'],aliases:['cleaning','clean down','close down']},{id:'cp-allergen',name:'Allergen matrix checked against today\u2019s specials',kind:'allergen',due:['11:00'],aliases:['allergen','allergens']},{id:'cp-open-equip',name:'Fridges, freezers and other equipment working',kind:'check',section:'management',due:['09:00'],aliases:['equipment']},{id:'cp-open-staff',name:'Staff fit for work, in clean work clothes',kind:'check',section:'management',due:['09:00'],aliases:['staff fit']},{id:'cp-open-surfaces',name:'Prep areas, surfaces and utensils clean and disinfected',kind:'cleaning',due:['09:00'],aliases:['surfaces','prep areas']},{id:'cp-open-pests',name:'No signs of pests',kind:'check',section:'cleaning',due:['09:00'],aliases:['pests','pest']},{id:'cp-open-hands',name:'Hand-wash basins: hot water, soap and paper towels',kind:'check',section:'cross',due:['09:00'],aliases:['hand wash','handwash','soap']},{id:'cp-open-probe',name:'Probe thermometer working, probe wipes available',kind:'check',section:'management',due:['09:00'],aliases:['probe wipes','thermometer']},{id:'cp-mid-boards',name:'Raw and ready-to-eat kept apart; colour-coded boards in use',kind:'check',section:'cross',due:['12:00'],aliases:['boards','raw and ready to eat']},{id:'cp-close-stored',name:'Food covered, labelled, dated and put away',kind:'check',section:'chilling',due:['22:00'],aliases:['labelled','covered']},{id:'cp-close-useby',name:'Food past its use-by date thrown away',kind:'check',section:'chilling',due:['22:00'],aliases:['use by','use-by']},{id:'cp-close-waste',name:'Waste removed and bins relined',kind:'check',section:'cleaning',due:['22:00'],aliases:['waste','bins']}],f=e=>null!=e.min&&null!=e.max?`${e.min}\xb0C to ${e.max}\xb0C`:null!=e.max?`${e.max}\xb0C or colder`:null!=e.min?`${e.min}\xb0C or hotter`:'Done / not done';function p(e,n){return(null==e.min||n>=e.min)&&(null==e.max||n<=e.max)}const h={zero:0,nought:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90};function y(e){const n=e.toLowerCase().replace(/\u2212/g,'-').replace(/degrees?|\xb0c?|celsius|centigrade/g,' '),t=/\b(minus|negative)\b/.test(n),r=n.match(/-?\d+(?:[.,]\d+)?/);if(r){const e=Number(r[0].replace(',','.'));return t&&e>0?-e:e}const o=n.split(/[^a-z]+/).filter(Boolean);let a=null,s=null,l=!1;for(const e of o)if('point'!==e){if(e in h){if(l){s=h[e];break}a=(a??0)+h[e]}}else l=!0;if(null==a)return null;const c=null!=s?Number(`${a}.${s}`):a;return t?-c:c}const k=e=>{const[n,t]=e.split(':').map(Number);return 60*n+t};const b=e=>null!=e.value?`${e.value}\xb0C`:e.done?'Done':'Not done',w=e=>{const n=null==e?'':String(e);return/[",\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n},v=['Date','Time','Check','Type','Reading','Safe limit','Result','Corrective action','Note','Recorded by','Entry'];function D(n,t){return n.map(n=>{const r=new Date(n.at),o=t.find(e=>e.id===n.pointId);return[r.toLocaleDateString('en-GB'),r.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),n.name,e[n.kind],b(n),o?f(o):'',n.ok?'OK':'OUT OF RANGE',n.corrective??'',n.note??'',n.by,'probe'===n.source?'Wireless probe':'voice'===n.source?'Voice (confirmed)':'Typed']})}const O=['opening','midday','closing'],x={opening:'Opening',midday:'Midday',closing:'Closing'},C={opening:'until 11:00',midday:'11:00 to 16:00',closing:'from 16:00'},$=e=>{const n=k(e);return n<660?'opening':n<960?'midday':'closing'};const z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,T=['Opening and closing checks were done every day (or the reason is in the diary)','Every out-of-range reading has a corrective action','Probe thermometers checked (iced water / boiling water) this week','Allergen information is up to date for menu and special changes','Cleaning schedule followed; no signs of pests','Staff trained on any changed safe methods']},1187,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setMenuCardBridge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"menuCardBridge",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveItem",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveMenu",{enumerable:!0,get:function(){return m}}),e.sortMenu=c;var t=r(d[0]);let n=null;const o=t=>{n=t},u=()=>n,i=o=>(0,t.overlayItem)(o,n?.cardFor(o.id)),m=t=>c(t.map(i));function c(t){return t.some(t=>'number'==typeof t.sort)?t.map((t,n)=>({m:t,i:n,k:'number'==typeof t.sort?t.sort:10*n})).sort((t,n)=>t.k-n.k||t.i-n.i).map(t=>t.m):t}},1188,[1179]); +__d(function(_g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nextTablesFree=function(t,r,o,l,u=[]){const m=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,f=(0,a.lastFoodOn)(t,m),d=f?new Date(`${m}T${f.time}:00`):null,b=t=>o.filter(a=>a.date===m&&'confirmed'===a.status&&(a.table??'').split('+').map(t=>t.trim()).includes(t)).map(t=>new Date(`${t.date}T${t.time}:00`)).filter(t=>t>=s(l,-20)).sort((t,a)=>t.getTime()-a.getTime())[0],c=[],g=[];for(const o of Object.values(r)){const r=o.table.name,m=b(r);if('free'===o.status){(!m||m>s(l,60))&&c.push(r);continue}if(!n.includes(o.status)||!o.booking)continue;const f=o.booking,h=f.seatedAt?new Date(f.seatedAt):new Date(`${f.date}T${f.time}:00`),$=(0,a.dwellFor)(t,f.partySize,u);let w=s(h,$.mins),T='maybe',p=`seated ${Math.max(0,Math.round((l.getTime()-h.getTime())/6e4))} min, usual ${$.mins} min`;'bill'===o.status?(w=s(l,10),T='likely',p='bill requested'):'dessert'===o.status?(w=new Date(Math.min(w.getTime(),s(l,25).getTime())),T='likely',p='on dessert'):'mains'===o.status&&(w=new Date(Math.min(Math.max(w.getTime(),s(l,35).getTime()),s(l,60).getTime())),p='mains out'),w=d?{drinksOnly:!0}:{}})}g.sort((t,a)=>t.at.getTime()-a.at.getTime());const h=Object.values(r).filter(t=>'blocked'!==t.status).length,$=h>0&&c.length<=Math.max(1,Math.round(.1*h));return{full:$,freeNow:c,list:g,waitFor:t=>g.find(a=>a.seats>=t)??null}},Object.defineProperty(e,"hhmm",{enumerable:!0,get:function(){return r}}),e.nextFreeSentence=function(a,n){if(a.freeNow.length&&!a.full)return`There are ${a.freeNow.length} tables free now: ${a.freeNow.slice(0,4).map(t=>`table ${t}`).join(', ')}.`;const s=a.list[0];if(!s)return a.freeNow.length?`${(0,t.tableNumbers)(a.freeNow[0])} is free now.`:'No table is due to free up before the bookings that follow; check the bookings list.';const o=Math.max(5,Math.round((s.at.getTime()-n.getTime())/6e4)),l=a.waitFor(2),u=a.waitFor(4);return`Next table free about ${r(s.at)} (table ${s.table}, ${s.seats} seats), ${s.confidence}, in about ${o} minutes.${l?` A table for 2: about ${r(l.at)}.`:''}${u?` A table for 4: about ${r(u.at)}.`:''}${s.drinksOnly?' That\u2019s after last food orders, so drinks only.':''}`};var t=_r(_d[0]),a=_r(_d[1]);const n=['seated','mains','dessert','bill'],s=(t,a)=>new Date(t.getTime()+6e4*a);const r=t=>`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},1189,[812,814]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),f={getItem:e=>u.default.getItem((0,n.venueKey)(e)),setItem:(e,t)=>u.default.setItem((0,n.venueKey)(e),t),removeItem:e=>u.default.removeItem((0,n.venueKey)(e))}},1190,[1199,5]); +__d(function(g,_r,i,_a3,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"combine",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"createJSONStorage",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"devtools",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"persist",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"redux",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"subscribeWithSelector",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"unstable_ssrSafe",{enumerable:!0,get:function(){return S}});const e=(e,t)=>(n,r,o)=>(o.dispatch=t=>(n(n=>e(n,t),!1,t),t),o.dispatchFromDevtools=!0,{dispatch:(...e)=>o.dispatch(...e),...t}),t=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,n=new Map,r=e=>{const t=n.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},o=(e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const o=n.get(r.name);if(o)return{type:"tracked",store:e,...o};const s={connection:t.connect(r),stores:{}};return n.set(r.name,s),{type:"tracked",store:e,...s}},s=(e,t,r)=>{if(void 0===t)return;const o=n.get(e);(null==o?void 0:o.stores[t])===r&&(delete o.stores[t],0===Object.keys(o.stores).length&&n.delete(e))},a=/^at (?:new |async )?(.+?) \(/,l=/^([^@]+)@/;function c(e){var t,n,r;if(!e)return;const o=e.split("\n"),s=o.findIndex(e=>e.includes("api.setState"));if(s<0)return;const c=(null==(t=o[s+1])?void 0:t.trim())||"";return(null==(n=a.exec(c))?void 0:n[1])||(null==(r=l.exec(c))?void 0:r[1])}const u=(e,a={})=>(l,u,p)=>{const{enabled:f,anonymousActionType:y,store:h,...b}=a;let S;try{S=(null!=f?f:"production"!==(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0))&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!S)return e(l,u,p);const{connection:O,..._}=o(h,S,b);let w,E=!0;p.setState=(e,t,n)=>{const o=l(e,t);if(!E)return o;const s=void 0===n?{type:y||c((new Error).stack)||"anonymous"}:"string"==typeof n?{type:n}:n;return void 0===h?(null==O||O.send(s,u()),o):(null==O||O.send({...s,type:`${h}/${s.type}`},{...r(b.name),[h]:p.getState()}),o)},p.devtools={cleanup:()=>{null==w||w(),w=void 0,s(b.name,h,p),void 0!==h&&n.has(b.name)||!O||"function"!=typeof O.unsubscribe||O.unsubscribe()}};const I=(...e)=>{const t=E;E=!1,l(...e),E=t},j=e(p.setState,u,p);if("untracked"===_.type?null==O||O.init(j):(_.stores[_.store]=p,null==O||O.init(Object.fromEntries(Object.entries(_.stores).map(([e,t])=>[e,e===_.store?j:t.getState()])))),t(p)){let e=!1;const t=p.dispatch;p.dispatch=(...n)=>{"production"===(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0)||"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return w=O.subscribe(e=>{var n;const o="object"==typeof b.serialize?b.serialize.reviver:void 0;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):v(e.payload,o,e=>{if("__setState"===e.type){if(void 0===h)return void I(e.state);1!==Object.keys(e.state).length&&console.error("\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");const t=e.state[h];if(null==t)return;return void(JSON.stringify(p.getState())!==JSON.stringify(t)&&I(t))}t(p)&&p.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return I(j),void 0===h?null==O?void 0:O.init(p.getState()):null==O?void 0:O.init(r(b.name));case"COMMIT":return void 0===h?void(null==O||O.init(p.getState())):null==O?void 0:O.init(r(b.name));case"ROLLBACK":return v(e.state,o,e=>{if(void 0===h)return I(e),void(null==O||O.init(p.getState()));I(e[h]),null==O||O.init(r(b.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return v(e.state,o,e=>{void 0!==h?JSON.stringify(p.getState())!==JSON.stringify(e[h])&&I(e[h]):I(e)});case"IMPORT_STATE":{const{nextLiftedState:t}=e.payload,r=null==(n=t.computedStates.slice(-1)[0])?void 0:n.state;if(!r)return;return I(void 0===h?r:r[h]),void(null==O||O.send(null,t))}case"PAUSE_RECORDING":return E=!E}return}}),j},v=(e,t,n)=>{let r;try{r=JSON.parse(e,t)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&n(r)},p=e=>(t,n,r)=>{const o=r.subscribe;r.subscribe=(e,t,n)=>{let s=e;if(t){const o=(null==n?void 0:n.equalityFn)||Object.is;let a=e(r.getState());s=n=>{const r=e(n);if(!o(a,r)){const e=a;t(a=r,e)}},(null==n?void 0:n.fireImmediately)&&t(a,a)}return o(s)};return e(t,n,r)};function f(e,t){return(...n)=>Object.assign({},e,t(...n))}function y(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var r;const o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),s=null!=(r=n.getItem(e))?r:null;return s instanceof Promise?s.then(o):o(s)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const h=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>h(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>h(t)(e)}}},b=(e,t)=>(n,r,o)=>{let s={storage:y(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},a=!1,l=0;const c=new Set,u=new Set;let v=s.storage;if(!v)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...e)},r,o);const p=()=>{const e=s.partialize({...r()});return v.setItem(s.name,{state:e,version:s.version})},f=o.setState;o.setState=(...e)=>(f(...e),p());const b=e((...e)=>(n(...e),p()),r,o);let S;o.getInitialState=()=>b;const O=()=>{var e,t;if(!v)return;const o=++l;a=!1,c.forEach(e=>{var t;return e(null!=(t=r())?t:b)});const f=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=r())?e:b))||void 0;return h(v.getItem.bind(v))(s.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];if(s.migrate){const t=s.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(o!==l)return;const[a,c]=e;return S=s.merge(c,null!=(t=r())?t:b),n(S,!0),a?p():void 0}).then(()=>{o===l&&(null==f||f(r(),void 0),S=r(),a=!0,u.forEach(e=>e(S)))}).catch(e=>{o===l&&(null==f||f(void 0,e))})};return o.persist={setOptions:e=>{s={...s,...e},e.storage&&(v=e.storage)},clearStorage:()=>{++l,null==v||v.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>O(),hasHydrated:()=>a,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},s.skipHydration||O(),S||b};function S(e,t="undefined"==typeof window){return(n,r,o)=>{if(!t)return e(n,r,o);const s=()=>{throw new Error("Cannot set state of Zustand store in SSR")};return o.setState=s,e(s,r,o)}}},1191,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useKitchenExtra",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isManagerish",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isKitchenStaff",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"kitchenByRule",{enumerable:!0,get:function(){return l}}),_e.inKitchen=b,_e.inChannel=function(e,t){return!!t&&(e.startsWith('dm:')?e.split(':').slice(1).includes(t.id):'all'===e||('kitchen'===e?b(t):'managers'===e?o(t):'foh'===e&&(o(t)||/front|bar|server|waiting/i.test(t.job))))},Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return h}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},c=r(d[1]),a=r(d[2]);const u=(0,c.create)()((0,a.persist)(e=>({extra:{},set:(t,n)=>e(e=>{const c={...e.extra};return null==n?delete c[t]:c[t]=n,{extra:c}})}),{name:'covercharge-kitchen-chat-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default)})),o=e=>!!e&&'staff'!==e.role,s=e=>!!e&&/head chef/i.test((e.level??'')+' '+e.job),f=e=>!!e&&(/^kitchen$/i.test(e.dept??'')||/chef|kitchen|\bkp\b|porter/i.test(e.job)),l=e=>!!e&&(o(e)||s(e)||f(e));function b(e){if(!e||!e.active)return!1;return u.getState().extra[e.id]??l(e)}const h=(e,t)=>`dm:${[e,t].sort().join(':')}`},1192,[1190,995,1191]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_PALETTE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_DISPLAY",{enumerable:!0,get:function(){return o}});const t={bg:'#1A1A1A',surface:'#222222',surface2:'#292929',border:'#62675E',gold:'#7DB754',goldLight:'#AED28E',goldTint:'#25321E',goldMuted:'#A1C783',tile:'#222222',tilePressed:'#2D3428',accentBg:'rgba(125,183,84,0.13)',accentBorder:'rgba(125,183,84,0.55)',onGold:'#1A1A1A',ok:'#AED28E',okBg:'#25321E',blue:'#AED28E',blueBg:'#25321E'},o={quietBorder:'rgba(125,183,84,0.55)',quietPressed:'rgba(125,183,84,0.16)',primaryPressed:'#6D9F49'}},1193,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_LOCATION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WILDINGS_ADDRESS",{enumerable:!0,get:function(){return t}}),e.withWildingsAddress=function(r){return'wildings'===r.id?{...r,location:n,address:t}:r},e.withWildingsQuestionnaireAddress=function(n,r){return'wildings'===n&&r?{...r,venue:{...r.venue,address:t}}:r};const n='Maidens, KA26 9NR',t='Maidens Road, Maidens, KA26 9NR'},1194,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.sampleFingerprint=i,e.stripOwnerLiveSamples=function(n){const a={};for(const[s,o]of Object.entries(t.OWNER_SAMPLE_HASHES)){const t=n[s]||[];a[s]=t.filter(t=>!o.includes(i(t)))}a.chat=(n.chat||[]).filter(t=>!(0,s.isSeedChefChat)(t));const o=(n.changeRequests||[]).length-a.changeRequests.length;o&&(a.changesUsed=Math.max(0,(n.changesUsed||0)-o));return a},e.stripCoreLiveSamples=function(a){const c={...(0,n.stripCoreChefSamples)(a)};c.giftCards=(a.giftCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.giftCards.includes(i(s))),c.stampCards=(a.stampCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.stampCards.includes(i(s))),c.ratings=(a.ratings||[]).filter(t=>!(/^rt-[123]$/.test(t.id)&&(0,s.demoActor)(t.customerName))),i(a.customer)===t.LEGACY_CUSTOMER_HASH&&(c.customer={...a.customer,id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}});return c.restaurants=(a.restaurants||[]).filter(t=>!('saltmarsh'===t.id&&['The Venue','Saltmarsh Bistro'].includes(t.name))),c.menu=(c.menu||a.menu||[]).filter(t=>'saltmarsh'!==t.restaurantId).map(t=>t.signOff?t:o(t)),c};var t=r(d[0]),s=r(d[1]),n=r(d[2]);const a=t=>Array.isArray(t)?t.map(a):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([,t])=>void 0!==t&&'function'!=typeof t).sort(([t],[s])=>ts?1:0).map(([t,s])=>[t,a(s)])):t;function i(t){const s=JSON.stringify(a(t))??"null";let n=2166136261;for(let t=0;t>>0).toString(16)}const o=t=>Array.isArray(t)?t.map(o):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).map(([t,s])=>[t,'allergenNotes'===t&&'string'==typeof s&&/\(example\)/i.test(s)?'':o(s)])):t},1195,[1196,1085,1197]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"OWNER_SAMPLE_HASHES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CORE_SAMPLE_HASHES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"LEGACY_CUSTOMER_HASH",{enumerable:!0,get:function(){return b}});const c={referrals:["43f09bc0","c438fbad","96bf8c62","3399d421"],coats:["f51097ad","2f7efa3a"],merch:["ef6e14e","dbbc0999","dc233c1d"],merchOrders:["13b15512","bc27f242"],offers:["ad0fcde0","59e6c0cf"],photos:["53a60fd9","ab778a74","95de43cd"],changeRequests:["81c5be12","6819542c"],lost:["5bbf0d77","7d3aa9ed","850c049e"],campaigns:["9cdf8346","82150e7"],suppliers:["41df06e7","466e32ac","fa3d8eea","dfafa674","1e26fbd0","c195b120","5fc49e74","6aa8b0af","602fc2e4"],supplierOrders:["22636226","464d6a6a"]},f={giftCards:["b1bba36d","f029bc0e"],stampCards:["e7bedf6f","a3c8404d"]},b="4b1e9971"},1196,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.stripCoreChefSamples=function(n){return{bookings:(n.bookings||[]).filter(n=>!((0,e.isAnchorage)(n.restaurantId)&&t[n.id]===n.name)),orders:(n.orders||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('ord-seed-1'===t.id&&'R. Gilmour'===t.customerName||'ord-seed-2'===t.id&&'Table 3 guest'===t.customerName))),waitlist:(n.waitlist||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('wl-1'===t.id&&'Paterson'===t.name||'wl-2'===t.id&&'Duncan'===t.name))),menu:(n.menu||[]).map(t=>(0,e.isAnchorage)(t.restaurantId)&&(0,e.demoActor)(t.signOff?.by)?{...t,signOff:null}:t),events:(n.events||[]).filter(e=>!(e.example&&('anchorage'===e.restaurantId||null===e.restaurantId))),audit:(n.audit||[]).filter(e=>!('anchorage'===e.restaurantId&&/Example sign-off \(demo\)/i.test(e.text)))}};var e=r(d[0]);const t={'bk-101':'Campbell','bk-102':'Fraser','bk-103':'McLeod','bk-104':'Kerr','bk-105':'Wallace','bk-106':'Boyd','bk-107':'Hamilton','bk-108':'Stewart','bk-109':'Murray'}},1197,[1085]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.archiveChefCache=async function(e,t){const n=JSON.stringify(t);let o=2166136261;for(let e=0;e>>0).toString(16)}`;const c=await i.default.getItem(s);if(c){if(JSON.stringify(JSON.parse(c).rows)===n)return;s+=`:${Date.now()}`}await i.default.setItem(s,JSON.stringify({at:(new Date).toISOString(),store:e,rows:t}))};var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e}},1198,[1190]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAsyncStorage",{enumerable:!0,get:function(){return n.useAsyncStorage}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=u.default},1199,[1200,1204]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return i}});var e,t=r(d[0]);const o=((e=t)&&e.__esModule?e:{default:e}).default.bind({concatArrays:!0,ignoreUndefined:!0});function n(e,t){const n=window.localStorage.getItem(e);if(n){const l=JSON.parse(n),c=JSON.parse(t),s=JSON.stringify(o(l,c));window.localStorage.setItem(e,s)}else window.localStorage.setItem(e,t)}function l(e,t){return new Promise((o,n)=>{try{const n=e();t?.(null,n),o(n)}catch(e){t?.(e),n(e)}})}function c(e,t,o){return Promise.all(e).then(e=>{const n=o?.(e)??null;return t?.(null,n),Promise.resolve(n)},e=>(t?.(e),Promise.reject(e)))}const s={getItem:(e,t)=>l(()=>window.localStorage.getItem(e),t),setItem:(e,t,o)=>l(()=>window.localStorage.setItem(e,t),o),removeItem:(e,t)=>l(()=>window.localStorage.removeItem(e),t),mergeItem:(e,t,o)=>l(()=>n(e,t),o),clear:e=>l(()=>window.localStorage.clear(),e),getAllKeys:e=>l(()=>{const e=window.localStorage.length,t=[];for(let o=0;o{},multiGet:(e,t)=>c(e.map(e=>s.getItem(e)),t,t=>t.map((t,o)=>[e[o],t])),multiSet:(e,t)=>c(e.map(e=>s.setItem(e[0],e[1])),t),multiRemove:(e,t)=>c(e.map(e=>s.removeItem(e)),t),multiMerge:(e,t)=>c(e.map(e=>s.mergeItem(e[0],e[1])),t)};var i=s},1200,[1201]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},1201,[1202]); +__d(function(g,r,i,a,m,e,d){'use strict';const t=r(d[0]),{hasOwnProperty:n}=Object.prototype,{propertyIsEnumerable:o}=Object,c=(t,n,o)=>Object.defineProperty(t,n,{value:o,writable:!0,enumerable:!0,configurable:!0}),s=this,f={concatArrays:!1,ignoreUndefined:!1},l=t=>{const c=[];for(const o in t)n.call(t,o)&&c.push(o);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(t);for(const s of n)o.call(t,s)&&c.push(s)}return c};function u(n){return Array.isArray(n)?y(n):t(n)?p(n):n}function y(t){const n=t.slice(0,0);return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}function p(t){const n=null===Object.getPrototypeOf(t)?Object.create(null):{};return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}const b=(t,n,o,s)=>(o.forEach(o=>{void 0===n[o]&&s.ignoreUndefined||(o in t&&t[o]!==Object.getPrototypeOf(t)?c(t,o,h(t[o],n[o],s)):c(t,o,u(n[o])))}),t),O=(t,o,s)=>{let f=t.slice(0,0),y=0;return[t,o].forEach(o=>{const p=[];for(let s=0;s!p.includes(t)),s)}),f};function h(n,o,c){return c.concatArrays&&Array.isArray(n)&&Array.isArray(o)?O(n,o,c):t(o)&&t(n)?b(n,o,l(o),c):u(o)}m.exports=function(...n){const o=h(u(f),this!==s&&this||{},f);let c={_:{}};for(const s of n)if(void 0!==s){if(!t(s))throw new TypeError('`'+s+'` is not an Option Object');c=h(c,{_:s},o)}return c._}},1202,[1203]); +__d(function(g,r,i,a,m,e,d){'use strict';m.exports=t=>{if('[object Object]'!==Object.prototype.toString.call(t))return!1;const o=Object.getPrototypeOf(t);return null===o||o===Object.prototype}},1203,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAsyncStorage=function(e){return{getItem:(...t)=>u.default.getItem(e,...t),setItem:(...t)=>u.default.setItem(e,...t),mergeItem:(...t)=>u.default.mergeItem(e,...t),removeItem:(...t)=>u.default.removeItem(e,...t)}};var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1204,[1200]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"createStore",{enumerable:!0,get:function(){return n}});const t=t=>{let n;const c=new Set,o=(t,o)=>{const s="function"==typeof t?t(n):t;if(!Object.is(s,n)){const t=n;n=(null!=o?o:"object"!=typeof s||null===s)?s:Object.assign({},n,s),c.forEach(c=>c(n,t))}},s=()=>n,u={setState:o,getState:s,getInitialState:()=>l,subscribe:t=>(c.add(t),()=>c.delete(t))},l=n=t(o,s,u);return u},n=n=>n?t(n):t},1205,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"create",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=r(d[1]);const c=e=>e;function o(e,t=c){const u=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return n.default.useDebugValue(u),u}const s=e=>{const t=(0,u.createStore)(e),n=e=>o(t,e);return Object.assign(n,t),n},l=e=>e?s(e):s},1206,[31,1205]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return p}}),_e.defaultSimStart=function(e=new Date){const t=new Date(e),r=(5-t.getDay()+7)%7;return t.setDate(t.getDate()+r),t.setHours(17,30,0,0),t},_e.buildSeed=function(u){if(r.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE){const e=I(u);return{...e,restaurants:e.restaurants.filter(e=>'anchorage'===e.id),menu:c.anchorageMenu.map(e=>({...e,signOff:null})),bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:e.events.filter(e=>!e.example),ratings:[],walkIns:{},counters:{order:0,table:0,booking:0},customer:{...e.customer,id:'',referralCode:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}}}}return t.IS_ISOLATED_VENUE?{restaurants:[t.IS_QUEUED_VENUE?(0,e.queuedRestaurant)(t.VENUE_RID):t.IS_ABBOTSFORD?n.ABBOTSFORD_RESTAURANT:t.IS_KIRKTON?n.KIRKTON_RESTAURANT:t.IS_GREENSIDE?n.GREENSIDE_RESTAURANT:t.IS_WILDINGS?n.WILDINGS_RESTAURANT:t.IS_KIRKMICHAEL?n.KIRKMICHAEL_RESTAURANT:s.SOUTERS_RESTAURANT],menu:t.IS_WILDINGS?l.WILDINGS_MENU:t.IS_KIRKMICHAEL?d.KIRKMICHAEL_MENU:t.IS_SOUTERS?i.SOUTERS_MENU:[],customer:{id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}},bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:t.IS_WILDINGS?(0,o.guideCalendarEvents)(o.WILDINGS_GUIDE,'wildings'):t.IS_KIRKMICHAEL?(0,o.guideCalendarEvents)(o.KIRKMICHAEL_GUIDE,'kirkmichael'):t.IS_SOUTERS?(0,o.guideCalendarEvents)(o.SOUTERS_GUIDE,'souters'):[],ratings:[],audit:[],alertAcks:{},walkIns:{},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:0,table:0,booking:0}}:I(u)};var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),s=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),m=_r(_d[11]);const p='cust-demo';function I(e){const t=(0,m.ymd)(e),r=e=>e.toISOString(),s=n.restaurants.map(e=>'anchorage'===e.id?{...e,sections:c.ANCHORAGE_SECTIONS}:e),i={id:p,name:'Alex Morgan',email:'alex.demo@example.com',phone:'07700 900123',allergies:[{allergen:'crustaceans',severity:'anaphylaxis'},{allergen:'mustard',severity:'allergy'}],allergyConsent:!0,referralCode:'ALEX-7K2Q',marketingOptIn:{anchorage:!0}},o=(n,s,i,o,d={})=>({id:n,ref:`BK-${n.slice(-3).toUpperCase()}`,restaurantId:'anchorage',customerId:null,name:s,partySize:i,date:t,time:o,allergies:[],notes:'',status:'confirmed',security:i>=6?'deposit':'none',depositPaid:0,...i>=6?{depositDue:1e3*i}:{},createdAt:r((0,m.addMins)(e,-4320)),...d}),d=[o('bk-101','Campbell',2,'17:00',{table:'12',status:'seated',seatedAt:r((0,m.addMins)(e,-28)),tags:['Regular']}),o('bk-102','Fraser',4,'17:30',{table:'10',tags:['VIP']}),o('bk-103','McLeod',2,'18:00',{table:'11',allergies:[{allergen:'gluten',severity:'coeliac'}],notes:'Anniversary',occasion:'anniversary'}),o('bk-104','Kerr',6,'18:00',{table:'18'}),o('bk-105','Wallace',3,'18:30',{table:'13'}),o('bk-106','Boyd',8,'19:00',{table:'1+2',dog:!0,allergies:[{allergen:'peanuts',severity:'anaphylaxis'}],notes:'Birthday \u2014 bringing a dog',occasion:'birthday'}),o('bk-107','Hamilton',2,'19:00',{table:'5'}),o('bk-108','Stewart',4,'19:30',{table:'19',tags:['Regular']}),o('bk-109','Murray',2,'20:00',{table:'16'})],l=[{id:'wl-1',restaurantId:'anchorage',number:1,name:'Paterson',partySize:2,joinedAt:r((0,m.addMins)(e,-12)),status:'waiting'},{id:'wl-2',restaurantId:'anchorage',number:2,name:'Duncan',partySize:4,joinedAt:r((0,m.addMins)(e,-4)),status:'waiting'}],I=(0,m.atTime)(e,'17:45'),h=[{id:'ord-seed-1',ref:'T-1041',restaurantId:'anchorage',customerId:'cust-other',customerName:'R. Gilmour',type:'takeaway',slotTime:r(I),lines:[{itemId:'a-fishsupper',name:'Fish Supper',qty:2,unitPrice:1800,choices:['Beer-battered'],notes:'',contains:[],may:[],overridden:!1,prepMins:12},{itemId:'a-chips',name:'Triple-Cooked Chips (V)',qty:1,unitPrice:450,choices:[],notes:'Extra salt',contains:[],may:[],overridden:!1,prepMins:6}],subtotal:4050,tip:0,giftCardApplied:0,total:4050,paid:4050,status:'acknowledged',createdAt:r((0,m.addMins)(e,-50)),allergies:[],readiness:{}},{id:'ord-seed-2',ref:'Q-2017',restaurantId:'anchorage',customerId:'cust-other2',customerName:'Table 3 guest',type:'table',tableNo:'3',lines:[{itemId:'a-moules',name:'Moules Marini\xe8re',qty:1,unitPrice:2200,choices:['Main 500g with triple-cooked chips (\xa322.00)'],notes:'',contains:[],may:[],overridden:!1,prepMins:10},{itemId:'a-claymore',name:'The Claymore Burger',qty:1,unitPrice:1800,choices:[],notes:'No gherkins',contains:[],may:[],overridden:!1,prepMins:14}],subtotal:4e3,tip:0,giftCardApplied:0,total:4e3,paid:0,status:'preparing',createdAt:r((0,m.addMins)(e,-18)),allergies:[],readiness:{}}],y=[{restaurantId:'anchorage',customerId:p,stamps:5,rewardsAvailable:0,history:[{at:'2026-08-15',source:'Dine-in (staff scan)'},{at:'2026-08-29',source:'Takeaway'},{at:'2026-09-12',source:'Table QR bill'},{at:'2026-10-02',source:'Takeaway'},{at:'2026-10-16',source:'Referral \u2014 friend\u2019s first visit'}]},{restaurantId:'saltmarsh',customerId:p,stamps:2,rewardsAvailable:0,history:[{at:'2026-09-01',source:'Dine-in'},{at:'2026-10-01',source:'Dine-in'}]}],b=[{id:'gc-1',code:'ANC-G7QX-4M2P-9TRE',restaurantId:'anchorage',initial:5e3,balance:2500,ownerId:p,recipientName:'Alex',message:'Happy birthday! (example)',createdAt:'2026-09-20'},{id:'gc-2',code:'WEB-OLD-10-EXAMPLE',restaurantId:'anchorage',initial:1e3,balance:1e3,ownerId:'legacy',recipientName:'Legacy website bookings voucher (example)',message:'',createdAt:'2026-06-01',legacy:!0}],E=[...u.SCOTTISH_BANK_HOLIDAYS.map((e,t)=>({id:`bh-${t}`,restaurantId:null,date:e.date,title:e.title+(e.notes&&!/substitute/i.test(e.notes)?` (${e.notes.toLowerCase()})`:''),kind:'bank-holiday',description:'Scottish bank holiday',example:!1,source:u.BANK_HOLIDAY_SOURCE})),{id:'ev-halloween',restaurantId:'anchorage',date:(0,m.ymd)(new Date(e.getFullYear(),9,31)),title:'Halloween weekend (example)',kind:'event',description:'Example event \u2014 busy weekend flag for the forecast.',example:!0},{id:'ev-xmas-party',restaurantId:'anchorage',date:'2026-12-04',title:'Christmas party nights begin (example)',kind:'event',description:'Example: festive set menu, deposit required for parties of 8+.',example:!0},{id:'ev-hogmanay',restaurantId:null,date:'2026-12-31',title:'Hogmanay',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-burns',restaurantId:'anchorage',date:'2027-01-25',title:'Burns Night Supper (example)',kind:'event',description:'EXAMPLE event: haggis, neeps & tatties, address to the haggis, set menu \xa348pp. Booking opens via the app.',example:!0},{id:'ev-valentines',restaurantId:null,date:'2027-02-14',title:"Valentine's Day",kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-mothering',restaurantId:null,date:'2027-03-07',title:'Mothering Sunday (UK)',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-live',restaurantId:'anchorage',date:'2026-11-14',title:'Live acoustic music (example)',kind:'event',description:'EXAMPLE: local folk duo from 7pm.',example:!0},{id:'ev-school-xmas',restaurantId:null,date:'2026-12-23',title:'South Ayrshire schools close for Christmas',kind:'school-holiday',description:'23 Dec 2026 \u2013 4 Jan 2027',example:!1},{id:'ev-salt-quiz',restaurantId:'saltmarsh',date:'2026-11-05',title:'Quiz night (fictional)',kind:'event',description:'Fictional demo restaurant event.',example:!0}];return{restaurants:s,menu:[...c.anchorageMenu,...n.demoMenus],customer:i,bookings:d,waitlist:l,orders:h,stampCards:y,giftCards:b,events:E,ratings:[{id:'rt-1',restaurantId:'anchorage',customerId:'cust-x1',customerName:'Fiona (example)',stars:5,comment:'Best fish supper on the coast, and the staff were brilliant with my son\u2019s nut allergy.',createdAt:r((0,m.addMins)(e,-1560)),context:'Takeaway T-1032'},{id:'rt-2',restaurantId:'anchorage',customerId:'cust-x2',customerName:'Iain (example)',stars:4,comment:'Lovely langoustines. Bit of a wait for a table at 7.',createdAt:r((0,m.addMins)(e,-3e3)),context:'Dine-in, Table 6'},{id:'rt-3',restaurantId:'anchorage',customerId:'cust-x3',customerName:'Morag (example)',stars:2,comment:'Chips were cold by the time we collected.',createdAt:r((0,m.addMins)(e,-4320)),context:'Takeaway T-1019'}],audit:[],alertAcks:{},walkIns:{anchorage:6},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:1042,table:2018,booking:110}}}},1207,[6,5,842,3,1208,1209,934,1210,1211,1212,1213,822]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_RESTAURANT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SOUTERS_BOOKING_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SOUTERS_CONTACTS",{enumerable:!0,get:function(){return o}});const t={id:'souters',name:"Souter's Inn",tagline:'Culinary excellence meets country hospitality in Kirkoswald',location:'Kirkoswald, South Ayrshire',address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',phone:'01655 760653',website:'https://www.soutersinn.com/',fictional:!1,kitchenHours:{0:['09:00','21:00'],1:['09:00','21:00'],2:['09:00','21:00'],3:['09:00','21:00'],4:['09:00','21:00'],5:['09:00','21:00'],6:['09:00','21:00']},hoursNote:'Official menus (10 Nov 2026): breakfast daily 9\u201311.45am; \xe0 la carte, children\u2019s, vegetarian and takeaway 12 noon\u20139pm; desserts 9am\u20139pm. Official homepage: open daily from 9am. Destination South Ayrshire lists 9am\u20139pm, seven days, food all day. Christmas hours not published.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:16,stampTarget:8,stampReward:'',stampMinSpend:1e3,capacityPerHour:0,walkInShare:.35,turnMins:75,orderAtTable:!1,showTakeaway:!1,tableRequests:!0,shortName:"Souter's",deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'A general table deposit policy was not published on the official website (10 November 2026). No deposit is taken in this app.'}}},n='',o={email:'souters@southernayr.com',phone:'01655 760653'}},1208,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_MENU",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SOUTERS_MENU_COUNT",{enumerable:!0,get:function(){return t}});const s=[{id:"su-breakfast-full-breakfast",section:"Breakfast",name:"Full Breakfast",description:"Ayrshire Bacon, Link Sausage, Black Pudding, Potato Scone, Beans, Tomato, Mushrooms & Two Eggs (Poached, Scrambled or Fried) with White or Wholemeal Toast",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-benedict",section:"Breakfast",name:"Eggs Benedict",description:"Two Poached Eggs along with Ayrshire Bacon served on Toasted Muffin topped with Hollandaise Sauce",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-french-toast",section:"Breakfast",name:"French Toast",description:"Two Slices of Bloomer Eggy Bread with Ayrshire Bacon and a side of Maple Syrup",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-light-breakfast",section:"Breakfast",name:"Light Breakfast",description:"Ayrshire Bacon, Link Sausage, Beans, Tomato and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-royale",section:"Breakfast",name:"Eggs Royale",description:"Two Poached Eggs with Flaked Smoked Salmon served on Toasted Muffin topped with Hollandaise Sauce",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-fried-scottish-pancakes",section:"Breakfast",name:"Fried Scottish Pancakes",description:"Scottish Pancakes with Ayrshire Bacon and a side of Maple Syrup",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-to-fried-scottish-pancakes",section:"Breakfast add-ons",name:"Add Banana (to Fried Scottish Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-two-eggs-poached-fried-or-scrambled-",section:"Breakfast add-ons",name:"Add Two Eggs \u2013 Poached, Fried or Scrambled (to Fried Scottish Pancakes)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-vegetarian-breakfast",section:"Breakfast",name:"Vegetarian Breakfast",description:"Potato Scone, Tomato, Mushrooms, Beans and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:925,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-benedict",section:"Breakfast",name:"Smashed Avocado Benedict",description:"Smashed Avocado Guacamole, 2 Poached Eggs served on Toasted Muffin topped with Hollandaise Sauce",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-granola-bowl",section:"Breakfast",name:"Granola Bowl",description:"Almond and Raisin Granola topped with Berries, Natural Yoghurt and Honey",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-burrito",section:"Breakfast",name:"Breakfast Burrito",description:"Crispy Bacon, Two Fried Eggs, Jalape\xf1o Salsa, Guacamole, Cheddar Cheese, Salad & Sour Cream",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pancake-stack",section:"Breakfast",name:"Pancake Stack",description:"American style pancakes with Biscoff, Nutella, Chocolate Sauce & Fresh Strawberries",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-roll",section:"Breakfast",name:"Breakfast Roll",description:"with a choice of Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg; 2 Items \xa34.75 | 3 Items \xa35.50",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-breakfast",section:"Junior / Kids",name:"Kids Breakfast",description:"Pork Link Sausage, Beans, Potato Scone, served with a Slice of Toast",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-pancakes",section:"Junior / Kids",name:"Kids Pancakes",description:"American Style Pancakes served with Syrup, Nutella or Butter & Jam",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-or-strawberries-to-kids-panca",section:"Junior / Kids add-ons",name:"Add Banana or Strawberries (to Kids Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-black-pudding-add-on",section:"Add-ons",name:"Black Pudding (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-beans-add-on",section:"Add-ons",name:"Beans (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-add-on",section:"Add-ons",name:"Smashed Avocado (add-on)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pork-link-sausage-add-on",section:"Add-ons",name:"Pork Link Sausage (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-mushrooms-add-on",section:"Add-ons",name:"Mushrooms (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-tomato-add-on",section:"Add-ons",name:"Tomato (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-ayrshire-bacon-2-add-on",section:"Add-ons",name:"Ayrshire Bacon (2) (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-haggis-add-on",section:"Add-ons",name:"Haggis (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-egg-add-on",section:"Add-ons",name:"Egg (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-potato-scone-add-on",section:"Add-ons",name:"Potato Scone (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-bucket-of-chips",section:"Add-ons",name:"Bucket of Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-toasted-white-or-wholemeal-bread",section:"Add-ons",name:"Toasted White or Wholemeal Bread",description:"served with Butter and Preserve",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-freshly-baked-basket-of-bread-with-butte",section:"Starters / bread",name:"Freshly Baked Basket Of Bread With Butter",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-olive-oil-balsamic-vinegar",section:"Starters / bread",name:"Add Olive Oil & Balsamic Vinegar",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-soup-of-the-day",section:"Starters",name:"Soup of The Day",description:"served with Crusty Bread & Butter",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-a-la-carte-salad-of-poached-pear-blue-cheese",section:"Starters",name:"Salad Of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fresh-water-prawns",section:"Starters",name:"Fresh Water Prawns",description:"coated in Spicy Bang Bang Sauce, topped with Chopped Chilli, Peanuts & Coriander",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sliced-melon-fresh-fruits",section:"Starters",name:"Sliced Melon & Fresh Fruits",description:"with Coulis & Raspberry Sorbet",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-liver-p-t",section:"Starters",name:"Chicken Liver P\xe2t\xe9",description:"with Oatcakes, Plum & Apple Chutney",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-crispy-salt-pepper-calamari",section:"Starters",name:"Crispy Salt & Pepper Calamari",description:"served with Garlic Mayo & Oriental Dressing",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-mussels",section:"Starters",name:"Steamed Mussels",description:"with White Wine, Garlic, Shallots & Cream, served with Garlic Bread",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamy-baked-garlic-mushrooms",section:"Starters",name:"Creamy Baked Garlic Mushrooms",description:"with a Cheddar Cheese Gratin",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-boiled-egg-crispy-bacon-caesar-salad",section:"Starters",name:"Boiled Egg & Crispy Bacon Caesar Salad",description:"with Parmesan & Croutons",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-grilled-honey-glazed-goat-s-cheese-salad",section:"Starters",name:"Grilled Honey Glazed Goat\u2019s Cheese Salad",description:"with Roquito Peppers & Chilli Jam",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sticky-bbq-ribs-in-a-korean-gochujang-sa",section:"Starters",name:"Sticky BBQ Ribs in a Korean Gochujang Sauce",description:"with Onions, Peppers & Sesame Seeds",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cioppino-fish-soup",section:"Starters",name:"Cioppino Fish Soup",description:"fired up with Fresh Chillies & Smoked Paprika, topped with Croutons & Parmesan",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-fillet-steak",section:"From the grill",name:"8oz Fillet Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-10oz-sirloin-steak",section:"From the grill",name:"10oz Sirloin Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-rosemary-garlic-lamb-chops",section:"From the grill",name:"Rosemary & Garlic Lamb Chops",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:2750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-breaded-haggis-grill",section:"From the grill add-ons",name:"Top with Breaded Haggis (grill)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-6-garlic-buttered-prawns-grill",section:"From the grill add-ons",name:"Top with 6 Garlic Buttered Prawns (grill)",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-fillet-of-salmon-with-cheese-gla",section:"Main courses",name:"Steamed Fillet of Salmon with Cheese Glaze",description:"served with Buttered Greens & Creamed Potatoes",price:2150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breaded-haddock-chips",section:"Main courses",name:"Breaded Haddock & Chips",description:"with Homemade Tartare Sauce & Side Salad",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fish-of-the-day",section:"Main courses",name:"Fish of the Day",description:"Check Chef\u2019s Daily Specials",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,priceNote:"Ask staff",special:!0},{id:"su-a-la-carte-locally-caught-haggis-with-neeps-tatties",section:"Main courses",name:"Locally Caught Haggis with Neeps & Tatties",description:"served with Whisky Peppercorn Sauce & Greentails",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breast-of-cajun-spiced-chicken",section:"Main courses",name:"Breast Of Cajun Spiced Chicken",description:"with Capsicums, Rice Pilaf & a Curried Coconut & Mango Chutney Sauce",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-schnitzel",section:"Main courses",name:"Chicken Schnitzel",description:"Pan-Fried in Breadcrumbs, served with Crispy Bacon, Grilled Pineapple & Chips",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-beef-steak-butcher-s-sausage-pie",section:"Main courses",name:"Beef Steak & Butcher\u2019s Sausage Pie",description:"with Creamed Potatoes & Buttered Carrots",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-madras-spiced-lamb-curry",section:"Main courses",name:"Madras Spiced Lamb Curry",description:"with Chillies, Pineapple & Coriander, served with Aromatic Rice, Spiced Onions & a Poppadom",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-pan-fried-lambs-liver",section:"Main courses",name:"Pan-Fried Lambs Liver",description:"with Saut\xe9ed Onions, Smoked Bacon, Grilled Tomato, Creamed Potatoes & Red Wine Gravy",price:1750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-cheeseburger",section:"Main courses",name:"8oz Cheeseburger",description:"with Bacon, Peppered Mayo, Pickles & Tomato, served with Coleslaw & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-haggis-to-cheeseburger",section:"Main courses add-ons",name:"Add Haggis (to Cheeseburger)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-panko-breaded-chicken-burger",section:"Main courses",name:"Panko Breaded Chicken Burger",description:"in a Toasted Brioche Bun, with Curried Slaw, Katsu Sauce & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Leeks, English Mustard & Matured Cheddar, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-bacon-to-macaroni-cheese",section:"Main courses add-ons",name:"Add Bacon (to Macaroni Cheese)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-penne-pasta-arrabbiata",section:"Main courses",name:"Penne Pasta Arrabbiata",description:"with Peppers, Vine Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-melon-prawn-salad",section:"Salads",name:"Melon & Prawn Salad",description:"with Marie Rose Cocktail Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-ploughman-s-salad",section:"Salads",name:"Ploughman\u2019s Salad",description:"Souter\u2019s Sausage Roll, Matured Cheddar, Pickle, Gammon, Boiled Egg & Crusty Bread; served with a choice of Chips or Boiled Potatoes",price:1695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-spiced-fillet-of-salmon",section:"Salads",name:"Cajun Spiced Fillet Of Salmon",description:"with Curried Coleslaw, Cashew Nuts & a Chilli, Ginger & Citrus Dressing; served with a choice of Chips or Boiled Potatoes",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-chicken-caesar-salad",section:"Salads",name:"Garlic Chicken Caesar Salad",description:"with Croutons, Parmesan, Baby Gem Lettuce, Boiled Egg & Caesar Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-prawn-smoked-salmon-sandwich",section:"Sandwiches",name:"Prawn & Smoked Salmon Sandwich",description:"with Rocket & Marie Rose Sauce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-tuna-mayonnaise-sandwich",section:"Sandwiches",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-spicy-bang-bang-chicken-sandwich",section:"Sandwiches",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-basil-pesto-chicken-sandwich",section:"Sandwiches",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-egg-mayonnaise-sandwich",section:"Sandwiches",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-a-cup-of-soup-with-any-sandwich",section:"Sandwiches add-ons",name:"Add a Cup of Soup (with any Sandwich)",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chips",section:"Sides",name:"Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-chips",section:"Sides",name:"Cajun Chips",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamed-potatoes",section:"Sides",name:"Creamed Potatoes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-onion-rings",section:"Sides",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-mac-cheese-side",section:"Sides",name:"Mac & Cheese (side)",description:"",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-seasonal-mixed-vegetables",section:"Sides",name:"Seasonal Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-coleslaw",section:"Sides",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-curried-coleslaw",section:"Sides",name:"Curried Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-side-salad",section:"Sides",name:"Souter\u2019s Side Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread",section:"Sides",name:"Garlic Bread",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread-with-cheese",section:"Sides",name:"Garlic Bread with Cheese",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-fresh-fruit-salad-sorbet",section:"Starters",name:"Fresh Fruit Salad & Sorbet",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-soup-of-the-day",section:"Starters",name:"Soup of the Day",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-garlic-bread-with-or-without-cheese",section:"Starters",name:"Garlic Bread (with or without Cheese)",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-breaded-goujons-of-chicken",section:"Main courses",name:"Breaded Goujons of Chicken",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-mini-breaded-fish",section:"Main courses",name:"Mini Breaded Fish",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-roast-chicken-salad",section:"Main courses",name:"Roast Chicken Salad",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-grilled-sausages-or-chicken-with-gravy",section:"Main courses",name:"Grilled Sausages or Chicken with Gravy",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-sticky-toffee-pudding",section:"Sweet treats",name:"Sticky Toffee Pudding",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-cone-from-the-counter",section:"Sweet treats",name:"Cone from the Counter",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-ice-cream-sundae",section:"Sweet treats",name:"Kids Ice Cream Sundae",description:"Two scoops, Sprinkles, Flakes, along with a choice of Sauce \u2013 Chocolate / Strawberry",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-juice-apple-orange-pineapple",section:"Drinks",name:"Juice \u2013 Apple / Orange / Pineapple",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-simply-fruit-shoot-orange-blackcurrant",section:"Drinks",name:"Simply Fruit Shoot \u2013 Orange / Blackcurrant",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-diluting-juice-orange-blackcurrant",section:"Drinks",name:"Diluting Juice \u2013 Orange / Blackcurrant",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-milk",section:"Drinks",name:"Milk",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-coke-diet-coke-lemonade",section:"Drinks",name:"Coke / Diet Coke / Lemonade",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-milk-shake-chocolate-strawberry",section:"Drinks",name:"Kids Milk Shake \u2013 Chocolate / Strawberry",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-sticky-toffee-pudding",section:"Dessert",name:"Souter\u2019s Sticky Toffee Pudding",description:"with Butterscotch Sauce & Vanilla Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cherry-almond-tart",section:"Dessert",name:"Cherry & Almond Tart",description:"with Cr\xe8me Anglaise & Wild Cherry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-individual-banoffee-pie",section:"Dessert",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-cheesecake-of-the-day",section:"Dessert",name:"Souter\u2019s Cheesecake of the Day",description:"Please ask your Server for Today\u2019s Choice",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-warm-chocolate-fudge-cake",section:"Dessert",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-meringue-pie",section:"Dessert",name:"Lemon Meringue Pie",description:"with Raspberries & Raspberry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-fresh-fruit-salad",section:"Dessert",name:"Fresh Fruit Salad",description:"with Citrus Syrup served with Pouring Cream, Ice Cream or Sorbet",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cheeseboard",section:"Dessert",name:"Cheeseboard",description:"A Selection of British & Continental Cheeses with Grapes, Fruit Chutney & Biscuits",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-affogato",section:"Dessert",name:"Affogato",description:"Vanilla Ice Cream with a Shot of Espresso",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-ice-cream-one-scoop",section:"Ice cream",name:"Ice Cream \u2013 One Scoop",description:"Please ask your Server for Today\u2019s Flavours",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-two-scoops",section:"Ice cream",name:"Ice Cream \u2013 Two Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-three-scoops",section:"Ice cream",name:"Ice Cream \u2013 Three Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-strawberry-snowball-delight",section:"Sundaes",name:"Strawberry Snowball Delight",description:"Vanilla & Strawberry Ice cream, Crushed Meringue, Fresh Strawberries, Strawberry Sauce, topped with a Snowball & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-biscoff-sundae",section:"Sundaes",name:"Biscoff Sundae",description:"Biscoff & Toffee Fudge Ice Cream, Whipped Cream, Crushed Lotus Biscoff Biscuits, Biscoff Topping Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-kinder-bueno-sundae",section:"Sundaes",name:"Kinder Bueno Sundae",description:"Kinder Bueno & Chocolate Ice Cream, Whipped Cream, Kinder Bueno Pieces, Chocolate Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-chilled-melon-seasonal-fruits",section:"Starters",name:"Chilled Melon & Seasonal Fruits",description:"with Fruit Coulis & Sorbet",price:850,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-garlic-mushrooms",section:"Starters",name:"Creamy Garlic Mushrooms",description:"with Cheddar Cheese & Crusty Bread",price:895,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-mediterranean-tomato-chunky-vegetable-so",section:"Starters",name:"Mediterranean Tomato & Chunky Vegetable Soup",description:"with Crusty Bread",price:650,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-honey-glazed-goats-cheese",section:"Starters",name:"Honey Glazed Goats Cheese",description:"with Tomato & Rocket Salad, Basil Pesto & Balsamic Dressing",price:850,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-freshly-baked-basket-of-bread",section:"Starters",name:"Freshly Baked Basket of Bread",description:"with Butter",price:450,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-vegetarian-vegan-add-olive-oil-balsamic",section:"Starters",name:"Add Olive Oil & Balsamic",description:"",price:100,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-boiled-egg-caesar-salad",section:"Starters",name:"Boiled Egg Caesar Salad",description:"with Croutons, Garlic Dressing & Vegetarian Cheese Shavings",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-salad-of-poached-pear-candied-walnuts",section:"Starters",name:"Salad of Poached Pear & Candied Walnuts",description:"with French Vinaigrette",price:795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-stuffed-peppers",section:"Main courses",name:"Stuffed Peppers",description:"with Braised Rice, Tomatoes, Basil & Brie, served with a Side Salad & a Bucket of Chips; without Brie is vegan",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-vegetable-cashew-nut-stir-fry",section:"Main courses",name:"Vegetable & Cashew Nut Stir Fry",description:"with Hoisin, Ginger & Garlic, served with Aromatic Rice",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Coleman\u2019s Mustard, Leeks & Matured Cheddar, served with Garlic Bread",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-pasta-arrabbiata",section:"Main courses",name:"Pasta Arrabbiata",description:"with Peppers, Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-coconut-vegetable-curry",section:"Main courses",name:"Creamy Coconut Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-katsu-vegetable-curry",section:"Main courses",name:"Katsu Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-fresh-fruit-salad",section:"Desserts",name:"Fresh Fruit Salad",description:"with Sorbet",price:700,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-sticky-toffee-pudding",section:"Desserts",name:"Sticky Toffee Pudding",description:"with Hot Caramel Sauce & Vanilla Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cherry-almond-tart",section:"Desserts",name:"Cherry & Almond Tart",description:"with Wild Cherry Ripple Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-trillionaire-tart",section:"Desserts",name:"Trillionaire Tart",description:"with Chocolate Pastry, Caramel Toffee & Chocolate Style Ganache, served with Vegan Vanilla Ice Cream",price:795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-individual-banoffee-pie",section:"Desserts",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-warm-chocolate-fudge-cake",section:"Desserts",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cheeseboard",section:"Desserts",name:"Cheeseboard",description:"served with Oatcakes & Seasonal Chutney",price:995,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-affogato",section:"Desserts",name:"Affogato",description:"1 Scoop of Plain Ice Cream with a shot of Espresso Coffee",price:650,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-ayrshire-bacon",section:"Morning (9am\u201312pm)",name:"Floured Bap with Ayrshire Bacon",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-pork-link-sausage",section:"Morning (9am\u201312pm)",name:"Floured Bap with Pork Link Sausage",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-poached-scrambled-fried",section:"Morning (9am\u201312pm)",name:"Floured Bap with Poached / Scrambled / Fried Egg",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-extra-item-on-floured-bap",section:"Morning (9am\u201312pm)",name:"Extra Item (on Floured Bap)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-traybakes",section:"Sweet treats",name:"Traybakes",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-freshly-baked-cakes",section:"Sweet treats",name:"Freshly Baked Cakes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-freshly-baked-plain-fruit-scone",section:"Sweet treats",name:"Freshly Baked Plain / Fruit Scone",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-soup-of-the-day",section:"Hot food (12pm\u20139pm)",name:"Soup of the Day",description:"with Crusty Bread; available 12pm\u20139pm",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-breaded-haddock-chips",section:"Hot food (12pm\u20139pm)",name:"Breaded Haddock & Chips",description:"with Tartare Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-steak-sausage-pie",section:"Hot food (12pm\u20139pm)",name:"Steak & Sausage Pie",description:"with Chips & Gravy",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-macaroni-cheese",section:"Hot food (12pm\u20139pm)",name:"Macaroni Cheese",description:"with Leeks, Mustard & Matured Cheddar, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-8oz-burger",section:"Hot food (12pm\u20139pm)",name:"8oz Burger",description:"with Bacon & Cheese, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-katsu-chicken-burger",section:"Hot food (12pm\u20139pm)",name:"Breaded Katsu Chicken Burger",description:"with Curried Slaw, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-cajun-chicken",section:"Hot food (12pm\u20139pm)",name:"Cajun Chicken",description:"with Rice & Coconut Curry Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-goat-s-cheese",section:"Hot food (12pm\u20139pm)",name:"Breaded Goat\u2019s Cheese",description:"with Tomato Salad, Pesto & Chutney, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-basil-pesto-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-spicy-bang-bang-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches (12pm\u20135pm)",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-tuna-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-egg-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-pork-fillet-escalopes",section:"Choose your cut",name:"Pork Fillet Escalopes",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-beef-fillet",section:"Choose your cut",name:"8oz Scotch Beef Fillet",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-sirloin",section:"Choose your cut",name:"8oz Scotch Sirloin",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-10oz-scotch-ribeye",section:"Choose your cut",name:"10oz Scotch Ribeye",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-scotch-lamb-chops",section:"Choose your cut",name:"Scotch Lamb Chops",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-600gm-scotch-t-bone-steak",section:"Choose your cut",name:"600gm Scotch T-Bone Steak",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:4500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-mixed-grill",section:"Choose your cut",name:"Souter\u2019s Mixed Grill",description:"4oz Sirloin / Chicken Breast / Lamb Chop / Pork Escalope; served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-chunky-chips-included-side-choice",section:"Side (included)",name:"Chunky Chips (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-baby-boiled-potatoes-included-side-choic",section:"Side (included)",name:"Baby Boiled Potatoes (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mashed-potato-included-side-choice",section:"Side (included)",name:"Mashed Potato (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-red-wine-jus-included-sauce-choice",section:"Sauce (included)",name:"Red Wine Jus (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-peppercorn-included-sauce-choice",section:"Sauce (included)",name:"Peppercorn (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mustard-included-sauce-choice",section:"Sauce (included)",name:"Mustard (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-onion-rings",section:"Upgrade extras",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garden-salad",section:"Upgrade extras",name:"Garden Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mixed-vegetables",section:"Upgrade extras",name:"Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-haggis-cake",section:"Upgrade extras",name:"Haggis Cake",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mac-cheese",section:"Upgrade extras",name:"Mac & Cheese",description:"",price:525,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garlic-prawns",section:"Upgrade extras",name:"Garlic Prawns",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-coleslaw",section:"Upgrade extras",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-2-course-set",section:"Festive set menu",name:"2 Course Festive Menu",description:"From 1 December, Monday\u2013Sunday 12\u20139pm, only available for tables of 10 or more. Christmas crackers included.",price:2995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-3-course-set",section:"Festive set menu",name:"3 Course Festive Menu",description:"From 1 December, Monday\u2013Sunday 12\u20139pm, only available for tables of 10 or more. Christmas crackers included.",price:3595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-chilled-melon-fruits",section:"Festive \xb7 Starters",name:"Chilled Melon & Fruits",description:"with Lemon Sorbet",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-salad-of-poached-pear-blue-cheese",section:"Festive \xb7 Starters",name:"Salad of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-souters-prawn-home-smoked-salmon-cocktail",section:"Festive \xb7 Starters",name:"Souter\u2019s Prawn & Home Smoked Salmon Cocktail",description:"with Baby Gem & Marie Rose Sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-smooth-chicken-liver-parfait",section:"Festive \xb7 Starters",name:"Smooth Chicken Liver Parfait",description:"with Spiced Plum Chutney & Oatcakes",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-soup-of-the-day",section:"Festive \xb7 Starters",name:"Soup of the Day",description:"served with Freshly Baked Crusty Bread",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-salad-of-warm-breaded-goats-cheese",section:"Festive \xb7 Starters",name:"Salad of Warm Breaded Goats Cheese",description:"with Red Onion Marmalade",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-traditional-roast-turkey",section:"Festive \xb7 Main courses",name:"Traditional Roast Turkey",description:"with Stuffing, Chipolatas, Roast Potatoes, Brussel Sprouts, Fresh Cranberry Sauce & Light Turkey Jus",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-individual-vegetable-chestnut-brie-cranberry-pie",section:"Festive \xb7 Main courses",name:"Individual Vegetable, Chestnut, Brie & Cranberry Pie",description:"served with a Creamy White Wine & Leek Sauce",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-pan-fried-fish-of-the-day-with-garlic-tiger-praw",section:"Festive \xb7 Main courses",name:"Pan Fried Fish of the Day with Garlic Tiger Prawns",description:"with Buttered Greens, Baby Potatoes, Capers & Citrus Beurre Blanc",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cajun-fillet-of-salmon-salad",section:"Festive \xb7 Main courses",name:"Cajun Fillet of Salmon Salad",description:"with Curried Coleslaw, Cashew Nuts & a Ginger & Lemongrass Dressing",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-individual-beef-steak-sausage-onion-pie",section:"Festive \xb7 Main courses",name:"Individual Beef Steak, Sausage & Onion Pie",description:"served with Creamed Potatoes & Glazed Carrots",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-lightly-peppered-breast-of-chicken",section:"Festive \xb7 Main courses",name:"Lightly Peppered Breast of Chicken",description:"served with Crispy Breaded Haggis, Champ Mashed Potatoes, Root Vegetables & Whisky Cream Sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-christmas-pudding",section:"Festive \xb7 Desserts",name:"Christmas Pudding",description:"with Brandy Sauce & Scottish Tablet Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cherry-almond-tart",section:"Festive \xb7 Desserts",name:"Cherry & Almond Tart",description:"with Chilled Cr\xe8me Anglaise & Wild Cherry Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-warm-chocolate-orange-fudge-cake",section:"Festive \xb7 Desserts",name:"Warm Chocolate & Orange Fudge Cake",description:"with Girvan Gelateria Vanilla Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cheesecake-of-the-day",section:"Festive \xb7 Desserts",name:"Cheesecake of the Day",description:"with Ice Cream",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-selection-of-scottish-farmhouse-cheese",section:"Festive \xb7 Desserts",name:"Selection of Scottish Farmhouse Cheese",description:"with Chutney, Grapes & Oatcakes",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-coffee-or-tea-with-a-mince-pie",section:"Festive \xb7 To finish",name:"Freshly Ground Coffee or Tea with a Mince Pie",description:"From 1 December, tables of 10 or more",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"souters",soldOut:!1,signOff:null})),t=235},1209,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIRKMICHAEL_MENU_COUNT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"KIRKMICHAEL_MENU",{enumerable:!0,get:function(){return n}});const s=133,n=[{id:"km-main-menu-khun-mais-canteen-grilled-aubergine",section:"Menu \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-langoustine-prawn-toast",section:"Menu \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-loch-ryan-venison-empinadas",section:"Menu \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-bbq-scotch-pork-neck-moo-ping",section:"Menu \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-scallop-slow-roasted-pork-belly",section:"Menu \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Menu \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-slow-roasted-apple-orchard-tamworth-pork-belly",section:"Menu \xb7 Main Courses on the specials board",name:"Slow Roasted Apple Orchard Tamworth Pork Belly",description:"Truffle Mash-Roasted Carrot-Spring Cabbage-Apple Puree",price:2800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-char-roasted-lamb-neck-fillet",section:"Menu \xb7 Main Courses on the specials board",name:"Char Roasted Lamb Neck Fillet",description:"Autumn Cabbage, Boiled Potatoes, Roast Carrot, Red Wine Jus",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-fire-roasted-lochryan-venison-loin",section:"Menu \xb7 Main Courses on the specials board",name:"Fire Roasted Lochryan Venison Loin",description:"Celeriac Parsley Puree-Wild Leeks-Potato Terrine-Juniper Jus",price:3900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-butter-poached-lemon-sole-fillet",section:"Menu \xb7 Main Courses on the specials board",name:"Butter Poached Lemon Sole Fillet",description:"Langoustines Tails-Pernod Chive Nage-Paris Mash-Truffle",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-grilled-tranche-of-turbot",section:"Menu \xb7 Main Courses on the specials board",name:"Grilled Tranche of Turbot",description:"Lemon Scented Monk's Beard-Pink Fir Apple Potatoes-Bearnaise",price:4400,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-lunch-khun-mais-canteen-grilled-aubergine",section:"Lunch \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-langoustine-prawn-toast",section:"Lunch \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-loch-ryan-venison-empinadas",section:"Lunch \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-bbq-scotch-pork-neck-moo-ping",section:"Lunch \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-scallop-slow-roasted-pork-belly",section:"Lunch \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Lunch \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-triple-cooked-hand-cut-chips",section:"Lunch \xb7 Sides",name:"Triple Cooked Hand Cut Chips",description:"",price:600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-khun-mais-canteen-grilled-aubergine",section:"Sunday lunch \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-langoustine-prawn-toast",section:"Sunday lunch \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-loch-ryan-venison-empinadas",section:"Sunday lunch \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-bbq-scotch-pork-neck-moo-ping",section:"Sunday lunch \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-scallop-slow-roasted-pork-belly",section:"Sunday lunch \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Sunday lunch \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-maple-glazed-bacon-loin",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Maple Glazed Bacon Loin",description:"",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-roasted-sirloin-of-scotch-beef",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Roasted Sirloin of Scotch Beef",description:"Beef Fat Roast Potatoes-Yorkshire Pudding-Spring Cabbage-Carrot-Peppercorn Sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-lemon-and-thyme-corn-fed-chicken",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Lemon and Thyme Corn Fed Chicken",description:"",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-carvery-plate",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Carvery Plate",description:"Beef, Bacon Loin, Corn Fed Chicken",price:3100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-fire-roasted-lochryan-venison-loin",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Fire Roasted Lochryan Venison Loin",description:"Celeriac Parsley Puree-Wild Leeks-Potato Terrine-Juniper Jus",price:3900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-butter-poached-lemon-sole-fillet",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Butter Poached Lemon Sole Fillet",description:"Langoustines Tails-Pernod Chive Nage-Paris Mash-Truffle",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-grilled-tranche-of-turbot",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Grilled Tranche of Turbot",description:"Lemon Scented Monk's Beard-Pink Fir Apple Potatoes-Bearnaise",price:4400,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-kids-garlic-bread",section:"Kids \xb7 Starters",name:"Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-cheesy-garlic-bread",section:"Kids \xb7 Starters",name:"Cheesy Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-soup",section:"Kids \xb7 Starters",name:"Soup",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-hamburger",section:"Kids \xb7 Mains",name:"Hamburger",description:"Scotch beef burger with brioche bun, lettuce, tomato & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-cheese-burger",section:"Kids \xb7 Mains",name:"Cheese Burger",description:"Scotch beef burger with cheddar cheese, brioche bun, lettuce, tomato & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-chicken-goujons",section:"Kids \xb7 Mains",name:"Chicken Goujons",description:"Crisp fried chicken strips with tortilla wraps, grated cheddar & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-fish-n-chips",section:"Kids \xb7 Mains",name:"Fish 'n Chips",description:"Battered haddock, lemon, tartare sauce & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-mac-n-cheese",section:"Kids \xb7 Mains",name:"Mac 'n Cheese",description:"Creamy Macaroni with cheddar cheese sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-strawberry-ice-cream",section:"Kids \xb7 Desserts",name:"Strawberry Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-chocolate-ice-cream",section:"Kids \xb7 Desserts",name:"Chocolate Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-vanilla-ice-cream",section:"Kids \xb7 Desserts",name:"Vanilla Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-sticky-toffee-pudding",section:"Kids \xb7 Desserts",name:"Sticky Toffee Pudding",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-whisky-whyte-macay",section:"Whisky \xb7 Blended Whisky",name:"Whyte & Macay",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-johnnie-walker-black-label",section:"Whisky \xb7 Blended Whisky",name:"Johnnie Walker Black Label",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-canadian-club",section:"Whisky \xb7 Blended Whisky",name:"Canadian Club",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jack-daniels-tennessee",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Jack Daniel's Tennessee",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-southern-comfort",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Southern Comfort",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-makers-mark-classic",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Maker's Mark Classic",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bulleit",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Bulleit",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bulleit-rye",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Bulleit Rye",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jim-beam-white-label",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Jim Beam White Label",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-woodford-reserve",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Woodford Reserve",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jameson",section:"Whisky \xb7 Irish Whiskey",name:"Jameson",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-hibiki-harmony-masters-masters-select",section:"Whisky \xb7 Japanese Whisky",name:"Hibiki Harmony Masters Masters Select",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenfiddich-12-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Glenfiddich 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenrothes-12-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Glenrothes 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-macallan-12-year-old-double-cask",section:"Whisky \xb7 Single Malt - Speyside",name:"Macallan 12 Year Old Double Cask",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-benrinnes-flora-fauna-15",section:"Whisky \xb7 Single Malt - Speyside",name:"Benrinnes Flora & Fauna 15",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-benrinnes-1997-maltman-18-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Benrinnes 1997 Maltman 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-balvenie-18-year-old-pedro-ximenez",section:"Whisky \xb7 Single Malt - Speyside",name:"Balvenie 18 Year Old Pedro Ximenez",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-macallan-18-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Macallan 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-aberlour-abunadh-cask-strength",section:"Whisky \xb7 Single Malt - Speyside",name:"Aberlour Abunadh Cask Strength",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-mortlach-16yo",section:"Whisky \xb7 Single Malt - Speyside",name:"Mortlach 16yo",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-dalmore-12-year-old",section:"Whisky \xb7 Single Malt - Highland",name:"Dalmore 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-oban-14-year-old",section:"Whisky \xb7 Single Malt - Highland",name:"Oban 14 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glencadam-10",section:"Whisky \xb7 Single Malt - Highland",name:"Glencadam 10",description:"",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-tomatin-legacy",section:"Whisky \xb7 Single Malt - Highland",name:"Tomatin Legacy",description:"",price:675,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-tomatin-14",section:"Whisky \xb7 Single Malt - Highland",name:"Tomatin 14",description:"",price:800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glendronach-15",section:"Whisky \xb7 Single Malt - Highland",name:"Glendronach 15",description:"",price:900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glenfarclas-21",section:"Whisky \xb7 Single Malt - Highland",name:"Glenfarclas 21",description:"",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glendronach-sherry-cask-18",section:"Whisky \xb7 Single Malt - Highland",name:"Glendronach Sherry Cask 18",description:"",price:2250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-bowmore-15-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Bowmore 15 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lagavulin-16-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Lagavulin 16 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-caol-ila-12-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Caol Ila 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-caol-ila-moch",section:"Whisky \xb7 Single Malt - Islay",name:"Caol Ila Moch",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-ardbeg-10",section:"Whisky \xb7 Single Malt - Islay",name:"Ardbeg 10",description:"",price:575,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-highland-park-12-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Highland Park 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-talisker-10-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Talisker 10 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-10-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Arran 10 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-port-cask-finish",section:"Whisky \xb7 Single Malt - Islands",name:"Arran Port Cask Finish",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-machrie-moor-cask-strength",section:"Whisky \xb7 Single Malt - Islands",name:"Machrie Moor Cask Strength",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-amarone-cask",section:"Whisky \xb7 Single Malt - Islands",name:"Arran Amarone Cask",description:"",price:725,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-hearach-oloroso-harris",section:"Whisky \xb7 Single Malt - Islands",name:"Hearach Oloroso, Harris",description:"",price:900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-ledaig-1974-mull",section:"Whisky \xb7 Single Malt - Islands",name:"Ledaig 1974, Mull",description:"",price:2250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-auchentoshan-three-wood",section:"Whisky \xb7 Single Malt - Lowlands",name:"Auchentoshan Three Wood",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-ailsa-bay",section:"Whisky \xb7 Single Malt - Lowlands",name:"Ailsa Bay",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenkinchie-12-year-old",section:"Whisky \xb7 Single Malt - Lowlands",name:"Glenkinchie 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-our-barley",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Our Barley\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-fallow-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Fallow Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-ploughing-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Ploughing Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-5",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"5\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-cask-strength-2nd-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Cask Strength 2nd Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-spirit-drink",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch Spirit Drink",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-vinaya",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch Vinaya",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-22-year-old-vintage-release",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch 22 Year Old Vintage Release",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-springbank-15-year-old",section:"Whisky \xb7 Single Malt - Campbeltown",name:"Springbank 15 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-springbank-18-year-old",section:"Whisky \xb7 Single Malt - Campbeltown",name:"Springbank 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-greyfriars-cuvee-brut",section:"Wine \xb7 Champagne/Sparkling",name:"Greyfriars Cuvee Brut",description:"England",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-greyfriars-rose-reserve",section:"Wine \xb7 Champagne/Sparkling",name:"Greyfriars Rose Reserve",description:"England",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ruinart-blank-de-blank",section:"Wine \xb7 Champagne/Sparkling",name:"Ruinart Blank De Blank",description:"",price:19e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-sanziana-pinot-noir-rose",section:"Wine \xb7 Rose",name:"Sanziana, Pinot Noir, Rose",description:"Romania",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-rose-organic",section:"Wine \xb7 Rose",name:"Art de Vivre Rose Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-orange-gold-white-organic",section:"Wine \xb7 Orange",name:"Orange Gold White Organic",description:"Gerard Bertrand Organic, France",price:6800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-les-lys-de-leon-sauvignon-blanc",section:"Wine \xb7 White",name:"Les Lys De Leon - Sauvignon Blanc",description:"Loir, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-fetele-feteasca-regala-recas-cramele",section:"Wine \xb7 White",name:"Fetele Feteasca Regala Recas Cramele",description:"Bannat, Romania",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-adam-who-riesling",section:"Wine \xb7 White",name:"Adam Who, Riesling",description:"Eden Valley, Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-rare-vineyards-marsanne-viognier",section:"Wine \xb7 White",name:"Rare Vineyards Marsanne-Viognier",description:"Languedoc France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-la-bergerie-chardonnay-francois-carillon",section:"Wine \xb7 White",name:"La Bergerie Chardonnay, Francois Carillon",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-blanc-organic",section:"Wine \xb7 White",name:"Art de Vivre Blanc Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-acrobat-pinot-gris",section:"Wine \xb7 White",name:"Acrobat Pinot Gris",description:"Oregon, U.S.A",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-dashwood-sauvignon-blanc",section:"Wine \xb7 White",name:"Dashwood Sauvignon Blanc",description:"Marlborough New Zealand",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-sancerre-la-graveli-re",section:"Wine \xb7 White",name:"Sancerre La Graveli\xe8re",description:"Joseph Mellot, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-petaluma-hanlin-hill-riesling",section:"Wine \xb7 White",name:"Petaluma Hanlin Hill Riesling",description:"Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-louis-jadot-puligny-montrachet",section:"Wine \xb7 White",name:"Louis Jadot Puligny Montrachet",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-vinvua-organic-nero-davola-doc",section:"Wine \xb7 Red",name:"Vinvua Organic Nero d'Avola DOC",description:"Sicilia Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-les-lys-de-leon-pinot-grigio",section:"Wine \xb7 Red",name:"Les Lys De Leon, Pinot Grigio",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-tres-priors-trepat-merlot",section:"Wine \xb7 Red",name:"Tres Priors Trepat Merlot",description:"Catalonia, Spain",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-alma-mora-malbec",section:"Wine \xb7 Red",name:"Alma Mora Malbec",description:"San Juan, Argentina",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-drifting-old-vine-zinfandel-lodi",section:"Wine \xb7 Red",name:"Drifting Old Vine Zinfandel Lodi",description:"California, U.S.A",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ch-teau-caz-au-maret-organic",section:"Wine \xb7 Red",name:"Ch\xe2teau Caz\xe9au Maret Organic",description:"Bordeaux, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-inzuzo-red-blend",section:"Wine \xb7 Red",name:"Inzuzo Red Blend",description:"Western Cape South Africa",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-languedoc-organic",section:"Wine \xb7 Red",name:"Art de Vivre LangueDOC Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-journeys-end-v4-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Journeys End V4 Cabernet Sauvignon",description:"South Africa",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-mucchietto-primitivo",section:"Wine \xb7 Red",name:"Mucchietto Primitivo",description:"Puglia, Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-yalumba-the-cigar-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Yalumba The Cigar Cabernet Sauvignon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-black-angus-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Black Angus Cabernet Sauvignon",description:"Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ch-teauneuf-du-pape-le-mioc-ne",section:"Wine \xb7 Red",name:"Ch\xe2teauneuf du Pape 'Le Mioc\xe8ne'",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-catena-zapata-malbec-argentino",section:"Wine \xb7 Red",name:"Catena Zapata Malbec Argentino",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-amarone-della-valpolicella-classico-reserva",section:"Wine \xb7 Red",name:"Amarone della Valpolicella Classico Reserva",description:"Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-psi-bodegas-ribera-del-duero",section:"Wine \xb7 Red",name:"Psi Bodegas Ribera Del Duero",description:"Spain",price:10600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-brunelo-di-mortlachino-ridolfi",section:"Wine \xb7 Red",name:"Brunelo Di Mortlachino Ridolfi",description:"Italy",price:16e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-flor-de-pingus-domain-de-pingus",section:"Wine \xb7 Red",name:"Flor De Pingus, Domain De Pingus",description:"Spain",price:29500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"kirkmichael",soldOut:!1,signOff:null}))},1210,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_MENU_COUNT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"WILDINGS_MENU",{enumerable:!0,get:function(){return n}});const s=83,n=[{id:"wi-lunch-smoked-haddock-gratin-with-creamed-potatoes",section:"Lunch \xb7 Starters",name:"Smoked Haddock Gratin with Creamed Potatoes",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-pear-poached-in-grenadine-with-prawns-marie-rose",section:"Lunch \xb7 Starters",name:"Pear Poached in Grenadine with Prawns Marie Rose",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chefs-pate-with-grape-chutney-toast",section:"Lunch \xb7 Starters",name:"Chefs Pate with Grape Chutney & Toast",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Lunch \xb7 Starters",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-melon-fan-with-sorbet-fruit-coulis",section:"Lunch \xb7 Starters",name:"Melon Fan with Sorbet & Fruit Coulis",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-spiced-chicken-salad-with-caesar-dressing-parmes",section:"Lunch \xb7 Starters",name:"Spiced Chicken Salad with Caesar Dressing & Parmesan",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-mushrooms-baked-in-a-cream-cheese-sauce-with-toa",section:"Lunch \xb7 Starters",name:"Mushrooms Baked in a Cream & Cheese Sauce with Toasted Ciabatta",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-smoked-haddock-salmon-chowder",section:"Lunch \xb7 Starters",name:"Smoked Haddock & Salmon Chowder",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Lunch \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-blackened-salmon-warm-potato-salad-a-pepper-must",section:"Lunch \xb7 Mains",name:"Blackened Salmon, Warm Potato Salad & a Pepper & Mustard Seed Dressing",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chicken-breast-coated-in-panko-crumb-with-a-ligh",section:"Lunch \xb7 Mains",name:"Chicken Breast Coated in Panko Crumb with a Lightly Spiced Sweet & Sour Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-fillet-of-pork-topped-with-banana-finished-with",section:"Lunch \xb7 Mains",name:"Fillet of Pork Topped with Banana Finished with a Creamy Coconut & Mango Curry Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-haddock-mornay-or-a-lemon-butter",section:"Lunch \xb7 Mains",name:"Haddock \u201cMornay\u201d or a Lemon Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chicken-piri-piri-szechuan-peppers-spices-served",section:"Lunch \xb7 Mains",name:"Chicken \u2018Piri-Piri\u2019 Szechuan Peppers & Spices served with a Yoghurt & Spring Onion Mayonnaise",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-lamb-fillet-with-a-cracked-black-pepper-cream-br",section:"Lunch \xb7 Mains",name:"Lamb Fillet with a Cracked Black Pepper Cream & Brandy Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00 \xb7 \xa32.00 supplement"},{id:"wi-lunch-pan-fried-fillet-of-hake-with-a-lobster-glaze",section:"Lunch \xb7 Mains",name:"Pan Fried Fillet of Hake with a Lobster Glaze",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-supreme-of-chicken-suedoise-white-wine-swiss-che",section:"Lunch \xb7 Mains",name:"Supreme of Chicken \u2018Suedoise\u2019 White Wine, Swiss Cheese, Cream & Mushrooms",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-spicy-chilli-with-rice-topped-with-onions-cheese",section:"Lunch \xb7 Mains",name:"Spicy Chilli with Rice Topped with Onions & Cheese",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-haddock-in-breadcrumbs-or-tempura-served-with-ta",section:"Lunch \xb7 Mains",name:"Haddock in Breadcrumbs or Tempura served with Tartar Sauce & Lemon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-lambs-liver-bacon",section:"Lunch \xb7 Mains",name:"Lambs Liver & Bacon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-any-extra-servings",section:"Lunch \xb7 Mains",name:"Any Extra Servings",description:"Each extra serving",price:395,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-dinner-tiger-prawns-tempura-with-a-sweet-chilli-dip",section:"Dinner \xb7 Starters",name:"Tiger Prawns Tempura with a Sweet Chilli Dip",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-smoked-haddock-bacon-gratin-with-braised-rice",section:"Dinner \xb7 Starters",name:"Smoked Haddock & Bacon Gratin with Braised Rice",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Dinner \xb7 Starters",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-spiced-chicken-salad-with-caesar-dressing-parmes",section:"Dinner \xb7 Starters",name:"Spiced Chicken Salad with Caesar Dressing & Parmesan",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-chefs-pate-with-grape-chutney-toast",section:"Dinner \xb7 Starters",name:"Chefs Pate with Grape Chutney & Toast",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-melon-fan-with-fresh-fruits-sorbet-mango-coulis",section:"Dinner \xb7 Starters",name:"Melon Fan with Fresh Fruits, Sorbet & Mango Coulis",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-smoked-haddock-salmon-chowder",section:"Dinner \xb7 Starters",name:"Smoked Haddock & Salmon Chowder",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Dinner \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-pear-poached-in-grenadine-with-prawns-marie-rose",section:"Dinner \xb7 Starters",name:"Pear Poached in Grenadine with Prawns Marie Rose",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-crayfish-avocado-melon-cocktail",section:"Dinner \xb7 Starters",name:"Crayfish, Avocado & Melon Cocktail",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-blackened-sea-bass-served-with-mixed-salad-a-swe",section:"Dinner \xb7 Mains",name:"Blackened Sea Bass served with Mixed Salad & a Sweet Pepper Vinaigrette",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-roast-rack-of-lamb-minted-peas-pan-juices",section:"Dinner \xb7 Mains",name:"Roast Rack of Lamb, Minted Peas & Pan Juices",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa32.50 supplement"},{id:"wi-dinner-roast-breast-of-duck-with-a-pink-peppercorn-bran",section:"Dinner \xb7 Mains",name:"Roast Breast of Duck with a Pink Peppercorn & Brandy Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-supreme-of-chicken-suedoise-white-wine-swiss-che",section:"Dinner \xb7 Mains",name:"Supreme of Chicken \u2018Suedoise\u2019 White Wine, Swiss Cheese, Cream & Mushrooms",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-lambs-liver-bacon-with-a-red-wine-jus",section:"Dinner \xb7 Mains",name:"Lambs Liver & Bacon with a Red Wine Jus",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-haddock-mornay-or-a-lemon-butter",section:"Dinner \xb7 Mains",name:"Haddock \u201cMornay\u201d or a Lemon Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-entrecote-steak-with-large-onion-rings-a-choice",section:"Dinner \xb7 Mains",name:"Entrecote Steak with Large Onion Rings & a Choice of Sauces",description:"Diane, Pepper or Caf\xe9 de Paris",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa38.00 supplement"},{id:"wi-dinner-haddock-in-breadcrumbs-or-tempura-served-with-ta",section:"Dinner \xb7 Mains",name:"Haddock in Breadcrumbs or Tempura served with Tartar Sauce & Lemon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-fillet-of-salmon-chicken-with-two-sauces-lobster",section:"Dinner \xb7 Mains",name:"Fillet of Salmon & Chicken with Two Sauces - \u2018Lobster\u2019 & White Wine Cream & Mushroom",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-fillet-steak-with-a-cracked-black-pepper-cream-s",section:"Dinner \xb7 Mains",name:"Fillet Steak with a Cracked Black Pepper & Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa312.00 supplement"},{id:"wi-dinner-fillet-of-pork-on-a-haggis-cake-with-a-mustard-g",section:"Dinner \xb7 Mains",name:"Fillet of Pork on a Haggis Cake with a Mustard Grain Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-wildings-chicken-schnitzel-topped-with-garlic-he",section:"Dinner \xb7 Mains",name:"Wildings Chicken Schnitzel Topped with Garlic & Herb Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-spicy-chilli-with-rice-topped-with-onions-cheese",section:"Dinner \xb7 Mains",name:"Spicy Chilli with Rice Topped with Onions & Cheese",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-any-extra-servings",section:"Dinner \xb7 Mains",name:"Any Extra Servings",description:"Each extra serving",price:395,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-vegetarian-roast-red-pepper-tomato-soup",section:"Vegetarian \xb7 Starters",name:"Roast Red Pepper & Tomato Soup",description:"",price:null,dietary:["GF option"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Vegetarian \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-melon-fan-with-sorbet-fruit-coulis",section:"Vegetarian \xb7 Starters",name:"Melon Fan with Sorbet & Fruit Coulis",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-mushrooms-baked-in-a-cream-cheese-sauce-with-toa",section:"Vegetarian \xb7 Starters",name:"Mushrooms Baked in a Cream & Cheese Sauce with Toasted Ciabatta",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Vegetarian \xb7 Mains",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-cajun-vegetables-crepe-glazed-in-a-cream-sauce",section:"Vegetarian \xb7 Mains",name:"Cajun Vegetables Crepe Glazed in a Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-vegan-curried-chickpea-with-cherry-tomatoes-wilt",section:"Vegetarian \xb7 Mains",name:"Vegan Curried Chickpea with Cherry Tomatoes & Wilted Spinach",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-vegetable-tempura",section:"Vegetarian \xb7 Mains",name:"Vegetable Tempura",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-mushroom-stroganoff-with-rice",section:"Vegetarian \xb7 Mains",name:"Mushroom Stroganoff with Rice",description:"",price:null,dietary:["GF option"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-sundried-tomato-feta-olive-tartlet-finished-with",section:"Vegetarian \xb7 Mains",name:"Sundried Tomato, Feta & Olive Tartlet, Finished with a Tomato Concasse & a Basil Dressing",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-sweets-trio-of-homemade-ice-creams",section:"Sweets \xb7 Desserts",name:"Trio of Homemade Ice Creams",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-cr-me-caramel-with-passion-fruit-ice-cream",section:"Sweets \xb7 Desserts",name:"Cr\xe8me Caramel with Passion Fruit Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-vanilla-cheesecake-with-strawberry-coulis-fresh",section:"Sweets \xb7 Desserts",name:"Vanilla Cheesecake with Strawberry Coulis & Fresh Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-sticky-toffee-pudding",section:"Sweets \xb7 Desserts",name:"Sticky Toffee Pudding",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-affogato",section:"Sweets \xb7 Desserts",name:"\u2018Affogato\u2019",description:"Wildings Ice Cream with a Shot of Espresso",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-chocolate-and-orange-liqueur-pot",section:"Sweets \xb7 Desserts",name:"Chocolate and Orange Liqueur Pot",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-rice-pudding-with-an-apple-compote",section:"Sweets \xb7 Desserts",name:"Rice Pudding with an Apple Compote",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-crepes-filled-with-bananas-and-maple-syrup",section:"Sweets \xb7 Desserts",name:"Crepes filled with Bananas and Maple Syrup",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-meringue-vacherin-with-a-berry-liqueur-compote",section:"Sweets \xb7 Desserts",name:"Meringue Vacherin with a Berry Liqueur Compote",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-bread-butter-pudding-with-pouring-cream",section:"Sweets \xb7 Desserts",name:"Bread & Butter Pudding with Pouring Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-selection-of-cheese-with-biscuits-grapes-chutney",section:"Sweets \xb7 Desserts",name:"Selection of Cheese with Biscuits, Grapes & Chutney",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"\xa33.00 supplement"},{id:"wi-sweets-tea",section:"Sweets \xb7 Hot drinks",name:"Tea",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-decaf-tea",section:"Sweets \xb7 Hot drinks",name:"Decaf Tea",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-espresso",section:"Sweets \xb7 Hot drinks",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-americano",section:"Sweets \xb7 Hot drinks",name:"Americano",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-latte",section:"Sweets \xb7 Hot drinks",name:"Latte",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-flat-white",section:"Sweets \xb7 Hot drinks",name:"Flat White",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-cappuccino",section:"Sweets \xb7 Hot drinks",name:"Cappuccino",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-mocha",section:"Sweets \xb7 Hot drinks",name:"Mocha",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-irish-coffee",section:"Sweets \xb7 Hot drinks",name:"Irish Coffee",description:"",price:775,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-kids-cheesy-garlic-bread",section:"Kids \xb7 Starters",name:"Cheesy Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-melon-sorbet",section:"Kids \xb7 Starters",name:"Melon & Sorbet",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-soup-of-the-day",section:"Kids \xb7 Starters",name:"Soup of the Day",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-breaded-haddock",section:"Kids \xb7 Mains",name:"Breaded Haddock",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-pasta-with-a-cheese-sauce-or-tomato-sauce",section:"Kids \xb7 Mains",name:"Pasta with a Cheese Sauce or Tomato Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-fish-pie",section:"Kids \xb7 Mains",name:"Fish Pie",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-tempura-chicken-goujons",section:"Kids \xb7 Mains",name:"Tempura Chicken Goujons",description:"All can be served with Fries and a choice of Beans or Vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-homemade-ice-cream",section:"Kids \xb7 Dessert",name:"Homemade Ice Cream",description:"Please ask Staff for Our Ice Cream Selection",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"}].map(s=>({...s,restaurantId:"wildings",soldOut:!1,signOff:null}))},1211,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SECTIONS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anchorageMenu",{enumerable:!0,get:function(){return o}});const i=i=>({id:i,name:'Served with',required:!0,multi:!1,choices:[{id:`${i}-custard`,label:'Custard',priceDelta:0,allergens:{}},{id:`${i}-icecream`,label:'Ice cream',priceDelta:0,allergens:{}},{id:`${i}-cream`,label:'Cream',priceDelta:0,allergens:{}},{id:`${i}-vegan`,label:'Vegan ice cream (ask server)',priceDelta:0,allergens:{}}]}),s=(i,s,n)=>({id:i,name:'Portion',required:!0,multi:!1,choices:[{id:`${i}-starter`,label:'Starter',priceDelta:0},{id:`${i}-main`,label:n,priceDelta:s}]}),n=[{id:'a-soup',section:'Starters',name:"Chef's Soup of the Day",description:'A heartwarming bowl of seasonal homemade soup, served with warm crusty bread and butter.',price:600,dietary:[],allergens:{},allergenNotes:'Recipe changes daily \u2014 check the day\u2019s soup.',prepMins:0},{id:'a-skink',section:'Starters',name:'Cullen Skink',description:'Traditional creamy soup made with locally smoked haddock, potatoes and leeks, served with warm crusty bread and butter.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-salmon',section:'Starters',name:'Scottish Smoked Salmon Roulade',description:'Delicate Scottish smoked salmon rolled with herb-infused cream cheese, served with garlic & herb crostini and dressed salad.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-haggis',section:'Starters',name:'Haggis Bon Bons',description:'Crisp golden panko-fried haggis balls, finished with a velvety Scotch whisky sauce and caramelised apple gel.',price:800,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-crabcakes',section:'Starters',name:'Spiced Crab Cakes',description:'Golden crab cakes, delicately seasoned with herbs and spices, served with crisp seasonal salad and house-made Marie Rose sauce.',price:900,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-tempura',section:'Starters',name:'Deluxe Mixed Tempura',description:"King prawns, chicken and lion's mane mushrooms in a light, crispy tempura batter, served with a dressed seasonal salad and house dipping sauce.",price:1e3,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[s('tempura',900,'Main with triple-cooked chips (\xa319.00)')]},{id:'a-kingoyster',section:'Starters',name:"Pan-Seared King Oyster Mushroom 'Scallops' (VG)",description:"King oyster mushroom 'scallops' prepared with the chef's special recipe of the day. Ask your server or see our specials board for today's garnish and accompaniments.",price:1e3,dietary:['VG'],allergens:{},allergenNotes:'Garnish changes daily \u2014 sign-off needed for each version.',prepMins:0,special:!0,unsigned:!0,optionGroups:[s('kingoyster',800,'Main (\xa318.00)')]},{id:'a-fishsupper',section:'Mains',name:'Fish Supper',description:'Locally landed haddock, available beer-battered or breaded, served with buttered peas, triple-cooked chips and homemade tartare sauce.',price:1800,dietary:['GF option'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'fs-coat',name:'Coating',required:!0,multi:!1,choices:[{id:'fs-batter',label:'Beer-battered',priceDelta:0},{id:'fs-bread',label:'Breaded',priceDelta:0}]}]},{id:'a-lionsmane',section:'Mains',name:"Southern Fried Lion's Mane Burger (VG)",description:"Crispy southern fried lion's mane mushroom, layered with vegan cheese and garlic aioli, served with triple-cooked chips and golden onion rings.",price:1800,dietary:['VG'],allergens:{},prepMins:0},{id:'a-pie',section:'Mains',name:'Steak & Ale Pie',description:'Slow-braised beef in a rich ale jus beneath golden all-butter puff pastry, served with buttered seasonal vegetables.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'pie-side',name:'Served with',required:!0,multi:!1,choices:[{id:'chips',label:'Triple-cooked chips',priceDelta:0},{id:'creamed',label:'Creamed potatoes',priceDelta:0,allergens:{}}]}]},{id:'a-bananablossom',section:'Mains',name:"Beer-Battered Banana Blossom 'Fish' Goujons (VG)",description:'Crisp beer-battered banana blossom goujons, dusted with locally foraged truffle seaweed seasoning, served with triple-cooked chips, garden peas and vegan tartare sauce.',price:1700,dietary:['VG'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-chicken',section:'Mains',name:'Roasted Breast of Chicken',description:'Golden pan-roasted chicken breast, served with creamed potatoes, buttered seasonal primaryBtns, and a fragrant lemon & thyme bouillon.',price:1900,dietary:[],allergens:{},prepMins:0},{id:'a-maccheese',section:'Mains',name:'Macaroni Cheese (V)',description:'Rich mature Cheddar macaroni finished with a golden cheese glaze, served with two slices of garlic bread.',price:1700,dietary:['V'],allergens:{},prepMins:0},{id:'a-penne',section:'Mains',name:'Cajun Chicken & Chorizo Penne Pasta',description:'Tender Cajun-spiced chicken strips, mixed peppers, red onion and smoky chorizo, tossed in a bold, creamy Cajun sauce, served with two slices of garlic bread.',price:1700,dietary:[],allergens:{},prepMins:0},{id:'a-caesar',section:'Mains',name:'Chicken Caesar Salad',description:'Tender pan-roasted chicken breast served on a bed of baby gem lettuce with golden garlic croutons, Parmesan and a classic Caesar dressing.',price:1800,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'caesar-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'caesar-bacon',label:'Add smoked Ayrshire bacon',priceDelta:150}]}]},{id:'a-moules',section:'Mains',name:'Moules Marini\xe8re',description:'Fresh Scottish mussels, steamed to perfection in a rich, creamy white wine and garlic sauce.',price:1200,dietary:[],allergens:{},prepMins:0,optionGroups:[s('moules',1e3,'Main 500g with triple-cooked chips (\xa322.00)')]},{id:'a-fillet',section:'From the Grill',name:'8oz Fillet Steak',description:'Prime 8oz fillet steak served with truffled woodland mushrooms, seasonal primaryBtns, golden onion rings and triple-cooked chips.',price:3800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'steak-sauce',name:'Sauce',required:!1,multi:!1,choices:[{id:'sauce-pepper',label:'Peppercorn sauce',priceDelta:0,allergens:{}},{id:'sauce-garlic',label:'Garlic butter',priceDelta:0,allergens:{}}]},{id:'steak-surf',name:'Surf & turf add-on',required:!1,multi:!1,choices:[{id:'surf-prawns',label:'Garlic prawns',priceDelta:800,allergens:{}},{id:'surf-scallops',label:'Scottish West Coast scallops',priceDelta:1e3,allergens:{}}]}]},{id:'a-claymore',section:'From the Grill',name:'The Claymore Burger',description:'One juicy 6oz homemade Scottish beef burger in a brioche bun with baby gem lettuce, tomato and gherkins, topped with cheese, smoked Ayrshire bacon and onion rings. Served with triple-cooked chips.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'claymore-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'claymore-haggis',label:'Add haggis and whisky sauce',priceDelta:150,allergens:{}}]}]},{id:'a-langoustines',section:"Captain's Table",name:'Whole Scottish Grilled Langoustines',description:'Locally caught whole Scottish langoustines grilled in garlic butter, served with a vibrant side salad and burnt lemon.',price:1700,dietary:[],allergens:{},prepMins:0,optionGroups:[s('lang',1200,'Main 500g with triple-cooked chips (\xa329.00)')]},{id:'a-scallops',section:"Captain's Table",name:'Pan-Seared West Coast Scallops',description:"Scottish West Coast scallops prepared to the chef's recipe of the day. Starter and main portions \u2014 see price on Specials Board.",price:null,priceNote:'See specials board',dietary:[],allergens:{},prepMins:0,special:!0,unsigned:!0},{id:'a-lobster',section:"Captain's Table",name:'Grilled Dunure Lobster',description:'Fresh Dunure lobster, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:3500,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'lobster-size',name:'Size',required:!0,multi:!1,choices:[{id:'lob-half',label:'Half',priceDelta:0},{id:'lob-whole',label:'Whole (\xa365.00)',priceDelta:3e3}]}]},{id:'a-crab',section:"Captain's Table",name:'Grilled Dunure Crab',description:'Freshly landed Dunure brown crab, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:4e3,dietary:[],allergens:{},prepMins:0},{id:'a-smorgasbord',section:'Platters',name:'Seafood Smorgasbord (serves one)',description:"250g langoustines, 3 pan-seared West Coast scallops, 250g fresh mussels, 6 garlic prawns and a roll of Scottish smoked salmon, with dressed side salad and warm crusty bread.",price:5e3,dietary:[],allergens:{},prepMins:0},{id:'a-deluxe',section:'Platters',name:'Deluxe Seafood Platter (serves two)',description:'One whole Dunure lobster, one whole Dunure crab, 500g whole langoustines, 500g moules marini\xe8re, pan-seared scallops, Scottish smoked salmon and 6 garlic prawns, with two portions of chips, side salad and warm crusty bread.',price:16500,dietary:[],allergens:{},prepMins:0},{id:'a-onionrings',section:'Sides',name:'House Beer-Battered Onion Rings (V)',description:'Crisp house beer-battered onion rings, served golden and crunchy.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-garlicbread',section:'Sides',name:'Garlic Bread (V)',description:'Warm toasted garlic bread, finished with garlic & parsley butter.',price:450,dietary:['V'],allergens:{},prepMins:0,optionGroups:[{id:'gb-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'gb-cheese',label:'Add cheese',priceDelta:100}]}]},{id:'a-chips',section:'Sides',name:'Triple-Cooked Chips (V)',description:'Golden triple-cooked chips, lightly tossed in Maldon sea salt.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'chips-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'chips-cajun',label:'Add Cajun seasoning',priceDelta:0,allergens:{}}]}]},{id:'a-truffle',section:'Sides',name:'Parmesan & Truffle Fries (V)',description:'Crispy fries topped with finely grated parmesan and tossed in a winter truffle infused oil.',price:500,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-salad',section:'Sides',name:'Side Salad (VG)',description:'Seasonal mixed leaves with cucumber, red onion and mixed peppers, finished with a light vinaigrette.',price:450,dietary:['VG'],allergens:{},prepMins:0},{id:'a-brulee',section:'Desserts',name:"Chef's Cr\xe8me Br\xfbl\xe9e of the Day (V)",description:"Smooth Madagascan custard with a delicately caramelised sugar crust. Ask your server or see our specials board for today's flavour.",price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-crumble',section:'Desserts',name:'Seasonal Fruit Crumble (V)',description:'Slow-cooked seasonal fruit topped with a golden buttery crumble.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('crumble')]},{id:'a-stp',section:'Desserts',name:'Sticky Toffee Pudding (V)',description:'A rich, homemade steamed date pudding, drenched in our signature homemade butterscotch sauce.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('stp')]},{id:'a-cheesecake',section:'Desserts',name:'Cheesecake of the Day (V)',description:'A smooth, creamy cheesecake on a buttery biscuit base. Gluten-free and vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('cheesecake')]},{id:'a-affogato',section:'Desserts',name:'Affogato (V)',description:'Two scoops of creamy vanilla ice cream with a freshly brewed shot of Italian espresso poured over. Vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0}],t=['Starters','Mains','From the Grill',"Captain's Table",'Platters','Sides','Desserts','Mini Anchors (under 12s)'],o=n.map(({unsigned:i,soldOut:s,...n})=>({...n,allergens:{},allergenNotes:'',prepMins:0,optionGroups:n.optionGroups?.map(i=>({...i,choices:i.choices.map(i=>({...i,allergens:{}}))})),restaurantId:"anchorage",soldOut:!!s,signOff:null}))},1212,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SCOTTISH_BANK_HOLIDAYS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"BANK_HOLIDAY_SOURCE",{enumerable:!0,get:function(){return n}});const t=[{date:"2026-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2026-12-25",title:"Christmas Day",notes:""},{date:"2026-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2027-01-01",title:"New Year\u2019s Day",notes:""},{date:"2027-01-04",title:"2nd January",notes:"Substitute day"},{date:"2027-03-26",title:"Good Friday",notes:""},{date:"2027-05-03",title:"Early May bank holiday",notes:""},{date:"2027-05-31",title:"Spring bank holiday",notes:""},{date:"2027-08-02",title:"Summer bank holiday",notes:""},{date:"2027-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2027-12-27",title:"Christmas Day",notes:"Substitute day"},{date:"2027-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2028-01-03",title:"New Year\u2019s Day",notes:"Substitute day"},{date:"2028-01-04",title:"2nd January",notes:"Substitute day"},{date:"2028-04-14",title:"Good Friday",notes:""},{date:"2028-05-01",title:"Early May bank holiday",notes:""},{date:"2028-05-29",title:"Spring bank holiday",notes:""},{date:"2028-08-07",title:"Summer bank holiday",notes:""},{date:"2028-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2028-12-25",title:"Christmas Day",notes:""},{date:"2028-12-26",title:"Boxing Day",notes:""}],n='gov.uk/bank-holidays.json (Scotland)'},1213,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MESSAGING_CONFIG",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"previewProvider",{enumerable:!0,get:function(){return t}}),_e.relayProvider=n,Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"activeProvider",{enumerable:!0,get:function(){return s}});const e={mode:'preview',endpoint:'',smsService:'Twilio',emailService:'Postmark',smsSenderId:'ANCHORAGE',fromEmail:'bookings@your-venue.co.uk'},t={id:'preview',label:'Preview mode (nothing is sent)',live:!1,deliver:async()=>({ok:!0})};function n(e){return{id:'relay',label:'Your messaging server',live:!0,deliver:async t=>{try{const n=await fetch(e,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({channel:t.channel,to:t.to,subject:t.subject,body:t.body,html:t.html,ref:t.ref,kind:t.kind,restaurantId:t.restaurantId})});if(!n.ok)return{ok:!1,error:`Server said ${n.status}`};return{ok:!0,providerId:(await n.json().catch(()=>({}))).id}}catch(e){return{ok:!1,error:e?.message??'Network error'}}}}}const o=()=>'live'===e.mode&&!!e.endpoint,s=()=>o()?n(e.endpoint):t},1214,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"DEFAULT_TEMPLATES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PLACEHOLDERS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"teamName",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"longDate",{enumerable:!0,get:function(){return u}}),e.bookingVars=function(n,r){const o=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen).toLowerCase()}`).join(', '),a=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),i=`${n.partySize} ${1===n.partySize?'person':'people'}`,s={...c(r),first:l(n.name),name:n.name.trim(),date:u(n.date),time:n.time,covers:i,ref:n.ref};return{sms:{...s,allergy:n.allergies.length?` We\u2019ve noted the allergy (${o}) and the team will check it with you when you arrive.`:'',note:'',details:''},email:{...s,allergy:n.allergies.length?`Thank you for telling us about: ${a}. Our team will go through this with you when you arrive, and every dish for your table is checked at each step, from the kitchen to your table.`:'',note:n.notes.trim()?`Your note to us: "${n.notes.trim()}". We\u2019ll make sure the team sees it.`:'',details:[`Date: ${u(n.date)}`,`Time: ${n.time}`,`Table for: ${i}`,`Reference: ${n.ref}`].join('\n')}}},e.orderVars=function(r,o){const a=r.lines.reduce((t,n)=>t+n.qty,0),i=r.readyBy??r.slotTime,s=i?`at ${m(i)}`:'time to be confirmed',d=r.allergies.map(n=>(0,t.allergenLabel)(n.allergen).toLowerCase()).join(', '),u=r.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),y={...c(o),first:l(r.customerName),name:r.customerName,ref:r.ref,items:`${a} ${1===a?'item':'items'}`,total:(0,n.gbp)(r.total),collect:s,date:'',time:i?m(i):'',covers:''};return{sms:{...y,allergy:r.allergies.length?` We\u2019ve noted your allergy (${d}); the kitchen checks every item.`:'',itemList:'',details:'',note:''},email:{...y,allergy:r.allergies.length?`You told us about: ${u}. The kitchen signs off every item against it before your order leaves the pass.`:'',itemList:r.lines.map(t=>`${t.qty} \xd7 ${t.name}${t.choices.length?` (${t.choices.join(', ')})`:''}`).join('\n'),details:[`Order: ${r.ref}`,`Collection: ${i?m(i):'time to be confirmed'}`,`Items: ${a}`,`Total: ${(0,n.gbp)(r.total)}`].join('\n'),note:''}}},e.fill=y,Object.defineProperty(e,"fillEmailText",{enumerable:!0,get:function(){return h}}),e.emailHtml=function(t,n){const r=n.accent??'#B8893E',o=t.split(/\n{2,}/).map(t=>{const n=t.split('\n');return n.length>1&&n.every(t=>/^[^:]{2,22}:\s.+/.test(t))?`${n.map(t=>{const n=t.indexOf(':');return``}).join('')}
${p(t.slice(0,n))}${p(t.slice(n+1).trim())}
`:n.length>1&&n.every(t=>/^\d+ \xd7/.test(t))?`
    ${n.map(t=>`
  • ${p(t)}
  • `).join('')}
`:`

${n.map(p).join('
')}

`}).join('');return`${p(n.preheader??'')}
${p(n.venue.toUpperCase())}
${o}
You\u2019re getting this because you made a booking or order with ${p(n.venue)}. It\u2019s about your booking only, not marketing.
`},e.smsParts=function(t){const n=b(t),r=!f.test(n),o=n.length,a=r?o<=70?1:Math.ceil(o/67):o<=160?1:Math.ceil(o/153);return{chars:o,parts:a,unicode:r}},Object.defineProperty(e,"toGsm",{enumerable:!0,get:function(){return b}});var t=_r(_d[0]),n=_r(_d[1]);const r={booking:{title:'Booking confirmed',when:'Every booking: online, phone or in person (and when you confirm a request)'},request:{title:'Booking request received',when:'Online bookings that need you to confirm them first'},declined:{title:'Booking request declined',when:'When you decline a booking request'},order:{title:'Takeaway order confirmed',when:'Every takeaway order from the app (and phone orders with a number)'}},o={booking:{sms:'Hi {first}, you\u2019re booked in at {venue}: {date} at {time}, {covers}. Ref {ref}.{allergy} Need to change or cancel? Just call {venuePhone}. See you soon, {team}',subject:'You\u2019re booked in at {venue}: {date} at {time}',body:'Hi {first},\n\nThank you for booking with us. We\u2019re really looking forward to welcoming you.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf your plans change, just give us a ring on {venuePhone} and we\u2019ll happily move or cancel it for you. Please quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nWarm wishes,\n{team}'},request:{sms:'Hi {first}, thanks for your booking request at {venue} for {date} at {time}, {covers}. We\u2019ll text you shortly to confirm. Ref {ref}. Questions? Call {venuePhone}. {team}',subject:'We\u2019ve got your booking request for {date}',body:'Hi {first},\n\nThank you for your booking request. A member of the team will look at it and confirm with you very shortly.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf you have any questions in the meantime, call us on {venuePhone} and quote {ref}.\n\nWarm wishes,\n{team}'},declined:{sms:'Hi {first}, we\u2019re so sorry, we can\u2019t fit {covers} in on {date} at {time}. Please call {venuePhone} and we\u2019ll do our best to find another time. {team}',subject:'About your booking request for {date}',body:'Hi {first},\n\nThank you for asking to book with us. We\u2019re really sorry, but we can\u2019t fit your party in on {date} at {time}.\n\nWe\u2019d love to find another time that works. Give us a ring on {venuePhone} and we\u2019ll do our best.\n\nWith apologies and warm wishes,\n{team}'},order:{sms:'Hi {first}, thanks for your order {ref} from {venue}: {items}, {total}. Collection {collect}.{allergy} Questions? Call {venuePhone}. {team}',subject:'Your {venue} order {ref}',body:'Hi {first},\n\nThank you for your order. The kitchen has it and we\u2019ll have it ready for you.\n\n{details}\n\n{itemList}\n\n{allergy}\n\nAny questions, or need to change something? Call us on {venuePhone} and quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nEnjoy!\n{team}'}},a=[{key:'first',what:'Guest\u2019s first name'},{key:'name',what:'Name on the booking'},{key:'venue',what:'Venue name'},{key:'date',what:'Day and date'},{key:'time',what:'Time'},{key:'covers',what:'e.g. 4 people'},{key:'ref',what:'Reference'},{key:'venuePhone',what:'Venue phone'},{key:'address',what:'Venue address'},{key:'team',what:'e.g. The Anchorage team'},{key:'allergy',what:'Allergy reassurance (only if one was noted)'},{key:'note',what:'Their note (email only)'},{key:'details',what:'Details box (email only)'},{key:'items',what:'Orders: e.g. 3 items'},{key:'total',what:'Orders: total'},{key:'collect',what:'Orders: collection time'},{key:'itemList',what:'Orders: list of items (email)'}],i=t=>/^the\s/i.test(t.trim())?`${t.trim()} team`:`The ${t.trim()} team`,l=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||'there',s=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=['January','February','March','April','May','June','July','August','September','October','November','December'],u=t=>{const[n,r,o]=t.split('-').map(Number),a=new Date(n,r-1,o,12);return`${s[a.getDay()]} ${o} ${d[r-1]}`},m=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`};function c(t){return{venue:t.name,venuePhone:t.phone||'the restaurant',address:t.address||t.location,team:i(t.name)}}function y(t,n){return t.replace(/\{(\w+)\}/g,(t,r)=>r in n?n[r]:t).replace(/[ \t]{2,}/g,' ').replace(/ +([.,])/g,'$1').trim()}const h=(t,n)=>y(t,n).split(/\n{2,}/).map(t=>t.trim()).filter(Boolean).join('\n\n'),p=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"');const f=/^[A-Za-z0-9 \r\n@\xa3$\xa5\xe8\xe9\xf9\xec\xf2\xc7\xd8\xf8\xc5\xe5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\xc6\xe6\xdf\xc9!"#\xa4%&'()*+,\-./:;<=>?\xa1\xc4\xd6\xd1\xdc\xa7\xbf\xe4\xf6\xf1\xfc\xe0^{}\\[~\]|\u20ac]*$/;const b=t=>t.replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').replace(/[\u2013\u2014]/g,'-').replace(/\u2026/g,'...').replace(/\xd7/g,'x')},1215,[819,820]); +__d(function(g,_r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PHONE_ERROR",{enumerable:!0,get:function(){return s}}),e.ukPhone=function(s){if(!(s??'').trim())return{ok:!1,error:t};const o=n(r(s));return'bad'in o?{ok:!1,error:'chars'===o.bad?'Please use numbers only, for example 07700 900123.':'That doesn\u2019t look like a UK mobile or landline. For example 07700 900123 or 01292 502826.'}:o},e.guestPhone=function(o){if(!(o??'').trim())return{ok:!1,error:t};const u=r(o);if(/^(\+44|0044)/.test(u)||/^44\d{10}$/.test(u)||!/^(\+|00)/.test(u)){const t=n(u);return'bad'in t?{ok:!1,error:s}:t}const d=u.replace(/^(\+|00)/,'');if(!/^[1-9]\d+$/.test(d))return{ok:!1,error:s};const h=d.slice(0,l(d));let $=d.slice(h.length);$.startsWith('0')&&'39'!==h&&($=$.slice(1));return $.length<7||$.length>15||h.length+$.length>15?{ok:!1,error:s}:{ok:!0,e164:`+${h}${$}`,pretty:`+${h} ${c($)}`,kind:'international'}},e.emailOk=function(t){const s=(t??'').trim();return!s||/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s)};const t='A phone number is needed so we can send the confirmation.',s='That doesn\u2019t look like a phone number. For example 07700 900123 or +971 56 411 2017.';function n(t){if(t.startsWith('+44')?t='0'+t.slice(3):t.startsWith('0044')?t='0'+t.slice(4):/^44\d{10}$/.test(t)&&(t='0'+t.slice(2)),t.startsWith('0(0)')&&(t=t.replace('0(0)','0')),t.startsWith('00')&&(t=t.slice(1)),!/^0\d+$/.test(t))return{bad:'chars'};const s=/^07\d{9}$/.test(t),n=/^0[1238]\d{8,9}$/.test(t);if(!s&&!n)return{bad:'shape'};const r=s?`${t.slice(0,5)} ${t.slice(5)}`:/^02/.test(t)?`${t.slice(0,3)} ${t.slice(3,7)} ${t.slice(7)}`:/^0(3|8)/.test(t)?`${t.slice(0,4)} ${t.slice(4,7)} ${t.slice(7)}`:`${t.slice(0,5)} ${t.slice(5)}`;return{ok:!0,e164:'+44'+t.slice(1),pretty:r,kind:s?'mobile':'landline'}}const r=t=>(t??'').trim().replace(/[\s\-().]/g,'');const o=new Set('20 27 30 31 32 33 34 36 39 40 41 43 44 45 46 47 48 49 51 52 53 54 55 56 57 58 60 61 62 63 64 65 66 81 82 84 86 90 91 92 93 94 95 98'.split(' ')),l=t=>/^[17]/.test(t)?1:o.has(t.slice(0,2))?2:3;function c(t){const s=[t.slice(-4)];let n=t.slice(0,-4);for(;n.length>3;)s.unshift(n.slice(-3)),n=n.slice(0,-3);return n&&s.unshift(n),s.join(' ')}},1216,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shallow",{enumerable:!0,get:function(){return c}});const t=t=>Symbol.iterator in t,n=t=>"entries"in t,o=(t,n)=>{const o=t instanceof Map?t:new Map(t.entries()),s=n instanceof Map?n:new Map(n.entries());if(o.size!==s.size)return!1;for(const[t,n]of o)if(!s.has(t)||!Object.is(n,s.get(t)))return!1;return!0},s=(t,n)=>{const o=t[Symbol.iterator](),s=n[Symbol.iterator]();let c=o.next(),u=s.next();for(;!c.done&&!u.done;){if(!Object.is(c.value,u.value))return!1;c=o.next(),u=s.next()}return!!c.done&&!!u.done};function c(c,u){return!!Object.is(c,u)||"object"==typeof c&&null!==c&&"object"==typeof u&&null!==u&&(Object.getPrototypeOf(c)===Object.getPrototypeOf(u)&&(t(c)&&t(u)?n(c)&&n(u)?o(c,u):s(c,u):o({entries:()=>Object.entries(c)},{entries:()=>Object.entries(u)})))}},1217,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setLiveData=c,e.requireRealData=function(){t=!0,c(!0)},Object.defineProperty(e,"liveData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"examplesAllowed",{enumerable:!0,get:function(){return l}}),e.onDataModeChange=function(n){return s.add(n),()=>{s.delete(n)}},Object.defineProperty(e,"EXAMPLE_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"notEnoughTip",{enumerable:!0,get:function(){return b}});const n=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("abbotsford");let t=n,o=n;const s=new Set;function c(n){o!==(n=t||n)&&(o=n,s.forEach(n=>n()))}const u=()=>o,l=()=>!o;const f='Example figures',b=n=>`Forecasts start once CoverCharge has ${1===n?'1 week':`${n} weeks`} of your bookings and cash-ups.`},1218,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EXAMPLE_TAG",{enumerable:!0,get:function(){return t}}),_e.exampleCards=function(t){return l.flatMap(l=>{const h=t.find(e=>e.id===l.menuItemId);if(!h)return[];return[{id:(0,e.uuidFrom)(`card:${h.restaurantId}:${h.id}`),restaurantId:h.restaurantId,menuItemId:h.id,dish:h.name,section:h.section,price:h.price,photo:l.photo,ingredients:o(l.menuItemId,l.ings),steps:l.steps,allergens:l.allergens,dismissed:l.dismissed??[],allergenNotes:l.notes,allergensConfirmed:{by:s.by,at:s.at},signOff:l.awaiting?null:s,wasLive:!0,origin:'example',version:l.awaiting?2:1,createdAt:n,updatedAt:l.awaiting?'2026-10-28T15:20:00.000Z':n,updatedBy:l.awaiting?'Example edit (demo)':s.by}]})},_e.importedCard=function(t,s){return{id:(0,e.uuidFrom)(`card:${t.restaurantId}:${t.id}`),restaurantId:t.restaurantId,menuItemId:t.id,dish:t.name,section:t.section,price:t.price,ingredients:[],steps:[],allergens:{...t.allergens},dismissed:[],allergenNotes:t.allergenNotes,allergensConfirmed:t.signOff?{by:t.signOff.by,at:t.signOff.at}:void 0,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at}:null,wasLive:!t.hidden||!!t.signOff,origin:'imported',version:1,createdAt:s,updatedAt:s,updatedBy:'Imported from the menu'}};var e=r(d[0]);const t='Example data',s={by:'Example sign-off (demo)',at:'2026-10-26T10:00:00.000Z'},n='2026-10-26T09:00:00.000Z',o=(e,t)=>t.map(([t,s,n],o)=>({id:`${e}-i${o}`,qty:t,unit:s,name:n})),l=[{menuItemId:'a-lobster',photo:'asset:lobster',ings:[['1','whole','Live Dunure lobster (c. 600 g, Kitty Fisher)'],['60','g','Garlic butter'],['\xbd','','Lemon, charred'],['60','g','Mixed leaves, cucumber and red onion'],['15','ml','House vinaigrette (Dijon mustard)'],['200','g','Triple-cooked chips']],steps:['Chill the lobster for 20 minutes, then dispatch humanely and split lengthways. Remove the stomach sac and the intestinal tract.','Crack the claws. Season the flesh and spoon over half the garlic butter.','Grill flesh side up for 6\u20138 minutes until just opaque; baste with the rest of the butter.','Char the lemon on the grill. Dress the salad at the pass.','Plate on the long board: lobster, claws alongside, salad, chips in the cone, lemon and a pot of the pan butter.'],allergens:{crustaceans:'contains',milk:'contains',mustard:'contains',gluten:'may',fish:'may'},notes:'Chips are cooked in a shared fryer (gluten, fish, crustaceans may be present).'},{menuItemId:'a-skink',photo:'asset:skink',ings:[['120','g','Smoked haddock, undyed'],['200','ml','Whole milk'],['20','g','Butter'],['60','g','Leek, sliced'],['40','g','Onion, diced'],['120','g','Floury potato, diced'],['1','tbsp','Parsley, chopped'],['1','slice','Crusty bread'],['10','g','Butter (portion)']],steps:['Poach the haddock in the milk for 5 minutes. Lift out, flake and keep the milk.','Sweat the leek and onion in the butter until soft, with no colour.','Add the potato and the poaching milk; simmer for 15 minutes until the potato breaks down.','Crush a third of the potato for body, return the haddock and season with pepper.','Serve in the warm bowl, parsley on top, bread and butter on the side.'],allergens:{fish:'contains',milk:'contains',gluten:'contains'}},{menuItemId:'a-fishsupper',photo:'asset:fishsupper',ings:[['200','g','Haddock fillet, locally landed'],['80','g','Self-raising flour'],['100','ml','Beer (lager)'],['250','g','Triple-cooked chips'],['80','g','Garden peas'],['10','g','Butter'],['40','g','Tartare sauce (mayonnaise, capers, gherkins)'],['\xbc','','Lemon']],steps:['Whisk the flour and cold beer to a thick batter; rest for 10 minutes.','Dust the haddock in flour, dip in the batter and lower into the fryer at 180 \xb0C for 5\u20136 minutes.','Fry the chips at 190 \xb0C until golden.','Warm the peas with the butter.','Plate the fish on the chips, peas in the ramekin, tartare and lemon on the side.'],allergens:{fish:'contains',gluten:'contains',eggs:'contains',milk:'contains',mustard:'may',crustaceans:'may',sulphites:'may'},notes:'Shared fryer. Tartare is made with mayonnaise (egg, may contain mustard). The beer in the batter may contain sulphites.'},{menuItemId:'a-moules',photo:'asset:moules',ings:[['500','g','Scottish rope mussels, cleaned'],['30','g','Butter'],['1','','Shallot, finely diced'],['2','cloves','Garlic, sliced'],['100','ml','Dry white wine'],['60','ml','Double cream'],['1','tbsp','Parsley, chopped'],['2','slices','Crusty bread']],steps:['Check every mussel: discard any that are cracked or stay open when tapped.','Sweat the shallot and garlic in the butter for 2 minutes.','Add the mussels and wine, cover and steam on a high heat for 3\u20134 minutes until they open.','Discard any that stay shut. Stir in the cream and parsley.','Serve in the deep bowl with the bread and an empty-shell bowl.'],allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',gluten:'contains'}},{menuItemId:'a-stp',photo:'asset:stp',awaiting:!0,ings:[['30','g','Medjool dates, chopped'],['40','ml','Boiling water'],['25','g','Butter'],['30','g','Dark muscovado sugar'],['1','','Egg (\xbd per portion)'],['35','g','Self-raising flour'],['60','ml','Butterscotch sauce (butter, cream, brown sugar)']],steps:['Soak the dates in the boiling water for 10 minutes, then blitz.','Cream the butter and sugar, beat in the egg, fold in the flour and the dates.','Steam in buttered moulds for 35 minutes.','Warm the butterscotch sauce.','Turn out, pour over the sauce and serve with the guest\u2019s choice of custard, ice cream or cream.'],allergens:{gluten:'contains',milk:'contains',eggs:'contains',sulphites:'may'},notes:'Dried dates may contain sulphites. Accompaniments are chosen at order (see the dish options).'}]},1219,[1179]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg",width:800,height:600,toString(){return this.uri}}},1220,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg",width:800,height:600,toString(){return this.uri}}},1221,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},1222,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},1223,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},1224,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAvatars",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),o=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]);const l=(0,s.create)()((0,n.persist)((e,t)=>({photos:{},log:[],clears:{},doneClear:t=>e(e=>{if(!e.clears?.[t])return e;const o={...e.clears};return delete o[t],{clears:o}}),setOwn:(t,o,s,n)=>{if(!t||t!==o||!s.startsWith('data:image/'))return!1;const l=(new Date).toISOString();return e(e=>({clears:Object.fromEntries(Object.entries(e.clears??{}).filter(([e])=>e!==o)),photos:{...e.photos,[o]:{dataUrl:s,at:l}},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'made',by:n,at:l},...e.log].slice(0,100)})),!0},reset:(o,s)=>{if(s.id!==o&&'staff'===s.role)return!1;if(!t().photos[o])return!1;const n={...t().photos};return delete n[o],e(e=>({photos:n,clears:{...e.clears??{},[o]:(new Date).toISOString()},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'reset',by:s.name,at:(new Date).toISOString()},...e.log].slice(0,100)})),!0}}),{name:'covercharge-avatars-v1',storage:(0,n.createJSONStorage)(()=>o.default),version:1}))},1225,[1190,995,1191]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FunctionRegion",{enumerable:!0,get:function(){return e.FunctionRegion}}),Object.defineProperty(_e,"FunctionsError",{enumerable:!0,get:function(){return e.FunctionsError}}),Object.defineProperty(_e,"FunctionsFetchError",{enumerable:!0,get:function(){return e.FunctionsFetchError}}),Object.defineProperty(_e,"FunctionsHttpError",{enumerable:!0,get:function(){return e.FunctionsHttpError}}),Object.defineProperty(_e,"FunctionsRelayError",{enumerable:!0,get:function(){return e.FunctionsRelayError}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return t.PostgrestError}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return r.StorageApiError}}),Object.defineProperty(_e,"SupabaseClient",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"createClient",{enumerable:!0,get:function(){return N}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]);Object.keys(n).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return n[e]}})});var r=_r(d[3]),s=_r(d[4]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});let o,i="";var c;if("undefined"!=typeof Deno)i="deno",o=null===(c=Deno.version)||void 0===c?void 0:c.deno;else if("undefined"!=typeof document)i="web";else if("undefined"!=typeof navigator&&"ReactNative"===navigator.product)i="react-native";else{var u;i="node",o="undefined"!=typeof process?null===(u=process.version)||void 0===u?void 0:u.replace(/^v/,""):void 0}const l=[`runtime=${i}`];o&&l.push(`runtime-version=${o}`);const h={headers:{"X-Client-Info":`supabase-js/2.109.0; ${l.join("; ")}`}},f={schema:"public"},p={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},b={},v={enabled:!1,respectSamplingDecision:!0};let y=null;function w(){return e=this,t=void 0,r=function*(){try{const e=yield(null===y&&(y=import("@opentelemetry/api").catch(()=>null)),y);if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch(e){return null}},new((n=void 0)||(n=Promise))(function(s,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function c(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,c)}u((r=r.apply(e,t||[])).next())});var e,t,n,r}function k(e){if(!e||"string"!=typeof e)return null;const t=e.split("-");if(4!==t.length)return null;const[n,r,s,o]=t;if(2!==n.length||32!==r.length||16!==s.length||2!==o.length)return null;const i=/^[0-9a-f]+$/i;return i.test(n)&&i.test(r)&&i.test(s)&&i.test(o)?"00000000000000000000000000000000"===r||"0000000000000000"===s?null:{version:n,traceId:r,parentId:s,traceFlags:o,isSampled:!(1&~parseInt(o,16))}:null}function O(e,t){if(!e||!t||0===t.length)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch(e){return!1}for(const e of t)try{if("string"==typeof e){if(T(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if("function"==typeof e&&e(n))return!0}catch(e){continue}return!1}function T(e,t){if(t===e)return!0;if(t.startsWith("*.")){const n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith("."+n)))return!0}return!1}function P(e){const t=[];try{const n=new URL(e);t.push(n.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=j(e,"string");return"symbol"==S(t)?t:t+""}function U(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;te?(...t)=>e(...t):(...e)=>fetch(...e),F=(e,t,n,r,s)=>{const o=C(r),i=Headers,c=!0===(null==s?void 0:s.enabled),u=!1!==(null==s?void 0:s.respectSamplingDecision),l=c?P(t):null;return async(t,r)=>{var s;const c=null!==(s=await n())&&void 0!==s?s:e;let h=new i(null==r?void 0:r.headers);if(h.has("apikey")||h.set("apikey",e),h.has("Authorization")||h.set("Authorization",`Bearer ${c}`),l){const e=await _(t,l,u);e&&(e.traceparent&&!h.has("traceparent")&&h.set("traceparent",e.traceparent),e.tracestate&&!h.has("tracestate")&&h.set("tracestate",e.tracestate),e.baggage&&!h.has("baggage")&&h.set("baggage",e.baggage))}return o(t,R(R({},r),{},{headers:h}))}};async function _(e,t,n){if(!O("string"==typeof e||e instanceof URL?e:e.url,t))return null;const r=await w();if(!r||!r.traceparent)return null;if(n){const e=k(r.traceparent);if(e&&!e.isSampled)return null}return r}function L(e){return"boolean"==typeof e?{enabled:e}:e}function I(e,t){var n,r,s,o,i,c;const{db:u,auth:l,realtime:h,global:f}=e,{db:p,auth:b,realtime:v,global:y}=t,w=L(e.tracePropagation),k=L(t.tracePropagation),O={db:R(R({},p),u),auth:R(R({},b),l),realtime:R(R({},v),h),storage:{},global:R(R(R({},y),f),{},{headers:R(R({},null!==(n=null==y?void 0:y.headers)&&void 0!==n?n:{}),null!==(r=null==f?void 0:f.headers)&&void 0!==r?r:{})}),tracePropagation:{enabled:null!==(s=null!==(o=null==w?void 0:w.enabled)&&void 0!==o?o:null==k?void 0:k.enabled)&&void 0!==s&&s,respectSamplingDecision:null===(i=null!==(c=null==w?void 0:w.respectSamplingDecision)&&void 0!==c?c:null==k?void 0:k.respectSamplingDecision)||void 0===i||i},accessToken:async()=>""};return e.accessToken?O.accessToken=e.accessToken:delete O.accessToken,O}function D(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((n=t).endsWith("/")?n:n+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var n}var K=class extends s.AuthClient{constructor(e){super(e)}},x=class{constructor(e,n,s){var o,i;this.supabaseUrl=e,this.supabaseKey=n;const c=D(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,l=I(null!=s?s:{},{db:f,realtime:b,auth:R(R({},p),{},{storageKey:u}),global:h,tracePropagation:v});var y;(this.settings=l,this.storageKey=null!==(o=l.auth.storageKey)&&void 0!==o?o:"",this.headers=null!==(i=l.global.headers)&&void 0!==i?i:{},l.accessToken)?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!==(y=l.auth)&&void 0!==y?y:{},this.headers,l.global.fetch);this.fetch=F(n,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(R({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new t.PostgrestClient(new URL("rest/v1",c).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new r.StorageClient(this.storageUrl.href,this.headers,this.fetch,null==s?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new e.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t,n=this;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return null!==(e=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:o,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,lockAcquireTimeout:f,skipAutoInitialize:p},b,v){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K({url:this.authUrl.href,headers:R(R({},y),b),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,fetch:v,lockAcquireTimeout:f,skipAutoInitialize:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new n.RealtimeClient(this.realtimeUrl.href,R(R({},e),{},{params:R(R({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,n){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===n?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=n,this.realtime.setAuth(n))}};const N=(e,t,n)=>new x(e,t,n);(function(){if("undefined"!=typeof window)return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(null==t)return!1;const n=t.match(/^v(\d+)\./);return!!n&&parseInt(n[1],10)<=18})()&&console.warn("\u26a0\ufe0f Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")},1226,[1227,1232,1233,1248,1250]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return n.FunctionsClient}}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t.FunctionsError}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return t.FunctionsFetchError}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return t.FunctionsHttpError}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return t.FunctionsRelayError}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return t.FunctionRegion}});var n=r(d[0]),t=r(d[1])},1227,[1228,1231]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]),o=r(d[2]);class s{constructor(t,{headers:s={},customFetch:c,region:l=o.FunctionRegion.Any}={}){this.url=t,this.headers=s,this.region=l,this.fetch=(0,n.resolveFetch)(c)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(n){return(0,t.__awaiter)(this,arguments,void 0,function*(t,n={}){var s;let c,l;try{const{headers:u,method:f,body:h,signal:p,timeout:y}=n;let b={},{region:F}=n;F||(F=this.region);const v=new URL(`${this.url}/${t}`);let w;F&&'any'!==F&&(b['x-region']=F,v.searchParams.set('forceFunctionRegion',F));const j=!!u&&Object.keys(u).some(t=>'content-type'===t.toLowerCase());h&&!j?'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer?(b['Content-Type']='application/octet-stream',w=h):'string'==typeof h?(b['Content-Type']='text/plain',w=h):'undefined'!=typeof FormData&&h instanceof FormData?w=h:(b['Content-Type']='application/json',w=JSON.stringify(h)):w=!h||'string'==typeof h||'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer||'undefined'!=typeof FormData&&h instanceof FormData?h:JSON.stringify(h);let O=p;y&&(l=new AbortController,c=setTimeout(()=>l.abort(),y),p?(O=l.signal,p.addEventListener('abort',()=>l.abort())):O=l.signal);const x=yield this.fetch(v.toString(),{method:f||'POST',headers:Object.assign(Object.assign(Object.assign({},b),this.headers),u),body:w,signal:O}).catch(t=>{throw new o.FunctionsFetchError(t)}),B=x.headers.get('x-relay-error');if(B&&'true'===B)throw new o.FunctionsRelayError(x);if(!x.ok)throw new o.FunctionsHttpError(x);let C,T=(null!==(s=x.headers.get('Content-Type'))&&void 0!==s?s:'text/plain').split(';')[0].trim();return C='application/json'===T?yield x.json():'application/octet-stream'===T||'application/pdf'===T?yield x.blob():'text/event-stream'===T?x:'multipart/form-data'===T?yield x.formData():yield x.text(),{data:C,error:null,response:x}}catch(t){return{data:null,error:t,response:t instanceof o.FunctionsHttpError||t instanceof o.FunctionsRelayError?t.context:void 0}}finally{c&&clearTimeout(c)}})}}},1228,[1229,1230,1231]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return G}}),_e.__extends=t,Object.defineProperty(_e,"__assign",{enumerable:!0,get:function(){return r}}),_e.__rest=n,_e.__decorate=o,_e.__param=a,_e.__esDecorate=i,_e.__runInitializers=c,_e.__propKey=u,_e.__setFunctionName=s,_e.__metadata=f,_e.__awaiter=l,_e.__generator=p,Object.defineProperty(_e,"__createBinding",{enumerable:!0,get:function(){return y}}),_e.__exportStar=_,_e.__values=d,_e.__read=h,_e.__spread=b,_e.__spreadArrays=v,_e.__spreadArray=w,_e.__await=m,_e.__asyncGenerator=g,_e.__asyncDelegator=O,_e.__asyncValues=j,_e.__makeTemplateObject=P,_e.__importStar=x,_e.__importDefault=T,_e.__classPrivateFieldGet=I,_e.__classPrivateFieldSet=D,_e.__classPrivateFieldIn=R,_e.__addDisposableResource=k,_e.__disposeResources=F,_e.__rewriteRelativeImportExtension=C;var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){return function(r,n){t(r,n,e)}}function i(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,s="getter"===u?"get":"setter"===u?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,y=r.length-1;y>=0;y--){var _={};for(var d in n)_[d]="access"===d?{}:n[d];for(var d in n.access)_.access[d]=n.access[d];_.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[y])("accessor"===u?{get:l.get,set:l.set}:l[s],_);if("accessor"===u){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(c=i(h.get))&&(l.get=c),(c=i(h.set))&&(l.set=c),(c=i(h.init))&&o.unshift(c)}else(c=i(h))&&("field"===u?o.unshift(c):l[s]=c)}f&&Object.defineProperty(f,n.name,l),p=!0}function c(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function b(){for(var e=[],t=0;t1||c(e,t)})},t&&(n[e]=t(n[e])))}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,s):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:!1}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=d(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){o(n,a,(t=e[r](t)).done,t.value)})}}function o(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},E=function(e){return E=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},E(e)};function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=E(e),n=0;nt?(...n)=>t(...n):(...t)=>fetch(...t)},1230,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return u}});class t extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class n extends t{constructor(t){super('Failed to send a request to the Edge Function','FunctionsFetchError',t)}}class s extends t{constructor(t){super('Relay Error invoking the Edge Function','FunctionsRelayError',t)}}class o extends t{constructor(t){super('Edge Function returned a non-2xx status code','FunctionsHttpError',t)}}var u;!(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(u||(u={}))},1231,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PostgrestBuilder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"PostgrestClient",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"PostgrestFilterBuilder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"PostgrestQueryBuilder",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PostgrestTransformBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});const e=e=>Math.min(1e3*2**e,3e4),t=[520,503],r=["GET","HEAD","OPTIONS"];var s=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function n(e,t){return new Promise(r=>{if(null==t?void 0:t.aborted)return void r();const s=setTimeout(()=>{null==t||t.removeEventListener("abort",n),r()},e);function n(){clearTimeout(s),r()}null==t||t.addEventListener("abort",n)})}function i(e,s,n,i){return!(!i||n>=3)&&(!!r.includes(e)&&!!t.includes(s))}var l=class{constructor(e){var t,r,s,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,this.shouldStripNulls=null!==(s=e.shouldStripNulls)&&void 0!==s&&s,this.urlLengthLimit=null!==(n=e.urlLengthLimit)&&void 0!==n?n:8e3,this.retryEnabled=null===(i=e.retry)||void 0===i||i,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if("text/csv"===this.headers.get("Accept"))throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(t,s){var l=this;if(void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const e=this.headers.get("Accept");"application/vnd.pgrst.object+json"===e?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):e&&"application/json"!==e||this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const o=this.fetch;let h=(async()=>{let t=0;for(;;){const u={};let c;l.headers.forEach((e,t)=>{u[t]=e}),t>0&&(u["X-Retry-Count"]=String(t));try{c=await o(l.url.toString(),{method:l.method,headers:u,body:JSON.stringify(l.body,(e,t)=>"bigint"==typeof t?t.toString():t),signal:l.signal})}catch(s){if("AbortError"===(null==s?void 0:s.name)||"ABORT_ERR"===(null==s?void 0:s.code))throw s;if(!r.includes(l.method))throw s;if(l.retryEnabled&&t<3){const r=e(t);t++,await n(r,l.signal);continue}throw s}if(i(l.method,c.status,t,l.retryEnabled)){var s,h;const r=null!==(s=null===(h=c.headers)||void 0===h?void 0:h.get("Retry-After"))&&void 0!==s?s:null,i=null!==r?1e3*Math.max(0,parseInt(r,10)||0):e(t);await c.text(),t++,await n(i,l.signal);continue}return await l.processResponse(c)}})();return this.shouldThrowOnError||(h=h.catch(e=>{var t;let r="",s="",n="";const i=null==e?void 0:e.cause;if(i){var l,o,h,u;const t=null!==(l=null==i?void 0:i.message)&&void 0!==l?l:"",s=null!==(o=null==i?void 0:i.code)&&void 0!==o?o:"";r=`${null!==(h=null==e?void 0:e.name)&&void 0!==h?h:"FetchError"}: ${null==e?void 0:e.message}`,r+=`\n\nCaused by: ${null!==(u=null==i?void 0:i.name)&&void 0!==u?u:"Error"}: ${t}`,s&&(r+=` (${s})`),(null==i?void 0:i.stack)&&(r+=`\n${i.stack}`)}else{var c;r=null!==(c=null==e?void 0:e.stack)&&void 0!==c?c:""}const p=this.url.toString().length;return"AbortError"===(null==e?void 0:e.name)||"ABORT_ERR"===(null==e?void 0:e.code)?(n="",s="Request was aborted (timeout or manual cancellation)",p>this.urlLengthLimit&&(s+=`. Note: Your request URL is ${p} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):"HeadersOverflowError"!==(null==i?void 0:i.name)&&"UND_ERR_HEADERS_OVERFLOW"!==(null==i?void 0:i.code)||(n="",s="HTTP headers exceeded server limits (typically 16KB)",p>this.urlLengthLimit&&(s+=`. Your request URL is ${p} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:r,hint:s,code:n},data:null,count:null,status:0,statusText:""}})),h.then(t,s)}async processResponse(e){var t=this;let r=null,n=null,i=null,l=e.status,o=e.statusText;if(e.ok){var h,u;if("HEAD"!==t.method){var c;const i=await e.text();if(""===i);else if("text/csv"===t.headers.get("Accept"))n=i;else if(t.headers.get("Accept")&&(null===(c=t.headers.get("Accept"))||void 0===c?void 0:c.includes("application/vnd.pgrst.plan+text")))n=i;else try{n=JSON.parse(i)}catch(e){if(r={message:i},n=null,t.shouldThrowOnError)throw new s({message:i,details:"",hint:"",code:""})}}const p=null===(h=t.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),f=null===(u=e.headers.get("content-range"))||void 0===u?void 0:u.split("/");p&&f&&f.length>1&&(i=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,i=null,l=406,o="Not Acceptable"):n=1===n.length?n[0]:null)}else{const i=await e.text();try{r=JSON.parse(i),Array.isArray(r)&&404===e.status&&(n=[],r=null,l=200,o="OK")}catch(t){404===e.status&&""===i?(l=204,o="No Content"):r={message:i}}if(r&&t.shouldThrowOnError)throw new s(r)}return{success:null===r,error:r,data:n,count:i,status:l,statusText:o}}returns(){return this}overrideTypes(){return this}},o=class extends l{throwOnError(){return super.throwOnError()}select(e){let t=!1;const r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":("\""===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.order`:"order",l=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const n=void 0===s?"offset":`${s}.offset`,i=void 0===s?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(i,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:n=!1,format:i="text"}={}){var l;const o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,n?"wal":null].filter(Boolean).join("|"),h=null!==(l=this.headers.get("Accept"))&&void 0!==l?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${h}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const h=new RegExp("[,()]");var u=class extends o{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let n="";"plain"===s?n="pl":"phrase"===s?n="ph":"websearch"===s&&(n="w");const i=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${n}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>void 0!==t).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},c=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=null!=t?t:{},n=r?"HEAD":"GET";let i=!1;const l=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":("\""===e&&(i=!i),e)).join(""),{url:o,headers:h}=this.cloneRequestState();return o.searchParams.set("select",l),s&&h.append("Prefer",`count=${s}`),new u({method:n,url:o,headers:h,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const{url:n,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),r||i.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);n.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:n,headers:i,schema:this.schema,body:e,fetch:null!==(s=this.fetch)&&void 0!==s?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!0}={}){var i;const{url:l,headers:o}=this.cloneRequestState();if(o.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&l.searchParams.set("on_conflict",t),s&&o.append("Prefer",`count=${s}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);l.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:l,headers:o,schema:this.schema,body:e,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const{url:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new u({method:"PATCH",url:s,headers:n,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new u({method:"DELETE",url:r,headers:s,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=p(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=f(e,"string");return"symbol"==p(t)?t:t+""}function v(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function P(e){for(var t=1;t0?(e,t)=>{const r=new AbortController,s=setTimeout(()=>r.abort(),n),i=null==t?void 0:t.signal;if(i){if(i.aborted)return clearTimeout(s),o(e,t);const n=()=>{clearTimeout(s),r.abort()};return i.addEventListener("abort",n,{once:!0}),o(e,P(P({},t),{},{signal:r.signal})).finally(()=>{clearTimeout(s),i.removeEventListener("abort",n)})}return o(e,P(P({},t),{},{signal:r.signal})).finally(()=>clearTimeout(s))}:o,this.retry=l}from(e){if(!e||"string"!=typeof e||""===e.trim())throw new Error("Invalid relation name: relation must be a non-empty string.");return new c(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:s=!1,count:n}={}){var i;let l;const o=new URL(`${this.url}/rpc/${e}`);let h;const c=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(c)),p=r&&Object.values(t).some(c);p?(l="POST",h=t):r||s?(l=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{o.searchParams.append(e,t)})):(l="POST",h=t);const f=new Headers(this.headers);return p?f.set("Prefer",n?`count=${n},return=minimal`:"return=minimal"):n&&f.set("Prefer",`count=${n}`),new u({method:l,url:o,headers:f,schema:this.schemaName,body:h,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},w={PostgrestClient:$,PostgrestQueryBuilder:c,PostgrestFilterBuilder:u,PostgrestTransformBuilder:o,PostgrestBuilder:l,PostgrestError:s}},1232,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RealtimePresence",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"RealtimeChannel",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(_e,"RealtimeClient",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return n.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e,"postgresChangesFilter",{enumerable:!0,get:function(){return n.postgresChangesFilter}}),Object.defineProperty(_e,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n.REALTIME_LISTEN_TYPES}}),Object.defineProperty(_e,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return n.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return u.REALTIME_PRESENCE_LISTEN_EVENTS}}),Object.defineProperty(_e,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return n.REALTIME_SUBSCRIBE_STATES}}),Object.defineProperty(_e,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return n.REALTIME_CHANNEL_STATES}}),Object.defineProperty(_e,"WebSocketFactory",{enumerable:!0,get:function(){return l.default}});var t=e(r(d[0])),n=r(d[1]),E=e(n),u=r(d[2]),o=e(u),l=e(r(d[3]))},1233,[1234,1240,1241,1235]); +__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,"default",{enumerable:!0,get:function(){return f}});var t=e(r(d[0])),n=r(d[1]),s=e(r(d[2])),o=r(d[3]),c=e(r(d[4])),l=e(r(d[5]));const h=25e3,u=[1e3,2e3,5e3,1e4];function k(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem:t=>e.has(t)?e.get(t):null,key(t){var n;return null!==(n=Array.from(e.keys())[t])&&void 0!==n?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function p(){try{if('undefined'!=typeof globalThis&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(e){}return k()}class f{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint='',this.headers={},this.params={},this.ref=0,this.serializer=new s.default,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey))throw new Error('API key is required to connect to Realtime');this.apiKey=t.params.apikey;const c=this._initializeOptions(t);this.socketAdapter=new l.default(e,c),this.httpEndpoint=(0,o.httpEndpointURL)(e),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely('connect'),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const t=e.message;if(t.includes('Node.js'))throw new Error(`${t}\n\nTo use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n npm install ws\n\n import ws from "ws"\n const client = new RealtimeClient(url, {\n ...options,\n transport: ws\n })`);throw new Error(`WebSocket not available: ${t}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return this._cancelPendingDisconnect(),this.isDisconnecting()?'ok':await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return'ok'===t&&e.teardown(),t}async removeAllChannels(){const e=this.channels.map(async e=>{const t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,n){this.socketAdapter.log(e,t,n)}connectionState(){return this.socketAdapter.connectionState()||n.CONNECTION_STATE.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(e=>e.topic===n);if(s)return s;{const n=new c.default(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(n),n}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),0===this.channels.length&&(this.log('transport','no channels remaining, scheduling disconnect'),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),0===this._disconnectOnEmptyChannelsAfterMs)return this.log('transport','disconnecting immediately - no channels'),void this.disconnect();this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,0===this.channels.length&&(this.log('transport','deferred disconnect fired - no channels, disconnecting'),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log('transport',`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){null!==this._pendingDisconnectTimer&&(this.log('transport','pending disconnect cancelled - channel activity detected'),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let t,s=!1;if(e)t=e,s=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(e){this.log('error','Error fetching access token from callback',e),t=this.accessTokenValue}else t=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{const s={access_token:t,version:n.DEFAULT_VERSION};t&&e.updateJoinPayload(s),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(n.CHANNEL_EVENTS.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log('error',`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log('error','error waiting for auth on connect',e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,n)=>{'sent'==t&&this._setAuthSafely(),e&&e(t,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log('worker',`starting worker for from ${this.workerUrl}`):this.log('worker',"starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log('worker','worker error',e.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=e=>{'keepAlive'===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:'start',interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log('worker','terminating worker'),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{const e=new Blob(["\n addEventListener(\"message\", (e) => {\n if (e.data.event === \"start\") {\n setInterval(() => postMessage({ event: \"keepAlive\" }), e.data.interval);\n }\n });"],{type:'application/javascript'});t=URL.createObjectURL(e)}return t}_initializeOptions(e){var s,o,c,l,k,f,_,v,w,b,A,T;this.worker=null!==(s=null==e?void 0:e.worker)&&void 0!==s&&s,this.accessToken=null!==(o=null==e?void 0:e.accessToken)&&void 0!==o?o:null;const y={};let C,R;y.timeout=null!==(c=null==e?void 0:e.timeout)&&void 0!==c?c:n.DEFAULT_TIMEOUT,y.heartbeatIntervalMs=null!==(l=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==l?l:h,this._disconnectOnEmptyChannelsAfterMs=null!==(k=null==e?void 0:e.disconnectOnEmptyChannelsAfterMs)&&void 0!==k?k:2*(null!==(f=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==f?f:h),y.transport=null!==(_=null==e?void 0:e.transport)&&void 0!==_?_:t.default.getWebSocketConstructor(),y.params=null==e?void 0:e.params,y.logger=null==e?void 0:e.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(null==e?void 0:e.heartbeatCallback),y.sessionStorage=null!==(v=null==e?void 0:e.sessionStorage)&&void 0!==v?v:p(),y.reconnectAfterMs=null!==(w=null==e?void 0:e.reconnectAfterMs)&&void 0!==w?w:e=>u[e-1]||1e4;const E=null!==(b=null==e?void 0:e.vsn)&&void 0!==b?b:n.DEFAULT_VSN;switch(E){case n.VSN_1_0_0:C=(e,t)=>t(JSON.stringify(e)),R=(e,t)=>t(JSON.parse(e));break;case n.VSN_2_0_0:C=this.serializer.encode.bind(this.serializer),R=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=E,y.encode=null!==(A=null==e?void 0:e.encode)&&void 0!==A?A:C,y.decode=null!==(T=null==e?void 0:e.decode)&&void 0!==T?T:R,y.beforeReconnect=this._reconnectAuth.bind(this),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if('undefined'!=typeof window&&!window.Worker)throw new Error('Web Worker is not supported');this.workerUrl=null==e?void 0:e.workerUrl,y.autoSendHeartbeat=!this.worker}return y}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}},1234,[1235,1236,1238,1239,1240,1247]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebSocketFactory",{enumerable:!0,get:function(){return t}});class t{constructor(){}static detectEnvironment(){var t;if('undefined'!=typeof WebSocket)return{type:'native',wsConstructor:WebSocket};const o=globalThis;if('undefined'!=typeof globalThis&&void 0!==o.WebSocket)return{type:'native',wsConstructor:o.WebSocket};const n=void 0!==g?g:void 0;if(n&&void 0!==n.WebSocket)return{type:'native',wsConstructor:n.WebSocket};if('undefined'!=typeof globalThis&&void 0!==o.WebSocketPair&&void 0===globalThis.WebSocket)return{type:'cloudflare',error:'Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.',workaround:'Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.'};if('undefined'!=typeof globalThis&&o.EdgeRuntime||'undefined'!=typeof navigator&&(null===(t=navigator.userAgent)||void 0===t?void 0:t.includes('Vercel-Edge')))return{type:'unsupported',error:'Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.',workaround:'Use serverless functions or a different deployment target for WebSocket functionality.'};const s=globalThis.process;if(s){const t=s.versions;if(t&&t.node){const o=t.node,n=parseInt(o.replace(/^v/,'').split('.')[0]);return n>=22?void 0!==globalThis.WebSocket?{type:'native',wsConstructor:globalThis.WebSocket}:{type:'unsupported',error:`Node.js ${n} detected but native WebSocket not found.`,workaround:'Provide a WebSocket implementation via the transport option.'}:{type:'unsupported',error:`Node.js ${n} detected without native WebSocket support.`,workaround:"For Node.js < 22, install \"ws\" package and provide it via the transport option:\nimport ws from \"ws\"\nnew RealtimeClient(url, { transport: ws })"}}}return{type:'unsupported',error:'Unknown JavaScript runtime without WebSocket support.',workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let o=t.error||'WebSocket not supported in this environment.';throw t.workaround&&(o+=`\n\nSuggested solution: ${t.workaround}`),new Error(o)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return'native'===t.type||'ws'===t.type}catch(t){return!1}}}var o=t},1235,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_VERSION",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VSN_1_0_0",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"VSN_2_0_0",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_VSN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEFAULT_TIMEOUT",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"WS_CLOSE_NORMAL",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"MAX_PUSH_BUFFER_SIZE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SOCKET_STATES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"CHANNEL_STATES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"CHANNEL_EVENTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TRANSPORTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"CONNECTION_STATE",{enumerable:!0,get:function(){return E}});var n=r(d[0]);const t=`realtime-js/${n.version}`,o='1.0.0',c='2.0.0',u=c,l=n.version,b=1e4,_=1e3,f=100,p={connecting:0,open:1,closing:2,closed:3},s={closed:'closed',errored:'errored',joined:'joined',joining:'joining',leaving:'leaving'},O={close:'phx_close',error:'phx_error',join:'phx_join',reply:'phx_reply',leave:'phx_leave',access_token:'access_token'},j={websocket:'websocket'},E={connecting:'connecting',open:'open',closing:'closing',closed:'closed'}},1236,[1237]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1237,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});class t{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT='broadcast',this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=t?t:[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&'string'==typeof t.payload.event)return n(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer(null===(n=t.payload)||void 0===n?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:{},c=(new TextEncoder).encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,c)}_encodeUserBroadcastPush(t,n,s){var o,c;const l=t.topic,h=null!==(o=t.ref)&&void 0!==o?o:'',u=null!==(c=t.join_ref)&&void 0!==c?c:'',f=t.payload.event,y=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},_=0===Object.keys(y).length?'':JSON.stringify(y);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`ref length ${h.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`topic length ${l.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const A=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+h.length+l.length+f.length+_.length,E=new ArrayBuffer(this.HEADER_LENGTH+A);let U=new DataView(E),B=0;U.setUint8(B++,this.KINDS.userBroadcastPush),U.setUint8(B++,u.length),U.setUint8(B++,h.length),U.setUint8(B++,l.length),U.setUint8(B++,f.length),U.setUint8(B++,_.length),U.setUint8(B++,n),Array.from(u,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(h,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(l,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(f,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(_,t=>U.setUint8(B++,t.charCodeAt(0)));var N=new Uint8Array(E.byteLength+s.byteLength);return N.set(new Uint8Array(E),0),N.set(new Uint8Array(s),E.byteLength),N.buffer}decode(t,n){if(this._isArrayBuffer(t)){return n(this._binaryDecode(t))}if('string'==typeof t){const s=JSON.parse(t),[o,c,l,h,u]=s;return n({join_ref:o,ref:c,topic:l,event:h,payload:u})}return n({})}_binaryDecode(t){const n=new DataView(t),s=n.getUint8(0),o=new TextDecoder;if(s===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,o)}_decodeUserBroadcast(t,n,s){const o=n.getUint8(1),c=n.getUint8(2),l=n.getUint8(3),h=n.getUint8(4);let u=this.HEADER_LENGTH+4;const f=s.decode(t.slice(u,u+o));u+=o;const y=s.decode(t.slice(u,u+c));u+=c;const _=s.decode(t.slice(u,u+l));u+=l;const A=t.slice(u,t.byteLength),E=h===this.JSON_ENCODING?JSON.parse(s.decode(A)):A,U={type:this.BROADCAST_EVENT,event:y,payload:E};return l>0&&(U.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:f,event:this.BROADCAST_EVENT,payload:U}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||'ArrayBuffer'===(null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)}_pick(t,n){return t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([t])=>n.includes(t))):{}}}},1238,[]); +__d(function(g,r,i,a,m,e,d){"use strict";var t;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PostgresTypes",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"convertChangeData",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"convertColumn",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"convertCell",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toBoolean",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toNumber",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"toJson",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toTimestampString",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"httpEndpointURL",{enumerable:!0,get:function(){return y}}),(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(t||(t={}));const n=(t,n,o={})=>{var s;const u=null!==(s=o.skipTypes)&&void 0!==s?s:[];return n?Object.keys(n).reduce((o,s)=>(o[s]=c(s,t,n,u),o),{}):{}},c=(t,n,c,u)=>{const p=n.find(n=>n.name===t),l=null==p?void 0:p.type,f=c[t];return l&&!u.includes(l)?o(l,f):s(f)},o=(n,c)=>{if('_'===n.charAt(0)){const t=n.slice(1,n.length);return f(c,t)}switch(n){case t.bool:return u(c);case t.float4:case t.float8:case t.int2:case t.int4:case t.int8:case t.numeric:case t.oid:return p(c);case t.json:case t.jsonb:return l(c);case t.timestamp:return b(c);case t.abstime:case t.date:case t.daterange:case t.int4range:case t.int8range:case t.money:case t.reltime:case t.text:case t.time:case t.timestamptz:case t.timetz:case t.tsrange:case t.tstzrange:default:return s(c)}},s=t=>t,u=t=>{switch(t){case't':return!0;case'f':return!1;default:return t}},p=t=>{if('string'==typeof t){const n=parseFloat(t);if(!Number.isNaN(n))return n}return t},l=t=>{if('string'==typeof t)try{return JSON.parse(t)}catch(n){return t}return t},f=(t,n)=>{if('string'!=typeof t)return t;const c=t.length-1,s=t[c];if('{'===t[0]&&'}'===s){let s;const u=t.slice(1,c);try{s=JSON.parse('['+u+']')}catch(t){s=u?u.split(','):[]}return s.map(t=>o(n,t))}return t},b=t=>'string'==typeof t?t.replace(' ','T'):t,y=t=>{const n=new URL(t);return n.protocol=n.protocol.replace(/^ws/i,'http'),n.pathname=n.pathname.replace(/\/+$/,'').replace(/\/socket\/websocket$/i,'').replace(/\/socket$/i,'').replace(/\/websocket$/i,''),''===n.pathname||'/'===n.pathname?n.pathname='/api/broadcast':n.pathname=n.pathname+'/api/broadcast',n.href}},1239,[]); +__d(function(g,_r,_i,a,m,_e2,_d2){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return d.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e2,"postgresChangesFilter",{enumerable:!0,get:function(){return d.postgresChangesFilter}}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e2,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e2,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e2,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e2,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return h}});var t,n,i,s=_r(_d2[0]),r=e(_r(_d2[1])),o=_r(_d2[2]),c=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(o),l=_r(_d2[3]),u=e(_r(_d2[4])),d=_r(_d2[5]);!(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(t||(t={})),(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(n||(n={})),(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(i||(i={}));const h=s.CHANNEL_STATES;class p{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){var i,s;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,''),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},t.config),this.channelAdapter=new u.default(this.socket.socketAdapter,e,this.params),this.presence=new r.default(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=(0,o.httpEndpointURL)(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(null===(s=null===(i=this.params.config)||void 0===i?void 0:i.broadcast)||void 0===s?void 0:s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,o,c;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:h}}=this.params,p=null!==(o=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==o?o:[],E=!!this.bindings[n.PRESENCE]&&this.bindings[n.PRESENCE].length>0||!0===(null===(c=this.params.config.presence)||void 0===c?void 0:c.enabled),b={},f={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:E}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(t=>{null==e||e(i.CHANNEL_ERROR,(0,l.normalizeChannelError)(t))}),this._onClose(()=>null==e?void 0:e(i.CLOSED)),this.updateJoinPayload(Object.assign({config:f},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive('ok',async({postgres_changes:t})=>{this.socket._isManualToken()||this.socket.setAuth(),void 0!==t?this._updatePostgresBindings(t,e):null==e||e(i.SUBSCRIBED)}).receive('error',t=>{this.state=s.CHANNEL_STATES.errored;const n=Object.values(t).join(', ')||'error';null==e||e(i.CHANNEL_ERROR,new Error(n,{cause:t}))}).receive('timeout',()=>{null==e||e(i.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var n;const r=this.bindings.postgres_changes,o=null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0,c=[];for(let n=0;n{var i,s,r;const o=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);'broadcast'!==e.type||(null===(r=null===(s=null===(i=this.params)||void 0===i?void 0:i.config)||void 0===s?void 0:s.broadcast)||void 0===r?void 0:r.ack)||n('ok'),o.receive('ok',()=>n('ok')),o.receive('error',()=>n('error')),o.receive('timeout',()=>n('timed out'))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:r}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:'','Content-Type':'application/json'};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:'POST',headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:r,private:this.private}]})};try{const e=await this._fetchWithTimeout(this.broadcastEndpointURL,c,null!==(n=t.timeout)&&void 0!==n?n:this.timeout);return await(null===(i=e.body)||void 0===i?void 0:i.cancel()),e.ok?'ok':'error'}catch(e){return e instanceof Error&&'AbortError'===e.name?'timed out':'error'}}}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive('ok',()=>t('ok')).receive('timeout',()=>t('timed out')).receive('error',()=>t('error'))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){const i=new AbortController,s=setTimeout(()=>i.abort(),n),r=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(s),r}_on(e,t,n){const i=e.toLocaleLowerCase(),s=null==t?void 0:t.filter;(s instanceof d.RealtimePostgresFilterBuilder||'object'==typeof s&&null!==s&&'function'==typeof s.build)&&(t=Object.assign(Object.assign({},t),{filter:s.build()}));const r={type:i,filter:t,callback:n,ref:this.channelAdapter.on(e,n)};return this.bindings[i]?this.bindings[i].push(r):this.bindings[i]=[r],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{var i,s,r,o,c,l,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=null===(i=this.bindings[d])||void 0===i?void 0:i.find(t=>t.ref===e.ref);if(!h)return!0;if(['broadcast','presence','postgres_changes'].includes(d)){if('id'in h){const e=h.id,n=null===(s=h.filter)||void 0===s?void 0:s.event;return e&&(null===(r=t.ids)||void 0===r?void 0:r.includes(e))&&('*'===n||(null==n?void 0:n.toLocaleLowerCase())===(null===(o=t.data)||void 0===o?void 0:o.type.toLocaleLowerCase()))}{const e=null===(l=null===(c=null==h?void 0:h.filter)||void 0===c?void 0:c.event)||void 0===l?void 0:l.toLocaleLowerCase();return'*'===e||e===(null===(u=null==t?void 0:t.event)||void 0===u?void 0:u.toLocaleLowerCase())}}return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){const{close:n,error:i,leave:r,join:o}=s.CHANNEL_EVENTS;return t&&[n,i,r,o].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if('object'==typeof t&&'ids'in t){const e=t.data,{schema:n,table:i,commit_timestamp:s,type:r,errors:o}=e,c={schema:n,table:i,commit_timestamp:s,eventType:r,new:{},old:{},errors:o};return Object.assign(Object.assign({},c),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw new Error('cannot copy bindings into joined channel');for(const t in e.bindings)for(const n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_getPayloadRecords(e){const t={new:{},old:{}};return'INSERT'!==e.type&&'UPDATE'!==e.type||(t.new=c.convertChangeData(e.columns,e.record)),'UPDATE'!==e.type&&'DELETE'!==e.type||(t.old=c.convertChangeData(e.columns,e.old_record)),t}}},1240,[1236,1241,1239,1244,1245,1246]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return t}});var e,t,n=r(d[0]),c=(e=n)&&e.__esModule?e:{default:e};!(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(t||(t={}));class u{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new c.default(this.channel.channelAdapter,t)}}},1241,[1242]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(s,c){const u=o(c);this.presence=new n.Presence(s.getChannel(),u),this.presence.onJoin((n,c,o)=>{const u=t.onJoinPayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onLeave((n,c,o)=>{const u=t.onLeavePayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onSync(()=>{s.getChannel().trigger('presence',{event:'sync'})})}get state(){return t.transformState(this.presence.state)}static transformState(n){return n=c(n),Object.getOwnPropertyNames(n).reduce((t,c)=>{const o=n[c];return t[c]=s(o),t},{})}static onJoinPayload(n,t,c){return{event:'join',key:n,currentPresences:u(t),newPresences:s(c)}}static onLeavePayload(n,t,c){return{event:'leave',key:n,currentPresences:u(t),leftPresences:s(c)}}}function s(n){return n.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function c(n){return JSON.parse(JSON.stringify(n))}function o(n){return(null==n?void 0:n.events)&&{events:n.events}}function u(n){return(null==n?void 0:n.metas)?s(n):[]}},1242,[1243]); +__d(function(g,r,_i,a,_m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"Channel",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e2,"LongPoll",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e2,"Presence",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e2,"Push",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e2,"Serializer",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e2,"Socket",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e2,"Timer",{enumerable:!0,get:function(){return w}});var e=e=>{if("function"==typeof e)return e;return function(){return e}},t="undefined"!=typeof self?self:null,s="undefined"!=typeof window?window:null,i=t||s||globalThis,n=0,o=1,h=2,c=3,l="closed",u="errored",f="joined",p="joining",m="leaving",b="phx_close",k="phx_error",T="phx_join",y="phx_reply",C="phx_leave",v="longpoll",R="websocket",j=4,E="base64url.bearer.phx.",S=class{constructor(e,t,s,i){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},w=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},A=class{constructor(t,s,i){this.state=l,this.topic=t,this.params=e(s||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new S(this,T,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new w(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=f,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",e=>{this.state=u,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=l,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=u,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new S(this,C,e({}),this.timeout).send(),this.state=u,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(y,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=l,this.bindings=[]}onClose(e){this.on(b,e)}onError(e){return this.on(k,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(void 0===t||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new S(this,e,function(){return t},s);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=m;let s=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(b,"leave")},i=new S(this,C,e({}),t);return i.receive("ok",()=>s()).receive("timeout",()=>s()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,i){return this.topic===e&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=p,this.joinPush.resend(e))}trigger(e,t,s,i){let n=this.onMessage(e,t,s,i);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(i=>i.event===e&&this.filterBindings(i,t,s));for(let e=0;eu.abort(),o);l.signal=u.signal}return i.fetch(t,l).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>c&&c(e)).catch(e=>{"AbortError"===e.name&&h?h():c&&c(null)}),u}static xdomainRequest(e,t,s,i,n,o,h){return e.timeout=n,e.open(t,s),e.onload=()=>{let t=this.parseJSON(e.responseText);h&&h(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,s,i,n,o,h,c){e.open(t,s,!0),e.timeout=o;for(let[t,s]of Object.entries(i))e.setRequestHeader(t,s);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{if(e.readyState===j&&c){let t=this.parseJSON(e.responseText);c(t)}},h&&(e.ontimeout=h),e.send(n),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let s=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let n=t?`${t}[${i}]`:i,o=e[i];"object"==typeof o?s.push(this.serialize(o,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(o))}return s.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},L=e=>{let t="",s=new Uint8Array(e),i=s.byteLength;for(let e=0;ethis.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R),"$1/"+v)}endpointURL(){return H.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=n}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===o||this.readyState===n}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:s,messages:i}=e;if(410===t&&null!==this.token)return this.onerror(410),void this.closeAndRetry(3410,"session_gone",!1);this.token=s}else t=0;switch(t){case 200:i.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=o,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=L(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join("\n"),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,s){for(let e of this.reqs)e.abort();this.readyState=c;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,s,i,n){let o;o=H.request(e,this.endpointURL(),t,s,this.timeout,()=>{this.reqs.delete(o),i()},e=>{this.reqs.delete(o),this.isActive()&&n(e)}),this.reqs.add(o)}},B=class e{constructor(t,s={}){let i=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(i.state,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,s,i),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,s,i)}),this.pendingDiffs=[],n()}),this.channel.on(i.diff,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,s,i),n())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,s,i){let n=this.clone(e),o={},h={};return this.map(n,(e,s)=>{t[e]||(h[e]=s)}),this.map(t,(e,t)=>{let s=n[e];if(s){let i=t.metas.map(e=>e.phx_ref),n=s.metas.map(e=>e.phx_ref),c=t.metas.filter(e=>n.indexOf(e.phx_ref)<0),l=s.metas.filter(e=>i.indexOf(e.phx_ref)<0);c.length>0&&(o[e]=t,o[e].metas=c),l.length>0&&(h[e]=this.clone(s),h[e].metas=l)}else o[e]=t}),this.syncDiff(n,{joins:o,leaves:h},s,i)}static syncDiff(e,t,s,i){let{joins:n,leaves:o}=this.clone(t);return s||(s=function(){}),i||(i=function(){}),this.map(n,(t,i)=>{let n=e[t];if(e[t]=this.clone(i),n){let s=e[t].metas.map(e=>e.phx_ref),i=n.metas.filter(e=>s.indexOf(e.phx_ref)<0);e[t].metas.unshift(...i)}s(t,n,i)}),this.map(o,(t,s)=>{let n=e[t];if(!n)return;let o=s.metas.map(e=>e.phx_ref);n.metas=n.metas.filter(e=>o.indexOf(e.phx_ref)<0),i(t,n,s),0===n.metas.length&&delete e[t]}),e}static list(e,t){return t||(t=function(e,t){return t}),this.map(e,(e,s)=>t(e,s))}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static clone(e){return JSON.parse(JSON.stringify(e))}},O={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,i,n,o,h]=JSON.parse(e);return t({join_ref:s,ref:i,topic:n,event:o,payload:h})}},binaryEncode(e){let{join_ref:t,ref:s,event:i,topic:n,payload:o}=e,h=this.META_LENGTH+t.length+s.length+n.length+i.length,c=new ArrayBuffer(this.HEADER_LENGTH+h),l=new DataView(c),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,s.length),l.setUint8(u++,n.length),l.setUint8(u++,i.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(s,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(i,e=>l.setUint8(u++,e.charCodeAt(0)));var f=new Uint8Array(c.byteLength+o.byteLength);return f.set(new Uint8Array(c),0),f.set(new Uint8Array(o),c.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,c=s.decode(e.slice(h,h+i));h+=i;let l=s.decode(e.slice(h,h+n));h+=n;let u=s.decode(e.slice(h,h+o));return h+=o,{join_ref:c,ref:null,topic:l,event:u,payload:e.slice(h,e.byteLength)}},decodeReply(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(c,c+i));c+=i;let u=s.decode(e.slice(c,c+n));c+=n;let f=s.decode(e.slice(c,c+o));c+=o;let p=s.decode(e.slice(c,c+h));c+=h;let m=e.slice(c,e.byteLength);return{join_ref:l,ref:u,topic:f,event:y,payload:{status:p,response:m}}},decodeBroadcast(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=this.HEADER_LENGTH+2,h=s.decode(e.slice(o,o+i));o+=i;let c=s.decode(e.slice(o,o+n));return o+=n,{join_ref:null,ref:null,topic:h,event:c,payload:e.slice(o,e.byteLength)}}},$=class{constructor(t,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||1e4,this.transport=n.transport||i.WebSocket||P,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let o=null;try{o=i&&i.sessionStorage}catch{}this.sessionStore=n.sessionStorage||o,this.establishedConnections=0,this.defaultEncoder=O.encode.bind(O),this.defaultDecoder=O.decode.bind(O),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==P?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let h=null;s&&s.addEventListener&&(s.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),h=this.connectClock)}),s.addEventListener("pageshow",e=>{h===this.connectClock&&(h=null,this.connect())}),s.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>n.rejoinAfterMs?n.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>n.reconnectAfterMs?n.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(e,t,s)=>{console.log(`${e}: ${t}`,s)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=e(n.params||{}),this.endPoint=`${t}/${R}`,this.vsn=n.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new w(()=>{if(this.pageHidden)return this.log("Not reconnecting as page is hidden!"),void this.teardown();this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return P}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=H.appendParams(H.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=e(t)),this.conn&&!this.disconnecting||(this.longPollFallbackMs&&this.transport!==P?this.connectWithFallback(P,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(n=>{n.ref===t&&(this.off([i]),e(Date.now()-s))});return!0}transportName(e){return e===P?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${E}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let s,i=!1,n=!0,o=this.transportName(e),h=t=>{this.log("transport",`falling back to ${o}...`,t),this.off([void 0,s]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),s=this.onError(e=>{this.log("transport","error",e),n&&!i&&(clearTimeout(this.fallbackTimer),h(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!n){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const i=this.conn;this.waitForBufferDone(i,()=>{t?i.close(t,s||""):i.close(),this.waitForSocketClosed(i,()=>{this.conn===i&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){5!==s&&e.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s):t()}waitForSocketClosed(e,t,s=1){5!==s&&e.readyState!==c?setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s):t()}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(k,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case n:return"connecting";case o:return"open";case h:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let s=new A(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;this.log("push",`${t} ${s} (${o}, ${n})`,i)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(this.isConnected())if(this.pendingHeartbeatRef)this.heartbeatTimeout();else{this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}else try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;if(n&&n===this.pendingHeartbeatRef){const e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback("ok"===i.status?"ok":"error",e)}catch(e){this.log("error","error in heartbeat callback",e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${t} ${s} ${n&&"("+n+")"||""}`.trim(),i);for(let e=0;e{try{i(...t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}},1243,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeChannelError=function(n){if(n instanceof Error)return n;if('string'==typeof n)return new Error(n);if(n&&'object'==typeof n){const o=n;if('number'==typeof o.code){const t='string'==typeof o.reason&&o.reason?` (${o.reason})`:'';return new Error(`socket closed: ${o.code}${t}`,{cause:n})}return new Error('channel error: transport failure',{cause:n})}return new Error('channel error: connection lost')}},1244,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(n,t,s){const h=(o=s,{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},o.config)});var o;this.channel=n.getSocket().channel(t,h),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,t){return this.channel.on(n,t)}off(n,t){this.channel.off(n,t)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(t,s,h){let o;try{o=this.channel.push(t,s,h)}catch(n){throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>n.MAX_PUSH_BUFFER_SIZE){const n=this.channel.pushBuffer.shift();n.cancelTimeout(),this.socket.log('channel',`discarded push due to buffer overflow: ${n.event}`,n.payload())}return o}updateJoinPayload(n){const t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),n)}canPush(){return this.socket.isConnected()&&this.state===n.CHANNEL_STATES.joined}isJoined(){return this.state===n.CHANNEL_STATES.joined}isJoining(){return this.state===n.CHANNEL_STATES.joining}isClosed(){return this.state===n.CHANNEL_STATES.closed}isLeaving(){return this.state===n.CHANNEL_STATES.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}},1245,[1236]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"postgresChangesFilter",{enumerable:!0,get:function(){return c}});const t=/[,()"\\]/,n=n=>t.test(n)||n!==n.trim(),s=t=>`"${t.replace(/\\/g,'\\\\').replace(/"/g,'\\"')}"`,u=t=>{const u=null===t?'null':String(t);return n(u)?s(u):u},l=t=>null===t?'null':String(t),h=(t,n)=>{if('in'===t){const t=Array.isArray(n)?n:[n];if(0===t.length)throw new Error('Realtime `in` filter requires at least one value.');return`in.(${Array.from(new Set(t)).map(t=>u(t)).join(',')})`}return'is'===t?`is.${l(n)}`:`${t}.${u(n)}`};class o{constructor(){this.filters=[]}add(t,n,s,u=!1){const l=u?'not.':'';return this.filters.push(`${t}=${l}${h(n,s)}`),this}eq(t,n){return this.add(t,'eq',n)}neq(t,n){return this.add(t,'neq',n)}gt(t,n){return this.add(t,'gt',n)}gte(t,n){return this.add(t,'gte',n)}lt(t,n){return this.add(t,'lt',n)}lte(t,n){return this.add(t,'lte',n)}in(t,n){return this.add(t,'in',n)}like(t,n){return this.add(t,'like',n)}ilike(t,n){return this.add(t,'ilike',n)}match(t,n){return this.add(t,'match',n)}imatch(t,n){return this.add(t,'imatch',n)}is(t,n){return this.add(t,'is',n)}isDistinct(t,n){return this.add(t,'isdistinct',n)}not(t,n,s){return this.add(t,n,s,!0)}build(){return this.filters.join(',')}toString(){return this.build()}}const c=()=>new o},1246,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]);class s{constructor(n,s){this.socket=new t.Socket(n,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,s,o=1e4){return new Promise(c=>{setTimeout(()=>c('timeout'),o),this.socket.disconnect(()=>{t(),c('ok')},n,s)})}push(t){this.socket.push(t)}log(t,n,s){this.socket.log(t,n,s)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.connecting}isDisconnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}},1247,[1243,1236]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"StorageAnalyticsClient",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StorageClient",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(_e,"StorageError",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"StorageUnknownError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"StorageVectorsApiError",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"StorageVectorsClient",{enumerable:!0,get:function(){return X}}),Object.defineProperty(_e,"StorageVectorsError",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"VectorBucketApi",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"VectorBucketScope",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(_e,"VectorDataApi",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"VectorIndexApi",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(_e,"VectorIndexScope",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(_e,"isStorageError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isStorageVectorsError",{enumerable:!0,get:function(){return f}});var e=_r(d[0]);function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function n(e){var n=r(e,"string");return"symbol"==t(n)?n:n+""}function o(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},k=e=>{if(Array.isArray(e))return e.map(e=>k(e));if("function"==typeof e||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([e,r])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));t[n]=k(r)}),t},x=e=>!(!e||"string"!=typeof e)&&(!(0===e.length||e.length>100)&&(e.trim()===e&&(!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e)))),$=e=>{if("object"==typeof e&&null!==e){const t=e;if("string"==typeof t.msg)return t.msg;if("string"==typeof t.message)return t.message;if("string"==typeof t.error_description)return t.error_description;if("string"==typeof t.error)return t.error;if("object"==typeof t.error&&null!==t.error){const e=t.error;if("string"==typeof e.message)return e.message}}return JSON.stringify(e)},j=async(e,t,r,n)=>{if(null!==e&&"object"==typeof e&&"json"in e&&"function"==typeof e.json){const r=e;let o=parseInt(String(r.status),10);Number.isFinite(o)||(o=500),r.json().then(e=>{const r=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||o+"";t(new l($(e),o,r,n))}).catch(()=>{const e=o+"";t(new l(r.statusText||`HTTP ${o} error`,o,e,n))})}else t(new h($(e),e,n))},B=(e,t,r,n)=>{const o={method:e,headers:(null==t?void 0:t.headers)||{}};if("GET"===e||"HEAD"===e||!n)return c(c({},o),r);if(S(n)){var s;const e=(null==t?void 0:t.headers)||{};let r;for(const[t,n]of Object.entries(e))"content-type"===t.toLowerCase()&&(r=n);o.headers=w(e,"Content-Type",null!==(s=r)&&void 0!==s?s:"application/json"),o.body=JSON.stringify(n)}else o.body=n;return(null==t?void 0:t.duplex)&&(o.duplex=t.duplex),c(c({},o),r)};async function P(e,t,r,n,o,s,c){return new Promise((i,u)=>{e(r,B(t,n,o,s)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;if("vectors"===c){const t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status)return{};if(!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>i(e)).catch(e=>j(e,u,0,c))})}function N(e="storage"){return{get:async(t,r,n,o)=>P(t,"GET",r,n,o,void 0,e),post:async(t,r,n,o,s)=>P(t,"POST",r,o,s,n,e),put:async(t,r,n,o,s)=>P(t,"PUT",r,o,s,n,e),head:async(t,r,n,o)=>P(t,"HEAD",r,c(c({},n),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,n,o,s)=>P(t,"DELETE",r,o,s,n,e)}}const E=N("storage"),{get:C,post:V,put:I,head:T,remove:U}=E,_=N("vectors");var F=class{constructor(e,t={},r,n="storage"){var o;this.shouldThrowOnError=!1,this.url=e,this.headers=O(t),this.fetch=(o=r)?(...e)=>o(...e):(...e)=>fetch(...e),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=w(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let R;R=Symbol.toStringTag;var L=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[R]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let D;D=Symbol.toStringTag;var A=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[D]="BlobDownloadBuilder",this.promise=null}asStream(){return new L(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};const M={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},z={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J=class extends F{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var o=this;return o.handleOperation(async()=>{let s;const i=c(c({},z),n);let u=c(c({},o.headers),"POST"===e&&{"x-upsert":String(i.upsert)});const l=i.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(s=new FormData,s.append("cacheControl",i.cacheControl),l&&s.append("metadata",o.encodeMetadata(l)),s.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",i.cacheControl),l&&!s.has("metadata")&&s.append("metadata",o.encodeMetadata(l))):(s=r,u["cache-control"]=`max-age=${i.cacheControl}`,u["content-type"]=i.contentType,l&&(u["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&s instanceof ReadableStream||s&&"object"==typeof s&&"pipe"in s&&"function"==typeof s.pipe)&&!i.duplex&&(i.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))u=w(u,e,t);const h=o._removeEmptyFolders(t),p=o._getFinalPath(h),f=await("PUT"==e?I:V)(o.fetch,`${o.url}/object/${p}`,s,c({headers:u},(null==i?void 0:i.duplex)?{duplex:i.duplex}:{}));return{path:h,id:f.Id,fullPath:f.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var o=this;const s=o._removeEmptyFolders(e),i=o._getFinalPath(s),u=new URL(o.url+`/object/upload/sign/${i}`);return u.searchParams.set("token",t),o.handleOperation(async()=>{let e;const t=c(c({},z),n);let i=c(c({},o.headers),{"x-upsert":String(t.upsert)});const l=t.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),l&&e.append("metadata",o.encodeMetadata(l)),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.has("cacheControl")||e.append("cacheControl",t.cacheControl),l&&!e.has("metadata")&&e.append("metadata",o.encodeMetadata(l))):(e=r,i["cache-control"]=`max-age=${t.cacheControl}`,i["content-type"]=t.contentType,l&&(i["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&e instanceof ReadableStream||e&&"object"==typeof e&&"pipe"in e&&"function"==typeof e.pipe)&&!t.duplex&&(t.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))i=w(i,e,t);return{path:s,fullPath:(await I(o.fetch,u.toString(),e,c({headers:i},(null==t?void 0:t.duplex)?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const o=c({},r.headers);(null==t?void 0:t.upsert)&&(o["x-upsert"]="true");const s=await V(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:o}),u=new URL(r.url+s.url),l=u.searchParams.get("token");if(!l)throw new i("No token returned by API");return{signedUrl:u.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await V(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await V(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let o=n._getFinalPath(e);const s="object"==typeof(null==r?void 0:r.transform)&&null!==r.transform&&Object.keys(r.transform).length>0;let i=await V(n.fetch,`${n.url}/object/sign/${o}`,c({expiresIn:t},s?{transform:r.transform}:{}),{headers:n.headers});const u=new URLSearchParams;(null==r?void 0:r.download)&&u.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&u.set("cacheNonce",String(r.cacheNonce));const l=u.toString();return{signedUrl:encodeURI(`${n.url}${i.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const o=await V(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),s=new URLSearchParams;(null==r?void 0:r.download)&&s.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&s.set("cacheNonce",String(r.cacheNonce));const i=s.toString();return o.map(e=>c(c({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${i?`&${i}`:""}`):null}))})}download(e,t,r){const n="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(o,t.transform),null!=(null==t?void 0:t.cacheNonce)&&o.set("cacheNonce",String(t.cacheNonce));const s=o.toString(),c=this._getFinalPath(e);return new A(()=>C(this.fetch,`${this.url}/${n}/${c}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},r),this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>k(await C(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await T(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(u(e)){var n;const t=e instanceof l?e.status:e instanceof h?null===(n=e.originalError)||void 0===n?void 0:n.status:void 0;if(void 0!==t&&[400,404].includes(t))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;(null==t?void 0:t.download)&&n.set("download",!0===t.download?"":t.download),(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(n,t.transform),null!=(null==t?void 0:t.cacheNonce)&&n.set("cacheNonce",String(t.cacheNonce));const o=n.toString(),s="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=n._getFinalPath(e),s=new URLSearchParams;(null==t?void 0:t.transformations)&&s.set("transformations","true");const c=s.toString();return await U(n.fetch,`${n.url}/cdn/${o}${c?`?${c}`:""}`,{},{headers:n.headers},r)})}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const o=(null==t?void 0:t.sortBy)?c(c({},M.sortBy),t.sortBy):M.sortBy,s=c(c(c({},M),t),{},{sortBy:o,prefix:e||""});return await V(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=c({},e);return await V(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const K={"X-Client-Info":"storage-js/2.109.0"};var q=class extends F{constructor(e,t={},r,n){const o=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));super(o.href.replace(/\/$/,""),c(c({},K),t),r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await C(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await C(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await V(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await I(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=new URLSearchParams;(null==t?void 0:t.transformations)&&o.set("transformations","true");const s=o.toString();return await U(n.fetch,`${n.url}/cdn/${e}${s?`?${s}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},H=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),t),r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&r.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);const n=r.toString(),o=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await C(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(t){var r=this;if(!x(t))throw new i("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new e.IcebergRestCatalog({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>r.headers},fetch:this.fetch}),o=this.shouldThrowOnError;return new Proxy(n,{get(e,t){const r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(e){if(o)throw e;return{data:null,error:e}}}}})}},Q=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},G=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},W=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},X=class extends W{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Y(this.url,this.headers,e,this.fetch)}async createBucket(e){return(()=>super.createBucket)().call(this,e)}async getBucket(e){return(()=>super.getBucket)().call(this,e)}async listBuckets(e={}){return(()=>super.listBuckets)().call(this,e)}async deleteBucket(e){return(()=>super.deleteBucket)().call(this,e)}},Y=class extends Q{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return(()=>super.createIndex)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return(()=>super.listIndexes)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return(()=>super.getIndex)().call(this,this.vectorBucketName,e)}async deleteIndex(e){return(()=>super.deleteIndex)().call(this,this.vectorBucketName,e)}index(e){return new Z(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Z=class extends G{constructor(e,t,r,n,o){super(e,t,o),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=this;return(()=>super.putVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(e){var t=this;return(()=>super.getVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(e={}){var t=this;return(()=>super.listVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(e){var t=this;return(()=>super.queryVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(e){var t=this;return(()=>super.deleteVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},ee=class extends q{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new J(this.url,this.headers,e,this.fetch)}get vectors(){return new X(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new H(this.url+"/iceberg",this.headers,this.fetch)}}},1248,[1249]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IcebergError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"IcebergRestCatalog",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"getCurrentSchema",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isDecimalType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isFixedType",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseDecimalType",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"parseFixedType",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"typesEqual",{enumerable:!0,get:function(){return x}});var t=class extends Error{constructor(t,a){super(t),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown="CommitStateUnknownException"===a.icebergType||[500,502,504].includes(a.status)&&!0===a.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function a(t,a,s){const n=new URL(a,t);if(s)for(const[t,a]of Object.entries(s))void 0!==a&&n.searchParams.set(t,a);return n.toString()}async function s(t){return t&&"none"!==t.type?"bearer"===t.type?{Authorization:`Bearer ${t.token}`}:"header"===t.type?{[t.name]:t.value}:"custom"===t.type?await t.getHeaders():{}:{}}function n(n){const c=n.fetchImpl??globalThis.fetch;return{async request({method:o,path:p,query:u,body:l,headers:h}){const b=a(n.baseUrl,p,u),f=await s(n.auth),y=await c(b,{method:o,headers:{...l?{"Content-Type":"application/json"}:{},...f,...h},body:l?JSON.stringify(l):void 0}),T=await y.text(),w=(y.headers.get("content-type")||"").includes("application/json"),x=w&&T?JSON.parse(T):T;if(!y.ok){const a=w?x:void 0,s=a?.error;throw new t(s?.message??`Request failed with status ${y.status}`,{status:y.status,icebergType:s?.type,icebergCode:s?.code,details:a})}return{status:y.status,headers:y.headers,data:x}}}}function c(t){return t.join("\x1f")}var o=class{constructor(t,a=""){this.client=t,this.prefix=a}async listNamespaces(t){const a=t?{parent:c(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(t=>({namespace:t}))}async createNamespace(t,a){const s={namespace:t.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${c(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${c(t.namespace)}`})).data.properties}}async namespaceExists(a){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${c(a.namespace)}`}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createNamespaceIfNotExists(a,s){try{return await this.createNamespace(a,s)}catch(a){if(a instanceof t&&409===a.status)return;throw a}}};function p(t){return t.join("\x1f")}var u=class{constructor(t,a="",s){this.client=t,this.prefix=a,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`})).data.identifiers}async createTable(t,a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`,body:a,headers:s})).data.metadata}async updateTable(t,a){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,body:a});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(t){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,headers:a})).data.metadata}async tableExists(a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${p(a.namespace)}/tables/${a.name}`,headers:s}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createTableIfNotExists(a,s){try{return await this.createTable(a,s)}catch(n){if(n instanceof t&&409===n.status)return await this.loadTable({namespace:a.namespace,name:s.name});throw n}}},l=class{constructor(t){let a="v1";t.catalogName&&(a+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=n({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new o(this.client,a),this.tableOps=new u(this.client,a,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,a){return this.namespaceOps.createNamespace(t,a)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,a){return this.tableOps.createTable(t,a)}async updateTable(t,a){return this.tableOps.updateTable(t,a)}async dropTable(t,a){await this.tableOps.dropTable(t,a)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,a){return this.namespaceOps.createNamespaceIfNotExists(t,a)}async createTableIfNotExists(t,a){return this.tableOps.createTableIfNotExists(t,a)}},h=/^decimal\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)$/,b=/^fixed\s*\[\s*(\d+)\s*\]$/;function f(t){const a=t.match(h);return a?{precision:parseInt(a[1],10),scale:parseInt(a[2],10)}:null}function y(t){const a=t.match(b);return a?{length:parseInt(a[1],10)}:null}function T(t){return h.test(t)}function w(t){return b.test(t)}function x(t,a){const s=f(t),n=f(a);if(s&&n)return s.precision===n.precision&&s.scale===n.scale;const c=y(t),o=y(a);return c&&o?c.length===o.length:t===a}function O(t){return t.schemas.find(a=>a["schema-id"]===t["current-schema-id"])}},1249,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"navigatorLock",{enumerable:!0,get:function(){return l.navigatorLock}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return l.NavigatorLockAcquireTimeoutError}}),Object.defineProperty(_e,"lockInternals",{enumerable:!0,get:function(){return l.internals}}),Object.defineProperty(_e,"processLock",{enumerable:!0,get:function(){return l.processLock}}),Object.defineProperty(_e,"GoTrueAdminApi",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"GoTrueClient",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(_e,"AuthAdminApi",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"AuthClient",{enumerable:!0,get:function(){return u.default}});var t=e(r(d[0])),n=e(r(d[1])),o=e(r(d[2])),u=e(r(d[3])),c=r(d[4]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(d[5]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var l=r(d[6])},1250,[1251,1259,1266,1267,1258,1256,1261]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]),s=r(d[1]),n=r(d[2]),o=r(d[3]),h=r(d[4]);class u{constructor({url:t="",headers:s={},fetch:o,experimental:h}){this.url=t,this.headers=s,this.fetch=(0,n.resolveFetch)(o),this.experimental=null!=h?h:{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=o.SIGN_OUT_SCOPES[0]){if(o.SIGN_OUT_SCOPES.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${o.SIGN_OUT_SCOPES.join(', ')}`);try{return await(0,s._request)(this.fetch,'POST',`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async inviteUserByEmail(t,n={}){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async generateLink(n){try{const{options:o}=n,h=(0,t.__rest)(n,["options"]),u=Object.assign(Object.assign({},h),o);return'newEmail'in h&&(u.new_email=null==h?void 0:h.newEmail,delete u.newEmail),await(0,s._request)(this.fetch,'POST',`${this.url}/admin/generate_link`,{body:u,headers:this.headers,xform:s._generateLinkResponse,redirectTo:null==o?void 0:o.redirectTo})}catch(t){if((0,h.isAuthError)(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/users`,{body:t,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async listUsers(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{users:[]},error:t};throw t}}async getUserById(t){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t}`,{headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async updateUserById(t,o){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/users/${t}`,{body:o,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async deleteUser(t,o=!1){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:o},xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async _listFactors(t){(0,n.validateUUID)(t.userId);try{const{data:n,error:o}=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:t=>({data:{factors:t},error:null})});return{data:n,error:o}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteFactor(t){(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.id);try{return{data:await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listOAuthClients(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{clients:[]},error:t};throw t}}async _createOAuthClient(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getOAuthClient(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateOAuthClient(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteOAuthClient(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listCustomProviders(t){try{const n={};return(null==t?void 0:t.type)&&(n.type=t.type),await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:t=>{var s;return{data:{providers:null!==(s=null==t?void 0:t.providers)&&void 0!==s?s:[]},error:null}}})}catch(t){if((0,h.isAuthError)(t))return{data:{providers:[]},error:t};throw t}}async _createCustomProvider(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getCustomProvider(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateCustomProvider(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteCustomProvider(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminListPasskeys(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminDeletePasskey(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.passkeyId);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}}},1251,[1229,1252,1255,1258,1256]); +__d(function(g,r,_i,_a2,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.handleError=i,_e._request=async function(e,o,t,n){var a;const i=Object.assign({},null==n?void 0:n.headers);i[s.API_VERSION_HEADER_NAME]||(i[s.API_VERSION_HEADER_NAME]=s.API_VERSIONS['2024-01-01'].name);(null==n?void 0:n.jwt)&&(i.Authorization=`Bearer ${n.jwt}`);const u=null!==(a=null==n?void 0:n.query)&&void 0!==a?a:{};(null==n?void 0:n.redirectTo)&&(u.redirect_to=n.redirectTo);const l=Object.keys(u).length?'?'+new URLSearchParams(u).toString():'',_=await c(e,o,t+l,{headers:i,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(_):{data:Object.assign({},_),error:null}},_e._sessionResponse=l,_e._sessionResponsePassword=function(e){const s=l(e);!s.error&&e.weak_password&&'object'==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&'string'==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0)&&(s.data.weak_password=e.weak_password);return s},_e._userResponse=function(e){var s;return{data:{user:null!==(s=e.user)&&void 0!==s?s:e},error:null}},_e._ssoResponse=function(e){return{data:e,error:null}},_e._generateLinkResponse=function(s){const{action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i}=s,u=(0,e.__rest)(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i},l=Object.assign({},u);return{data:{properties:c,user:l},error:null}},_e._noResolveJsonResponse=function(e){return e};var e=r(d[0]),s=r(d[1]),o=r(d[2]),t=r(d[3]);const n=e=>{if('object'==typeof e&&null!==e){const s=e;if('string'==typeof s.msg)return s.msg;if('string'==typeof s.message)return s.message;if('string'==typeof s.error_description)return s.error_description;if('string'==typeof s.error)return s.error}return JSON.stringify(e)},a=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function i(e){var i;if(!(0,o.looksLikeFetchResponse)(e))throw new t.AuthRetryableFetchError(n(e),0);if(a.includes(e.status))throw new t.AuthRetryableFetchError(n(e),e.status);let u,c;try{u=await e.json()}catch(e){throw new t.AuthUnknownError(n(e),e)}const l=(0,o.parseResponseAPIVersion)(e);if(l&&l.getTime()>=s.API_VERSIONS['2024-01-01'].timestamp&&'object'==typeof u&&u&&'string'==typeof u.code?c=u.code:'object'==typeof u&&u&&'string'==typeof u.error_code&&(c=u.error_code),c){if('weak_password'===c)throw new t.AuthWeakPasswordError(n(u),e.status,(null===(i=u.weak_password)||void 0===i?void 0:i.reasons)||[]);if('session_not_found'===c)throw new t.AuthSessionMissingError}else if('object'==typeof u&&u&&'object'==typeof u.weak_password&&u.weak_password&&Array.isArray(u.weak_password.reasons)&&u.weak_password.reasons.length&&u.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0))throw new t.AuthWeakPasswordError(n(u),e.status,u.weak_password.reasons);throw new t.AuthApiError(n(u),e.status||500,c)}const u=(e,s,o,t)=>{const n={method:e,headers:(null==s?void 0:s.headers)||{}};return'GET'===e?n:(n.headers=Object.assign({'Content-Type':'application/json;charset=UTF-8'},null==s?void 0:s.headers),n.body=JSON.stringify(t),Object.assign(Object.assign({},n),o))};async function c(e,s,o,a,c,l){const _=u(s,a,c,l);let p;try{p=await e(o,Object.assign({},_))}catch(e){throw console.error(e),new t.AuthRetryableFetchError(n(e),0)}if(p.ok||await i(p),null==a?void 0:a.noResolveJson)return p;try{return await p.json()}catch(e){await i(e)}}function l(e){var s;let t=null;_(e)&&(t=Object.assign({},e),e.expires_at||(t.expires_at=(0,o.expiresAt)(e.expires_in)));return{data:{session:t,user:null!==(s=e.user)&&void 0!==s?s:'string'==typeof(null==e?void 0:e.id)?e:null},error:null}}function _(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}},1252,[1229,1253,1255,1256]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AUTO_REFRESH_TICK_DURATION_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AUTO_REFRESH_TICK_THRESHOLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"EXPIRY_MARGIN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REFRESH_FAILURE_COOLDOWN_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"GOTRUE_URL",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"STORAGE_KEY",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"AUDIENCE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DEFAULT_HEADERS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NETWORK_FAILURE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"API_VERSION_HEADER_NAME",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"API_VERSIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BASE64URL_REGEX",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"JWKS_TTL",{enumerable:!0,get:function(){return A}});var t=r(d[0]);const n=3e4,u=3,o=9e4,c=6e4,E='http://localhost:9999',_='supabase.auth.token',b='',f={'X-Client-Info':`gotrue-js/${t.version}`},R={MAX_RETRIES:10,RETRY_INTERVAL:2},O='X-Supabase-Api-Version',p={'2024-01-01':{timestamp:Date.parse('2024-01-01T00:00:00.0Z'),name:'2024-01-01'}},l=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,A=6e5},1253,[1254]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1254,[]); +__d(function(g,r,_i,a,m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),_e2.expiresAt=function(e){return Math.round(Date.now()/1e3)+e},_e2.generateCallbackId=function(){return Symbol('auth-callback')},Object.defineProperty(_e2,"isBrowser",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e2,"supportsLocalStorage",{enumerable:!0,get:function(){return i}}),_e2.parseParametersFromURL=function(e){const t={},n=new URL(e);if(n.hash&&'#'===n.hash[0])try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch(e){}return n.searchParams.forEach((e,n)=>{t[n]=e}),t},Object.defineProperty(_e2,"resolveFetch",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e2,"looksLikeFetchResponse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e2,"setItemAsync",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e2,"getItemAsync",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e2,"removeItemAsync",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e2,"Deferred",{enumerable:!0,get:function(){return p}}),_e2.decodeJWT=function(o){const s=o.split('.');if(3!==s.length)throw new t.AuthInvalidJwtError('Invalid JWT structure');for(let n=0;n{setTimeout(()=>t(null),e)})},_e2.retryable=function(e,t){return new Promise((n,o)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await e(s);if(!t(s,null,o))return void n(o)}catch(e){if(!t(s,e))return void o(e)}})()})},_e2.generatePKCEVerifier=b,_e2.generatePKCEChallenge=S,_e2.getCodeChallengeAndMethod=async function(e,t,n=!1){const o=b();let s=o;n&&(s+='/recovery');await l(e,`${t}-code-verifier`,s);const i=await S(o);return[i,o===i?'plain':'s256']},_e2.parseResponseAPIVersion=function(t){const n=t.headers.get(e.API_VERSION_HEADER_NAME);if(!n)return null;if(!n.match(P))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch(e){return null}},_e2.validateExp=function(e){if(!e)throw new Error('Missing exp claim');const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error('JWT has expired')},_e2.getAlgorithm=function(e){switch(e){case'RS256':return{name:'RSASSA-PKCS1-v1_5',hash:{name:'SHA-256'}};case'ES256':return{name:'ECDSA',namedCurve:'P-256',hash:{name:'SHA-256'}};default:throw new Error('Invalid alg claim')}},_e2.validateUUID=function(e){if(!A.test(e))throw new Error('@supabase/auth-js: Expected parameter to be UUID but is not')},_e2.assertPasskeyExperimentalEnabled=function(e){if(!e.passkey)throw new Error('@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).')},_e2.userNotAvailableProxy=function(){return new Proxy({},{get:(e,t)=>{if('__isUserNotAvailableProxy'===t)return!0;if('symbol'==typeof t){const e=t.toString();if('Symbol(Symbol.toPrimitive)'===e||'Symbol(Symbol.toStringTag)'===e||'Symbol(util.inspect.custom)'===e)return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})},_e2.insecureUserWarningProxy=function(e,t){return new Proxy(e,{get:(e,n,o)=>{if('__isInsecureUserWarningProxy'===n)return!0;if('symbol'==typeof n){const t=n.toString();if('Symbol(Symbol.toPrimitive)'===t||'Symbol(Symbol.toStringTag)'===t||'Symbol(util.inspect.custom)'===t||'Symbol(nodejs.util.inspect.custom)'===t)return Reflect.get(e,n,o)}return t.value||'string'!=typeof n||(console.warn('Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server.'),t.value=!0),Reflect.get(e,n,o)}})},_e2.deepClone=function(e){return JSON.parse(JSON.stringify(e))};var e=r(d[0]),t=r(d[1]),n=r(d[2]);const o=()=>'undefined'!=typeof window&&'undefined'!=typeof document,s={tested:!1,writable:!1},i=()=>{if(!o())return!1;try{if('object'!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(s.tested)return s.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),s.tested=!0,s.writable=!0}catch(e){s.tested=!0,s.writable=!1}return s.writable};const u=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),c=e=>'object'==typeof e&&null!==e&&'status'in e&&'ok'in e&&'json'in e&&'function'==typeof e.json,l=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},f=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return null}},h=async(e,t)=>{await e.removeItem(t)};class p{constructor(){this.promise=new p.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function y(e){return('0'+e.toString(16)).substr(-2)}function b(){const e=new Uint32Array(56);if('undefined'==typeof crypto){const e='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~',t=e.length;let n='';for(let o=0;o<56;o++)n+=e.charAt(Math.floor(Math.random()*t));return n}return crypto.getRandomValues(e),Array.from(e,y).join('')}async function w(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest('SHA-256',t),o=new Uint8Array(n);return Array.from(o).map(e=>String.fromCharCode(e)).join('')}async function S(e){if(!('undefined'!=typeof crypto&&void 0!==crypto.subtle&&'undefined'!=typeof TextEncoder))return console.warn('WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256.'),e;const t=await w(e);return btoa(t).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'')}p.promiseConstructor=Promise;const P=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;const A=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/},1255,[1253,1256,1257]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AuthError",{enumerable:!0,get:function(){return t}}),e.isAuthError=s,Object.defineProperty(e,"AuthApiError",{enumerable:!0,get:function(){return n}}),e.isAuthApiError=function(t){return s(t)&&'AuthApiError'===t.name},Object.defineProperty(e,"AuthUnknownError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CustomAuthError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AuthSessionMissingError",{enumerable:!0,get:function(){return c}}),e.isAuthSessionMissingError=function(t){return s(t)&&'AuthSessionMissingError'===t.name},Object.defineProperty(e,"AuthInvalidTokenResponseError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"AuthInvalidCredentialsError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AuthImplicitGrantRedirectError",{enumerable:!0,get:function(){return f}}),e.isAuthImplicitGrantRedirectError=function(t){return s(t)&&'AuthImplicitGrantRedirectError'===t.name},Object.defineProperty(e,"AuthPKCEGrantCodeExchangeError",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AuthPKCECodeVerifierMissingError",{enumerable:!0,get:function(){return A}}),e.isAuthPKCECodeVerifierMissingError=function(t){return s(t)&&'AuthPKCECodeVerifierMissingError'===t.name},Object.defineProperty(e,"AuthRetryableFetchError",{enumerable:!0,get:function(){return p}}),e.isAuthRetryableFetchError=function(t){return s(t)&&'AuthRetryableFetchError'===t.name},Object.defineProperty(e,"AuthRefreshDiscardedError",{enumerable:!0,get:function(){return b}}),e.isAuthRefreshDiscardedError=function(t){return s(t)&&'AuthRefreshDiscardedError'===t.name},Object.defineProperty(e,"AuthWeakPasswordError",{enumerable:!0,get:function(){return O}}),e.isAuthWeakPasswordError=function(t){return s(t)&&'AuthWeakPasswordError'===t.name},Object.defineProperty(e,"AuthInvalidJwtError",{enumerable:!0,get:function(){return P}});class t extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name='AuthError',this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function s(t){return'object'==typeof t&&null!==t&&'__isAuthError'in t}class n extends t{constructor(t,s,n){super(t,s,n),this.name='AuthApiError',this.status=s,this.code=n}}class o extends t{constructor(t,s){super(t),this.name='AuthUnknownError',this.originalError=s}}class u extends t{constructor(t,s,n,o){super(t,n,o),this.name=s,this.status=n}}class c extends u{constructor(){super('Auth session missing!','AuthSessionMissingError',400,void 0)}}class h extends u{constructor(){super('Auth session or user missing','AuthInvalidTokenResponseError',500,void 0)}}class l extends u{constructor(t){super(t,'AuthInvalidCredentialsError',400,void 0)}}class f extends u{constructor(t,s=null){super(t,'AuthImplicitGrantRedirectError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class E extends u{constructor(t,s=null){super(t,'AuthPKCEGrantCodeExchangeError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class A extends u{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.",'AuthPKCECodeVerifierMissingError',400,'pkce_code_verifier_not_found')}}class p extends u{constructor(t,s){super(t,'AuthRetryableFetchError',s,void 0)}}class b extends u{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,'AuthRefreshDiscardedError',409,void 0)}}class O extends u{constructor(t,s,n){super(t,'AuthWeakPasswordError',s,'weak_password'),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class P extends u{constructor(t){super(t,'AuthInvalidJwtError',400,'invalid_jwt')}}},1256,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.byteToBase64URL=o,e.byteFromBase64URL=i,e.stringToBase64URL=function(t){const u=[],n=t=>{u.push(t)},i={queue:0,queuedBits:0};return f(t,t=>{o(t,i,n)}),o(null,i,n),u.join('')},e.stringFromBase64URL=function(t){const u=[],n=t=>{u.push(String.fromCodePoint(t))},o={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},f=t=>{c(t,o,n)};for(let u=0;u{u.push(t)};for(let u=0;uu.push(t)),new Uint8Array(u)},e.bytesToBase64URL=function(t){const u=[],n={queue:0,queuedBits:0},i=t=>{u.push(t)};return t.forEach(t=>o(t,n,i)),o(null,n,i),u.join('')};const t='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'.split(''),u=' \t\n\r='.split(''),n=(()=>{const n=new Array(128);for(let t=0;t=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}}function i(t,u,o){const i=n[t];if(!(i>-1)){if(-2===i)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}for(u.queue=u.queue<<6|i,u.queuedBits+=6;u.queuedBits>=8;)o(u.queue>>u.queuedBits-8&255),u.queuedBits-=8}function s(t,u){if(!(t<=127)){if(t<=2047)return u(192|t>>6),void u(128|63&t);if(t<=65535)return u(224|t>>12),u(128|t>>6&63),void u(128|63&t);if(t<=1114111)return u(240|t>>18),u(128|t>>12&63),u(128|t>>6&63),void u(128|63&t);throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}u(t)}function f(t,u){for(let n=0;n55295&&o<=56319){const u=1024*(o-55296)&65535;o=65536+(t.charCodeAt(n+1)-56320&65535|u),n+=1}s(o,u)}}function c(t,u,n){if(0===u.utf8seq){if(t<=127)return void n(t);for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){u.utf8seq=n;break}if(2===u.utf8seq)u.codepoint=31&t;else if(3===u.utf8seq)u.codepoint=15&t;else{if(4!==u.utf8seq)throw new Error('Invalid UTF-8 sequence');u.codepoint=7&t}u.utf8seq-=1}else if(u.utf8seq>0){if(t<=127)throw new Error('Invalid UTF-8 sequence');u.codepoint=u.codepoint<<6|63&t,u.utf8seq-=1,0===u.utf8seq&&n(u.codepoint)}}},1257,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SIGN_OUT_SCOPES",{enumerable:!0,get:function(){return t}});const t=['global','local','others']},1258,[]); +__d(function(e,t,s,r,i,n,a){"use strict";Object.defineProperty(n,'__esModule',{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return A}});var o,l=t(a[0]),u=(o=l)&&o.__esModule?o:{default:o},h=t(a[1]),c=t(a[2]),d=t(a[3]),_=t(a[4]),g=t(a[5]),w=t(a[6]),y=t(a[7]),f=t(a[8]),p=t(a[9]),v=t(a[10]),b=t(a[11]);(0,y.polyfillGlobalThis)();const k={url:h.GOTRUE_URL,storageKey:h.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:h.DEFAULT_HEADERS,flowType:'implicit',debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},m={};class R{get jwks(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{cachedAt:e})}constructor(e){var t,s,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},k),e);if(this.storageKey=i.storageKey,this.instanceID=null!==(t=R.nextInstanceID[this.storageKey])&&void 0!==t?t:0,R.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,'function'==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&(0,_.isBrowser)()){const e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=null!==(s=i.experimental)&&void 0!==s?s:{},this.admin=new u.default({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=(0,_.resolveFetch)(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,null!=i.lock&&(this.lock=i.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new b.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,_.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),(0,_.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error('Failed to create a new BroadcastChannel, multi-tab state changes will not be available',e)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener('message',async e=>{this._debug('received broadcast notification from other tab or client',e),'TOKEN_REFRESHED'!==e.data.event&&'SIGNED_IN'!==e.data.event||(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug('#broadcastChannel','error',e)}})}i.skipAutoInitialize||this.initialize().catch(e=>{this._debug('#initialize()','error',e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${f.version}) ${(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())()),await this.initializePromise}async _initialize(){var e;try{let t={},s='none';if((0,_.isBrowser)()&&(t=(0,_.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(t)?s='implicit':await this._isPKCECallback(t)&&(s='pkce')),(0,_.isBrowser)()&&this.detectSessionInUrl&&'none'!==s){const{data:r,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug('#_initialize()','error detecting session from URL',i),(0,c.isAuthImplicitGrantRedirectError)(i)){const t=null===(e=i.details)||void 0===e?void 0:e.code;if('identity_already_exists'===t||'identity_not_found'===t||'single_identity_not_deletable'===t)return{error:i}}return{error:i}}const{session:n,redirectType:a}=r;return this._debug('#_initialize()','detected session in URL',n,'redirect type',a),await this._saveSession(n),setTimeout(async()=>{'recovery'===a?await this._notifyAllSubscribers('PASSWORD_RECOVERY',n):await this._notifyAllSubscribers('SIGNED_IN',n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return(0,c.isAuthError)(e)?this._returnResult({error:e}):this._returnResult({error:new c.AuthUnknownError('Unexpected error during initialization',e)})}finally{await this._handleVisibilityChange(),this._debug('#_initialize()','end')}}async signInAnonymously(e){var t,s,r;try{const i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{data:null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==s?s:{},gotrue_meta_security:{captcha_token:null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken}},xform:d._sessionResponse}),{data:n,error:a}=i;if(a||!n)return this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,s,r;try{let i;if('email'in e){const{email:s,password:r,options:n}=e;let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey)),i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:d._sessionResponse})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:t,password:n,options:a}=e;i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null==a?void 0:a.data)&&void 0!==s?s:{},channel:null!==(r=null==a?void 0:a.channel)&&void 0!==r?r:'sms',gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:d._sessionResponse})}}const{data:n,error:a}=i;if(a||!n)return await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if('email'in e){const{email:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}}const{data:s,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!s||!s.session||!s.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers('SIGNED_IN',s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,null!=this.lock?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:t}=e;switch(t){case'ethereum':return await this.signInWithEthereum(e);case'solana':return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,s,r,i,n,a,o,l,u,h,g;let w,y;if('message'in e)w=e.message,y=e.signature;else{const{chain:h,wallet:c,statement:d,options:g}=e;let f;if((0,_.isBrowser)())if('object'==typeof c)f=c;else{const e=window;if(!('ethereum'in e)||'object'!=typeof e.ethereum||!('request'in e.ethereum)||'function'!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");f=e.ethereum}else{if('object'!=typeof c||!(null==g?void 0:g.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');f=c}const p=new URL(null!==(t=null==g?void 0:g.url)&&void 0!==t?t:window.location.href),b=await f.request({method:'eth_requestAccounts'}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=(0,v.getAddress)(b[0]);let m=null===(s=null==g?void 0:g.signInWithEthereum)||void 0===s?void 0:s.chainId;if(!m){const e=await f.request({method:'eth_chainId'});m=(0,v.fromHex)(e)}const R={domain:p.host,address:k,statement:d,uri:p.href,version:'1',chainId:m,nonce:null===(r=null==g?void 0:g.signInWithEthereum)||void 0===r?void 0:r.nonce,issuedAt:null!==(n=null===(i=null==g?void 0:g.signInWithEthereum)||void 0===i?void 0:i.issuedAt)&&void 0!==n?n:new Date,expirationTime:null===(a=null==g?void 0:g.signInWithEthereum)||void 0===a?void 0:a.expirationTime,notBefore:null===(o=null==g?void 0:g.signInWithEthereum)||void 0===o?void 0:o.notBefore,requestId:null===(l=null==g?void 0:g.signInWithEthereum)||void 0===l?void 0:l.requestId,resources:null===(u=null==g?void 0:g.signInWithEthereum)||void 0===u?void 0:u.resources};w=(0,v.createSiweMessage)(R),y=await f.request({method:'personal_sign',params:[(0,v.toHex)(w),k]})}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'ethereum',message:w,signature:y},(null===(h=e.options)||void 0===h?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null===(g=e.options)||void 0===g?void 0:g.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,s,r,i,n,a,o,l,u,h,g,w;let y,f;if('message'in e)y=e.message,f=e.signature;else{const{chain:c,wallet:d,statement:g,options:w}=e;let p;if((0,_.isBrowser)())if('object'==typeof d)p=d;else{const e=window;if(!('solana'in e)||'object'!=typeof e.solana||!('signIn'in e.solana&&'function'==typeof e.solana.signIn||'signMessage'in e.solana&&'function'==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");p=e.solana}else{if('object'!=typeof d||!(null==w?void 0:w.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');p=d}const v=new URL(null!==(t=null==w?void 0:w.url)&&void 0!==t?t:window.location.href);if('signIn'in p&&p.signIn){const e=await p.signIn(Object.assign(Object.assign(Object.assign({issuedAt:(new Date).toISOString()},null==w?void 0:w.signInWithSolana),{version:'1',domain:v.host,uri:v.href}),g?{statement:g}:null));let t;if(Array.isArray(e)&&e[0]&&'object'==typeof e[0])t=e[0];else{if(!(e&&'object'==typeof e&&'signedMessage'in e&&'signature'in e))throw new Error('@supabase/auth-js: Wallet method signIn() returned unrecognized value');t=e}if(!('signedMessage'in t&&'signature'in t&&('string'==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields');y='string'==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),f=t.signature}else{if(!('signMessage'in p&&'function'==typeof p.signMessage&&'publicKey'in p&&'object'==typeof p&&p.publicKey&&'toBase58'in p.publicKey&&'function'==typeof p.publicKey.toBase58))throw new Error('@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API');y=[`${v.host} wants you to sign in with your Solana account:`,p.publicKey.toBase58(),...g?['',g,'']:[''],'Version: 1',`URI: ${v.href}`,`Issued At: ${null!==(r=null===(s=null==w?void 0:w.signInWithSolana)||void 0===s?void 0:s.issuedAt)&&void 0!==r?r:(new Date).toISOString()}`,...(null===(i=null==w?void 0:w.signInWithSolana)||void 0===i?void 0:i.notBefore)?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...(null===(n=null==w?void 0:w.signInWithSolana)||void 0===n?void 0:n.expirationTime)?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...(null===(a=null==w?void 0:w.signInWithSolana)||void 0===a?void 0:a.chainId)?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...(null===(o=null==w?void 0:w.signInWithSolana)||void 0===o?void 0:o.nonce)?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...(null===(l=null==w?void 0:w.signInWithSolana)||void 0===l?void 0:l.requestId)?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...(null===(h=null===(u=null==w?void 0:w.signInWithSolana)||void 0===u?void 0:u.resources)||void 0===h?void 0:h.length)?['Resources',...w.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join('\n');const e=await p.signMessage((new TextEncoder).encode(y),'utf8');if(!(e&&e instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet signMessage() API returned an recognized value');f=e}}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'solana',message:y,signature:(0,p.bytesToBase64URL)(f)},(null===(g=e.options)||void 0===g?void 0:g.captchaToken)?{gotrue_meta_security:{captcha_token:null===(w=e.options)||void 0===w?void 0:w.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!=t?t:'').split('/');try{if(!s&&'pkce'===this.flowType)throw new c.AuthPKCECodeVerifierMissingError;const{data:t,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:d._sessionResponse});if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('recovery'===r?'PASSWORD_RECOVERY':'SIGNED_IN',t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=r?r:null}),error:i})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,a=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:d._sessionResponse}),{data:o,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o||!o.session||!o.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers('SIGNED_IN',o.session)),this._returnResult({data:o,error:l})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if('email'in e){const{email:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null==i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:t,options:s}=e,{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null==s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null==s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},channel:null!==(n=null==s?void 0:s.channel)&&void 0!==n?n:'sms'}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number.')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,s;try{let r,i;'options'in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:a}=await(0,d._request)(this.fetch,'POST',`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:d._sessionResponse});if(a)throw a;if(!n){throw new Error('An error occurred on token verification.')}const o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers('recovery'==e.type?'PASSWORD_RECOVERY':'SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,s,r,i,n;try{let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const l=await(0,d._request)(this.fetch,'POST',`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},'providerId'in e?{provider_id:e.providerId}:null),'domain'in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:o}),headers:this.headers,xform:d._ssoResponse});return(null===(i=l.data)||void 0===i?void 0:i.url)&&(0,_.isBrowser)()&&!(null===(n=e.options)||void 0===n?void 0:n.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new c.AuthSessionMissingError;const{error:r}=await(0,d._request)(this.fetch,'GET',`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if('email'in e){const{email:s,type:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return o&&await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:s,type:r,options:i}=e,{data:n,error:a}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a type')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,t){this._debug('#_acquireLock','begin',e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug('#_acquireLock','lock acquired for storage key',this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug('#_acquireLock','lock released for storage key',this.storageKey),this.lockAcquired=!1}})}finally{this._debug('#_acquireLock','end')}}async _useSession(e){this._debug('#_useSession','begin');try{const t=await this.__loadSession();return await e(t)}finally{this._debug('#_useSession','end')}}async __loadSession(){this._debug('#__loadSession()','begin'),null==this.lock||this.lockAcquired||this._debug('#__loadSession()','used outside of an acquired lock!',(new Error).stack);try{let e=null;const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(this._debug('#getSession()','session from storage',t),null!==t&&(this._isValidSession(t)?e=t:(this._debug('#getSession()','session from storage is not valid'),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&1e3*e.expires_at-Date.now()Date.now())){const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(t&&t.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:r},error:null})}finally{this._debug('#__loadSession()','end')}}async getUser(e){if(e)return await this._getUser(e);let t;return await this.initializePromise,t=null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):await this._getUser(),t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:e,xform:d._userResponse}):await this._useSession(async e=>{var t,s,r;const{data:i,error:n}=e;if(n)throw n;return(null===(t=i.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0,xform:d._userResponse}):{data:{user:null},error:new c.AuthSessionMissingError}})}catch(e){if((0,c.isAuthError)(e))return(0,c.isAuthSessionMissingError)(e)&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t)):await this._updateUser(e,t)}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new c.AuthSessionMissingError;const n=r.session;let a=null,o=null;'pkce'===this.flowType&&null!=e.email&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{data:l,error:u}=await(0,d._request)(this.fetch,'PUT',`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:d._userResponse});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers('USER_UPDATED',n),this._returnResult({data:{user:n.user},error:null})})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new c.AuthSessionMissingError;const t=Date.now()/1e3;let s=t,r=!0,i=null;const{payload:n}=(0,_.decodeJWT)(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{data:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:'bearer',expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers('SIGNED_IN',i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null==e?void 0:e.refresh_token))throw new c.AuthSessionMissingError;const{data:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var s;try{if(!(0,_.isBrowser)())throw new c.AuthImplicitGrantRedirectError('No browser detected.');if(e.error||e.error_description||e.error_code)throw new c.AuthImplicitGrantRedirectError(e.error_description||'Error in URL with unspecified error_description',{error:e.error||'unspecified_error',code:e.error_code||'unspecified_code'});switch(t){case'implicit':if('pkce'===this.flowType)throw new c.AuthPKCEGrantCodeExchangeError('Not a valid PKCE flow url.');break;case'pkce':if('implicit'===this.flowType)throw new c.AuthImplicitGrantRedirectError('Not a valid implicit grant flow url.')}if('pkce'===t){if(this._debug('#_initialize()','begin','is PKCE flow',!0),!e.code)throw new c.AuthPKCEGrantCodeExchangeError('No code detected.');const{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;const i=new URL(window.location.href);return i.searchParams.delete('code'),window.history.replaceState(window.history.state,'',i.toString()),{data:{session:t.session,redirectType:null!==(s=t.redirectType)&&void 0!==s?s:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:n,refresh_token:a,expires_in:o,expires_at:l,token_type:u}=e;if(!(n&&o&&a&&u))throw new c.AuthImplicitGrantRedirectError('No session defined in URL');const d=Math.round(Date.now()/1e3),g=parseInt(o);let w=d+g;l&&(w=parseInt(l));const y=w-d;1e3*y<=h.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${g}s`);const f=w-g;d-f>=120?console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale',f,w,d):d-f<0&&console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew',f,w,d);const{data:p,error:v}=await this._getUser(n);if(v)throw v;const b={provider_token:r,provider_refresh_token:i,access_token:n,expires_in:g,expires_at:w,refresh_token:a,token_type:u,user:p.user};return window.location.hash='',this._debug('#_getSessionFromURL()','clearing window.location.hash'),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return'function'==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:'global'}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:'global'}){return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i&&!(0,c.isAuthSessionMissingError)(i))return this._returnResult({error:i});const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!(0,c.isAuthApiError)(t)||404!==t.status&&401!==t.status&&403!==t.status)&&!(0,c.isAuthSessionMissingError)(t))return this._returnResult({error:t})}return'others'!==e&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=(0,_.generateCallbackId)(),s={id:t,callback:e,unsubscribe:()=>{this._debug('#unsubscribe()','state change callback with id removed',t),this.stateChangeEmitters.delete(t)}};return this._debug('#onAuthStateChange()','registered callback with id',t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)}):await this._emitInitialSession(t)})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback('INITIAL_SESSION',r)),this._debug('INITIAL_SESSION','callback id',e,'session',r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback('INITIAL_SESSION',null)),this._debug('INITIAL_SESSION','callback id',e,'error',t),(0,c.isAuthSessionMissingError)(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let s=null,r=null;'pkce'===this.flowType&&([s,r]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,d._request)(this.fetch,'POST',`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return'token'in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:s,error:r}=await this._useSession(async t=>{var s,r,i,n,a;const{data:o,error:l}=t;if(l)throw l;const u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await(0,d._request)(this.fetch,'GET',u,{headers:this.headers,jwt:null!==(a=null===(n=o.session)||void 0===n?void 0:n.access_token)&&void 0!==a?a:void 0})});if(r)throw r;return(0,_.isBrowser)()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==s?void 0:s.url),this._returnResult({data:{provider:e.provider,url:null==s?void 0:s.url},error:null})}catch(t){if((0,c.isAuthError)(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var s;try{const{error:r,data:{session:i}}=t;if(r)throw r;const{options:n,provider:a,token:o,access_token:l,nonce:u}=e,h=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(s=null==i?void 0:i.access_token)&&void 0!==s?s:void 0,body:{provider:a,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:d._sessionResponse}),{data:_,error:g}=h;return g?this._returnResult({data:{user:null,session:null},error:g}):_&&_.session&&_.user?(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers('USER_UPDATED',_.session)),this._returnResult({data:_,error:g})):this._returnResult({data:{user:null,session:null},error:new c.AuthInvalidTokenResponseError})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){const t="#_refreshAccessToken()";this._debug(t,'begin');try{const s=Date.now();return await(0,_.retryable)(async s=>(s>0&&await(0,_.sleep)(200*Math.pow(2,s-1)),this._debug(t,'refreshing attempt',s),await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:d._sessionResponse})),(e,t)=>{const r=200*Math.pow(2,e);return t&&(0,c.isAuthRetryableFetchError)(t)&&Date.now()+r-sDate.now())?this._debug(r,'proactive refresh failed, access token still valid \u2014 preserving session'):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:s,expiresAt:Date.now()+h.REFRESH_FAILURE_COOLDOWN_MS},null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,'end')}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,'begin',t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map(async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(i),r.length>0){for(let e=0;ethis._autoRefreshTokenTick(),h.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&'object'==typeof e&&'function'==typeof e.unref?e.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&'object'==typeof t&&'function'==typeof t.unref?t.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug('#_stopAutoRefresh()');const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),null===(e=this.broadcastChannel)||void 0===e||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug('#_autoRefreshTokenTick()','begin'),null==this.lock)if(null===this.refreshingDeferred)try{const e=Date.now();try{await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}else this._debug('#_autoRefreshTokenTick()','refresh already in flight, skipping');else try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}})}catch(e){if(!(e instanceof w.LockAcquireTimeoutError))throw e;this._debug('auto refresh token tick lock not available')}}async _handleVisibilityChange(){if(this._debug('#_handleVisibilityChange()'),!(0,_.isBrowser)()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug('#visibilityChangedCallback','error',e)}},null===window||void 0===window||window.addEventListener('visibilitychange',this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error('_handleVisibilityChange',e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;if(this._debug(t,'visibilityState',document.visibilityState),'visible'===document.visibilityState){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,null!=this.lock)await this._acquireLock(this.lockAcquireTimeout,async()=>{'visible'===document.visibilityState?await this._recoverAndRefresh():this._debug(t,'acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting')});else{if('visible'!==document.visibilityState)return void this._debug(t,'visibilityState is no longer visible, skipping recovery');await this._recoverAndRefresh()}}else'hidden'===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null==s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null==s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),'pkce'===this.flowType){const[e,t]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey),s=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(s.toString())}if(null==s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null==s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join('&')}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;return i?this._returnResult({data:null,error:i}):await(0,d._request)(this.fetch,'DELETE',`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)return this._returnResult({data:null,error:n});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},'phone'===e.factorType?{phone:e.phone}:'totp'===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors`,{body:a,headers:this.headers,jwt:null===(s=null==i?void 0:i.session)||void 0===s?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):('totp'===e.factorType&&'totp'===o.type&&(null===(r=null==o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=Object.assign({challenge_id:e.challengeId},'webauthn'in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:'create'===e.webauthn.type?(0,b.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,b.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/verify`,{body:n,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers('MFA_CHALLENGE_VERIFIED',a),this._returnResult({data:a,error:o}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challenge(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});if(n.error)return n;const{data:a}=n;if('webauthn'!==a.type)return{data:a,error:null};switch(a.webauthn.type){case'create':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case'request':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:s}=await this.getUser();if(s)return{data:null,error:s};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])r.all.push(s),'verified'===s.status&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,s,r,i;if(e)try{const{payload:r}=(0,_.decodeJWT)(e);let i=null;r.aal&&(i=r.aal);let n=i;const{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!==(s=null===(t=null==a?void 0:a.factors)||void 0===t?void 0:t.filter(e=>'verified'===e.status))&&void 0!==s?s:[]).length>0&&(n='aal2');return{data:{currentLevel:i,nextLevel:n,currentAuthenticationMethods:r.amr||[]},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}const{data:{session:n},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=(0,_.decodeJWT)(n.access_token);let l=null;o.aal&&(l=o.aal);let u=l;(null!==(i=null===(r=n.user.factors)||void 0===r?void 0:r.filter(e=>'verified'===e.status))&&void 0!==i?i:[]).length>0&&(u='aal2');return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?await(0,d._request)(this.fetch,'GET',`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'approve'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'deny'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;return s?this._returnResult({data:null,error:s}):t?await(0,d._request)(this.fetch,'GET',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?(await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let s=t.keys.find(t=>t.kid===e);if(s)return s;const r=Date.now();if(s=this.jwks.keys.find(t=>t.kid===e),s&&this.jwks_cached_at+h.JWKS_TTL>r)return s;const{data:i,error:n}=await(0,d._request)(this.fetch,'GET',`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(n)throw n;return i.keys&&0!==i.keys.length?(this.jwks=i,this.jwks_cached_at=r,s=i.keys.find(t=>t.kid===e),s||null):null}async getClaims(e,t={}){try{let s=e;if(!s){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}const{header:r,payload:i,signature:n,raw:{header:a,payload:o}}=(0,_.decodeJWT)(s);if(!(null==t?void 0:t.allowExpired))try{(0,_.validateExp)(i.exp)}catch(e){throw new c.AuthInvalidJwtError(e instanceof Error?e.message:'JWT validation failed')}const l=r.alg&&!r.alg.startsWith('HS')&&r.kid&&'crypto'in globalThis&&'subtle'in globalThis.crypto?await this.fetchJwk(r.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!l){const{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:i,header:r,signature:n},error:null}}const u=(0,_.getAlgorithm)(r.alg),h=await crypto.subtle.importKey('jwk',l,u,!0,['verify']);if(!await crypto.subtle.verify(u,h,n,(0,p.stringToUint8Array)(`${a}.${o}`)))throw new c.AuthInvalidJwtError('Invalid JWT signature');return{data:{claims:i,header:r,signature:n},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,s,r;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:i,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}});if(n||!i)return this._returnResult({data:null,error:n});const a=(0,b.deserializeCredentialRequestOptions)(i.options),o=null!==(r=null===(s=null==e?void 0:e.options)||void 0===s?void 0:s.signal)&&void 0!==r?r:b.webAuthnAbortService.createNewAbortSignal(),{data:l,error:u}=await(0,b.getCredential)({publicKey:a,signal:o});if(u||!l)return this._returnResult({data:null,error:null!=u?u:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const h=(0,b.serializeCredentialRequestResponse)(l);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,s;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const n=(0,b.deserializeCredentialCreationOptions)(r.options),a=null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.signal)&&void 0!==s?s:b.webAuthnAbortService.createNewAbortSignal(),{data:o,error:l}=await(0,b.createCredential)({publicKey:n,signal:a});if(l||!o)return this._returnResult({data:null,error:null!=l?l:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const u=(0,b.serializeCredentialCreationResponse)(o);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:s,error:r}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:s,error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:d._sessionResponse});return s?this._returnResult({data:null,error:s}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:t,error:null}))}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'GET',`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'PATCH',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:e.friendlyName}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{error:i}=await(0,d._request)(this.fetch,'DELETE',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}}R.nextInstanceID={};var A=R},1259,[1251,1253,1256,1252,1255,1260,1261,1262,1254,1257,1263,1264]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.memoryLocalStorageAdapter=function(t={}){return{getItem:o=>t[o]||null,setItem:(o,n)=>{t[o]=n},removeItem:o=>{delete t[o]}}}},1260,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"internals",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"LockAcquireTimeoutError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"ProcessLockAcquireTimeoutError",{enumerable:!0,get:function(){return s}}),_e.navigatorLock=async function(e,t,s){o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire lock',e,t);const c=new globalThis.AbortController;let l;t>0&&(l=setTimeout(()=>{c.abort(),o.debug&&console.log('@supabase/gotrue-js: navigatorLock acquire timed out',e)},t));await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:'exclusive',ifAvailable:!0}:{mode:'exclusive',signal:c.signal},async c=>{if(!c){if(0===t)throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: not immediately available',e),new n(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(o.debug)try{const e=await globalThis.navigator.locks.query();console.log('@supabase/gotrue-js: Navigator LockManager state',JSON.stringify(e,null,' '))}catch(e){console.warn('@supabase/gotrue-js: Error when querying Navigator LockManager state',e)}return console.warn('@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request'),clearTimeout(l),await s()}clearTimeout(l),o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquired',e,c.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released',e,c.name)}})}catch(u){if(t>0&&clearTimeout(l),null!==u&&'object'==typeof u&&'name'in u&&'AbortError'===u.name&&t>0){if(c.signal.aborted)return o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock',e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:'exclusive',steal:!0},async t=>{if(!t)return console.warn('@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true'),await s();o.debug&&console.log('@supabase/gotrue-js: navigatorLock: recovered (stolen)',e,t.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released (stolen)',e,t.name)}}));throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: lock was stolen by another request',e),new n(`Lock "${e}" was released because another request stole it`)}throw u}},_e.processLock=async function(e,o,n){var l;const u=null!==(l=c[e])&&void 0!==l?l:Promise.resolve(),b=(async()=>{try{return await u,null}catch(e){return null}})(),k=(async()=>{let c=null;try{const t=o>=0?new Promise((t,n)=>{c=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${e}" acquisition timed out after ${o}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),n(new s(`Acquiring process lock with name "${e}" timed out`))},o)}):null;await Promise.race([b,t].filter(e=>e)),null!==c&&clearTimeout(c)}catch(e){if(null!==c&&clearTimeout(c),e instanceof t)throw e}return await n()})();return c[e]=(async()=>{try{return await k}catch(e){if(e instanceof t){try{await u}catch(e){}return null}throw e}})(),await k};var e=r(d[0]);const o={debug:!!(globalThis&&(0,e.supportsLocalStorage)()&&globalThis.localStorage&&'true'===globalThis.localStorage.getItem('supabase.gotrue-js.locks.debug'))};class t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class n extends t{}class s extends t{}const c={}},1261,[1255]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.polyfillGlobalThis=function(){if('object'==typeof globalThis)return;try{Object.defineProperty(Object.prototype,'__magic__',{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){'undefined'!=typeof self&&(self.globalThis=self)}}},1262,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}Object.defineProperty(e,'__esModule',{value:!0}),e.getAddress=t,e.fromHex=function(t){return parseInt(t,16)},e.toHex=function(t){const n=(new TextEncoder).encode(t);return'0x'+Array.from(n,t=>t.toString(16).padStart(2,'0')).join('')},e.createSiweMessage=function(n){var s;const{chainId:o,domain:u,expirationTime:c,issuedAt:l=new Date,nonce:f,notBefore:I,requestId:v,resources:h,scheme:$,uri:w,version:E}=n;if(!Number.isInteger(o))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${o}`);if(!u)throw new Error("@supabase/auth-js: Invalid SIWE message field \"domain\". Domain must be provided.");if(f&&f.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${f}`);if(!w)throw new Error("@supabase/auth-js: Invalid SIWE message field \"uri\". URI must be provided.");if('1'!==E)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${E}`);if(null===(s=n.statement)||void 0===s?void 0:s.includes('\n'))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`);const S=t(n.address),b=$?`${$}://${u}`:u,p=n.statement?`${n.statement}\n`:'',j=`${b} wants you to sign in with your Ethereum account:\n${S}\n\n${p}`;let x=`URI: ${w}\nVersion: ${E}\nChain ID: ${o}${f?`\nNonce: ${f}`:''}\nIssued At: ${l.toISOString()}`;c&&(x+=`\nExpiration Time: ${c.toISOString()}`);I&&(x+=`\nNot Before: ${I.toISOString()}`);v&&(x+=`\nRequest ID: ${v}`);if(h){let t='\nResources:';for(const n of h){if(!n||'string'!=typeof n)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${n}`);t+=`\n- ${n}`}x+=t}return`${j}\n${x}`}},1263,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return l.WebAuthnError}}),Object.defineProperty(e,"isWebAuthnError",{enumerable:!0,get:function(){return l.isWebAuthnError}}),Object.defineProperty(e,"identifyRegistrationError",{enumerable:!0,get:function(){return l.identifyRegistrationError}}),Object.defineProperty(e,"identifyAuthenticationError",{enumerable:!0,get:function(){return l.identifyAuthenticationError}}),Object.defineProperty(e,"WebAuthnAbortService",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"webAuthnAbortService",{enumerable:!0,get:function(){return u}}),e.deserializeCredentialCreationOptions=function(i){if(!i)throw new Error('Credential creation options are required');if('undefined'!=typeof PublicKeyCredential&&'parseCreationOptionsFromJSON'in PublicKeyCredential&&'function'==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:o,user:l,excludeCredentials:s}=i,u=(0,t.__rest)(i,["challenge","user","excludeCredentials"]),c=(0,n.base64UrlToUint8Array)(o).buffer,f=Object.assign(Object.assign({},l),{id:(0,n.base64UrlToUint8Array)(l.id).buffer}),h=Object.assign(Object.assign({},u),{challenge:c,user:f});if(s&&s.length>0){h.excludeCredentials=new Array(s.length);for(let t=0;t0){c.allowCredentials=new Array(l.length);for(let t=0;tnull!==t&&'object'==typeof t&&!Array.isArray(t),i=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),o={};for(const l of t)if(l)for(const t in l){const s=l[t];if(void 0!==s)if(Array.isArray(s))o[t]=s;else if(i(s))o[t]=s;else if(n(s)){const i=o[t];n(i)?o[t]=p(i,s):o[t]=p(s)}else o[t]=s}return o}function w(t,n){return p(b,t,n||{})}function A(t,n){return p(y,t,n||{})}class O{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:'webauthn'}))}async _challenge({factorId:t,webauthn:n,friendlyName:o,signal:l},s){var c;try{const{data:i,error:b}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!i)return{data:null,error:b};const y=null!=l?l:u.createNewAbortSignal();if('create'===i.webauthn.type){const{user:t}=i.webauthn.credential_options.publicKey;if(!t.name){const n=o;if(n)t.name=`${t.id}:${n}`;else{const n=(await this.client.getUser()).data.user,i=(null===(c=null==n?void 0:n.user_metadata)||void 0===c?void 0:c.name)||(null==n?void 0:n.email)||(null==n?void 0:n.id)||'User';t.name=`${t.id}:${i}`}}t.displayName||(t.displayName=t.name)}switch(i.webauthn.type){case'create':{const n=w(i.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:o,error:l}=await f({publicKey:n,signal:y});return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}case'request':{const n=A(i.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:o,error:l}=await h(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:n,signal:y}));return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in challenge',t)}}}async _verify({challengeId:t,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:i})}async _authenticate({factorId:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn authentication')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:o},signal:l},{request:s});if(!u)return{data:null,error:f};const{webauthn:h}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:o,credential_response:h.credential_response}})}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in authenticate',t)}}}async _register({friendlyName:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn registration')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(n=>{var i;return null===(i=n.data)||void 0===i?void 0:i.all.find(n=>'webauthn'===n.factor_type&&n.friendly_name===t&&'unverified'!==n.status)}).then(t=>t?this.client.mfa.unenroll({factorId:null==t?void 0:t.id}):void 0),{data:null,error:f};const{data:h,error:b}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:o},signal:l},{create:s});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:o,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:b}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in register',t)}}}}},1264,[1229,1257,1256,1255,1265]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebAuthnUnknownError",{enumerable:!0,get:function(){return t}}),e.isWebAuthnError=function(n){return'object'==typeof n&&null!==n&&'__isWebAuthnError'in n},e.identifyRegistrationError=function({error:t,options:s}){var u,c,R;const{publicKey:E}=s;if(!E)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Registration ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else if('ConstraintError'===t.name){if(!0===(null===(u=E.authenticatorSelection)||void 0===u?void 0:u.requireResidentKey))return new o({message:'Discoverable credentials were required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',cause:t});if('conditional'===s.mediation&&'required'===(null===(c=E.authenticatorSelection)||void 0===c?void 0:c.userVerification))return new o({message:'User verification was required during automatic registration but it could not be performed',code:'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',cause:t});if('required'===(null===(R=E.authenticatorSelection)||void 0===R?void 0:R.userVerification))return new o({message:'User verification was required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',cause:t})}else{if('InvalidStateError'===t.name)return new o({message:'The authenticator was previously registered',code:'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',cause:t});if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('NotSupportedError'===t.name){return 0===E.pubKeyCredParams.filter(n=>'public-key'===n.type).length?new o({message:'No entry in pubKeyCredParams was of type "public-key"',code:'ERROR_MALFORMED_PUBKEYCREDPARAMS',cause:t}):new o({message:'No available authenticator supported any of the specified pubKeyCredParams algorithms',code:'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',cause:t})}if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(E.rp.id!==s)return new o({message:`The RP ID "${E.rp.id}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('TypeError'===t.name){if(E.user.id.byteLength<1||E.user.id.byteLength>64)return new o({message:'User ID was not between 1 and 64 characters',code:'ERROR_INVALID_USER_ID_LENGTH',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new credential',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})},e.identifyAuthenticationError=function({error:t,options:s}){const{publicKey:u}=s;if(!u)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Authentication ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else{if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(u.rpId!==s)return new o({message:`The RP ID "${u.rpId}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new assertion signature',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})};var n=r(d[0]);class o extends Error{constructor({message:n,code:o,cause:t,name:s}){var u;super(n,{cause:t}),this.__isWebAuthnError=!0,this.name=null!==(u=null!=s?s:t instanceof Error?t.name:void 0)&&void 0!==u?u:'Unknown Error',this.code=o}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class t extends o{constructor(n,o){super({code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:o,message:n}),this.name='WebAuthnUnknownError',this.originalError=o}}},1265,[1264]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1266,[1251]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1267,[1259]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.setSyncNamespace=function(e){s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:${e}:`:`cc-sync:${e}:`},Object.defineProperty(_e,"syncNamespace",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"kv",{enumerable:!0,get:function(){return i}}),_e.uuid=function(){const e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();const t=new Uint8Array(16);if(e?.getRandomValues)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,'0')).join('');return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`};var e,t=r(d[0]),n=r(d[1]),c=(e=n)&&e.__esModule?e:{default:e};let s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:`:'cc-sync:';const o=()=>s,i={async get(e,t){try{const n=await c.default.getItem(s+e);return null==n?t:JSON.parse(n)}catch{return t}},async set(e,t){try{await c.default.setItem(s+e,JSON.stringify(t))}catch{}},async remove(e){try{await c.default.removeItem(s+e)}catch{}}}},1268,[5,1190]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UK14",{enumerable:!0,get:function(){return t}}),e.cardAllergenMap=n,e.applyServerCard=function(t,s){const i=s.updated_at?new Date(String(s.updated_at)).toISOString():t.updatedAt,o=s.doc?.item?.allergenNotes;return{...t,allergens:n(s.allergens,s.may_contain),allergenNotes:'string'==typeof o&&o?o:void 0,dish:'string'==typeof s.dish&&s.dish?s.dish:t.dish,section:'string'==typeof s.section&&s.section?s.section:t.section,price:'number'==typeof s.price_pence?s.price_pence:t.price,signOff:t.signOff??{by:'Head chef',at:i}}},e.serverItem=function(t,s){const i=t.doc?.item;return i&&i.id?{...i,restaurantId:s,allergens:n(t.allergens,t.may_contain)}:null},Object.defineProperty(e,"noAllergenWords",{enumerable:!0,get:function(){return s}});const t=['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'];function n(n,s){const i=n=>Array.isArray(n)?n.map(String).filter(n=>t.includes(n)):[],o={};for(const t of i(s))o[t]='may';for(const t of i(n))o[t]='contains';return o}const s=t=>t?'No listed allergens':'Allergens not confirmed yet: ask staff'},1269,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isKitchenTeam",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canEditKitchenRota",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"kitchenTeam",{enumerable:!0,get:function(){return c}}),e.kitchenPending=function(t,n,c,s){return t.filter(t=>n.has(t.staffId)&&!!t.date&&t.date>=c&&t.date<=s&&(!t.published||t.changed))},e.publishKitchen=function(t,n,c,s){let u=0;return{shifts:t.map(t=>!n.has(t.staffId)||!t.date||t.dates||t.published&&!t.changed?t:(u++,{...t,published:!0,changed:!1})),n:u}},Object.defineProperty(e,"clashes",{enumerable:!0,get:function(){return s}});const t=t=>'kitchen'===String(t.dept??'').trim().toLowerCase()&&'owner'!==t.role&&'manager'!==t.role&&!t.managerAccess&&!t.ownerAccess,n=t=>t.includes('*')||t.includes('rota.kitchen')||t.includes('rota.manage'),c=n=>n.filter(n=>!1!==n.active&&t(n));const s=(t,n,c,s,u,o)=>t.some(t=>t.staffId===n&&t.date===c&&t.id!==o&&t.startt.category===n&&t.menuPrice&&t.id!==r).map(t=>t.menuPrice);return i.length?{avg:Math.round(i.reduce((t,n)=>t+n,0)/i.length),count:i.length}:null},Object.defineProperty(e,"GRAMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"PACK_UNITS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"unitName",{enumerable:!0,get:function(){return u}}),e.convert=function(t,n,r){const i=a[n],o=a[r];return i&&o&&i.dim===o.dim?t*i.f/o.f:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"perServing",{enumerable:!0,get:function(){return f}}),e.perBaseUnit=d,Object.defineProperty(e,"servingWord",{enumerable:!0,get:function(){return p}}),e.lineCost=g,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return m}}),e.suggestAllergens=function t(n,r,i=[],o=0){const c=new Set;for(const a of n.lines)if(a.ingId.startsWith('dish:')){const n=i.find(t=>t.id===a.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>c.add(t)),t(n,r,i,o+1).forEach(t=>c.add(t)))}else r.find(t=>t.id===a.ingId)?.allergens?.forEach(t=>c.add(t));return[...c]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return h}}),e.gpOf=P,e.toPricePoint=b,e.suggestPrice=y,Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return O}}),e.multipleOf=function(t,n,r,i="inc"){return t<=0?0:('inc'===i?n:h(n,r))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return x}}),e.suggestForMultiple=function(t,n,r,i,o){const c=t*Math.max(0,n)*('ex'===i?1+r/100:1);return o?b(Math.ceil(c)):Math.ceil(c)},e.amountLabel=S,e.cardCostSummary=function(t,n,r,i){const o=(t?.lines??[]).map(t=>{const r=n.find(n=>n.id===t.ingId);return{line:t,name:r?.name??'Removed ingredient',cost:g(t,n),label:S(t,r)}}),c=o.reduce((t,n)=>t+n.cost,0),a=Math.max(1,t?.portions||1),s=c/a,u=t?.target??r.defaultTarget??70,l=s>0?y(s,u,r.vatPct,r.pricePoints):null,f=t?.menuPrice&&t.menuPrice>0?t.menuPrice:null,d=f??(i&&i>0?i:l),p=d&&s>0?P(s,d,r.vatPct):null;return{lines:o,batch:c,perPortion:s,target:u,suggested:l,price:d,priceIsSuggested:!(f||i&&i>0),gp:p?p.gpPct:null,cashGp:p?p.cashGp:null,foodCostPct:p?p.foodCostPct:null,tone:p?v(p.gpPct,u):null,missing:o.filter(t=>t.cost<=0).length}},Object.defineProperty(e,"foodCostTargetOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"targetGpForFoodCost",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"foodCostTone",{enumerable:!0,get:function(){return C}}),e.lineRates=function(t,n,r){const i=Math.max(1,n||1),o=r?d(r):null;return{perPortion:t/i,perKilo:o?o.pence:null,per:o?o.per:null}},e.lineRatesText=function(t){return`${M(t.perPortion)} a portion${null!=t.perKilo?` \xb7 ${M(t.perKilo)} a ${'item'===t.per?'item':t.per}`:''}`},e.vatAwareGp=function(t,n,r){const i=P(t,n,r),o=n>0?(n-t)/n*100:0;return{...i,vatPence:n-i.ex,naiveGpPct:o}},e.menuOverview=function(t){return[...t].sort((t,n)=>(null==t.gp?1:0)-(null==n.gp?1:0)||(t.gp??0)-(n.gp??0)||(n.foodCostPct??0)-(t.foodCostPct??0)||t.name.localeCompare(n.name))},e.marginDrops=function(t,n){const r=new Set,i=[];for(const o of[...t].filter(t=>t.gp&&t.date>=n).sort((t,n)=>(n.gp.at||n.date).localeCompare(t.gp.at||t.date)))for(const t of o.gp.dishes)null==t.before||null==t.after||r.has(t.id)||t.aftert.prices?.length?t.prices:[{p:t.packPrice,at:''}];function i(t,n=5){const i=r(t),o=i.slice(-Math.max(1,n)),c=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:i[i.length-1].p,avg:c,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const o=(t,n="latest",r=5)=>'average'===n?i(t,r).avg:i(t,r).latest;const c={g:1,kg:1e3,oz:28.349523125,lb:453.59237,stone:1e3*t.KG_PER_STONE},a={kg:{dim:'mass',f:c.kg},g:{dim:'mass',f:c.g},oz:{dim:'mass',f:c.oz},lb:{dim:'mass',f:c.lb},stone:{dim:'mass',f:c.stone},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},s=['kg','g','stone','lb','oz','L','ml','each'],u=(t,n=1)=>'L'===t?1===n?'litre':'litres':'stone'===t?'stone':'each'===t?'each':t;const l=(t,n)=>[...'mass'===a[t].dim?['g','kg','oz','lb']:'vol'===a[t].dim?['ml','L']:['each'],...n&&n>0?['serving']:[]],f=t=>t.servings&&t.servings>0?t.packPrice/t.servings:null;function d(t){const n=a[t.packUnit];if(!(n&&t.packSize>0))return null;const r=t.packSize*n.f;return'mass'===n.dim?{pence:t.packPrice/r*1e3,per:'kg'}:'vol'===n.dim?{pence:t.packPrice/r*1e3,per:'litre'}:{pence:t.packPrice/r,per:'item'}}const p=(t,n)=>{const r=(t?.servingName||'serving').trim().toLowerCase();return 1===n?r:/(s|sh|ch|x)$/.test(r)?`${r}es`:`${r}s`};function g(t,n,r=[],i=0){if(t.ingId.startsWith('dish:')){const o=r.find(n=>n.id===t.ingId.slice(5));return o&&i<4?m(o,n,r,i+1)*t.qty:0}const o=n.find(n=>n.id===t.ingId);if(!o||!o.packSize)return 0;if('serving'===t.unit){const n=f(o);return null==n?0:t.qty*n}const c=a[o.packUnit],s=a[t.unit];if(!s||c.dim!==s.dim)return 0;const u=o.packPrice/(o.packSize*c.f),l=Math.min(95,Math.max(0,t.wastePct??o.wastePct??0));return t.qty*s.f*u/(1-l/100)}const m=(t,n,r=[],i=0)=>t.lines.reduce((t,o)=>t+g(o,n,r,i),0)/Math.max(1,t.portions||1);const h=(t,n)=>t/(1+n/100);function P(t,n,r){const i=h(n,r);return{ex:i,gpPct:i>0?(i-t)/i*100:0,cashGp:i-t,foodCostPct:i>0?t/i*100:0}}function b(t){const n=Math.floor(t/100),r=t-100*n;return r<=50?100*n+50:r<=95?100*n+95:100*(n+1)+50}function y(t,n,r,i){const o=t/(1-Math.min(95,Math.max(0,n))/100)*(1+r/100);return i?b(Math.ceil(o)):Math.ceil(o)}const v=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',M=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,O=t=>`${t.toFixed(1)}%`;const x=t=>`${t.toFixed(1)}x`;function S(t,n){const r=Number.isInteger(t.qty)?String(t.qty):String(Math.round(1e3*t.qty)/1e3);return'serving'===t.unit?`${r} ${p(n,t.qty)}`:'each'===t.unit?`${r} ${1===t.qty?'item':'items'}`:`${r} ${u(t.unit,t.qty)}`}const k=t=>Math.round(10*(100-t))/10,j=t=>Math.round(10*(100-Math.min(60,Math.max(5,t))))/10,C=(t,n)=>t<=n+.05?'ok':t<=n+5?'amber':'red'},1271,[1086]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"piecesPerPack",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pieceName",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"lineTotal",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"deliveryTotal",{enumerable:!0,get:function(){return l}}),e.countPacks=a,Object.defineProperty(e,"countLineValue",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"countValue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"countUnitsFor",{enumerable:!0,get:function(){return p}}),e.applyDelivery=function(i,c,l,a,u=(new Date).toISOString(),o){let p=f(i,c.id,l,u,o);const v=`${c.date}T12:00:00.000Z`,h=c.lines.map(i=>{const o=i.name.trim();let f=p.find(n=>n.id===i.ingId)??p.find(n=>n.name.trim().toLowerCase()===o.toLowerCase());const h={p:Math.round(i.packPrice),at:v,src:c.id},k=t(i),b=k?{servings:Math.round(1e3*k)/1e3,servingName:s(i)}:{};if(!f){const n=a();return f={id:n,name:o,packSize:i.packSize,packUnit:i.packUnit,packPrice:h.p,wastePct:0,prices:[h],...b,...c.supplier.trim()?{supplier:c.supplier.trim()}:{},updatedAt:u},p=[...p,f],{...i,ingId:n,name:o,...k?{prevServings:null,prevServingName:null}:{}}}const P=d([...f.prices?.length?f.prices:[{p:f.packPrice,at:''}],h]).slice(-20),y=k?{prevServings:f.servings??null,prevServingName:f.servingName??null}:{},S={...f,packSize:i.packSize,packUnit:i.packUnit,prices:P,...b,...c.supplier.trim()?{supplier:c.supplier.trim()}:{},updatedAt:u};return S.packPrice=(0,n.costingPrice)(S,l.priceBasis,l.avgOf??5),p=p.map(n=>n.id===f.id?S:n),{...i,ingId:f.id,name:f.name,...y}});return{ingredients:p,lines:h}},e.removeDeliveryPrices=f,e.matchIngredient=function(n,t){const i=k(n);if(!i.length)return null;let s=null,c=0;for(const l of t){if(h(n)!==h(l.name))continue;const t=k(l.name),a=(n,t)=>n===t||Math.min(n.length,t.length)>=5&&(n.startsWith(t)||t.startsWith(n)),u=i.filter(n=>t.some(t=>a(n,t))).length,o=u?u/Math.max(i.length,t.length)+(l.name.trim().toLowerCase()===n.trim().toLowerCase()?1:0):0;o>c&&(c=o,s=l)}return c>=.5?s:null},e.cardUnit=b,e.suggestAmount=function(t,i,s){const c=(0,n.unitsFor)(s.packUnit,s.servings),l=Number(String(t).replace(',','.').trim()),a=b(i);if(Number.isFinite(l)&&l>0&&a){if('each'===a&&!c.includes('each')&&c.includes('serving'))return{qty:l,unit:'serving'};if(c.includes(a))return{qty:l,unit:a}}return{qty:0,unit:c[0]}};var n=r(_d[0]);const t=n=>n.count&&n.count>0&&n.packs>0?n.count/n.packs:null,i=n=>{const t=n.trim().toLowerCase();return t.length>3&&/ies$/.test(t)?`${t.slice(0,-3)}y`:t.length>3&&/(sh|ch|x)es$/.test(t)?t.slice(0,-2):t.length>3&&/s$/.test(t)&&!/ss$/.test(t)?t.slice(0,-1):t},s=n=>i(n.countName||'piece')||'piece',c=n=>Math.round((n.packs||0)*(n.packPrice||0)),l=n=>n.lines.reduce((n,t)=>n+c(t),0);function a(t){if(!(t.qty>=0))return null;if('pack'===t.unit)return t.qty;if('serving'===t.unit)return t.servings&&t.servings>0?t.qty/t.servings:null;const i=(0,n.convert)(t.qty,t.unit,t.packUnit);return null!=i&&t.packSize>0?i/t.packSize:null}const u=n=>{const t=a(n);return null==t?0:Math.round(t*n.packPrice)},o=n=>n.lines.reduce((n,t)=>n+u(t),0),p=t=>['pack',...(0,n.unitsFor)(t.packUnit,t.servings)],d=n=>[...n].sort((n,t)=>(n.at||'').localeCompare(t.at||''));function f(t,i,s,c=(new Date).toISOString(),l){return t.map(t=>{if(!t.prices?.some(n=>n.src===i))return t;const a=t.prices.filter(n=>n.src!==i),u=l?.lines.find(n=>n.ingId===t.id&&void 0!==n.prevServings),o=u?{servings:u.prevServings??void 0,servingName:u.prevServingName??void 0}:{},p={...t,...o,prices:a.length?a:[{p:t.packPrice,at:''}],updatedAt:c};return u&&null==u.prevServings&&(delete p.servings,delete p.servingName),p.packPrice=(0,n.costingPrice)(p,s.priceBasis,s.avgOf??5),p})}const v=n=>n.toLowerCase().replace(/\b(pea|bean|broccoli|radish|sunflower)\s*-?\s*(shoots?|sprouts?)\b/g,'$1$2'),h=n=>(v(n).match(/[a-z]*(shoot|sprout|cress)[a-z]*/g)||[]).map(n=>n.replace(/s$/,'')).sort().join(','),k=n=>v(n).replace(/\([^)]*\)/g,' ').replace(/[^a-z\s]/g,' ').split(/\s+/).filter(n=>n.length>2&&!['the','and','with','cooked','fresh','chopped','diced','sliced','cleaned','whole'].includes(n)).map(n=>n.replace(/(es|s)$/,''));function b(n){const t=n.trim().toLowerCase().replace(/\.$/,'');return['g','gram','grams','gr'].includes(t)?'g':['kg','kilo','kilos','kgs'].includes(t)?'kg':['ml','mls'].includes(t)?'ml':['l','litre','litres','liter','liters','ltr'].includes(t)?'L':['oz','ounce','ounces'].includes(t)?'oz':['lb','lbs','pound','pounds'].includes(t)?'lb':['','whole','each','single','singles','piece','pieces','slice','slices','sliced','portion','portions','wedge','wedges','x'].includes(t)?'each':null}},1272,[1271]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"normRead",{enumerable:!0,get:function(){return r}}),e.rememberedMatch=i,e.matchLine=function(t,r,a,s,c){const o=i(t,a,s,c);if(o)return{ing:o,how:'remembered'};const l=r.trim().toLowerCase(),u=c.find(t=>t.name.trim().toLowerCase()===l);if(u)return{ing:u,how:'exact'};const p=(0,n.matchIngredient)(r,c)??(0,n.matchIngredient)(t,c);return p?{ing:p,how:'close'}:{ing:null,how:'new'}},e.packUnitOf=s,e.lineFlags=function(t,n){const r=[];t.sure||r.push('Not sure it read this line right');t.item||r.push('Item name not read');t.packs&&t.packs>0||r.push('Quantity not read');t.packSize&&t.packSize>0&&s(t.packUnit)||r.push('Pack size not read');null==t.unitPrice&&r.push('Price not read');null!=t.unitPrice&&t.packs&&null!=t.lineTotal&&Math.abs(t.packs*t.unitPrice-t.lineTotal)>Math.max(2,.01*t.lineTotal)&&r.push('Quantity times price does not match the line total');'new'===n&&r.push('New item: not on your price list yet');'close'===n&&r.push('Matched to a similar name: check it is the same item');return r},e.costView=c,e.lineCostChange=function(r,a,i){const s=(0,n.piecesPerPack)(a),o=s?{servings:s,servingName:(a.countName||'piece').replace(/s$/i,'')}:{},l=r?{...r,packSize:a.packSize,packUnit:a.packUnit,...o,prices:[...r.prices?.length?r.prices:[{p:r.packPrice,at:''}],{p:a.packPrice,at:'z'}]}:{id:'',name:'',packSize:a.packSize,packUnit:a.packUnit,packPrice:a.packPrice,wastePct:0,...o};l.packPrice=r?(0,t.costingPrice)(l,i.priceBasis,i.avgOf??5):a.packPrice;const u=c(r),p=c(l),d=u?.base&&p?.base&&u.base.per===p.base.per&&u.base.pence>0?(p.base.pence-u.base.pence)/u.base.pence*100:null;return{before:u,after:p,changePct:d}},e.menuGp=o,Object.defineProperty(e,"NOTICEABLE_DROP",{enumerable:!0,get:function(){return l}}),e.gpImpact=function(t,r,a,i,s,c){const u=o(t,r,a,i),{ingredients:p}=(0,n.applyDelivery)(t,s,i,()=>`tmp-${Math.random()}`,void 0,c),d=o(p,r,a,i),m=d.dishes.map(t=>{const n=u.dishes.find(n=>n.id===t.id),r=n?.gp??t.gp,a=r-t.gp;return{id:t.id,name:t.name,before:r,after:t.gp,target:t.target,drop:a,flagged:a>=l||r>=t.target-.05&&t.gpMath.abs(t.before-t.after)>=.05).sort((t,n)=>n.drop-t.drop);return{snap:{at:`${s.date}T12:00:00.000Z`,before:u.menu,after:d.menu,dishes:d.dishes.map(t=>({id:t.id,name:t.name,before:u.dishes.find(n=>n.id===t.id)?.gp??null,after:t.gp}))},dishes:m,after:p}},Object.defineProperty(e,"RANGE_WEEKS",{enumerable:!0,get:function(){return u}}),e.mondayOf=m,e.gpHistory=function(t,n,r,a=d(new Date)){const i=[],s=m(a),[c,o,l]=s.split('-').map(Number);for(let t=u[r]-1;t>=0;t--)i.push(d(new Date(c,o-1,l-7*t)));const p=[...t].sort((t,n)=>t.date.localeCompare(n.date)||(t.createdAt??'').localeCompare(n.createdAt??'')),f={};let h=null;for(const t of p)t.datenull!=t.after).map(t=>[t.id,t.after]))});const b=[],k=[];for(const t of i){const r=d(new Date(Number(t.slice(0,4)),Number(t.slice(5,7))-1,Number(t.slice(8,10))+7)),a=p.filter(n=>n.date>=t&&n.datenull!=t.after).map(t=>[t.id,t.after]))},n.gp.dishes.forEach(t=>{f[t.id]=t.name}));const r=n.gp&&null!=n.gp.before&&null!=n.gp.after?n.gp.after-n.gp.before:null;(!n.gp||null==r||Math.abs(r)>=.05)&&k.push({week:t,date:n.date,id:n.id,supplier:n.supplier,change:r})}t!==s?b.push(h?{...h,week:t}:{week:t,menu:null,dishes:{}}):b.push({week:t,menu:n.menu,dishes:Object.fromEntries(n.dishes.map(t=>[t.id,t.gp]))})}return{points:b,markers:k,names:f}},Object.defineProperty(e,"RANGE_SAID",{enumerable:!0,get:function(){return f}}),e.gpSummary=function(t,n){const r=t.filter(t=>null!=t.menu);if(!r.length)return'No GP history yet. It starts with the first delivery that changes a cost.';const a=r[r.length-1].menu,i=t=>Math.abs(t)<.05?'steady':`${t>0?'up':'down'} ${Math.abs(t).toFixed(1)} points`,s=r.length>1?r[r.length-2].menu:null,c=r[0].menu;return null==s?`Menu GP now ${a.toFixed(1)} percent. Not enough history to compare yet.`:`Menu GP now ${a.toFixed(1)} percent, ${i(a-s)} on the week before, ${i(a-c)} over ${f[n]}.`};var t=_r(_d[0]),n=_r(_d[1]);const r=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,' ').replace(/\s+/g,' ').trim(),a=(t,n)=>r(t)===r(n)&&!!r(t);function i(t,n,i,s){const c=r(t);if(!c)return null;const o=(Array.isArray(i)?i:Object.values(i)).filter(t=>a(t.supplier,n)).sort((t,n)=>(n.updatedAt??n.createdAt).localeCompare(t.updatedAt??t.createdAt));for(const t of o)for(const n of t.lines)if(n.read&&r(n.read)===c){const t=s.find(t=>t.id===n.ingId);if(t)return t}return null}function s(n){const r=(n??'').trim().toLowerCase().replace(/\.$/,'');return r?['kg','kgs','kilo','kilos','kilogram','kilograms'].includes(r)?'kg':['g','gr','gram','grams','gm','gms'].includes(r)?'g':['l','lt','ltr','litre','litres','liter','liters'].includes(r)?'L':['ml','mls'].includes(r)?'ml':['lb','lbs','pound','pounds'].includes(r)?'lb':['oz','ounce','ounces'].includes(r)?'oz':['st','stone'].includes(r)?'stone':['each','ea','x','unit','units','pc','pcs','piece','pieces','item','items','case','cases','box','boxes','tray','trays','pack','packs','bottle','bottles','can','cans','tin','tins','jar','jars','tub','tubs','bag','bags','dozen','doz'].includes(r)?'each':t.PACK_UNITS.includes(r)?r:null:null}function c(n){if(!n)return null;const r=(0,t.perServing)(n);return{base:(0,t.perBaseUnit)(n),piece:null!=r?{pence:r,name:(n.servingName||'piece').toLowerCase()}:null}}function o(n,r,a,i){const s=a.map(a=>{const s=(0,t.cardCostSummary)(r[a.id],n,i,a.price);return{id:a.id,name:a.dish,gp:s.gp,target:s.target}}).filter(t=>null!=t.gp);return{menu:s.length?s.reduce((t,n)=>t+n.gp,0)/s.length:null,dishes:s}}const l=2;const u={'4w':4,'3m':13,'12m':52},p=t=>String(t).padStart(2,'0'),d=t=>`${t.getFullYear()}-${p(t.getMonth()+1)}-${p(t.getDate())}`;function m(t){const[n,r,a]=t.split('-').map(Number),i=new Date(n,r-1,a);return i.setDate(i.getDate()-(i.getDay()+6)%7),d(i)}const f={'4w':'4 weeks','3m':'3 months','12m':'12 months'}},1273,[1271,1272]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteFromLocation=function(n,t){const o=new URLSearchParams(n).get('invite');if(o)return o;const s=(t||'').match(/[#&]invite=([A-Za-z0-9_-]{10,})/);return s?s[1]:null},e.addressWithoutInvite=function(n){try{const t=new URL(n);t.searchParams.delete('invite');const o=t.hash.replace(/^#/,'').split('&').filter(n=>n&&!n.startsWith('invite=')&&!n.startsWith('ccchrome=')&&!n.startsWith('cckitchen=')).join('&');return t.hash=o?`#${o}`:'',t.toString()}catch{return n}},Object.defineProperty(e,"PHONE_LINKED_TEXT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isPhoneLinked",{enumerable:!0,get:function(){return t}}),e.inviteRefusal=function(t){return/already linked to another phone/i.test(t)?n:/update the app/i.test(t)?'Update the app: close it, then open your personal link again.':/already been used/i.test(t)?'This link has already been used on another device. Ask your manager for a new one.':/expired/i.test(t)?'This link has expired. Ask your manager for a new one.':/replaced|switched off|not valid|invalid|unknown invite/i.test(t)?'This link has been replaced or switched off. Ask your manager for a new one.':/personal app link is incomplete/i.test(t)?'Open the complete personal iPhone link your manager sent.':/no longer active/i.test(t)?'This person is no longer on the team. Ask your manager if this is wrong.':null},Object.defineProperty(e,"WIPE_PREFIXES",{enumerable:!0,get:function(){return o}}),e.keysToWipe=function(n){return n.filter(n=>o.some(t=>n.startsWith(t)))},e.handoverFromHash=function(n){const t=(n||'').match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|$)/);return t?t[1]:null};const n='This link is already linked to another phone. Ask a manager to reset it or send you a new link.',t=n=>!!n&&/already linked to another phone/i.test(n);const o=['covercharge-','cc-sync:','cc-','sb-']},1274,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.persistedSessionSlice=function(n,o){return n?{welcomed:o.welcomed}:{meId:o.meId,signedInAt:o.signedInAt,welcomed:o.welcomed}},e.migrateCarSession=function(n){return{meId:null,signedInAt:void 0,welcomed:(n&&'object'==typeof n?n:{}).welcomed??{}}},e.carResetsSessionOnLoad=function(n,o){return n&&!o}},1275,[]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hrRemote",{enumerable:!0,get:function(){return y}}),_e.exampleHr=f,_e.stripHrSamples=m,Object.defineProperty(_e,"useHr",{enumerable:!0,get:function(){return q}});var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),i=r(_d[4]),u=(e=i)&&e.__esModule?e:{default:e},d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const y={live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null},v=(e,t,s)=>(0,c.oneWayToken)(e,`shift:${t}:${s}`),p=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function f(e,t){const s=[];for(let n=14;n>=1;n--){const o=p(t,-n),i=4===n?2:4+7*n%4;for(let t=0;t!((0,s.isAnchorage)(e.venue)&&e.example)),questions:e.questions.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrq-ex-[123]$/.test(e.id))),shouts:e.shouts.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrs-ex-[123]$/.test(e.id)))}}const q=(0,d.create)()((0,l.persist)((e,t)=>({secret:(0,c.newSecret)(),answered:[],voted:{},checkins:[],questions:[],shouts:[],log:[],seeded:{},ensure:(s,i)=>{if(n.LIVE_VENUE_BUILD||o.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(s)||t().seeded[s]||y.live)return;const u=f(s,i);e(e=>({seeded:{...e.seeded,[s]:!0},checkins:[...e.checkins,...u.checkins],questions:[...e.questions,...u.questions],shouts:[...e.shouts,...u.shouts]}))},hasAnswered:(e,s)=>t().answered.includes(v(t().secret,e,s)),submit:s=>{const n=t(),o=v(n.secret,s.rid,s.shiftKey);if(n.answered.includes(o))return'already';const i=(0,c.checkInPayload)({venue:s.rid,day:s.day,token:o,morale:s.morale,staffing:s.staffing}),u=s.question?(0,c.cleanQuestion)(s.question):null,d=s.shoutTo?.trim().slice(0,80)||void 0,l=s.shoutBody?.trim().slice(0,280)||void 0;return e({answered:[...n.answered,o].slice(-300)}),y.live&&y.checkout?(y.checkout({rid:s.rid,shiftKey:'',day:i.day,morale:i.morale,staffing:i.staffing,question:u??void 0,kind:s.kind??'up',shoutTo:d,shoutBody:l,token:o}),'queued'):(e(e=>({checkins:[...e.checkins,{venue:i.venue,day:i.day,morale:i.morale,staffing:i.staffing}],questions:u?[...e.questions,{id:(0,h.uuid)(),venue:s.rid,body:u,kind:s.kind??'up',up:0,yes:0,no:0,hidden:!1,postedOn:s.day}]:e.questions,shouts:d?[...e.shouts,{id:(0,h.uuid)(),venue:s.rid,day:s.day,to:d,body:l}]:e.shouts})),'ok')},skip:(s,n)=>{const o=t(),i=v(o.secret,s,n);o.answered.includes(i)||e({answered:[...o.answered,i].slice(-300)})},post:(t,s,n,o)=>{const i=(0,c.cleanQuestion)(s);if(!i)return null;const u=(0,h.uuid)();return e(e=>({questions:[...e.questions,{id:u,venue:t,body:i,kind:n,up:0,yes:0,no:0,hidden:!1,postedOn:o}]})),y.live&&y.post&&y.post(t,u,i,n),u},vote:(s,n)=>{const o=t();if(o.voted[s])return!1;const i=o.questions.find(e=>e.id===s);if(!i||i.hidden)return!1;const u='up'===i.kind?1:n;return e({voted:{...o.voted,[s]:u},questions:o.questions.map(e=>e.id===s?(0,c.applyVote)(e,u):e)}),y.live&&y.vote&&y.vote(s,(0,c.oneWayToken)(o.secret,`vote:${s}`),u),!0},moderate:(s,n,o,i)=>{const u=t().questions.find(e=>e.id===s);u&&(e(e=>({questions:e.questions.map(e=>e.id===s?{...e,hidden:'hide'===n}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:n,reason:o.trim()||void 0,by:i,at:(new Date).toISOString()},...e.log].slice(0,500)})),y.live&&y.moderate&&y.moderate(s,n,o.trim()))},reply:(s,n,o)=>{const i=n.trim().slice(0,600),u=t().questions.find(e=>e.id===s);if(!u)return;const d=(new Date).toISOString();e(e=>({questions:e.questions.map(e=>e.id===s?{...e,reply:i||void 0,replyAt:i?d:void 0}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:'reply',by:o,at:d},...e.log].slice(0,500)})),y.live&&y.reply&&y.reply(s,i)},setRemoteBoard:(t,s)=>e(e=>({questions:[...e.questions.filter(e=>e.venue!==t),...s]})),upsertRemote:t=>e(e=>({questions:e.questions.some(e=>e.id===t.id)?e.questions.map(e=>e.id===t.id?t:e):[...e.questions,t]}))}),{name:'covercharge-hr-v1',version:3,storage:(0,l.createJSONStorage)(()=>u.default),migrate:async e=>n.LIVE_VENUE_BUILD&&e?(await(0,t.archiveChefCache)('hr',e),{...e,...m(e)}):e}))},1276,[1198,1085,842,5,1190,995,1191,1277,1099]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_ANSWERS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_WORDING",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_HR",{enumerable:!0,get:function(){return r}}),e.hrSettingsOf=function(t){const n=t??{},r=n.wording??{},s=Object.fromEntries(Object.entries(o).map(([t,n])=>[t,a(r[t],'intro'===t||'staffing'===t||'question'===t?160:60,n)]));return{on:!1!==n.on,askQuestion:!1!==n.askQuestion,askShout:!1!==n.askShout,board:!1!==n.board,wording:s}},Object.defineProperty(e,"MORALE_STEPS",{enumerable:!0,get:function(){return s}}),e.moraleWord=function(t,n=o){return t<=1?n.moraleLow:t>=5?n.moraleHigh:2===t?'Fairly low':3===t?'OK':'Good'},Object.defineProperty(e,"STAFF_STOPS",{enumerable:!0,get:function(){return u}}),e.snapStaffing=i,e.staffingWord=function(t,n=o){const r=i(t);return r<=12?n.staffLow:r<45?"A bit short":r<=55?n.staffMid:r<88?"A bit over":n.staffHigh},e.oneWayToken=function(n,o){return(0,t.sha256HexSync)(`cc-hr:${n}:${o}`).slice(0,40)},e.newSecret=function(){let t='';const n=globalThis.crypto;if(n?.getRandomValues){return n.getRandomValues(new Uint8Array(24)).forEach(n=>{t+=n.toString(16).padStart(2,'0')}),t}for(let n=0;n<48;n++)t+=Math.floor(16*Math.random()).toString(16);return t},e.checkInPayload=function(t){const n=Math.max(1,Math.min(5,Math.round(t.morale)));return{venue:t.venue,day:t.day,token:t.token,morale:n,staffing:null==t.staffing?null:i(t.staffing)}},e.dayResults=function(t,o=n){const r=new Map;for(const n of t){const t=r.get(n.day)??[];t.push(n),r.set(n.day,t)}const a=[];let s=0;for(const[t,n]of[...r.entries()].sort(([t],[n])=>t.localeCompare(n))){if(n.lengtht.staffing).filter(t=>null!=t);a.push({day:t,answers:n.length,morale:Math.round(n.reduce((t,n)=>t+n.morale,0)/n.length*10)/10,staffing:r.length?Math.round(r.reduce((t,n)=>t+n,0)/r.length):null,short:r.filter(t=>t<45).length,perfect:r.filter(t=>t>=45&&t<=55).length,over:r.filter(t=>t>55).length})}return{shown:a,held:s}},Object.defineProperty(e,"QUESTION_MAX",{enumerable:!0,get:function(){return f}}),e.cleanQuestion=function(t){const n=t.replace(/\s+/g,' ').trim().slice(0,f);return n.length>=3?n:null},e.boardOrder=function(t,n){const o=t=>'up'===t.kind?t.up:t.yes+t.no;return t.filter(t=>n||!t.hidden).sort((t,n)=>Number(t.hidden)-Number(n.hidden)||o(n)-o(t)||n.postedOn.localeCompare(t.postedOn)||t.id.localeCompare(n.id))},e.applyVote=function(t,n){return'up'===t.kind?{...t,up:t.up+1}:1===n?{...t,yes:t.yes+1}:{...t,no:t.no+1}};var t=_r(d[0]);const n=3,o={intro:'Before you go: 3 quick taps, about 15 seconds. Your name is never saved with your answers.',morale:'How was team morale today?',moraleLow:'Low',moraleHigh:'High',staffing:'Was there enough staff on today for the number of customers?',staffLow:'Not enough',staffMid:'Perfect',staffHigh:'Overstaffed',question:'Got a question you\u2019d like to post anonymously for the team to vote on?',shout:'Shout out a teammate?'},r={on:!0,askQuestion:!0,askShout:!0,board:!0,wording:o},a=(t,n,o)=>('string'==typeof t?t.trim().slice(0,n):'')||o;const s=[1,2,3,4,5];const u=[0,12.5,25,37.5,50,62.5,75,87.5,100].map(t=>Math.round(t));function i(t){const n=Math.max(0,Math.min(100,Number.isFinite(t)?t:50));return u.reduce((t,o)=>Math.abs(o-n)>>0;o.push(c>>>24&255,c>>>16&255,c>>>8&255,255&c,h>>>24&255,h>>>16&255,h>>>8&255,255&h);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64),f=(t,n)=>t>>>n|t<<32-n;for(let n=0;n>>3,e=f(u[t-2],17)^f(u[t-2],19)^u[t-2]>>>10;u[t]=u[t-16]+n+u[t-7]+e>>>0}let e=l[0],s=l[1],c=l[2],h=l[3],a=l[4],i=l[5],p=l[6],d=l[7];for(let n=0;n<64;n++){const o=d+(f(a,6)^f(a,11)^f(a,25))+(a&i^~a&p)+t[n]+u[n]>>>0,l=(f(e,2)^f(e,13)^f(e,22))+(e&s^e&c^s&c)>>>0;d=p,p=i,i=a,a=h+o>>>0,h=c,c=s,s=e,e=o+l>>>0}l[0]=l[0]+e>>>0,l[1]=l[1]+s>>>0,l[2]=l[2]+c>>>0,l[3]=l[3]+h>>>0,l[4]=l[4]+a>>>0,l[5]=l[5]+i>>>0,l[6]=l[6]+p>>>0,l[7]=l[7]+d>>>0}return Array.from(l).map(t=>t.toString(16).padStart(8,'0')).join('')};const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t){const n=[];for(let e=0;e=55296&&o<=56319&&e+1=56320&&n<=57343&&(o=65536+(o-55296<<10)+(n-56320),e++)}o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<65536?n.push(224|o>>12,128|o>>6&63,128|63&o):n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}return n}},1278,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isOnline",{enumerable:!0,get:function(){return t}}),_e.setOnline=o,_e.onConnectivity=function(e){return n.add(e),()=>{n.delete(e)}},_e.isNetworkError=function(e){if(!e)return!1;const n=String(e.message??e).toLowerCase();return 0===e.status||/network|fetch failed|failed to fetch|timeout|timed out|offline|econn|enotfound|socket/.test(n)};let e=!0;const n=new Set,t=()=>e;function o(t){t!==e&&(e=t,n.forEach(n=>n(e)))}const s=globalThis.window;s?.addEventListener&&('boolean'==typeof s.navigator?.onLine&&(e=s.navigator.onLine),s.addEventListener('online',()=>o(!0)),s.addEventListener('offline',()=>o(!1)))},1279,[]); +__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'}},1280,[1279]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1281,[1282,1283,872,1268,1075]); +__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())}}}},1283,[1268]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.staffNickname=t,_e.staffDate=l,_e.staffSyncItem=c,_e.staffRevision=o,_e.staffEdited=function(e,n,t){return o(e,t)!==o(n,t)},_e.staffRow=function(e,t,l,o){const s=c(e,l),m={venue_id:t,external_ref:s.id,display_name:s.name||'Staff',job_title:s.job||null,department:s.dept||null,active:!1!==s.active};l.nickname&&(m.nickname=s.nickname??null);l.display&&(m.display_clock=!0===s.displayClock,m.temp=!0===s.temp,m.temp_until=s.temp?s.tempUntil??null:null);o&&n.test(o)&&!s.ownerAccess&&!s.managerAccess&&(m.role_id=o);return m};const e=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function t(e){if('string'!=typeof e)return null;return e.trim().slice(0,40)||null}function l(n){return'string'==typeof n&&e.test(n)?n:null}function c(e,n={nickname:!0,display:!0}){const c='owner'===e.role||'manager'===e.role||'staff'===e.role?e.role:'staff',o=!0===e.temp,s={id:e.id,name:(e.name??'').trim(),role:c,level:(e.level??'').trim(),job:(e.job??'').trim(),dept:(e.dept??'').trim(),active:!1!==e.active,managerAccess:!0===e.managerAccess,ownerAccess:!0===e.ownerAccess};return'boolean'==typeof e.bookingWrite&&(s.bookingWrite=e.bookingWrite),n.nickname&&(s.nickname=t(e.nickname)),n.display&&(s.displayClock=!0===e.displayClock,s.temp=o,s.tempUntil=o?l(e.tempUntil):null),s}function o(e,n={nickname:!0,display:!0}){const t=c(e,n);return JSON.stringify({name:t.name??'',job:t.job??'',dept:t.dept??'',active:!1!==t.active,...n.nickname?{nickname:t.nickname??null}:{},...n.display?{displayClock:!0===t.displayClock,temp:!0===t.temp,tempUntil:t.tempUntil??null}:{}})}},1284,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBookingSaves",{enumerable:!0,get:function(){return s}}),_e.notSavedWhat=u,Object.defineProperty(_e,"notSavedLine",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),n=r(d[1]),o=r(d[2]),l=(e=o)&&e.__esModule?e:{default:e};const s=(0,t.create)()((0,n.persist)((e,t)=>({count:()=>Object.keys(t().notSaved).length,notSaved:{},mark:t=>e(e=>({notSaved:{...e.notSaved,[t.id]:{...t,at:(new Date).toISOString()}}})),clear:t=>e(e=>{if(!e.notSaved[t])return e;const n={...e.notSaved};return delete n[t],{notSaved:n}}),clearAll:()=>e({notSaved:{}})}),{name:'covercharge-booking-saves-v1',storage:(0,n.createJSONStorage)(()=>l.default),version:1,partialize:e=>({notSaved:e.notSaved})})),c=e=>{const t=(e??'').split('+').map(e=>e.trim()).filter(Boolean);return t.length?`${t.length>1?'Tables':'Table'} ${t.join(' + ')}`:''};function u(e){const t=c(e.table);if(e.walkIn)return`Walk-in of ${e.partySize}${t?` on ${t}`:''}`;const n=(e.name||'Guest').trim();return t?`${t} for ${n}`:`Booking for ${n} at ${e.time}`}const v=e=>`${u(e)} did not save. Tap to try again.`},1285,[995,1191,1190]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useTempSaves",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"tempKey",{enumerable:!0,get:function(){return l}}),_e.tempNotSavedLine=function(e,t){const n=[];e&&n.push(1===e?'1 temperature reading':`${e} temperature readings`);t.length&&n.push(1===t.length?`the change to ${t[0]}`:`${t.length} unit changes`);const o=n.join(' and ');return`${o.charAt(0).toUpperCase()}${o.slice(1)} did not save. Tap to try again.`},_e.tempWaitingLine=function(e){return`${1===e?'1 temperature reading is':`${e} temperature readings are`} waiting to send. ${1===e?'It sends':'They send'} by itself when the connection is back.`.replace('They send by itself','They send by themselves')};var e,t=r(d[0]),n=r(d[1]),o=r(d[2]),s=(e=o)&&e.__esModule?e:{default:e};const c=(e,t)=>`${e}:${t}`,u=(0,t.create)()((0,n.persist)((e,t)=>({notSaved:{},count:()=>Object.keys(t().notSaved).length,mark:t=>e(e=>({notSaved:{...e.notSaved,[c(t.table,t.id)]:{...t,at:(new Date).toISOString()}}})),clear:t=>e(e=>{if(!e.notSaved[t])return e;const n={...e.notSaved};return delete n[t],{notSaved:n}})}),{name:'covercharge-temp-saves-v1',storage:(0,n.createJSONStorage)(()=>s.default),version:1,partialize:e=>({notSaved:e.notSaved})})),l=c},1286,[995,1191,1190]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.pointFromRow=i,_e.pointToRow=n,_e.readingFromRow=r,_e.readingToRow=o,Object.defineProperty(_e,"sameReading",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"readingRev",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"pointRev",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"TEMP_WINDOW_DAYS",{enumerable:!0,get:function(){return l}}),_e.tempUnitsSpec=function(e,t){return{name:'temp_units',table:'temp_units',conflict:'venue_id,id',deletes:!1,list:()=>e.getState().points??[],key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>/^[A-Za-z0-9_.:-]{1,64}$/.test(e.id),writable:t,matchKey:e=>({id:e}),revision:s,knownByRevision:!0,filter:e=>e.order('sort',{ascending:!0}),toRow:(t,i)=>n(t,i,10*Math.max(0,(e.getState().points??[]).findIndex(e=>e.id===t.id))),fromRow:e=>i(e),apply:t=>e.setState(e=>{const i=new Map(t.map(e=>[e.id,e])),n=(e.points??[]).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{points:[...n,...t.filter(e=>!r.has(e.id))]}}),afterRead:t=>{const i=new Map(t.map((e,t)=>[String(e.id),Number(e.sort??t)]));e.setState(e=>{const t=e.points??[],n=[...t.filter(e=>i.has(e.id)).sort((e,t)=>i.get(e.id)-i.get(t.id)),...t.filter(e=>!i.has(e.id))];return n.every((e,i)=>e===t[i])?e:{points:n}})},subscribe:t=>e.subscribe((e,i)=>{e.points!==i.points&&t()})}},_e.tempReadingsSpec=function(e,t){const i=()=>new Date(Date.now()-6912e7).toISOString();return{name:'temp_readings',table:'temp_readings',mode:'insert',conflict:'venue_id,id',deletes:!1,protect:!0,list:()=>e.getState().entries??[],key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>/^[A-Za-z0-9_.:-]{1,64}$/.test(e.id)&&!!e.pointId&&!!e.at,writable:t,matchKey:e=>({id:e}),revision:c,knownByRevision:!0,filter:e=>e.gte('taken_at',i()),inWindow:e=>e.at>=i(),toRow:(e,t)=>o(e,t),fromRow:e=>r(e),supersededBy:(e,t)=>t.some(t=>t.id!==e.id&&a(t,e)),apply:(t,i)=>e.setState(e=>{const n=new Map(t.map(e=>[e.id,e])),r=new Set(i),o=e.entries??[],c=o.filter(e=>n.has(e.id)||!t.some(t=>t.id!==e.id&&a(t,e))).filter(e=>!r.has(e.id)||!o.some(t=>t.id!==e.id&&!r.has(t.id)&&a(t,e))).map(e=>{const t=n.get(e.id);return t?e.photo?{...t,photo:e.photo}:t:e}),s=new Set(c.map(e=>e.id));return{entries:[...t.filter(e=>!s.has(e.id)),...c].sort((e,t)=>t.at.localeCompare(e.at))}}),subscribe:t=>e.subscribe((e,i)=>{e.entries!==i.entries&&t()})}};var e=_r(d[0]);const t=e=>null==e||''===e?void 0:Number(e);function i(e){const i={id:String(e.id),name:String(e.name),kind:e.kind,due:Array.isArray(e.due)?e.due.map(String):[],aliases:Array.isArray(e.aliases)?e.aliases.map(String):[]},n=t(e.min_c),r=t(e.max_c);return void 0!==n&&(i.min=n),void 0!==r&&(i.max=r),e.section&&(i.section=e.section),e.location&&(i.location=String(e.location)),e.archived&&(i.archived=!0),i}function n(e,t,i){return{venue_id:t,id:e.id,name:e.name.slice(0,80),kind:e.kind,location:e.location?.trim()||null,min_c:e.min??null,max_c:e.max??null,due:e.due??[],aliases:e.aliases??[],section:e.section??null,archived:!!e.archived,sort:i}}function r(e){const i={id:String(e.id),pointId:String(e.point_id),name:String(e.point_name),kind:e.kind,at:new Date(e.taken_at).toISOString(),by:String(e.by_name??''),byId:String(e.by_ref??''),app:e.app??'chef',ok:!!e.ok,source:e.source??'typed'},n=t(e.value);void 0!==n&&(i.value=n),null!==e.done&&void 0!==e.done&&(i.done=!!e.done),e.corrective&&(i.corrective=String(e.corrective)),e.note&&(i.note=String(e.note)),e.initials&&(i.initials=String(e.initials)),e.probe_id&&(i.probeId=String(e.probe_id)),e.archived&&(i.archived=!0);const r=t(e.corrected_value);return void 0!==r&&(i.correctedValue=r),e.correction_note&&(i.correctionNote=String(e.correction_note)),e.corrected_by&&(i.correctedBy=String(e.corrected_by)),i}function o(e,t){return{venue_id:t,id:e.id,point_id:e.pointId,point_name:(e.name||'Check').slice(0,200),kind:e.kind,taken_at:e.at,value:e.value??null,done:e.done??null,ok:!!e.ok,by_name:(e.by??'').slice(0,120),by_ref:e.byId||null,app:e.app??null,source:e.source??null,corrective:e.corrective?.slice(0,1e3)||null,note:e.note?.slice(0,1e3)||null,initials:e.initials||null,probe_id:e.probeId||null}}const a=(e,t)=>e.pointId===t.pointId&&e.at===t.at&&(e.value??null)===(t.value??null)&&(e.done??null)===(t.done??null),c=t=>(0,e.hashOf)(r({...o(t,''),archived:t.archived??!1,corrected_value:t.correctedValue??null,correction_note:t.correctionNote??null,corrected_by:t.correctedBy??null})),s=t=>(0,e.hashOf)(i(n(t,'',0))),l=800},1287,[1166]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.mirrorRecords=o,_e.csToRow=i,_e.csFromRow=r,Object.defineProperty(_e,"csRev",{enumerable:!0,get:function(){return c}}),_e.applyRecords=s,_e.cooksafeSpec=function(t,n,d,a){return{name:'cooksafe_records',table:'cooksafe_records',conflict:'venue_id,id',deletes:!1,protect:!0,list:()=>o(t.getState(),n.getState().records??[],d),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,e.csIdOk)(t.id)&&e.CS_KINDS.includes(t.kind)&&!!t.at,writable:a,matchKey:e=>({id:e}),revision:c,knownByRevision:!0,toRow:(e,t)=>i(e,t),fromRow:e=>r(e),apply:e=>s(e,t,n),subscribe:e=>{const d=t.subscribe((t,n)=>{t.diary===n.diary&&t.daySigns===n.daySigns&&t.weekly===n.weekly&&t.inspectorSends===n.inspectorSends&&t.accidents===n.accidents&&t.entries===n.entries||e()}),o=n.subscribe((t,n)=>{t.records!==n.records&&e()});return()=>{d(),o()}}}};var e=_r(_d[0]),t=_r(_d[1]);const n=e=>`photo-${e}`.slice(0,64),d=e=>JSON.parse(JSON.stringify(e));function o(e,t,o){const i=[...t];for(const t of e.diary??[])i.push({id:t.id,kind:'diary',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.daySigns??[])i.push({id:`day-${t.date}`,kind:'daysign',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.weekly??[])i.push({id:`week-${t.week}`,kind:'weekly',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.inspectorSends??[])i.push({id:t.id,kind:'inspector',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.accidents??[])o(t)||i.push({id:t.id,kind:'accident',at:t.createdAt,by:t.reportedBy,byId:t.reportedById,doc:d(t)});for(const t of e.entries??[])t.photo&&i.push({id:n(t.id),kind:'photo',at:t.at,by:t.by,byId:t.byId,doc:{entryId:t.id,photo:t.photo}});return i}function i(e,t){return{venue_id:t,id:e.id,kind:e.kind,at:e.at,by_name:(e.by??'').slice(0,120),doc:{...e.doc,...e.byId?{_byId:e.byId}:{}},archived:!!e.archived}}function r(t){if(!e.CS_KINDS.includes(t.kind))return null;const n={...t.doc??{}},d=n._byId?String(n._byId):void 0;delete n._byId;const o={id:String(t.id),kind:t.kind,at:new Date(t.at).toISOString(),by:String(t.by_name??''),doc:n};return d&&(o.byId=d),t.archived&&(o.archived=!0),o}const c=e=>(0,t.hashOf)(r({...i(e,''),at:e.at}));function s(t,n,d){if(!t.length)return;const o=t.filter(t=>e.CS_OWN.includes(t.kind));o.length&&d.setState(e=>{const t=new Map(o.map(e=>[e.id,e])),n=e.records.map(e=>t.get(e.id)??e),d=new Set(n.map(e=>e.id));return{records:[...o.filter(e=>!d.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at))}});const i=e=>t.filter(t=>t.kind===e).map(e=>e.doc),r=(e,t,n,d=!0)=>{if(!t.length)return e??[];const o=new Map(t.map(e=>[n(e),e])),i=(e??[]).map(e=>o.get(n(e))??e),r=new Set(i.map(n)),c=[...t.filter(e=>!r.has(n(e))),...i];return d?c:c.reverse()},c=t.filter(e=>'photo'===e.kind);n.setState(e=>{const t={},n=i('diary');n.length&&(t.diary=r(e.diary,n,e=>e.id).sort((e,t)=>t.at.localeCompare(e.at)));const d=i('daysign');d.length&&(t.daySigns=r(e.daySigns,d,e=>e.date));const o=i('weekly');o.length&&(t.weekly=r(e.weekly,o,e=>e.week).sort((e,t)=>t.at.localeCompare(e.at)));const s=i('inspector');s.length&&(t.inspectorSends=r(e.inspectorSends,s,e=>e.id).sort((e,t)=>t.at.localeCompare(e.at)));const a=i('accident');if(a.length&&(t.accidents=r(e.accidents,a,e=>e.id).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))),c.length){const n=new Map(c.map(e=>[String(e.doc.entryId),String(e.doc.photo??'')]));let d=!1;const o=(e.entries??[]).map(e=>{const t=n.get(e.id);return t&&e.photo!==t?(d=!0,{...e,photo:t}):e});d&&(t.entries=o)}return t})}},1288,[1289,1166]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CS_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CS_PRIVATE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CS_OWN",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"csIdOk",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"csId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CS_SECTION_LABEL",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"REHEAT_MIN_C",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"reheatOk",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"ICE_RANGE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"BOIL_RANGE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"iceOk",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"boilOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"calibrationOk",{enumerable:!0,get:function(){return b}}),e.offsiteOk=function(t,n){return!!Number.isFinite(n)&&('chilled'===t?n<=8:'frozen'===t?n<=-15:n>=63)},e.deliveryOk=function(t,n){return'ambient'===t||!(null===n||!Number.isFinite(n))&&('chilled'===t?n<=8:n<=-15)},Object.defineProperty(e,"tempWords",{enumerable:!0,get:function(){return y}}),e.calibrationDue=function(t,n){const r=k(t,'calibration');return!r||n.getTime()-new Date(r).getTime()>26784e5},e.reviewDue=function(t,n){const r=k(t,'review');return!r||n.getTime()-new Date(r).getTime()>157248e5},Object.defineProperty(e,"REVIEW_QUESTIONS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"EXCLUSION_HOURS",{enumerable:!0,get:function(){return v}}),e.returnFrom=C,e.mayReturn=function(t,n){return!!t&&n.getTime()>=C(t).getTime()},Object.defineProperty(e,"HOUSE_RULES",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"FLOW_STEPS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"CLEANING_DEFAULT",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"FREQ_LABEL",{enumerable:!0,get:function(){return x}}),e.cleaningDue=function(t,n,r){const i=t=>{const n=new Date(t);return Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())},o=i(r.toISOString());return t.filter(t=>{const r=n.filter(n=>'cleaning'===n.kind&&!n.archived&&n.doc.taskId===t.id).map(t=>t.at).sort().pop();return!r||(o-i(r))/w>=P[t.freq]})},e.allergenMatrix=function(n){const r=n.filter(t=>!!t.signOff);return{rows:r.map(n=>({id:n.id,dish:n.dish,section:n.section??'',cells:t.ALLERGENS.map(t=>n.allergens?.[t.id]??'')})).sort((t,n)=>t.section.localeCompare(n.section)||t.dish.localeCompare(n.dish)),left:n.length-r.length}},Object.defineProperty(e,"MATRIX_HEAD",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"matrixCell",{enumerable:!0,get:function(){return D}}),e.matrixSpoken=function(n){const r=t.ALLERGENS.filter((t,r)=>'contains'===n.cells[r]).map(t=>t.short),i=t.ALLERGENS.filter((t,r)=>'may'===n.cells[r]).map(t=>t.short);return`${n.dish}: ${r.length?`contains ${r.join(', ')}`:'none of the 14 allergens'}${i.length?`; may contain ${i.join(', ')}`:''}.`},Object.defineProperty(e,"CS_KIND_LABEL",{enumerable:!0,get:function(){return A}}),e.recordSummary=_,e.csCsv=function(t){return['Date and time,Record,By,Details',...t.filter(t=>i.includes(t.kind)&&!t.archived).sort((t,n)=>t.at.localeCompare(n.at)).map(t=>[new Date(t.at).toLocaleString('en-GB'),A[t.kind],t.by,_(t)].map(N).join(','))].join('\n')};var t=_r(_d[0]);const n=['diary','daysign','weekly','inspector','accident','photo','reheat','calibration','review','offsite','delivery','training','exclusion','houserule','cleaning','pest','maintenance'],r=['accident','training','exclusion'],i=['reheat','calibration','review','offsite','delivery','training','exclusion','houserule','cleaning','pest','maintenance'],o=t=>/^[A-Za-z0-9_.:-]{1,64}$/.test(t);let a=0;const l=t=>`cs-${t.slice(0,6)}-${Date.now().toString(36)}${(a++).toString(36)}`,s={cross:'Cross-contamination & allergens',cleaning:'Cleaning',chilling:'Chilled storage & cooling',cooking:'Cooking, reheating & hot holding',management:'Management & records'},c=82,d=t=>Number.isFinite(t)&&t>=c,u=[-1,1],f=[99,101],h=t=>Number.isFinite(t)&&t>=u[0]&&t<=u[1],p=t=>Number.isFinite(t)&&t>=f[0]&&t<=f[1],b=(t,n)=>h(t)&&p(n);const y=t=>`${t<0?'minus ':''}${Math.abs(t)} degrees`,w=864e5,k=(t,n)=>t.filter(t=>t.kind===n&&!t.archived).map(t=>t.at).sort().pop()??null;const $=['New dishes, suppliers or equipment are covered by the CookSafe safe methods','Critical limits (cooking 75\xb0C, reheating 82\xb0C, chilling 8\xb0C or below, hot holding 63\xb0C or above) still right','Records were kept every day, with corrective actions written down','Every member of the team has training and induction records','House Rules read and still followed','Allergen information matches the signed-off recipe cards'],v=48;function C(t){return new Date(new Date(t).getTime()+1728e5)}const O=[{id:'hr-personal',title:'Personal hygiene',text:'Clean work clothes and aprons; hair tied back and covered; no jewellery except a plain band; cuts covered with a blue waterproof dressing; no smoking, eating or vaping in food areas.'},{id:'hr-fitness',title:'Fitness to work',text:'Anyone with sickness, diarrhoea, skin infections or infected cuts tells the person in charge before starting work. Food handlers with sickness or diarrhoea stay off until 48 hours after the symptoms stop.'},{id:'hr-hands',title:'Handwashing',text:'Wash hands with soap and warm water and dry with paper towels: before handling food, after raw food, after breaks, the toilet, bins, cleaning and touching face or phone.'},{id:'hr-cross',title:'Cross-contamination',text:'Raw and ready-to-eat food kept apart in storage, preparation and display; separate colour-coded boards, knives and equipment; raw meat on the bottom shelf; separate complex equipment for raw and ready-to-eat food.'},{id:'hr-allergens',title:'Allergen management',text:'Allergen information comes only from signed-off recipe cards; any change to a recipe or supplier is checked before serving; orders with an allergy are made separately with clean equipment.'},{id:'hr-cleaning',title:'Cleaning',text:'Clean as you go; follow the cleaning schedule; use the right chemical at the right dilution and contact time; food contact surfaces disinfected with a product meeting BS EN 1276 or 13697.'},{id:'hr-pests',title:'Pest control',text:'Doors and windows proofed or screened; food stored off the floor and covered; any sign of pests reported straight away and written in the pest control log.'},{id:'hr-maintenance',title:'Maintenance',text:'Equipment, fridges and the building kept in good repair; faults reported, written in the maintenance log and fixed before the equipment is used for food.'},{id:'hr-waste',title:'Waste management',text:'Bins lidded and emptied regularly; waste never left in food rooms overnight; outside bins kept closed and the area clean.'},{id:'hr-stock',title:'Stock control',text:'Deliveries checked and put away straight away; first in, first out; food labelled and dated; nothing used past its use-by date.'},{id:'hr-water',title:'Water supply',text:'Mains drinking water used for food, ice and cleaning; ice machines cleaned to the schedule.'},{id:'hr-physical',title:'Physical and chemical contamination',text:'No glass in food areas where avoidable; breakages cleared and recorded; chemicals stored away from food and clearly labelled.'},{id:'hr-training',title:'Training and supervision',text:'Every food handler has induction before starting and training for their job, recorded in the training records; the person in charge supervises and checks the daily records.'}],S=[{id:'purchase',title:'Purchase',limit:'Approved suppliers only'},{id:'delivery',title:'Delivery',limit:'Chilled 8\xb0C or below \xb7 Frozen \u221215\xb0C or below'},{id:'storage',title:'Storage',limit:'Fridges 5\xb0C or below (8\xb0C legal limit) \xb7 Freezers \u221218\xb0C or below'},{id:'prep',title:'Preparation',limit:'Raw and ready-to-eat kept apart \xb7 Allergens checked'},{id:'cooking',title:'Cooking',limit:'Core 75\xb0C or above'},{id:'cooling',title:'Cooling',limit:'Cooled within 90 minutes, then chilled'},{id:'reheating',title:'Reheating',limit:'Core 82\xb0C or above (Scotland)'},{id:'hothold',title:'Hot holding',limit:'63\xb0C or above'},{id:'service',title:'Service',limit:'Allergen information from signed-off cards'}],E=[{id:'cl-surfaces',task:'Work surfaces and chopping boards',freq:'daily'},{id:'cl-handbasins',task:'Hand-wash basins and taps',freq:'daily'},{id:'cl-floors',task:'Kitchen floors',freq:'daily'},{id:'cl-bins',task:'Bins emptied and cleaned',freq:'daily'},{id:'cl-handles',task:'Door, fridge and freezer handles',freq:'daily'},{id:'cl-fridges',task:'Inside fridges and seals',freq:'weekly'},{id:'cl-ovens',task:'Ovens, grill and fryer',freq:'weekly'},{id:'cl-filters',task:'Extraction canopy filters',freq:'weekly'},{id:'cl-freezers',task:'Freezers defrosted and cleaned',freq:'monthly'},{id:'cl-walls',task:'Walls, shelves and behind equipment',freq:'monthly'}],P={daily:1,weekly:7,monthly:31},x={daily:'Daily',weekly:'Weekly',monthly:'Monthly'};const j=['Dish',...t.ALLERGENS.map(t=>t.short)],D=t=>'contains'===t?'Yes':'may'===t?'May':'';const A={diary:'Diary',daysign:'Daily sign-off',weekly:'Weekly sign-off',inspector:'Sent to inspector',accident:'Accident book',photo:'Check photo',reheat:'Reheating',calibration:'Probe calibration',review:'Six-monthly review',offsite:'Off-site temperature',delivery:'Delivery',training:'Training',exclusion:'Exclusion / return to work',houserule:'House Rule',cleaning:'Cleaning',pest:'Pest control',maintenance:'Maintenance'},N=t=>`"${String(t??'').replace(/"/g,'""')}"`;function _(t){const n=t.doc;switch(t.kind){case'reheat':return`${n.food??''}: ${n.value}\xb0C${n.ok?'':' (below 82\xb0C)'}${n.action?`; action: ${n.action}`:''}`;case'calibration':return`${n.probe??'Probe'}: iced water ${n.ice}\xb0C, boiling ${n.boil}\xb0C${n.ok?'':' (out of range)'}${n.action?`; action: ${n.action}`:''}`;case'offsite':return`${n.food??''} at ${n.place??''}: ${n.value}\xb0C (${n.type})${n.ok?'':' (out of range)'}${n.action?`; action: ${n.action}`:''}`;case'delivery':return`${n.supplier??''}: ${n.items??''}${null!==n.value&&void 0!==n.value?`, ${n.value}\xb0C`:''} (${n.type})${!1===n.accepted?', rejected':''}${n.note?`; ${n.note}`:''}`;case'training':return`${n.person??''}: ${n.course??''}${n.expires?`, renew ${n.expires}`:''}`;case'exclusion':return`${n.person??''}: off from ${n.from??''}${n.stopped?`, symptoms stopped ${n.stopped}`:''}${n.returned?`, back ${n.returned}`:''}`;case'houserule':return`${n.title??''}: ${n.inPlace?'in place':'not ticked'}${n.text?` \u2014 ${n.text}`:''}`;case'cleaning':return`${n.task??''}${n.note?`; ${n.note}`:''}`;case'pest':case'maintenance':return`${n.what??''}${n.action?`; action: ${n.action}`:''}${n.contractor?` (${n.contractor})`:''}`;case'review':return`${n.answers?.filter(Boolean).length??0} of ${$.length} confirmed${n.note?`; ${n.note}`:''}`;default:return String(n.text??n.note??'')}}},1289,[819]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCookSafe",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"SCHEDULE_ID",{enumerable:!0,get:function(){return u}}),_e.scheduleOf=function(e){const r=e.find(e=>e.id===u),t=r?.doc.schedule;return Array.isArray(t)&&t.length?t:n.CLEANING_DEFAULT},Object.defineProperty(_e,"ruleRecordId",{enumerable:!0,get:function(){return l}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},c=_r(d[1]),o=_r(d[2]),n=_r(d[3]);const s=(0,c.create)()((0,o.persist)(e=>({records:[],add:(r,t,c,o,s)=>{const u={id:s??(0,n.csId)(r),kind:r,at:o??(new Date).toISOString(),by:c.by.replace(' (example)',''),byId:c.byId,doc:t};return e(e=>({records:[u,...e.records.filter(e=>e.id!==u.id)]})),u},update:(r,t)=>e(e=>({records:e.records.map(e=>e.id===r?{...e,doc:{...e.doc,...t}}:e)})),archive:r=>e(e=>({records:e.records.map(e=>e.id===r?{...e,archived:!0}:e)}))}),{name:'covercharge-cooksafe-v1',storage:(0,o.createJSONStorage)(()=>t.default),version:1})),u='cs-cleaning-schedule';const l=e=>`houserule-${e}`},1290,[1190,995,1191,1289]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEED_INGREDIENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SEED_RECIPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"WASTE_REASONS",{enumerable:!0,get:function(){return f}}),_e.stripKitchenExamples=S,Object.defineProperty(_e,"useKitchen",{enumerable:!0,get:function(){return w}});var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[6]),p=_r(_d[7]);const c=(e,t,s,i,n,r,o,d=[],l)=>({id:e,name:t,unit:s,cost:i,supplierId:n,par:r,onHand:o,allergens:d,prevCost:l}),u=[c('haddock','Haddock fillet','kg',1848,'sup-1',14,9.5,['fish'],1650),c('smk-haddock','Smoked haddock','kg',1500,'sup-1',4,3.2,['fish']),c('smk-salmon','Smoked salmon','kg',2800,'sup-1',3,1.1,['fish']),c('crab','White and brown crab meat','kg',3800,'sup-1',3,2.4,['crustaceans']),c('mussels','Rope mussels','kg',450,'sup-1',12,0,['molluscs']),c('langoustine','Langoustines','kg',2600,'sup-1',6,4.5,['crustaceans']),c('lobster','Lobster (whole)','each',1800,'sup-1',6,4,['crustaceans']),c('prawns','Prawns (cooked, peeled)','kg',1400,'sup-1',3,2.6,['crustaceans']),c('beef-fillet','Beef fillet','kg',4800,'sup-2',4,2.9),c('steak','Braising steak','kg',1200,'sup-2',8,6.2),c('patty','Burger patty 6 oz','each',160,'sup-2',40,18),c('chicken','Chicken breast','kg',950,'sup-2',10,7.5),c('chorizo','Chorizo','kg',1400,'sup-2',2,1.6,['sulphites']),c('haggis','Haggis','kg',900,'sup-2',4,3.5,['gluten','celery']),c('potatoes','Potatoes (chipping)','kg',90,'sup-3',75,40),c('onions','Onions','kg',110,'sup-3',15,11),c('leaves','Salad leaves','kg',700,'sup-3',3,.8),c('lemons','Lemons','each',25,'sup-3',60,44),c('milk','Whole milk','L',110,'sup-4',20,14,['milk']),c('cream','Double cream','L',380,'sup-4',12,9,['milk']),c('butter','Butter','kg',850,'sup-4',6,4.5,['milk']),c('cheddar','Mature cheddar','kg',900,'sup-4',5,3.8,['milk']),c('parmesan','Parmesan','kg',1800,'sup-4',2,1.4,['milk']),c('eggs','Free-range eggs','each',28,'sup-4',120,90,['eggs']),c('ice-cream','Vanilla ice cream','L',450,'sup-4',10,7,['milk','eggs']),c('flour','Plain flour','kg',90,'sup-5',16,12,['gluten']),c('batter','Beer batter mix','kg',220,'sup-5',12,3.5,['gluten']),c('pastry','Puff pastry','kg',450,'sup-5',6,4.2,['gluten','milk']),c('macaroni','Macaroni','kg',180,'sup-5',6,5,['gluten']),c('penne','Penne','kg',180,'sup-5',6,4.5,['gluten']),c('buns','Brioche buns','each',45,'sup-5',40,30,['gluten','eggs','milk','sesame']),c('baguette','Garlic baguette','each',90,'sup-5',24,16,['gluten','milk']),c('oil','Rapeseed oil (fryer)','L',200,'sup-5',60,32),c('sponge','Sticky toffee sponge (portion)','each',95,'sup-5',30,22,['gluten','eggs','milk']),c('truffle-oil','Truffle oil','L',3e3,'sup-5',1,.6)],k=(e,t,s)=>({dishId:e,yield:t,lines:s.map(([e,t])=>({ing:e,qty:t}))}),h=[k('a-fishsupper','1 portion (220 g fillet)',[['haddock',.22],['batter',.06],['potatoes',.35],['oil',.05],['lemons',1]]),k('a-skink','1 bowl',[['smk-haddock',.08],['potatoes',.1],['milk',.15],['cream',.05],['onions',.03],['butter',.01]]),k('a-salmon','1 plate',[['smk-salmon',.07],['cream',.03],['leaves',.02],['lemons',1]]),k('a-haggis','1 plate',[['haggis',.1],['flour',.02],['eggs',1],['oil',.03]]),k('a-crabcakes','2 cakes',[['crab',.08],['potatoes',.06],['flour',.02],['eggs',1],['leaves',.02]]),k('a-tempura','1 plate',[['haddock',.07],['prawns',.05],['onions',.05],['batter',.06],['oil',.04],['lemons',1]]),k('a-mini-fish-goujons','Fish Goujons & Chips',[['haddock',.1],['potatoes',.2],['batter',.03],['oil',.03]]),k('a-pie','1 pie',[['steak',.22],['pastry',.08],['onions',.05],['potatoes',.3],['oil',.03]]),k('a-chicken','1 plate',[['chicken',.22],['potatoes',.25],['cream',.05],['butter',.02]]),k('a-maccheese','1 bowl',[['macaroni',.12],['cheddar',.08],['milk',.2],['butter',.02],['flour',.015]]),k('a-penne','1 bowl',[['penne',.12],['chicken',.15],['chorizo',.04],['cream',.08],['parmesan',.01]]),k('a-caesar','1 plate',[['chicken',.16],['leaves',.08],['parmesan',.015],['eggs',1],['baguette',.25]]),k('a-moules','1 pot',[['mussels',.5],['cream',.08],['onions',.03],['baguette',.5]]),k('a-fillet','8 oz steak',[['beef-fillet',.227],['potatoes',.35],['onions',.05],['oil',.05],['butter',.02]]),k('a-claymore','1 burger',[['patty',1],['buns',1],['cheddar',.03],['potatoes',.3],['onions',.06],['batter',.03],['oil',.05]]),k('a-langoustines','1 plate',[['langoustine',.35],['butter',.03],['baguette',.5],['leaves',.03],['lemons',1]]),k('a-lobster','1 lobster',[['lobster',1],['butter',.04],['potatoes',.3],['oil',.04],['leaves',.03],['lemons',1]]),k('a-smorgasbord','Serves one',[['langoustine',.3],['mussels',.3],['crab',.08],['prawns',.1],['smk-salmon',.06],['leaves',.05],['lemons',2]]),k('a-deluxe','Serves two',[['lobster',1],['langoustine',.5],['crab',.15],['mussels',.5],['prawns',.15],['smk-salmon',.1],['leaves',.1],['lemons',3],['baguette',1]]),k('a-chips','1 side',[['potatoes',.35],['oil',.05]]),k('a-onionrings','1 side',[['onions',.15],['batter',.06],['oil',.04]]),k('a-garlicbread','1 side',[['baguette',.5],['butter',.02]]),k('a-truffle','1 side',[['potatoes',.35],['oil',.05],['parmesan',.015],['truffle-oil',.005]]),k('a-salad','1 side',[['leaves',.06],['lemons',.5]]),k('a-stp','1 portion',[['sponge',1],['cream',.05],['butter',.02],['ice-cream',.08]])],f=['Out of date','Spoiled','Over-production','Dropped / burnt','Returned by customer','Prep trim'],b=(e,t=10)=>{const s=new Date;return s.setDate(s.getDate()-e),s.setHours(t,0,0,0),s.toISOString()},y=e=>`${e}-${Math.random().toString(36).slice(2,8)}`;function v(){return{ingredients:u.map(e=>({...e})),recipes:h,targetGp:70,deliveries:[{id:'dl-today-fish',supplierId:'sup-1',due:'today',status:'expected',lines:[{ing:'haddock',ordered:10,received:8,price:1848},{ing:'mussels',ordered:12,received:12,price:450},{ing:'langoustine',ordered:3,received:3,price:2750},{ing:'smk-salmon',ordered:2,received:2,price:2800}]},{id:'dl-today-veg',supplierId:'sup-3',due:'today',status:'expected',lines:[{ing:'potatoes',ordered:50,received:50,price:90},{ing:'leaves',ordered:3,received:2,price:700},{ing:'lemons',ordered:30,received:30,price:25}]}],stockTakes:[{id:'stk-1',at:b(7,22),by:'Head Chef (example)',lines:[{ing:'haddock',expected:6,counted:5.4,cost:1650},{ing:'potatoes',expected:30,counted:28,cost:90},{ing:'cream',expected:8,counted:8,cost:380},{ing:'beef-fillet',expected:3.2,counted:3,cost:4800}]}],waste:[{id:'w1',at:b(1,21),by:'Head Chef (example)',item:'Haddock fillet',ing:'haddock',qty:.6,unit:'kg',reason:'Over-production',cost:1109},{id:'w2',at:b(2,15),by:'Head Chef (example)',item:'Salad leaves',ing:'leaves',qty:.5,unit:'kg',reason:'Spoiled',cost:350},{id:'w3',at:b(3,20),by:'Head Chef (example)',item:'Fish supper',qty:1,unit:'portion',reason:'Dropped / burnt',cost:517},{id:'w4',at:b(4,11),by:'Head Chef (example)',item:'Double cream',ing:'cream',qty:1,unit:'L',reason:'Out of date',cost:380},{id:'w5',at:b(5,22),by:'Head Chef (example)',item:'Chips',ing:'potatoes',qty:3,unit:'kg',reason:'Over-production',cost:270}],orders:[{id:'po-1',supplierId:'sup-1',at:b(1,13),by:'Head Chef (example)',status:'placed (by phone)',lines:[{ing:'haddock',qty:10,cost:1848},{ing:'mussels',qty:12,cost:450},{ing:'langoustine',qty:3,cost:2600},{ing:'smk-salmon',qty:2,cost:2800}],total:30520},{id:'po-2',supplierId:'sup-3',at:b(1,18),by:'Head Chef (example)',status:'placed (on website)',lines:[{ing:'potatoes',qty:50,cost:90},{ing:'leaves',qty:3,cost:700},{ing:'lemons',qty:30,cost:25}],total:7350}],prepTicks:{},temps:[{id:'t1',at:b(0,9),by:'Head Chef (example)',kind:'fridge',unit:'Walk-in fridge',temp:3},{id:'t2',at:b(0,9),by:'Head Chef (example)',kind:'freezer',unit:'Chest freezer',temp:-20}]}}function S(e){const t=v(),s=(e,t)=>t.some(t=>JSON.stringify(t)===JSON.stringify(e)),i=e.recipes.filter(e=>!s(e,t.recipes)),r=e.deliveries.filter(e=>!t.deliveries.some(t=>t.id===e.id&&t.supplierId===e.supplierId&&t.due===e.due&&'expected'===e.status&&!e.checkedBy&&!e.note&&JSON.stringify(t.lines)===JSON.stringify(e.lines))),o=e.stockTakes.filter(e=>!(0,n.demoActor)(e.by)),d=e.waste.filter(e=>!(0,n.demoActor)(e.by)),l=e.orders.filter(e=>!(0,n.demoActor)(e.by)),p=e.temps.filter(e=>!(0,n.demoActor)(e.by)),c=new Set([...i,...r,...o,...l].flatMap(e=>e.lines.map(e=>e.ing)));return d.forEach(e=>{e.ing&&c.add(e.ing)}),{ingredients:e.ingredients.filter(e=>c.has(e.id)||!s(e,t.ingredients)),recipes:i,deliveries:r,stockTakes:o,waste:d,orders:l,temps:p}}const w=(0,l.create)()((0,p.persist)(e=>({...r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v(),setTarget:t=>e({targetGp:Math.max(40,Math.min(90,Math.round(t)))}),setIngredient:(t,s)=>e(e=>({ingredients:e.ingredients.map(e=>e.id===t?{...e,...s}:e)})),setRecipeQty:(t,s,i)=>e(e=>({recipes:e.recipes.map(e=>e.dishId!==t?e:{...e,lines:i>0?e.lines.some(e=>e.ing===s)?e.lines.map(e=>e.ing===s?{...e,qty:i}:e):[...e.lines,{ing:s,qty:i}]:e.lines.filter(e=>e.ing!==s)})})),acceptDelivery:(t,i,n,o)=>e(e=>({deliveries:e.deliveries.map(e=>e.id===t?{...e,lines:i,status:'accepted',checkedBy:n,at:(new Date).toISOString(),note:o}:e),ingredients:e.ingredients.map(e=>{const t=i.find(t=>t.ing===e.id);return t?{...e,onHand:(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand+t.received:Math.round(100*(e.onHand+t.received))/100,...t.price!==e.cost?{prevCost:e.cost,cost:t.price}:{}}:e})})),saveStockTake:(t,s)=>e(e=>({stockTakes:[{id:y('stk'),at:(new Date).toISOString(),by:s,lines:Object.entries(t).map(([t,s])=>{const i=e.ingredients.find(e=>e.id===t);return{ing:t,expected:i.onHand,counted:s,cost:i.cost}})},...e.stockTakes],ingredients:e.ingredients.map(e=>e.id in t?{...e,onHand:t[e.id]}:e)})),addWaste:t=>e(e=>({waste:[{...t,id:y('w'),at:(new Date).toISOString()},...e.waste],ingredients:t.ing?e.ingredients.map(e=>e.id===t.ing?{...e,onHand:Math.max(0,(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand-t.qty:Math.round(100*(e.onHand-t.qty))/100)}:e):e.ingredients})),addOrder:t=>{const s=y('po');return e(e=>({orders:[{...t,id:s,at:(new Date).toISOString()},...e.orders]})),s},setOrderStatus:(t,s)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,status:s}:e)})),tickPrep:(t,s)=>e(e=>{const i={...e.prepTicks};return s?i[t]={by:s,at:(new Date).toISOString()}:delete i[t],{prepTicks:i}}),addTemp:t=>e(e=>({temps:[{...t,id:y('t'),at:(new Date).toISOString()},...e.temps]})),reset:()=>e(r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v())}),{name:'covercharge-kitchen-v1',version:3,storage:(0,p.createJSONStorage)(()=>d.default),migrate:async e=>{const s=e;return t.LIVE_VENUE_BUILD?(await(0,i.archiveChefCache)('kitchen',s),{...s,...S(s)}):s}}))},1291,[842,1086,1198,1085,5,1190,995,1191]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fixSupplierNames=function(b){return b?s.reduce((s,[b,n])=>s.replace(b,n),b):b};const s=[[/\bAl{2}sons?'?s?\b|\bAlson's\b/g,'Alsons'],[/\bSpe[zs] ?[Bb]ona\b|\bSpezbona\b/g,'Spes Bona'],[/\bReeds\b/gi,'Reids']]},1292,[]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_ORDER_LIST_SETTINGS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"UNITS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY_FULL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"normName",{enumerable:!0,get:function(){return a}}),e.findDuplicate=function(t,n,i,s){return t.find(t=>t.listId===n&&!t.removed&&'open'===t.status&&a(t.name)===a(i)&&u(t.unit)===u(s))},e.bumpQty=function(t,n,i,a,u){return{...t,qty:Math.round(100*(t.qty+n))/100,bumps:[...t.bumps??[],{by:i,name:a,qty:n,at:u}],updatedAt:u}},Object.defineProperty(e,"qtyText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"validQty",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"liveItems",{enumerable:!0,get:function(){return d}}),e.finishOrder=function(t,n,i,a,u,s){const o=d(n,t.id),l=o.filter(t=>'got'!==t.status),c={id:s(),listId:t.id,listName:t.name,finishedAt:u,finishedBy:a.id,finishedByName:a.name,items:o.map(t=>({name:t.name,qty:t.qty,unit:t.unit,note:t.note,status:t.status,addedByName:t.addedByName})),carried:i?l.length:0},p=i?l.map(t=>({...t,status:'open',carried:'missing'===t.status?'missing':'not-got',statusBy:void 0,statusAt:void 0,updatedAt:u})):[],m=new Set(p.map(t=>t.id));return{round:c,drop:o.filter(t=>!m.has(t.id)).map(t=>t.id),carriedOver:p}},e.nextTripDate=p,e.tripText=function(t,n,a){const u=p(t,n,a);if(!u)return'Running list';const[,s,o]=u.split('-').map(Number);return"Next trip "+(u===n?'today':u===l(n,1)?'tomorrow':`${i[c(u)]} ${o} ${['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][s-1]}`)},e.initials=function(t){const n=t.replace(/\(.*?\)/g,' ').split(/[^A-Za-z0-9]+/).filter(t=>t&&!['and','the','of','&'].includes(t.toLowerCase()));return n.length?(1===n.length?n[0].slice(0,2):n[0][0]+n[1][0]).toUpperCase():'?'},e.telHref=function(t){if(!t)return null;const n=t.trim().replace(/[^\d+]/g,'').replace(/(?!^)\+/g,'');return n.replace(/\D/g,'').length>=6?`tel:${n}`:null};const t={allowStaff:!0,defaultTripDay:5},n=['','cases','bottles','kegs','boxes','bags','packs','kg','litres','each'],i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],a=t=>t.trim().toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').replace(/s$/,''),u=t=>t.trim().toLowerCase().replace(/s$/,'');const s=t=>`${Number.isInteger(t.qty)?t.qty:t.qty.toFixed(2).replace(/0$/,'')}${t.unit?` ${t.unit}`:''}`,o=t=>Number.isFinite(t)&&t>0&&t<=9999,d=(t,n)=>t.filter(t=>t.listId===n&&!t.removed).sort((t,n)=>('open'===t.status?0:1)-('open'===n.status?0:1)||t.addedAt.localeCompare(n.addedAt));const l=(t,n)=>{const[i,a,u]=t.split('-').map(Number);return new Date(Date.UTC(i,a-1,u+n)).toISOString().slice(0,10)},c=t=>{const[n,i,a]=t.split('-').map(Number);return new Date(Date.UTC(n,i-1,a)).getUTCDay()};function p(n,i,a=t.defaultTripDay){if('trip'!==n.kind)return null;if(n.nextTrip&&n.nextTrip>=i)return n.nextTrip;const u=n.tripDay??a;return l(i,(u-c(i)+7)%7)}},1293,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useClockArea",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"areaOf",{enumerable:!0,get:function(){return _}});var e,t=r(d[0]),n=r(d[1]),s=r(d[2]),u=(e=s)&&e.__esModule?e:{default:e},c=r(d[3]),l=r(d[4]),E=r(d[5]);const o=(0,c.create)()((0,l.persist)(e=>({areas:(0,n.privateClockVenue)(t.VENUE_RID)?{[t.VENUE_RID]:(0,n.venueClockArea)(t.VENUE_RID)}:{},visiting:{},set:(s,u,c)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{...e.areas[s]??{},...u}),updatedAt:(new Date).toISOString(),updatedBy:c}}}),reset:(s,u)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{lat:e.areas[s]?.lat??null,lng:e.areas[s]?.lng??null}),updatedAt:(new Date).toISOString(),updatedBy:u}}}),setVisiting:t=>e(e=>({visiting:Object.fromEntries([...Object.entries(e.visiting).slice(-60),[t,!0]])}))}),{name:'covercharge-clock-area-v1',version:1,storage:(0,l.createJSONStorage)(()=>u.default)})),_=e=>t.IS_ISOLATED_VENUE&&e!==t.VENUE_RID?(0,E.cleanArea)(E.DEFAULT_CLOCK_AREA):(0,n.venueClockArea)(e,o.getState().areas[e]??{})},1294,[5,869,1190,995,1191,870]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteStatus=function(){return{'st-tracy':{state:'used',usedAt:s(3e3),devices:2},'st-gordon':{state:'used',usedAt:s(2940),devices:2},'st-bisto':{state:'used',usedAt:s(1800),devices:1},'st-agate':{state:'used',usedAt:s(1680),devices:1},'st-lenny':{state:'used',usedAt:s(1560),devices:1},'st-finn':{state:'unused',expiresAt:n(52),devices:0},'st-eilidh':{state:'used',usedAt:s(1200),devices:1},'st-emily':{state:'expired',devices:0},'st-lillie':{state:'used',usedAt:s(480),devices:1},'st-jack':{state:'unused',expiresAt:n(70),devices:0}}},e.linkPhones=async function(){return{...a}},e.resetPhone=async function(t){const s=a[t]?.phones??0;return delete a[t],s},e.reissueInvite=async function(t){const s='st-bisto'===t?'chef':['st-tracy','st-gordon','st-agate'].includes(t)?'owner':'staff';return{ok:!0,token:'DEMO-link-not-real-0000',expiresAt:n(72),app:s}},e.unlockCashUp=async function(s,n,a){const c=new Date(Date.now()+18e5).toISOString();'cashup'===s?t.useCashUp.setState(t=>({cashUps:t.cashUps.map(t=>t.id===n?{...t,unlockedUntil:c}:t)})):t.useCashUp.setState(t=>({sales:t.sales.map(t=>t.id===n?{...t,unlockedUntil:c}:t)}));return{ok:!0,until:c}},e.cashAudit=async function(t){return[{at:s(780),action:'unlocked',by:'Morgan',tbl:'cash_ups',reason:'Card total keyed as 1,284 not 1,248',changed:[]},{at:s(768),action:'changed',by:'Alex',tbl:'cash_ups',changed:['card']},{at:s(840),action:'created',by:'Alex',tbl:'cash_ups',changed:[]}]},e.pitchRpc=function(t,s){switch(t){case'list_displays':return c;case'create_display_code':case'new_code_for_display':return[{code:'DEMO7K2QX',expires_at:n(24*Number(s.p_hours?Number(s.p_hours)/24:7))}];default:return[]}};var t=r(d[0]);const s=t=>new Date(Date.now()-6e4*t).toISOString(),n=t=>new Date(Date.now()+36e5*t).toISOString();const a={'st-tracy':{phones:1,since:s(4445)},'st-bisto':{phones:1,since:s(2920)},'st-agate':{phones:1,since:s(1680)},'st-lenny':{phones:1,since:s(1560)},'st-eilidh':{phones:1,since:s(1200)}};const c=[{id:'pd-1',label:'Front desk tablet',can_write:!0,created_at:s(17280),last_seen_at:s(2),revoked_at:null,sessions:1,open_codes:0},{id:'pd-2',label:'Kitchen pass tablet',can_write:!1,created_at:s(12960),last_seen_at:s(5),revoked_at:null,sessions:1,open_codes:0}]},1295,[1049]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useChatSync",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"chatSynced",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({synced:!1,checked:!1})),n=()=>t.getState().synced},1296,[995]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestSpecialsAfter=function(t,n){return n.ok?n.board?t&&t.postedAt>n.board.postedAt?{board:t,note:''}:{board:n.board,note:''}:{board:null,note:''}:{board:t,note:n.message}},Object.defineProperty(e,"GUEST_SPECIALS_OFFLINE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SUPPORT_NOT_SENT",{enumerable:!0,get:function(){return n}}),e.supportAfterWrite=function(t,o){return t.trim()?o.ok?{text:t,sent:!0,note:''}:{text:t,sent:!1,note:o.message||n}:{text:t,sent:!1,note:''}};const t='The specials board could not be loaded. What is already on this phone is unchanged.',n='Saved on this phone. It was not sent.'},1297,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1298,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get Badge(){return x.Badge},get DarkTheme(){return y.DarkTheme},get DefaultTheme(){return _.DefaultTheme},get ErrorBoundary(){return v.ErrorBoundary},get ExperimentalStack(){return U.ExperimentalStack},get ExpoRoot(){return c.ExpoRoot},get Icon(){return x.Icon},get IsWithinNativeNavigator(){return B.IsWithinNativeNavigator},get Label(){return x.Label},get LocaleProvider(){return I.LocaleProvider},get NativeStackView(){return E.NativeStackView},get NavigationAwareActivity(){return R.NavigationAwareActivity},get Navigator(){return t.Navigator},get RouterActionHandling(){return C.RouterActionHandling},get Sitemap(){return b.Sitemap},get Slot(){return t.Slot},get SplashScreen(){return S},get StackRouter(){return C.StackRouter},get SuspenseFallback(){return f.SuspenseFallback},get TabRouter(){return C.TabRouter},get Tabs(){return M.Tabs},get ThemeProvider(){return T.ThemeProvider},get Unmatched(){return l.Unmatched},get VectorIcon(){return x.VectorIcon},get attachRouteState(){return C.attachRouteState},get createBaseStackProps(){return j.createBaseStackProps},get createBaseTabProps(){return D.createBaseTabProps},get createNativeStackProps(){return W.createNativeStackProps},get createStandardRouterNavigator(){return B.createStandardRouterNavigator},get enableLegacyHeaderAppearance(){return F.enableLegacyHeaderAppearance},get extendRouter(){return C.extendRouter},get extendRouterActions(){return C.extendRouterActions},get integrateWithRouter(){return B.integrateWithRouter},get isActionHandled(){return C.isActionHandled},get router(){return u.router},get unstable_PerformanceObserver(){return G.unstable_PerformanceObserver},get unstable_createStandardRouterNavigator(){return B.unstable_createStandardRouterNavigator},get unstable_enablePerformanceIntegration(){return G.unstable_enablePerformanceIntegration},get unstable_integrateWithRouter(){return B.unstable_integrateWithRouter},get unstable_performance(){return G.unstable_performance},get unstable_useIsNavigating(){return o.useIsNavigating},get unstable_useReconcileTabHistory(){return H.useReconcileTabHistory},get useCanGoBack(){return n.useCanGoBack},get useCurrentRouteInfo(){return n.useCurrentRouteInfo},get useFocusEffect(){return h.useFocusEffect},get useGlobalSearchParams(){return n.useGlobalSearchParams},get useIsFocused(){return N.useIsFocused},get useLoaderData(){return n.useLoaderData},get useLocalSearchParams(){return n.useLocalSearchParams},get useNavigation(){return P.useNavigation},get useNavigationContainerRef(){return n.useNavigationContainerRef},get usePathname(){return n.usePathname},get usePreventRemove(){return L.usePreventRemove},get useRootNavigation(){return n.useRootNavigation},get useRootNavigationState(){return n.useRootNavigationState},get useRoute(){return A.useRoute},get useRoutePath(){return O.useRoutePath},get useRouter(){return n.useRouter},get useScrollToTop(){return w.useScrollToTop},get useSegments(){return n.useSegments},get useSitemap(){return p.useSitemap},get useTheme(){return k.useTheme},get useUnstableGlobalHref(){return n.useUnstableGlobalHref},get withLayoutContext(){return s.withLayoutContext}});const t=r(d[0]),n=r(d[1]),u=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),l=r(d[6]),b=r(d[7]),p=r(d[8]),v=r(d[9]),f=r(d[10]),R=r(d[11]),S=q(r(d[12])),P=r(d[13]),h=r(d[14]),N=r(d[15]),y=r(d[16]),_=r(d[17]),T=r(d[18]),k=r(d[19]),I=r(d[20]),O=r(d[21]),w=r(d[22]),A=r(d[23]),L=r(d[24]),x=r(d[25]),B=r(d[26]),H=r(d[27]),j=r(d[28]),D=r(d[29]),W=r(d[30]),C=r(d[31]),E=r(d[32]),F=r(d[33]),G=r(d[34]),M=r(d[35]),U=r(d[36]);function V(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(V=function(t){return t?u:n})(t)}function q(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=V(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=s?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(o,c,l):o[c]=t[c]}return o.default=t,u&&u.set(t,o),o}},1299,[695,420,513,1300,713,33,767,758,761,1301,665,663,668,534,538,543,482,484,448,449,1302,489,490,479,477,525,712,658,726,1303,725,359,704,709,379,1304,1307]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useIsNavigating",{enumerable:!0,get:function(){return u}});const t=r(d[1]);function u(){return(0,n().use)(t.NavigationPendingContext)}},1300,[31,376]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}function n(){const t=r(d[2]);return n=function(){return t},t}function l(){const t=r(d[3]);return l=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ErrorBoundary",{enumerable:!0,get:function(){return f}});r(d[4]);const s=r(d[5]),c=r(d[6]),u=r(d[7]);function h({error:o}){return(0,t().jsxs)(n().View,{style:{marginBottom:12,gap:4,flexWrap:'wrap'},children:[(0,t().jsx)(n().Text,{role:"heading","aria-level":1,style:y.title,children:"Something went wrong"}),(0,t().jsxs)(n().Text,{testID:"router_error_message",role:"heading","aria-level":2,style:y.errorMessage,children:["Error: ",o.message]})]})}function f({error:f,retry:x}){const w=(0,o().use)(s.BottomTabBarHeightContext)?n().View:l().SafeAreaView,S=f instanceof c.ReactServerError;return(0,t().jsx)(n().View,{style:y.container,children:(0,t().jsxs)(w,{style:{flex:1,gap:8,maxWidth:720,marginHorizontal:'auto'},children:[S?(0,t().jsx)(b,{error:f}):(0,t().jsx)(h,{error:f}),(0,t().jsx)(n().View,{style:{flex:1}}),!1,(0,t().jsx)(u.Pressable,{testID:"router_error_retry",onPress:x,children:({hovered:o,pressed:l})=>(0,t().jsx)(n().View,{style:[y.buttonInner,(o||l)&&{backgroundColor:'white'}],children:(0,t().jsx)(n().Text,{style:[y.buttonText,{color:o||l?'black':'white'}],children:"Retry"})})})]})})}const x={404:'NOT_FOUND',500:'INTERNAL_SERVER_ERROR',503:'SERVICE_UNAVAILABLE',504:'GATEWAY_TIMEOUT'};function b({error:o}){let l=String(o.statusCode);l+=': '+(x[o.statusCode]??'Server Error');const s=o.headers.get('cf-ray'),c=o.headers.get('Date');return(0,t().jsxs)(n().View,{style:{padding:12,gap:8},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:n().Platform.select({web:24,default:16}),fontWeight:'bold',marginBottom:4,color:'white'},children:l}),(0,t().jsx)(n().ScrollView,{style:{borderColor:'rgba(255,255,255,0.5)',borderTopWidth:n().StyleSheet.hairlineWidth,borderBottomWidth:n().StyleSheet.hairlineWidth,maxHeight:150},contentContainerStyle:{paddingVertical:4},children:(0,t().jsx)(n().Text,{testID:"router_error_message",selectable:!0,allowFontScaling:!0,style:{color:'white'},children:o.message})}),(0,t().jsx)(w,{title:"Code",right:o.statusCode}),s&&(0,t().jsx)(w,{title:"ID",right:s}),c&&(0,t().jsx)(w,{title:"Date",right:c}),o.url&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:14,opacity:.5,color:'white'},children:o.url})]})}function w({title:o,right:l}){const s={fontSize:16,color:'white'};return(0,t().jsxs)(n().View,{style:{flexDirection:'row',justifyContent:'space-between'},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:s,children:o}),l&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:[s,y.code],children:l})]})}const y=n().StyleSheet.create({container:{flex:1,backgroundColor:'black',padding:24,alignItems:'stretch',justifyContent:'center'},title:{color:'white',fontSize:n().Platform.select({web:32,default:24}),fontWeight:'bold'},buttonText:{fontSize:18,fontWeight:'bold',color:'black',...n().Platform.select({web:{transitionDuration:'100ms'}})},buttonInner:{...n().Platform.select({web:{transitionDuration:'100ms'}}),paddingVertical:12,paddingHorizontal:24,borderColor:'white',borderWidth:2,marginLeft:8,justifyContent:'center',alignItems:'center'},code:{fontFamily:n().Platform.select({default:'Courier',ios:'Courier New',android:'monospace'}),fontWeight:'500'},errorMessage:{color:'white',fontSize:16},subtitle:{color:'white',fontSize:14,marginBottom:12},link:{color:'rgba(255,255,255,0.4)',textDecorationStyle:'solid',textDecorationLine:'underline',fontSize:14,textAlign:'center'}})},1301,[25,31,34,290,509,546,667,760]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LocaleProvider",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o({direction:o,children:c}){return(0,n().jsx)(t.LocaleDirContext.Provider,{value:o,children:c})}},1302,[25,430]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({dispatch:t,isPreloaded:o,isRemovalPrevented:n,state:s}){return{isPreloaded:o,isRemovalPrevented:n,routeNames:s.routeNames,preload:o=>t({type:'PRELOAD',payload:{name:o}})}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createBaseTabProps",{enumerable:!0,get:function(){return t}})},1303,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get BottomTabBar(){return n.BottomTabBar},get BottomTabBarHeightCallbackContext(){return n.BottomTabBarHeightCallbackContext},get BottomTabBarHeightContext(){return n.BottomTabBarHeightContext},get BottomTabView(){return n.BottomTabView},get SceneStyleInterpolators(){return u},get Tabs(){return n.default},get TransitionPresets(){return c},get TransitionSpecs(){return f},get createJSTabsProps(){return n.createJSTabsProps},get createStandardBottomTabNavigator(){return n.createStandardBottomTabNavigator},get default(){return s},get useBottomTabBarHeight(){return n.useBottomTabBarHeight}});const t=r(d[0]),o=r(d[1]),n=b(r(d[2])),u=b(r(d[3])),c=b(r(d[4])),f=b(r(d[5]));function l(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,n=new WeakMap;return(l=function(t){return t?n:o})(t)}function b(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=l(o);if(n&&n.has(t))return n.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var b=c?Object.getOwnPropertyDescriptor(t,f):null;b&&(b.get||b.set)?Object.defineProperty(u,f,b):u[f]=t[f]}return u.default=t,n&&n.set(t,u),u}n.default.Screen=o.Screen,n.default.Protected=t.Protected;const s=n.default},1304,[719,720,1305,547,548,549]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get createJSTabsProps(){return h},get default(){return y}});const o=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),f=r(d[7]);var l,b;function h(t){const{dispatch:n,state:o}=t;return{...(0,f.createBaseTabProps)(t),popNestedStackToTop:t=>{const s=o.routes.find(n=>n.key===t)?.state;s?.key&&n({...c.StackActions.popToTop(),target:s.key})}}}l=r(d[8]),b=e,Object.keys(l).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(b,t)||Object.defineProperty(b,t,{enumerable:!0,get:function(){return l[t]}})});const y=(0,u.integrateWithRouter)(s.createStandardBottomTabNavigator,c.TabRouter,{activityDefaultThreshold:1,processDescriptors:p.appendMissingPlaceholderTabDescriptors,processState:p.appendMissingPlaceholderTabRoutes,createProps:h,processScreens:s=>s.map(s=>{if('function'!=typeof s.options&&void 0!==s.options?.href){const{href:c,...u}=s.options;if(u.tabBarButton)throw new Error('Cannot use `href` and `tabBarButton` together.');return null===c?{...s,options:{...u,hidden:!0}}:{...s,options:{...u,tabBarButton:s=>{const u='web'===n().Platform.OS?s.children:(0,t().jsx)(n().Pressable,{children:s.children});return(0,t().jsx)(o.Link,{...s,style:[{display:'flex'},s.style],href:c,asChild:'web'!==n().Platform.OS,children:u})}}}}return s})})},1305,[25,34,509,653,428,712,1306,1303,546]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){const s=n.routeNames.filter(t=>!n.routes.some(n=>n.name===t));if(0===s.length)return t;const u=s.reduce((t,n)=>(t[n]=o({key:void 0,name:n}),t),{});return{...t,...u}}function n(t,n){if(!t.routeNames.some(n=>!t.routes.some(t=>t.name===n)))return t;const s=t.routes[t.index]?.key,u=t.routeNames.map(s=>{const u=t.routes.find(t=>t.name===s);return u||o(s,n)}),c=Math.max(0,u.findIndex(t=>t.key===s));return{...t,index:c,routes:u}}function o(t,n){const o=n[t];if(!o)throw new Error(`Could not find a descriptor for route "${t}". This is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.`);return{...o.route,key:t,name:t}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get appendMissingPlaceholderTabDescriptors(){return t},get appendMissingPlaceholderTabRoutes(){return n}})},1306,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get ExperimentalStack(){return c},get default(){return o}});const n=u(r(d[1]));function u(t){return t&&t.__esModule?t:{default:t}}const c=Object.assign(u=>(0,t().jsx)(n.default,{...u}),{Screen:n.default.Screen,Protected:n.default.Protected}),o=c},1307,[25,1308]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,u){for(var n in u)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(u,n).get})})(e,{get Stack(){return t.default},get default(){return l}});const t=c(r(d[0])),u=r(d[1]),n=r(d[2]);function c(t){return t&&t.__esModule?t:{default:t}}t.default.Screen=u.StackScreen,t.default.Header=u.StackHeader,t.default.Title=u.StackTitle,t.default.Toolbar=n.StackToolbar;const l=t.default},1308,[696,729,734]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.default}});const t=o((n=r(d[0]),u=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(u,t)||Object.defineProperty(u,t,{enumerable:!0,get:function(){return n[t]}})}),n));var n,u;function o(t){return t&&t.__esModule?t:{default:t}}},1309,[1308]); +__d(function(g,r,i,a,m,e,d){"use strict";var t,n;Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get useIsPreview(){return s.useIsPreview},get usePreventZoomTransitionDismissal(){return o.usePreventZoomTransitionDismissal}}),t=r(d[0]),n=e,Object.keys(t).forEach(function(o){"default"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return t[o]}})});const o=r(d[1]),s=r(d[2])},1310,[509,1311,422]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreventZoomTransitionDismissal",{enumerable:!0,get:function(){return n}})},1311,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Color",{enumerable:!0,get:function(){return y}});r(d[0]);function t(t,n){return Object.keys(t).forEach(function(u){"default"===u||Object.prototype.hasOwnProperty.call(n,u)||Object.defineProperty(n,u,{enumerable:!0,get:function(){return t[u]}})}),t}t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e),t(r(d[5]),e);const n=new Proxy({},{get:(t,n)=>null}),u=new Proxy({},{get:(t,n)=>null}),o=new Proxy({},{get:(t,n)=>null}),l=new Proxy({},{get:(t,n)=>null}),c=new Proxy({get attr(){return u},get material(){return o},get dynamic(){return l}},{get:(t,n)=>n in t?t[n]:null}),y={get ios(){return n},get android(){return c}}},1312,[1313,1314,1315,1316,1317,1318]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return null}function n(t){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Material3Color(){return n},get Material3DynamicColor(){return t}})},1313,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1314,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1315,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1316,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1317,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1318,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inlineStyles",{enumerable:!0,get:function(){return n.inlineStyles}}),Object.defineProperty(_e,"loadLocalRawResource",{enumerable:!0,get:function(){return n.loadLocalRawResource}}),Object.defineProperty(_e,"LocalSvg",{enumerable:!0,get:function(){return n.LocalSvg}}),Object.defineProperty(_e,"SvgCss",{enumerable:!0,get:function(){return n.SvgCss}}),Object.defineProperty(_e,"SvgCssUri",{enumerable:!0,get:function(){return n.SvgCssUri}}),Object.defineProperty(_e,"SvgWithCss",{enumerable:!0,get:function(){return n.SvgWithCss}}),Object.defineProperty(_e,"SvgWithCssUri",{enumerable:!0,get:function(){return n.SvgWithCssUri}}),Object.defineProperty(_e,"WithLocalSvg",{enumerable:!0,get:function(){return n.WithLocalSvg}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return e.camelCase}}),Object.defineProperty(_e,"fetchText",{enumerable:!0,get:function(){return t.fetchText}}),Object.defineProperty(_e,"parse",{enumerable:!0,get:function(){return e.parse}}),Object.defineProperty(_e,"SvgAst",{enumerable:!0,get:function(){return e.SvgAst}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return e.SvgFromUri}}),Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return e.SvgFromXml}}),Object.defineProperty(_e,"SvgUri",{enumerable:!0,get:function(){return e.SvgUri}}),Object.defineProperty(_e,"SvgXml",{enumerable:!0,get:function(){return e.SvgXml}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),u=r(d[3]);Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});var o=r(d[4]);Object.keys(o).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return o[e]}})});var c,f=(c=o)&&c.__esModule?c:{default:c}},1319,[1320,1321,1340,1341,1323]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SvgAst=c,_e.SvgXml=l,_e.SvgUri=function(r){const{onError:o=i,uri:s,onLoad:c,fallback:u}=r,[f,p]=(0,t.useState)(null),[d,h]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s?(0,n.fetchText)(s).then(t=>{p(t),d&&h(!1),c?.()}).catch(t=>{o(t),h(!0)}):p(null)},[o,s,c]),d)return u??null;return e.createElement(l,{xml:f,override:r,fallback:u})},Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return d}}),_e.getStyle=h,_e.astToReact=x,_e.parse=j,Object.defineProperty(_e,"tags",{enumerable:!0,get:function(){return r.tags}});var t=_r(_d[0]),e=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e})(t),n=_r(_d[1]),r=_r(_d[2]);function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;enull!==o?j(o):null,[o]);return e.createElement(c,{ast:r,override:s||n})}catch(t){return r(t),l??null}}class u extends t.Component{state={ast:null};componentDidMount(){this.parse(this.props.xml)}componentDidUpdate(t){const{xml:e}=this.props;e!==t.xml&&this.parse(e)}parse(t){const{onError:e=i}=this.props;try{this.setState({ast:t?j(t):null})}catch(t){const n=t;e({...n,message:`[RNSVG] Couldn't parse SVG, reason: ${n.message}`})}}render(){const{props:t,state:{ast:n}}=this;return e.createElement(c,{ast:n,override:t.override||t})}}class f extends t.Component{state={xml:null};componentDidMount(){this.fetch(this.props.uri)}componentDidUpdate(t){const{uri:e}=this.props;e!==t.uri&&this.fetch(e)}async fetch(t){try{this.setState({xml:t?await(0,n.fetchText)(t):null})}catch(t){console.error(t)}}render(){const{props:t,state:{xml:n}}=this;return e.createElement(u,{xml:n,override:t,onError:t.onError})}}const p=(t,e)=>e.toUpperCase(),d=t=>t.replace(/[:-]([a-z])/g,p);function h(t){const e={},n=t.split(';').filter(t=>t.trim()),{length:r}=n;for(let t=0;tb(' ',t.length);function v(t,e){const n=t.split('\n'),r=n.length;let o=e,s=0;for(;s=t))break;o-=t}const c=t.slice(0,e).replace(/^\t+/,y),i=/(^|\n).*$/.exec(c),l=i&&i[0]||'',u=t.slice(e),f=/.*(\n|$)/.exec(u);return{line:s,column:o,snippet:`${l}${f&&f[0]}\n${b(' ',l.length)}^`}}const E=/[a-zA-Z0-9:_-]/,O=/
The Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

- + diff --git a/abbotsford/display-app/index.html b/abbotsford/display-app/index.html index 68a8d76f4f336164b75f459901978d04b04e1177..477318398d3ed1a72063ed0a7d998ec20c22683d 100644 --- a/abbotsford/display-app/index.html +++ b/abbotsford/display-app/index.html @@ -30,6 +30,6 @@
The Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

- + diff --git a/abbotsford/display-app/sw.js b/abbotsford/display-app/sw.js index 2e704575d899b4d633b1b9fd106ee6d134249f91..3d412bc07df2939c88c093c492b01f91c6395e2a 100644 --- a/abbotsford/display-app/sw.js +++ b/abbotsford/display-app/sw.js @@ -1,4 +1,4 @@ -const V="cc-abbotsford-display-1ccaacca32556531",B="/abbotsford/display-app/",P=["/abbotsford/display-app/apple-touch-icon.png", "/abbotsford/display-app/favicon.ico", "/abbotsford/display-app/icon-192.png", "/abbotsford/display-app/icon-512.png", "/abbotsford/display-app/brand-logo.png", "/abbotsford/display-app/index.html", "/abbotsford/display-app/display.html", "/abbotsford/display-app/manifest.webmanifest", "/abbotsford/display-app/brand-hero.png", "/abbotsford/display-app/_expo/static/js/web/basket-7c4fed68ce9e0c09c65383c7cef79793.js", "/abbotsford/display-app/_expo/static/js/web/index-e7d08ddd8307cc90502f5624c0ccc0bd.js", "/abbotsford/display-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/abbotsford/display-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/abbotsford/display-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/abbotsford/display-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/abbotsford/display-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/abbotsford/display-app/_expo/static/js/web/loyalty-679d7aa42c3cddfce82c3e1207d2d4cf.js", "/abbotsford/display-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/abbotsford/display-app/_expo/static/js/web/refer-01535dadf727412eb1a34a61dcc6d53d.js", "/abbotsford/display-app/_expo/static/js/web/historicalBookingApi-0882cd30208cbd3c9dac9321ada9420d.js", "/abbotsford/display-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/abbotsford/display-app/_expo/static/js/web/book-7c4c90140093809a35e48a974143bb55.js", "/abbotsford/display-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/abbotsford/display-app/_expo/static/js/web/profile-b82887516ccba728915e95d502c0081a.js", "/abbotsford/display-app/_expo/static/js/web/offers-eba5409c285b6031064e79e9f1ea19e0.js", "/abbotsford/display-app/_expo/static/js/web/merch-63634eac687774d71f27698748247bd2.js", "/abbotsford/display-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/abbotsford/display-app/_expo/static/js/web/index-9831b9208e843e392cc61937fd9804e1.js", "/abbotsford/display-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js", "/abbotsford/display-app/_expo/static/js/web/waitlist-7da65cbcea167a5ec8823003e69ae268.js", "/abbotsford/display-app/_expo/static/js/web/whatson-dd3d796ea1e77876d5803d9ecd8c1109.js", "/abbotsford/display-app/_expo/static/js/web/index-c83f6d48c547716df6a3ebcf342a6d7a.js", "/abbotsford/display-app/_expo/static/js/web/index-c1c9ac942fc6d77c5bdc658c26dfe16e.js", "/abbotsford/display-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/abbotsford/display-app/_expo/static/js/web/_layout-1ed84717c52ac5205bfb65a8eda2d70c.js", "/abbotsford/display-app/_expo/static/js/web/__common-27a67798a6076f949173558388c8d9e0.js", "/abbotsford/display-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/abbotsford/display-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/abbotsford/display-app/_expo/static/js/web/lost-817d2886f8973bfa630e2a69674dc584.js", "/abbotsford/display-app/_expo/static/js/web/index-c21267a9b534b341ed4458adcc7f4444.js", "/abbotsford/display-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/abbotsford/display-app/_expo/static/js/web/index-997bc0470ef63b01fb21fb195351458b.js", "/abbotsford/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/abbotsford/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/abbotsford/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/abbotsford/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/abbotsford/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/abbotsford/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/abbotsford/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/abbotsford/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/abbotsford/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/abbotsford/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/abbotsford/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/abbotsford/display-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/abbotsford/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/abbotsford/display-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/abbotsford/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/abbotsford/display-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/abbotsford/display-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/display-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/abbotsford/display-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/abbotsford/display-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/abbotsford/display-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/display-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/abbotsford/display-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/abbotsford/display-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/abbotsford/display-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/abbotsford/display-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/abbotsford/display-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/abbotsford/display-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/abbotsford/display-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/abbotsford/display-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/abbotsford/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/abbotsford/display-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/abbotsford/display-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/abbotsford/display-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/abbotsford/display-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/abbotsford/display-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/abbotsford/display-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/abbotsford/display-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/abbotsford/display-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/abbotsford/display-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/abbotsford/display-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/abbotsford/display-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/abbotsford/display-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/abbotsford/display-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png"]; +const V="cc-abbotsford-display-da1e359c7c2d30c6",B="/abbotsford/display-app/",P=["/abbotsford/display-app/index.html", "/abbotsford/display-app/icon-192.png", "/abbotsford/display-app/brand-logo.png", "/abbotsford/display-app/favicon.ico", "/abbotsford/display-app/brand-hero.png", "/abbotsford/display-app/icon-512.png", "/abbotsford/display-app/apple-touch-icon.png", "/abbotsford/display-app/manifest.webmanifest", "/abbotsford/display-app/display.html", "/abbotsford/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/abbotsford/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/abbotsford/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/abbotsford/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/abbotsford/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/abbotsford/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/abbotsford/display-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/abbotsford/display-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/abbotsford/display-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/abbotsford/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/abbotsford/display-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/abbotsford/display-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/abbotsford/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/abbotsford/display-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/abbotsford/display-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/abbotsford/display-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/abbotsford/display-app/assets/assets/brand/smokinggoat.fff2a9a694b41fed68c80a2c9bfe65da.png", "/abbotsford/display-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/abbotsford/display-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/abbotsford/display-app/assets/assets/brand/drunkencoo.272f746bf13376f503acd81a524a7998.png", "/abbotsford/display-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/abbotsford/display-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/abbotsford/display-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/abbotsford/display-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/abbotsford/display-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/abbotsford/display-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/abbotsford/display-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/display-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/abbotsford/display-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/display-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/abbotsford/display-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/abbotsford/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/abbotsford/display-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/abbotsford/display-app/assets/assets/brand/3idiots-hero.77d66ccb53ec1835c3b8a838e9bcfb5a.png", "/abbotsford/display-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/abbotsford/display-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/abbotsford/display-app/assets/assets/brand/drunkencoo-hero.7c01fed6cb075a3a8e4f969bff1cf103.png", "/abbotsford/display-app/assets/assets/brand/smokinggoat-hero.b2ae48c4a1fcf2521ae9ff58435a6649.png", "/abbotsford/display-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/abbotsford/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/abbotsford/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/abbotsford/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/abbotsford/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/abbotsford/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/abbotsford/display-app/_expo/static/js/web/index-ba5aea4e23e402619315d92ef1e4fc6c.js", "/abbotsford/display-app/_expo/static/js/web/gift-791c64f5dbcb5e9b9629af9241dde456.js", "/abbotsford/display-app/_expo/static/js/web/index-708cc108b14a03d1e55d135c08408edf.js", "/abbotsford/display-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js", "/abbotsford/display-app/_expo/static/js/web/basket-b6d5d5daeda35a03cd8137d4a926f820.js", "/abbotsford/display-app/_expo/static/js/web/merch-1080abcf96d828ded78defd0c4e60db8.js", "/abbotsford/display-app/_expo/static/js/web/waitlist-57b6a339b55faddefcbf15cc558b7de7.js", "/abbotsford/display-app/_expo/static/js/web/lost-ce780ee1f6f200e996e7d3ed8cbad51e.js", "/abbotsford/display-app/_expo/static/js/web/index-d72f0e09722c49318a402489e965ec4a.js", "/abbotsford/display-app/_expo/static/js/web/feedback-e234bfa389c6fd89a2e9f35bd3515c4d.js", "/abbotsford/display-app/_expo/static/js/web/refer-04f1fe483aeb39c42e1a284a988d0659.js", "/abbotsford/display-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/abbotsford/display-app/_expo/static/js/web/index-eae28ef7f0787cddcf90124d27547cf2.js", "/abbotsford/display-app/_expo/static/js/web/loyalty-1a6a63899543a8249ca64860b4832a26.js", "/abbotsford/display-app/_expo/static/js/web/_layout-4c62ffb29e94ee001c0e7fcf24b00576.js", "/abbotsford/display-app/_expo/static/js/web/index-2c33bb80c88c28d14a905ee5ebc63cab.js", "/abbotsford/display-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js", "/abbotsford/display-app/_expo/static/js/web/index-222dc045fd0aac3818857fc3da15e957.js", "/abbotsford/display-app/_expo/static/js/web/index-15a0a802a721da0d6fa681c188ed059a.js", "/abbotsford/display-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js", "/abbotsford/display-app/_expo/static/js/web/index-167b8195b1ab8415f93ba1cd7ee288e6.js", "/abbotsford/display-app/_expo/static/js/web/offers-4bae334794c27ee5d138768273078ed2.js", "/abbotsford/display-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js", "/abbotsford/display-app/_expo/static/js/web/index-18a42003614e46ed29f029ff3e81efd8.js", "/abbotsford/display-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js", "/abbotsford/display-app/_expo/static/js/web/book-34e99aaf0197899dc09c20d6bb54139f.js", "/abbotsford/display-app/_expo/static/js/web/profile-51acbb4fee90028b48e71efb79e6d43a.js", "/abbotsford/display-app/_expo/static/js/web/index-66b393bb6353c2ff5bae6b0e5167921b.js", "/abbotsford/display-app/_expo/static/js/web/demo-bb0072f641fdd92aa99cba5bc91fc36d.js", "/abbotsford/display-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js", "/abbotsford/display-app/_expo/static/js/web/whatson-6498b8821e66bd4aa1639b57afb933a3.js", "/abbotsford/display-app/_expo/static/js/web/__common-1240cb6cc5260d7d05075ffe302b67da.js"]; self.addEventListener('install',e=>e.waitUntil(caches.open(V).then(c=>Promise.all(P.map(u=>fetch(u).then(r=>{if(!r.ok)throw Error('cache');return c.put(u,r)})))).then(()=>self.skipWaiting()))); self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-abbotsford-display-')&&k!==V).map(k=>caches.delete(k)))).then(()=>self.clients.claim()))); self.addEventListener('fetch',e=>{const u=new URL(e.request.url);if(e.request.method!=='GET'||u.origin!==location.origin||!u.pathname.startsWith(B))return;if(e.request.mode==='navigate'){e.respondWith(fetch(e.request).then(r=>r.ok?r:caches.match(B+'index.html')).catch(()=>caches.match(B+'index.html')));return;}e.respondWith(caches.match(e.request).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/abbotsford/get/chef.html b/abbotsford/get/chef.html index d3c01fd9984941459cddcad12fb9bd175f299ae2..8e6a13b1dc873ca77fcc1517965eb1db3c9e4b3d 100644 --- a/abbotsford/get/chef.html +++ b/abbotsford/get/chef.html @@ -1 +1 @@ -The Abbotsford Hotel · Head ChefThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

Head Chef

Open Head Chef

Open in Chrome or Safari. Use the browser menu to add to your Home Screen.

No personal link or pairing code is included. Manager setup is required for team access.

v0.3.12.84 \ No newline at end of file +The Abbotsford Hotel · Head ChefThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

Head Chef

Open Head Chef

Open in Chrome or Safari. Use the browser menu to add to your Home Screen.

No personal link or pairing code is included. Manager setup is required for team access.

v0.3.12.184 \ No newline at end of file diff --git a/abbotsford/get/customer.html b/abbotsford/get/customer.html index 5bb1c9e9af1ac1d7ee907a4175f71c681cfb919b..82a22e49cf9a875d4e9559cc75eea1fa804a3f44 100644 --- a/abbotsford/get/customer.html +++ b/abbotsford/get/customer.html @@ -1 +1 @@ -The Abbotsford Hotel · CustomerThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

Customer

Open Customer

Open in Chrome or Safari. Use the browser menu to add to your Home Screen.

No personal link or pairing code is included. Manager setup is required for team access.

v0.3.12.84 \ No newline at end of file +The Abbotsford Hotel · CustomerThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

Customer

Open Customer

Open in Chrome or Safari. Use the browser menu to add to your Home Screen.

No personal link or pairing code is included. Manager setup is required for team access.

v0.3.12.184 \ No newline at end of file diff --git a/abbotsford/get/display.html b/abbotsford/get/display.html index e651ac0e83d0d12e1c1f55da52d0d359f13b357d..43f798806e6c5c6e17b2f53b2fdbb32efda2a383 100644 --- a/abbotsford/get/display.html +++ b/abbotsford/get/display.html @@ -1 +1 @@ -The Abbotsford Hotel · DisplayThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

Display

Open Display

Open in Chrome or Safari. Use the browser menu to add to your Home Screen.

No personal link or pairing code is included. Manager setup is required for team access.

v0.3.12.84 \ No newline at end of file +The Abbotsford Hotel · DisplayThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

Display

Open Display

Open in Chrome or Safari. Use the browser menu to add to your Home Screen.

No personal link or pairing code is included. Manager setup is required for team access.

v0.3.12.184 \ No newline at end of file diff --git a/abbotsford/get/managers.html b/abbotsford/get/managers.html index 6245b58a85f596a48776b414fc235e14af1748e9..6837a6acaa26eb7179124c9d461b37db4657dd9d 100644 --- a/abbotsford/get/managers.html +++ b/abbotsford/get/managers.html @@ -1 +1 @@ -The Abbotsford Hotel · ManagersThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

Managers

Open Managers

Open in Chrome or Safari. Use the browser menu to add to your Home Screen.

No personal link or pairing code is included. Manager setup is required for team access.

v0.3.12.84 \ No newline at end of file +The Abbotsford Hotel · ManagersThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

Managers

Open Managers

Open in Chrome or Safari. Use the browser menu to add to your Home Screen.

No personal link or pairing code is included. Manager setup is required for team access.

v0.3.12.184 \ No newline at end of file diff --git a/abbotsford/get/staff.html b/abbotsford/get/staff.html index 9d93884b1e3551ab7ab8caecd6a5771fc4353cb3..452f58a852ef0b2cdacc533d256eb2f8b9ca5285 100644 --- a/abbotsford/get/staff.html +++ b/abbotsford/get/staff.html @@ -1 +1 @@ -The Abbotsford Hotel · StaffThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

Staff

Open Staff

Open in Chrome or Safari. Use the browser menu to add to your Home Screen.

No personal link or pairing code is included. Manager setup is required for team access.

v0.3.12.84 \ No newline at end of file +The Abbotsford Hotel · StaffThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

Staff

Open Staff

Open in Chrome or Safari. Use the browser menu to add to your Home Screen.

No personal link or pairing code is included. Manager setup is required for team access.

v0.3.12.184 \ No newline at end of file diff --git a/abbotsford/index.html b/abbotsford/index.html index aecc5ebae8186be528616758dedc791a7a6ea55d..36636d59f3a166fafe5de7c2e1167ab5e39aa7c7 100644 --- a/abbotsford/index.html +++ b/abbotsford/index.html @@ -1 +1 @@ -The Abbotsford Hotel · CoverChargeThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

CoverCharge apps

Managers

Staff

Head Chef

Display

Customer

v0.3.12.84 \ No newline at end of file +The Abbotsford Hotel · CoverChargeThe Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

CoverCharge apps

Managers

Staff

Head Chef

Display

Customer

v0.3.12.184 \ No newline at end of file diff --git a/abbotsford/owner-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js b/abbotsford/owner-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js new file mode 100644 index 0000000000000000000000000000000000000000..8039fc81f8fac85dbe1964b30e03ea44f335ea65 --- /dev/null +++ b/abbotsford/owner-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},802,[805,31,807,25]); \ No newline at end of file diff --git a/abbotsford/owner-app/_expo/static/js/web/[did]-7cffbbc18605a1b0ae43a1dfeeca7cc7.js b/abbotsford/owner-app/_expo/static/js/web/[did]-7cffbbc18605a1b0ae43a1dfeeca7cc7.js new file mode 100644 index 0000000000000000000000000000000000000000..8b0660ac15c57fb809f0b202eea5295ace8cc283 --- /dev/null +++ b/abbotsford/owner-app/_expo/static/js/web/[did]-7cffbbc18605a1b0ae43a1dfeeca7cc7.js @@ -0,0 +1 @@ +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return b}});var n=_r(_d[0]),t=_r(_d[1]),s=_r(_d[2]),a=e(_r(_d[3])),l=e(_r(_d[4])),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]);function b(){const{rid:e,did:b}=(0,t.useLocalSearchParams)(),j=(0,h.useRestaurant)(e),x=(0,h.useMenu)(e).find(e=>e.id===b),y=(0,h.useCustomer)(),m=(0,h.useRecipeCards)(e).find(e=>e.id===x?.recipeCardId),k=m?.signOff&&m.photo?(0,g.recipeCards)().photoSource(m.photo):null,v=(0,h.useStore)(e=>e.addLine),w=(0,n.useTakeawayMenu)(n=>n.byVenue[e]),S=(0,h.useStore)(n=>n.basket.restaurantId===e&&'table'===n.basket.mode),[C,B]=(0,s.useState)(()=>(x?.optionGroups??[]).filter(e=>e.required).map(e=>e.choices[0].id)),[$,I]=(0,s.useState)(1),[P,T]=(0,s.useState)(''),[L,O]=(0,s.useState)(!1),[D,A]=(0,s.useState)(!1),[M,R]=(0,s.useState)(!1),[q,_]=(0,s.useState)(!1),N=(0,s.useMemo)(()=>x?(0,c.effectiveAllergens)(x,C):{},[x,C]);if(!j||!x)return(0,f.jsx)(d.Screen,{title:"Not found",children:(0,f.jsx)(d.T,{children:"Dish not found."})});const G=(0,c.conflictsFor)(N,y.allergies),Y=(x.price??0)+(x.optionGroups??[]).flatMap(e=>e.choices).filter(e=>C.includes(e.id)).reduce((e,n)=>e+n.priceDelta,0),z=S||j.fictional?'on':(0,n.takeawayAvail)(x,w),F=x.soldOut||!x.signOff||null===x.price||'on'!==z,Q=(e,n)=>{const t=x.optionGroups.find(n=>n.id===e);B(e=>{const s=t.choices.map(e=>e.id);return t.multi?e.includes(n)?e.filter(e=>e!==n):[...e,n]:e.includes(n)&&!t.required?e.filter(e=>e!==n):[...e.filter(e=>!s.includes(e)),n]})},V=e=>{h.useStore.getState().basket.restaurantId!==j.id&&h.useStore.getState().startBasket(j.id,'takeaway'),v({itemId:x.id,qty:$,choiceIds:C,notes:P,override:e?{allergens:G.contains,at:(new Date).toISOString()}:void 0}),O(!1),_(!0)};return(0,f.jsxs)(d.Screen,{title:x.name,subtitle:j.name,right:(0,f.jsx)(o.BasketButton,{}),children:[k?(0,f.jsx)(a.default,{testID:"dish-photo",source:k,accessibilityLabel:`${x.name}${'example'===m?.origin?' (example photo)':''}`,style:{width:'100%',height:200,borderRadius:12},resizeMode:"cover"}):null,(0,f.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(d.T,{weight:"bold",size:20,colour:p.colours.gold,children:null===x.price?x.priceNote:(0,u.gbp)(Y)}),x.dietary.map(e=>(0,f.jsx)(d.Badge,{kind:"ok",label:e},e))]}),(0,f.jsx)(d.T,{children:x.description}),G.contains.length?(0,f.jsx)(d.Banner,{kind:"danger",title:`Blocked: contains ${G.contains.map(c.allergenLabel).join(', ')}`,children:`You\u2019ve told us: ${y.allergies.filter(e=>G.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`).join('; ')}. This dish can\u2019t be added unless you deliberately override (for example, ordering for someone else).`}):null,G.may.length?(0,f.jsx)(d.Banner,{kind:"warn",title:`Warning: may contain ${G.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact is possible (e.g. shared fryer). Please speak to staff before ordering."}):null,(x.optionGroups??[]).map(e=>(0,f.jsxs)(d.Card,{children:[(0,f.jsxs)(d.T,{weight:"semibold",children:[e.name,e.required?' (required)':' (optional)']}),(0,f.jsx)(d.Row,{wrap:!0,gap:6,children:e.choices.map(n=>(0,f.jsx)(d.Chip,{label:n.label,sub:n.priceDelta?`+${(0,u.gbp)(n.priceDelta)}`:void 0,selected:C.includes(n.id),onPress:()=>Q(e.id,n.id)},n.id))})]},e.id)),(0,f.jsx)(d.Card,{children:(0,f.jsx)(r.AllergenPanel,{item:x,map:N,declared:y.allergies})}),j.fictional?null:(0,f.jsx)(d.AllergenNotice,{phone:j.phone}),(0,f.jsx)(d.Field,{label:"Notes for the kitchen (optional)",placeholder:"e.g. no gherkins",value:P,onChangeText:T}),(0,f.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(d.T,{weight:"semibold",children:"Quantity"}),(0,f.jsx)(d.Stepper,{value:$,onChange:I,label:"quantity"})]}),q?(0,f.jsx)(d.Banner,{kind:"success",title:"Added to basket",children:G.contains.length?'Allergy override recorded \u2014 the kitchen will see a large allergy alert.':'Carry on browsing or go to your basket.'}):null,F?(0,f.jsx)(d.Banner,{kind:"warn",children:x.soldOut||'sold-out'===z?'Sold out today.':'off'===z&&x.signOff&&null!==x.price?'This dish isn\u2019t on the takeaway menu. You can have it when you eat in.':x.signOff?'Price on the specials board \u2014 ask staff.':'Not available to order online until the head chef signs off its allergens.'}):G.contains.length?(0,f.jsxs)(l.default,{style:{gap:8},children:[(0,f.jsx)(d.Button,{kind:"secondary",label:"Choose something else",onPress:()=>t.router.back()}),(0,f.jsx)(d.Button,{kind:"danger",label:"Override and add anyway\u2026",onPress:()=>{A(!1),R(!1),O(!0)},testID:"override-open"})]}):(0,f.jsxs)(d.Row,{gap:8,children:[(0,f.jsx)(d.Button,{style:{flex:1},label:`Add ${$} to basket \xb7 ${(0,u.gbp)(Y*$)}`,onPress:()=>V(!1),testID:"add-to-basket"}),q?(0,f.jsx)(d.Button,{kind:"secondary",label:"Basket",onPress:()=>t.router.push('/customer/basket')}):null]}),(0,f.jsxs)(d.Sheet,{visible:L,onClose:()=>O(!1),title:"Allergy override",children:[(0,f.jsx)(d.Banner,{kind:"danger",title:`${x.name} contains ${G.contains.map(c.allergenLabel).join(', ')}`,children:`Your profile says: ${y.allergies.filter(e=>G.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`).join('; ')}.`}),(0,f.jsx)(d.Toggle,{label:"I understand this dish contains an allergen I have declared",value:D,onChange:A}),(0,f.jsx)(d.Toggle,{label:"It is for someone without this allergy, or I have spoken to staff",value:M,onChange:R}),(0,f.jsx)(d.Muted,{children:"The override is logged and shown to the kitchen as an allergy alert that must be acknowledged."}),(0,f.jsx)(d.Button,{kind:"danger",disabled:!D||!M,label:"Confirm override and add",onPress:()=>V(!0),testID:"override-confirm"})]})]})}},779,[836,805,31,197,128,837,838,817,818,819,822,839,824,25]); \ No newline at end of file diff --git a/abbotsford/owner-app/_expo/static/js/web/[n]-3f651c9b2f8da617300d5ff83469d05b.js b/abbotsford/owner-app/_expo/static/js/web/[n]-3f651c9b2f8da617300d5ff83469d05b.js new file mode 100644 index 0000000000000000000000000000000000000000..0564e0f1160648d8e1ce342407db227044cf0248 --- /dev/null +++ b/abbotsford/owner-app/_expo/static/js/web/[n]-3f651c9b2f8da617300d5ff83469d05b.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),u=_r(d[4]),c=_r(d[5]),s=_r(d[6]),l=_r(d[7]);function f(){const{n:f,r:b}=(0,r.useLocalSearchParams)(),E=(0,u.useStore)(t=>t.startBasket),[_,h]=(0,n.useState)(!1),S=b??c.VENUE_RID,j=(0,u.useOrderAtTable)(S),I=(0,s.guestServer)();return(0,n.useEffect)(()=>{t.LIVE_VENUE_BUILD||I||(j&&E(S,'table',String(f)),h(!0))},[S,f,j,I]),t.LIVE_VENUE_BUILD||I?(0,l.jsx)(o.Screen,{title:"Order at the table",children:(0,l.jsx)(o.Banner,{kind:"demo",title:"Scan the code on your table",children:"To order from your table, scan the QR code printed on it. Or order at the bar."})}):_?(0,l.jsx)(r.Redirect,{href:`/customer/${S}`}):null}},795,[842,805,31,817,822,5,845,25]); \ No newline at end of file diff --git a/abbotsford/owner-app/_expo/static/js/web/[oid]-2117fdb09b7aecce4030b2d0969827e2.js b/abbotsford/owner-app/_expo/static/js/web/[oid]-2117fdb09b7aecce4030b2d0969827e2.js new file mode 100644 index 0000000000000000000000000000000000000000..8fe2d8bea9180ec121577fdefea80ffe197c3bf5 --- /dev/null +++ b/abbotsford/owner-app/_expo/static/js/web/[oid]-2117fdb09b7aecce4030b2d0969827e2.js @@ -0,0 +1,3 @@ +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=_r(d[0]),l=_r(d[1]),s=_r(d[2]),r=_r(d[3]),n=(e=r)&&e.__esModule?e:{default:e},o=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),y=_r(d[10]),b=_r(d[11]),j=_r(d[12]);const x=[['new','Placed'],['acknowledged','Accepted'],['preparing','Cooking'],['ready','Ready to collect'],['collected','Collected']],w=[['new','Sent'],['acknowledged','Accepted'],['preparing','Cooking'],['served','Food out'],['closed','Paid']];function f(){const{oid:e}=(0,l.useLocalSearchParams)(),r=(0,p.useOrder)(e),f=(0,p.useRestaurant)(r?.restaurantId),[k,T]=(0,s.useState)(0),[S,C]=(0,s.useState)(''),[v,M]=(0,s.useState)(!1),[P,A]=(0,s.useState)(0),[R,$]=(0,s.useState)(r?.split?.ways??1);if(!r||!f)return(0,j.jsx)(i.Screen,{title:"Order",children:(0,j.jsx)(i.T,{children:"Order not found."})});const O='takeaway'===r.type?x:w,I=Math.max(0,O.findIndex(([e])=>e===r.status)),N=Math.round(r.subtotal*P/100),B='table'===r.type?r.subtotal+(r.split?r.tip:N):r.total,_=B-r.paid,H=r.split?.ways??R,D=r.split?.paidShares??0,F=Math.ceil(B/H),q='collected'===r.status||'closed'===r.status;return(0,j.jsxs)(i.Screen,{title:`Order ${r.ref}`,subtitle:`${f.name} \xb7 ${'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Collection at ${r.slotTime?(0,h.hm)(new Date(r.slotTime)):'\u2014'}`}`,children:['takeaway'===r.type?(0,j.jsx)(b.TakeawayPayCard,{o:r,phone:f.phone}):null,'takeaway'===r.type&&'awaiting_payment'!==r.status&&'cancelled'!==r.status?(0,j.jsx)(i.Banner,{kind:"success",title:'ready'===r.status?'Your order is ready!':'Order placed',children:'ready'===r.status?'Head to the bar and give your order number. Staff will check allergies with you at handover.':`Show order number ${r.ref} at the bar when you arrive.`}):null,'awaiting_payment'===r.status||'cancelled'===r.status?null:(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.H2,{children:"Status"}),O.map(([e,t],l)=>(0,j.jsxs)(i.Row,{gap:10,children:[(0,j.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:l<=I?y.colours.gold:y.colours.surface2,borderWidth:1,borderColor:y.colours.gold}}),(0,j.jsx)(i.T,{weight:l===I?'semibold':'regular',colour:l<=I?y.colours.text:y.colours.muted,children:t})]},e)),r.allergyAck?(0,j.jsxs)(i.Muted,{children:["Kitchen signed off your allergies (",r.allergyAck.by,", ",(0,h.hm)(new Date(r.allergyAck.at)),")"]}):r.allergies.length?(0,j.jsx)(i.Muted,{children:"Waiting for the kitchen to sign off your allergies\u2026"}):null,'takeaway'!==r.type||q?null:(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.Button,{small:!0,kind:'on-my-way'===r.customerSignal?'primary':'secondary',label:"On my way",onPress:()=>p.repo.orders.customerSignal(r.id,'on-my-way')}),(0,j.jsx)(i.Button,{small:!0,kind:'here'===r.customerSignal?'primary':'secondary',label:"I\u2019m here",onPress:()=>p.repo.orders.customerSignal(r.id,'here')})]})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.H2,{children:"Items"}),r.lines.map((e,t)=>(0,j.jsxs)(n.default,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{style:{flex:1},children:[e.qty,"\xd7 ",e.name]}),(0,j.jsx)(i.T,{children:(0,u.gbp)(e.unitPrice*e.qty)})]}),e.choices.length?(0,j.jsx)(i.Muted,{children:e.choices.join(' \xb7 ')}):null,e.overridden?(0,j.jsx)(i.Badge,{kind:"red",label:`Allergy override: ${e.contains.map(c.allergenLabel).join(', ')}`}):null]},t)),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Subtotal"}),(0,j.jsx)(i.T,{children:(0,u.gbp)(r.subtotal)})]}),r.giftCardApplied?(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Of which gift card"}),(0,j.jsxs)(i.T,{colour:y.colours.ok,children:["\u2212",(0,u.gbp)(r.giftCardApplied)]})]}):null,r.tip?(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Tip"}),(0,j.jsx)(i.T,{children:(0,u.gbp)(r.tip)})]}):null,(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Paid (test, no real money)"}),(0,j.jsx)(i.T,{weight:"semibold",colour:y.colours.gold,children:(0,u.gbp)(r.paid)})]})]}),'table'===r.type&&'closed'!==r.status&&'cancelled'!==r.status?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsxs)(i.H2,{children:["Your bill \u2014 ",(0,t.tableNumbers)(r.tableNo)]}),r.split?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(i.T,{children:["Total ",(0,u.gbp)(B)," \xb7 split ",H," way",H>1?'s':''," \xb7 ",(0,u.gbp)(F)," each"]}),(0,j.jsxs)(i.T,{children:["Shares paid: ",D," of ",H," \xb7 remaining ",(0,u.gbp)(_)]}),(0,j.jsx)(i.Muted,{children:"Pay with a member of staff at your table. Online card payment for the table bill isn\u2019t set up."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Add a tip?"}),(0,j.jsx)(i.Row,{wrap:!0,children:[0,10,12.5,15].map(e=>(0,j.jsx)(i.Chip,{label:e?`${e}%`:'No tip',selected:P===e,onPress:()=>A(e)},e))}),(0,j.jsx)(i.Muted,{children:"Tips go to staff under the restaurant\u2019s tipping policy (Employment (Allocation of Tips) Act 2023)."}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Split evenly between"}),(0,j.jsx)(i.Stepper,{value:R,onChange:$,min:1,max:8,label:"people"})]}),(0,j.jsxs)(i.T,{children:["Total ",(0,u.gbp)(r.subtotal+N),R>1?` \xb7 ${(0,u.gbp)(Math.ceil((r.subtotal+N)/R))} each`:'']}),(0,j.jsx)(i.Button,{label:"Get the bill",onPress:()=>p.repo.orders.setSplit(r.id,R,N),testID:"get-bill"})]})]}):null,!q||r.rated||v?null:(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.H2,{children:"How was everything?"}),(0,j.jsxs)(i.Muted,{children:["One tap \u2014 this goes privately to ",f.name," only, never published."]}),(0,j.jsx)(o.Stars,{value:k,onChange:T}),k?(0,j.jsx)(i.Field,{label:"Anything to add? (optional)",value:S,onChangeText:C}):null,(0,j.jsx)(i.Button,{label:"Send feedback",disabled:!k,onPress:()=>{p.repo.feedback.add({restaurantId:f.id,orderId:r.id,customerId:r.customerId,customerName:r.customerName,stars:k,comment:S,context:'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Takeaway ${r.ref}`}),M(!0)},testID:"send-rating"})]}),v||r.rated?(0,j.jsx)(i.Banner,{kind:"success",children:"Thanks \u2014 your feedback went privately to the restaurant."}):null,q?(0,j.jsx)(i.Button,{kind:"secondary",label:"View stamp card",onPress:()=>l.router.push(`/customer/${f.id}/loyalty`)}):null]})}},792,[811,805,31,128,840,817,818,819,821,822,824,879,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPayCard=function({o:e,phone:y}){const[f,k]=(0,n.useState)(Date.now()),[w,x]=(0,n.useState)(!1),[j,b]=(0,n.useState)(''),[P,v]=(0,n.useState)(null),_=(0,n.useRef)(!1),B=(0,c.payView)(e,f);(0,n.useEffect)(()=>{const e=setInterval(()=>k(Date.now()),1e3);return()=>clearInterval(e)},[]);const T='pay'===B.kind||'expired'===B.kind&&_.current&&'awaiting_payment'===e.status;(0,n.useEffect)(()=>{if(!T||!_.current)return;const n=setInterval(()=>{(0,h.checkPaid)(e.id)},1e4),r=t.default.addEventListener('change',n=>{'active'===n&&(0,h.checkPaid)(e.id)});return()=>{clearInterval(n),r.remove()}},[T,e.id]);if('none'===B.kind)return null;if('sending'===B.kind)return(0,p.jsx)(s.Banner,{kind:"warn",title:"Saving your order\u2026",children:"Sending it to the restaurant. Card payment opens in a moment."});if('refused'===B.kind)return(0,p.jsxs)(s.Banner,{kind:"danger",title:"The restaurant couldn\u2019t take this order",children:[(0,p.jsx)(s.T,{size:14,colour:"#FFE3DF",children:`${B.reason} Nothing has been charged.`}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to the menu",onPress:()=>o.router.replace(`/customer/${e.restaurantId}`)})]});if('paid'===B.kind)return(0,p.jsx)(s.Banner,{kind:"success",title:`Paid ${(0,l.gbp)(B.amount)} by card`,children:B.late?'Your payment came in after the time ran out. The restaurant has your order and will contact you if the collection time needs to change.':'Your order has gone to the kitchen.'});if('expired'===B.kind)return(0,p.jsxs)(s.Banner,{kind:"warn",title:'awaiting_payment'===e.status?'Checking your payment\u2026':'Time ran out: order not sent',children:[(0,p.jsx)(s.T,{size:14,children:'awaiting_payment'===e.status?'We\u2019re checking with the payment page. If you paid, your order will show as paid shortly.':`Nothing has been charged. You can order again${y?` or ring ${y}`:''}.`}),'awaiting_payment'!==e.status?(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Order again",onPress:()=>o.router.replace(`/customer/${e.restaurantId}`)}):null]});return(0,p.jsxs)(s.Card,{highlight:u.colours.gold,children:[(0,p.jsx)(s.H2,{children:"Pay to send your order"}),(0,p.jsxs)(s.T,{children:["Your order goes to the kitchen once it\u2019s paid. Time left to pay: ",(0,p.jsx)(s.T,{weight:"bold",colour:B.secondsLeft<120?u.colours.red:u.colours.gold,children:(0,c.mmss)(B.secondsLeft)})]}),(0,p.jsx)(s.Button,{label:w?'Opening the payment page\u2026':`Pay ${(0,l.gbp)(e.total)} by card`,disabled:w||B.secondsLeft<120,onPress:async()=>{x(!0),b('');const n='undefined'!=typeof window?window.open('','_blank'):null,t=await(0,h.getPayLink)(e.id);if(x(!1),!t.ok)return n?.close(),void b(t.message);if(v(t.url),_.current=!0,n)try{return void(n.location.href=t.url)}catch{}},testID:"pay-card"}),B.secondsLeft<120?(0,p.jsx)(s.Muted,{children:"Not enough time left to pay. Wait for this order to expire, then order again."}):null,P?(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Open the payment page again",onPress:()=>{'undefined'!=typeof window?window.open(P,'_blank'):r.default.openURL(P)}}):null,P?(0,p.jsx)(s.Button,{small:!0,kind:"ghost",label:"I\u2019ve paid: check now",onPress:()=>{(0,h.checkPaid)(e.id)}}):null,j?(0,p.jsx)(s.T,{size:14,colour:u.colours.red,children:j}):null,(0,p.jsx)(s.Muted,{children:"Secure card payment on the restaurant\u2019s website. Apple Pay and Google Pay may be offered there."})]})};var n=_r(d[0]),t=e(_r(d[1])),r=e(_r(d[2]));_r(d[3]);var o=_r(d[4]),s=_r(d[5]),l=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10])},879,[31,232,240,123,805,817,819,824,836,880,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_OFF",{enumerable:!0,get:function(){return o}}),e.getPayLink=async function(u){try{if(!await(0,n.guestSession)())return{ok:!1,message:'Can\u2019t reach the restaurant. Check your signal and try again.'};const{data:c,error:y}=await(0,t.getSupabase)().functions.invoke('takeaway-pay',{body:{order_id:u}}),f=await s(c,y);return f&&'string'==typeof f.url&&f.url.startsWith('https://')?{ok:!0,url:f.url,expiresAt:String(f.expiresAt??''),amountPence:Number(f.amountPence??0)}:{ok:!1,message:'string'==typeof f?.error?f.error:o}}catch{return{ok:!1,message:o}}},e.checkPaid=async function(o){try{const{data:u,error:c}=await(0,t.getSupabase)().functions.invoke('takeaway-pay-check',{body:{order_id:o}}),y=await s(u,c);return(0,n.nudgeGuestSync)(),y?.off?'off':String(y?.state??'unknown')}catch{return'unknown'}};var t=r(d[0]),n=r(d[1]);const o='Card payment isn\u2019t available right now. Nothing has been charged. Please ring the restaurant.';async function s(t,n){if(t&&'object'==typeof t)return t;const o=n?.context;try{const t=o?.json?await o.json():null;return t&&'object'==typeof t?t:null}catch{return null}}},880,[871,823]); \ No newline at end of file diff --git a/abbotsford/owner-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js b/abbotsford/owner-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js new file mode 100644 index 0000000000000000000000000000000000000000..aa5686de2b7746d4738fdfd057a3991ab57eb798 --- /dev/null +++ b/abbotsford/owner-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);r(d[1]);var n=r(d[2]),c=r(d[3]),o=r(d[4]),f=r(d[5]);function s(){const{section:s}=(0,t.useLocalSearchParams)();return(0,c.canShow)('chef')?s&&(0,o.chefSectionAllowed)(String(s))?(0,f.jsx)(n.ChefApp,{section:String(s)},String(s)):(0,f.jsx)(t.Redirect,{href:"/kitchen"}):(0,f.jsx)(t.Redirect,{href:c.ENTRY[c.APP_VARIANT]})}},776,[805,31,806,807,808,25]); \ No newline at end of file diff --git a/abbotsford/owner-app/_expo/static/js/web/[token]-575687ca5d34a1fb861b3398f12bcb98.js b/abbotsford/owner-app/_expo/static/js/web/[token]-575687ca5d34a1fb861b3398f12bcb98.js new file mode 100644 index 0000000000000000000000000000000000000000..f5adfb1bc3da81a2aa7445fc390be0d80fd28cc6 --- /dev/null +++ b/abbotsford/owner-app/_expo/static/js/web/[token]-575687ca5d34a1fb861b3398f12bcb98.js @@ -0,0 +1,2 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]);function u(){const{token:u}=(0,t.useLocalSearchParams)(),h=(0,c.cleanToken)(u);return h?(0,s.guestServer)()?(0,l.jsx)(o.TableOrderLive,{token:h}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"demo",title:"Not connected",children:"This preview isn't connected to a venue, so table orders can't be sent from here."})}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"warn",title:"This code isn't working",children:"Please scan the QR code on your table again, or ask a member of staff."})})}},796,[805,31,817,882,883,845,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},882,[873,811,31,128,817,818,819,883,884,822,824,25]); \ No newline at end of file diff --git a/abbotsford/owner-app/_expo/static/js/web/__common-17b45fc7dc09bbe35bd0bc963d505d46.js b/abbotsford/owner-app/_expo/static/js/web/__common-17b45fc7dc09bbe35bd0bc963d505d46.js new file mode 100644 index 0000000000000000000000000000000000000000..ad81bd5eebab4b25f9e815293f03ace5043ee601 --- /dev/null +++ b/abbotsford/owner-app/_expo/static/js/web/__common-17b45fc7dc09bbe35bd0bc963d505d46.js @@ -0,0 +1,691 @@ +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}Object.defineProperty(e,"__esModule",{value:!0}),r(d[0]),t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e)},805,[1328,1329,1339,1340,1342]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:K}=(0,z.useChef)(3e4);(0,we.useReviewAlerts)(i);const V=(0,_.useSignedIn)(),X=V?.id??z.CHEF_ID,Z=V?.ownerAccess&&'owner'!==V.role?'owner privileges':V?.managerAccess&&'staff'===V.role?'manager privileges':'',Ce=(0,Se.useSync)(e=>e.perms),Pe=Ce.includes('*')||Ce.includes('takings.view');(0,o.useSoldOutLink)(!0,(V?.name??n).replace(' (example)',''));const Oe=e?Be[e]:void 0,[Ee,Le]=(0,A.useState)(Oe?.tab??'home'),[Ne,We]=(0,A.useState)(Oe?.k??null),[Fe,Ge]=(0,A.useState)(Oe?.stock??'levels'),[Ke,Me]=(0,A.useState)(void 0),[Ve,ze]=(0,A.useState)(Oe?.gp??'dishes'),Ue=(0,A.useRef)(null),qe=(0,y.ymd)(K),Qe=(0,y.ymd)(new Date(K.getTime()+864e5));(0,p.useTipsPosted)(i,qe);const Ye=(0,ie.useTravelDay)('chef',qe),Je='home'===Ee&&!Ye;(0,S.useKitchenTodoChime)(i,qe,()=>tt('kitchen','bookings')),(0,me.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,_.ensureAttendance)((new Date).toISOString().slice(0,10),K)},[]);const Xe=(0,A.useRef)({t:'home',k:null});Xe.current={t:Ee,k:Ne};const Ze=(0,A.useRef)([]),et=(0,r.useScrollMemory)(Ue),tt=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Pe||(t=null);const s=Xe.current;s.t===e&&s.k===t||(Ze.current=[...Ze.current,{...s,y:et.leave()}].slice(-30),et.restore(0)),Le(e),We(t)},[Pe]),st=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Xe.current;let t=Ze.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ze.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return et.leave(),Le(s.t),We(s.k),et.restore(s.y??0),!0},[]);(0,l.useWebBack)(st);const it=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ge(s),'gp'===e&&s&&ze(s),tt(e,t)})},[tt]),(0,b.useShiftReminders)({rid:i,staffId:X,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:V?.id??'',name:n,onOpen:e=>{'orderlists'===e&&tt('kitchen','orderlists'),'chat'===e&&tt('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:V?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',st);return()=>e.remove()},[st]),(0,A.useEffect)(()=>{'takings'!==Ne||Pe||(We(null),Le('kitchen'))},[Ne,Pe]),(0,Se.useSync)(e=>e.perms.join(','));const at=(0,H.kitchenHistoryAccess)(i),ot=Ae.filter(e=>('takings'!==e.id||Pe)&&('bookinghistory'!==e.id||at)&&('kitchensetup'!==e.id||at)),nt=Ne&&('takings'!==Ne||Pe)?Ae.find(e=>e.id===Ne):null,rt=((0,E.default)().width,nt?nt.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:ge.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[Ee]);return(0,Re.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:M.colours.bg},edges:['top','bottom'],children:[(0,Re.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:M.colours.border,gap:6},children:[(0,Re.jsx)(L.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,Re.jsx)(F.VoiceSlot,{size:44})}),(0,Re.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'80%',paddingRight:8},children:[(0,Re.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${Z?`, ${Z}`:''}`,style:{borderWidth:1,borderColor:M.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Re.jsxs)(G.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Re.jsx)(ue.StaffAvatar,{id:z.CHEF_ID,size:24,ring:!1}),(0,Re.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Re.jsxs)(G.T,{size:13,weight:"semibold",colour:M.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),Z?(0,Re.jsx)(G.Muted,{center:!1,size:10,numberOfLines:1,children:Z}):null]})]})}),(0,f.openedFromDisplay)()?(0,Re.jsx)(f.BackToDisplayButton,{compact:!0}):null]}),(0,Re.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Re.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,he.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:M.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Re.jsx)(G.T,{size:13,colour:M.colours.gold,children:"Staff app \u203a"})})]}),(0,Re.jsxs)(O.default,{ref:Ue,...et.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Ee?(0,Re.jsx)(ce.AlertsBanner,{}):null,'home'===Ee?(0,Re.jsx)(de.WhosOnShift,{}):null,(0,Re.jsx)(l.BackTitleRow,{back:!('home'===Ee&&!Ne||it),onBack:st,title:rt}),'home'===Ee?(0,Re.jsx)(ie.DayBar,{app:"chef",today:qe}):null,'home'===Ee&&Ye?(0,Re.jsx)(ie.DayView,{rid:i,day:Ye,today:qe,app:"chef"}):null,'home'===Ee?(0,Re.jsx)(le.WhoBar,{}):null,Je&&V?(0,Re.jsx)(h.MyTasksToday,{rid:i,staffId:V.id,name:V.name,onShift:(0,b.shiftNow)(V.id,K.getTime()).on}):null,Je&&(0,k.isKitchenViaDisplay)()?(0,Re.jsx)($e,{go:(e,t)=>{'stock'===e&&t&&Ge(t),'gp'===e&&t&&ze(t),'orders'===e&&Me(t),tt(e,'kitchen'===e?t??null:null)}}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(p.TodaysTipsCard,{rid:i,today:qe}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(p.TipsPotCard,{rid:i,today:qe}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(x.CoversToday,{rid:i,onPress:()=>tt('kitchen','bookings')}):null,Je?(0,Re.jsx)(j.LastFoodBanner,{rid:i,now:K}):null,Je?(0,Re.jsx)(w.NextTableFreeCard,{rid:i,now:K}):null,Je?(0,Re.jsx)(v.KitchenSignoffs,{rid:i,today:qe,by:n,app:"chef"}):null,Je?(0,Re.jsxs)(L.default,{style:{gap:4},children:[(0,Re.jsx)(v.PlattersBooked,{rid:i,date:qe,label:"Platters booked today"}),(0,Re.jsx)(v.PlattersBooked,{rid:i,date:Qe,label:"Platters booked tomorrow"})]}):null,Je?(0,Re.jsx)(Te.ChefAssistantButton,{}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)($e,{go:(e,t)=>{'stock'===e&&t&&Ge(t),'gp'===e&&t&&ze(t),'orders'===e&&Me(t),tt(e,'kitchen'===e?t??null:null)}}):null,'stock'!==Ee||c.PITCH?null:(0,Re.jsx)(te.KitchenCosts,{rid:i,me:(V?.name??n).replace(' (example)',''),actor:{name:(V?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Fe?'deliveries':'take'===Fe?'count':'deliveries'},`s-${Fe}`),'gp'!==Ee||c.PITCH?null:(0,Re.jsx)(te.KitchenCosts,{rid:i,me:(V?.name??n).replace(' (example)',''),actor:{name:(V?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ve}`),'stock'===Ee&&c.PITCH?(0,Re.jsx)(ee.StockScreen,{initial:Fe},Fe):null,'gp'===Ee&&c.PITCH?(0,Re.jsx)(U.GpScreen,{initial:Ve},Ve):null,'creator'===Ee?(0,Re.jsx)(ge.DishCreator,{rid:i,canPublish:!1}):null,'orders'===Ee?(0,Re.jsx)(Y.OrdersScreen,{focus:Ke},Ke??'all'):null,'rota'===Ee?(0,Re.jsx)(G.Card,{children:(0,Re.jsx)(J.KitchenRotaTab,{today:qe})}):null,'kitchen'!==Ee||nt?null:(0,Re.jsxs)(L.default,{style:{gap:10},children:[(0,Re.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:M.colours.border,backgroundColor:M.colours.surface,overflow:'hidden'},children:[He.map(e=>(0,Re.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>tt(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Re.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Re.jsxs)(L.default,{style:{flex:1},children:[(0,Re.jsx)(G.T,{weight:"medium",children:e.title}),(0,Re.jsx)(G.Muted,{children:e.sub})]}),(0,Re.jsx)(G.T,{colour:M.colours.muted,children:"\u203a"})]})},e.id)),ot.map(e=>(0,Re.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>tt(Ee,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:M.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Re.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Re.jsxs)(L.default,{style:{flex:1},children:[(0,Re.jsx)(G.T,{weight:"medium",children:e.title}),(0,Re.jsx)(G.Muted,{children:e.sub})]}),(0,Re.jsx)(G.T,{colour:M.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Re.jsx)(G.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Re.jsxs)(G.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Se.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ne&&X?(0,Re.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Re.jsx)(ne.ClockInOut,{}),(0,Re.jsx)(re.MyUpcomingShifts,{staffId:X,team:!0})]}):null,'mypay'===Ne?(0,Re.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Re.jsx)(ae.MyPeriods,{staffId:X}),(0,Re.jsx)(se.MyHoursPay,{staffId:X}),(0,Re.jsx)(oe.MyTips,{staffId:X}),(0,Re.jsx)(G.Card,{children:(0,Re.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ne?(0,Re.jsx)(L.default,{testID:"chef-alerts",children:(0,Re.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ne?(0,Re.jsx)(t.AvatarMaker,{meId:V?.id??z.CHEF_ID,me:n}):null,'reviews'===Ne?(0,Re.jsx)(je.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ne?(0,Re.jsx)(R.BookingHistory,{rid:i,today:qe}):null,'bookings'===Ne?(0,Re.jsx)(I.TodaysBookings,{rid:i,today:qe,by:n,app:"chef"}):null,'specials'===Ne?(0,Re.jsx)(fe.SpecialsEditor,{rid:i,me:n,app:"chef",now:K}):null,'forecast'===Ne?(0,Re.jsx)(q.ChefForecast,{openPrep:()=>tt('kitchen','prep')}):null,'prep'===Ne?(0,Re.jsx)(Q.PrepScreen,{}):null,'live'===Ne?(0,Re.jsx)(Q.TeamScreen,{}):null,'waste'===Ne?(0,Re.jsx)(Q.WasteScreen,{}):null,'recipes'===Ne?(0,Re.jsx)(xe.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ne?(0,Re.jsx)(Q.AllergenScreen,{openCards:()=>tt('kitchen','recipes')}):null,'takings'===Ne&&Pe?(0,Re.jsx)(p.CashUpScreen,{rid:i,today:qe,canEdit:!1,chartsOnly:!0,who:{id:X,name:n.replace(' (example)','')}}):null,'board'===Ne?(0,Re.jsx)(ve.QuestionBoard,{rid:i,today:qe,manager:!1,by:""}):null,'teamtasks'===Ne?(0,Re.jsx)(h.KitchenTeamTasks,{rid:i,actor:V}):null,'orderlists'===Ne?(0,Re.jsx)(C.OrderListsScreen,{rid:i,today:qe,editor:!0,who:{id:X,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ne?at?(0,Re.jsx)(D.TempUnitsSetup,{}):(0,Re.jsx)(G.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ne||'compliance'===Ne||'foodsafety'===Ne?(0,Re.jsx)(ke.HaccpLog,{mode:"chef",me:n,meId:z.CHEF_ID,now:K,rid:i}):null,'accidents'===Ne?(0,Re.jsx)(pe.AccidentBook,{app:"chef",me:n,meId:z.CHEF_ID,now:K,seeAll:!1}):null]}),(0,Re.jsx)(Ie.BottomTabs,{tablist:!0,background:M.colours.surface,active:'orders'===Ee?'kitchen':Ee,onPress:e=>tt(e),tabs:De.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Re.jsx)(Te.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Me(t),tt('orders')):'gp'===e?tt('gp'):tt('kitchen',e)}}),(0,Re.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Re.jsx)(ye.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),fe=_r(_d[67]),be=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]),Ie=_r(_d[79]),Re=_r(_d[80]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const De=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:ge.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],He=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],Ae=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],Be={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function $e({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,z.useChef)(3e4),d=(0,X.useSheetReminders)(),u=(0,z.useWeek)(),{covers:h,label:p,enough:k,booked:f}=(0,z.useForecast)(),b=(0,Y.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,z.isLow)(e.onHand,e.par)),x=b.filter(e=>e.ordersToday&&!e.placedToday),j=(0,V.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,Ce.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,te.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Re.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Re.jsx)(ke.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Re.jsxs)(G.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Re.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Re.jsxs)(G.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Re.jsx)(Z.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Re.jsx)(G.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Re.jsxs)(G.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,z.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,z.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,z.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Re.jsx)(z.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,K.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Re.jsx)(z.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,K.gbp)((0,z.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Re.jsx)(z.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Re.jsx)(z.Tile,{label:"Waste this week",value:t.waste.length?(0,K.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,z.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Re.jsx)(z.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Re.jsx)(z.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${f}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Re.jsx)(z.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Re.jsxs)(G.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Re.jsx)(G.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Re.jsxs)(G.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Re.jsx)(G.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[ge.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Re.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:M.colours.gold,backgroundColor:M.colours.surface},children:(0,Re.jsxs)(G.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Re.jsx)(G.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Re.jsx)(Pe.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},806,[1106,1412,1112,992,1413,991,993,1159,2,1121,1041,994,1302,1206,1042,821,1142,1019,1020,1023,1092,1015,1016,995,1447,1470,1472,1437,31,234,123,264,152,288,128,290,867,1009,817,819,824,998,1482,1483,1484,1485,1486,1491,1490,1492,1493,1496,1117,1089,1018,1038,1088,1087,1040,1039,989,990,999,865,1113,1114,1115,1116,1010,1532,1012,1103,841,1013,1049,822,1535,1045,823,1004,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"IS_OWNER_DESKTOP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"IS_CAR",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"APP_VARIANT",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"ENTRY",{enumerable:!0,get:function(){return l}}),_e.isAllowedPath=function(e,n=f){return!(t.IS_ISOLATED_VENUE&&/^\/(customer|table)(\/|$)/.test(e)&&![`/customer/${t.VENUE_RID}`,`/customer/${t.VENUE_RID}/`].includes(e))&&('/'===e||''===e||_[n].test(e))},_e.canShow=function(e,t=f){return t===e||'owner'===t&&'customer'===e};var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};const u=o.default.expoConfig?.extra?.appVariant??void 0??'owner',c=!1,s=!1,f=['owner','staff','customer','display','chef'].includes(u)?u:'owner',l={owner:'/owner',staff:'/team',customer:`/customer/${t.VENUE_RID}`,display:'/display',chef:'/kitchen'},_={owner:/^\/(owner|customer|table)(\/|$)/,customer:/^\/(customer|table)(\/|$)/,staff:/^\/team(\/|$)/,display:/^\/display(\/|$)/,chef:/^\/kitchen(\/|$)/}},807,[5,409]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PERMISSIONS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"CHEF_SECTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"chefSectionAllowed",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"rotaView",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"chatView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ticketView",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"supplierView",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"auditView",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"CARD_ROLE_APP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"cardCostsVisible",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"ownJobSeesCosts",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"costsAllowedFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ownJobManagesLinks",{enumerable:!0,get:function(){return h}});const e={owner:'all',manager:'all',staff:new Set(['rota-shifts','tickets','eighty-six','allergens']),chef:new Set(['stock','costing','gp','waste','dish-sales','prep','ordering','allergens','compliance','rota-shifts','kitchen-chat','tickets','eighty-six','specials'])},t=(t,n)=>{const a=e[t];return'all'===a||a.has(n)},n={stock:'stock','stock-take':'stock',deliveries:'stock',gp:'gp','price-changes':'gp','gp-week':'gp','menu-engineering':'dish-sales',orders:'ordering',forecast:'prep',prep:'prep',live:'tickets',waste:'waste',allergens:'allergens',compliance:'compliance',haccp:'compliance',accidents:'compliance','new-dish':'gp',specials:'specials',recipes:'allergens','recipe-cards':'allergens'},a=e=>e in n&&t('chef',n[e]),s=(e,n,a)=>t(e,'staff-personal')?{staff:n,shifts:a}:{staff:n.filter(e=>e.active).map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},job:e.job})),shifts:a.filter(e=>e.published).map(({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l})=>({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l}))},c=(e,t)=>'chef'===e?t.filter(e=>'kitchen'===e.ch&&!e.removed):t,l=(e,n)=>t(e,'customer-personal')?n:n.map(({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),f=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text)),u={'head-chef':'chef',manager:'manager',owner:'owner',staff:'staff'},p=(e,n="edit")=>'edit'===n&&t(u[e]??'staff','costing'),b=e=>'owner'===e.role||'manager'===e.role||'Head Chef'===e.level,m=e=>!e||b(e),h=e=>'owner'===e.role||'manager'===e.role},808,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},811,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},812,[31,264,274,128,1456,824,817,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_DWELL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"dwellBands",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"bandLabel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fmtMins",{enumerable:!0,get:function(){return o}}),_e.dwellFor=function(e,t,r=[]){const o=n(e),i=Math.max(0,o.findIndex(e=>t<=e.upTo)),s=o[i]??o[o.length-1];if(!1===e?.settings.dwellLearn)return{mins:s.mins,learned:!1,samples:0};const a=0===i?1:o[i-1].upTo+1,u=r.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt&&e.partySize>=a&&e.partySize<=s.upTo).map(e=>(new Date(e.finishedAt).getTime()-new Date(e.seatedAt).getTime())/6e4).filter(e=>e>=20&&e<=360).sort((e,t)=>e-t);if(u.length<8)return{mins:s.mins,learned:!1,samples:u.length};const l=u[Math.floor(u.length/2)];return{mins:5*Math.round((s.mins+l)/2/5),learned:!0,samples:u.length}},Object.defineProperty(_e,"DAYS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ruleText",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"ANCHORAGE_EVENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"regularEventsOf",{enumerable:!0,get:function(){return l}}),_e.occursOn=m,_e.nextOccurrence=function(e,t){const n=f(t);for(let t=0;t<400;t++){const r=c(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t));if(m(e,r))return r}return null},_e.expandEvents=function(e,t,n,r){const o=[];if(!t.some(e=>e.active))return o;const i=f(n),s=f(r);for(let n=i;n<=s;n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)){const r=c(n);for(const n of t)m(n,r)&&o.push({id:`${n.id}:${r}`,restaurantId:e,date:r,title:n.name,kind:'event',example:!1,source:'regular',description:[n.time?`from ${n.time}`:'',n.lastFood?`last food orders ${n.lastFood}`:'',n.notes??''].filter(Boolean).join(' \xb7 '),busier:n.busier,lastFood:n.lastFood,time:n.time})}return o},_e.lastFoodOn=function(t,n){if(!t)return null;const r=f(n).getDay(),o=t.settings.lastFoodByDay?.[r],s=(0,e.kitchenHoursOn)(t,f(n));let a=s?{time:s[1],reason:'kitchen closes'}:null;o&&(!a||oe?.settings.dwellBands?.length?e.settings.dwellBands:t,r=(e,t)=>{const n=0===t?1:e[t-1].upTo+1,r=e[t].upTo;return r>=9999?`${n} or more covers`:n===r?`${n} cover${1===n?'':'s'}`:`${n}\u2013${r} covers`},o=e=>e%60==0?`${e/60} hour${60===e?'':'s'}`:e>60?`${Math.floor(e/60)} h ${e%60} min`:`${e} min`;const i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],s=['','first','second','third','fourth'],a=e=>'last'===e.kind?`Last ${i[e.weekday]} of every month`:'nth'===e.kind?`${s[e.n][0].toUpperCase()}${s[e.n].slice(1)} ${i[e.weekday]} of every month`:'weekly'===e.kind?`Every ${i[e.weekday]}`:`One-off: ${e.date}`,u=[{id:'ev-music-night',name:'Open Mic Night',rule:{kind:'last',weekday:0},time:'20:00',notes:'Live music from 8pm.',busier:!0,lastFood:'19:00',active:!0}],l=e=>e?.settings.regularEvents??('anchorage'===e?.id?u:[]),d=e=>String(e).padStart(2,'0'),c=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`,f=e=>new Date(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)));function m(e,t){if(!e.active)return!1;const n=e.rule;if('once'===n.kind)return n.date===t;const r=f(t);return r.getDay()===n.weekday&&('weekly'===n.kind||('nth'===n.kind?Math.ceil(r.getDate()/7)===n.n:new Date(r.getFullYear(),r.getMonth(),r.getDate()+7).getMonth()!==r.getMonth()))}const b=e=>e?.settings.afterLastFood??'drinks',p=e=>{const[t,n]=e.split(':').map(Number);return`${t%12||12}${n?`:${d(n)}`:''}${t<12?'am':'pm'}`},y=e=>e?.settings.showTakeaway??'anchorage'!==e?.id,h=e=>!1!==e?.settings.coversCounter,O=e=>!1!==e?.settings.nextTableFree,$=e=>!1!==e?.settings.dogQuestion,w=e=>!1!==e?.settings.dietQuestion,F=e=>!1!==e?.settings.accessQuestion,k=(e,t)=>e?.settings.holidayFullNames?t:t.replace(/\s*\(substitute day\)/gi,'').trim()},813,[832]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},814,[873,31,123,128,25]); +__d(function(_g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.startForm=function(t=Date.now()){return{openedAt:t,hp:''}},e.guardFor=function(t,n=Date.now()){return{hp:t.hp,formMs:Math.max(0,Math.round(n-t.openedAt))}},e.rememberGuard=function(n,o){t.set(n,o)},e.takeGuard=function(n){const o=t.get(n);return o?(t.delete(n),o):{}};const t=new Map},815,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedFields=W,_e.historyText=D,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=W(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:D(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${A(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!W(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return E}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: 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.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],h=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],u=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],w=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),k=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return k(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){const i=y(e);return l.filter(e=>M(e,i)!==M(e,t))}const j=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,A=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function D(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${j(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${j(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${j(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${h.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=w(o.holds),i=w(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${A(s)}`}const E=e=>e.map(e=>f[e]).join(', ')},816,[831,1456,1450,1454]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return A}}),_e.BrandBar=z,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,B.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,B.jsx)(v,{}):null]});return(0,B.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,B.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,B.jsx)(z,{title:t,subtitle:r,back:o,right:l})}),c?(0,B.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,B.jsx)(p.default,{style:{flex:1},children:u}),s?(0,B.jsx)(p.default,{style:N.footer,children:(0,B.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=F,_e.Card=H,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,B.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:D?'center':'flex-start'}],children:(0,B.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=E,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return $}}),_e.Row=O,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return _}}),_e.Field=function({label:e,...t}){return(0,B.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,B.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,B.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t,style:[N.input,t.multiline&&{minHeight:70,textAlignVertical:'top'},t.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,B.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,B.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,B.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,B.jsxs)(O,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,B.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,B.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,B.jsxs)(O,{gap:10,children:[(0,B.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,B.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,B.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,B.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,B.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,B.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w}){const{height:W}=(0,x.default)(),k=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},S=(0,r.useTyping)(),I=(0,r.useVisibleArea)(),D=S&&I&&I.height({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,B.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,R?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,B.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,B.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,B.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,B.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,B.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]);const R=['kirkton','abbotsford'].includes(k.VENUE_RID),D='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(D&&('semibold'===l||'bold'===l)&&!j);return(0,B.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,B.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,B.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),A=e=>(0,B.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??D});function z({title:e,back:t=!0,right:r,subtitle:o}){return(0,B.jsxs)(p.default,{style:N.brandBar,children:[(0,B.jsxs)(p.default,{style:N.row,children:[(0,B.jsx)(p.default,{style:N.brandSide,children:t?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,B.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,B.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,B.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,B.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,B.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,B.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,B.jsx)(A,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function v(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,B.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,B.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function F({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,B.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,B.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,B.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function H({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,B.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,B.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function E({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,B.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,B.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,B.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}A.statusLine=!0,F.centreRow=!0;const V=({phone:e})=>(0,B.jsx)(E,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),$=()=>(0,B.jsx)(E,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function O({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===H?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(D&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,B.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=D&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,B.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const _=()=>(0,B.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},817,[1205,835,1376,873,805,878,31,240,257,123,264,152,47,272,128,288,290,824,1375,1377,5,807,867,25]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ALLERGENS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"allergenLabel",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEVERITIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"severityLabel",{enumerable:!0,get:function(){return s}}),e.effectiveAllergens=function(l,n=[]){const t={...l.allergens};for(const s of l.optionGroups??[])for(const l of s.choices)if(n.includes(l.id)&&l.allergens)for(const[n,s]of Object.entries(l.allergens))'contains'!==t[n]&&(t[n]=s);return t},e.conflictsFor=function(l,n){const t=[],s=[];for(const a of n)'contains'===l[a.allergen]?t.push(a.allergen):'may'===l[a.allergen]&&s.push(a.allergen);return{contains:t,may:s}},Object.defineProperty(e,"hasConflict",{enumerable:!0,get:function(){return a}});const l=[{id:'gluten',label:'Cereals containing gluten',short:'Gluten'},{id:'crustaceans',label:'Crustaceans',short:'Crustaceans'},{id:'molluscs',label:'Molluscs',short:'Molluscs'},{id:'eggs',label:'Eggs',short:'Eggs'},{id:'fish',label:'Fish',short:'Fish'},{id:'peanuts',label:'Peanuts',short:'Peanuts'},{id:'treenuts',label:'Tree nuts',short:'Tree nuts'},{id:'soya',label:'Soya',short:'Soya'},{id:'milk',label:'Milk',short:'Milk'},{id:'celery',label:'Celery',short:'Celery'},{id:'mustard',label:'Mustard',short:'Mustard'},{id:'sesame',label:'Sesame',short:'Sesame'},{id:'sulphites',label:'Sulphur dioxide / sulphites',short:'Sulphites'},{id:'lupin',label:'Lupin',short:'Lupin'}],n=n=>l.find(l=>l.id===n)?.short??n,t=[{id:'intolerance',label:'Intolerance'},{id:'allergy',label:'Allergy'},{id:'coeliac',label:'Coeliac disease'},{id:'anaphylaxis',label:'Severe \u2014 anaphylaxis risk'}],s=l=>t.find(n=>n.id===l)?.label??l;const a=l=>l.contains.length>0||l.may.length>0},818,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"gbp",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return n}});const t=t=>`\xa3${(t/100).toFixed(2)}`,n=t=>Math.round(100*t)},819,[]); +__d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSlotMinutesOf=s,e.bookingNoticeMinsOf=r,e.bookingCoversPerStartOf=u,e.bookingPartiesPerStartOf=l,e.onlinePartyBounds=c,Object.defineProperty(e,"COVERS_WINDOW_MINS",{enumerable:!0,get:function(){return f}}),e.coversInHalfHour=m,e.countInStartSlot=p,e.bookingLimitsHint=function(t){const n=s(t),o=u(t),f=l(t),m=r(t),p=c(t);if(null!=o||null!=f){const t=[];return null!=o&&null!=f?t.push(`up to ${o} people and ${f} bookings at each start time`):null!=o?t.push(`up to ${o} people at each start time`):t.push(`up to ${f} bookings at each start time`),(p.max<100||p.min>1)&&t.push(`parties of ${p.min} to ${p.max}`),t.push(`from ${m} minutes ahead`),t.push('table rules still apply'),`Times are every ${n} minutes: ${t.join(', ')}.`}return`Times are every ${n} minutes. Covers per slot (${t.settings.bookingCoversPerSlot} per half hour) and table rules still apply.`},e.takeawaySlots=function(o,s,r){const u=(0,t.hoursFor)(o,r);if(!u)return[];const l=o.settings.slotMinutes,c=(0,n.addMins)(r,o.settings.leadMins),f=[];for(let t=new Date(u.open);t<=u.close;t=(0,n.addMins)(t,l)){if(tn.restaurantId===o.id&&'takeaway'===n.type&&'cancelled'!==n.status&&n.slotTime&&new Date(n.slotTime).getTime()===t.getTime()).length;f.push({time:new Date(t),label:(0,n.hm)(t),taken:r,cap:o.settings.slotCap,full:r>=o.settings.slotCap})}return f},e.bookingSlots=function(c,f,d,h,k,M=()=>0){const y=(0,t.hoursFor)(c,f);if(!y)return[];const S=[],$=y.close,P=(0,o.lastFoodOn)(c,b(f)),v=P?(0,n.atTime)(f,P.time):$,I='drinks'===(0,o.afterLastFood)(c),O=s(c),C=r(c),N=u(c),T=l(c);for(let t=new Date(y.open);t<=$;t=(0,n.addMins)(t,O)){const o=(0,n.hm)(t),s=t>v;if(s&&!I)continue;const r=null!=N?p(d,o,O):m(d,o),u=(N??c.settings.bookingCoversPerSlot)-r,l=null!=T?p(M,o,O):0,f=null!=T?T-l:void 0,b=t.getTime()=1;S.push({time:o,left:u,available:!b&&u>=h&&y,past:b,...s?{drinksOnly:!0}:{},...null!=f?{partiesLeft:f,partiesCap:T}:{}})}return S};var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]);function s(t){const n=t.settings.bookingSlotMinutes;return 5===n||10===n||15===n||20===n||30===n?n:15}function r(t){const n=t.settings.bookingNoticeMins;return'number'==typeof n&&Number.isInteger(n)&&n>=0&&n<=1440?n:30}function u(t){const n=t.settings.bookingCoversPerStart;return'number'==typeof n&&Number.isInteger(n)&&n>0&&n<=200?n:null}function l(t){const n=t.settings.bookingPartiesPerStart;return'number'==typeof n&&Number.isInteger(n)&&n>0&&n<=50?n:null}function c(t){const n=t.settings.onlinePartyMin,o=t.settings.onlinePartyMax,s='number'==typeof n&&Number.isInteger(n)&&n>=1&&n<=100?n:1;return{min:s,max:'number'==typeof o&&Number.isInteger(o)&&o>=s&&o<=100?o:100}}const f=30;function m(t,o){const s=Math.floor((0,n.toMins)(o)/f)*f;let r=0;for(let o=0;o`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},820,[832,821,813]); +__d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"pad",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return n}}),e.venueYmd=function(t,u="Europe/London"){try{const n=new Intl.DateTimeFormat('en-CA',{timeZone:u,year:'numeric',month:'2-digit',day:'2-digit'}).format(t);if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n}catch{}return n(t)},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseYmd",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toMins",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fromMins",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"atTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"addMins",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"dayShort",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"dayLong",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"monthLong",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"niceDate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"niceDateYear",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"minsBetween",{enumerable:!0,get:function(){return P}});const t=t=>String(t).padStart(2,'0'),n=n=>`${n.getFullYear()}-${t(n.getMonth()+1)}-${t(n.getDate())}`;const u=n=>`${t(n.getHours())}:${t(n.getMinutes())}`,a=t=>{const[n,u,a]=t.split('-').map(Number);return new Date(n,u-1,a)},o=t=>{const[n,u]=t.split(':').map(Number);return 60*n+u},c=n=>`${t(Math.floor(n/60))}:${t(n%60)}`,d=(t,n)=>{const u=new Date(t);return u.setHours(0,0,0,0),u.setMinutes(o(n)),u},m=(t,n)=>new Date(t.getTime()+6e4*n),b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],y=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],f=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],l=['January','February','March','April','May','June','July','August','September','October','November','December'],p=t=>b[t.getDay()],s=t=>y[t.getDay()],O=t=>l[t],M=t=>`${b[t.getDay()]} ${t.getDate()} ${f[t.getMonth()]}`,j=t=>`${M(t)} ${t.getFullYear()}`,P=(t,n)=>Math.round((n.getTime()-t.getTime())/6e4)},821,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"repo",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=t.localRepositories},822,[1378,1074]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return Q.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return Q.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return Q.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return Q.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return Q.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return et}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ct}}),i.rotaReconcile=Dt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();de.useOwner.getState().chatMarkRead(e,{[t]:a});const s=de.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>de.useOwner.getState().chatSeen(t,e)),Qt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await De().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(de.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await De().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(de.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await De().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return de.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...vt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(me.PITCH)return Se.unlockCashUp(e,t,a);const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await De().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?le.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):le.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})),{ok:!0,until:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.readCashAudit=async function(e){if(me.PITCH)return Se.cashAudit(e);const t=Ue.getState().venueId;if(!t)return[];let a=De().from('cash_up_audit').select('at, action, changed_by_name, tbl, for_date, reason, old_row, new_row').eq('venue_id',t).order('at',{ascending:!1}).limit(50);e&&(a=a.eq('row_id',e));const{data:s,error:n}=await a;return n||!Array.isArray(s)?[]:s.map(e=>({at:String(e.at),action:String(e.action),by:String(e.changed_by_name??'\u2014'),tbl:String(e.tbl),forDate:e.for_date??void 0,reason:e.reason??void 0,changed:(0,A.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=Ue.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await De().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(ya.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=_a,i.readAccessLog=async function(){const e=Ue.getState().venueId;if(!e)return[];try{const{data:t}=await De().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ue.getState().venueId;if(!e)return[];const{data:t,error:a}=await De().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await De().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=ha.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await De().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return ha.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await De().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return ya}}),i.claimInvite=Na,i.makeChromeHandover=async function(){const e=Ue.getState();if(me.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await De().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Ke});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(me.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await De().rpc('claim_chrome_handover',{p_code:e,p_app:Ke});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),Le&&ja(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(me.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{Me();const{data:t,error:a}=await De().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(me.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await De().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),Le&&ja(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{Me(),await De().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Aa)}catch{}},i.signedInHereAs=async function(e){Me();const t=await L.kv.get(Aa,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return Me(),await L.kv.get(Ca,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ue.getState();if(!u.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==u.VENUE_UUID||e.staffRef!==C.useSession.getState().meId)return null;Me();const t=await L.kv.get(Ca,null);return t?(0,C.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ue.getState();if(!u.IS_WILDINGS||'staff'!==e.kind||e.venueId!==u.VENUE_UUID||e.staffRef!==C.useSession.getState().meId)return null;Me();const t=await L.kv.get(Ca,null);return t?(0,C.appUrl)('staff',t):null},i.forgetSignInHere=async function(){Me(),await L.kv.remove(Aa),await L.kv.remove(Ca),Ee({mode:'signin',perms:[]});try{await Ba()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ue.getState().venueId;if(me.PITCH||!s||'staff'!==Ue.getState().kind)return{ok:!0};if(!(0,ue.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await qa('approve_shift_swap',{p_venue:s,p_shift:e,p_to_ref:t,p_kind:a}),{ok:!0}}catch(e){return{ok:!1,message:String(e?.message??e).replace(/^.*?:\s*/,'')||'Not allowed'}}},i.claimInviteForSync=async function(e){const t=await Na(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(me.PITCH)return Se.reissueInvite(e);const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await De().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.currentStaffAppLinks=async function(e){const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return qa('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return qa('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return qa('staff_app_link_history',{p_venue:Ue.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await qa('revoke_staff_app_link',{p_venue:Ue.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(me.PITCH)return Se.linkPhones();const e=Ue.getState().venueId;if(!e||'staff'!==Ue.getState().kind)return{};try{const t=await qa('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(me.PITCH)return Se.resetPhone(e);const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return Number(await qa('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(me.PITCH)return Se.inviteStatus();const e=Ue.getState().venueId;if(!e)return{};const{data:t,error:a}=await De().rpc('invite_status',{p_venue:e});if(a||!Array.isArray(t))return{};const s={};for(const e of t)s[String(e.staff_ref)]={state:e.state,expiresAt:e.expires_at??void 0,usedAt:e.used_at??void 0,devices:Number(e.devices??0)};return s},i.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Ta();const{data:t,error:a}=await De().rpc(u.IS_QUEUED_VENUE?'claim_'+u.VENUE_RID+'_pairing_code':u.IS_GREENSIDE?'claim_greenside_pairing_code':u.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':u.IS_KIRKTON?'claim_kirkton_pairing_code':u.IS_WILDINGS?'claim_wildings_pairing_code':u.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':u.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)return{ok:!1,error:'That code was not accepted. It may have expired. Ask a manager for a new one.'};const n={kind:'device',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await L.kv.set(Oa,n),ja(),{ok:!0,venueName:s.venue_name}}catch(e){const t=String(e?.message??e);return/fetch|network/i.test(t)?{ok:!1,error:'No connection. Check the tablet\u2019s Wi-Fi and try again.'}:/rate|too many/i.test(t)?{ok:!1,error:'Too many tries from this network. Wait a little and try again.'}:{ok:!1,error:/valid|switched off/i.test(t)?t:`Couldn\u2019t pair: ${t}`}}},i.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Ta();const{data:e,error:t}=await De().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ka,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:Pa(e)}}},i.carPairPoll=async function(e){try{Me();const t=e??await L.kv.get(Ka,null);if(!t)return'unknown';const{data:a,error:s}=await De().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,Y.carPairApproved)(n)){const e=(0,Y.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Oa,null);await L.kv.set(Oa,e),await L.kv.remove(Aa),C.useSession.getState().meId&&C.useSession.getState().signOut(),de.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||ja()}return'revoked'!==i&&'unknown'!==i||await Ma(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{Me(),await De().rpc('car_sign_out')}catch{}await Ma(),await Ba();try{await De().auth.signOut({scope:'local'})}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await qa('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:Pa(e)}}},i.carList=async function(){const e=Ue.getState().venueId;if(!e)return[];return(await qa('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=Ue.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await qa('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:Pa(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Oa),await Ba();try{await De().auth.signOut()}catch{}Ee({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Aa),await L.kv.remove(Ca),await Ba();try{await De().auth.signOut()}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'Disconnected. Open your personal invite link to connect again.'})},i.wipeThisDevice=async function(e={}){try{await Ba()}catch{}try{(0,K.isSupabaseConfigured)()&&await De().auth.signOut({scope:'local'})}catch{}let t=0;try{const e='undefined'!=typeof navigator?navigator:null,t=await(e?.serviceWorker?.getRegistration?.()),a=await(t?.pushManager?.getSubscription?.());a&&await a.unsubscribe()}catch{}for(const e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${u.VENUE_RID}:`)):(0,O.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!u.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This device has been wiped.'}),!1!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=xa,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return qa}}),i.mendSession=Fa,i.startAppSync=async function(e=u.VENUE_RID){if(u.IS_ISOLATED_VENUE&&e!==u.VENUE_RID)return;if(Le)return;Le=!0,$a=e,'customer'===Ke&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(Me(),'customer'!==Ke){const t=e=>new Promise(t=>{try{if(!e?.persist||e.persist.hasHydrated())return t();const a=e.persist.onFinishHydration(()=>{a?.(),t()});setTimeout(t,3e3)}catch{t()}}),a='chef'===Ke&&(0,w.isAnchorage)(e)?[z.useStore,de.useOwner,re.useKitchen,oe.useSafety,ae.useCardStore,S.useGpCalc,se.useOrderSheets,y.useSpecials,D.useHr]:[z.useStore,de.useOwner,re.useKitchen];if(await Promise.all(a.map(t)),'chef'===Ke&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ee({mode:'offline',message:'Saved kitchen data could not be backed up. Nothing was cleared. Free some device storage, then reopen.',lastError:'Legacy kitchen archive not ready'});try{await Cs(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ee({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ee({mode:'off'});$.mutationQueue.subscribe(()=>{const e=$.mutationQueue.waiting,t=e[0];Ee({pending:$.mutationQueue.pending.length,failed:$.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,j.describeWrite)(t)}: ${(0,j.plainReason)({...t.lastErr},'retry')}`:void 0})}),$.mutationQueue.onFailed(e=>Ee({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:$.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,j.describeWrite)(e),why:'conflict'===e.reason?(0,j.plainReason)({code:'conflict'},'refused'):(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),qe.push((0,P.onConnectivity)(e=>Ee({mode:e?Ue.getState().venueId?'live':Ue.getState().mode:Ue.getState().venueId?'offline':Ue.getState().mode}))),await Wa()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return Ga}}),i.serverOrder=es,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ts}}),i.nudgeGuestSync=function(){as?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return ss}}),i.stockSaveBlocker=ns,i.stockEventStatus=function(e){if(et(e))return{state:'saved'};const t=$.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,j.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=is,i.saveStockEventsNow=rs,i.bookingSaveBlocker=ds,i.resendUnsavedBookings=ls,i.saveBookingsNow=fs,i.waitForBookingSave=function(e,t=12e3){if(!Ne())return Promise.resolve({state:'local'});const a=ds();if(a)return Promise.resolve({state:'refused',why:a});const s=us()[0]?.venueId??'',n=()=>os.some(t=>$.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,P.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push($.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push($.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||us().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||us().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=Ss,i.tempLogState=function(){const e=hs()[0]?.venueId??'',t=hs().find(e=>'temp_readings'===e.spec.table),a=$.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!$.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(H.useTempSaves.getState().notSaved),i=oe.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ys,i.waitForTempSave=function(e,t,a=1e4){if(!Ne()||!hs().length)return Promise.resolve({state:'local'});const s=Ss(e);if(s)return Promise.resolve({state:'refused',why:s});const n=hs()[0]?.venueId??'',i=hs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>H.useTempSaves.getState().notSaved[(0,H.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>$.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=ks,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Ls}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=qs.get(a);if('customer'!==Ke||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():qs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),qa('public_day',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:Fe(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:Fe(a.from_time),to:Fe(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),qs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Ls.setState(e=>({n:e.n+1}))}).catch(()=>{const e=qs.get(a);e&&!e.ok&&qs.delete(a)}));const n=qs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ue.getState().venueId;if(!n||'staff'!==Ue.getState().kind)throw new Error('Connect to your venue first.');const i=await qa('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ue.getState().venueId;if(!e||'staff'!==Ue.getState().kind)return null;return(await qa('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');await qa('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),S=t(r[10]),h=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),K=t(r[27]),P=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),L=t(r[32]),B=t(r[33]),j=t(r[34]),F=t(r[35]),$=t(r[36]),W=t(r[37]),H=t(r[38]),Q=t(r[39]),V=t(r[40]),G=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),Se=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(a){if('default'!==a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,t})(_e),he=t(r[64]),ye=t(r[65]),we=t(r[66]),ve=t(r[67]),be=t(r[68]),ke=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]);const De=()=>(0,N.getSupabase)();$.mutationQueue.setExecutor(B.executeMutation),(0,x.setClockServer)(()=>'staff'===Ue.getState().kind);const Ue=(0,T.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ee=e=>Ue.setState(e),Te=e=>{const t=Ue.getState().perms;return t.includes('*')||t.includes(e)},Ne=()=>{const e=Ue.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ue.subscribe(()=>(0,Re.setLiveData)(Ne()));let Ke=Z.IS_CAR?'car':Z.APP_VARIANT,Pe=!1;const Me=()=>{Pe||((0,L.setSyncNamespace)(Ke),Pe=!0)};let xe=[],qe=[],Le=!1;const Be=()=>(new Date).toISOString().slice(0,10),je=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),Fe=e=>e?e.slice(0,5):'',$e=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],We=e=>JSON.parse(JSON.stringify(e));function He(e,t){const a=je(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write')),filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=We(e);if(t)return{id:e.id,venue_id:a,walk_date:e.date,arrived_at:e.seatedAt??e.createdAt,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:$e(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,ue.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:$e(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Qe(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>'guest'!==Ue.getState().kind,filter:e=>e.gte('created_at',t),inWindow:e=>e.createdAt>=t,toRow:(e,t)=>({id:e.id,venue_id:t,ref:e.ref,customer_id:(0,ue.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:We(e.lines??[]),allergies:$e(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:We(e.allergyChain??{}),readiness:We(e.readiness??{}),allergy_ticks:We(e.allergyTicks??{}),handover_check:e.handoverCheck?We(e.handoverCheck):null,accepted:e.accepted?We(e.accepted):null,doc:We(e)}),fromRow:t=>t.doc&&'object'==typeof t.doc?{...t.doc,id:String(t.id),restaurantId:e,status:t.status??t.doc.status}:null,apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Ve(e){const t=je(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...X.useBlocks.getState().blocks,...X.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==Ue.getState().kind,filter:e=>e.gte('block_date',t),inWindow:e=>e.date>=t,toRow:(e,t)=>({id:e.id,venue_id:t,block_date:e.date,from_time:e.from,to_time:e.to,reason:e.reason??null,note:e.note??null,area_id:e.areaId??null,area_name:e.areaName??null,created_by:e.by,created_at:e.createdAt,doc:We(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,X.blockClock)(t.from_time)??a?.from,n=(0,X.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>X.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>X.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ge=null,Je='Main plan';function ze(e){const t=e=>We({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ee.useFloor.getState().plans[e]??(0,ee.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Te('floor.manage')||Te('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ge??(0,Oe.uuidFrom)(`plan:${a}`),venue_id:a,name:Je||'Main plan',is_active:!0,...t(e),updated_by:(0,Y.actorStamp)({isCar:Z.IS_CAR,kind:Ue.getState().kind,staffRef:Ue.getState().staffRef,fallback:Ke})}),fromRow:e=>(Ge=String(e.id),Je=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,Ae.withSeedBest)(e,t[0]):void 0;a&&ee.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ee.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Ze(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>te.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Te('stock.manage'),matchKey:e=>({key:e}),toRow:(e,t)=>({venue_id:t,key:e.key,name:e.name,plural:e.plural,unit:e.unit,low_at:e.lowAt,supplier_id:e.supplierId?(0,ue.isUuid)(e.supplierId)?e.supplierId:(0,Oe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),fromRow:e=>{return{key:e.key,name:e.name,plural:e.plural,unit:e.unit,lowAt:Number(e.low_at),icon:e.icon??'\u2022',sort:e.sort??0,active:!1!==e.active,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),lt.get(t)??t)}:{}};var t},apply:(t,a)=>te.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.get(e.key)??e),o=new Set(r.map(e=>e.key));return{items:{...s.items,[e]:[...r,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>te.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Ye=new Set,Xe=new Set;$.mutationQueue.onDone(e=>{'stock_events'===e.table&&Xe.add(e.rowKey)});const et=e=>Xe.has(e)||Ye.has(e),tt=()=>Te('*')||Te('staff.manage')||Te('recipes.edit')||Te('recipes.signoff'),at=()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write'));function st(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>te.useShellStore.getState().events.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,ue.isUuid)(t.id)&&!!(te.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write')),filter:e=>e.gte('at',t).order('at',{ascending:!1}),inWindow:e=>e.at>=t,toRow:(e,t)=>({id:e.id,venue_id:t,item:e.kind,delta:e.delta,reason:e.reason,undoes:e.undoes&&(0,ue.isUuid)(e.undoes)&&(et(e.undoes)||$.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Ye.add(String(t.id)),{id:String(t.id),rid:e,kind:t.item,delta:Number(t.delta),reason:t.reason,by:t.by_name??'',app:t.app??'',at:new Date(t.at).toISOString(),...t.undoes?{undoes:String(t.undoes)}:{}}),apply:(e,t)=>te.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>te.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function nt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(te.useShellStore.getState().server[e]?.counts??{}).map(([e,t])=>({item:e,quantity:t})),key:e=>e.item,rowKey:e=>String(e.item),syncable:()=>!1,writable:()=>!1,toRow:()=>({}),fromRow:e=>({item:String(e.item),quantity:Number(e.quantity)}),apply:(a,s)=>{t={...te.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;te.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Ye]}}}))},afterRead:()=>{te.useShellStore.getState().server[e]||te.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Ye]}}}))},subscribe:()=>()=>{}}}const it=new Set;function rt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ae.useCardStore.getState().cards.filter(t=>t.restaurantId===e).map(e=>({card:e,item:t.find(t=>t.id===e.menuItemId)}))},key:e=>e.card.id,rowKey:e=>String(e.id),syncable:t=>(0,ue.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Te('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Oe.photoPath)(a,s),t=ot(s.photo);t&&((0,ae.cachePhotoAs)(e,t),dt(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Oe.cardToRow)(s,a);return{...i,...r,doc:We({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(a.card))return null;const s=t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:new Date(t.signed_off_at).toISOString()}:null;return{card:{...a.card,id:String(t.id),restaurantId:e,signOff:s&&a.card.signOff?a.card.signOff:s,...t.photo_url?{photo:t.photo_url}:{}},item:a.item?{...a.item,restaurantId:e,signOff:(0,w.isAnchorage)(e)&&(0,w.demoActor)(a.item.signOff?.by)?null:a.item.signOff}:void 0}},supersededBy:(e,t)=>t.some(t=>t.card.menuItemId===e.card.menuItemId&&t.card.id!==e.card.id),apply:(e,t)=>{if(!Te('recipes.edit')&&t.length){const e=new Set(t);ae.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ae.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),r=t.cards.filter(e=>!a.has(e.id)&&(s.has(e.id)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=ae.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ot=e=>(0,ae.readLocalPhoto)(e);async function dt(e,t){if(!it.has(e)){it.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await De().storage.from(Oe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){it.delete(e),Ee({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const ut=new Map,ct=(0,T.create)(()=>({n:0}));(0,ae.setStoragePhotoResolver)(e=>{const t=ut.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ue.getState().mode?(t||(ut.set(e,{url:'',at:Date.now()}),De().storage.from(Oe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(ut.set(e,{url:t.signedUrl,at:Date.now()}),ct.setState(e=>({n:e.n+1})),ae.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const lt=new Map;const ft=(e,t)=>{const a=(0,ue.isUuid)(t)?t:(0,Oe.uuidFrom)(`sup:${e}:${t}`);return lt.set(a,t),a};function pt(e){return{name:'order_sheets',table:'suppliers',list:()=>se.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Te('suppliers.manage'),toRow:(e,t)=>({id:ft(t,e.id),venue_id:t,name:e.name||'Supplier',category:e.goods||null,contact:e.contact??null,phones:e.number?[e.number]:[],website:e.url||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,notes:e.notes||null,doc:{kind:'sheet',localId:e.id,sheet:We(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(lt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>se.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.get(e.id)??e),o=new Set(r.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...r,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>se.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,ue.isUuid)(e)?e:(0,Oe.uuidFrom)(`sup:${Ue.getState().venueId}:${e}`)})}}let gt=!1,mt=!1;const _t=new Map,St=new Map,ht=new Map,yt=new Map,wt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',vt=e=>'owner'===e?{role:'owner',level:'Owner'}:'manager'===e?{role:'manager',level:'Manager'}:'supervisor'===e?{role:'manager',level:'Supervisor'}:'head_chef'===e?{role:'staff',level:'Head Chef'}:{role:'staff',level:'Staff'},bt=(e,t)=>({...e,managerAccess:t}),kt=()=>({nickname:gt,display:mt}),It=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=bt({role:e.role,level:e.level??vt(wt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},kt())};const Rt=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ot=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},At=e=>{const t=de.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,c.isKitchenTeam)(t)},Ct=2e3;function Dt(e,t){return t||!e.length||e.length>=Ct?null:e=>(0,ue.isUuid)(e.id)}function Ut(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Dt(t,Te('rota.manage')):null,keepOnEmpty:()=>e&&!Te('rota.manage'),list:()=>de.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&_t.has(e.staffId)&&(Te('rota.manage')||At(e.staffId)),writable:()=>Te('rota.manage')||Te('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(Rt());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ot(e.start),end_time:Ot(e.end),published:!!e.published,doc:We(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Et(){const e=je(62),t=e=>Te('rota.manage')||e.staffId===Ue.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>de.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ue.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=je(2)&&e.staffId===Ue.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:We(e.breaks??[]),break_mins:e.breakMins??0,doc:We((0,v.privateAttendance)(u.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(u.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Tt(){const e=je(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>de.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&e.staffId===Ue.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ue.getState().kind,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,ue.isUuid)(e.attendanceId)?e.attendanceId:null,kind:e.kind,suggested_in:e.suggestedIn??null,suggested_out:e.suggestedOut??null,note:(e.note??'').slice(0,300)||null,status:'open',doc:We({...e,status:'open'})}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),date:String(e.work_date).slice(0,10),attendanceId:e.attendance_id?String(e.attendance_id):t.attendanceId,kind:e.kind,suggestedIn:e.suggested_in?new Date(e.suggested_in).toISOString():void 0,suggestedOut:e.suggested_out?new Date(e.suggested_out).toISOString():void 0,note:e.note??'',at:t.at??new Date(e.created_at).toISOString(),status:e.status,resolvedBy:e.resolved_by_name??void 0,resolvedAt:e.resolved_at?new Date(e.resolved_at).toISOString():void 0}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Nt(e){de.leaveRemote.decide=t=>!(!Te('rota.manage')||!(0,ue.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&($.mutationQueue.enqueue({table:'staff_leave',venueId:e,kind:'rpc',fn:'staff_leave_decide',rowKey:t.id,values:{p_id:t.id,p_status:t.status}}),!0),qe.push(()=>{de.leaveRemote.decide=null})}function Kt(e){de.timesheetRemote.send=(t,a)=>{if(!Te('rota.manage')||!(0,ue.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return $.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:We(s)}}),!0}const s=a;if('attendance_void'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&($.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:We(s.breaks??[]),p_reason:n,p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0},qe.push(()=>{de.timesheetRemote.send=null})}function Pt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('created_at',new Date(Date.now()-2592e6).toISOString()),inWindow:()=>!1,toRow:(e,t)=>{return{id:(a=e.id,(0,ue.isUuid)(a)?a:(0,Oe.uuidFrom)(`outbox:${a}`)),local_id:e.id,venue_id:t,channel:e.channel,kind:e.kind,to_address:e.to||'',to_name:e.toName||null,subject:e.subject??null,body:e.body,html:e.html??null,ref_type:e.refType,ref_id:(0,ue.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:We(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.useStore.setState(t=>{const a=new Set(t.outbox.map(e=>e.id));return{outbox:[...e.filter(e=>!a.has(e.id)),...t.outbox].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,300)}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const Mt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function xt(e,t){if(!Array.isArray(t))return;const a=t.filter(e=>e&&'string'==typeof e.id&&'string'==typeof e.date&&'string'==typeof e.title).map(t=>({...t,restaurantId:e,example:!1}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function qt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[We({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ee.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:Mt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Te('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...Bt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...Bt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...Bt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Lt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Lt=t.feature_flags??{},Bt=t.settings??{};const a=t.settings?.app?.restaurant;if(!a)return null;const s='string'==typeof t.settings?.whatsapp?t.settings.whatsapp:void 0;return s&&!a.settings?.whatsapp&&(a.settings={...a.settings,whatsapp:s}),We({restaurant:{...a,id:e},msgTemplates:t.settings?.ops?.msgTemplates??{},display:t.settings?.ops?.display??{},games:!1!==t.feature_flags?.games,...Array.isArray(t.settings?.app?.events)?{events:t.settings.app.events}:{}})},apply:t=>{const a=t[0];a&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,p.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&ee.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&xt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ee.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Lt=null,Bt=null;const jt=()=>new Date(Date.now()-2592e6).toISOString(),Ft=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>_t.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},$t=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,ve.dmId)(t[0],t[1]):null},Wt=()=>Ue.getState().perms.includes('*');function Ht(){const e=()=>Ue.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>de.useOwner.getState().chat.filter(e=>(0,ue.isUuid)(e.id)).map(e=>We({id:e.id,ch:e.ch,from:e.from,text:e.text,photo:e.photo,at:e.at,removed:!!e.removed})),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>!!Ft(t.ch)&&(t.from===e()||Wt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('created_at',jt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=jt(),toRow:(e,t)=>{const a=Ft(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:_t.get(e.from)??null;return{id:e.id,venue_id:t,channel:a,from_staff:s,body:e.text??null,photo:e.photo??null,removed:e.removed,created_at:e.at}},fromRow:e=>{const t=$t(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?We({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>de.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=$t(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=de.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,ve.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,be.soundAllowed)())try{(0,be.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Qt(e,t,a){const s=Ue.getState();if(!we.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=_t.get(e),i='*'===t?'*':Ft(t);if(n&&i)try{await De().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Vt(e){const t=Ue.getState().staffRef,a=t?_t.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await De().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':$t(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&de.useOwner.getState().chatMarkRead(t,i)}catch{}}function Gt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=U.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:We(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:We(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'break_rules'===e.kind?'break_rules':'reminder',doc:e.doc??{}}),apply:(t,a)=>U.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[e];const o=new Map(t.filter(e=>'reminder'===e.kind).map(t=>[t.id,{...t.doc,id:t.id,rid:e}])),d=s.reminders.filter(e=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>U.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function Jt(e){const t=je(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>U.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.reminderId)&&e.staffRef===Ue.getState().staffRef,writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('for_date',t).order('done_at',{ascending:!1}),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,reminder_id:e.reminderId,for_date:e.forDate,staff_ref:e.staffRef,staff_name:e.staffName.slice(0,80),done_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,reminderId:String(t.reminder_id),forDate:String(t.for_date).slice(0,10),staffRef:t.staff_ref??'',staffName:t.staff_name??'Team',at:new Date(t.done_at).toISOString()}),apply:(e,t)=>U.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>U.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function zt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Zt=e=>null==e||''===e?null:Number(e),Yt=e=>e.filter(e=>!e.startsWith('data:')),Xt=()=>Te('takings.view');function ea(e){const t=!Xt();return{name:'cash_ups',table:'cash_ups',list:()=>le.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,k.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,k.tradingDay)()&&!e.onServer),writable:()=>Te('wages.manage')||(0,b.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,k.tradingDay)()):e.gte('for_date',je(400)),...t?{inWindow:e=>e.date===(0,k.tradingDay)()}:{},toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:We(e.vals),cash_tips:'number'==typeof e.vals.cashTips?e.vals.cashTips:null,card_tips:'number'==typeof e.vals.cardTips?e.vals.cardTips:null,photos:Yt(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,date:String(t.for_date),vals:t.vals??{},photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>le.useCashUp.setState(s=>({cashUps:zt(s.cashUps,t.map(e=>{const t=s.cashUps.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function ta(e){return{name:'sales_reports',table:'sales_reports',list:()=>le.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Te('wages.manage')||(0,b.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:We(e.vals),categories:e.categories,photos:Yt(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,weekStart:String(t.week_start),vals:t.vals??{},categories:t.categories??[],photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>le.useCashUp.setState(s=>({sales:zt(s.sales,t.map(e=>{const t=s.sales.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function aa(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=le.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,le.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Te('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:We({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,le.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>le.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function sa(e){return{name:'day_tips',table:'day_tips',list:()=>le.useCashUp.getState().tips.filter(t=>t.rid===e).map(e=>({...e,id:e.date})),key:e=>e.id,rowKey:e=>String(e.for_date),syncable:()=>!1,writable:()=>!1,deletes:!1,filter:e=>e.gte('for_date',je(120)),toRow:()=>({}),fromRow:t=>({id:String(t.for_date),rid:e,date:String(t.for_date),total:Number(t.total),postedAt:String(t.posted_at),postedBy:t.posted_by??void 0}),apply:t=>le.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function na(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>le.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('wages.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,for_date:e.forDate??null,through_date:e.throughDate??null,amount:e.amount,reason:e.reason??null,by_name:e.by,at:e.at}),fromRow:t=>({id:String(t.id),rid:e,kind:'payout'===t.kind?'payout':'correction',forDate:t.for_date??void 0,throughDate:t.through_date??void 0,amount:Zt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>le.useCashUp.setState(s=>({pot:zt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function ia(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=le.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Te('wages.manage'),toRow:(e,t)=>({venue_id:t,show_today:e.showToday,show_pot:e.showPot,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'show',showToday:!1!==e.show_today,showPot:!1!==e.show_pot}),apply:t=>le.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function ra(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>ce.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:We(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ce.useNotifs.setState(s=>({items:zt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ce.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function oa(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=fe.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:We(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:We(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings')||Te('suppliers.order'),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'settings'===e.kind?'settings':'list',doc:e.doc??{}}),apply:(t,a)=>fe.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...pe.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:zt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function da(e){const t=()=>Te('venue.settings')||Te('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>fe.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,ue.isUuid)(a.id)&&(0,ue.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,fe.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ue.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:Ue.getState().staffRef)||null,doc:We(n),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),listId:String(t.list_id),status:t.status??'open',rid:e}),apply:(t,a)=>fe.useOrderLists.setState(s=>({items:zt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){const t=je(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>fe.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings')||Te('suppliers.order'),filter:e=>e.gte('finished_at',t).order('finished_at',{ascending:!1}).limit(300),toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,list_id:e.listId,finished_at:e.finishedAt,finished_by:e.finishedByName.slice(0,80),doc:We(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useOrderLists.setState(s=>({history:zt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function ca(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=ge.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:We(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Te('venue.settings'),toRow:(e,t)=>({venue_id:t,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'area',doc:e.doc??{}}),apply:t=>{const a=t[0];a&&ge.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>ge.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function la(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=he.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,he.libraryRowId)(e),kind:'library',doc:We({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,he.personRowId)(e,i),kind:'person',staffRef:i,doc:We({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=de.useOwner.getState().staff.find(e=>e.id===Ue.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=de.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ye.canEditTasks)(t,a)},writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,staff_ref:e.staffRef??null,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'library'===e.kind?'library':'person',staffRef:e.staff_ref??void 0,doc:e.doc??{}}),apply:t=>he.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,he.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>he.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function fa(e){const t=je(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>he.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ue.getState();return e.byRef===t.staffRef||Te('staff.manage')},writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('for_date',t),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffRef,task_id:e.taskId,for_date:e.forDate,ticked_by_ref:e.byRef,ticked_by_name:e.byName.slice(0,80),ticked_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,staffRef:String(t.staff_ref),taskId:String(t.task_id),forDate:String(t.for_date).slice(0,10),byRef:String(t.ticked_by_ref??''),byName:String(t.ticked_by_name??''),at:String(t.ticked_at)}),apply:(t,a)=>he.useDailyTasks.setState(s=>({ticks:zt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>he.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function pa(e,t=!1){const a=je(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ke.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ue.getState().kind||Te('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Oe.uuidFrom)(`soldout:${a}:${e.itemId}`),venue_id:a,item_id:e.itemId.slice(0,80),name:e.name.slice(0,120),is_on:e.on,marked_at:e.at,by_name:(e.by||'Staff').slice(0,80),clear_after:e.clearAfter??null,...t?{auto:!!e.auto,kept:!!e.kept}:{}}),fromRow:a=>({rid:e,itemId:String(a.item_id),name:String(a.name??''),on:!0===a.is_on,at:String(a.marked_at),by:String(a.by_name??''),clearAfter:a.clear_after?String(a.clear_after):void 0,...t?{auto:!0===a.auto,kept:!0===a.kept}:{}}),apply:(t,a)=>ke.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ke.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Ie.autoSync.soldOutRead.add(e)}}}function ga(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Ie.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:(0,Oe.uuidFrom)(`soldoutlink:${t}:${e.itemId}`),venue_id:t,item_id:e.itemId.slice(0,80),uses:e.uses.slice(0,10).map(e=>({key:String(e.key).slice(0,40),qty:Math.max(0,Math.min(99,Number(e.qty)||0))})),auto:!!e.auto,updated_at:e.at,updated_by:(e.by||'Staff').slice(0,80)}),fromRow:t=>({rid:e,itemId:String(t.item_id),uses:(Array.isArray(t.uses)?t.uses:[]).map(e=>({key:String(e.key??''),qty:Number(e.qty)||0})).filter(e=>e.key&&e.qty>0),at:String(t.updated_at??''),by:String(t.updated_by??''),...!0===t.auto?{auto:!0}:{}}),apply:(t,a)=>Ie.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>Ie.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Ie.autoSync.linksRead.add(e)}}}async function ma(e,t="*"){const a='*'===t?`table:${e}`:`table:${e}.${t}`;try{const s=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:n}=await Promise.race([De().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function _a(){const e=Ue.getState().venueId;if(e)try{const{data:t}=await De().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();ya.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const ha=new Map;const ya=(0,T.create)(()=>({live:!1,known:!1}));async function wa(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([De().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function va(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([De().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const ba=(e,t)=>We({id:String(e.id),venue:t,body:String(e.body??''),kind:'yesno'===e.kind?'yesno':'up',up:Number(e.up_count??0),yes:Number(e.yes_count??0),no:Number(e.no_count??0),hidden:!!e.hidden,reply:e.reply??void 0,replyAt:e.reply_at??void 0,postedOn:String(e.posted_on??'').slice(0,10)}),ka='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Ia(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>D.useHr.getState().questions.filter(t=>t.venue===e&&(0,ue.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>ba(t,e),filter:e=>e.gte('posted_on',new Date(Date.now()-10368e6).toISOString().slice(0,10)),apply:(e,t)=>{const a=new Set(t);D.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>D.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Ra(e,t){const a=(t,a,s)=>{$.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(D.hrRemote,{live:!0,checkout:t=>a('hr_checkout',t.token,{p_venue:e,p_day:t.day,p_token:t.token,p_morale:t.morale,p_staffing:t.staffing,p_question:t.question??null,p_kind:t.kind??'up',p_shout_to:t.shoutTo??null,p_shout_body:t.shoutBody??null}),post:(t,s,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),vote:(e,t,s)=>a('hr_vote',e,{p_question:e,p_token:t,p_vote:s}),moderate:(e,t,s)=>a('hr_moderate',e,{p_question:e,p_action:t,p_reason:s}),reply:(e,t)=>a('hr_reply',e,{p_question:e,p_reply:t}),trend:async(t,a,s)=>{try{const{data:t,error:n}=await De().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?null:(t??[]).map(e=>({day:String(e.day).slice(0,10),answers:Number(e.answers),morale:Number(e.morale),staffing:null==e.staffing?null:Number(e.staffing),short:Number(e.short),perfect:Number(e.perfect),over:Number(e.over)}))}catch{return null}},shouts:async(a,s)=>{try{const{data:a,error:n}=await De().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?null:(a??[]).map(e=>({id:String(e.id),venue:t,day:String(e.day).slice(0,10),to:String(e.to_name),body:e.body??void 0}))}catch{return null}},log:async()=>{try{const{data:a,error:s}=await De().from('hr_mod_log').select('id,question_id,action,reason,by_name,at').eq('venue_id',e).order('at',{ascending:!1}).limit(30);return s?null:(a??[]).map(e=>({id:String(e.id),venue:t,questionId:String(e.question_id??''),action:e.action,reason:e.reason??void 0,by:String(e.by_name??'A manager'),at:String(e.at)}))}catch{return null}},refresh:async()=>{try{const{data:a,error:s}=await De().from('hr_questions').select(ka).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||D.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>ba(e,t)))}catch{}}}),qe.push(()=>{Object.assign(D.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Oa='pair:v1',Aa='staff:v1',Ca='staff:rejoin:v1';async function Da(e){const t=u.IS_QUEUED_VENUE?'claim_'+u.VENUE_RID+'_invite':u.IS_GREENSIDE?'claim_greenside_invite':u.IS_ABBOTSFORD?'claim_abbotsford_invite':u.IS_KIRKTON?'claim_kirkton_invite':u.IS_WILDINGS?'claim_wildings_invite':u.IS_KIRKMICHAEL?'claim_kirkmichael_invite':u.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:Ke,p_device:(0,C.deviceId)()},s=await De().rpc(t,{...a,p_phone:(0,C.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?De().rpc(t,a):s}async function Ua(){if('display'===Ke||'customer'===Ke||me.PITCH)return'none';const e=await L.kv.get(Ca,null);if(!e)return'none';try{await Ta();const{data:t,error:a}=await Da(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ca),await L.kv.remove(Aa),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Aa,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await L.kv.remove(Ca),'refused')}catch{return'offline'}}const Ea=e=>/jwt|refresh|token|401|not authenticated|invalid claim|session/i.test(String(e?.message??e))&&!/fetch|network/i.test(String(e?.message??e));async function Ta(){Me();const{data:e}=await De().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await De().auth.signInAnonymously();if(!t)return;const a=429===t.status||/rate|too many/i.test(t.message);if(!a||e>=2){if(a)throw new Error('Too many people are connecting from this network right now. Wait a few minutes, or switch to mobile data, and open the link again.');throw t}Ee({message:'Lots of people are connecting at once. Trying again in a moment\u2026'}),await new Promise(t=>setTimeout(t,0===e?15e3:45e3))}}async function Na(e){if(me.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await Da(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,u.venueKey)(`cc-pending-invite:${Ke}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),await L.kv.set(Ca,e),Le&&ja(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ee({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ka='car:request:v1',Pa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function Ma(){await L.kv.remove(Oa),await L.kv.remove(Aa),await L.kv.remove(Ka),C.useSession.getState().meId&&C.useSession.getState().signOut()}async function xa(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Ta(),!0}catch{return!1}}const qa=async(e,t={})=>{if(me.PITCH)return(0,_e.pitchRpc)(e,t);const{data:a,error:s}=await De().rpc(e,t);if(s)throw s;return a};let La=null;async function Ba(){for(const e of qe)try{e()}catch{}qe=[],xe.forEach(e=>e.stop()),xe=[],La&&(clearInterval(La),La=null)}async function ja(){await Ba(),await Wa()}async function Fa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Ke||me.PITCH)return!1;try{Me();const{data:e}=await De().auth.getSession();if(e.session){const{error:e}=await De().auth.refreshSession();if(!e)return!0}if('display'===Ke)return!1;if(!await L.kv.get(Ca,null))return!1;if(e.session)try{await De().auth.signOut({scope:'local'})}catch{}return'ok'===await Ua()&&(ja(),!0)}catch{return!1}}(0,l.setSessionMender)(Fa);let $a=u.VENUE_RID;async function Wa(){try{const e='undefined'!=typeof navigator?navigator.storage:null;e?.persist&&e.persist()}catch{}try{const e='undefined'!=typeof window?window.CoverChargeNative:null;e&&'function'==typeof e.checkUpdate&&/CoverChargePhone\//.test(navigator.userAgent)&&e.checkUpdate()}catch{}const e=$a;try{if(Ee({mode:'connecting'}),await $.mutationQueue.load(),'customer'===Ke)return void await za(e);let t=await L.kv.get(Oa,null),a=await L.kv.get(Aa,null);if(Z.IS_CAR&&!t&&a){const e=(0,Y.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Oa,t)),await L.kv.remove(Aa),a=null,C.useSession.getState().meId&&C.useSession.getState().signOut()}if(u.IS_ISOLATED_VENUE&&(t&&!(0,u.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,u.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ee({mode:'display'===Ke?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await De().auth.getSession();if('display'!==Ke&&!Z.IS_CAR&&a&&!s.session){const t=await Ua();if('offline'===t)return Ee({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{$a===e&&ja()},6e4);'refused'===t&&a.staffRef&&C.useSession.getState().meId===a.staffRef&&C.useSession.getState().signOut(),a=await L.kv.get(Aa,null),({data:s}=await De().auth.getSession())}const n='display'===Ke||Z.IS_CAR?t:a;if(!s.session||!n)return void Ee({mode:'display'===Ke||Z.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await qa('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Ke||Z.IS_CAR?await L.kv.remove(Oa):(await L.kv.remove(Aa),await L.kv.remove(Ca)),'staff'===n.kind&&n.staffRef&&C.useSession.getState().meId===n.staffRef&&C.useSession.getState().signOut(),void Ee({mode:'display'===Ke||Z.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Ke?'This display was unpaired by a manager.':Z.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,P.isOnline)()||/fetch|network/i.test(String(t?.message)))Ee({mode:'offline'});else if(Ea(t)&&'display'!==Ke){const{error:t}=await De().auth.refreshSession();t&&'ok'===await Ua()&&setTimeout(()=>{$a===e&&ja()},500)}i=Ue.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ee({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Z.IS_CAR&&'staff'===n.kind&&n.staffRef&&C.useSession.getState().meId!==n.staffRef&&(C.useSession.getState().signIn(n.staffRef),de.useOwner.setState({staffAs:n.staffRef})),Z.IS_CAR&&(C.useSession.getState().meId&&C.useSession.getState().signOut(),de.useOwner.setState({previewRole:'owner'})),await Qa(n.venueId,e,n.kind)}catch(e){Ee({mode:'local',lastError:String(e?.message??e)})}}const Ha=new Set(['venues','staff','bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_items','stock_events','stock_counts','recipe_cards','suppliers','supplier_orders','rota_shifts','attendance','time_requests','game_scores','floor_live','chat_messages','venue_reminders','reminder_done']);async function Qa(e,a,s){if(!(0,u.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Z.IS_CAR&&'device'===s;await ks(a),qe.push(xs(e));try{const{data:t}=await De().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])ht.set(e.key,e.id),yt.set(e.id,e.key)}catch{}const i=[qt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>de.useOwner.getState().staff.map(It),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Te('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,kt()),toRow:(e,t)=>(0,F.staffRow)(e,t,kt(),e.managerAccess||e.ownerAccess?null:ht.get(wt(e))),fromRow:e=>{if(!e.external_ref)return null;_t.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ns.set(String(e.external_ref),e.avatar_path??null);const t=bt(vt(yt.get(String(e.role_id))),!0===e.manager_access);return(0,F.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},kt())},apply:e=>de.useOwner.setState(t=>{const a=new Map(e.map(e=>[e.id,e])),s=t.staff.map(e=>a.has(e.id)?{...e,...a.get(e.id)}:e),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ms()},onRemote:()=>{Ms()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=de.useOwner.getState(),t=ie.useSetup.getState().sites[$a]?.staffGrade??{};return e.staff.filter(e=>_t.has(e.id)).map(a=>We({id:a.id,hourly:e.hourly[a.id]??null,salaried:!!a.salaried,noTax:!!a.noTax,grade:t[a.id]||void 0}))},key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>_t.has(e.id),writable:()=>Te('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:_t.get(e.id),venue_id:t,hourly_rate:null==e.hourly?null:e.hourly/100,salaried:e.salaried,no_tax:e.noTax,pay_grade:e.grade??null}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?We({id:t,hourly:null==e.hourly_rate?null:Math.round(100*Number(e.hourly_rate)),salaried:!!e.salaried,noTax:!!e.no_tax,grade:e.pay_grade||void 0}):null},apply:e=>de.useOwner.setState(t=>{const a={...t.hourly},s=new Map(e.map(e=>[e.id,e]));for(const t of e)null==t.hourly?delete a[t.id]:a[t.id]=t.hourly;if(e.length){const t=ie.useSetup.getState().sites[$a],a={...t?.staffGrade??{}};let s=!1;for(const t of e)(a[t.id]||void 0)!==t.grade&&(s=!0,t.grade?a[t.id]=t.grade:delete a[t.id]);s&&ie.useSetup.getState().patch($a,{staffGrade:a})}return{hourly:a,staff:t.staff.map(e=>s.has(e.id)?{...e,salaried:s.get(e.id).salaried,noTax:s.get(e.id).noTax}:e)}}),subscribe:e=>{const t=de.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=ie.useSetup.subscribe((t,a)=>{t.sites[$a]?.staffGrade!==a.sites[$a]?.staffGrade&&e()});return()=>{t(),a()}}},He(a,!1),He(a,!0),Ve(a),ze(a),Qe(a),Ze(a),st(a),nt(a),pt(a),{name:'supplier_directory',table:'suppliers',list:()=>de.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,name:e.name||'Supplier',category:e.category,contact:e.contact||null,phones:e.phones.filter(Boolean),email:e.email||null,website:e.website||null,account_ref:e.account||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,doc:{kind:'directory',localId:e.id,supplier:We(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>de.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.supplierId),writable:()=>Te('suppliers.order')||Te('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Be(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:We(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},rt(a),Us(a)];Te('wages.view')&&i.push(Es(a)),n&&(i.push(Ut(!0),Et(),Tt(),Pt(a)),Kt(e)),n&&await ma('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>de.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&/^\d{4}-\d{2}-\d{2}$/.test(e.from)&&/^\d{4}-\d{2}-\d{2}$/.test(e.to)&&e.to>=e.from&&(e.staffId===Ue.getState().staffRef&&'pending'===e.status||Te('rota.manage')),writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffId,from_date:e.from,to_date:e.to,reason:(e.reason??'').slice(0,200)||null,status:e.status,doc:We(e)}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),from:String(e.from_date).slice(0,10),to:String(e.to_date).slice(0,10),reason:e.reason??t.reason??'Holiday',status:e.status,by:e.requested_by_name??t.by,decidedBy:e.decided_by_name??void 0}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{leave:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ha.add('staff_leave'),Nt(e));const o=n&&await va();if(we.useChatSync.setState({synced:o,checked:!0}),qe.push(()=>we.useChatSync.setState({synced:!1})),o&&i.push(Ht(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(ve.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>_t.has(e.id),writable:()=>Te('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:_t.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:_t.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>ve.useKitchenExtra.setState(a=>{const s={...a.extra};return t.forEach(e=>{delete s[e]}),e.forEach(e=>{s[e.id]=e.include}),{extra:s}}),subscribe:e=>ve.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ma('hr_questions')&&(i.push(Ia(a)),Ha.add('hr_questions'),Ra(e,a)),'guest'!==s&&'customer'!==Ke&&await ma('temp_readings')&&(i.push((0,Q.tempUnitsSpec)(oe.useSafety,tt),(0,Q.tempReadingsSpec)(oe.useSafety,at)),Ha.add('temp_units'),Ha.add('temp_readings')),'guest'!==s&&'customer'!==Ke&&await ma('cooksafe_records')&&(i.push((0,V.cooksafeSpec)(oe.useSafety,G.useCookSafe,oe.isSeedAccident,at)),Ha.add('cooksafe_records')),'guest'!==s&&await ma('sold_out_items')?(i.push(pa(a,await ma('sold_out_items','auto'))),Ha.add('sold_out_items')):Ie.autoSync.soldOutRead.add(a),'guest'!==s&&await ma('sold_out_links')?(i.push(ga(a)),Ha.add('sold_out_links')):Ie.autoSync.linksRead.add(a),U.useReminders.getState().ensure(a),'guest'!==s&&await wa()&&(i.push(Gt(a)),n&&i.push(Jt(a))),ce.useNotifs.getState().ensure(a),fe.useOrderLists.getState().ensure(a),n){gt=await ma('staff','nickname'),mt=await ma('staff','display_clock');const[e,t,s,n]=await Promise.all([ma('scheduled_notifications'),ma('order_lists'),ma('venue_clock_area'),ma('daily_tasks')]);he.useDailyTasks.getState().ensure(a),n&&(i.push(la(a),fa(a)),Ha.add('daily_tasks'),Ha.add('daily_task_ticks')),e&&(i.push(ra(a)),_a()),t&&i.push(oa(a),da(a),ua(a)),s&&i.push(ca(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&Ha.add(n)}if('guest'!==s&&await ma('day_tips')){i.push(sa(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ha.add(e);await ma('tips_pot_events')&&i.push(na(a),ia(a)),n&&(Xt()||(0,le.forgetPastTakings)(a,(0,k.tradingDay)()),i.push(ea(a),aa(a)),Ha.add('cash_ups'),Xt()&&(i.push(ta(a)),Ha.add('sales_reports')),t(r[76])(r[75],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Ut(),Et()),await ma('scheduled_notifications')&&i.push(ra(a)));let d=!1;const c=()=>{if(Z.IS_CAR&&n&&Te('recipes.edit'))return!0;const e=de.useOwner.getState().staff.find(e=>e.id===Ue.getState().staffRef);return!!e&&e.active&&Te('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&c()&&await ma('ingredient_prices')&&(i.push((0,S.gpSyncSpec)('ing',c)),Ha.add('ingredient_prices'),await ma('card_costs')&&(i.push((0,S.gpSyncSpec)('card',c)),Ha.add('card_costs')),await ma('kitchen_deliveries')&&(i.push((0,S.gpSyncSpec)('del',c)),Ha.add('kitchen_deliveries')),await ma('kitchen_stock_counts')&&(i.push((0,S.gpSyncSpec)('count',c)),Ha.add('kitchen_stock_counts'))),(0,Ce.specialsSyncOn)()&&'guest'!==s&&await ma('specials_boards')&&(i.push((0,Ce.specialsBoardSpec)(a,()=>Te('recipes.edit')||Te('floor.manage')||Te('*'))),Ha.add('specials_boards'));const l={onActivity:()=>Ee({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ee({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ee({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await qa('whoami')??[]).some(t=>t.venue_id===e))return void($a===a&&ja());for(const a of xe){if(a.spec.name!==t)continue;const{count:s,error:n}=await De().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ds()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||H.useTempSaves.getState().mark({id:t,table:e,why:Ss(e)??'this screen could not send it'})}};xe=i.map(t=>new J.EntityBridge(t,e,l)),await Promise.all(xe.map(e=>e.start()));let f=0;const p=async()=>{if(!(f&&Date.now()-f<6e4)){f=Date.now();try{await g()}finally{f=0}}},g=async()=>{if(n&&(0,P.isOnline)())try{const t=await qa('whoami');if(!t?.some(t=>t.venue_id===e))return void($a===a&&ja())}catch(e){if(Ea(e)){if(Z.IS_CAR)return void($a===a&&ja());const e=await Ua();return void('ok'!==e&&'refused'!==e||$a===a&&ja())}}let t=0;for(const[a,s]of xe.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(we.useChatSync.getState().error&&we.useChatSync.setState({error:void 0}),await Vt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&we.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,P.setOnline)(!0),Ee({mode:'live',lastSyncAt:e,lastServerAt:e}),$.mutationQueue.flush()}else Ee({mode:'offline'});if(!Te('wages.view')){const e=Ue.getState().staffRef;de.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([p(),new Promise(e=>setTimeout(e,3e4))]);const m=new Map;for(const e of xe)m.set(e.spec.table,[...m.get(e.spec.table)??[],e]);const _=[...m.keys()].filter(e=>Ha.has(e)).map(e=>({table:e,venueColumn:m.get(e)[0].spec.venueColumn}));let y=!1;const w=(0,J.venueChannel)(e,_,(e,t,a)=>{for(const s of m.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ee({lastSyncAt:s,lastServerAt:s})},e=>{Ee({realtime:e}),'SUBSCRIBED'===e?(y&&p(),y=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(y=!0)});qe.push(()=>{De().removeChannel(w)}),qe.push((0,P.onConnectivity)(e=>{e&&p()}));const v=xe.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),b=(0,M.superviseSync)({fastMs:Ga(Ke),readFast:async()=>{for(const e of v)await e.read()},readAll:p,flush:()=>{$.mutationQueue.flush()},wake:()=>{$.mutationQueue.retryNow()},restart:()=>{$a===a&&ja()},realtime:()=>Ue.getState().realtime,lastServerAt:()=>{const e=Ue.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,P.setOnline)(!0),Ee({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Ea,refreshAuth:async()=>{await De().auth.refreshSession()},heartbeat:()=>Va(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});qe.push(b.stop)}async function Va(e){const t=Ue.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await qa('sync_heartbeat',{p_venue:e,p_device:(0,C.deviceId)()??'unknown',p_app:Ke,p_version:q.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const Ga=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ue.getState(),queue:$.mutationQueue.pending.map(e=>e.table),failedTables:$.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),me.PITCH&&(window.__ccSyncPreview=e=>Ee(e)));const Ja='guest:sent:v1';async function za(e){Ee({kind:'guest',venueSlug:e,perms:[]});try{const t=(await qa('public_venue',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!u.IS_ISOLATED_VENUE||t.id===u.VENUE_UUID)){Ee({venueId:t.id,venueName:t.name}),await ks(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,p.withWildingsAddress)({...a,id:e}):t)})),xt(e,t.app?.events)}await Za(e),Ee({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ee({mode:(0,P.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Za(e).catch(()=>{})},6e4);qe.push(()=>clearInterval(t)),u.IS_ISOLATED_VENUE||await Ya(e)}async function Za(e){const t=await qa('public_menu',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ae.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}});try{const t=await qa('public_takeaway_menu',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function Ya(e){let t=await L.kv.get(Ja,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,ue.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,ue.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await xa())return;for(const a of n)try{const s=(await qa('guest_create_booking',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_booking:{...We(a),...(0,R.takeGuard)(a.id),allergies:$e(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&z.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Ee({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await qa('guest_create_takeaway',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_order:{...We(a),...(0,R.takeGuard)(a.id),allergies:$e(a.allergies)}}))?.[0];t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?es(e,s):e)}))}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ee({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ts(s)}}:e)})))}await L.kv.set(Ja,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await qa('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ja,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await qa('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.useStore.setState(e=>({bookings:e.bookings.map(e=>{const a=t.get(e.id);return a&&a.status&&a.status!==e.status&&'declined'!==a.status?{...e,status:a.status}:'declined'===a?.status&&'cancelled'!==e.status?{...e,status:'cancelled'}:e}),orders:e.orders.map(e=>{const a=t.get(e.id);if(!a)return e;const s=es(e,a);return Xa(s)===Xa(e)?e:s})})),Ee({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ee({mode:(0,P.isOnline)()?Ue.getState().mode:'offline'})}finally{a=!1}}};qe.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),La=setInterval(()=>{n()},15e3),as=()=>{n()},n()}const Xa=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function es(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ts=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let as=null;const ss={bridges:()=>xe,restart:ja};function ns(){const e=Ue.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Te('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function is(){const e=xe.find(e=>'stock_events'===e.spec.table);if(!e||ns())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&($.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function rs(){const e=xe.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}is();try{await $.mutationQueue.retryNow()}catch{}}Ue.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{rs()},3e3)});const os=['bookings','walk_ins'];function ds(){const e=Ue.getState();return Ne()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Te('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const us=()=>xe.filter(e=>os.includes(e.spec.table)),cs=e=>$.mutationQueue.failed.some(t=>os.includes(t.table)&&t.rowKey===e);function ls(e=!1){return ds()?0:us().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&cs(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function fs(e=!1){const t=ds();if(t)return t;for(const e of us())try{await e.read()}catch{}ls(e);try{await $.mutationQueue.retryNow()}catch{}return e&&ps(),null}function ps(){const e=us()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(us().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||cs(s)||os.some(t=>$.mutationQueue.hasPending(t,e,s))||t.clear(s)}$.mutationQueue.onFailed(e=>{os.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),$.mutationQueue.onDone(e=>{os.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let gs=null;const ms=(e=2500)=>{gs&&clearTimeout(gs),gs=setTimeout(()=>{gs=null,fs(!1)},e)};(0,P.onConnectivity)(e=>{e&&ms()}),Ue.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Te('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&ms(3e3)});const _s=['temp_readings','temp_units'];function Ss(e="temp_readings"){const t=Ue.getState();return Ne()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||tt()?'device'!==t.kind||Te('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const hs=()=>xe.filter(e=>_s.includes(e.spec.table));async function ys(e=!1){const t=Ss();if(t)return t;for(const e of hs())try{await e.read()}catch{}const a=hs()[0]?.venueId??'';for(const t of hs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,$.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await $.mutationQueue.retryNow()}catch{}if(e){const e=H.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=hs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||$.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,H.tempKey)(t.table,t.id))}}return null}$.mutationQueue.onFailed(e=>{_s.includes(e.table)&&H.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),$.mutationQueue.onDone(e=>{_s.includes(e.table)&&H.useTempSaves.getState().clear((0,H.tempKey)(e.table,e.rowKey))});let ws=null;const vs=(e=3e3)=>{ws&&clearTimeout(ws),ws=setTimeout(()=>{ws=null,ys(!1)},e)};(0,P.onConnectivity)(e=>{e&&vs()}),Ue.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Te('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&vs(3500)});const bs='golive:v1:';async function ks(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Cs(e):(await L.kv.get(bs+e,!1)||await Cs(e),await L.kv.get(Os+e,!1)||(As(e),await L.kv.set(Os+e,!0)),await L.kv.get(Is+e,!1)||(Rs(),await L.kv.set(Is+e,!0)))}const Is='golive:v3:';function Rs(){const e=e=>JSON.stringify(e).includes('(example)');try{re.useKitchen.setState(t=>({waste:t.waste.filter(t=>!e(t)),stockTakes:t.stockTakes.filter(t=>!e(t)),deliveries:t.deliveries.filter(e=>'dl-today-fish'!==e.id&&'dl-today-veg'!==e.id)}))}catch{}}const Os='golive:v2:';function As(e){const t=e=>JSON.stringify(e).includes('(example)');z.useStore.setState(t=>({customer:{...t.customer,name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}},stampCards:t.stampCards.filter(t=>t.restaurantId!==e),giftCards:t.giftCards.filter(t=>t.restaurantId!==e),ratings:t.ratings.filter(t=>t.restaurantId!==e),events:t.events.filter(t=>!(t.example&&(t.restaurantId===e||null===t.restaurantId)))})),de.useOwner.setState(e=>({referrals:[],coats:[],merchOrders:[],lost:[],customerTags:{},offers:e.offers.filter(e=>!t(e)),changeRequests:e.changeRequests.filter(e=>!t(e)),campaigns:e.campaigns.filter(e=>!t(e)),supplierOrders:e.supplierOrders.filter(e=>!t(e)),chat:e.chat.filter(e=>e.id.startsWith('m-seed-')).map((e,t)=>({...e,at:new Date(Date.now()-6e4*(5-t)).toISOString()}))}))}async function Cs(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,re.stripKitchenExamples)(re.useKitchen.getState()),s=de.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:oe.useSafety.getState().accidents.filter(e=>!(0,oe.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(re.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',re.useKitchen.getState()),re.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),de.useOwner.setState(n)),r(oe.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',oe.useSafety.getState()),oe.useSafety.setState(i));const o=(0,D.stripHrSamples)(D.useHr.getState());r(D.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',D.useHr.getState()),D.useHr.setState(o));const d=(0,S.stripGpSamples)(S.useGpCalc.getState());r(S.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',S.useGpCalc.getState()),S.useGpCalc.setState(d));const u=se.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),se.useOrderSheets.setState(c));const l=ae.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ae.useCardStore.setState(f)),void await L.kv.set(bs+e,!0)}const t=t=>t.restaurantId===e&&!(0,ue.isUuid)(t.id);z.useStore.setState(a=>({bookings:a.bookings.filter(e=>!t(e)),orders:a.orders.filter(e=>!t(e)),waitlist:a.waitlist.filter(t=>t.restaurantId!==e),walkIns:Object.fromEntries(Object.entries(a.walkIns).filter(([t])=>!t.includes(e)))})),X.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,ue.isUuid)(t.id))})),ee.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),de.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,ue.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,ue.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,ue.isUuid)(e.id)),leave:e.leave.filter(e=>(0,ue.isUuid)(e.id)),swaps:[]}));try{re.useKitchen.setState(e=>(0,re.stripKitchenExamples)(e))}catch{}de.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,ue.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.supplierId))}));try{oe.useSafety.setState(e=>({accidents:e.accidents.filter(e=>{return!String(e.id).startsWith('acc-ex')&&(t=e,!JSON.stringify(t).includes('(example)'));var t})}))}catch{}await L.kv.set(bs+e,!0)}const Ds=(e,t)=>We({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Us(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ee.useFloor.getState().live[e]??{}).map(([e,t])=>Ds(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ue.getState().kind||Te('device.write'),deletes:!1,matchKey:e=>({table_name:e}),toRow:(e,t)=>({venue_id:t,table_name:e.name,stage:e.stage??null,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note?e.note.slice(0,200):null,updated_by:(0,Y.actorStamp)({isCar:Z.IS_CAR,kind:Ue.getState().kind,staffRef:Ue.getState().staffRef,fallback:Ke})}),fromRow:e=>Ds(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ee.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>ee.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Es(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(ie.useSetup.getState().sites[e]?.grades??ie.DEFAULT_GRADES).map((e,t)=>({id:e.id,name:e.name,pence:e.pence,sort:t})),key:e=>e.id,rowKey:e=>String(e.grade_id),syncable:e=>!!e.id&&!!e.name,writable:()=>Te('wages.manage'),matchKey:e=>({grade_id:e}),toRow:(e,t)=>({venue_id:t,grade_id:e.id,name:e.name.slice(0,60),pence:Math.max(0,Math.min(1e5,Math.round(e.pence))),sort:e.sort}),fromRow:e=>({id:String(e.grade_id),name:String(e.name),pence:Number(e.pence),sort:Number(e.sort??0)}),apply:(t,a)=>{if(!t.length&&!a.length)return;const s=ie.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));ie.useSetup.getState().patch(e,{grades:i})},subscribe:t=>ie.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ts='staff-avatars',Ns=new Map;let Ks=!1;const Ps=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ms(){if(!Ks){Ks=!0;try{for(const[e,t]of Ns){const a=ne.useAvatars.getState().photos[e];if(!t){a?.path&&ne.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ue.getState().staffRef)continue;const{data:s,error:n}=await De().storage.from(Ts).download(t);if(n||!s)continue;const i=await Ps(s);i.startsWith('data:image/')&&ne.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ks=!1}}}function xs(e){const t=async()=>{const t=Ue.getState().staffRef,a=t?_t.get(t)??Ue.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ue.getState().kind)return;const s=ne.useAvatars.getState().photos[t];try{const n=Ns.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&De().storage.from(Ts).remove([t]).catch(()=>{})};if(!s){const e=!!ne.useAvatars.getState().clears?.[t];return e&&n&&(await qa('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ns.set(t,null),i(n)),void(e&&ne.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ee({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===r.type?'jpg':'image/webp'===r.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await De().storage.from(Ts).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await qa('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ns.set(t,d),n!==d&&i(n),ne.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ee({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ne.useAvatars.getState().photos},s=ne.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Te('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ue.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ns.set(t,null),ne.useAvatars.getState().doneClear(t),qa('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>De().storage.from(Ts).remove([e])).catch(()=>{})}});return t(),s}const qs=new Map,Ls=(0,T.create)(()=>({n:0}))},823,{"0":836,"1":1295,"2":5,"3":1296,"4":1214,"5":6,"6":1073,"7":842,"8":1217,"9":1221,"10":1209,"11":808,"12":863,"13":1219,"14":868,"15":1161,"16":1033,"17":1066,"18":815,"19":1300,"20":13,"21":865,"22":1303,"23":1051,"24":1052,"25":1072,"26":871,"27":1136,"28":1306,"29":1211,"30":1160,"31":1159,"32":1291,"33":1308,"34":1307,"35":1311,"36":1162,"37":1312,"38":1313,"39":1314,"40":1315,"41":1317,"42":1207,"43":878,"44":807,"45":1118,"46":827,"47":828,"48":1292,"49":1210,"50":1122,"51":1094,"52":1032,"53":1319,"54":1320,"55":861,"56":1241,"57":1053,"58":1030,"59":1062,"60":1063,"61":1064,"62":2,"63":1323,"64":1050,"65":1324,"66":1325,"67":1326,"68":1120,"69":992,"70":1151,"71":1112,"72":1104,"73":1077,"74":1327,"75":1536,"76":29,"paths":{}}); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"colours",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"font",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return A}}),e.brandColour=function(I,S=F.gold){const r=/^#([0-9a-f]{6})$/i.exec(I??'');if(!r)return S;const _=parseInt(r[1],16),t=(_>>16)/255,E=(_>>8&255)/255,n=(255&_)/255,o=Math.max(t,E,n),A=Math.min(t,E,n),l=o-A;if(l<.12)return I;const D=o===t?((E-n)/l+6)%6*60:o===E?60*((n-t)/l+2):60*((t-E)/l+4);return D>65&&D<320?S:I};var I=_r(_d[0]),S=_r(_d[1]),r=_r(_d[2]),_=_r(_d[3]),t=_r(_d[4]),E=_r(_d[5]);const F={bg:I.IS_SOUTERS?'#56152A':I.IS_WILDINGS?'#272A2F':'#0B0B0B',surface:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#141414',surface2:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#363A42':'#1D1C1A',border:I.IS_SOUTERS?'#87435B':I.IS_WILDINGS?'#50545C':'#34302A',gold:I.IS_WILDINGS?'#FFE3A5':I.IS_KIRKMICHAEL?'#B87754':I.IS_SOUTERS?'#A4622E':'#CFA45F',goldLight:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',goldTint:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',goldMuted:I.IS_WILDINGS?'#DDC694':I.IS_KIRKMICHAEL?'#C2937A':I.IS_SOUTERS?'#C18F67':'#BFA06C',hairline:'rgba(255,255,255,0.09)',tile:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#18171A',tilePressed:I.IS_SOUTERS?'#64223B':I.IS_WILDINGS?'#393D45':'#211F1C',accentBg:I.IS_WILDINGS?'rgba(255,227,165,0.13)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.13)':I.IS_SOUTERS?'rgba(164,98,46,0.13)':'rgba(207,164,95,0.13)',accentBorder:I.IS_WILDINGS?'rgba(255,227,165,0.38)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.38)':I.IS_SOUTERS?'rgba(164,98,46,0.38)':'rgba(207,164,95,0.38)',text:'#F5F1E8',muted:'#B8B0A0',onGold:I.IS_WILDINGS?'#272A2F':I.IS_KIRKMICHAEL?'#0B0B0B':I.IS_SOUTERS?'#FFFFFF':'#0B0B0B',red:'#FF6B5E',redBg:'#4A1310',redSolid:'#C62F22',amber:'#FFB547',amberBg:'#3F2C05',shellfishFree:'#6EC470',ok:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',okBg:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',blue:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',blueBg:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#39352C':'#1E1A12',...I.IS_GREENSIDE?r.GREENSIDE_PALETTE:{},...I.IS_QUEUED_VENUE?S.QUEUED_PALETTE:{},...I.IS_KIRKTON?t.KIRKTON_PALETTE:{},...I.IS_ABBOTSFORD?_.ABBOTSFORD_PALETTE:{}},n={regular:'Poppins_400Regular',medium:'Poppins_500Medium',semibold:'Poppins_600SemiBold',bold:'Poppins_700Bold'},o={small:E.type.small,body:E.type.body,large:E.type.large,title:E.type.title,hero:E.type.hero},A={s:E.radii.s,m:E.radii.m,l:E.radii.l}},824,[5,1372,1216,1373,1374,1375]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},825,[240]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.templatesFor=function(t){const n={...r.DEFAULT_TEMPLATES};for(const o of Object.keys(r.DEFAULT_TEMPLATES))n[o]={...r.DEFAULT_TEMPLATES[o],...t?.[o]??{}};return n},e.composeBooking=function(t,n,o,c,u){if(n.walkIn)return[];return s(t,'booking-confirmation'===t?'booking':'booking-request'===t?'request':'declined',(0,r.bookingVars)(n,o),{phone:n.phone,email:n.email,name:n.name},{refType:'booking',refId:n.id,ref:n.ref},o,c,u)},e.composeOrder=function(t,n,o,c){return'takeaway'!==t.type?[]:s('order-confirmation','order',(0,r.orderVars)(t,n),{phone:t.phone,email:t.email,name:t.customerName},{refType:'order',refId:t.id,ref:t.ref},n,o,c)},e.deliverQueued=async function(r,n){if(!(0,t.isLive)())return;const o=(0,t.activeProvider)();for(const t of r){const r=await o.deliver(t);n(t.id,r.ok?{status:'sent'}:{status:'failed',error:r.error})}},e.statusLabel=function(t){const r='sms'===t.channel?'Text':'Email';return'preview'===t.status?`${r}: Ready (preview mode)`:'queued'===t.status?`${r}: Sending\u2026`:'sent'===t.status?`${r} sent`:`${r}: Not sent (failed)`},Object.defineProperty(e,"PREVIEW_BANNER",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);Object.keys(t).forEach(function(r){'default'===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})});var r=_r(d[1]);Object.keys(r).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var n=_r(d[2]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=()=>`msg-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-4)}`;function s(s,c,u,l,f,m,p,b){const y=[],v=(0,t.isLive)()?'queued':'preview',h=(0,t.activeProvider)().id,E=(0,n.guestPhone)(l.phone);if(E.ok&&y.push({id:o(),restaurantId:m.id,at:b,channel:'sms',kind:s,to:E.pretty,toName:l.name,body:(0,r.toGsm)((0,r.fill)(p[c].sms,u.sms)),...f,status:v,provider:h}),l.email?.trim()){const t=(0,r.fillEmailText)(p[c].body,u.email),n=(0,r.fill)(p[c].subject,u.email);y.push({id:o(),restaurantId:m.id,at:b,channel:'email',kind:s,to:l.email.trim(),toName:l.name,subject:n,body:t,html:(0,r.emailHtml)(t,{venue:m.name,preheader:n}),...f,status:v,provider:h})}return y}const c='Preview mode, not sent yet. Connect a text and email service to go live.'},826,[1238,1239,1240]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCK_REASONS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return m}}),_e.blockClock=function(e){if('string'==typeof e){const t=/(\d{1,2}):(\d{2})/.exec(e);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}return e instanceof Date&&!Number.isNaN(e.getTime())?`${String(e.getHours()).padStart(2,'0')}:${String(e.getMinutes()).padStart(2,'0')}`:void 0},Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return k}}),_e.blockedTablesAt=v,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return M}}),_e.closedAreasAt=function(e,t,o,n){const a=(0,u.toMins)(n),s=p(e,t,o).filter(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).map(e=>e.areaId);return new Set([...s,...[...v(e,t,o,n)].map(M)])},_e.blockAt=S,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,u.toMins)(e.to)>(0,u.toMins)(n))).sort((e,t)=>e.date===t.date?(0,u.toMins)(e.from)-(0,u.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o={...t,id:(0,a.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,a.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)}))},remove:(t,o)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>{const n=e.blocks.find(e=>e.id===t);return n?{blocks:e.blocks.filter(e=>e.id!==t),removed:[...e.removed,{...n,removedAt:(new Date).toISOString(),removedBy:o??n.by}]}:e})},put:t=>e(e=>{const o=e.blocks.filter(e=>e.id!==t.id),n=e.removed.filter(e=>e.id!==t.id);return t.removedAt?{blocks:o,removed:[...n,t]}:{blocks:[...o,t],removed:n}})}),{name:'covercharge-blocks-v1',storage:(0,c.createJSONStorage)(()=>n.default),version:2,migrate:e=>{const t=e??{};return{blocks:t.blocks??[],removed:t.removed??[]}}}));const k=e=>!e.areaId&&!e.tables?.length;function v(e,t,o,n){const a=(0,u.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).flatMap(e=>e.tables))}const O=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&k(e)).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),p=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),M=e=>`tbl:${e}`;function S(e,t,o,n){const a=(0,u.toMins)(n);return O(e,t,o).find(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to))}const $=(e,t,o,n)=>S(e,t,o,n),h=e=>e.privateFunction?`${e.privateFunction.title} \xb7 ${e.privateFunction.covers} Covers \xb7 ${e.areaName??'Whole venue'} \xb7 until ${e.to}`:e.tables?.length?`${e.tables.map(t.tableNumbers).join(', ')} blocked until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:e.areaId?`${e.areaName??'Area'} closed until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:`Bookings paused until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`,y=(e,t)=>{const o=m(e=>e.blocks);return O(o,e,t)}},827,[811,1080,1241,1072,1081,821,1096,1318]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SETTINGS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"seedPlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useFloor",{enumerable:!0,get:function(){return p}}),_e.hashOldPins=f,Object.defineProperty(_e,"usePlan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useDisplaySettings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"planOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j}}),_e.tablesLabel=v,_e.tableCardLabel=function(e){return(0,t.withTableWord)(v(e))},Object.defineProperty(_e,"joinTables",{enumerable:!0,get:function(){return S}});var e,n=r(d[0]),t=r(d[1]),a=r(d[2]),s=(e=a)&&e.__esModule?e:{default:e},i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});const u={privacy:!0,idleMins:2,pinOn:!1,...i.DEFAULT_WAKE,tonightCards:!0},b=e=>'souters'===e||n.IS_ISOLATED_VENUE&&'souters'===n.VENUE_RID?{areas:[{id:'su-restaurant',name:'Restaurant'},{id:'su-bar',name:'Bar'},{id:'su-mezzanine',name:'Mezzanine / private dining'},{id:'su-garden',name:'Beer garden',outdoor:!0},{id:'su-icecream',name:'Ice cream & cake corner'}],tables:[],joins:[],sections:[],fixtures:[]}:'kirkmichael'===e||n.IS_ISOLATED_VENUE&&'kirkmichael'===n.VENUE_RID?{areas:[{id:'km-restaurant',name:'Restaurant'},{id:'km-bar',name:'Bar'},{id:'km-private',name:'Private dining',label:'The Room (about 18 covers) \u2014 table plan to confirm'}],tables:[],joins:[],sections:[],fixtures:[]}:['wildings','greenside'].includes(e)||n.IS_ISOLATED_VENUE?{areas:[],tables:[],joins:[],sections:[],fixtures:[]}:'anchorage'===e?(0,c.anchoragePlan)():(0,c.starterPlan)(),p=(0,l.create)()((0,o.persist)((e,t)=>{const a=e=>t().plans[e]??b(e);return{plans:n.IS_ISOLATED_VENUE?{[n.VENUE_RID]:b(n.VENUE_RID)}:{anchorage:(0,c.anchoragePlan)()},live:{},settings:{},smsLog:[],setPlan:(n,t)=>e(e=>({plans:{...e.plans,[n]:t}})),updateTable:(n,t,s)=>{const i=a(n);e(e=>({plans:{...e.plans,[n]:{...i,tables:i.tables.map(e=>e.id===t?{...e,...s}:e)}}}))},addTable:(n,t)=>{const s=a(n);e(e=>({plans:{...e.plans,[n]:{...s,tables:[...s.tables,t]}}}))},removeTable:(n,t)=>{const s=a(n),i=s.tables.find(e=>e.id===t);e(e=>({plans:{...e.plans,[n]:{...s,tables:s.tables.filter(e=>e.id!==t),joins:s.joins.filter(e=>!i||!e.tables.includes(i.name))}}}))},setLive:(n,t,a)=>e(e=>({live:{...e.live,[n]:{...e.live[n]??{},[t]:{...e.live[n]?.[t]??{},...a}}}})),setSettings:(n,t)=>e(e=>({settings:{...e.settings,[n]:{...u,...e.settings[n]??{},...t}}})),logSms:(n,t,a)=>e(e=>{return{smsLog:[{id:(s='sms',`${s}-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`),rid:n,at:t,text:a},...e.smsLog].slice(0,50)};var s}),resetPlan:n=>e(e=>({plans:{...e.plans,[n]:b(n)}}))}},{name:'covercharge-floor-v1',version:6,storage:(0,o.createJSONStorage)(()=>s.default),migrate:(e,n)=>{const t=e??{};let a=t;if(n<2){const e={};for(const[n,a]of Object.entries(t.plans??{}))e[n]='anchorage'===n?(0,c.anchoragePlan)():(0,c.normalisePlan)(a);e.anchorage=(0,c.anchoragePlan)(),a={...t,plans:e,live:{}}}else if(n<3)a={...t,plans:{...t.plans??{},anchorage:(0,c.anchoragePlan)()}};else if(n<4){const e=t.plans?.anchorage;e&&(a={...t,plans:{...t.plans,anchorage:{...e,joins:(e.joins??[]).filter(e=>!(2===e.tables.length&&e.tables.includes('1')&&e.tables.includes('2')))}}})}return n<5&&(a={...a,settings:f(a.settings)}),n<6&&a.plans?.anchorage&&(a={...a,plans:{...a.plans,anchorage:(0,c.withSeedBest)('anchorage',a.plans.anchorage)}}),a}}));function f(e){const n={};for(const[t,a]of Object.entries(e??{})){const{pin:e,...s}=a??{};n[t]={...u,...s,...'pinHash'in s?{}:(0,i.fromOldPin)(e)}}return n}const h=e=>p(n=>n.plans[e])??E(e),N={};function E(e){return N[e]??=b(e)}const O=e=>{const n=p(n=>n.settings[e]);return n?{...u,...n}:u},P=e=>p.getState().plans[e]??E(e),j=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[];function v(e){const n=j((0,t.tableNumbers)(e));if(!n.length)return'';if(1===n.length)return n[0];const a=n.map(e=>/^\d+$/.test(e)?Number(e):NaN),s=a.every(e=>!Number.isNaN(e))?[...n].sort((e,n)=>Number(e)-Number(n)):n;return a.every(e=>!Number.isNaN(e))&&s.length>=3&&s.every((e,n)=>0===n||Number(e)===Number(s[n-1])+1)?`${s[0]}\u2013${s[s.length-1]}`:s.join(' + ')}const S=e=>[...new Set(e)].sort((e,n)=>/^\d+$/.test(e)&&/^\d+$/.test(n)?Number(e)-Number(n):e.localeCompare(n)).join('+')},828,[5,811,1080,1213,1072,1081,1077]); +__d(function(_g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STATUS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"STAGE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"turnFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"startOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"durOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"endOf",{enumerable:!0,get:function(){return f}}),e.clashes=function(a,s=90){const n=new Set,l=a.filter(t=>g(t)&&t.table);for(let a=0;a(0,t.tablesOf)(d.table).includes(a))&&(u(o)t.date===n&&!['cancelled','noshow'].includes(t.status)).sort((t,a)=>t.time.localeCompare(a.time));for(const s of a.tables){const a=i.filter(a=>(0,t.tablesOf)(a.table).includes(s.name)),n=a[0],o=(0,t.tablesOf)(n?.table);l[s.name]={table:s,status:n?'soon':'free',next:n,covers:n?.partySize??0,dayBookings:a.length?a:void 0,group:o.length>1?o:void 0,allergy:!(!n?.allergies?.length&&!n?.allergyNote),vip:n?.tags?.find(t=>'VIP'===t)??n?.tags?.find(t=>'Regular'===t),occasion:n?.occasion??h(n?.notes)}}return l},e.floorView=function(a,n,l,i,o,d=90,c){const b={},g=n.filter(t=>t.date===S(o));for(const n of a.tables){const a=i[n.name]??{},y=g.filter(a=>(0,t.tablesOf)(a.table).includes(n.name)),S=y.find(t=>'seated'===(0,s.shownStatus)(t)),v=y.filter(t=>'confirmed'===t.status).sort((t,a)=>t.time.localeCompare(a.time)).find(t=>O(o,t)>=-20),T=v?Math.round(O(o,v)):void 0,w=S?void 0:p(y,o,d),F=l.find(t=>'table'===t.type&&t.tableNo===n.name&&!['closed','cancelled','collected'].includes(t.status));let j='free';a.blocked?j='blocked':S?j=a.stage??'seated':!c?.has(n.areaId)&&!c?.has(`tbl:${n.name}`)||F?a.dirty?j='dirty':F?j=a.stage??'seated':v&&(j='soon'):j='blocked';const A=S,P=A?.tags?.find(t=>'VIP'===t)??A?.tags?.find(t=>'Regular'===t)??(A?void 0:v?.tags?.[0]);b[n.name]={table:n,status:j,booking:A,next:v,due:w,nextIn:T,covers:A?.partySize??0,group:(()=>{const a=(0,t.tablesOf)((A??('soon'===j?v:void 0))?.table);return a.length>1?a:void 0})(),orderOnly:!A&&!!F,note:a.note,seatedMins:A?Math.max(0,Math.round((o.getTime()-u(A).getTime())/6e4)):void 0,freeAt:A?f(A,d):void 0,allergy:!!(A?.allergies?.length||A?.allergyNote||!A&&(v?.allergies?.length||v?.allergyNote)||F?.allergies?.length),vip:P,occasion:A?.occasion??(A?void 0:v?.occasion??h(v?.notes))??h(A?.notes)}}return b},e.dueOnTable=p,Object.defineProperty(e,"OCCASION_ICON",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"tableAllowed",{enumerable:!0,get:function(){return v}}),e.suggestTable=function(s,n,l,i,o,d,c=90,b,p){const h=[...s.tables.map(t=>({name:t.name,seats:t.maxSeats,min:t.minSeats,parts:[t.name]})),...s.joins.map(t=>{const a=s.tables.filter(a=>t.tables.includes(a.name));return{name:t.tables.join('+'),seats:a.reduce((t,a)=>t+a.maxSeats,0),min:a.reduce((t,a)=>t+a.minSeats,0),parts:t.tables}})].filter(t=>t.parts.every(t=>v(s,t,p))),y=o.getTime()+6e4*d,O=new Set((0,a.bestTables)(s));let S=null;for(const a of h){if(a.seats['blocked'].includes(l[t]?.status)))continue;const s=!!l&&a.parts.some(t=>['seated','mains','dessert','bill','dirty'].includes(l[t]?.status)),d=n.filter(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()o.getTime()).length,p=1===a.parts.length&&O.has(a.parts[0])?12:0,h=(s?1e3:0)+100*d+10*(a.seats-i)+(i({name:t.name,seats:t.maxSeats,parts:[t.name]})),...s.joins.map(t=>({name:t.tables.join('+'),seats:s.tables.filter(a=>t.tables.includes(a.name)).reduce((t,a)=>t+a.maxSeats,0),parts:t.tables}))].filter(t=>t.seats>=l&&t.parts.every(t=>v(s,t,c))).filter(a=>!n.some(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()i.getTime())),y=new Set((0,a.bestTables)(s)),O=t=>1===t.parts.length&&y.has(t.parts[0])?0:1;return h.sort((t,a)=>t.seats-a.seats||t.parts.length-a.parts.length||O(t)-O(a)).map(t=>({table:t.name,seats:t.seats,area:s.areas.find(a=>a.id===s.tables.find(a=>a.name===t.parts[0])?.areaId)?.name??''}))},e.seatedPartiesAt=function(a,s,n){return s.filter(s=>s.date===n&&'seated'===s.status&&(0,t.tablesOf)(s.table).includes(a))},Object.defineProperty(e,"unseatStatus",{enumerable:!0,get:function(){return T}});var t=r(_d[0]),a=r(_d[1]),s=r(_d[2]);const n={colour:'#3A2F1E',fg:'#F1DDB0'},l={colour:'#CFA45F',fg:'#0B0B0B'},i={free:{label:'Free',...n},soon:{label:'Booked later',colour:'#9A3050',fg:'#FFF6F0'},seated:{label:'Seated',...l},mains:{label:'Seated',...l},dessert:{label:'Seated',...l},bill:{label:'Seated',...l},dirty:{label:'Needs clearing',colour:'#6E6555',fg:'#FFFFFF'},blocked:{label:'Blocked',...n}},o={seated:'Seated',mains:'Mains',dessert:'Dessert',bill:'Bill requested'},d=['seated','mains','dessert','bill'],c=(t,a=90)=>Math.min(a+60,a+15*Math.max(0,Math.ceil((t-2)/2))),u=t=>'seated'===(0,s.shownStatus)(t)&&t.seatedAt?new Date(t.seatedAt):new Date(`${t.date}T${t.time}:00`),b=(t,a=90)=>t.durationMins??c(t.partySize,a),f=(t,a=90)=>new Date(u(t).getTime()+6e4*b(t,a)),g=t=>!['cancelled','noshow','finished'].includes(t.status);function p(t,a,s=90){return t.filter(t=>'confirmed'===t.status&&O(a,t)<=45&&-O(a,t)t.time.localeCompare(a.time))[0]}const h=t=>t?/birthday/i.test(t)?'birthday':/anniversary/i.test(t)?'anniversary':void 0:void 0,y={birthday:'\ud83c\udf82',anniversary:'\ud83d\udc9d',celebration:'\ud83e\udd42'},O=(t,a)=>(new Date(`${a.date}T${a.time}:00`).getTime()-t.getTime())/6e4,S=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,v=(t,a,s)=>{const n=t.tables.find(t=>t.name===a);if(!n)return!1;const l=t.areas.find(t=>t.id===n.areaId);return!(s?.dog&&!(void 0!==n.dogOk?n.dogOk:l?.dogs))&&(!s?.closed?.has(n.areaId)&&!s?.closed?.has(`tbl:${n.name}`))};const T=t=>t.walkIn?'cancelled':'confirmed'},829,[828,1077,831]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"emptyNeeds",{enumerable:!0,get:function(){return w}}),_e.needsMissing=function(e,l=[]){const s=[];null===e.allergy?s.push('Answer the allergy question first'):'yes'!==e.allergy||e.allergens.length||l.length||e.allergyNote.trim()||s.push('Pick the allergens or describe them');null===e.dog&&s.push('Say whether a dog is coming');return s},_e.needsPatch=function(e,l=[]){const s='yes'===e.allergy?e.allergens.filter(e=>!l.some(l=>l.allergen===e)).map(l=>({allergen:l,severity:e.severity})):[],t=Object.entries(e.holds).filter(([,e])=>e>0).map(([e,l])=>{const s=e.indexOf(':');return{kind:e.startsWith('item:')?'item':'stock',id:s>=0?e.slice(s+1):e,qty:l}}),a=e.dog?Math.max(1,e.dogs):0,n={...e.wheelchair?{wheelchair:e.wheelchair}:{},...e.stepFree?{stepFree:!0}:{},...e.toilet?{toilet:!0}:{},...e.assistDog?{assistDog:!0}:{},...e.accessNote.trim()?{note:e.accessNote.trim()}:{}},r={...e.vegan?{vegan:e.vegan}:{},...e.vegetarian?{vegetarian:e.vegetarian}:{}};return{allergies:[...l,...s],allergyNone:'none'===e.allergy&&!l.length||void 0,allergyPeople:'yes'===e.allergy?e.allergyPeople:void 0,allergyNote:'yes'===e.allergy&&e.allergyNote.trim()?e.allergyNote.trim():void 0,dog:a>0,dogs:a||void 0,access:Object.keys(n).length?n:void 0,diet:Object.keys(r).length?r:void 0,holds:t.length?t:void 0,tableReq:e.tableReq.length?e.tableReq:void 0}},_e.FirstQuestions=function({rid:e,value:l,onChange:a,party:r,audience:i,profile:o=[]}){const y=e=>a({...l,...e}),b=(0,p.usePlan)(e),[x,j]=(0,t.useState)(!1),k=(0,s.dogQuestionOn)((0,u.useRestaurant)(e));(0,t.useEffect)(()=>{k||null!==l.dog||a({...l,dog:!1})},[k,l.dog]);const w=x?m.ALLERGENS:m.ALLERGENS.filter(e=>['gluten','milk','peanuts','treenuts','crustaceans','molluscs','fish','eggs','sesame'].includes(e.id)||l.allergens.includes(e.id)),q=[...o.map(e=>e.allergen),...l.allergens],M=(0,f.dogSetUp)(b);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(R,{tone:"red",testID:"q-allergens",children:[(0,v.jsx)(C,{sub:'guest'===i?'We ask everyone first, so the kitchen can keep you safe.':'Ask every guest first. It goes to the kitchen in red.',children:"\u26a0\ufe0f Does anyone in the party have a food allergy?"}),o.length?(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(e=>(0,v.jsx)(h.Badge,{kind:"red",label:`${m.ALLERGENS.find(l=>l.id===e.allergen)?.short} (from your profile)`},e.allergen))}):null,(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No allergies",selected:'none'===l.allergy,onPress:()=>y({allergy:'none',allergens:[]})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes, allergies",selected:'yes'===l.allergy,onPress:()=>y({allergy:'yes'})})})]}),'none'===l.allergy&&o.length?(0,v.jsx)(h.Muted,{children:"Your profile allergies above are still shared with the kitchen."}):null,'yes'===l.allergy?(0,v.jsxs)(n.default,{style:{gap:10},testID:"allergen-picker",children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"Which allergens? (the 14 UK allergens)"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[w.map(e=>(0,v.jsx)(h.Chip,{label:e.short,selected:l.allergens.includes(e.id)||o.some(l=>l.allergen===e.id),disabled:o.some(l=>l.allergen===e.id),onPress:()=>y({allergens:l.allergens.includes(e.id)?l.allergens.filter(l=>l!==e.id):[...l.allergens,e.id]})},e.id)),x?null:(0,v.jsx)(h.Chip,{label:"All 14\u2026",onPress:()=>j(!0)})]}),(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"How serious?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:m.SEVERITIES.map(e=>(0,v.jsx)(h.Chip,{label:e.label,selected:l.severity===e.id,onPress:()=>y({severity:e.id})},e.id))}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many people with allergies?"}),(0,v.jsx)(h.Stepper,{value:Math.min(l.allergyPeople,r),onChange:e=>y({allergyPeople:e}),min:1,max:Math.max(1,r),label:"people with allergies"})]}),(0,v.jsx)(h.Field,{label:"Anything else the kitchen should know? (optional)",value:l.allergyNote,onChangeText:e=>y({allergyNote:e}),placeholder:"e.g. traces of sesame, one child with coeliac disease",testID:"allergy-note"}),q.length?(0,v.jsx)(c.MenuAllergyCheck,{rid:e,allergens:q,audience:i}):null]}):null]}),k?(0,v.jsxs)(R,{tone:"gold",testID:"q-dogs",children:[(0,v.jsx)(C,{sub:M?'Well-behaved dogs are welcome at our dog-friendly tables.':'staff'===i?'Dog-friendly tables aren\u2019t marked yet (Managers \u203a Booking options), so any table is offered for now.':void 0,children:"\ud83d\udc15 Are you bringing a dog?"}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No",selected:!1===l.dog,onPress:()=>y({dog:!1})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes",selected:!0===l.dog,onPress:()=>y({dog:!0,dogs:Math.max(1,l.dogs)})})})]}),l.dog?(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many dogs?"}),(0,v.jsx)(h.Stepper,{value:l.dogs,onChange:e=>y({dogs:e}),min:1,max:4,label:"dogs"})]}):null]}):null]})},_e.useReserveAvailability=q,_e.MoreQuestions=function({rid:e,r:l,value:a,onChange:r,party:i,date:o,time:c,today:y,bookings:m,audience:b,showTables:x}){const j=e=>r({...a,...e}),w=l.settings,S=(0,u.useMenu)(e),P=(0,t.useMemo)(()=>S.filter(e=>/\((V|VG|Ve)\)|vegan|vegetarian/i.test(`${e.name} ${e.tags?.join(' ')??''}`)).slice(0,4),[S.length]),N=q(e,l,o,y,m,b),T=e=>a.holds[e]??0,D=(0,f.stockNeed)({holds:Object.entries(a.holds).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.indexOf(':')>=0?e.slice(e.indexOf(':')+1):e,qty:l}))},N.items),$=(e,l)=>Math.min(10,...e.map(e=>{const s=(D[e.key]??0)-T(l)*e.qty;return Math.floor(((N.free[e.key]??0)-s)/e.qty)})),I=(e,l,s,t)=>{const r=T(e),i=t<=0&&0===r;return(0,v.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'center',gap:10,opacity:i?.55:1},testID:`reserve-${e.replace(':','-')}`,children:[(0,v.jsxs)(n.default,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(h.T,{weight:"semibold",children:l}),(0,v.jsx)(h.Muted,{children:i?'Unavailable \u2014 none left for this day':s})]}),i?(0,v.jsx)(h.Badge,{kind:"neutral",label:"Unavailable"}):(0,v.jsx)(h.Stepper,{value:r,onChange:l=>j({holds:{...a.holds,[e]:Math.max(0,Math.min(l,Math.max(r,t)))}}),min:0,max:Math.max(r,Math.min(10,t)),label:l})]},e)},O=N.items.length>0||!1!==w.reserveStock&&N.stock.length>0,A=(0,p.usePlan)(e);return(0,v.jsxs)(v.Fragment,{children:[(0,s.accessQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-access",children:[(0,v.jsx)(C,{sub:"Optional. Tell us and we\u2019ll have the right table ready.",children:"\u267f Access needs"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Wheelchair users"}),(0,v.jsx)(h.Stepper,{value:a.wheelchair,onChange:e=>j({wheelchair:e}),min:0,max:Math.max(1,i),label:"wheelchair users"})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"Step-free access",selected:a.stepFree,onPress:()=>j({stepFree:!a.stepFree})}),(0,v.jsx)(h.Chip,{label:"Accessible toilet",selected:a.toilet,onPress:()=>j({toilet:!a.toilet})}),(0,v.jsx)(h.Chip,{label:"Assistance dog",selected:a.assistDog,onPress:()=>j({assistDog:!a.assistDog})})]}),(0,v.jsx)(h.Field,{label:"Anything else? (optional)",value:a.accessNote,onChangeText:e=>j({accessNote:e}),placeholder:"e.g. needs a chair with arms"}),w.accessStatement?.trim()?(0,v.jsx)(h.Muted,{children:w.accessStatement.trim()}):null]}):null,(0,s.dietQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-veg",children:[(0,v.jsx)(C,{sub:"We\u2019d love to look after you. Optional.",children:"\u24cb Any vegans or vegetarians?"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegan"}),(0,v.jsx)(h.Stepper,{value:a.vegan,onChange:e=>j({vegan:e}),min:0,max:Math.max(1,i),label:"vegans"})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegetarian"}),(0,v.jsx)(h.Stepper,{value:a.vegetarian,onChange:e=>j({vegetarian:e}),min:0,max:Math.max(1,i),label:"vegetarians"})]}),!1!==w.vegTeaser&&P.length&&(a.vegan||a.vegetarian)?(0,v.jsxs)(h.Muted,{children:["On the menu: ",P.map(e=>e.name).join(' \xb7 ')]}):null]}):null,O?(0,v.jsxs)(R,{tone:"gold",testID:"q-reserve",children:[(0,v.jsx)(C,{sub:N.known?'Held for you from today\u2019s count.':o>y||'guest'===b?'Held for you; the kitchen confirms and orders in.':void 0,children:"\ud83e\udd9e Reserve with your table"}),N.items.map(e=>I(`item:${e.id}`,`${e.name}${k(e.price)}`,e.description||e.uses.map(e=>`${e.qty} ${N.stock.find(l=>l.key===e.key)?.name.toLowerCase()??e.key}`).join(' + '),$(e.uses,`item:${e.id}`))),!1!==w.reserveStock?N.stock.map(e=>I(`stock:${e.key}`,`Reserve ${e.name.toLowerCase()}`,N.known?`${N.free[e.key]} available today`:'Held for the kitchen to order',$([{key:e.key,qty:1}],`stock:${e.key}`))):null,'staff'===b&&N.known?(0,v.jsxs)(h.Muted,{children:["Today: ",N.stock.map(e=>`${N.free[e.key]} ${e.plural.toLowerCase()} free (${N.reserved[e.key]??0} reserved)`).join(' \xb7 ')]}):null]}):null,x&&!1!==w.tableRequests&&A.tables.length?(0,v.jsx)(M,{rid:e,value:a,onChange:r,party:i,hide:w.tableRequestHide??[]}):null]})},_e.dogTimeOk=function(e,l,s,t,a){if(!a)return!0;const n=e.settings.maxDogsPerSlot;return!n||(0,f.dogsAt)(l,s,t)+a<=n},Object.defineProperty(_e,"accessibleSetUp",{enumerable:!0,get:function(){return f.accessibleSetUp}});var e,l=_r(d[0]),s=_r(d[1]),t=_r(d[2]),a=_r(d[3]),n=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),i=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),p=_r(d[10]),y=_r(d[11]),m=_r(d[12]),b=_r(d[13]),x=_r(d[14]),f=_r(d[15]),j=_r(d[16]),v=_r(d[17]);const k=e=>'display'===x.APP_VARIANT?'':` \xb7 ${(0,b.gbp)(e)}`,w=()=>({allergy:null,allergens:[],severity:'allergy',allergyPeople:1,allergyNote:'',dog:null,dogs:1,wheelchair:0,stepFree:!1,toilet:!1,assistDog:!1,accessNote:'',vegan:0,vegetarian:0,holds:{},tableReq:[]});const R=({children:e,tone:l,testID:s})=>(0,v.jsx)(n.default,{testID:s,style:{gap:10,padding:16,borderRadius:16,borderWidth:'plain'===l?1:1.5,borderColor:'red'===l?j.colours.red:'gold'===l?j.colours.accentBorder:j.colours.hairline,backgroundColor:'red'===l?'#1E1110':j.colours.surface},children:e}),C=({children:e,sub:l})=>(0,v.jsxs)(n.default,{style:{gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:e}),l?(0,v.jsx)(h.Muted,{children:l}):null]});function q(e,l,s,t,a,n,i){const o=(0,f.reservablesOf)(l),c=(0,y.useStockItems)(e),h=(0,y.useShellStore)((0,r.useShallow)(l=>(0,y.venueCounts)(l,e))),u=(0,y.useShellStore)(l=>!!l.server[e]),p=(0,f.reservedOn)(a,s,o,i),m=s===t&&('staff'===n||u),b={};for(const e of c)b[e.key]=m?Math.max(0,Math.floor((h[e.key]??0)-(p[e.key]??0))):1/0;return{items:o,stock:c,free:b,reserved:p,known:m}}function M({rid:e,value:s,onChange:a,party:r,hide:c}){const u=(0,p.usePlan)(e),y=u.areas.filter(e=>u.tables.some(l=>l.areaId===e.id&&!c.includes(l.name))),[m,b]=(0,t.useState)(y[0]?.id??''),x=s.dog?s.dogs:0,k=e=>c.includes(e)?'Not bookable':(0,f.tableBlockReason)(u,e,r,x,s.wheelchair>0||s.stepFree),w=Object.fromEntries(u.tables.map(e=>[e.name,{table:e,status:k(e.name)?'blocked':'free',covers:0,allergy:!1}])),q=e=>{if(k(e))return;const l=s.tableReq.includes(e)?s.tableReq.filter(l=>l!==e):[...s.tableReq,e].slice(-2);a({...s,tableReq:l})},M=u.tables.filter(e=>e.areaId===m&&!c.includes(e.name));return(0,v.jsxs)(R,{tone:"plain",testID:"q-table",children:[(0,v.jsx)(C,{sub:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best.",children:"\ud83e\ude91 Request a table (optional)"}),y.length>1?(0,v.jsx)(i.AreaTabs,{plan:u,area:m,onPick:b}):null,(0,v.jsx)(n.default,{testID:"q-table-plan",style:{height:240,borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:j.colours.hairline},children:(0,v.jsx)(o.FloorCanvas,{plan:u,areaId:m,mode:"live",view:w,privacy:!0,fit:"contain",crop:!0,maxH:260,highlight:s.tableReq,onTap:e=>q(e.name)})}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>{const t=k(e.name),a=s.tableReq.indexOf(e.name);return(0,v.jsx)(h.Chip,{label:`${(0,l.tableNumbers)(e.name)}`,sub:t||(0===a?'1st choice':1===a?'2nd choice':`${e.maxSeats} seats`),selected:a>=0,disabled:!!t,onPress:()=>q(e.name)},e.name)})}),s.tableReq.length?(0,v.jsxs)(h.T,{size:14,colour:j.colours.goldLight,children:["Requested: ",s.tableReq.map((e,s)=>`${(0,l.tableNumbers)(e)}${s?' (2nd choice)':''}`).join(', ')]}):(0,v.jsx)(h.Muted,{children:"Tap a table; tap another for a second choice."})]})}},830,[811,813,31,128,881,1461,1462,1464,817,822,828,1292,818,819,807,831,824,25]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ACTIVE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ANCHORAGE_RESERVABLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"reservablesOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"holdId",{enumerable:!0,get:function(){return s}}),e.stockNeed=a,e.reservedBookingsOn=function(t,r,o,i){return t.filter(t=>t.date===r&&n(t)&&'finished'!==t.status).map(t=>({booking:t,qty:a(t,o)[i]??0})).filter(t=>t.qty>0).sort((t,r)=>t.booking.time.localeCompare(r.booking.time))},e.reservedOn=c,e.usedOn=function(t,r,n){const o={};for(const i of t)if(i.date===r)for(const t of i.holds??[])if(t.served)for(const[r,s]of Object.entries(a({...i,holds:[{...t,served:void 0}]},n)))o[r]=(o[r]??0)+s;return o},e.heldSummary=function(t,r,o){const i={},a={};for(const o of t)if(o.date===r&&n(o))for(const t of o.holds??[])if(!t.served){const r=s(t.id);'item'===t.kind?i[r]=(i[r]??0)+t.qty:a[r]=(a[r]??0)+t.qty}return{platters:Object.values(i).reduce((t,r)=>t+r,0),byItem:i,single:a,stock:c(t,r,o)}},e.holdsText=function(t,r,n){return(t.holds??[]).filter(t=>t.qty>0).map(t=>{const o=s(t.id);return`${'item'===t.kind?l(r.find(t=>t.id===o)?.name??'Reserved item'):n.find(t=>t.key===o)?.name??o} x${t.qty}${t.served?' (served)':''}`}).join(', ')},Object.defineProperty(e,"shortItem",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"needsAllergenSeen",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"needsHoldOk",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"hasAllergens",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"allergenText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"dogCount",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"hasAccess",{enumerable:!0,get:function(){return p}}),e.accessText=function(t){const r=t.access;return r?[r.wheelchair?`${r.wheelchair} wheelchair user${1===r.wheelchair?'':'s'}`:'',r.stepFree?'step-free access':'',r.toilet?'accessible toilet':'',r.assistDog?'assistance dog':'',r.note?.trim()??''].filter(Boolean).join(', '):''},Object.defineProperty(e,"dietText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"accessibleSetUp",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"dogSetUp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"isAccessible",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isDogOk",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dogsAt",{enumerable:!0,get:function(){return P}}),e.tableBlockReason=function(t,n,o,i,s){const a=t.tables.find(t=>t.name===n);return a?a.maxSeats0&&k(t)&&!(0,r.tableDogOk)(t,a)?'No dogs here':s&&O(t)&&!a.accessible?'Not step-free':'':'Not available'},Object.defineProperty(e,"holidayName",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"coverDone",{enumerable:!0,get:function(){return w}}),e.shownStatus=$,e.seatedCoversOn=function(t,r){return t.filter(t=>t.date===r&&['seated','finished'].includes($(t))).reduce((t,r)=>t+(r.partySize||0),0)},e.laterTodayCovers=function(t,r){return t.filter(t=>t.date===r&&!t.walkIn&&'walk-in'!==t.source&&['confirmed','pending'].includes($(t))).reduce((t,r)=>t+(r.partySize||0),0)},Object.defineProperty(e,"laterTodayLine",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"isWalkInBooking",{enumerable:!0,get:function(){return q}}),e.partiesLine=function(t){const r=t.filter(n),o=r.filter(t=>!q(t)).length,i=r.length-o;return`${o} ${1===o?'booking':'bookings'} \xb7 ${i} ${1===i?'walk-in':'walk-ins'}`},Object.defineProperty(e,"COVERS_FOUR_LABELS",{enumerable:!0,get:function(){return N}}),e.coversFour=T,e.coversCard=function(t,r,o){const i=t.filter(t=>t.date===r&&n(t)),s=t=>t.reduce((t,r)=>t+(r.partySize||0),0);return{...T(t,r),booked:s(i.filter(t=>!q(t))),walkIns:s(i.filter(q))}},e.coversToday=function(t,r){return T(t,r)};var t=_r(_d[0]),r=_r(_d[1]);const n=t=>!['cancelled','noshow'].includes(t.status),o=[{id:'seafood-platter-2',name:'Seafood Platter for 2',price:16e3,description:'Whole crab and lobster with all the trimmings, for two to share.',uses:[{key:'crab',qty:1},{key:'lobster',qty:1}],active:!0}],i=t=>(t?.settings.reservables??('anchorage'===t?.id?o:[])).filter(t=>t.active),s=t=>t.startsWith(':')?t.slice(1):t;function a(t,r,n=!1){const o={};for(const i of t.holds??[]){if(i.served&&!n)continue;const t=s(i.id);if('stock'===i.kind)o[t]=(o[t]??0)+i.qty;else for(const n of r.find(r=>r.id===t)?.uses??[])o[n.key]=(o[n.key]??0)+n.qty*i.qty}return o}function c(t,r,o,i){const s={};for(const c of t)if(c.date===r&&n(c)&&'finished'!==c.status&&c.id!==i)for(const[t,r]of Object.entries(a(c,o)))s[t]=(s[t]??0)+r;return s}const l=t=>/platter/i.test(t)?'Platter':t.replace(/ for \d+$/i,''),d=t=>n(t)&&(t.allergies.length>0||!!t.allergyNote?.trim())&&!t.allergyAck,u=t=>n(t)&&(t.holds??[]).some(t=>t.qty>0&&!t.served)&&!t.holdOk,f=t=>t.allergies.length>0||!!t.allergyNote?.trim(),b=r=>[r.allergies.map(r=>(0,t.allergenLabel)(r.allergen)).join(', '),r.allergyNote?.trim()].filter(Boolean).join(' \xb7 ')+(r.allergyPeople?` (${r.allergyPeople} ${1===r.allergyPeople?'person':'people'})`:''),y=t=>t.dogs??(t.dog?1:0),p=t=>!(!t.access||!(t.access.wheelchair||t.access.stepFree||t.access.toilet||t.access.assistDog||t.access.note?.trim()));const h=t=>[t.diet?.vegan?`${t.diet.vegan} vegan`:'',t.diet?.vegetarian?`${t.diet.vegetarian} vegetarian`:''].filter(Boolean).join(', '),O=t=>t.tables.some(t=>t.accessible),k=t=>t.tables.some(t=>void 0!==t.dogOk)||t.areas.some(t=>t.dogs),v=(t,r)=>r.split('+').every(r=>!!t.tables.find(t=>t.name===r.trim())?.accessible),j=(t,n)=>n.split('+').every(n=>{const o=t.tables.find(t=>t.name===n.trim());return!!o&&(0,r.tableDogOk)(t,o)}),P=(t,r,o,i)=>t.filter(t=>t.id!==i&&t.date===r&&t.time===o&&n(t)).reduce((t,r)=>t+y(r),0);const S=t=>t.replace(/\s*\(substitute day\)/gi,'').trim(),w=t=>'finished'===t.status;function $(t){if('seated'===t.status&&t.seatedAt){const r=new Date(t.seatedAt);if((isNaN(r.getTime())?t.date:r.toLocaleDateString('en-CA',{timeZone:'Europe/London'}))t>0?`${t} more ${1===t?'cover':'covers'} booked for later today.`:'No more bookings for later today.',q=t=>!!t.walkIn||'walk-in'===t.source;const N=['Done','Seated','To come','Total'];function T(t,r){const o=t.filter(t=>t.date===r&&n(t)),i=t=>t.reduce((t,r)=>t+(r.partySize||0),0),s=i(o.filter(w)),a=i(o.filter(t=>!w(t)&&'seated'===$(t))),c=i(o.filter(t=>!q(t)&&['confirmed','pending'].includes($(t))));return{done:s,seated:a,toCome:c,total:s+a+c}}},831,[818,1077]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SEASONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hourSetsOf",{enumerable:!0,get:function(){return n}}),e.seasonOn=s,e.kitchenHoursOn=l,e.hoursFor=function(r,n){const u=l(r,n);return u?{open:(0,t.atTime)(n,u[0]),close:(0,t.atTime)(n,u[1])}:null};var t=_r(_d[0]);const r=[{id:'winter',name:'Winter',hours:{0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']}},{id:'summer',name:'Summer',hours:null}],n=t=>t.settings.hourSets??('anchorage'===t.id?r:[]),u=t=>`${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,o=t=>`${t.getFullYear()}-${u(t)}`;function s(t,r){const o=n(t).filter(t=>t.hours);if(!o.length)return null;const s=o.filter(t=>t.start).sort((t,r)=>t.start.localeCompare(r.start));if(s.length<2)return s[0]??o[0];const l=u(r);return[...s].reverse().find(t=>t.start<=l)??s[s.length-1]}function l(t,r){const n=(t.settings.hourOverrides??[]).find(t=>t.date===o(r));if(n)return n.hours;const u=s(t,r);return u?.hours?u.hours[r.getDay()]??null:t.kitchenHours[r.getDay()]??null}},832,[821]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},833,[]); +__d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SERVER_MAX_DAYS_AHEAD",{enumerable:!0,get:function(){return n}}),e.bookAheadDays=r,Object.defineProperty(e,"bookAheadUnlimited",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"lastBookableDay",{enumerable:!0,get:function(){return u}}),e.typedBookDateProblem=function(n,r,o){const s=(n??'').trim();if(!s)return'Type a date as DD/MM/YYYY, for example 24/12/2026.';const l=(0,t.dayFromSlash)(s);if(!l)return'That isn\u2019t a date yet. Type it as DD/MM/YYYY, for example 24/12/2026.';if(lc){const[t,n,r]=c.split('-');return`Online booking is open up to ${r}/${n}/${t}. For later dates, please call us.`}return null};var t=_r(_d[0]);const n=366;function r(t){const r=Number(t?.settings?.onlineBookDaysAhead);return Number.isFinite(r)&&r>=1?Math.min(Math.round(r),n):n}const o=t=>r(t)>=n,s=(t,n)=>{const r=new Date(t+'T12:00:00Z');return r.setUTCDate(r.getUTCDate()+n),r.toISOString().slice(0,10)},u=(t,n)=>s(t,r(n))},834,[833]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GoldX=h,_e.GoldClose=j,Object.defineProperty(_e,"TEXT_ONLY_CLOSE",{enumerable:!0,get:function(){return x}}),_e.ToastClose=function({onPress:e,label:o="Close",testID:s,size:l="md",style:c,colour:h}){return x?(0,b.jsx)(t.default,{testID:s,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:[{minWidth:64,minHeight:48,alignItems:'center',justifyContent:'center',paddingHorizontal:8},c],children:(0,b.jsx)(u.Text,{style:{fontSize:16,color:h??n.colours.text},children:"Close"})}):(0,b.jsx)(j,{onPress:e,label:o,testID:s,size:l,style:c})},r(d[0]);var t=e(r(d[1])),o=e(r(d[2])),s=r(d[3]),l=e(s),n=r(d[4]),c=r(d[5]),u=r(d[6]),b=r(d[7]);function h({size:e=16,colour:t=n.colours.gold,stroke:o}){const c=o??(e>=20?2.4:2.2);return(0,b.jsx)(l.default,{width:e,height:e,viewBox:"0 0 24 24",accessible:!1,focusable:!1,pointerEvents:"none",children:(0,b.jsx)(s.Path,{d:"M6 6 L18 18 M18 6 L6 18",stroke:t,strokeWidth:Math.min(4,c*(24/e)),strokeLinecap:"round",fill:"none"})})}const f={sm:32,md:38,lg:46},y={sm:13,md:15,lg:18};function j({onPress:e,label:s="Close",testID:l,size:c="md",style:u,disabled:j,hint:x}){const C=f[c],I=Math.max(44,C+8);return(0,b.jsx)(t.default,{testID:l,accessibilityRole:"button",accessibilityLabel:s,accessibilityHint:x,disabled:j,onPress:e,dataSet:{goldClose:'1'},style:[{width:I,height:I,alignItems:'center',justifyContent:'center',flexShrink:0,opacity:j?.4:1},u],children:({pressed:e,hovered:t})=>(0,b.jsx)(o.default,{style:{width:C,height:C,borderRadius:C/2,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:e||t?n.colours.gold:n.colours.accentBorder,backgroundColor:e?n.colours.goldTint:t?n.colours.accentBg:'rgba(0,0,0,0.18)'},children:(0,b.jsx)(h,{size:y[c],colour:e?n.colours.goldLight:n.colours.gold})})})}const x=['kirkton','abbotsford'].includes(c.VENUE_RID)},835,[31,264,128,1017,824,5,873,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return l}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,l=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},836,[1072]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:l,declared:s}){return(0,c.jsxs)(a.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,c.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(d.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,n.isLiveVenue)()?null:(0,c.jsx)(d.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,c.jsx)(a.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:t.ALLERGENS.map(e=>{const n=l[e.id],u=s.find(l=>l.allergen===e.id),f='contains'===n?o.colours.redBg:'may'===n?o.colours.amberBg:o.colours.surface2,h='contains'===n?'#FFD9D4':'may'===n?'#FFE2A8':o.colours.muted;return(0,c.jsxs)(a.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:u?2:1,borderColor:u?o.colours.red:o.colours.border},children:[(0,c.jsx)(d.T,{size:14,weight:"medium",colour:n?h:o.colours.text,children:e.label}),(0,c.jsxs)(d.T,{size:13,colour:h,children:['contains'===n?'Contains':'may'===n?'May contain':'Not listed',u?` \xb7 YOUR ALLERGY (${(0,t.severityLabel)(u.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,c.jsxs)(d.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,c.jsx)(a.default,{testID:"allergen-signoff",children:(0,c.jsx)(d.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${u(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,c.jsx)(d.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:l,declared:n,signedOff:s}){const a=Object.entries(l);return a.length?(0,c.jsx)(d.Row,{wrap:!0,gap:5,children:a.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,l])=>{const s=n.some(l=>l.allergen===e);return(0,c.jsx)(d.Badge,{label:`${s?'\u26a0 ':''}${(0,t.allergenLabel)(e)}${'may'===l?' (may)':''}`,kind:s?'contains'===l?'red':'amber':'neutral'},e)})}):(0,c.jsx)(d.Muted,{children:(0,e.noAllergenWords)(s)})};var e=r(_d[0]);r(_d[1]);var l,n=r(_d[2]),s=r(_d[3]),a=(l=s)&&l.__esModule?l:{default:l},t=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]);const u=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},837,[1295,31,988,128,818,824,817,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BasketButton=function(){const s=(0,l.useBasket)().lines.reduce((e,s)=>e+s.qty,0);return s?(0,c.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Basket, ${s} items`,onPress:()=>e.router.push('/customer/basket'),style:{backgroundColor:u.colours.gold,borderRadius:999,paddingHorizontal:12,paddingVertical:6},children:(0,c.jsxs)(n.T,{weight:"semibold",colour:u.colours.onGold,size:14,children:["Basket \xb7 ",s]})}):null};var e=r(d[0]);r(d[1]);var s,t=r(d[2]),o=(s=t)&&s.__esModule?s:{default:s},l=r(d[3]),u=r(d[4]),n=r(d[5]),c=r(d[6])},838,[805,31,264,822,824,817,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setRecipeCardRepository=function(n){t=n,r.forEach(t=>t())},e.recipeCards=function(){if(!t)throw new Error('Recipe card repository not set up');return t},Object.defineProperty(e,"hasRecipeCards",{enumerable:!0,get:function(){return n}}),e.onRepositorySwap=function(t){return r.add(t),()=>{r.delete(t)}};let t=null;const r=new Set;const n=()=>!!t},839,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Stars=function({value:e,onChange:s,size:n=36}){return(0,c.jsx)(t.Row,{gap:6,children:[1,2,3,4,5].map(u=>(0,c.jsx)(l.default,{disabled:!s,accessibilityRole:"button",accessibilityLabel:`${u} star${u>1?'s':''}`,onPress:()=>s?.(u),hitSlop:4,children:(0,c.jsx)(t.T,{size:n,colour:u<=e?o.colours.gold:'#555',children:"\u2605"})},u))})},r(d[0]);var e,s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),c=r(d[4])},840,[31,264,824,817,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},841,[31,123,264,128,881,817,824,1066,1107,1108,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_VENUE_SLUGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LIVE_VENUE_BUILD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return n}});var c=r(d[0]);const b=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"],f=b.includes(c.VENUE_RID),n=c=>b.includes(c)||['6349aa07-3fec-46e9-8c69-7b1b08494793','41ce63ca-ae46-432d-a5ba-25e1b801e64d','43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6','47f86b36-4c99-466a-be9c-30eb3d79f1e1','e0afad1d-cbc1-414a-add6-92e47d302139','24624ea5-d1e3-4182-b0d1-73402b8a1532','1bc2a056-2ef6-4585-abfd-b7d21c84f215',"59766322-119e-4036-a18a-f6909f60a8d2","596c6f7e-9797-4e16-84fe-db4a99fa1bdc","5d500571-e205-4ead-bb58-60e986b6f40e","f43f20ad-55d0-4008-88c8-7738dc1698df","6abc2793-93ab-4e23-a705-b4011a5cc011","78bff97d-5f07-440a-bb99-f6a6118da7a3","cd985ff5-2443-458d-ac8b-342d553628cf","35f870fc-772c-4aad-bb9e-09a9a16bc925","f500ef12-b405-438b-9671-e54289bec5dd"].includes(c)},842,[5]); +__d(function(_g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MockPay=function({visible:e,onClose:h,amount:p,restaurantId:j,allowGiftCard:b=!0,onPaid:x,title:f="Pay"}){const y=(0,o.useRestaurant)(j),g=(0,o.useGiftCards)(j).filter(e=>e.balance>0),[m,w]=(0,s.useState)(),[P,C]=(0,s.useState)('Test card \u2022\u2022\u2022\u2022 4242'),[T,v]=(0,s.useState)(!1),M=g.find(e=>e.code===m),R=M?Math.min(M.balance,p):0,_=p-R;if(!y?.fictional)return(0,u.jsxs)(c.Sheet,{visible:e,onClose:h,title:f,children:[(0,u.jsxs)(c.T,{children:["Online card payment isn\u2019t set up for this yet, so nothing can be paid here. Please ask at the restaurant",y?.phone?` or phone ${y.phone}`:'',"."]}),(0,u.jsx)(c.Button,{kind:"secondary",label:"Close",onPress:h})]});return(0,u.jsxs)(c.Sheet,{visible:e,onClose:h,title:f,children:[(0,u.jsx)(c.DemoPaymentNotice,{}),b&&g.length>0?(0,u.jsxs)(l.default,{style:{gap:6},children:[(0,u.jsx)(c.T,{weight:"semibold",children:"Use a gift card"}),(0,u.jsxs)(c.Row,{wrap:!0,children:[(0,u.jsx)(c.Chip,{label:"None",selected:!m,onPress:()=>w(void 0)}),g.map(e=>(0,u.jsx)(c.Chip,{label:`${e.code.slice(0,8)}\u2026`,sub:`${(0,n.gbp)(e.balance)} left`,selected:m===e.code,onPress:()=>w(e.code)},e.id))]})]}):null,(0,u.jsx)(c.T,{weight:"semibold",children:"Payment method"}),(0,u.jsx)(c.Row,{wrap:!0,children:['Test card \u2022\u2022\u2022\u2022 4242','Apple Pay (test)','Google Pay (test)'].map(e=>(0,u.jsx)(c.Chip,{label:e,selected:P===e,onPress:()=>C(e)},e))}),(0,u.jsxs)(l.default,{style:{gap:2},children:[(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.Muted,{children:"Amount"}),(0,u.jsx)(c.T,{children:(0,n.gbp)(p)})]}),R?(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.Muted,{children:"Gift card"}),(0,u.jsxs)(c.T,{colour:r.colours.ok,children:["\u2212",(0,n.gbp)(R)]})]}):null,(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.T,{weight:"semibold",children:"To pay now"}),(0,u.jsx)(c.T,{weight:"bold",size:20,colour:r.colours.gold,children:(0,n.gbp)(_)})]})]}),T?(0,u.jsx)(t.default,{color:r.colours.gold}):(0,u.jsx)(c.Button,{label:`Pay ${(0,n.gbp)(_)} \u2014 demo`,onPress:()=>{v(!0),setTimeout(()=>{v(!1),x({giftCardCode:m,giftApplied:R,method:P})},700)},testID:"mock-pay-confirm"})]})};var s=_r(d[0]),t=e(_r(d[1])),l=e(_r(d[2])),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7])},843,[31,247,128,822,819,824,817,25]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftLive=function({slug:e,venue:n}){const{info:x,mine:b,err:S,load:w,pay:k}=j(e),[T,P]=(0,t.useState)(null),[D,C]=(0,t.useState)(''),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(''),[I,M]=(0,t.useState)(''),[E,L]=(0,t.useState)(!1),[R,A]=(0,t.useState)(''),[_,H]=(0,t.useState)(null),F=f(e);if(!x)return(0,h.jsx)(a.Screen,{title:"Gift cards",subtitle:n,children:S?(0,h.jsx)(a.Banner,{kind:"warn",title:S}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const N=D?(0,o.poundsToPence)(D)??0:T??x.amounts[1]??x.amounts[0]??0;return(0,h.jsxs)(a.Screen,{title:"Gift cards",subtitle:`${n}: used only at ${n}`,children:[_?(0,h.jsx)(s.default,{testID:"gift-made",children:(0,h.jsx)(a.Card,{highlight:u.colours.gold,children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift card code"}),(0,h.jsx)(a.T,{size:26,weight:"bold",colour:u.colours.gold,center:!0,children:_.code}),(0,h.jsxs)(a.Muted,{center:!0,children:["Shown once and kept on this phone. Write it down or take a screenshot to give it to ",O||'them',"."]}),(0,h.jsxs)(a.Banner,{kind:"warn",title:`Pay ${(0,l.gbp)(_.pence)} at the bar or till`,children:["Show reference ",_.ref,". The card works once staff mark it paid.",k.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"gift",id:_.id,pay:k})]})})}):null,(0,h.jsx)(g,{onDone:w}),(0,h.jsx)(s.default,{testID:"gift-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift cards"}),b.cards.length?b.cards.map(t=>(0,h.jsxs)(s.default,{style:{gap:2},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{style:{flex:1},children:F[t.id]??`\u2022\u2022\u2022\u2022 ${t.last4}`}),(0,h.jsxs)(a.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balancePence)," of ",(0,l.gbp)(t.initialPence)]})]}),(0,h.jsxs)(a.Muted,{size:12,children:[o.STATUS_WORDS[t.status]??t.status,t.expiresAt?` \xb7 use by ${p(t.expiresAt)}`:'','waiting-payment'===t.status?` \xb7 reference ${t.ref}`:'']}),'waiting-payment'===t.status&&_?.id!==t.id?(0,h.jsx)(m,{slug:e,kind:"gift",id:t.id,pay:k}):null]},t.id)):(0,h.jsx)(a.Muted,{children:"None yet."})]})})}),x.giftsOn?(0,h.jsx)(s.default,{testID:"gift-buy",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:8},children:[(0,h.jsx)(a.H2,{children:"Buy a gift card"}),(0,h.jsx)(a.Row,{wrap:!0,children:x.amounts.map(e=>(0,h.jsx)(a.Chip,{label:(0,l.gbp)(e),selected:!D&&N===e,onPress:()=>{C(''),P(e)}},e))}),(0,h.jsx)(a.Field,{label:`Or another amount (\xa3${x.minPence/100} to \xa3${x.maxPence/100})`,keyboardType:"decimal-pad",value:D,onChangeText:C,placeholder:"e.g. 40",testID:"gift-custom"}),(0,h.jsx)(a.Field,{label:"Who it\u2019s for",value:O,onChangeText:$,testID:"gift-recipient"}),(0,h.jsx)(a.Field,{label:"From",value:v,onChangeText:B}),(0,h.jsx)(a.Field,{label:"Message",value:I,onChangeText:M,multiline:!0,placeholder:"Happy birthday!"}),(0,h.jsxs)(a.Muted,{size:12,children:["Use within ",(0,o.expiryWords)(x.expiryMonths)," of paying. Part-use leaves a balance.",x.terms?` ${x.terms}`:'']}),(0,h.jsx)(s.default,{testID:"gift-pay-placeholder",children:(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER})}),R?(0,h.jsx)(a.Banner,{kind:"warn",title:R}):null,(0,h.jsx)(a.Button,{label:E?'Saving\u2026':`Get a ${(0,l.gbp)(N)} gift card, pay at the till`,testID:"gift-buy-btn",disabled:E||Nx.maxPence,onPress:async()=>{L(!0),A('');try{const t=await(0,c.buyGift)(e,{amount:N,recipient:O,from:v,message:I});t.code&&y(e,t.id,t.code),H({id:t.id,code:t.code??'',ref:t.ref,pence:t.initialPence}),w()}catch(e){A((0,r.plainError)(e))}finally{L(!1)}}})]})})}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n} isn\u2019t selling gift cards in the app yet`,children:"Ask at the bar."})]})},_e.ShopLive=function({slug:e,venue:n,guestName:p}){const{info:x,mine:f,err:y,load:b,pay:S}=j(e),[w,k]=(0,t.useState)({}),[T,P]=(0,t.useState)(p),[D,C]=(0,t.useState)(!1),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(null);if(!x)return(0,h.jsx)(a.Screen,{title:"Shop",subtitle:n,children:y?(0,h.jsx)(a.Banner,{kind:"warn",title:y}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const I=Object.entries(w).filter(([,e])=>e>0).map(([e,t])=>({id:e,qty:t})),M=(0,o.basketTotal)(I,x.products);return(0,h.jsxs)(a.Screen,{title:"Shop",subtitle:`${n}: collect at the venue`,children:[v?(0,h.jsxs)(s.default,{testID:"shop-done",children:[(0,h.jsxs)(a.Banner,{kind:"warn",title:`Order ${v.ref}: pay ${(0,l.gbp)(v.total)} at the bar or till`,children:["Staff will have it ready to collect once it\u2019s paid.",S.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"shop",id:v.id,pay:S})]}):null,(0,h.jsx)(g,{onDone:b}),x.shopOn?(0,h.jsxs)(h.Fragment,{children:[x.products.length?x.products.map(e=>(0,h.jsx)(s.default,{testID:`shop-item-${e.id}`,children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,h.jsx)(a.T,{colour:u.colours.gold,children:(0,l.gbp)(e.pricePence)})]}),e.details?(0,h.jsx)(a.Muted,{children:e.details}):null,e.soldOut?(0,h.jsx)(a.Badge,{kind:"amber",label:"Sold out"}):(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(a.Muted,{children:"How many"}),(0,h.jsx)(a.Stepper,{value:w[e.id]??0,min:0,max:20,label:`${e.name} quantity`,onChange:t=>k({...w,[e.id]:t})})]})]})})},e.id)):(0,h.jsx)(a.Muted,{children:"Nothing in the shop yet."}),I.length?(0,h.jsx)(s.default,{testID:"shop-basket",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",children:"Total"}),(0,h.jsx)(a.T,{weight:"semibold",colour:u.colours.gold,children:(0,l.gbp)(M)})]}),(0,h.jsx)(a.Field,{label:"Name for collection",value:T,onChangeText:P,testID:"shop-name"}),(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER}),O?(0,h.jsx)(a.Banner,{kind:"warn",title:O}):null,(0,h.jsx)(a.Button,{label:D?'Sending\u2026':'Order, pay at the till',testID:"shop-order-btn",disabled:D||!T.trim(),onPress:async()=>{C(!0),$('');try{const t=await(0,c.shopOrder)(e,I,T);B({id:t.id,ref:t.ref,total:t.totalPence}),k({}),b()}catch(e){$((0,r.plainError)(e))}finally{C(!1)}}})]})})}):null]}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n}\u2019s shop isn\u2019t open in the app yet`,children:"Ask at the bar."}),f.orders.length?(0,h.jsx)(s.default,{testID:"shop-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsx)(a.H2,{children:"Your shop orders"}),f.orders.map(e=>(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(a.T,{style:{flex:1},children:[e.ref," \xb7 ",e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')]}),(0,h.jsx)(a.Muted,{children:o.STATUS_WORDS[e.status]??e.status})]},e.ref))]})})}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},a=_r(d[2]),l=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]);const p=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},x=e=>`cc-gift-codes:${e}:v1`;function f(e){try{return JSON.parse(globalThis.localStorage?.getItem(x(e))||'{}')}catch{return{}}}function y(e,t,n){try{const s=f(e);s[t]=n,globalThis.localStorage?.setItem(x(e),JSON.stringify(s))}catch{}}function j(e){const[n,s]=(0,t.useState)(null),[a,l]=(0,t.useState)({cards:[],orders:[]}),[o,u]=(0,t.useState)(''),[h,p]=(0,t.useState)({provider:'none',cardOn:!1,testMode:!0}),x=(0,t.useCallback)(()=>{u(''),(0,c.shopPublic)(e).then(s).catch(e=>u((0,r.plainError)(e))),(0,c.myShop)(e).then(l).catch(()=>{}),(0,c.payPublic)(e).then(p)},[e]);return(0,t.useEffect)(()=>{x()},[x]),{info:n,mine:a,err:o,load:x,pay:h}}function g({onDone:e}){const[n,l]=(0,t.useState)('');return(0,t.useEffect)(()=>{const t='undefined'!=typeof window?new URLSearchParams(window.location.search).get('paid'):null;if(!t||!/^[0-9a-f-]{36}$/.test(t))return;let n=0;const s=()=>(0,c.payStatus)(t).then(t=>{l(t.status),'paid'===t.status?e():n++<10&&setTimeout(s,2e3)}).catch(()=>{});s()},[e]),n?(0,h.jsx)(s.default,{testID:"pay-back",children:(0,h.jsx)(a.Banner,{kind:'paid'===n?'success':'warn',title:'paid'===n?'Paid by card (TEST MODE: no real money)':'expired'===n?'The card payment timed out. Pay at the bar or till.':'Checking the card payment\u2026'})}):null}function m({slug:e,kind:n,id:l,pay:o}){const[u,p]=(0,t.useState)(!1),[x,f]=(0,t.useState)('');return o.cardOn?(0,h.jsxs)(s.default,{testID:`pay-card-${n}`,style:{gap:4},children:[(0,h.jsx)(a.Button,{label:u?'Opening card payment\u2026':'Pay by card (TEST MODE)',kind:"secondary",disabled:u,onPress:async()=>{p(!0),f('');try{const t=await(0,c.payStart)(e,n,l);window.location.assign(t.url)}catch(e){f((0,r.plainError)(e))}finally{p(!1)}}}),(0,h.jsx)(a.Muted,{size:12,children:"Test mode: use a Stripe test card. No real money is taken."}),x?(0,h.jsx)(a.Banner,{kind:"warn",title:x}):null]}):null}},844,[31,128,817,819,1059,1537,1538,824,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"guestServer",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"useGuestLoyalty",{enumerable:!0,get:function(){return _}}),e.refreshGuest=async function(t){if(!c())return;_.setState(n=>({loading:{...n.loading,[t]:!0}}));try{const n=await(0,o.rpc)('loyalty_public',{p_venue_slug:t});if(_.setState(r=>({info:{...r.info,[t]:n}})),await(0,o.guestSession)()){const n=await(0,o.rpc)('loyalty_my_card',{p_venue_slug:t});_.setState(r=>({card:{...r.card,[t]:n??null}}))}}finally{_.setState(n=>({loading:{...n.loading,[t]:!1}}))}},e.guestJoin=async function(t,n){if(!await(0,o.guestSession)())throw new Error('No connection. Try again when you are back online.');const r=await(0,o.rpc)('loyalty_guest_join',{p_venue_slug:t,p_name:n.name.trim(),p_phone:n.phone.trim()||null,p_email:n.email.trim()||null,p_consent:n.consent,p_consent_text:n.consentText,p_referral:n.referral?(0,l.cleanCode)(n.referral):null});return p(t,r),r},e.guestClaim=async function(t,n){if(!await(0,o.guestSession)())return{ok:!1,error:'No connection. Try again when you are back online.'};const r=await(0,o.rpc)('loyalty_guest_claim',{p_venue_slug:t,p_code:(0,l.cleanCode)(n)});return r?.error?{ok:!1,error:String(r.error)}:(p(t,r),{ok:!0,card:r,linked:!!r.linked})},e.guestLinkCode=async function(t){return(0,o.rpc)('loyalty_guest_link_code',{p_venue_slug:t})},e.guestLeave=async function(t){await(0,o.rpc)('loyalty_guest_leave',{p_venue_slug:t}),p(t,null)},Object.defineProperty(e,"staffFind",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"staffCard",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"staffStamp",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"staffRedeem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"staffJoin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"staffCode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"staffRemove",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"loyaltySummary",{enumerable:!0,get:function(){return P}}),e.readSettings=async function(){const{data:t,error:n}=await u().from('loyalty_settings').select('*').eq('venue_id',y()).maybeSingle();if(n)throw n;return(0,l.settingsFromRow)(t)},e.saveSettings=async function(t){const{error:n}=await u().from('loyalty_settings').upsert({venue_id:y(),...(0,l.settingsToRow)(t),updated_by:(o.useSync.getState().staffRef??'').slice(0,80)||'manager',updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readOffers=k,e.saveOffer=C,e.watchLoyalty=function(t){if(!f())return()=>{};const n=y();let r=u().channel(`cc-loyalty:${n}:${Math.random().toString(36).slice(2,8)}`);for(const o of['loyalty_settings','loyalty_offers','loyalty_guests','loyalty_stamps','loyalty_rewards','loyalty_referrals'])r=r.on('postgres_changes',{event:'*',schema:'public',table:o,filter:`venue_id=eq.${n}`},()=>t());return r.subscribe(),()=>{try{u().removeChannel(r)}catch{}}},e.migrateLocalOnce=async function(t,n,r){if(!f())return 0;const o=`loyalty:migrated:${y()}`;if(await n(o))return 0;let s=0;if(!(await k()).length)for(const n of t.offers.filter(t=>'offer'===t.kind&&!JSON.stringify(t).includes('(example)')))await C({title:n.title.slice(0,80),details:(n.body??'').slice(0,500),startsOn:null,endsOn:n.until??null,isOn:!!n.live}),s++;return await r(o),s};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=_r(d[3]),s=_r(d[4]),l=_r(d[5]);const u=()=>(0,n.getSupabase)(),c=()=>(0,r.isSupabaseConfigured)()&&!s.PITCH,f=()=>c()&&'staff'===o.useSync.getState().kind&&!!o.useSync.getState().venueId,y=()=>{const t=o.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},_=(0,t.create)(()=>({info:{},card:{},loading:{}}));const p=(t,n)=>_.setState(r=>({card:{...r.card,[t]:n}}));const b=t=>(0,o.rpc)('loyalty_staff_find',{p_venue:y(),p_q:t}),w=t=>(0,o.rpc)('loyalty_staff_card',{p_guest:t}),v=t=>(0,o.rpc)('loyalty_staff_stamp',{p_guest:t}),S=t=>(0,o.rpc)('loyalty_staff_redeem',{p_reward:t}),O=t=>(0,o.rpc)('loyalty_staff_join',{p_venue:y(),p_name:t.name.trim(),p_phone:t.phone.trim()||null,p_email:t.email.trim()||null,p_consent:t.consent,p_consent_text:t.consentText}),h=(t,n)=>(0,o.rpc)('loyalty_staff_code',{p_venue:y(),p_kind:t,p_guest:n??null}),j=t=>(0,o.rpc)('loyalty_staff_remove',{p_guest:t}),P=()=>(0,o.rpc)('loyalty_summary',{p_venue:y()});async function k(){const{data:t,error:n}=await u().from('loyalty_offers').select('*').eq('venue_id',y()).order('created_at');if(n)throw n;return(t??[]).map(l.offerFromRow)}async function C(t){const n={venue_id:y(),title:t.title.trim(),details:t.details.trim(),starts_on:t.startsOn||null,ends_on:t.endsOn||null,is_on:t.isOn,updated_at:(new Date).toISOString()},{error:r}=t.id?await u().from('loyalty_offers').update(n).eq('id',t.id):await u().from('loyalty_offers').insert(n);if(r)throw r}},845,[1072,871,1136,823,2,1059]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},860,[31,264,128,288,817,824,1003,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"leaveOn",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"leaveRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return b}}),_e.liveAttendance=function(e){const t=y.get(e);if(t)return t;const n=e.some(e=>e.voided)?e.filter(e=>!e.voided):e;return y.set(e,n),n},Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return P}}),_e.openShiftOf=A,_e.loggedBreakMins=M,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return F}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),n=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,n)=>t&&n.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${n} (${t})`:n},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return Q}});var e,t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),i=_r(_d[3]),s=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=(e=d)&&e.__esModule?e:{default:e},f=_r(_d[8]),u=_r(_d[9]),l=_r(_d[10]),p=_r(_d[11]);const m=(e,t,n)=>e.find(e=>e.staffId===t&&'approved'===e.status&&e.from<=n&&n<=e.to),h={decide:null},g=e=>e.out?e.signOff?'confirmed':'awaiting':'open',b=e=>!!e.out&&!!e.signOff,y=new WeakMap;const k={send:null},I=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,w=e=>{const[t,n,a]=e.split('-').map(Number);return(new Date(t,n-1,a).getDay()+6)%7},E=(e,t)=>{const[n,a,i]=e.split('-').map(Number);return I(new Date(n,a-1,i+t))},S=e=>E(e,-w(e)),O=(e,t)=>e.filter(e=>e.date===t),v=(e,t,n)=>e.find(e=>e.staffId===t&&e.date===n),R=(e,t)=>t?e:e.filter(e=>e.published),_=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],$=1271,L=6,D=['ql-wix-view','ql-wix-edit'],T=e=>D.includes(e.id)||'Website bookings'===e.group,P=[{id:'ql-gmail',label:'Work email (Gmail)',url:'',icon:'\u2709\ufe0f',kind:'gmail',staff:!1,builtIn:!0},{id:'ql-wix-view',label:'View site',url:'https://www.anchoragedunure.com',icon:'\ud83c\udf10',kind:'link',group:'Website bookings',staff:!1,builtIn:!0},{id:'ql-wix-edit',label:'Edit site',url:'https://manage.wix.com',icon:'\ud83d\udd8a\ufe0f',kind:'link',group:'Website bookings',staff:!1,builtIn:!0}];function A(e,t,n){const a=new Date(n).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&a-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function M(e,t=new Date){const n=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():n)-new Date(t.start).getTime()),0)/6e4)}const j=e=>!!e?.breaks?.some(e=>!e.end),N=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,C=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function B(){return l.ROSTER.map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},role:e.role,job:e.job,active:!0,level:e.level,dept:e.dept,salaried:e.salaried,noTax:e.noTax,...U.includes(e.id)?{displayClock:!0}:{}}))}const U=['st-jack'];function V(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const q=()=>{const e={tronc:{method:'hours',points:{FOH:1,Bar:1,Kitchen:.8,KP:.6,Manager:1},includeManagers:!0,includeOwner:!1,custom:{},text:'The Anchorage tipping policy (template)\n\n1. 100% of tips paid by card and cash tips put in the tip jar go to staff. Nothing is deducted.\n2. Tips are pooled and shared by paid hours worked in each pay period (breaks excluded).\n3. The owner does not take a share. Managers share only for hours worked on the floor or in the kitchen.\n4. Tips are paid with wages, no later than the end of the month after the tip was paid.\n5. Tip records are kept for 3 years. Ask a manager for your records at any time.'},troncCash:{},troncHistory:[],troncLog:[],chat:[],chatMuted:{},chatRead:{},referral:{giverReward:'Free dessert',friendReward:'\xa35 off first order',active:!0},referrals:[],reminders:{h24:!0,h2:!0,confirmText:!0},coats:[],merch:[],merchOrders:[],marketingDraft:void 0,socialAccounts:{facebook:!0,instagram:!0,tiktok:!0,youtube:!0},socialPosts:[],socialDraft:void 0,quickLinks:P.map(e=>({...e})),workEmail:'',staff:B(),rosterVersion:l.ROSTER_VERSION,previewRole:'owner',staffAs:l.ROSTER.find(e=>'staff'===e.app)?.id??l.ROSTER[0]?.id??'',offers:[],photos:[],changeRequests:[],changesUsed:2,site:t.VENUE_RID,branding:{},checks:{},lost:[],lostReports:[],campaigns:[],shifts:[],rotaPublished:void 0,leave:[],swaps:[],availability:{},attendance:[],attLog:[],timeRequests:[],geofence:{lat:55.4047,lng:-4.7606,radius:100},simLocation:'venue',consent:{},hourly:V(),payPeriod:'weekly',suppliers:[],supplierOrders:[],staffCanViewSuppliers:!1,readNotes:{},customerTags:{'cust-demo':['Allergy','Regular'],'cr-2':['VIP'],'cr-5':['Takeaway']}};if(s.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE)return{...e,changesUsed:0,customerTags:{},socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1}};if(!t.IS_ISOLATED_VENUE)return e;for(const t of Object.keys(e))Array.isArray(e[t])&&(e[t]=[]);return{...e,site:t.VENUE_RID,staffAs:'',hourly:{},customerTags:{},geofence:{lat:0,lng:0,radius:100},tronc:{...e.tronc,text:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].name+' tipping policy \u2014 to confirm.':t.IS_ABBOTSFORD?'The Abbotsford Hotel tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKTON?'The Kirkton Inn tipping policy \u2014 awaiting venue confirmation.':t.IS_GREENSIDE?'The Greenside Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_WILDINGS?'Wildings Hotel & Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKMICHAEL?"The Kirkmichael Arms tipping policy \u2014 awaiting venue confirmation.":"Souter's Inn tipping policy \u2014 awaiting venue confirmation."},changesUsed:0,socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1},quickLinks:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?[]:t.IS_GREENSIDE?[{id:'greenside-phone',label:'Call 01655 889685',url:'tel:01655889685',icon:'',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_WILDINGS?[{id:'wildings-phone',label:'Call to book',url:'tel:01655331401',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0},{id:'wildings-email',label:'Email to book',url:'mailto:bookings@wildingsrestaurant-hotel.co.uk',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_KIRKMICHAEL?[{id:'kirkmichael-site',label:'Venue website',url:'https://www.kirkmichaelarms.co.uk/',icon:'\ud83c\udf10',kind:'link',group:'Website',staff:!0,builtIn:!0}]:[{id:'souters-book',label:'Guest table requests',url:'https://covercharge-apps.static.hf.space/souters/customer-app/',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}],branding:{[t.VENUE_RID]:{accent:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?a.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},x=(0,f.create)()((0,u.persist)((e,n)=>({...q(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,n,a)=>e(e=>({staff:[...e.staff,{id:N('st'),name:t,role:n,job:a,active:!0,level:W[n]}]})),saveSupplier:t=>e(e=>({suppliers:e.suppliers.some(e=>e.id===t.id)?e.suppliers.map(e=>e.id===t.id?t:e):[...e.suppliers,t]})),setRate:(t,n)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(n))}})),clearRate:t=>e(e=>{const n={...e.hourly};return delete n[t],{hourly:n}}),updateStaff:(t,n)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...n}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:N('of')},...e.offers]})),updateOffer:(t,n)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...n}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:N('ph'),caption:t,tone:C[e.photos.length%C.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,n)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:N('cr'),text:t,at:n,status:'requested'},...e.changeRequests]}),setSite:n=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:n}),setBranding:(t,n)=>e(e=>{const a={...e.branding};return n?a[t]={...a[t],...n}:delete a[t],{branding:a}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:N('sp')},...e.socialPosts]})),setSocialPost:(t,n)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...n}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,n,a)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[n]??[];return{...e,reactions:{...e.reactions,[n]:i.includes(a)?i.filter(e=>e!==a):[...i,a]}}})})),chatSeen:(t,n)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(n))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(n)?e:{...e,seenBy:[...e.seenBy,n]})}:e),chatMarkRead:(t,n)=>e(e=>{const a={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(n))(!a[e]||Date.parse(t)>Date.parse(a[e]))&&(a[e]=t);const i=e=>Math.max(Date.parse(a['*']??'')||0,Date.parse(a[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:a},chat:s}}),chatPatch:(t,n)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...n}:e)})),chatMute:(t,n)=>e(e=>{const a=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),sys:(t,n,a)=>e(e=>({chat:[...e.chat,{id:N('m'),ch:t,from:'system',text:n,at:a,reactions:{},seenBy:[]}]})),tick:(t,n,a,i)=>e(e=>({checks:{...e.checks,[t]:{by:n,at:a,value:i}}})),untick:t=>e(e=>{const n={...e.checks};return delete n[t],{checks:n}}),addLost:t=>e(e=>({lost:[{...t,id:N('lp'),status:'held'},...e.lost]})),setLost:(t,n)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...n}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:N('cp')},...e.campaigns]})),setCampaign:(t,n)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...n}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:w(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:w(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,a)=>{const i=n(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const n=E(t,e),o=E(a,e);i.shifts.filter(e=>e.date===n&&s.has(e.staffId)&&!m(i.leave,e.staffId,o)&&!i.shifts.some(t=>t.staffId===e.staffId&&t.date===o)&&!r.some(t=>t.staffId===e.staffId&&t.date===o)).forEach(e=>r.push({id:(0,p.uuid)(),staffId:e.staffId,date:o,day:w(o),start:e.start,end:e.end,note:e.note,published:!1}))}return r.length&&e({shifts:[...i.shifts,...r]}),r.length},publishWeek:t=>{const n=E(t,6);let a=0;return e(e=>({shifts:e.shifts.map(e=>e.daten||e.published&&!e.changed?e:(a++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),a},removeShift:t=>e(e=>({shifts:e.shifts.filter(e=>e.id!==t)})),markRead:t=>e(e=>({readNotes:{...e.readNotes,...Object.fromEntries(t.map(e=>[e,!0]))}})),toggleTag:(t,n)=>e(e=>{const a=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>{const n={...t,id:(0,p.uuid)(),status:t.status??'pending'};return e(e=>({leave:[n,...e.leave]})),n},setLeave:(t,a)=>{e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:a}:e)}));const i=n().leave.find(e=>e.id===t);i&&h.decide?.(i)},addSwap:t=>e(e=>({swaps:[{...t,id:N('sw'),status:'open'},...e.swaps]})),setSwap:(t,n)=>e(e=>{const a=e.swaps.find(e=>e.id===t);return{shifts:'approved'===n&&a?.toId?e.shifts.map(e=>e.id===a.shiftId?{...e,staffId:a.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:n}:e)}}),toggleAvail:(t,n)=>e(e=>{const a=e.availability[t]??[];return{availability:{...e.availability,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),clock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.filter(e=>e.staffId===t&&e.in&&!e.out&&new Date(i).getTime()-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0];if('in'===a)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:n,in:i,inSite:s}]};const d=e=>e?.map(e=>e.end?e:{...e,end:i});return o?{attendance:e.attendance.map(e=>e.id===o.id?{...e,out:i,outSite:s,breakMins:r??M({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.find(e=>e.id===t),d=e.staff.find(e=>e.id===o?.staffId),c=o?.[n]?new Date(o[n]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[n]:a,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:N('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${n} from ${c} to ${new Date(a).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,n,a)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...n,geo:a?[...e.geo??[],a].slice(-20):e.geo}:e)})),breakToggle:(t,a,i)=>{const s=n(),r=A(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===a?d:!d)return!1;const c='start'===a?[...o,{start:i}]:o.map(e=>e.end?e:{...e,end:i});return e({attendance:s.attendance.map(e=>e.id===r.id?{...e,breaks:c,breakMins:M({breaks:c})}:e)}),!0},adjustBreak:(t,n,a,i,s)=>e(e=>{const r=e.attendance.find(e=>e.id===t),o=e.staff.find(e=>e.id===r?.staffId);return{attendance:e.attendance.map(e=>e.id===t?{...e,breakMins:n,adjusted:{by:a,at:s,reason:i}}:e),attLog:[{id:N('al'),at:s,text:`${a} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${n}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const a=n(),i=t.id?a.attendance.find(e=>e.id===t.id):void 0,s=t.reason.trim();if(s.length<3)return null;if(t.out&&t.out<=t.in)return null;const r=e=>e?new Date(e).toTimeString().slice(0,5):'none',o=(e,n,a)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:n,to:a,reason:s}),d=a.staff.find(e=>e.id===t.staffId)?.name??'staff';let c;const f=[];if(i){const e=[...i.audit??[]];if(i.signOff&&(e.push(o('reopened','Confirmed','Awaiting sign-off')),f.push(`${t.by} reopened ${d}'s confirmed ${i.date} entry`)),i.in!==t.in&&(e.push(o('clock_in',r(i.in),r(t.in))),f.push(`${t.by} changed ${d} clock-in from ${r(i.in)} to ${r(t.in)}: ${s}`)),(i.out??'')!==(t.out??'')&&(e.push(o('clock_out',r(i.out),r(t.out))),f.push(`${t.by} changed ${d} clock-out from ${r(i.out)} to ${r(t.out)}: ${s}`)),(i.breakMins??0)!==t.breakMins&&(e.push(o('break',`${i.breakMins??0}m`,`${t.breakMins}m`)),f.push(`${t.by} changed ${d} break from ${i.breakMins??0}m to ${t.breakMins}m: ${s}`)),e.length===(i.audit??[]).length)return i;const n=t.out?i.breaks?.map(e=>e.end?e:{...e,end:t.out}):i.breaks;c={...i,in:t.in,out:t.out,breakMins:t.breakMins,breaks:n,signOff:void 0,adjusted:{by:t.by,at:t.now,reason:s},audit:e}}else c={id:t.id??(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:s},audit:[o('added',void 0,`${r(t.in)}\u2013${t.out?r(t.out):'open'}, break ${t.breakMins}m`)]},f.push(`${t.by} added ${d}'s ${t.date} entry ${r(t.in)}\u2013${t.out?r(t.out):'open'} (break ${t.breakMins}m): ${s}`);return t.request&&(c={...c,audit:[...c.audit??[],o('request_applied')]}),k.send?.('attendance_override',c,{reason:s}),e(e=>({attendance:i?e.attendance.map(e=>e.id===i.id?c:e):[...e.attendance,c],attLog:[...f.reverse().map(e=>({id:N('al'),at:t.now,text:e})),...e.attLog]})),c},voidEntry:(t,a,i,s,r)=>{const o=n(),d=o.attendance.find(e=>e.id===t);if(!d||d.voided||d.signOff||s.trim().length<3)return!1;const c={...d,voided:{by:a,at:r,reason:s.trim()},audit:[...d.audit??[],{at:r,by:a,byId:i,action:'voided',from:'In hours',to:'Removed',reason:s.trim()}]};k.send?.('attendance_void',c,{reason:s.trim()});const f=o.staff.find(e=>e.id===d.staffId)?.name??'staff';return e({attendance:o.attendance.map(e=>e.id===t?c:e),attLog:[{id:N('al'),at:r,text:`${a} removed ${f}'s ${d.date} shift (kept in the history): ${s.trim()}`},...o.attLog]}),!0},deleteEntry:(t,a,i,s)=>{const r=n(),o=r.attendance.find(e=>e.id===t);if(!o)return{ok:!1,message:'Not found.'};if(o.signOff)return{ok:!1,message:"This shift has been signed off and can't be deleted."};const d={...o,audit:[...o.audit??[],{at:s,by:a,byId:i,action:'voided',from:'In hours',to:'Deleted'}]};k.send?.('attendance_delete',d);const c=r.staff.find(e=>e.id===o.staffId)?.name??'staff';return e({attendance:r.attendance.filter(e=>e.id!==t),attLog:[{id:N('al'),at:s,text:`${a} deleted ${c}'s ${o.date} shift`},...r.attLog]}),{ok:!0}},addPastShift:t=>{if(!t.staffId||!t.in||!t.out||t.out<=t.in)return null;const a=(t.note??'').trim()||'Past shift (historical entry)',i={id:(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:a},signOff:{by:t.by,byId:t.byId,at:t.now},audit:[{at:t.now,by:t.by,byId:t.byId,action:'added',to:`${t.in}\u2013${t.out}, break ${t.breakMins}m`,reason:a},{at:t.now,by:t.by,byId:t.byId,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed',reason:'Historical entry'}]};k.send?.('attendance_add_past',i,{reason:a});const s=n().staff.find(e=>e.id===t.staffId)?.name??'staff';return e(e=>({attendance:[...e.attendance,i],attLog:[{id:N('al'),at:t.now,text:`${t.by} entered ${s}'s past shift on ${t.date}`},...e.attLog]})),i},confirmEntries:(t,a,i,s)=>{const r=n(),o=new Set(t),d=[],c=r.attendance.map(e=>{if(!o.has(e.id)||!e.out||e.signOff)return e;const t={...e,signOff:{by:a,byId:i,at:s},audit:[...e.audit??[],{at:s,by:a,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>k.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:N('al'),at:s,text:`${a} confirmed ${d.length} ${1===d.length?'entry':'entries'} (${[...new Set(d.map(e=>e.date))].join(', ')})`},...r.attLog]}),d.length):0},addTimeRequest:t=>e(e=>({timeRequests:[{...t,id:(0,p.uuid)(),status:'open'},...e.timeRequests]})),resolveTimeRequest:(t,a,i,s)=>{const r=n().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:a,resolvedBy:i,resolvedAt:s};k.send?.('time_request_resolve',o),e(e=>({timeRequests:e.timeRequests.map(e=>e.id===t?o:e)}))},setGeofence:t=>e(e=>({geofence:{...e.geofence,...t}})),setSimLocation:t=>e({simLocation:t}),giveConsent:(t,n)=>e(e=>({consent:{...e.consent,[t]:n}})),resetOwner:()=>e(q()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const n=new Set(e.staff.map(e=>e.id)),a=B().filter(e=>!n.has(e.id));return{staff:a.length?[...e.staff,...a]:e.staff,hourly:{...e.hourly,...V()},rosterVersion:l.ROSTER_VERSION}})}),{name:'covercharge-owner-v1',version:6,storage:(0,u.createJSONStorage)(()=>c.default),migrate:async(e,t)=>{if(s.LIVE_VENUE_BUILD&&e)return await(0,o.archiveChefCache)('owner',e),{...e,...(0,i.stripOwnerLiveSamples)(e)};if(e&&t<2&&Array.isArray(e.quickLinks)&&(e.quickLinks=e.quickLinks.map(e=>D.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=q();Object.assign(e,{staff:t.staff,hourly:t.hourly,shifts:t.shifts,leave:t.leave,swaps:t.swaps,availability:t.availability,attendance:[],attLog:[],consent:{},chat:[],chatMuted:{},troncHistory:[],staffAs:t.staffAs,previewRole:'owner',rosterVersion:l.ROSTER_VERSION,rotaPublished:void 0})}if(e&&t<4){const t=S(I(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:E(t,e.day??0),published:!0}),e.timeRequests=e.timeRequests??[]}return s.LIVE_VENUE_BUILD&&e&&(Object.assign(e,(0,i.stripOwnerLiveSamples)(e)),e.chat=(e.chat||[]).filter(e=>!(0,r.isSeedChefChat)(e)),e.suppliers=(e.suppliers||[]).filter(e=>!/^sup-[1-9]$/.test(e.id)||!/^(Example|Sample)\b/.test(e.name)),e.supplierOrders=(e.supplierOrders||[]).filter(e=>!/\(example\)/i.test(e.by||''))),e}})),K=(e,t,n)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${n(t)}/h`,W={owner:'Owner',manager:'Manager',staff:'Staff'},F={forecasts:e=>'staff'!==e,manage:e=>'staff'!==e,staffAdmin:e=>'owner'===e,billing:e=>'owner'===e,takings:e=>'staff'!==e,publishSocial:e=>'staff'!==e};const G=e=>[e.name.replace(/\s*\([^)]*\)\s*$/,'').replace(' (example)',''),e.nickname??''].map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>[e,e.split(' ')[0]]).filter((e,t,n)=>n.indexOf(e)===t),H=(e,t)=>{const n=t.trim().toLowerCase();if(!n)return!1;const a=G(e);return a.includes(n)||a.includes(n.split(' ')[0])},Q=(e,t)=>{const n=t.trim().toLowerCase();return!n||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(n))}},861,[5,6,1216,1217,842,1219,1221,1080,1072,1081,15,1241]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return T}}),_e.BoardPhoto=M,_e.PhotoZoom=S,_e.SpecialRow=I,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const n=(0,f.useSpecials)(t=>t.current[e]??null),[o,c]=(0,s.useState)(null),[h,x]=(0,s.useState)('');if((0,s.useEffect)(()=>(0,w.watchGuestSpecials)(e,x),[e]),!n)return(0,k.jsx)(p.Card,{children:(0,k.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,k.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,k.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,k.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."}),h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null]})});const C=n.allergenCheck;return(0,k.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[h?(0,k.jsx)(p.Muted,{center:!0,testID:"specials-sync-note",children:h}):null,(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(n,l)})}),(0,y.isToday)(n.postedAt,l)?(0,k.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,k.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(n.postedAt,l)?null:(0,k.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),n.photo?(0,k.jsxs)(u.default,{style:{gap:4},children:[(0,k.jsx)(M,{photo:n.photo,testID:"specials-photo",onPress:()=>c(n.photo)}),(0,k.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,n.items.map(e=>(0,k.jsx)(I,{it:e,declared:t,signedBy:C?.by},e.id)),C?(0,k.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",C.by.replace(' (example)','')," at ",(0,j.hm)(new Date(C.at)),"."]}):null,n.photo&&!n.items.length?(0,k.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,k.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,k.jsx)(S,{photo:o,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]),k=r(d[15]);const C=r(d[16]),T=e=>e===y.SAMPLE_PHOTO?C:{uri:e};function M({photo:e,width:n,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,k.jsx)(l.default,{source:T(e),resizeMode:"contain",accessibilityLabel:p,style:{width:n??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,k.jsx)(o.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,k.jsx)(u.default,{testID:h,children:j})}function S({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,k.jsx)(n.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,k.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,k.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,k.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,k.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,k.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,k.jsx)(o.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,k.jsx)(M,{photo:e,width:h?820:360})}):null})})]})})}function I({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,k.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,k.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,k.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,k.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,k.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,k.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,k.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,k.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,k.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,k.jsx)(h.AllergenChips,{map:e.allergens,declared:t,signedOff:!1}),s?(0,k.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},862,[887,31,197,257,264,152,128,837,817,863,818,864,821,824,1327,25,1524]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSpecials",{enumerable:!0,get:function(){return _}});var e,t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),n=r(_d[3]),o=r(_d[4]),c=(e=o)&&e.__esModule?e:{default:e},l=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),y=r(_d[9]);const p=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock)}catch{return new Date}};let S=0;const f=()=>`sb-${Date.now().toString(36)}${(S++).toString(36)}`,b=(e,t)=>u.useStore.setState(s=>({audit:[{id:`au-${f()}`,restaurantId:e,at:p().toISOString(),kind:'allergy',text:t},...s.audit].slice(0,300)})),_=(0,l.create)()((0,d.persist)((e,t)=>({...n.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{current:{},history:[]}:(0,h.seedSpecials)(p()),post:(t,s,i,n)=>{e(e=>(0,h.postBoard)(e,t,s,i,n,p(),f())),s.items.length&&b(t,`Specials board: allergens for ${s.items.length} typed special${1===s.items.length?'':'s'} checked and signed off by ${i}`)},clear:(t,s)=>{e(e=>(0,h.clearBoard)(e,t)),b(t,`Specials board cleared by ${s}`)},reuse:(s,i,n,o)=>{const c=t().history.find(e=>e.id===i);e(e=>(0,h.reuseBoard)(e,s,i,n,o,p(),f())),c?.items.length&&b(s,`Specials board re-used: ${c.items.length} typed special${1===c.items.length?'':'s'}, allergens as previously checked, signed off by ${n}`)},remove:t=>e(e=>(0,h.deleteFromHistory)(e,t))}),{name:'covercharge-specials-v1',storage:(0,d.createJSONStorage)(()=>c.default),version:1,partialize:e=>({current:e.current,history:e.history})})),E=async()=>{if(!(0,y.liveData)())return;const e=_.getState(),n=e=>String(e.id).startsWith('sb-seed')&&(!s.LIVE_VENUE_BUILD||(0,t.demoActor)(e.postedBy)&&(!e.allergenCheck||(0,t.demoActor)(e.allergenCheck.by))&&(!e.photo||e.photo===h.SAMPLE_PHOTO)&&e.items.every(e=>/\(sample\)/i.test(e.name))),o=Object.fromEntries(Object.entries(e.current).filter(([,e])=>!(e&&n(e)))),c=e.history.filter(e=>!n(e));Object.keys(o).length===Object.keys(e.current).length&&c.length===e.history.length||(s.LIVE_VENUE_BUILD&&await(0,i.archiveChefCache)('specials',{current:e.current,history:e.history}),_.setState({current:o,history:c}))};(0,y.onDataModeChange)(E);try{_.persist?.onFinishHydration?.(E)}catch{}E()},863,[1219,842,1221,5,1080,1072,1081,864,878,1112]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAMPLE_PHOTO",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_MAX",{enumerable:!0,get:function(){return n}}),e.parsePrice=function(t){const n=t.trim().replace(/^\xa3\s*/,'');return n?/^\d{1,3}(\.\d{1,2})?$/.test(n)?Math.round(100*parseFloat(n)):NaN:null},Object.defineProperty(e,"priceText",{enumerable:!0,get:function(){return s}}),e.itemProblems=a,e.draftProblems=i,e.cycleAllergen=function(t,n){const s={...t};s[n]?'contains'===s[n]?s[n]='may':delete s[n]:s[n]='contains';return s},e.postBoard=function(t,n,s,a,l,c,d){const u=i(s);if(u.length)throw new Error(u[0]);const p={id:d,restaurantId:n,photo:s.photo,app:l,postedBy:a,postedAt:c.toISOString(),items:s.items.map(t=>({...t,name:t.name.trim(),description:t.description.trim()})),allergenCheck:s.items.length?{by:a,at:c.toISOString()}:null};return{current:{...t.current,[n]:p},history:o(t.history,t.current[n],n)}},e.clearBoard=function(t,n){return{current:{...t.current,[n]:null},history:o(t.history,t.current[n],n)}},e.reuseBoard=function(t,n,s,a,i,l,c){const d=t.history.find(t=>t.id===s&&t.restaurantId===n);if(!d)return t;const u={...d,id:c,app:i,postedBy:a,postedAt:l.toISOString(),reusedFrom:d.id,allergenCheck:d.items.length?{by:a,at:l.toISOString()}:null},p={...t,history:t.history.filter(t=>t.id!==s)};return{current:{...t.current,[n]:u},history:o(p.history,t.current[n],n)}},e.deleteFromHistory=function(t,n){return{...t,history:t.history.filter(t=>t.id!==n)}},Object.defineProperty(e,"historyFor",{enumerable:!0,get:function(){return l}}),e.whenText=h,Object.defineProperty(e,"isToday",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"freshness",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"lastUpdated",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"boardSummary",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SAMPLE_ITEMS",{enumerable:!0,get:function(){return k}}),e.seedSpecials=function(n){const s=60*n.getHours()+n.getMinutes()>=702?S(n,0,11,42):new Date(n.getTime()-6e5),a=S(n,1,11,20),i=S(n,3,12,5);return{current:{anchorage:{id:'sb-seed-today',restaurantId:'anchorage',photo:null,items:k,postedAt:s.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:{by:'Head Chef (example)',at:s.toISOString()}}},history:[{id:'sb-seed-yday',restaurantId:'anchorage',photo:null,postedAt:a.toISOString(),postedBy:'Duty Manager (example)',app:'managers',allergenCheck:{by:'Duty Manager (example)',at:a.toISOString()},items:[{id:'sp-y1',name:'Pan-fried sea bass, samphire, brown shrimp butter (sample)',description:'Sample dish.',price:2100,allergens:{fish:'contains',crustaceans:'contains',milk:'contains'}},{id:'sp-y2',name:'Smoked haddock fishcake, poached egg (sample)',description:'Sample dish: with wholegrain mustard sauce.',price:1250,allergens:{fish:'contains',eggs:'contains',gluten:'contains',milk:'contains',mustard:'contains'}},{id:'sp-y3',name:'Lemon posset, shortbread (sample)',description:'Sample pudding.',price:750,allergens:{milk:'contains',gluten:'contains'}}]},{id:'sb-seed-photo',restaurantId:'anchorage',photo:t,items:[],postedAt:i.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:null}]}};const t='sample:chalkboard',n=8;const s=t=>null===t?'Ask your server':`\xa3${(t/100).toFixed(2)}`;function a(t){const n=[];t.name.trim().length<3&&n.push('Add a dish name'),null!==t.price&&(!Number.isFinite(t.price)||t.price<=0||t.price>5e4)&&n.push('Check the price');const s=Object.keys(t.allergens).length;return s||t.noAllergens||n.push('Choose its allergens, or tick \u201cNone of the 14\u201d'),s&&t.noAllergens&&n.push('Allergens chosen and \u201cNone of the 14\u201d both ticked'),n}function i(t){const n=[];return t.photo||t.items.length||n.push('Add a photo of the board or type at least one special'),t.items.forEach((t,s)=>a(t).forEach(t=>n.push(`Special ${s+1}: ${t}`))),t.items.length&&!t.allergensChecked&&n.push('Confirm you have checked the allergens'),n}const o=(t,s,a)=>{if(!s)return t;return[...[s,...t.filter(t=>t.restaurantId===a&&t.id!==s.id)].slice(0,n),...t.filter(t=>t.restaurantId!==a)]};const l=(t,n)=>t.history.filter(t=>t.restaurantId===n),c=t=>String(t).padStart(2,'0'),d=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],p=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate();function h(t,n){const s=new Date(t),a=`${c(s.getHours())}:${c(s.getMinutes())}`;if(p(s,n))return`today at ${a}`;const i=new Date(n);return i.setDate(i.getDate()-1),p(s,i)?`yesterday at ${a}`:`${d[s.getDay()]} ${s.getDate()} ${u[s.getMonth()]} at ${a}`}const m=(t,n)=>p(new Date(t),n),y=(t,n)=>`Updated ${h(t.postedAt,n)}`,f=(t,n)=>`Last updated ${h(t.postedAt,n)} by ${t.postedBy}`,b=t=>[t.photo?'Photo':'',t.items.length?`${t.items.length} typed special${1===t.items.length?'':'s'}`:''].filter(Boolean).join(' + '),S=(t,n,s,a)=>{const i=new Date(t);return i.setDate(i.getDate()-n),i.setHours(s,a,0,0),i},k=[{id:'sp-hake',name:'Grilled hake, crushed new potatoes, salsa verde (sample)',description:'Sample dish: day-boat hake, lemon and caper salsa verde.',price:1950,allergens:{fish:'contains',mustard:'contains',sulphites:'may'}},{id:'sp-scallops',name:'Half-shell scallops, garlic and herb butter (sample)',description:'Sample dish: three scallops grilled in the shell, crusty bread.',price:1400,allergens:{molluscs:'contains',milk:'contains',gluten:'contains'}},{id:'sp-crab',name:'Crab and chilli linguine (sample)',description:'Sample dish: brown and white crab meat, chilli, parsley, lemon.',price:1850,allergens:{crustaceans:'contains',gluten:'contains',eggs:'contains',molluscs:'may'}},{id:'sp-mussels',name:'Mussels in cider and leek cream (sample)',description:'Sample dish: rope-grown mussels, dry cider, leeks, cream. Main with chips.',price:1300,allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',celery:'may'}}]},864,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addressWithoutInvite",{enumerable:!0,get:function(){return u.addressWithoutInvite}}),Object.defineProperty(_e,"inviteFromLocation",{enumerable:!0,get:function(){return u.inviteFromLocation}}),Object.defineProperty(_e,"useSession",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"rosterPerson",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"APP_NAME",{enumerable:!0,get:function(){return S}}),_e.sha256Hex=y,_e.inviteFromText=function(e){const t=e.trim(),n=t.match(/[?&#](?:invite|i)=([A-Za-z0-9_-]{10,})/);return n?n[1]:/^[A-Za-z0-9_-]{10,}$/.test(t)?t:null},_e.personForInvite=async function(e){if(a.IS_ISOLATED_VENUE)return;const t=await y(e);return t?l.ROSTER.find(e=>e.tokenHash===t):void 0},Object.defineProperty(_e,"DEVICE_KEY",{enumerable:!0,get:function(){return p}}),_e.deviceId=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(p);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(p,e)}return e}catch{return null}},Object.defineProperty(_e,"PHONE_KEY",{enumerable:!0,get:function(){return I}}),_e.phoneKey=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(I);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(I,e)}return e}catch{return null}},Object.defineProperty(_e,"START_INVITE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"START_HANDOVER",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"START_KITCHEN",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"START_GO",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"START_LOYALTY_CODE",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"START_TABLE_TOKEN",{enumerable:!0,get:function(){return O}}),_e.appUrl=function(e,t){if('undefined'==typeof window||!window.location)return null;const{origin:n,pathname:o}=window.location,i=o.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/),a=i?i[1]:'/';return`${n}${a}${e}-app/index.html${t?`#invite=${encodeURIComponent(t)}`:''}`},_e.levelJob=function(e,t){const n=(e??'').trim(),o=(t??'').trim();return n?!o||o.toLowerCase().startsWith(n.toLowerCase())?o||n:`${n} \xb7 ${o}`:o};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]),a=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]),u=r(d[7]),f=r(d[8]);const w={getItem:e=>{try{if((0,f.isKitchenViaDisplay)())return Promise.resolve('undefined'!=typeof sessionStorage?sessionStorage.getItem((0,f.kitchenSessionStoreName)()):null)}catch{}return n.default.getItem(e)},setItem:(e,t)=>{try{if((0,f.isKitchenViaDisplay)())return sessionStorage.setItem((0,f.kitchenSessionStoreName)(),t),Promise.resolve()}catch{}return n.default.setItem(e,t)},removeItem:e=>{try{(0,f.isKitchenViaDisplay)()&&sessionStorage.removeItem((0,f.kitchenSessionStoreName)())}catch{}return n.default.removeItem(e)}},h=(0,o.create)()((0,i.persist)(e=>({meId:null,welcomed:{},signIn:t=>e({meId:t,signedInAt:(new Date).toISOString()}),signOut:()=>e({meId:null,signedInAt:void 0}),markWelcomed:t=>e(e=>({welcomed:{...e.welcomed,[t]:(new Date).toISOString()}}))}),{name:c.IS_CAR?'covercharge-car-session-v1':'covercharge-session-v1',storage:(0,i.createJSONStorage)(()=>w),version:c.IS_CAR?2:1,partialize:e=>(0,s.persistedSessionSlice)(c.IS_CAR,e),migrate:e=>c.IS_CAR?(0,s.migrateCarSession)(e):e})),m=e=>!a.IS_ISOLATED_VENUE&&e?l.ROSTER.find(t=>t.id===e):void 0,S={owner:'CoverCharge for Managers',staff:'CoverCharge for Staff',chef:'CoverCharge for Head Chef'};async function y(e){const t=globalThis.crypto?.subtle;if(!t)return null;const n=await t.digest('SHA-256',(new TextEncoder).encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,'0')).join('')}const p=(0,a.venueKey)('covercharge-device-id');const I=(0,a.venueKey)('covercharge-phone-key');const v=(()=>{try{if('undefined'==typeof window||!window.location)return null;if(c.IS_CAR){try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(null,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}return null}const e=(0,a.venueKey)(`cc-pending-invite:${c.APP_VARIANT}`);let t=(0,u.inviteFromLocation)(window.location.search,window.location.hash);try{t?localStorage.setItem(e,t):t=localStorage.getItem(e)}catch{}if(t&&!/^[A-Za-z0-9_-]{10,64}$/.test(t)&&(t=null),t&&window.history?.replaceState){const e=()=>{try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};e();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[?&#]invite=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const t of[300,1e3,2500,5e3,1e4,2e4])setTimeout(e,t)}return t}catch{return null}})(),A=(()=>{try{if('undefined'==typeof window||!window.location||c.IS_CAR)return null;const e=(0,u.handoverFromHash)(window.location.hash);if(!e)return null;const t=()=>{try{/[#&]ccchrome=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};t();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[#&]ccchrome=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const e of[300,1e3,2500,5e3])setTimeout(t,e);return e}catch{return null}})(),b=(()=>{try{if('undefined'==typeof window||!window.location||c.IS_CAR)return null;const e=(0,f.kitchenTicketFromHash)(window.location.hash);if(!e)return null;const t=()=>{try{/[#&]cckitchen=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};t();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[#&]cckitchen=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const e of[300,1e3,2500,5e3])setTimeout(t,e);return e}catch{return null}})(),_=(()=>{try{return'undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('go'):null}catch{return null}})(),T=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('loyalty'):null;return e&&/^[A-Za-z0-9-]{4,12}$/.test(e)?e.toUpperCase():null}catch{return null}})(),O=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('table'):null;return e&&/^[A-Za-z2-9]{16}$/.test(e)?e.toUpperCase():null}catch{return null}})()},865,[1080,1072,1081,5,807,1301,15,1300,1302]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},866,[31,128,875,817,822,865,1059,845,824,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BUILTIN_LOGOS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HERO_LOGOS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"HEADER_LOGO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACCENTS",{enumerable:!0,get:function(){return z}}),_e.useBrandRid=k,_e.useBrand=A,_e.PoweredBy=H,_e.RestaurantLogo=L,_e.RestaurantHero=function({rid:e,size:r=200,showPlace:o=!0}){const c=A(e),u='wildings'===c.rid||'greenside'===c.rid||'kirkton'===c.rid||'abbotsford'===c.rid||(0,t.isQueuedVenue)(c.rid),x='yasmins'===c.rid?c.logo:u?S[c.rid]:c.custom?c.logo:S[c.rid]??c.logo;return(0,p.jsxs)(s.default,{testID:"restaurant-hero",style:{alignItems:'center',gap:6},children:[x?(0,p.jsx)(l.default,{source:x,accessibilityLabel:`${c.name} logo`,style:{width:r,height:r,borderRadius:!u&&c.custom?r/2:0},resizeMode:"contain"}):(0,p.jsx)(L,{rid:c.rid,size:r}),u?null:(0,p.jsx)(n.Text,{testID:"restaurant-hero-name",style:[{fontFamily:f.fonts.semibold,fontSize:26,lineHeight:34,color:f.colours.text,textAlign:'center'},(0,h.webLine)({lineHeight:34},26)],children:c.name}),o&&c.place?(0,p.jsx)(n.Text,{style:[{fontFamily:f.fonts.regular,fontSize:14,lineHeight:20,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:20},14)],children:c.place}):null]})},_e.VenueName=I,_e.RestaurantBrand=function({rid:e,sub:t,size:r=T,nameSuffix:o,beside:l}){const c=A(e);if('display'===x.APP_VARIANT||l)return(0,p.jsx)(s.default,{style:{gap:2,flexShrink:1},children:(0,p.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,p.jsx)(L,{rid:c.rid,size:r}),(0,p.jsxs)(s.default,{style:{flexShrink:1,flex:1,minWidth:0},children:[(0,p.jsx)(I,{name:c.name+(o??''),lines:2,bold:!0}),(0,p.jsx)(s.default,{testID:"display-powered-by",style:{marginLeft:14,marginTop:-1},children:(0,p.jsx)(H,{})}),t?(0,p.jsx)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:c.accentText},(0,h.webLine)({lineHeight:16},12)],children:t}):null]})]})});return(0,p.jsxs)(s.default,{testID:"venue-header-block",dataSet:{centre:'heading'},style:{gap:4,alignItems:'center',alignSelf:'center',maxWidth:420,width:'100%'},children:[(0,p.jsx)(L,{rid:c.rid,size:r}),(0,p.jsx)(I,{name:c.name+(o??'')}),t?(0,p.jsx)(n.Text,{numberOfLines:2,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:16},12)],children:t}):null,(0,p.jsx)(H,{})]})},_e.VenueHeaderBlock=function({rid:e,name:t,badge:r,place:o}){return(0,p.jsxs)(s.default,{testID:"venue-header-block",dataSet:{centre:'heading'},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',alignSelf:'center',gap:12,maxWidth:420,width:'100%'},children:[(0,p.jsx)(L,{rid:e,size:44}),(0,p.jsxs)(s.default,{style:{flexShrink:1,minWidth:0,alignItems:'center',gap:2},children:[(0,p.jsx)(I,{name:t}),(0,p.jsx)(s.default,{testID:"app-badge",accessibilityLabel:`${r} app`,style:{borderWidth:1,borderColor:f.colours.gold,borderRadius:6,paddingHorizontal:6,paddingVertical:1},children:(0,p.jsx)(n.Text,{style:[{fontFamily:f.fonts.bold,fontSize:10,lineHeight:14,color:f.colours.gold,textAlign:'center'},(0,h.webLine)({lineHeight:14},10)],children:r})}),o?(0,p.jsx)(n.Text,{testID:"venue-header-place",dataSet:{centre:'heading'},style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:f.colours.muted,textAlign:'center'},(0,h.webLine)({lineHeight:16},12)],children:o}):null,(0,p.jsx)(H,{})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=e(_r(d[3])),l=e(_r(d[4]));_r(d[5]);var s=e(_r(d[6])),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),x=_r(d[11]),b=_r(d[12]),y=_r(d[13]),j=_r(d[14]),p=_r(d[15]);const w={"3idiots":_r(d[16]),cecchinis:_r(d[17]),mrbasrais:_r(d[18]),yasmins:_r(d[19]),williewastles:_r(d[20]),rupeeroom:_r(d[21]),smokinggoat:_r(d[22]),pizzaioli:_r(d[23]),drunkencoo:_r(d[24]),abbotsford:_r(d[25]),kirkton:_r(d[26]),greenside:_r(d[27]),wildings:_r(d[28]),kirkmichael:_r(d[29]),souters:_r(d[30]),anchorage:_r(d[31]),saltmarsh:_r(d[32]),brae:_r(d[33])},S={"3idiots":_r(d[34]),cecchinis:_r(d[35]),mrbasrais:_r(d[36]),yasmins:_r(d[37]),williewastles:_r(d[38]),rupeeroom:_r(d[39]),smokinggoat:_r(d[40]),pizzaioli:_r(d[41]),drunkencoo:_r(d[42]),abbotsford:_r(d[43]),kirkton:_r(d[44]),greenside:_r(d[45]),wildings:_r(d[46]),kirkmichael:_r(d[47]),souters:_r(d[30]),anchorage:_r(d[48])};y.PITCH&&!y.PITCH_ANCHORAGE&&(delete w.anchorage,delete S.anchorage);const T=48,z=['#CFA45F','#D4AF61','#C9A24A','#E2C489','#F2EDE4','#A88B5A','#B08D57','#D9774B'];function k(e){const t=(0,r.useGlobalSearchParams)(),n=(0,u.useOwner)(e=>e.site),o='string'==typeof t.rid?t.rid:void 0;return b.IS_ISOLATED_VENUE?b.VENUE_RID:e??o??n??b.VENUE_RID}function A(e){const t=k(e),n=(0,c.useStore)(e=>e.restaurants.find(e=>e.id===t)),r=(0,u.useOwner)(e=>e.branding[t]),l=r?.logoUri?{uri:r.logoUri}:w[t],s=r?.accent??f.colours.gold,h=o.default.useMemo(()=>(0,j.checkAccent)(s,f.colours.bg,f.colours.onGold,f.colours.text),[s]);return{rid:t,name:n?.name??'Restaurant',place:n?.location??'',logo:l,accent:s,accentText:h.accentText,onAccent:h.onAccent,custom:!!r?.logoUri}}function H({size:e=10}){return(0,p.jsxs)(n.Text,{accessibilityLabel:"powered by CoverCharge",style:[{fontFamily:f.fonts.regular,fontSize:e,lineHeight:Math.round(1.35*e),color:f.colours.muted,textAlign:'center'},(0,h.webLine)({lineHeight:Math.round(1.35*e)},e)],children:["powered by ",(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.text},children:"Cover"}),(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.gold},children:"Charge"})]})}function L({rid:e,size:t=T}){const r=A(e);if(r.logo)return(0,p.jsx)(l.default,{source:r.logo,accessibilityLabel:`${r.name} logo`,style:{width:t,height:t,borderRadius:r.custom?t/2:0},resizeMode:"contain"});const o=r.name.replace(/^The /,'').split(/\s+/).map(e=>e[0]).join('').slice(0,2).toUpperCase();return(0,p.jsx)(s.default,{accessibilityLabel:`${r.name} logo`,style:{width:t,height:t,borderRadius:t/2,borderWidth:2,borderColor:r.accentText,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.bold,color:r.accentText,fontSize:.36*t},children:o})})}function I({name:e,size:t=17,lines:r,bold:o}){return(0,p.jsx)(n.Text,{testID:"venue-header-name",accessibilityRole:"header",accessibilityLabel:e,numberOfLines:r,style:[{fontFamily:o?f.fonts.bold:f.fonts.semibold,fontSize:t,lineHeight:Math.ceil(1.35*t),color:f.colours.text,textAlign:'center',flexShrink:1,minWidth:0},(0,h.webLine)({lineHeight:Math.ceil(1.35*t)},t),{overflowWrap:'normal',wordBreak:'keep-all'}],children:e})}},867,[6,873,805,31,197,123,128,822,861,824,1377,807,5,2,1102,25,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PUB_LOCATIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"privateClockVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"pubLocation",{enumerable:!0,get:function(){return s}}),e.venueClockArea=function(a,o={}){if((0,t.isQueuedVenue)(a)&&!t.queuedVenues[a].clockArea.on)return(0,n.cleanArea)({...o,on:!0===o.on&&'number'==typeof o.lat&&'number'==typeof o.lng,offRotaPrompt:!1});const l=s(a);if(!l)return(0,n.cleanArea)(o);const c=(0,n.cleanArea)({lat:l.lat,lng:l.lng,radius:150,...o});return{...c,lat:c.lat??l.lat,lng:c.lng??l.lng,on:!0,offRotaPrompt:!1}},e.venueClockGeo=l,e.privateAttendance=function(n,a){if(!o(n)&&!(0,t.isQueuedVenue)(n))return a;const s={...a};for(const t of['lat','lng','latitude','longitude','coords','position','location','acc','dist','accuracy','distance','outSite'])delete s[t];a.geo&&(s.geo=a.geo.map(t=>l(n,t)).filter(t=>!!t));return s};var t=r(d[0]),n=r(d[1]);const a={"3idiots":{name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",lat:55.4650286,lng:-4.6283062,source:"Verified exact-address venue pack"},cecchinis:{name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",lat:55.461505,lng:-4.6345736,source:"Verified exact-address venue pack"},williewastles:{name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",lat:55.4646261,lng:-4.6323929,source:"Verified exact-address venue pack"},smokinggoat:{name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",lat:55.464226,lng:-4.6326035,source:"Verified exact-address venue pack"},drunkencoo:{name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",lat:55.4570308,lng:-4.6294663,source:"Verified exact-address venue pack"},abbotsford:{name:'The Abbotsford Hotel',address:'14 Corsehill Road, Ayr KA7 2ST',lat:55.4488797,lng:-4.6314856,source:'Official FSA1696388, exact address match verified6 Nov2026'},kirkton:{name:'The Kirkton Inn',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',lat:55.3971215,lng:-4.5920177,source:'Public FSA establishment1955433 verified6 November2026'},greenside:{name:'The Greenside Restaurant',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',lat:55.3542369,lng:-4.6851418,source:'Official Find us Google Maps link, place point, verified 6 November 2026'},kirkmichael:{name:'The Kirkmichael Arms',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',lat:55.3458202,lng:-4.6180793,source:'venue-profile.json geo, matched to the venue address'},souters:{name:"Souter\u2019s Inn",address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',lat:55.3297218,lng:-4.7772979,source:'Food Standards Agency establishment 1863840, address matched'}},o=t=>Object.prototype.hasOwnProperty.call(a,t),s=t=>o(t)?a[t]:void 0;function l(n,a){return o(n)||(0,t.isQueuedVenue)(n)?'in'===a.action?{action:'in',at:a.at,inside:a.inside,...a.override?{override:{by:a.override.by,byId:a.override.byId,reason:a.override.reason}}:{}}:void 0:a}},868,[6,869]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_RADIUS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_RADIUS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ACCURACY_CAP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_BREAK_OPTIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_CLOCK_AREA",{enumerable:!0,get:function(){return r}}),e.distanceM=s,Object.defineProperty(e,"validLat",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validLng",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"areaSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"clampRadius",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"accuracyAllowance",{enumerable:!0,get:function(){return p}}),e.isInside=h,e.cleanArea=function(t){const n=(t.breakOptions??a).map(t=>Math.round(Number(t))).filter(t=>Number.isFinite(t)&&t>0&&t<=180);return{...r,...t,lat:c(t.lat)?t.lat:null,lng:l(t.lng)?t.lng:null,radius:f(t.radius??r.radius),on:!1!==t.on,offRotaPrompt:!1!==t.offRotaPrompt,breakOptions:[...new Set(n)].sort((t,n)=>t-n).slice(0,12),offRotaTitle:(t.offRotaTitle??'').trim().slice(0,80)||r.offRotaTitle,offRotaBody:(t.offRotaBody??'').trim().slice(0,160)||r.offRotaBody}},Object.defineProperty(e,"ACTION_WORD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DENIED_TEXT",{enumerable:!0,get:function(){return m}}),e.gate=function(t,n,o,a,r="browser"){if(!t.on||!d(t)){const r={action:n,at:a,inside:null,unchecked:!0};return'object'==typeof o&&Object.assign(r,{lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc)}),{allowed:!0,geo:r,warn:t.on?'The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':void 0}}if('object'!=typeof o){const t='app-phone-off'===r?m['app-phone-off']:'denied'===o?m[r]:'timeout'===o?'Your phone couldn\u2019t find your location in time. Step outside or near a window and try again.':'unsupported'===o?'This phone or browser can\u2019t share its location. Ask a manager to record it for you.':'Your phone couldn\u2019t find your location. Check Location is on, then try again.';return{allowed:!1,message:`You need to be at the venue to ${b[n]}. ${t}`,geo:{action:n,at:a,inside:!1}}}const u=h(t,o),s={action:n,at:a,lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc),dist:u.dist,inside:u.inside};if(u.inside)return{allowed:!0,geo:s};const c=u.dist>=1e3?`${(u.dist/1e3).toFixed(1)} km`:`${u.dist} m`;return{allowed:!1,geo:s,message:`You need to be at the venue to ${b[n]}. You look to be about ${c} away (allowed ${u.limit} m). If you\u2019re at the venue, try again in a moment or ask a manager to record it for you.`}},e.overrideGeo=function(t,n,o,a){const r=a.trim();return r.length<3?null:{action:t,at:n,inside:null,override:{by:o.name,byId:o.id,reason:r.slice(0,200)}}},e.offRotaDue=function(t){return!(!(t.area.offRotaPrompt&&d(t.area)&&t.inside)||t.clockedIn||t.dismissedToday)&&!t.shifts.some(n=>t.nowHours>=n.start-1&&t.nowHours<(n.end<=n.start?n.end+24:n.end))},Object.defineProperty(e,"breakLabel",{enumerable:!0,get:function(){return O}});const t=50,n=2e3,o=50,a=[5,10,15,20,30,45,60],r={lat:null,lng:null,radius:100,on:!0,breakOptions:[...a],offRotaPrompt:!0,offRotaTitle:'Do you want to sign in?',offRotaBody:'Should you be on the rota?'},u=t=>t*Math.PI/180;function s(t,n){const o=u(n.lat-t.lat),a=u(n.lng-t.lng),r=Math.sin(o/2)**2+Math.cos(u(t.lat))*Math.cos(u(n.lat))*Math.sin(a/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(r)))}const c=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-90&&t<=90,l=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-180&&t<=180,d=t=>c(t.lat)&&l(t.lng),f=o=>Number.isFinite(o)?Math.min(n,Math.max(t,Math.round(o))):r.radius,p=t=>Number.isFinite(t)&&t>0?Math.min(t,o):0;function h(t,n){const o=s({lat:t.lat,lng:t.lng},n),a=f(t.radius)+p(n.acc);return{inside:o<=a,dist:Math.round(o),limit:Math.round(a)}}const b={in:'clock in',out:'clock out',break_start:'start a break',break_end:'end your break'},m={browser:'Location is turned off for this browser. Turn it on in your phone\u2019s settings (Location \u203a allow for this browser), then try again.',iphone:'Location is turned off for this app. On your iPhone open Settings \u203a Privacy & Security \u203a Location Services \u203a Safari Websites and choose While Using the App, then try again.',app:'Location is turned off for this app. Tap Open app settings, then Permissions \u203a Location \u203a Allow only while using the app. Then come back and try again.','app-old':'This version of the app can\u2019t use location. Tap Update the app at the bottom of the screen, then tap Allow when your phone asks.','app-phone-off':'Location is switched off on your phone. Tap Open location settings, turn on Use location, then come back and try again.'};const y=t=>Math.round(1e6*t)/1e6;const O=t=>60===t?'1 hour':t%60==0?t/60+" hours":t>60?`${Math.floor(t/60)} h ${t%60} min`:`${t} min`},869,[]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},870,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FETCH_TIMEOUT_MS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"READER_TIMEOUT_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"fetchLimitMs",{enumerable:!0,get:function(){return _}}),_e.fetchWithTimeout=S,_e.getSupabase=function(){if(c)return c;if(!(0,s.isSupabaseConfigured)())throw new Error('Supabase is not configured: set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in .env.local');return c=(0,o.createClient)(s.SUPABASE_URL,s.SUPABASE_ANON_KEY,{auth:{storage:n.default,persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!1,storageKey:`${(0,u.syncNamespace)()}auth`},realtime:{params:{eventsPerSecond:10}},global:{fetch:S}}),c},_e.setSupabaseClient=function(e){c=e};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),u=r(d[3]);let c=null;const f=2e4,l=15e4,b=/\/functions\/v1\/(delivery-read|plan-photo-read)(\?|$)/,_=e=>b.test(e)?l:/\/storage\/v1\//.test(e)?12e4:f;function S(e,t){const n='string'==typeof e?e:e instanceof URL?e.href:e.url,o=_(n);if('undefined'==typeof AbortController)return fetch(e,t);const s=new AbortController,u=t?.signal;u&&(u.aborted?s.abort():u.addEventListener('abort',()=>s.abort(),{once:!0}));const c=setTimeout(()=>s.abort(),o);return fetch(e,{...t,signal:s.signal}).catch(e=>{if(s.signal.aborted&&!u?.aborted)throw new TypeError(`Failed to fetch (network timeout after ${o/1e3} s)`);throw e}).finally(()=>clearTimeout(c))}},871,[1080,1249,1136,1291]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedSessions=o,e.queuedRequestSlots=u,e.queuedRequestError=function(t,o,s,a=new Date){if(o.name.trim().length<2||o.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(o.phone)||!/^[0-9]{7,15}$/.test(o.phone.replace(/\D/g,''))||o.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email))return'Enter your name, phone number and email.';if(o.notes.length>2e3)return'Keep notes under 2000 characters.';const c=(0,n.localDate)(a),d=(0,n.localDate)(new Date(+a+63072e6));if(!o.date||o.dated||!u(t,o.date,s).includes(o.time||''))return'Choose a future date and a time within confirmed kitchen service hours.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return o.date===c&&(o.time||'')<=l?'Choose a future time.':!Number.isInteger(o.covers)||o.covers<1||o.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]),n=r(_d[1]);function o(n){const o=t.queuedVenues[n];return o?.kitchenSessionsByDay??o?.hours.sessionsByDay??void 0}const s=t=>60*+t.slice(0,2)+ +t.slice(3);function u(n,u,a){if(!/^\d{4}-\d{2}-\d{2}$/.test(u))return[];const c=new Date(u+'T12:00:00Z');if(!Number.isFinite(+c)||c.toISOString().slice(0,10)!==u)return[];const d=(a??o(n))?.[c.getUTCDay()];if(!Array.isArray(d))return[];const l=[],f=t.queuedVenues[n]?.booking.lastSittingMinutesBeforeClose??0;for(const t of d){if(!Array.isArray(t)||2!==t.length||!t.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))continue;const n=s(t[0]),o=s(t[1]);if(!(n>=o))for(let t=n;t(0,t.getSupabase)();const s=e=>{const t=String(e?.message||'');return/^(Requests are not enabled|Too many|Please complete|Enter your|Choose |This request|Only this venue)/.test(t)?t:'Unable to send or load requests. Check your connection and try again, or call the hotel.'}},874,[6,871]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},875,[31,128,1539,824,25]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.forecastToday=function(u,c,h,f,p,v){const k=(0,e.venueBusy)(u,c,p),M=(0,a.examplesAllowed)(),b=(0,n.clampWeeks)(u.settings.forecastMinWeeks),w=M?null:v??(0,n.buildHistory)(u.id,c,h,[],p,b),H=M||!!w?.enough,O=(0,r.hoursFor)(u,p),S=[],C=(0,s.ymd)(p);let I=1;for(const e of f.filter(e=>e.date===C&&(null===e.restaurantId||e.restaurantId===u.id)))S.push(e.title.replace(/\s*\(substitute day\)/gi,'')),!1!==e.busier&&(I*='bank-holiday'===e.kind?1.25:'event'===e.kind?1.15:1.1);if(!O)return{busy:k,open:!1,hours:[],restOfDay:{covers:0,low:0,high:0,takeaway:0,booked:0},flags:S,suggestions:['Kitchen closed today (per listed hours).'],multiplier:I,example:M,enough:H,minWeeks:b};const x=M?o.EXAMPLE_HISTORY[u.id]??o.EXAMPLE_HISTORY.default:H&&w?w:{covers:{},takeaway:{}},E=p.getDay(),N=l(u,p),$=(0,t.lastFoodOn)(u,C);let _=O.close.getMinutes()>0?O.close.getHours():O.close.getHours()-1;if($){const[e,t]=$.time.split(':').map(Number);_=Math.min(_,t>0?e:e-1),'kitchen closes'!==$.reason&&S.push(`Last food orders ${$.time} (${$.reason})`)}const P=c.filter(e=>e.restaurantId===u.id&&e.date===C&&['confirmed','seated','finished'].includes(e.status)),T=P.filter(e=>!e.walkIn&&'finished'!==e.status).map(e=>Number(e.time.slice(0,2))),A=Math.min(N[0],O.open.getHours(),...T),L=Math.max(N[1],_,...T),R=[];for(let e=A;e<=L;e++){const t=e>=O.open.getHours()&&e<=_,o=x.covers[E]?.[e]??0,r=x.takeaway[E]?.[e]??0,a=P.filter(t=>!t.walkIn&&'finished'!==t.status&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),n=P.filter(t=>t.walkIn&&['seated','finished'].includes(t.status)&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),i=t?Math.round(o*u.settings.walkInShare*I):0,c=H&&t?Math.max(0,Math.round(o*I*(1-u.settings.walkInShare))-a):0,l=Math.max(n,i)+c,f=a+l,p=h.filter(t=>t.restaurantId===u.id&&'takeaway'===t.type&&'cancelled'!==t.status&&t.slotTime&&new Date(t.slotTime).getHours()===e&&(0,s.ymd)(new Date(t.slotTime))===C).length,y=t?Math.max(p,Math.round(r*I)):p;R.push({hour:e,booked:a,walkIns:l,covers:f,coversLow:H?Math.round(.8*f):f,coversHigh:H?Math.round(1.2*f):f,takeawayPlaced:p,takeaway:y,historicalCovers:o})}const D=y(u,E);if(H&&D){const e=D-R.reduce((e,t)=>e+t.covers,0),t=R.filter(e=>e.hour>=O.open.getHours()&&e.hour<=_);if(e>0&&t.length){const o=t.map(e=>e.historicalCovers),r=i(e,o.reduce((e,t)=>e+t,0)>0?o:t.map(()=>1));t.forEach((e,t)=>{const o=r[t];o&&(e.floorAdded=o,e.walkIns+=o,e.covers+=o,e.coversHigh=Math.max(e.coversHigh,Math.round(1.2*e.covers)))})}const o=R.reduce((e,t)=>e+t.coversLow,0);if(oMath.max(1,e.covers)));t.forEach((t,o)=>{t.coversLow=Math.min(t.covers,t.coversLow+e[o])})}}const j=p.getHours()+(p.getMinutes()>=30?1:0),W=R.filter(e=>e.hour>=j),F=W[0],B=e=>W.reduce((t,o)=>t+e(o),0),G={covers:B(e=>e.covers),low:B(e=>e.coversLow),high:B(e=>e.coversHigh),takeaway:B(e=>e.takeaway),booked:B(e=>e.booked)},z=[],V=u.settings.capacityPerHour,X=W.reduce((e,t)=>!e||t.covers>e.covers?t:e,void 0);X&&X.covers>=.85*V&&z.push(`Dining room near capacity around ${String(X.hour).padStart(2,'0')}:00 (about ${X.covers} of ${V} covers) \u2014 consider pausing or capping takeaway slots then.`);const Y=W.find(e=>e.historicalCovers>0&&e.covers>1.1*e.historicalCovers);Y&&z.push(`Busier than a usual ${['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][E]} from ${String(Y.hour).padStart(2,'0')}:00 \u2014 consider one more on the floor.`);G.takeaway>=10&&z.push(`About ${G.takeaway} takeaway orders expected \u2014 prep extra haddock and chips.`);H||z.unshift(`Not enough history yet. ${(0,a.notEnoughTip)(b)}`);z.length||z.push('Looks like a normal service \u2014 no action suggested.');return{busy:k,open:!0,nextHour:F,hours:R,restOfDay:G,flags:S,suggestions:z,multiplier:I,example:M,enough:H,minWeeks:b,minCovers:D??void 0}},_e.spread=i,Object.defineProperty(_e,"ANCHORAGE_FORECAST_HOURS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"forecastHoursOf",{enumerable:!0,get:function(){return c}}),_e.forecastWindow=l,Object.defineProperty(_e,"ANCHORAGE_MIN_COVERS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"MIN_COVERS_NOTE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"minCoversOf",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"minCoversOn",{enumerable:!0,get:function(){return y}}),_e.coversRange=function(e,t,o=!0){const r=Math.min(e,t),s=Math.max(e,t),a=r===s?String(r):`${r} to ${s}`;return o?`${a} ${1===s?'Cover':'Covers'}`:a};var e=_r(d[0]),t=_r(d[1]),o=_r(d[2]),r=_r(d[3]),s=_r(d[4]),a=_r(d[5]),n=_r(d[6]);function i(e,t){const o=t.reduce((e,t)=>e+t,0)||1,r=t.map(t=>e*t/o),s=r.map(Math.floor);let a=e-s.reduce((e,t)=>e+t,0);return r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]).forEach(([,e])=>{a>0&&(s[e]++,a--)}),s}const u={0:['12:00','22:00'],1:null,2:null,3:['12:00','22:00'],4:['12:00','22:00'],5:['12:00','22:00'],6:['12:00','22:00']},c=e=>e.settings.forecastHours??('anchorage'===e.id?u:{});function l(e,t){const o=(0,r.hoursFor)(e,t),s=o.close.getMinutes()>0?o.close.getHours():o.close.getHours()-1,a=c(e)[t.getDay()];if(!a)return[o.open.getHours(),s];const[n]=a[0].split(':').map(Number),[i,u]=a[1].split(':').map(Number);return[Math.min(n,o.open.getHours()),Math.max(u>0?i:i-1,s)]}const h={0:50,6:50},f='Gordon, 4 Nov 2026',p=e=>e.settings.minCoversByDay??('anchorage'===e.id?h:{}),y=(e,t)=>{const o=p(e)[t];return o&&o>0?Math.round(o):null}},876,[1047,813,1082,832,821,1112,1054]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.estimateWait=function(t,n,u){const o=Math.max(6,Math.round(n/6*u));return t*o}},877,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return y.uuid}}),_e.nowFrom=S,_e.linesFromBasket=w,Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return u.DEMO_CUSTOMER_ID}});var e,t=_r(d[0]),a=_r(d[1]),r=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),o=(e=i)&&e.__esModule?e:{default:e},l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),g=_r(d[9]),m=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),k=_r(d[14]),y=_r(d[15]);const $=(e,t,a)=>e.reduce((e,a)=>a.startsWith(t)?Math.max(e,Number(a.slice(t.length))||0):e,a)+1,I=e=>`${e}-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-3)}`;function S(e){return'live'===e.mode?new Date:new Date(e.simStartMs+(Date.now()-e.anchorRealMs))}function h(){const e=(0,u.defaultSimStart)();return{clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},...(0,u.buildSeed)(e),outbox:[],msgTemplates:{}}}function w(e,t,a){return e.lines.flatMap(e=>{const r=t.find(t=>t.id===e.itemId);if(!r)return[];const n=(0,b.resolveItem)(r),s=(n.optionGroups??[]).flatMap(t=>t.choices.filter(t=>e.choiceIds.includes(t.id))),i=(n.price??0)+s.reduce((e,t)=>e+t.priceDelta,0),o=(0,p.conflictsFor)((0,p.effectiveAllergens)(n,e.choiceIds),a);return[{itemId:n.id,name:n.name,qty:e.qty,unitPrice:i,choices:s.map(e=>e.label),notes:e.notes,contains:o.contains,may:o.may,overridden:!!e.override&&o.contains.every(t=>e.override.allergens.includes(t)),prepMins:n.prepMins,choiceIds:s.map(e=>e.id)}]})}const O=e=>{const t='ABCDEFGHJKLMNPQRSTUVWXYZ23456789',a=()=>Array.from({length:4},()=>t[Math.floor(32*Math.random())]).join('');return`${e}-${a()}-${a()}-${a()}`},C=(0,l.create)()((0,c.persist)((e,t)=>{const a=()=>S(t().clock),r=(t,r,n)=>e(e=>({audit:[{id:I('au'),restaurantId:t,at:a().toISOString(),kind:r,text:n},...e.audit].slice(0,300)})),n=(a,n,s)=>{if(!a||s<=0)return 0;const i=t().giftCards.find(e=>e.code===a&&e.restaurantId===n);if(!i||i.balance<=0)return 0;const o=Math.min(i.balance,s);return e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-o}:e)})),r(n,'giftcard',`Gift card ${a.slice(0,8)}\u2026 redeemed \xa3${(o/100).toFixed(2)} (balance \xa3${((i.balance-o)/100).toFixed(2)})`),o},s=e=>{const a=t().restaurants.find(t=>t.id===e.restaurantId);a&&e.customerId===t().customer.id&&e.subtotal>=a.settings.stampMinSpend&&t().addStamp(e.restaurantId,e.customerId,'takeaway'===e.type?'Takeaway (auto on collection)':'Table QR bill (auto on payment)')},i=e=>(0,f.templatesFor)(t().msgTemplates[e]),o=a=>{a.length&&(e(e=>({outbox:[...a,...e.outbox].slice(0,300)})),(0,f.deliverQueued)(a.filter(e=>'queued'===e.status),(e,a)=>t().updateOutbox(e,a)))},l=(e,r)=>{const n=t().restaurants.find(e=>e.id===r.restaurantId);n&&o((0,f.composeBooking)(e,r,n,i(n.id),a().toISOString()))},c=e=>{const r=t().restaurants.find(t=>t.id===e.restaurantId);r&&o((0,f.composeOrder)(e,r,i(r.id),a().toISOString()))};return{...h(),resetDemo:()=>e(h()),setClockMode:()=>e({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),skipMinutes:()=>{},updateCustomer:t=>e(e=>({customer:{...e.customer,...t}})),setAllergy:(t,a)=>e(e=>{const r=e.customer.allergies.filter(e=>e.allergen!==t);return{customer:{...e.customer,allergies:a?[...r,{allergen:t,severity:a}]:r}}}),startBasket:(t,a,r)=>e(e=>{const n=e.basket.restaurantId===t&&e.basket.mode===a&&e.basket.tableNo===r;return{basket:{restaurantId:t,mode:a,tableNo:r,lines:n?e.basket.lines:[]}}}),addLine:t=>e(e=>({basket:{...e.basket,lines:[...e.basket.lines,{...t,key:I('ln')}]}})),setLineQty:(t,a)=>e(e=>({basket:{...e.basket,lines:a<=0?e.basket.lines.filter(e=>e.key!==t):e.basket.lines.map(e=>e.key===t?{...e,qty:a}:e)}})),overrideLine:(t,r)=>e(e=>({basket:{...e.basket,lines:e.basket.lines.map(e=>e.key===t?{...e,override:{allergens:r,at:a().toISOString()}}:e)}})),clearBasket:()=>e(e=>({basket:{...e.basket,lines:[]}})),placeOrder:({slotTime:n,tip:s,notes:i,phone:o,email:l,customerName:u})=>{const g=t(),m=g.basket,p=m.restaurantId,b=w(m,g.menu,g.customer.allergies),f=b.reduce((e,t)=>e+t.unitPrice*t.qty,0),k='table'===m.mode,I=$(g.orders.filter(e=>e.restaurantId===p).map(e=>e.ref),k?'Q-':'T-',k?g.counters.table:g.counters.order),S=!k,h=f+(S?0:s),O=(u??'').trim()||g.customer.name,C={id:(0,y.uuid)(),ref:`${k?'Q':'T'}-${I}`,restaurantId:p,customerId:g.customer.id,customerName:O,type:m.mode,tableNo:m.tableNo,slotTime:n,lines:b,subtotal:f,tip:S?0:s,giftCardApplied:0,giftCardCode:void 0,total:h,paid:0,status:S?'awaiting_payment':'new',createdAt:a().toISOString(),allergies:g.customer.allergies,readiness:{},notes:i,channel:'app',...'takeaway'===m.mode?{phone:o??g.customer.phone,email:l??g.customer.email}:{}};e(e=>({orders:[C,...e.orders],basket:{...e.basket,lines:[]},counters:k?{...e.counters,table:I}:{...e.counters,order:I}}));const v=b.filter(e=>e.overridden);return r(p,'order',`Order ${C.ref} placed (${k?`Table ${m.tableNo}`:'takeaway'})${v.length?` \u2014 ALLERGY OVERRIDE on ${v.map(e=>e.name).join(', ')}`:''}`),C.allergies.length&&r(p,'allergy',`Allergies declared and confirmed by customer on ${C.ref}: ${C.allergies.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),'awaiting_payment'!==C.status&&c(C),C},setOrderStatus:(a,n,i)=>{const o=t().orders.find(e=>e.id===a);o&&((0,k.statusBlock)(o,n,(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===a?{...e,status:n}:e)})),r(o.restaurantId,'order',`${o.ref} \u2192 ${n}${i?` by ${i}`:''}`),'collected'===n&&'takeaway'===o.type&&s(o)))},ackOrderAllergy:(n,s)=>{const i=t().orders.find(e=>e.id===n);if(!i||!(0,k.canSign)(i,'kitchen',(0,k.linkedBooking)(i,t().bookings)))return;const o={by:s,at:a().toISOString()};e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyAck:o,status:'new'===e.status?'acknowledged':e.status}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 3/5 Kitchen on ${i.ref}: ${s} (chef signed off before cooking)`)},tickOrderAllergy:(n,s,i,o=!0)=>{const l=t().orders.find(e=>e.id===n);if(!l)return;const c={...l.allergyTicks??{}};o?c[s]={by:i,at:a().toISOString()}:delete c[s],e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyTicks:c}:e)})),r(l.restaurantId,'allergy',`${l.ref}: kitchen ${o?'confirmed':'unticked'} ${s} (${i})`)},ackReadiness:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);o&&('cook'===s&&(0,k.statusBlock)(o,'preparing',(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,readiness:{...e.readiness,[s]:{by:i,at:a().toISOString()}},status:'cook'===s&&['new','acknowledged'].includes(e.status)?'preparing':e.status}:e)})),r(o.restaurantId,'order',`${o.ref}: ${'cook'===s?'started cooking':'bagged'} (${i})`)))},handoverCheck:(n,s)=>{const i=t().orders.find(e=>e.id===n);i&&(0,k.canSign)(i,'table',(0,k.linkedBooking)(i,t().bookings))&&(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,handoverCheck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 5/5 Table on ${i.ref}: ${s} (served and checked with the guest; chain complete)`))},signAllergyStep:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o||!i.trim())return!1;const l=(0,k.linkedBooking)(o,t().bookings);if(!(0,k.canSign)(o,s,l))return!1;if('kitchen'===s)return t().ackOrderAllergy(n,i),!0;if('table'===s)return t().handoverCheck(n,i),!0;const c={by:i,at:a().toISOString()};'booked'===s&&l&&l.allergies.length&&!l.allergyAck?e(e=>({bookings:e.bookings.map(e=>e.id===l.id?{...e,allergyAck:c}:e)})):e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyChain:{...e.allergyChain,[s]:c}}:e)}));const u=(0,k.stepInfo)(s);return r(o.restaurantId,'allergy',`Allergen sign-off ${u.n}/5 ${u.label} on ${o.ref}: ${i} (${u.what.toLowerCase()})`),!0},customerSignal:(t,a)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,customerSignal:a}:e)})),setSplit:(t,a,r)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,tip:r,total:e.subtotal+r,split:{ways:a,paidShares:e.split?.paidShares??0}}:e)})),payTable:(a,{shares:i,giftCardCode:o})=>{const l=t().orders.find(e=>e.id===a);if(!l)return;const c=l.split?.ways??1,u=Math.ceil(l.total/c),g=Math.min(c,(l.split?.paidShares??0)+i),m=g>=c,p=m?l.total-l.paid:Math.min(l.total-l.paid,u*i),b=n(o,l.restaurantId,p),f={...l,giftCardApplied:l.giftCardApplied+b,giftCardCode:b?o:l.giftCardCode,paid:l.paid+p,split:{ways:c,paidShares:g},status:m?'closed':l.status};e(e=>({orders:e.orders.map(e=>e.id===a?f:e)})),r(l.restaurantId,'order',`${l.ref} (Table ${l.tableNo}) ${m?'bill paid in full':`share ${g}/${c} paid`} (paid at the till)`),m&&s(f)},createBooking:n=>{const s=$(t().bookings.filter(e=>e.restaurantId===n.restaurantId).map(e=>e.ref),'BK-',t().counters.booking),i=t().restaurants.find(e=>e.id===n.restaurantId)?.settings,o='online'===n.source&&!!i&&(n.partySize>(i.autoAcceptUpTo??7)||!!i.reviewRequests&&!!n.notes.trim()),c={...n,id:(0,y.uuid)(),ref:`BK-${s}`,status:o?'pending':'confirmed',createdAt:a().toISOString()};return e(e=>({bookings:[...e.bookings,c],counters:{...e.counters,booking:s}})),r(c.restaurantId,'booking',`Booking ${o?'request ':''}${c.ref}: ${c.name}, ${c.partySize} on ${c.date} ${c.time}${c.source?` (${c.source})`:''}${c.allergies.length?' \u2014 allergies declared':''}`),l(o?'booking-request':'booking-confirmation',c),c},decideBooking:(n,s,i)=>{const o=t().bookings.find(e=>e.id===n);if(!o||'pending'!==o.status)return;const c={by:i,at:a().toISOString(),outcome:s},u='confirmed'===s?'confirmed':'cancelled';e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:u,decided:c}:e)})),r(o.restaurantId,'booking',`Booking request ${o.ref} (${o.name}, ${o.partySize}) ${s} by ${i}`),l('confirmed'===s?'booking-confirmation':'booking-declined',{...o,status:u})},addOutbox:t=>e(e=>({outbox:[...t,...e.outbox].slice(0,300)})),updateOutbox:(t,a)=>e(e=>({outbox:e.outbox.map(e=>e.id===t?{...e,...a}:e)})),clearOutbox:t=>e(e=>({outbox:e.outbox.filter(e=>e.restaurantId!==t)})),setTemplate:(t,a,r)=>e(e=>{const n={...e.msgTemplates[t]??{}};return null===r?delete n[a]:n[a]={...n[a]??{},...r},{msgTemplates:{...e.msgTemplates,[t]:n}}}),acceptOrder:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o)return!1;const l='new'===o.status&&!!(0,k.statusBlock)(o,'acknowledged',(0,k.linkedBooking)(o,t().bookings)),c=a(),u=i?new Date(c.getTime()+6e4*i).toISOString():o.readyBy;return e(e=>({orders:e.orders.map(e=>e.id===n?{...e,status:'new'!==e.status||l?e.status:'acknowledged',accepted:e.accepted??{by:s,at:c.toISOString()},readyBy:u}:e)})),r(o.restaurantId,'order',`${o.ref} accepted by ${s}${i?`, ready by ${String(new Date(u).getHours()).padStart(2,'0')}:${String(new Date(u).getMinutes()).padStart(2,'0')}`:''}`),!l},setBookingStatus:(n,s)=>{const i=t().bookings.find(e=>e.id===n),o=a().toISOString();e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:s,...'seated'===s?{seatedAt:o}:'finished'===s?{finishedAt:o,table:void 0}:{}}:e)})),i&&r(i.restaurantId,'booking',`${i.ref} ${i.name} \u2192 ${s}`)},seatWalkIn:(n,s,i,o)=>{const l=a(),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,u=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,g=t().bookings.filter(e=>e.restaurantId===n&&e.walkIn&&e.date===c).reduce((e,t)=>Math.max(e,Number(t.ref.slice(2))||0),0)+1,m={id:(0,y.uuid)(),ref:`W-${g}`,restaurantId:n,customerId:null,name:'Walk-in',partySize:s,date:c,time:u,table:i||void 0,allergies:[],notes:(o??'').trim(),status:'seated',security:'none',depositPaid:0,createdAt:l.toISOString(),seatedAt:l.toISOString(),walkIn:!0,source:'walk-in'};return e(e=>({bookings:[...e.bookings,m]})),r(n,'walkin',`Walk-in ${m.ref} seated: ${s} cover(s)${i?`, Table ${i}`:', table to assign'}`),m},setBookingTable:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,table:n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.name} \u2192 ${n?n.includes('+')?`Tables ${n.split('+').join(' + ')}`:`Table ${n}`:'no table'}`)},updateBooking:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,...n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.walkIn?'Walk-in':s.name} moved/updated${n.table?` \u2192 Table ${n.table}`:''}${n.time?` at ${n.time}`:''}${n.durationMins?` for ${n.durationMins} min`:''}`)},undoWalkIn:a=>{const n=t().bookings.find(e=>e.id===a);n&&n.walkIn&&(e(e=>({bookings:e.bookings.filter(e=>e.id!==a)})),r(n.restaurantId,'walkin',`Walk-in ${n.ref} undone`))},ackBookingAllergy:(n,s)=>{const i=t().bookings.find(e=>e.id===n);i&&!i.allergyAck&&(e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,allergyAck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 1/5 Booked on ${i.ref} (${i.name}): ${s} (allergy recorded)`))},joinWaitlist:(n,s,i,o)=>{const l=t().waitlist.filter(e=>e.restaurantId===n).reduce((e,t)=>Math.max(e,t.number),0)+1,c={id:I('wl'),restaurantId:n,number:l,name:s,partySize:i,joinedAt:a().toISOString(),status:'waiting',customerId:o};return e(e=>({waitlist:[...e.waitlist,c]})),r(n,'waitlist',`${s} (${i}) joined the waitlist as #${l}`),c},setWaitlistStatus:(a,n)=>{const s=t().waitlist.find(e=>e.id===a);e(e=>({waitlist:e.waitlist.map(e=>e.id===a?{...e,status:n}:e)})),s&&(r(s.restaurantId,'waitlist',`Waitlist #${s.number} ${s.name} \u2192 ${n}`),'seated'===n&&t().addWalkIn(s.restaurantId,s.partySize))},addWalkIn:(t,a)=>{e(e=>({walkIns:{...e.walkIns,[t]:(e.walkIns[t]??0)+a}})),r(t,'walkin',`Walk-in seated: ${a} cover(s)`)},addStamp:(n,s,i)=>{const o=t().restaurants.find(e=>e.id===n);o&&(e(e=>{const t=e.stampCards.find(e=>e.restaurantId===n&&e.customerId===s),r=t??{restaurantId:n,customerId:s,stamps:0,rewardsAvailable:0,history:[]};let l=r.stamps+1,c=r.rewardsAvailable;l>=o.settings.stampTarget&&(l=0,c+=1);const u={...r,stamps:l,rewardsAvailable:c,history:[{at:a().toISOString(),source:i},...r.history]};return{stampCards:t?e.stampCards.map(e=>e===t?u:e):[...e.stampCards,u]}}),r(n,'stamp',`Stamp added (${i})`))},redeemReward:(t,a)=>{e(e=>({stampCards:e.stampCards.map(e=>e.restaurantId===t&&e.customerId===a&&e.rewardsAvailable>0?{...e,rewardsAvailable:e.rewardsAvailable-1}:e)})),r(t,'stamp','Loyalty reward redeemed')},buyGiftCard:(n,s,i,o)=>{const l=n.slice(0,3).toUpperCase(),c={id:I('gc'),code:O(l),restaurantId:n,initial:s,balance:s,ownerId:t().customer.id,recipientName:i,message:o,createdAt:a().toISOString()};return e(e=>({giftCards:[c,...e.giftCards]})),r(n,'giftcard',`Gift card sold \xa3${(s/100).toFixed(2)} (demo payment)`),c},redeemGiftCard:(a,n,s)=>{const i=t().giftCards.find(e=>e.code.toUpperCase()===a.trim().toUpperCase());return!(!i||n<=0||n>i.balance)&&(e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-n}:e)})),r(i.restaurantId,'giftcard',`Gift card ${i.code} redeemed \xa3${(n/100).toFixed(2)} by ${s}`),!0)},honourLegacyCard:(t,n,s,i)=>{const o={id:I('gc'),code:n.trim().toUpperCase(),restaurantId:t,initial:s,balance:s,ownerId:'legacy',recipientName:'Legacy website bookings gift card',message:`Honoured by ${i}`,createdAt:a().toISOString().slice(0,10),legacy:!0};return e(e=>({giftCards:[o,...e.giftCards]})),r(t,'giftcard',`Legacy website bookings gift card ${o.code} honoured (\xa3${(s/100).toFixed(2)}) by ${i}`),o},addEvent:t=>e(e=>({events:[...e.events,{...t,id:I('ev')}]})),addRating:t=>{e(e=>({ratings:[{...t,id:I('rt'),createdAt:a().toISOString()},...e.ratings],orders:t.orderId?e.orders.map(e=>e.id===t.orderId?{...e,rated:!0}:e):e.orders})),r(t.restaurantId,'rating',`Private rating ${t.stars}/5 from ${t.customerName}`)},updateMenuItem:(a,n)=>{const{name:s,section:i,price:o,allergens:l,allergenNotes:c,...u}=n,g={};void 0!==s&&(g.dish=s),void 0!==i&&(g.section=i),'price'in n&&(g.price=o??null),void 0!==l&&(g.allergens=l),'allergenNotes'in n&&(g.allergenNotes=c);const m='optionGroups'in n,p=(0,b.menuCardBridge)();p&&(Object.keys(g).length||m)&&p.menuEdited(a,g,'CoverCharge for Managers',m);const f=p?u:n;Object.keys(f).length&&e(e=>({menu:e.menu.map(e=>e.id===a?{...e,...f}:e)}));const k=t().menu.find(e=>e.id===a);k&&Object.keys(f).length&&r(k.restaurantId,'menu',`Menu: ${(0,b.resolveItem)(k).name} updated`)},setSignOff:(t,r)=>{const n=(0,b.menuCardBridge)();n?r?n.signOff(t,r):n.menuEdited(t,{},'CoverCharge for Managers',!0):e(e=>({menu:e.menu.map(e=>e.id===t?{...e,signOff:r?{by:r,at:a().toISOString().slice(0,10)}:null}:e)}))},addAudit:(e,t,a)=>r(e,t,a),updateSettings:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,settings:{...e.settings,...a}}:e)})),'takeawayPaused'in a&&r(t,'order',"Takeaway slots "+(a.takeawayPaused?'PAUSED':'resumed'))},addMenuItem:t=>{const a=I('m');return e(e=>({menu:[...e.menu,{...t,id:a}]})),(0,b.menuCardBridge)()?.menuItemAdded({...t,id:a}),r(t.restaurantId,'menu',`Menu: ${t.name} added (recipe card awaiting head chef sign-off)`),a},updateRestaurant:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,...a}:e)})),r(t,'menu',`Restaurant info updated (${Object.keys(a).join(', ')})`)},placeManualOrder:({restaurantId:n,type:s,channel:i,customerName:o,phone:l,email:u,tableNo:g,slotTime:m,lines:f,allergies:k,notes:I,by:S})=>{const h=t(),w=f.flatMap(({itemId:e,qty:t})=>{const a=h.menu.find(t=>t.id===e);if(!a||t<=0)return[];const r=(0,b.resolveItem)(a),n=(0,p.conflictsFor)((0,p.effectiveAllergens)(r),k);return[{itemId:e,name:r.name,qty:t,unitPrice:r.price??0,choices:[],notes:'',contains:n.contains,may:n.may,overridden:!1,prepMins:r.prepMins}]}),O=w.reduce((e,t)=>e+t.unitPrice*t.qty,0),C='table'===s,v=$(h.orders.filter(e=>e.restaurantId===n).map(e=>e.ref),C?'Q-':'T-',C?h.counters.table:h.counters.order),A={id:(0,y.uuid)(),ref:`${C?'Q':'T'}-${v}`,restaurantId:n,customerId:`manual-${i}`,customerName:o||(C?`Table ${g}`:'Walk-in'),type:s,tableNo:g,slotTime:m,lines:w,subtotal:O,tip:0,giftCardApplied:0,total:O,paid:0,status:'new',createdAt:a().toISOString(),allergies:k,readiness:{},notes:I,channel:i,...l?{phone:l}:{},...u?{email:u}:{},...k.length?{allergyChain:{booked:{by:S,at:a().toISOString()}}}:{}};return e(e=>({orders:[A,...e.orders],counters:C?{...e.counters,table:v}:{...e.counters,order:v}})),r(n,'order',`Order ${A.ref} taken by ${S} (${'phone'===i?'phone':'walk-in'===i?'walk-in takeaway':`Table ${g}`})`),k.length&&r(n,'allergy',`Allergen sign-off 1/5 Booked on ${A.ref}: ${S} recorded ${k.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),(l||u)&&c(A),A},ackAlert:(t,r)=>e(e=>({alertAcks:{...e.alertAcks,[t]:{by:r,at:a().toISOString()}}}))}},{name:'covercharge-demo-v1',version:9,migrate:async(e,t)=>{if(!e)return e;if(n.LIVE_VENUE_BUILD)return await(0,s.archiveChefCache)('core',e),Object.assign(e,(0,r.stripCoreLiveSamples)(e)),e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},e;if(e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},t<6){try{e.restaurants=(e.restaurants??[]).map(e=>'saltmarsh'===e?.id?{...e,name:'The Venue'}:e)}catch{}try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e?.id&&JSON.stringify(e.kitchenHours)===JSON.stringify(g.ANCHORAGE_KITCHEN_OLD)?{...e,kitchenHours:g.ANCHORAGE_KITCHEN,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.'}:e)}catch{}}if(t<5)try{e.events=(e.events??[]).map(e=>'string'==typeof e?.title&&/\(substitute day\)/i.test(e.title)?{...e,title:e.title.replace(/\s*\(substitute day\)/gi,'').trim()}:e)}catch{}if(t<4)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id&&e.settings&&!e.settings.pay?{...e,settings:{...e.settings,pay:g.ANCHORAGE_PAY}}:e)}catch{}if(t<3)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id?{...e,settings:{...e.settings,orderAtTable:!1}}:e),e.orders=(e.orders??[]).filter(e=>'ord-seed-3'!==e.id&&'Q-2018'!==e.ref),e.audit=(e.audit??[]).filter(e=>!String(e.text??'').includes('Q-2018'))}catch{}if(t>=2)return e;try{const t=(0,u.buildSeed)((0,u.defaultSimStart)()),a=new Map(t.bookings.map(e=>[e.id,e])),r=new Set((0,m.anchoragePlan)().tables.map(e=>e.name)),n=e=>!e||e.split('+').every(e=>r.has(e));e.bookings=(e.bookings??[]).map(e=>{const t=a.get(e.id);return t?{...e,table:t.table,dog:t.dog,notes:t.notes}:'anchorage'!==e.restaurantId||n(e.table)?e:{...e,table:void 0}})}catch{}return e},merge:(e,r)=>{const n={...r,...e};return a.IS_WILDINGS&&(n.restaurants=n.restaurants.map(t.withWildingsAddress)),n},storage:(0,c.createJSONStorage)(()=>o.default)}))},878,[1073,5,1217,842,1221,1080,1072,1081,1099,3,1077,818,1237,826,1037,1241]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShallow",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]);function o(e){const t=u.default.useRef(void 0);return u=>{const o=e(u);return(0,n.shallow)(t.current,o)?t.current:t.current=o}}},881,[31,1242]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLE_ORDER_DEFAULT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"cleanToken",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"isTableNo",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fromRow",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"toRow",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"hm",{enumerable:!0,get:function(){return l}}),_e.openAt=function(e,t){const r=a(t),n=e.openFrom?a(e.openFrom):null,o=e.lastOrders?a(e.lastOrders):null;return null!==n&&null!==o?n<=o?r>=n&&r=n||r=n:null===o||r{const t=(e??'').trim().toUpperCase();return/^[A-Z2-9]{16}$/.test(t)?t:null},r=e=>/^[0-9]{1,4}$/.test(e),n=t=>t?{on:!!t.is_on,tables:Array.isArray(t.tables)?t.tables.map(String):null,staffAccept:!1!==t.staff_accept,openFrom:t.open_from?String(t.open_from).slice(0,5):null,lastOrders:t.last_orders?String(t.last_orders).slice(0,5):null,guestTip:t.guest_tip??''}:{...e},o=e=>({is_on:e.on,tables:e.tables&&e.tables.length?e.tables.filter(r):null,staff_accept:e.staffAccept,open_from:e.openFrom,last_orders:e.lastOrders,guest_tip:e.guestTip.slice(0,300)}),a=e=>{const[t,r]=e.split(':').map(Number);return 60*t+r},l=e=>`${String(Math.floor(e/60)%24).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`;const s=(e,t)=>e.reduce((e,r)=>e+r.qty*(t.find(e=>e.id===r.id)?.pricePence??0),0),u=(e,t,r)=>e.map(e=>t.find(t=>t.id===e.id)).filter(e=>!!e&&(e.allergens.some(e=>r.includes(e))||e.mayContain.some(e=>r.includes(e)))),c=(e,t)=>`${e.replace(/\/$/,'')}/t?k=${t}`,f=(e,t)=>`${e.replace(/\/$/,'')}/customer-app/index.html?table=${t}`,p=e=>{const t=e.trim();return t.length>=2&&t.length<=40&&/\p{L}/u.test(t)},b=e=>{const t=e.trim();return!t||/^\+?[0-9][0-9 ()-]{6,19}$/.test(t)},m=e=>'table'===e.type&&'table-qr'===e.channel,y=e=>m(e)&&!!e.held&&!e.accepted&&'cancelled'!==e.status,h=e=>!y(e),O=e=>'cancelled'===e.status?e.cancelReason?`Cancelled: ${e.cancelReason}`:'Cancelled by the staff.':e.held&&!e.accepted?'Sent. Waiting for a member of staff to accept it.':'served'===e.status||'collected'===e.status||'closed'===e.status?'Served. Enjoy!':'ready'===e.status?'Ready: on its way to your table.':'Accepted: the kitchen has your order.',P=['Sold out','Wrong table','Sent twice','Kitchen closed','Guest asked to cancel'],j='Pay at the bar or with your server. Paying by card from your phone is coming later.'},883,[]); +__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})},884,[871,823,883]); +__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 Ye}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:J,subHeader:_e,noVoice:Fe=!1}={}){const tt=(0,V.default)(),nt=b??tt.width,at=tt.height,rt=nt<700,dt=nt>=at,ct=!rt&&dt&&nt>=600,ut=ct,ht=Math.round(Math.min(520,Math.max(nt>=1e3?448:280,.3*nt))),gt=W.default.useRef(null),bt=W.default.useRef(0),[yt,pt]=(0,L.useState)({w:0,h:0}),xt=(0,le.useOwner)(e=>e.site),ft=(0,Z.useRestaurant)(xt);(0,Ce.useAlertWatcher)(xt,{enabled:!e});const mt=(0,Z.useOrders)(xt),jt=(0,Z.useBookings)(xt),wt=(0,Z.useEvents)(xt),kt=(0,Z.useStore)(e=>e.skipMinutes),It=(0,Z.useStore)(e=>e.clock.mode),Dt=(0,Z.useNow)(5e3),vt=(0,le.useOwner)(e=>e.staff),St=(0,le.useOwner)(e=>e.attendance),Ct=(0,le.useOwner)(e=>e.shifts),Tt=(0,le.useOwner)(e=>e.leave),$t=W.default.useMemo(()=>(0,Ae.workingShifts)(Ct,Tt),[Ct,Tt]);W.default.useEffect(()=>{(0,ie.ensureAttendance)((0,X.ymd)(Dt),Dt)},[(0,X.ymd)(Dt)]);const Rt=(0,S.useSession)(e=>e.meId),Bt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:Ze(vt.find(e=>e.id===Rt)?.name)}),Lt=I.IS_CAR?'Car':'Display';(0,$.useSoldOutLink)(!1,e?void 0:Lt,!0);const Wt=(0,X.ymd)(Dt),zt=(0,H.useTravelDay)('display',Wt),Ht=(0,se.useFrontDoor)(Wt,dt),Pt=(0,oe.useDisplaySettings)(xt),Mt=Pt.privacy,At=(0,be.useSaverSync)(),Et=(0,oe.usePlan)(xt),Ot=(0,oe.useFloor)(e=>e.live[xt]),Nt=(0,Te.useBlocks)(e=>e.blocks),[_t,Ft]=(0,L.useState)('plan'),[Gt,Vt]=(0,L.useState)(!1),[Ut,Kt]=(0,L.useState)('all'),[qt,Yt]=(0,L.useState)(null),[Qt,Jt]=(0,L.useState)(null),[Xt,Zt]=(0,L.useState)(null),[el,tl]=(0,L.useState)(!1),[ll,sl]=(0,L.useState)(!1),[il,ol]=(0,L.useState)(null),[nl,al]=(0,L.useState)(!1),[rl,dl]=(0,L.useState)(!1),[cl,ul]=(0,L.useState)(!1),[hl,gl]=(0,L.useState)(null),[bl,yl]=(0,L.useState)(null),[pl,xl]=(0,L.useState)(null),[fl,ml]=(0,L.useState)(!1),jl=W.default.useRef(0),wl=e=>{jl.current=Date.now(),xl(e)};W.default.useEffect(()=>{if(!pl)return;const e=setInterval(()=>{Date.now()-jl.current>=Le.DAY_IDLE_MS&&xl(null)},5e3);return()=>clearInterval(e)},[pl]);const kl=(0,Z.useWaitlist)(xt),Il=(0,Z.useStore)(e=>e.walkIns[xt]??0),[Dl,vl]=(0,L.useState)(!1),[Sl,Cl]=(0,L.useState)(!1),[Tl,$l]=(0,L.useState)(!1);(0,Y.useReviewAlerts)(xt);const[Rl,Bl]=(0,L.useState)({view:0,content:0}),[Ll,Wl]=(0,L.useState)(null);W.default.useEffect(()=>{Ll&&((0,R.notify)({id:`floor-note:${Date.now()}`,title:Ll,timeoutMs:4500,big:!0,testID:'floor-toast'}),Wl(null))},[Ll]),W.default.useEffect(()=>{if(!e)return(0,P.setDisplaySilent)(!0),()=>(0,P.setDisplaySilent)(!1)},[e]);const[zl,Hl]=(0,L.useState)(null),Pl=W.default.useRef(0),[Ml,Al]=(0,L.useState)(null);W.default.useEffect(()=>{if(!zl)return;Pl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Pl.current;if(e>=Ye)return Hl(null),void Wl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Al(e>=105e3?Math.ceil((Ye-e)/1e3):null)},1e3);return()=>clearInterval(e)},[zl]);const El=e=>e.date!==Wt?Zt({title:`Guest details \xb7 ${(0,Le.dayWord)(e.date,Wt)} ${e.time}`,body:(0,Ue.jsxs)(Ue.Fragment,{children:[!e.walkIn&&e.date>Wt?(0,Ue.jsx)(K.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Le.dayWord)(e.date,Wt)}, ${e.time}`,disabled:!oi.ok,accessibilityHint:oi.hint,onPress:()=>{Zt(null),ol(e.id)},style:{minHeight:56}}):null,(0,Ie.bookingDetails)(e)]})}):Zt({title:`Guest details \xb7 ${e.time}`,body:(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsx)(ot,{rid:xt,id:e.id,turnBase:ft.settings.turnMins}),e.walkIn?null:(0,Ue.jsx)(K.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{Zt(null),ol(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ue.jsx)(me.CancelWalkInButton,{rid:xt,b:e,big:!0,onDone:e=>{Zt(null),Wl(e)}}):null,e.walkIn?(0,Ue.jsx)(me.ReinstateWalkInButton,{rid:xt,b:e,today:Wt,onDone:e=>{Zt(null),Wl(e)}}):null,(0,Ie.bookingDetails)(e)]})}),Ol=jt.filter(e=>e.date===Wt).sort((e,t)=>e.time.localeCompare(t.time)),Nl=Ol.filter(e=>!['cancelled','noshow'].includes(e.status)),_l=mt.filter(et).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Fl=(0,L.useMemo)(()=>(0,c.forecastToday)(ft,jt,mt,wt,Dt),[ft,jt,mt,wt,Dt.getTime()/6e4|0]),Gl=(0,Te.closedAreasAt)(Nt,xt,Wt,(0,X.hm)(Dt)),Vl=[...Gl].join(','),Ul=(0,L.useMemo)(()=>(0,ne.floorView)(Et,jt,mt,Ot??{},Dt,ft.settings.turnMins,Gl),[Et,jt,mt,Ot,Dt.getTime(),Vl]),Kl=(0,ke.hoursFor)(ft,Dt),ql=Kl?.open??new Date(`${Wt}T12:00:00`),Yl=Kl?.close??new Date(`${Wt}T21:00:00`),Ql=(0,X.addMins)(ql,-ql.getMinutes()),Jl=(0,X.addMins)(Yl,30),Xl=e=>new Date(`${Wt}T${e}:00`),Zl=(0,Te.blocksOn)(Nt,xt,Wt).map(e=>({from:Xl(e.from),to:Xl(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(ft,Dt,Wt)),es=Object.keys(Ul).filter(e=>'blocked'===Ul[e]?.status),ts=pl&&pl!==Wt?pl:Wt,ls=ts!==Wt,ss=(0,Le.dayWord)(ts,Wt),is=/^(Today|Yesterday|Tomorrow)$/.test(ss),os=ls?(0,Le.bookingsForDay)(jt,ts,Wt).sort((e,t)=>e.time.localeCompare(t.time)):Ol,ns=(0,X.parseYmd)(ts);ns.setHours(12);const as=ls?(0,ke.hoursFor)(ft,ns):Kl,rs=as?.open??new Date(`${ts}T12:00:00`),ds=as?.close??new Date(`${ts}T21:00:00`),cs=e=>new Date(`${ts}T${e}:00`),us=[...ls?(0,Te.blocksOn)(Nt,xt,ts).map(e=>({from:cs(e.from),to:cs(e.to),label:e.reason??'Paused'})):Zl,...ls?(0,o.queuedServicePauses)(ft,ns,ts):[]],hs=(0,o.queuedServiceSessions)(ft,ns),gs=s.IS_QUEUED_VENUE&&(void 0===hs||!hs.length),bs=(0,Ue.jsxs)(G.default,{testID:"queued-hours-gate",style:[Ee.look.panel,{padding:14,gap:8}],children:[(0,Ue.jsx)(K.T,{weight:"semibold",children:void 0===hs?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ue.jsx)(K.Muted,{children:i.queuedVenues[xt]?.hours.note})]}),ys=ls?as||os.length?tsls?(0,ne.dayFloorView)(Et,os,ts):Ul,[ls,Et,os,ts,Ul]),[xs,fs]=(0,L.useState)(null),[ms,js]=(0,L.useState)(null),[ws,ks]=(0,L.useState)(null),Is=ls?os.filter(e=>!['cancelled','noshow'].includes(e.status)):Nl,Ds=Is.reduce((e,t)=>e+t.partySize,0),vs=(0,u.coversSplit)(Is,ts),Ss=(0,ze.cancelledDayTally)(jt,ts),Cs=(0,He.cancellationsFor)(jt,ts,e=>e.walkIn?(0,ye.privName)(e,Mt):(e.name??'').replace(' (example)','')),Ts=(0,ze.cancelledTallyWords)(Ss,is?ss.toLowerCase():ls?`on ${ss}`:'today'),$s=Nt.filter(e=>e.rid===xt&&e.date===ts&&!e.removedAt),Rs=(0,Be.chartBands)($s,60*rs.getHours()+rs.getMinutes(),60*ds.getHours()+ds.getMinutes()),Bs=new Set((0,Be.blockedHours)(Rs)),Ls=Dt.getHours()+(Dt.getMinutes()>=30?1:0),Ws=Fl.hours.filter(e=>e.hour>=Ls&&!Bs.has(e.hour)),zs=Ws.reduce((e,t)=>e+t.coversHigh,0),Hs=Ws.reduce((e,t)=>e+t.coversLow,0),Ps=Math.round((Hs+zs)/2),Ms=!Fl.example&&Fl.open&&Fl.enough&&zs>0?`Usually ${(0,c.coversRange)(Ps,Ps)} more`:void 0,As=async(e,t)=>{const l=Ul[e]?.booking;if(!l||e===t)return;const s=Ul[t]?.status;if(s&&!['free','soon'].includes(s))return void Wl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ne.STATUS[s].label.toLowerCase()}. Pick a free table.`);if(!(0,je.guardBookingChange)(Wl,{b:l,tables:[t]}))return;await Z.repo.bookings.update(l.id,{table:t});const i=Ot?.[e]?.stage;oe.useFloor.getState().setLive(xt,t,{stage:i??'seated',dirty:!1}),oe.useFloor.getState().setLive(xt,e,{stage:void 0,dirty:!0}),Wl(`Saving: ${(0,ye.privName)(l,Mt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,je.reportBookingSave)(l.id,`${(0,ye.privName)(l,Mt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,ye.privName)(l,Mt)} to ${(0,d.tableNumbers)(t)}`,Wl)},Es=e=>{if(bl)return js(null),void yl(t=>t?{...t,tables:(0,we.toggleTable)(t.tables,e)}:t);ls?fs(e):Qt?(e!==Qt&&As(Qt,e),Jt(null)):Yt(e)},Os=bl?jt.find(e=>e.id===bl.id):void 0,Ns=bl&&Os?(()=>{const e=Os.walkIn?(0,ye.privName)(Os,Mt):Ze(Os.name),t=(0,we.seatsOf)(Et,bl.tables).total,l=(0,we.seatLine)(t,Os.partySize),s=(0,we.pickClashes)(Os,bl.tables,jt.filter(e=>e.date===Os.date),ft.settings.turnMins),i=(0,we.tableKey)(bl.tables)!==(0,we.tableKey)((0,oe.tablesOf)(Os.table));return(0,Ue.jsxs)(G.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ee.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ee.colours.gold,padding:10},children:[(0,Ue.jsxs)(G.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Le.dayWord)(Os.date,Wt)} ${Os.time}. Tap tables on the plan to add or take them off. ${(0,we.tablesWords)(bl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ue.jsxs)(K.T,{size:17,weight:"semibold",colour:ee.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Le.dayWord)(Os.date,Wt)," ",Os.time]}),(0,Ue.jsxs)(K.T,{size:16,colour:ee.colours.text,children:[(0,we.tablesWords)(bl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),ms?(0,Ue.jsx)(G.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:ms,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ee.colours.amber,backgroundColor:ee.colours.amberBg},children:(0,Ue.jsx)(K.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:ms})}):null,(0,Ue.jsxs)(K.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ue.jsx)(K.Button,{testID:ms?'plan-pick-overcap-yes':'plan-pick-save',label:ms?'Use it anyway':s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${ms?'Use it anyway':s.length?'Save anyway':'Save'}, ${(0,we.tablesWords)(bl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(!Os)return void yl(null);if(!(0,je.guardBookingChange)(Wl,{b:Os,tables:bl.tables}))return js(null),void yl(null);const l=(0,we.overCapacityAsk)(bl.tables,t,Os.partySize);if(l&&!ms)return void js(l);js(null);const s=bl.tables;yl(null),await(0,je.saveTablesReported)(xt,Os,s,e,t,Wl)}}),(0,Ue.jsx)(K.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{js(null),yl(null)}})]})]})})():null,_s=Et.areas.filter(e=>Et.tables.some(t=>t.areaId===e.id)),Fs=e=>{const t=Et.tables.filter(t=>t.areaId===e);return ls?`${t.filter(e=>!ps[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Ul[e.name]?.status??'free')).length}/${t.length} free`},Gs='all'===Ut||_s.some(e=>e.id===Ut)?Ut:'all',Vs=e=>(0,Ue.jsx)(ae.FloorCanvas,{plan:Et,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ct,big:!0,view:ps,privacy:Mt,turnBase:ft.settings.turnMins,highlight:bl?bl.tables:Qt?[Qt]:void 0,onTap:e=>Es(e.name),onDrop:(e,t)=>bl||ls?void 0:As(e.name,t.name)}),Us=rt?1:dt||_s.length>2?2:1,Ks=e=>{const t=Et.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},qs=[];for(let e=0;e<_s.length;e+=Us)qs.push(_s.slice(e,e+Us));const Ys=ct?(0,re.venueGrid)(_s.map(e=>{const t=(0,ae.areaBounds)(Et,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ae.minReadableScale)(Et,e.id)}}),yt.w,yt.h):null,Qs=e=>(0,Ue.jsxs)(K.Row,{style:{justifyContent:'space-between',height:re.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ue.jsxs)(K.T,{size:14,weight:"semibold",colour:(0,ee.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,de.areaMarks)(e)]}),Gl.has(e.id)?(0,Ue.jsx)(K.T,{size:13,weight:"semibold",colour:ee.colours.blue,children:"Closed for weather"}):(0,Ue.jsx)(K.T,{size:13,colour:ee.colours.muted,children:Fs(e.id)})]}),Js=(0,Ue.jsx)(G.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-yt.w)>1||Math.abs(l-yt.h)>1)&&pt({w:t,h:l})},children:Ys?(0,Ue.jsx)(F.default,{style:{flex:1},scrollEnabled:Ys.scroll,showsVerticalScrollIndicator:Ys.scroll,contentContainerStyle:{gap:re.GRID_GAP},children:Ys.rows.map((e,t)=>(0,Ue.jsx)(G.default,{style:{height:Ys.rowHeights[t],flexDirection:'row',gap:re.GRID_GAP},children:e.map(e=>{const t=_s.find(t=>t.id===e);return(0,Ue.jsxs)(G.default,{testID:`area-cell-${e}`,style:{width:Ys.cellW,gap:2},children:[Qs(t),(0,Ue.jsx)(G.default,{style:{flex:1},children:Vs(e)})]},e)})},t))}):null}),Xs=(0,Ue.jsxs)(G.default,{testID:"venue-plan",style:{flex:rt?void 0:1,gap:10,minWidth:0},children:[(0,Ue.jsx)(r.TableNumberWarning,{plan:Et}),Et.tables.length?null:(0,Ue.jsxs)(G.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ue.jsx)(K.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ue.jsx)(K.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,Ue.jsx)(K.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,Ue.jsx)(st,{chipId:"all",compact:!rt,label:"Whole venue",selected:'all'===Gs,onPress:()=>Kt('all')},"__all"),..._s.map(e=>(0,Ue.jsx)(st,{chipId:e.id,compact:!rt,label:`${e.name}${(0,de.areaMarks)(e)}`,colour:(0,ee.brandColour)(e.colour),sub:rt?Gl.has(e.id)?'closed':Gs===e.id?Fs(e.id):void 0:void 0,selected:Gs===e.id,onPress:()=>Kt(e.id)},e.id))];return rt?(0,Ue.jsx)(G.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ue.jsx)(F.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Bl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Bl(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:Rl.view>0&&Rl.content>0&&Rl.content<=Rl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Rl.view>0&&Rl.content<=Rl.view+1?'100%':void 0},children:e})})(),(0,Ue.jsx)(g.FloorLegend,{}),Ns,Qt?(0,Ue.jsxs)(K.Row,{gap:8,style:{backgroundColor:ee.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ue.jsxs)(K.T,{weight:"semibold",colour:ee.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Qt),": tap the new table."]}),(0,Ue.jsx)(K.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Jt(null)})]}):null,'all'===Gs&&ct?Js:'all'===Gs?(0,Ue.jsx)(G.default,{style:{flex:rt?void 0:1,gap:12,minHeight:ut?void 0:360},children:qs.map((e,t)=>(0,Ue.jsxs)(G.default,{style:{flex:rt?void 0:Math.max(.3,...e.map(e=>Ks(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ue.jsxs)(G.default,{style:{flex:1,gap:2},children:[rt?(0,Ue.jsxs)(G.default,{style:{alignItems:'center',gap:4},children:[(0,Ue.jsxs)(K.T,{center:!0,size:18,weight:"semibold",colour:(0,ee.brandColour)(e.colour),children:[e.name,(0,de.areaMarks)(e)]}),Gl.has(e.id)?(0,Ue.jsx)(K.T,{center:!0,size:14,weight:"semibold",colour:ee.colours.blue,children:"Closed for weather"}):(0,Ue.jsx)(K.Muted,{center:!0,children:Fs(e.id)})]}):(0,Ue.jsxs)(K.Row,{style:{justifyContent:'space-between'},children:[(0,Ue.jsxs)(K.T,{size:14,weight:"semibold",colour:(0,ee.brandColour)(e.colour),children:[e.name,(0,de.areaMarks)(e)]}),Gl.has(e.id)?(0,Ue.jsx)(K.T,{size:13,weight:"semibold",colour:ee.colours.blue,children:"Closed for weather"}):(0,Ue.jsx)(K.Muted,{children:Fs(e.id)})]}),(0,Ue.jsx)(G.default,{style:rt?{height:Math.max(280,Math.round((nt-40)*Ks(e.id)))}:{flex:1},children:Vs(e.id)})]},e.id)),e.length{if(ls)return void gl(e.id);const t=(0,oe.tablesOf)(e.table)[0];t&&Ul[t]?Yt(t):El(e)}},ts)}),ei='timeline'===_t,ti=Gt?(0,Ue.jsx)(O.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Vt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ue.jsxs)(G.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ee.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ue.jsxs)(G.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ue.jsx)(_.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Vt(!1),style:{minHeight:64,minWidth:nt<600?120:180,paddingHorizontal:nt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ee.colours.goldLight,backgroundColor:ee.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ue.jsx)(K.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ue.jsx)(G.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ue.jsx)(K.T,{size:22,weight:"semibold",colour:ee.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${ls?(0,Le.dayLong)(ts):'Today'}`})}),nt<600?null:(0,Ue.jsx)(G.default,{style:{minWidth:180}})]}),gs?bs:(0,Ue.jsx)(G.default,{style:{flex:1,minHeight:0},children:(0,Ue.jsx)(he.Timeline,{hideNow:!0,fit:!0,plan:Et,bookings:ls?os:Ol,now:ls?rs:Dt,privacy:Mt,turnBase:ft.settings.turnMins,t0:ls?(0,X.addMins)(rs,-rs.getMinutes()):Ql,t1:ls?(0,X.addMins)(ds,30):Jl,pauses:ls?us:Zl,blockedTables:ls?[]:es,onOpen:e=>{if(Vt(!1),ls)return void gl(e.id);const t=(0,oe.tablesOf)(e.table)[0];t&&Ul[t]?Yt(t):El(e)}},`full-${ts}`)})]})}):null,li=ls?(0,Ue.jsxs)(G.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:ee.colours.gold,backgroundColor:ee.colours.goldTint},children:[(0,Ue.jsx)(K.T,{size:15,weight:"semibold",colour:ee.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:is?`Showing ${ss} \xb7 ${(0,X.niceDate)((0,X.parseYmd)(ts))}`:`Showing ${(0,Le.dayWord)(ts,Wt)}`}),(0,Ue.jsx)(G.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ts}. Showing ${(0,Le.dayLong)(ts)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ue.jsx)(K.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{yl(null),wl(null)},style:{minHeight:44}})]}):null,si=(0,Ue.jsx)(G.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:rt?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(ei||Gt);return(0,Ue.jsx)(_.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?(Ft('plan'),Vt(!0)):(Vt(!1),Ft('plan'))},style:{flex:rt?1:void 0,minHeight:rt?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ee.colours.gold:'transparent',...Ee.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,Ue.jsx)(K.T,{size:rt?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),ii='display'!==I.APP_VARIANT||e?si:(0,Ue.jsxs)(G.default,{testID:"display-view-row",style:{flexDirection:rt?'column':'row',flexWrap:rt?'nowrap':'wrap',gap:6,alignItems:rt?'stretch':'center'},children:[si,(0,Ue.jsx)(k.DisplayRotaKitchenButtons,{phone:rt,shifts:Ct,staff:vt,today:Wt,leave:Tt})]}),oi=(0,h.useBookingWrite)(),ni=e=>(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsx)(Oe.BigAction,{premium:!0,label:"Walk-in",onPress:Ht.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!oi.ok,accessibilityHint:oi.hint}),(0,Ue.jsx)(Oe.BigAction,{premium:!0,label:"New booking",onPress:Ht.openBooking,testID:"add-booking",block:e,size:"s",disabled:!oi.ok,accessibilityHint:oi.hint}),(0,Ue.jsx)(Oe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>sl(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!oi.ok,accessibilityHint:oi.hint})]});(0,Ve.useDisplayNotices)(xt,!e);const ai=rt?180:168,[ri,di]=(0,L.useState)(ai),ci=W.default.useRef(ai),ui=W.default.useRef(null),hi=W.default.useRef(null),gi=()=>{const e=ui.current,t=hi.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=at<820?8:12,o=44+(at<820?4:8),n=i>ci.current?Math.ceil(i-ci.current):Re.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(ai,Math.floor(t-s-l)-n-o));Math.abs(ci.current-a)>=2&&(ci.current=a,di(a))})})};W.default.useEffect(()=>{const e=setTimeout(gi,60);return()=>clearTimeout(e)},[nt,at]);const bi=(0,Ue.jsxs)(G.default,{ref:hi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||f.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),gi()},style:{flexDirection:'row',flexWrap:nt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:rt?12:6,justifyContent:rt?'center':void 0,borderTopWidth:1,borderTopColor:ee.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ue.jsx)(Ge.DisplayClockButton,{}),(0,Ue.jsx)(ue.HoldToEdit,{quiet:!0,onUnlock:()=>{Al(null),Hl({at:Date.now()})},onHint:()=>Wl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ue.jsx)($e.BlockBookingsButton,{rid:xt,r:ft,now:Dt,by:Bt,quiet:!0,display:!0,day:ts}),Et.areas.some(e=>e.outdoor)?(0,Ue.jsx)($e.CloseGardenButton,{rid:xt,r:ft,now:Dt,by:Bt,quiet:!0,short:!0}):null,(0,Ue.jsx)(_.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>$l(!0),style:({pressed:e})=>({...Ee.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ue.jsx)(K.T,{size:15,weight:"semibold",colour:ee.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,Ue.jsx)(x.GiftQrButton,{rid:xt,venue:ft.name})]}),yi=_l.length?(0,Ue.jsxs)(G.default,{testID:"takeaway-panel",style:[Ee.look.panel,{overflow:'hidden'}],children:[(0,Ue.jsxs)(K.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ue.jsx)(K.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ue.jsxs)(K.T,{size:12,colour:ee.colours.muted,children:[_l.length," live"]})]}),(0,Ue.jsx)(G.default,{style:{padding:10},children:(0,Ue.jsx)(it,{list:_l,me:Bt,compact:!0,bookings:jt})})]}):null,pi=(Me.DueToday,ft.settings.turnMins||90),xi=ls?os:(0,v.todaysGuestList)(Ol,Dt,pi),fi=ls?[]:(0,v.todaysFinishedList)(Ol,Dt,pi),mi=ls?is?`${ss}\u2019s guests`:`Guests ${ss}`:'Today\u2019s guests',ji=(0,Ue.jsxs)(Ue.Fragment,{children:[0===xi.length?(0,Ue.jsx)(K.Muted,{children:ls?ts{const t=(0,v.isLeftEarly)(e,Dt,pi),l=(0,te.isSeatedHighlight)(e.status,{otherDay:ls})&&!t,s=(0,pe.guestRowText)(e,{name:e.walkIn?(0,ye.privName)(e,Mt):(e.name??'').replace(' (example)',''),seated:l,leftEarly:t,tableWord:!0}),i=ee.colours.text,o=l?ee.colours.goldLight:ee.colours.muted,n=ee.colours.gold,a=s.depositWarn?ee.colours.amber:ee.colours.goldLight;return(0,Ue.jsxs)(_.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:ls?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{dl(!1),gl(e.id)},style:({pressed:e})=>l?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,te.seatedHighlightStyle)({backgroundColor:e?qe:Ke,borderColor:ee.colours.gold,borderLeftColor:ee.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ee.colours.hairline,backgroundColor:e?ee.colours.tilePressed:'transparent'},children:[(0,Ue.jsxs)(G.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ue.jsx)(K.T,{size:18,weight:"semibold",colour:n,style:{width:58},children:s.time}),(0,Ue.jsx)(K.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Ue.jsx)(G.default,{style:{paddingTop:2},children:(0,Ue.jsx)(E.AllergyIcon,{text:s.allergy,size:22,colour:ee.colours.amber,ink:ee.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ue.jsxs)(K.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ue.jsx)(K.T,{size:16,colour:i,children:s.people}),s.deposit?(0,Ue.jsx)(K.T,{size:16,colour:o,children:" \xb7 "}):null,s.deposit?(0,Ue.jsx)(K.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Ue.jsx)(K.T,{size:16,colour:o,children:" \xb7 "}),(0,Ue.jsx)(K.T,{size:16,weight:l?'semibold':'regular',colour:'No table yet'===s.table?o:i,children:s.table}),s.dog?(0,Ue.jsx)(K.T,{size:16,children:" "}):null,s.dog?(0,Ue.jsx)(G.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ue.jsx)(xe.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),fi.length?(0,Ue.jsxs)(G.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ee.colours.hairline,padding:8,gap:4},children:[(0,Ue.jsxs)(_.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${fi.length}${cl?', expanded':', collapsed'}`,accessibilityState:{expanded:cl},onPress:()=>ul(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ee.colours.tilePressed:'transparent'}),children:[(0,Ue.jsxs)(K.T,{size:16,weight:"semibold",colour:ee.colours.goldLight,children:["Finished (",fi.length,")"]}),(0,Ue.jsx)(K.T,{size:16,colour:ee.colours.muted,children:cl?'\u25be':'\u25b8'})]}),cl?fi.map(e=>{const t=(0,pe.guestRowText)(e,{name:e.walkIn?(0,ye.privName)(e,Mt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ue.jsxs)(_.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{dl(!1),gl(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ee.colours.hairline,backgroundColor:e?ee.colours.tilePressed:'transparent'}),children:[(0,Ue.jsxs)(G.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ue.jsx)(K.T,{size:17,weight:"semibold",colour:ee.colours.gold,style:{width:58},children:t.time}),(0,Ue.jsx)(K.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ue.jsxs)(K.T,{size:15,colour:ee.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]})]},e.id)}):null]}):null,(0,Ue.jsx)(Pe.CancellationsSection,{items:Cs,dayWord:ls?is?ss.toLowerCase():`on ${ss}`:'today'})]}),wi=(0,Ue.jsx)(F.default,{testID:"display-guest-list",accessibilityLabel:mi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:ji}),ki=N.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&dl(!1)}}),Ii=(0,Ue.jsxs)(_.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${mi}, ${xi.length}`,accessibilityState:{expanded:rl},'aria-expanded':rl,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>dl(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:rl?ee.colours.gold:ee.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ee.colours.tilePressed:rl?ee.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ue.jsx)(K.T,{size:16,weight:"bold",colour:ee.colours.gold,children:xi.length}),(0,Ue.jsx)(G.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ue.jsx)(G.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ue.jsxs)(K.T,{size:13,weight:"semibold",colour:ee.colours.goldLight,numberOfLines:1,children:[mi," ",rl?'\u2039':'\u203a']})})})]}),Di=rl?(0,Ue.jsxs)(G.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ue.jsxs)(G.default,{testID:"guests-drawer",...ki.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*nt)),backgroundColor:ee.colours.surface,borderRightWidth:1,borderColor:ee.colours.gold,borderRadius:14,...Ee.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ue.jsxs)(G.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ue.jsxs)(G.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ue.jsxs)(K.T,{size:17,weight:"semibold",colour:ee.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[mi.toUpperCase()," (",xi.length,")"]}),(0,Ue.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${mi}`,onPress:()=>dl(!1),style:{marginRight:-6}})]}),Ss.count?(0,Ue.jsx)(K.T,{size:13,colour:ee.colours.muted,testID:"cancelled-day-tally-guests",children:Ts}):null]}),wi]}),(0,Ue.jsx)(_.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${mi}`,accessibilityRole:"button",onPress:()=>dl(!1),style:{flex:1}})]}):null,vi=gs?bs:s.IS_KIRKTON&&!Object.values(ft.kitchenHours??{}).some(Boolean)?(0,Ue.jsxs)(G.default,{testID:"kirkton-hours-to-confirm",style:[Ee.look.panel,{padding:14,gap:8}],children:[(0,Ue.jsx)(K.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ue.jsx)(K.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ue.jsx)(Re.DayGraph,{busyThreshold:(0,t.venueBusy)(ft,jt,Dt).busy,todays:os,open:rs,close:ds,now:Dt,turnBase:ft.settings.turnMins,blocks:$s,pauses:us,compact:rt,dense:!rt,fit:ct,tight:ct&&at<600,height:ai,forecastNote:ls?void 0:Ms,emptyText:ys,past:ts{jl.current=Date.now(),ml(!0)}}),Ti=(0,Ue.jsx)(We.DisplayCalendar,{visible:fl,today:Wt,day:ts,bookings:jt,restaurant:ft,now:Dt,onDay:wl,onClose:()=>ml(!1)}),$i=()=>{ls?dl(!0):Vt(!0)},Ri=(0,Ue.jsxs)(G.default,{style:{flex:1,flexDirection:'row',padding:at<820?8:12,paddingTop:at<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[zt?null:Ii,(0,Ue.jsxs)(G.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[zt?null:li,zt?(0,Ue.jsx)(F.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ue.jsx)(H.DayView,{rid:xt,day:zt,today:Wt,app:"display"})}):ei?Zs:Xs,ti,Di]}),(0,Ue.jsxs)(G.default,{testID:"display-side",style:{width:ht,gap:at<820?4:8,minHeight:0},children:[(0,Ue.jsx)(G.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ni(!1)}),(0,Ue.jsx)(G.default,{style:{flexShrink:0},children:ii}),zt?null:(0,Ue.jsx)(G.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ue.jsx)(z.CoversToday,{rid:xt,day:ts,compact:at<820,snug:at<820,tight:at<700,sound:(0,P.flapSoundOn)(),onPress:$i})}),zt?null:(0,Ue.jsx)(G.default,{ref:ui,testID:"day-graph-slot",onLayout:gi,style:{flexGrow:0,flexShrink:1,flexBasis:ai+52,minHeight:at<600?90:120,overflow:'visible'},children:Si}),(0,Ue.jsxs)(F.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ue.jsx)(_.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Cl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ue.jsx)(K.T,{center:!0,weight:"semibold",children:"Reviews"})}),yi,(0,Ue.jsx)($e.BlocksBanner,{rid:xt,now:Dt,big:!0,by:Bt})]})]})]});return(0,Ue.jsxs)(U.SafeAreaView,{style:{flex:1,backgroundColor:ee.colours.bg},onTouchStart:()=>{jl.current=Date.now()},onMouseDown:()=>{jl.current=Date.now()},children:[rt?(0,Ue.jsxs)(G.default,{style:{flex:1},children:[(0,Ue.jsxs)(F.default,{ref:gt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ue.jsxs)(G.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ue.jsx)(G.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ue.jsx)(j.ExitButton,{})}),(0,Ue.jsx)(Q.RestaurantLogo,{rid:xt,size:64}),(0,Ue.jsx)(K.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:ft.name}),(0,Ue.jsx)(Q.PoweredBy,{}),(0,Ue.jsx)(B.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ue.jsx)(G.default,{accessible:!0,accessibilityLabel:`Current time ${(0,X.hm)(Dt)}`,children:(0,Ue.jsx)(K.T,{center:!0,size:30,weight:"semibold",colour:ee.colours.goldLight,children:(0,X.hm)(Dt)})}),(0,Ue.jsx)(Ne.ShellfishChip,{rid:xt,by:Bt,app:"display",size:"m"}),(0,Ue.jsx)(Ne.SundayRoastChip,{rid:xt,by:Bt,app:"display",size:"m"}),J]}),_e,I.IS_CAR?null:(0,Ue.jsx)(w.WhosOnShift,{}),(0,Ue.jsx)(je.BookingSaveBanner,{rid:xt}),Ci,(0,Ue.jsx)(G.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ue.jsx)(lt,{phone:!0,split:vs,items:[{label:`Tables \xb7 ${ss}`,value:Is.length,testID:'badge-tables'},{label:`Covers \xb7 ${ss}`,value:Ds,testID:'badge-covers'},{label:'Takeaway',value:_l.length,alert:_l.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>tl(!0)}]})}),(0,Ue.jsx)(G.default,{testID:"primary-actions",style:{gap:8},children:ni(!0)}),(0,Ue.jsx)($e.BlocksBanner,{rid:xt,now:Dt,big:!0,by:Bt}),ii,(0,Ue.jsxs)(G.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[ei?Zs:Xs,ti]}),(0,Ue.jsxs)(G.default,{onLayout:e=>{bt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ee.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ue.jsxs)(K.T,{center:!0,size:20,weight:"semibold",colour:ee.colours.goldLight,accessibilityRole:"header",children:[mi," (",xi.length,")"]}),(0,Ue.jsx)(G.default,{testID:"display-guest-list",accessibilityLabel:mi,style:{gap:4},children:ji})]}),yi,Si,(0,Ue.jsx)(G.default,{testID:"covers-dock",children:(0,Ue.jsx)(z.CoversToday,{rid:xt,day:ts,compact:!0,sound:(0,P.flapSoundOn)(),onPress:()=>gt.current?.scrollTo({y:bt.current,animated:!0})})}),(0,Ue.jsxs)(G.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ue.jsx)(K.T,{center:!0,size:14,colour:Mt?ee.colours.muted:ee.colours.amber,children:Mt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ue.jsx)(K.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>vl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ue.jsx)(K.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Cl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),bi]}),e?null:(0,Ue.jsx)(G.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:ee.colours.hairline},children:(0,Ue.jsx)(A.VoiceSlot,{size:56})})]}):(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsxs)(G.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:nt>=1e3?18:14,paddingVertical:at<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...Ee.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ue.jsxs)(G.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ue.jsx)(G.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ue.jsx)(Q.RestaurantBrand,{rid:ft.id,size:nt<900?32:40,beside:!0})}),(0,Ue.jsxs)(G.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ue.jsx)(K.T,{size:nt<900?18:21,weight:"semibold",colour:ee.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,X.hm)(Dt)}),nt>=900?(0,Ue.jsx)(K.T,{size:13,colour:ee.colours.muted,children:(0,X.niceDate)(Dt)}):null]})]}),zt?(0,Ue.jsx)(G.default,{style:{width:220}}):(0,Ue.jsx)(G.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:Ci}),(0,Ue.jsxs)(G.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ue.jsx)(Ne.ShellfishChip,{rid:xt,by:Bt,app:"display",size:nt<1200?'xs':nt<1280||at<700?'s':'m'}),(0,Ue.jsx)(_.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>vl(!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,Ue.jsx)(K.T,{size:15,weight:"semibold",colour:ee.colours.muted,children:"?"})}),'simulated'===It?(0,Ue.jsx)(_.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>kt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ue.jsx)(K.T,{size:11,colour:ee.colours.muted,children:"+15"})}):null,e?null:(0,Ue.jsx)(j.ExitButton,{}),J,Fe?null:(0,Ue.jsx)(A.VoiceSlot,{size:44})]})]}),_e,!I.IS_CAR&&zt?(0,Ue.jsx)(w.WhosOnShift,{compact:!0}):null,(0,Ue.jsx)(je.BookingSaveBanner,{rid:xt,margin:{marginHorizontal:12,marginTop:6}}),zt?null:(0,Ue.jsxs)(G.default,{testID:"display-day-stats",style:Qe,children:[(0,Ue.jsxs)(G.default,{style:Je,children:[I.IS_CAR?null:(0,Ue.jsx)(w.WhosOnShift,{compact:!0}),(0,Ue.jsx)(G.default,{style:Xe,children:(0,Ue.jsx)(lt,{splitOnly:!0,split:vs,items:[]})})]}),(0,Ue.jsx)(G.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(nt>=1e3?18:14)+(e?0:52)+('simulated'===It?52:0),zIndex:4},children:(0,Ue.jsx)(Ne.SundayRoastChip,{rid:xt,by:Bt,app:"display",size:nt<1100||at<700?'s':'m'})})]}),ct?Ri:(Bi=(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsxs)(G.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ue.jsx)(G.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ni(!1)}),ii]}),(0,Ue.jsx)($e.BlocksBanner,{rid:xt,now:Dt,big:!0,by:Bt}),zt?(0,Ue.jsx)(H.DayView,{rid:xt,day:zt,today:Wt,app:"display"}):(0,Ue.jsx)(Ue.Fragment,{children:(0,Ue.jsxs)(G.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[Ii,(0,Ue.jsxs)(G.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[li,ei?Zs:Xs,ti,Di]})]})}),yi,zt?null:(0,Ue.jsx)(G.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ue.jsx)(z.CoversToday,{rid:xt,day:ts,sound:(0,P.flapSoundOn)(),onPress:$i})}),zt?null:(0,Ue.jsx)(G.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:ai+Re.DAY_GRAPH_CHROME},children:Si})]}),(0,Ue.jsx)(F.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:Bi})),bi]}),(0,Ue.jsx)(C.SoldOutStrip,{rid:xt,by:Lt,onOpen:()=>$l(!0)}),(0,Ue.jsx)(T.SoldOutSheet,{visible:Tl,onClose:()=>$l(!1),rid:xt,by:Lt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ue.jsx)(p.TableOrderCue,{rid:xt}),Ht.elements,ll?(0,Ue.jsx)(y.EditBookingPicker,{rid:xt,today:Wt,who:Bt,onClose:()=>sl(!1)}):null,il?(0,Ue.jsx)(y.EditBookingSheet,{rid:xt,id:il,who:Bt,onClose:()=>ol(null)}):null,qt?(0,Ue.jsx)(Ie.TableSheet,{rid:xt,name:qt,view:Ul,plan:Et,todays:Ol,now:Dt,privacy:Mt,turnBase:ft.settings.turnMins,onClose:()=>Yt(null),onWalkIn:e=>Ht.openWalkInAt(e),onMove:e=>Jt(e),onDetails:El}):null,xs?(()=>{const e=ps[xs],t=e?.dayBookings??[];return(0,Ue.jsxs)(K.Sheet,{visible:!0,onClose:()=>{ks(null),fs(null)},title:`${(0,d.tableNumbersA11y)(xs)} \xb7 ${is?ss:(0,Le.dayLong)(ts)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ue.jsxs)(K.T,{size:16,center:!0,colour:ee.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${is?ss.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${is?ss.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ye.privName)(e,Mt):Ze(e.name);return(0,Ue.jsx)(K.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,we.tablesWords)((0,oe.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{fs(null),gl(e.id)},style:{minHeight:56}},e.id)}),ts>=Wt?(()=>{const t=e?.table.maxSeats??0,l=jt.filter(e=>e.date===ts&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,oe.tablesOf)(e.table).includes(xs)).sort((e,t)=>e.time.localeCompare(t.time));return l.length?(0,Ue.jsxs)(G.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ue.jsxs)(K.T,{size:17,weight:"semibold",center:!0,colour:ee.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(xs)]}),ws?(0,Ue.jsxs)(G.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:ws.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ee.colours.amber,backgroundColor:ee.colours.amberBg},children:[(0,Ue.jsx)(K.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:ws.ask}),(0,Ue.jsxs)(K.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ue.jsx)(K.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!oi.ok,accessibilityHint:oi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=jt.find(e=>e.id===ws.id);if(ks(null),!e)return;const l=Ze(e.name);fs(null),await(0,je.saveTablesReported)(xt,e,[xs],l,t,Wl)}}),(0,Ue.jsx)(K.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>ks(null)})]})]}):null,ws?null:l.slice(0,12).map(e=>{const l=Ze(e.name),s=e.partySize>t;return(0,Ue.jsx)(K.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${l} \xb7 ${e.partySize} Covers`,sub:s?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!oi.ok,accessibilityHint:oi.hint,accessibilityLabel:`Put ${l}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(xs)}${s?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,je.guardBookingChange)(Wl,{b:e,tables:[xs]}))return;const s=(0,we.overCapacityAsk)([xs],t,e.partySize);s?ks({id:e.id,ask:s}):(fs(null),await(0,je.saveTablesReported)(xt,e,[xs],l,t,Wl))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ue.jsx)(K.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{ks(null),fs(null)},style:{minHeight:56}})]})})():null,hl?(()=>{const e=jt.find(e=>e.id===hl);return e?(0,Ue.jsx)(fe.GuestActionsSheet,{rid:xt,b:e,name:e.walkIn?(0,ye.privName)(e,Mt):Ze(e.name),view:Ul,now:Dt,otherDay:e.date!==Wt,turnBase:ft.settings.turnMins,onClose:()=>gl(null),onDetails:El,onDone:Wl,onEdit:e=>{gl(null),ol(e.id)},onPickOnPlan:(e,t)=>{dl(!1),Ft('plan'),Kt('all'),yl({id:e.id,tables:t})}}):null})():null,Xt?(0,Ue.jsx)(Ie.DetailsPanel,{title:Xt.title,onClose:()=>Zt(null),children:Xt.body}):null,Ti,nl?(0,Ue.jsx)(Ie.ServiceSummary,{r:ft,todays:Ol,orders:mt,waitlistAll:kl,walkInCount:Il,onClose:()=>al(!1)}):null,Dl?(0,Ue.jsxs)(K.Sheet,{visible:!0,onClose:()=>vl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ue.jsx)(g.FloorLegend,{}),(0,Ue.jsx)(K.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ue.jsx)(K.Button,{kind:"secondary",label:"Close",onPress:()=>vl(!1)})]}):null,Sl?(0,Ue.jsxs)(K.Sheet,{visible:!0,onClose:()=>Cl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ue.jsx)(q.ReviewsSection,{rid:xt,mode:"read",venueName:ft.name}),(0,Ue.jsx)(K.Button,{kind:"secondary",label:"Close",onPress:()=>Cl(!1)})]}):null,el?(0,Ue.jsxs)(Ie.DetailsPanel,{title:"Takeaway",onClose:()=>tl(!1),children:[(0,Ue.jsx)(K.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ue.jsx)(it,{list:_l,me:Bt,bookings:jt})]}):null,zl?(0,Ue.jsx)(G.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ee.colours.bg},children:(0,Ue.jsx)(ce.PlanDesigner,{initial:Et,venue:ft.name,mode:"display",startStep:"arrange",onActivity:()=>{Pl.current=Date.now(),null!==Ml&&Al(null)},notice:null!==Ml?`Locking again in ${Ml} s \xb7 touch to keep editing`:null,onSave:e=>{oe.useFloor.getState().setPlan(xt,e),Hl(null),Wl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{oe.useFloor.getState().setPlan(xt,e),Wl('Live seating plan updated on every screen.')},onCancel:()=>{Hl(null),Wl('No changes kept. Editing is locked again.')}},zl.at)}):null,e?null:(0,Ue.jsx)(ge.Screensaver,{rid:xt,idleMins:Pt.idleMins,pinOn:Pt.pinOn,wake:Pt,tonightCards:Pt.tonightCards,cfg:At}),e?null:(0,Ue.jsx)(ve.PrintHost,{rid:xt}),e?null:(0,Ue.jsx)(De.AlertHost,{variant:"display",rid:xt,skipTakeaway:!0}),e?null:(0,Ue.jsx)(M.SeatAllergenReminder,{rid:xt}),e?null:(0,Ue.jsx)(Se.TakeawayTakeover,{rid:xt,me:Bt})]});var Bi};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),B=_r(_d[29]),L=_r(_d[30]),W=e(L),z=_r(_d[31]),H=_r(_d[32]),P=_r(_d[33]),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=e(_r(_d[37])),N=e(_r(_d[38])),_=e(_r(_d[39])),F=e(_r(_d[40])),G=e(_r(_d[41])),V=e(_r(_d[42])),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),xe=_r(_d[68]),fe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Re=_r(_d[81]),Be=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Fe=_r(_d[94]),Ge=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]);const Ke='#221C12',qe='#2E2618',Ye=12e4,Qe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Je={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},Xe={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},Ze=e=>(e??'').replace(' (example)',''),et=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),tt=e=>e.slotTime?(0,X.hm)(new Date(e.slotTime)):'ASAP';function lt({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ue.jsxs)(G.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,Ue.jsx)(G.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,Ue.jsxs)(G.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,Ue.jsx)(K.T,{size:l?24:19,weight:"semibold",colour:e.alert?ee.colours.amber:ee.colours.text,children:e.value}),(0,Ue.jsx)(K.T,{size:l?14:12,colour:ee.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ue.jsx)(_.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,Ue.jsx)(W.default.Fragment,{children:i},e.testID)})}),s?(0,Ue.jsx)(G.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,Ue.jsx)(K.T,{size:14,colour:ee.colours.muted,children:"No Covers yet"}):(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsxs)(G.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ue.jsx)(K.T,{size:i?13:14,weight:"semibold",colour:ee.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ue.jsx)(K.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ue.jsxs)(G.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ee.colours.gold},children:[(0,Ue.jsx)(G.default,{style:{width:`${s.walkInPct}%`,backgroundColor:ee.colours.gold}}),(0,Ue.jsx)(G.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function st({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ue.jsxs)(_.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,Ue.jsx)(G.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ue.jsx)(K.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?ee.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ue.jsx)(K.T,{size:12,colour:ee.colours.muted,children:l}):null]})}function it({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Fe.statusBlock)(e,t,(0,Fe.linkedBooking)(e,s));return e.length?(0,Ue.jsx)(G.default,{style:{gap:8},children:e.map(e=>(0,Ue.jsxs)(G.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ee.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ee.colours.ok:e.allergies.length?ee.colours.red:ee.colours.gold},children:[(0,Ue.jsxs)(K.Row,{style:{justifyContent:'space-between'},children:[(0,Ue.jsxs)(K.T,{size:l?16:18,weight:"bold",children:[tt(e)," \xb7 ",Ze(e.customerName)]}),(0,Ue.jsx)(K.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,Ue.jsxs)(K.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,Ue.jsxs)(K.T,{size:14,weight:"semibold",colour:ee.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,J.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ue.jsx)(_e.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ue.jsxs)(K.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ue.jsx)(K.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Z.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ue.jsx)(K.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Z.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ue.jsx)(K.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Z.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ue.jsx)(ve.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ue.jsx)(K.Muted,{children:"No takeaway orders right now."})}function ot({rid:e,id:t,turnBase:l}){const s=(0,Z.useBookings)(e).find(e=>e.id===t);return s?(0,Ue.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},886,[1047,835,5,6,1572,887,1232,1452,811,876,1046,1022,1573,1145,1144,1574,1575,888,1578,989,1579,807,1582,1583,865,1584,1045,992,1208,1148,31,1142,1018,1120,995,1009,1585,257,242,264,152,128,288,290,817,841,1013,867,818,821,822,824,1449,861,1043,998,828,829,1462,1586,1461,1149,1592,1594,1124,1126,1596,1600,1602,1603,1466,1453,1454,832,1609,1010,1011,1533,1012,827,1044,1617,1618,1433,1432,1468,1620,1621,1622,1441,1494,1623,1493,1036,1037,1098,1624,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_BG",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SOUTERS_SURFACE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_TYPE_SCALE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"soutersFont",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"soutersSurface",{enumerable:!0,get:function(){return f}}),e.soutersInk=function(o){if(!t.IS_SOUTERS)return o;const c=(0,n.normaliseHex)(o);return c?'#A4622E'===c?'#D9AD8A':(0,n.contrast)(c,u)<4.5?'#FFFFFF':o:o};var t=r(d[0]),n=r(d[1]);const u='#56152A',o='#43122F',c=.88,S=n=>t.IS_SOUTERS?Math.round(n*c*100)/100:n,f=n=>t.IS_SOUTERS?o:n},887,[5,1102]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useScreensaverAsleep",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"useDisplayToolsH",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(0,t.create)(t=>({asleep:!1,set:n=>t({asleep:n})})),s=(0,t.create)(()=>({h:65}))},888,[1072]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"START_PAIR",{enumerable:!0,get:function(){return t}});const t=(()=>{try{if('undefined'==typeof window||!window.location)return null;const t=new URL(window.location.href),n=new URLSearchParams(t.hash.replace(/^#/,'')),c=t.searchParams.get('pair')||n.get('pair');if(!c)return null;t.searchParams.delete('pair'),n.delete('pair');const o=n.toString();return window.history.replaceState(null,'',t.pathname+(t.search?t.search:'')+(o?`#${o}`:'')),c}catch{return null}})()},889,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return D}}),_e.flagsFor=O,_e.notesFor=T,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return B}}),_e.AuditTrail=P,_e.TimeEdit=q,_e.OverrideSheet=H,_e.outstandingDays=N,_e.useOutstanding=function(){const e=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),t=(0,r.useOwner)(e=>e.timeRequests),n=(0,u.ymd)(new Date);return(0,s.useMemo)(()=>({days:N(e,n),requests:t.filter(e=>'open'===e.status).length}),[e,t,n])},_e.SignOff=function(){const{role:e}=(0,h.useCtx)(3e4);return r.CAN.manage(e)?(0,y.jsx)(z,{}):(0,y.jsx)(l.Muted,{center:!0,testID:"signoff-managers-only",children:"Sign off hours is for managers and owners."})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3])),a=e(_r(_d[4])),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]);const w=['Forgot to clock in','Forgot to clock out','Wrong time'],I=[0,15,20,30,45,60],S=e=>(e??'').replace(' (example)',''),v=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},D=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setMinutes(t),n.toISOString()},C=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},$=(e,t)=>{const n=(0,u.parseYmd)(e);return n.setDate(n.getDate()+t),(0,u.ymd)(n)},M=(e,t)=>e===t?'Today':e===$(t,-1)?'Yesterday':(0,u.niceDate)((0,u.parseYmd)(e));function O(e,t,s,o,a=[]){const l=[],i=(0,h.paidMins)(e,s),r=60*s.getHours()+s.getMinutes();if(!e.out&&(e.date60*t.end+60||i.worked>840)&&l.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=v(e.in)-Math.round(60*t.start),s=e.out?v(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&v(e.out)=30&&l.push({key:'diff',label:`${a>=60?(0,h.hmDur)(a):`${a}m`} off the rota`})}return(0,n.isZeroShift)(e)&&l.push({key:'zero',label:'Check: 0 minutes'}),t||l.push({key:'unrostered',label:'Not on the rota'}),i.worked>720&&l.push({key:'long',label:`Very long shift (${(0,h.hmDur)(i.worked)})`}),e.out&&i.worked>360&&0===i.brk&&l.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||l.push({key:'offsite',label:'Clocked off-site'}),a.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&l.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&l.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&l.push({key:'offrota',label:'Signed in off rota'}),l}function T(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),'rota'===e?.auto&&n.push(e.autoNote?`Auto from rota \xb7 ${e.autoNote}`:'Auto from rota'),n}const R=e=>{const t=(0,r.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},B=e=>{const t=(0,r.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},A={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined',voided:'Removed (kept in history)'};function P({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,y.jsx)(a.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,y.jsxs)(a.default,{style:{flexDirection:'row',gap:8},children:[(0,y.jsx)(a.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?c.colours.ok:'reopened'===e.action?c.colours.amber:c.colours.gold}}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:13,weight:"semibold",children:[A[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,y.jsxs)(l.Muted,{children:[S(e.by)," \xb7 ",(0,u.niceDate)(new Date(e.at))," ",(0,u.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,y.jsx)(l.Muted,{children:"No changes yet. Times are as clocked."})}function q({label:e,mins:n,onChange:o,testID:i}){const[r,d]=(0,s.useState)(null),u=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&o(60*+t[1]+ +t[2]+(n>=1440&&60*+t[1]+ +t[2]<360?1440:0)),d(null)};return(0,y.jsxs)(a.default,{style:{gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:e}),n>=1440?(0,y.jsx)(l.Muted,{children:"next day"}):null]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>o(n-15)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>o(n-5)}),(0,y.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??C(n),onChangeText:d,onBlur:()=>null!=r&&u(r),onSubmitEditing:()=>null!=r&&u(r),style:[l.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:c.colours.text}]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>o(n+5)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>o(n+15)})]})]})}function H({a:e,staffId:t,date:n,request:o,onClose:i}){const{me:d,meId:j,now:k,role:C}=(0,h.useCtx)(3e4),[$,M]=(0,s.useState)(!1),O=!!e&&(0,m.canSeeHoursEdit)({role:C,isCar:p.IS_CAR}),T=(0,r.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),A=(0,r.useOwner)(e=>e.shifts),H=(0,r.shiftOf)(A,t,n),N=o?.suggestedIn?v(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,u.parseYmd)(n).getTime())/6e4):H?Math.round(60*H.start):720,z=o?.suggestedOut??e?.out,F=z?(E=z,Math.round((new Date(E).getTime()-(0,u.parseYmd)(n).getTime())/6e4)):e&&e.in&&!e.out?null:H?Math.round(60*H.end):N+480;var E;const[_,L]=(0,s.useState)(N),[Y,W]=(0,s.useState)(F),[V,G]=(0,s.useState)(e?.breakMins??(H&&H.end-H.start>6?30:0)),[K,U]=(0,s.useState)(o?'out'===o.kind?w[1]:w[0]:e?e.in&&!e.out?w[1]:null:w[0]),[Z,J]=(0,s.useState)(''),[Q,X]=(0,s.useState)(null),ee=[K,Z.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),te=null!=Y?Y-_:0,ne=e?(0,h.paidMins)(e,k):null,se=null!=Y?Math.max(0,te-V):null,oe=e&&'confirmed'===(0,r.attStatus)(e),ae=null!=Y&&Y<=_?'Clock-out must be after clock-in.':te>1200?'A shift can\u2019t be longer than 20 hours.':null!=Y&&V>=te?'The break is longer than the shift.':null,le=e?.in&&!o&&_===N?e.in:D(n,_),ie=null==Y?void 0:e?.out&&!o&&Y===F?e.out:D(n,Y),re=!e||le!==e.in||(ie??'')!==(e.out??'')||(e.breakMins??0)!==V;return(0,y.jsxs)(l.Sheet,{visible:!0,onClose:i,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${S(T)} \xb7 ${(0,u.niceDate)((0,u.parseYmd)(n))}`,testID:"override-sheet",children:[(0,y.jsxs)(l.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,y.jsx)(l.Badge,{kind:B(e),label:R(e)}):(0,y.jsx)(l.Badge,{kind:"red",label:"No clock record"}),H?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Rota ${(0,h.fmtH)(H.start)}\u2013${(0,h.fmtH)(H.end)}`}):(0,y.jsx)(l.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,y.jsx)(l.Badge,{kind:"neutral",label:`Clocked ${(0,u.hm)(new Date(e.in))}\u2013${e.out?(0,u.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,y.jsxs)(l.Banner,{kind:"info",title:`${S(T)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,y.jsx)(q,{label:"Clock in",mins:_,onChange:L,testID:"ov-in"}),null!=Y?(0,y.jsx)(q,{label:"Clock out",mins:Y,onChange:W,testID:"ov-out"}):(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.Muted,{children:"No clock-out yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>W(H?Math.round(60*H.end):Math.min(_+480,60*k.getHours()+k.getMinutes()>_?60*k.getHours()+k.getMinutes():_+480))})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Break"}),(0,y.jsxs)(l.Row,{wrap:!0,gap:6,children:[I.map(e=>(0,y.jsx)(l.Chip,{label:0===e?'None':`${e} min`,selected:V===e,onPress:()=>G(e)},e)),(0,y.jsx)(l.Stepper,{value:V,min:0,max:240,onChange:G,label:"break minutes"})]}),(0,y.jsx)(l.T,{size:13,colour:c.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:w.map(e=>(0,y.jsx)(l.Chip,{label:e,selected:K===e,onPress:()=>U(K===e?null:e)},e))}),(0,y.jsx)(l.Field,{label:K?'Add detail (optional)':'Or type a reason',value:Z,onChangeText:J,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,y.jsxs)(l.Card,{style:{backgroundColor:c.colours.surface2},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(l.T,{children:"Paid hours"}),(0,y.jsx)(l.T,{weight:"bold",colour:c.colours.gold,children:null!=se?(0,h.hmDur)(se):'still on shift'})]}),ne&&e?.out?(0,y.jsxs)(l.Muted,{children:["Was ",(0,h.hmDur)(ne.paid)," (",(0,u.hm)(new Date(e.in)),"\u2013",(0,u.hm)(new Date(e.out)),", ",ne.brk,"m break)"]}):null,oe?(0,y.jsx)(l.T,{size:13,colour:c.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),ae?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:ae}):null,Q?(0,y.jsx)(l.T,{size:13,colour:c.colours.red,children:Q}):null,!ae&&re&&ee.trim().length<3?(0,y.jsx)(l.T,{size:15,center:!0,colour:c.colours.amber,testID:"ov-reason-short",children:ee.trim()?b.REASON_SHORT:'Pick a reason above or type one (at least 3 letters) to save.'}):null,(0,y.jsx)(l.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!ae||!re||ee.trim().length<3,onPress:()=>{r.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:n,in:le,out:ie,breakMins:V,reason:ee.slice(0,200),by:d,byId:j,now:k.toISOString(),request:o?.id})?(o&&r.useOwner.getState().resolveTimeRequest(o.id,'applied',d,k.toISOString()),i()):X('Couldn\u2019t save: check the times and the reason.')}}),O?(0,y.jsx)(a.default,{style:{alignItems:'center',width:'100%'},children:(0,y.jsx)(l.Button,{testID:"ov-delete-entry",kind:"ghost",label:"Delete entry",accessibilityLabel:"Delete entry",onPress:()=>M(!0),style:{minHeight:48,minWidth:160}})}):null,e&&$?(0,y.jsx)(x.DeleteShiftSheet,{a:e,onClose:()=>M(!1),onDeleted:i}):null,e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(f.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,y.jsx)(P,{a:e})]}):null]})}function N(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}function z(){const{now:e,today:t,me:n,meId:m}=(0,h.useCtx)(3e4),p=(0,r.useOwner)(e=>e.staff),x=(0,r.useOwner)(e=>(0,r.liveAttendance)(e.attendance)),b=(0,r.useOwner)(e=>e.shifts),w=(0,r.useOwner)(e=>e.timeRequests),I=(0,r.useOwner)(e=>e.leave),v=(0,s.useMemo)(()=>N(x,t),[x,t]),[D,C]=(0,s.useState)(t),[A,P]=(0,s.useState)(!1),[q,z]=(0,s.useState)(null),[F,E]=(0,s.useState)(null),_=(0,s.useMemo)(()=>{const n=x.filter(e=>e.date===D&&e.in),s=n.map(n=>{const s=(0,r.shiftOf)(b,n.staffId,D);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:O(n,s,e,t,w)}});b.filter(e=>e.date===D&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{const o=(0,d.leaveCovering)(I,n.staffId,D);if(o)return void(s.some(e=>e.leave&&e.staffId===n.staffId)||s.push({key:`leave-${n.id}`,staffId:n.staffId,sh:n,flags:[],leave:o}));(D60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.leave?4:e.a?'confirmed'===(0,r.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(p.find(t=>t.id===e.staffId)?.name??'').localeCompare(p.find(e=>e.id===t.staffId)?.name??''))},[x,b,w,I,D,e.getMinutes(),p]),L=w.filter(e=>'open'===e.status&&e.date===D),Y=w.filter(e=>'open'===e.status&&e.date!==D),W=_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)&&!e.flags.length),V=_.reduce((t,n)=>{if(!n.a)return t;const s=(0,h.paidMins)(n.a,e).paid;return'confirmed'===(0,r.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),G={confirmed:_.filter(e=>e.a&&'confirmed'===(0,r.attStatus)(e.a)).length,awaiting:_.filter(e=>e.a&&'awaiting'===(0,r.attStatus)(e.a)).length,open:_.filter(e=>e.a&&'open'===(0,r.attStatus)(e.a)).length,flagged:_.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,r.attStatus)(e.a))).length,off:_.filter(e=>e.leave).length},K=[t,...v.map(e=>e.date).filter(e=>e!==t)];for(let e=1;K.length<8&&e<=7;e++){const n=$(t,-e);K.includes(n)||K.push(n)}const U=A?(0,j.pastWeekDays)(D,t).slice().reverse():K.slice(0,10).sort((e,t)=>t.localeCompare(e)),Z=t=>{const s=r.useOwner.getState().confirmEntries(t,n,m,e.toISOString());E(s?`${s} ${1===s?'entry':'entries'} confirmed`:null)};return(0,y.jsxs)(a.default,{style:{gap:10},testID:"signoff",children:[v.filter(e=>e.date!==D).length?(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>C(v.filter(e=>e.date!==D)[v.filter(e=>e.date!==D).length-1].date),children:(0,y.jsx)(l.Banner,{kind:"warn",title:`${v.filter(e=>e.date!==D).length} earlier ${1===v.filter(e=>e.date!==D).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,y.jsx)(k.HoursDayPicker,{testID:"so-pick",date:D,today:t,custom:A,onDate:e=>{C(e),P(!0),E(null)},resetLabel:"Back to this week",onReset:()=>{C(t),P(!1),E(null)}}),(0,y.jsx)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:U.map(e=>{const n=v.find(t=>t.date===e);return(0,y.jsx)(l.Chip,{testID:`so-day-${e}`,accessibilityLabel:`${(0,j.longDay)(e)}${n?`, ${n.n} to sign off`:''}`,label:M(e,t),sub:n?`${n.n} to sign off`:void 0,selected:D===e,onPress:()=>{C(e),E(null)}},e)})}),(0,y.jsx)(l.Card,{children:(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{size:18,weight:"bold",testID:"so-day-title",children:[M(D,t),D===t||D===$(t,-1)?` \xb7 ${(0,u.niceDate)((0,u.parseYmd)(D))}`:'']}),(0,y.jsxs)(l.Muted,{children:[G.confirmed," confirmed \xb7 ",G.awaiting," awaiting \xb7 ",G.open," still clocked in",G.flagged?` \xb7 ${G.flagged} flagged`:'',G.off?` \xb7 ${G.off} on time off`:'']})]}),(0,y.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,y.jsx)(l.T,{size:18,weight:"bold",colour:c.colours.ok,children:(0,h.hmDur)(V.conf)}),(0,y.jsx)(l.Muted,{children:"confirmed"}),V.pend?(0,y.jsxs)(l.T,{size:13,colour:c.colours.amber,children:[(0,h.hmDur)(V.pend)," pending"]}):null]})]})}),F?(0,y.jsx)(l.Banner,{kind:"success",title:F}):null,L.length||Y.length?(0,y.jsx)(f.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...L,...Y].map(t=>{const s=p.find(e=>e.id===t.staffId),o=t.attendanceId&&x.find(e=>e.id===t.attendanceId)||x.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,y.jsxs)(l.Card,{highlight:c.colours.blue,children:[(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:30}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsxs)(l.T,{weight:"semibold",children:[S(s?.name)," \xb7 ",(0,u.niceDate)((0,u.parseYmd)(t.date))]}),(0,y.jsxs)(l.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,u.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,u.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,y.jsx)(l.Badge,{kind:"blue",label:"Request"})]}),(0,y.jsxs)(l.Row,{gap:6,children:[(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>z({staffId:t.staffId,a:o,request:t})}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>r.useOwner.getState().resolveTimeRequest(t.id,'declined',n,e.toISOString())})]})]},t.id)}),(0,y.jsx)(f.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),_.map(t=>{const n=p.find(e=>e.id===t.staffId),s=t.a,o=s?(0,h.paidMins)(s,e):null,f=s?(0,r.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,y.jsx)(l.Card,{highlight:t.leave?c.colours.blue:'confirmed'===f?c.colours.ok:t.flags.length?c.colours.amber:void 0,children:(0,y.jsxs)(a.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,y.jsxs)(l.Row,{gap:10,children:[(0,y.jsx)(i.StaffAvatar,{id:t.staffId,size:36}),(0,y.jsxs)(a.default,{style:{flex:1},children:[(0,y.jsx)(l.T,{weight:"semibold",children:S(n?.name)}),(0,y.jsx)(l.Muted,{children:[n?.job,...T(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,y.jsx)(l.Badge,{kind:"gold",label:"Temp"}):null,s?(0,y.jsx)(l.Badge,{kind:B(s),label:R(s)}):t.leave?(0,y.jsx)(l.Badge,{kind:"blue",label:(0,d.leaveLabel)(t.leave)}):(0,y.jsx)(l.Badge,{kind:"red",label:"Missing"})]}),(0,y.jsx)(l.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,h.fmtH)(t.sh.start)}\u2013${(0,h.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,u.hm)(new Date(s.in))}\u2013${s.out?(0,u.hm)(new Date(s.out)):'on'}`:t.leave?(0,d.leaveLabel)(t.leave):'no clock-in'],['Break',s?.out?`${o.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,h.hmDur)(o.paid):`${(0,h.hmDur)(o.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,y.jsxs)(a.default,{style:{minWidth:92,flexGrow:1},children:[(0,y.jsx)(l.T,{size:11,colour:c.colours.muted,children:e.toUpperCase()}),(0,y.jsx)(l.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===f?c.colours.ok:c.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==f?(0,y.jsx)(l.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,y.jsx)(l.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,t.leave?(0,y.jsxs)(l.Muted,{testID:`so-leave-${t.staffId}`,children:[(0,d.leaveNote)(t.leave),". Rota shift covered by leave: no hours counted."]}):null,m?(0,y.jsxs)(l.Muted,{children:["Adjusted by ",S(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,y.jsxs)(l.Muted,{children:["Confirmed by ",S(s.signOff.by)," \xb7 ",(0,u.niceDate)(new Date(s.signOff.at))," ",(0,u.hm)(new Date(s.signOff.at))]}):null,(0,y.jsxs)(l.Row,{gap:8,children:[(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${S(n?.name)}`,onPress:()=>z({staffId:t.staffId,a:s})}),s&&'awaiting'===f?(0,y.jsx)(l.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${S(n?.name)}`,onPress:()=>Z([s.id])}):null,s&&'open'===f?(0,y.jsx)(l.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),_.length?null:(0,y.jsx)(l.Card,{children:(0,y.jsx)(l.Muted,{children:"No clock records or rostered shifts for this day."})}),_.length?(0,y.jsx)(l.Button,{testID:"confirm-unflagged",kind:"success",label:W.length?`Confirm all unflagged (${W.length})`:'Nothing unflagged to confirm',disabled:!W.length,onPress:()=>Z(W.map(e=>e.a.id))}):null,(0,y.jsx)(l.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),q?(0,y.jsx)(H,{a:q.a,staffId:q.staffId,date:q.request?.date??q.a?.date??D,request:q.request,onClose:()=>z(null)}):null]})}},987,[873,1505,31,264,128,817,999,861,1441,821,824,997,998,1507,807,1508,1506,1509,1511,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},988,[2,823]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),u=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),f=(0,n.useOwner)(e=>e.staff),x=(0,r.workingNow)(u,f,t),b=(0,r.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:b,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'center',flexShrink:1,minWidth:0},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'center',alignItems:'center',minWidth:0},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:o.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:o.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'center',alignItems:'center',flexShrink:1,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:o.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:o.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:b,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:o.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:o.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:o.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:o.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),h=_r(d[7])},989,[31,128,998,861,1024,824,817,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCKED_STEPS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"BLOCKED_INTRO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"BLOCKED_SPOKEN",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"STILL_OFF",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"ALERTS_PROMPT_ON",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"usePushPrompt",{enumerable:!0,get:function(){return O}}),_e.bannerFor=L,_e.titleFor=R,_e.chromeUrlFor=B,_e.AlertsBanner=function(){const e=O(e=>e.mode);if(!e)return null;const{line:n,action:o}=L(e);return(0,C.jsxs)(r.default,{testID:"alerts-banner",accessibilityRole:"button",accessibilityLabel:`${n} ${o}.`,accessibilityHint:"Opens the steps",onPress:()=>O.setState({open:!0}),style:{alignSelf:'center',maxWidth:420,width:'100%',minHeight:48,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1,borderColor:l.colours.accentBorder,backgroundColor:l.colours.surface2},children:[(0,C.jsx)(H,{size:18}),(0,C.jsxs)(t.Text,{testID:"alerts-banner-text",style:{color:'#F2E6C9',fontSize:15,textAlign:'center',flexShrink:1},children:[n," ",(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontWeight:'700',textDecorationLine:'underline'},children:o})]})]})},_e.PushPrompt=function(){const e=(0,s.useSync)(e=>e.kind),u=(0,s.useSync)(e=>e.staffRef),p=(0,s.useSync)(e=>e.venueId),b=O(e=>e.mode),m=O(e=>e.open),x=e=>O.setState(e?{mode:e}:{mode:null,open:!1}),[w,A]=(0,n.useState)(null),[L,_]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!k.includes(f.APP_VARIANT)||!P)return;if(h.PITCH)return globalThis.__pitchPushPrompt=e=>{A(null),O.setState({mode:e,open:!!e})},void(globalThis.__pitchPushBanner=e=>{A(null),O.setState({mode:e,open:!1})});if('staff'!==e||!u||!p)return;let t=!0;const n=async()=>{let e='unsupported';if(!(0,c.inApkWebView)()){try{e=await(0,c.pushState)()}catch{return}if(!t)return;if('on'===e)return x(null),void(0,c.resaveIfAllowed)().catch(()=>{});if('off'===e&&'undefined'!=typeof Notification&&'granted'===Notification.permission){let e=!1;try{e=await(0,c.resaveIfAllowed)()}catch{}if(!t)return;if(e)return void x(null)}}const n=z(e);t&&(n&&Date.now()-D()>I?O.setState({mode:n}):x(null))};n();const o=()=>{'undefined'!=typeof document&&'visible'===document.visibilityState&&n()};try{document.addEventListener('visibilitychange',o)}catch{}return()=>{t=!1;try{document.removeEventListener('visibilitychange',o)}catch{}}},[e,u,p]),!b||!m)return null;const F=R(b),N={minHeight:64,borderRadius:16,justifyContent:'center',alignItems:'center',paddingHorizontal:20,backgroundColor:l.colours.gold,alignSelf:'stretch'},W=(e,n)=>(0,C.jsxs)(i.default,{style:{flexDirection:'row',gap:12,alignItems:'center',alignSelf:'stretch'},children:[(0,C.jsx)(i.default,{style:{width:30,height:30,borderRadius:15,borderWidth:1.5,borderColor:l.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontSize:15,fontWeight:'700'},children:e})}),(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,flex:1,lineHeight:22},children:n})]},e);return(0,C.jsx)(i.default,{testID:"alerts-prompt-backdrop",style:{position:'fixed',left:0,right:0,top:0,bottom:0,zIndex:2147483100,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:18},children:(0,C.jsxs)(i.default,{testID:"alerts-prompt",accessibilityRole:'dialog',accessibilityLabel:F,style:{width:'100%',maxWidth:380,backgroundColor:l.colours.surface2,borderColor:l.colours.accentBorder,borderWidth:1,borderRadius:22,paddingHorizontal:22,paddingTop:22,paddingBottom:18,alignItems:'center',gap:14,shadowColor:'#000',shadowOpacity:.5,shadowRadius:24,shadowOffset:{width:0,height:10}},children:[(0,C.jsx)(i.default,{style:{position:'absolute',top:10,right:10},children:(0,C.jsx)(y.GoldClose,{testID:"alerts-prompt-close",label:"Close",onPress:()=>{A(null),O.setState({open:!1})}})}),(0,C.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1.5,borderColor:l.colours.gold,alignItems:'center',justifyContent:'center',marginTop:6},children:(0,C.jsx)(H,{})}),(0,C.jsx)(t.Text,{testID:"alerts-prompt-title",accessibilityRole:"header",style:{color:l.colours.goldLight,fontSize:22,fontWeight:'700',textAlign:'center',lineHeight:28,paddingHorizontal:8},children:F}),'off'===b?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(r.default,{testID:"alerts-prompt-turn-on",accessibilityRole:"button",disabled:L,accessibilityState:{disabled:L,busy:L},accessibilityLabel:"Turn on alerts. Your phone will then ask to allow notifications: tap Allow.",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{const e=await(0,c.turnOnPush)();if(e.ok)return void x(null);A(e.message);const t=z(await(0,c.pushState)());x(t||null)}catch{A('Could not turn on alerts. Please try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Turning on\u2026':'Turn on alerts'})}),(0,C.jsxs)(t.Text,{testID:"alerts-prompt-allow",style:{color:'#F2E6C9',fontSize:17,textAlign:'center'},children:["When your phone asks, tap ",(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontWeight:'700'},children:"Allow"}),"."]})]}):null,'blocked'===b?(0,C.jsxs)(i.default,{testID:"alerts-prompt-blocked",accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"assertive",accessibilityLabel:j,style:{alignSelf:'stretch',gap:8},children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:17,textAlign:'center'},children:T}),S.map((e,t)=>W(t+1,e))]}):null,'blocked'===b?(0,C.jsx)(r.default,{testID:"alerts-prompt-recheck",accessibilityRole:"button",disabled:L,accessibilityState:{disabled:L,busy:L},accessibilityLabel:"I\u2019ve allowed it. Check again.",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{if('blocked'===await(0,c.pushState)())return void A(v);const e=await(0,c.turnOnPush)();if(e.ok)return void x(null);A(e.message);const t=z(await(0,c.pushState)());x(t)}catch{A('Could not check alerts. Please try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Checking\u2026':'I\u2019ve allowed it, check again'})}):null,'ios'===b?(0,C.jsxs)(i.default,{testID:"alerts-prompt-ios",style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,textAlign:'center'},children:"iPhone only sends alerts to apps on the Home Screen. First:"}),W(1,'Tap the Share button (the square with the arrow) in Safari.'),W(2,'Tap Add to Home Screen, then Add.'),W(3,'Open CoverCharge from your Home Screen.'),W(4,'Tap Turn on alerts, then Allow.')]}):null,'apk'===b||'webview'===b?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,textAlign:'center'},children:'apk'===b?'The phone app can\u2019t show alerts when it\u2019s closed. Chrome can. You\u2019ll stay signed in as you.':'This browser can\u2019t get alerts. Open CoverCharge in Chrome.'}),(0,C.jsx)(r.default,{testID:"alerts-prompt-open-chrome",accessibilityRole:"button",disabled:L,accessibilityLabel:"Open CoverCharge in Chrome to turn on alerts",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{let e=null;if('apk'===b){const t=await(0,s.makeChromeHandover)();if(!t.ok)return void A(t.message);e=t.code}const t=B(window.location.href,e,'apk'===b);if(h.PITCH)return A('Opening Chrome\u2026'),void(globalThis.__pitchLastChromeUrl=t);A('Opening Chrome\u2026 Then tap Turn on alerts there, and Allow.');try{window.location.href=t}catch{await o.default.openURL(t)}}catch{A('Could not open Chrome. Check your connection and try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Opening\u2026':'Open in Chrome'})}),(0,C.jsx)(t.Text,{style:{color:'#CFC6B4',fontSize:14,textAlign:'center'},children:"In Chrome: tap Turn on alerts, then Allow."})]}):null,w?(0,C.jsx)(i.default,{accessibilityLiveRegion:"assertive",accessibilityRole:'alert',children:(0,C.jsx)(t.Text,{testID:"alerts-prompt-msg",style:{color:l.colours.goldLight,fontSize:15,textAlign:'center'},children:w})}):null,(0,C.jsx)(r.default,{testID:"alerts-prompt-later",accessibilityRole:"button",accessibilityLabel:"Not now. Hide this until tomorrow",onPress:()=>{E(),A(null),x(null)},style:{minHeight:48,justifyContent:'center',paddingHorizontal:24},children:(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontSize:17,textDecorationLine:'underline'},children:"Not now"})})]})})};var t=_r(d[0]),n=_r(d[1]),o=e(_r(d[2]));_r(d[3]);var r=e(_r(d[4])),i=e(_r(d[5])),l=_r(d[6]),s=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),f=_r(d[11]),p=_r(d[12]),b=_r(d[13]),y=_r(d[14]),m=_r(d[15]),x=e(m),C=_r(d[16]);const w='cc-alerts-prompt-v1',S=['In Chrome, tap the three dots at the top right, then Settings.','Tap Site settings, then Notifications.','Find CoverCharge (covercharge-apps) under Blocked, tap it, and choose Allow.','Come back here and tap \u201cI\u2019ve allowed it, check again\u201d.'],T='Chrome has alerts switched off for CoverCharge on this phone, so the app can\u2019t ask again. To switch them back on:',j=`${T} ${S.map((e,t)=>`${t+1}. ${e}`).join(' ')}`,v='Alerts are still off in Chrome. Follow the steps above, then tap check again.',I=864e5,k=['owner','staff','chef'],P=!(b.IS_ISOLATED_VENUE||b.IS_QUEUED_VENUE||b.IS_GREENSIDE||b.IS_ABBOTSFORD||b.IS_KIRKTON),A=k.includes(f.APP_VARIANT)&&P&&!h.PITCH,O=(0,u.create)(()=>({mode:null,open:!1}));function L(e){return{line:'Alerts are off on this phone.',action:'off'===e?'Tap to turn on':'ios'===e?'Tap to see how':'apk'===e||'webview'===e?'Tap to open in Chrome':'Tap to fix'}}function R(e){return'apk'===e||'webview'===e?'Open CoverCharge in Chrome to turn on alerts':'ios'===e?'Add CoverCharge to your Home Screen':'blocked'===e?'Turn alerts back on in Chrome':'Turn on alerts so you don\u2019t miss orders and reminders'}const _=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent);function D(){try{const e=JSON.parse(localStorage.getItem(w)||'{}');return Number(e.later||0)}catch{return 0}}function E(){try{localStorage.setItem(w,JSON.stringify({later:Date.now(),version:p.APP_VERSION}))}catch{}}function z(e){return _()?'apk':(0,c.inApkWebView)()?'webview':'off'===e?'off':'blocked'===e?'blocked':'ios-home-screen'===e?'ios':null}function B(e,t,n){const o=new URL(e),r=`${o.origin}${o.pathname.replace(/[^/]*$/,'')}index.html${t?`#ccchrome=${t}`:''}`;return n?`googlechrome://navigate?url=${encodeURIComponent(r)}`:`intent://${o.host}${o.pathname.replace(/[^/]*$/,'')}index.html#Intent;scheme=https;package=com.android.chrome;end`}function H({size:e=32}={}){return(0,C.jsxs)(x.default,{width:e,height:e,viewBox:"0 0 24 24",accessible:!1,pointerEvents:"none",children:[(0,C.jsx)(m.Path,{d:"M6 16 V11 a6 6 0 0 1 12 0 V16 l1.5 2 H4.5 Z",stroke:l.colours.gold,strokeWidth:1.7,strokeLinejoin:"round",fill:"none"}),(0,C.jsx)(m.Path,{d:"M10 20.5 a2 2 0 0 0 4 0",stroke:l.colours.gold,strokeWidth:1.7,strokeLinecap:"round",fill:"none"})]})}},990,[873,31,240,123,264,128,824,823,1065,1072,2,807,1159,5,835,1017,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"currentScrollY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"screenGeneration",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"restoreScroll",{enumerable:!0,get:function(){return o}}),_e.useScrollMemory=function(u){const c=(0,e.useRef)(0),o=(0,e.useRef)(0),l=(0,e.useRef)(0),s=(0,e.useRef)(0),f=(0,e.useRef)(0),v=(0,e.useRef)(null),y=(0,e.useRef)([]),h=()=>{y.current.forEach(clearTimeout),y.current=[]},b=()=>{const e=v.current;null!=e&&(u.current?.scrollTo({y:e,animated:!1}),f.current-s.current>=e-2&&(c.current=e,o.current=e,v.current=null,h()))},p=(0,e.useCallback)(e=>{if(h(),v.current=Math.max(0,e),e<=0)return v.current=null,u.current?.scrollTo({y:0,animated:!1}),c.current=0,void(o.current=0);for(const e of[0,30,80,160,320,600,1e3,1600,2500])y.current.push(setTimeout(b,e));y.current.push(setTimeout(()=>{v.current=null},2600))},[]);t={y:()=>o.current,restore:p};const R=(0,e.useCallback)(()=>{n++;return o.current},[]);return{props:{scrollEventThrottle:32,onScroll:e=>{const t=e.nativeEvent.contentOffset.y;c.current=t,s.current=e.nativeEvent.layoutMeasurement.height,f.current=e.nativeEvent.contentSize.height,Date.now()-l.current>250&&null==v.current&&(o.current=t)},onScrollBeginDrag:()=>{v.current=null,h()},onContentSizeChange:(e,t)=>{f.current=t,l.current=Date.now(),b()},onLayout:e=>{s.current=e.nativeEvent.layout.height}},restore:p,leave:R}};var e=r(d[0]);let t=null,n=0;const u=()=>t?t.y():0,c=()=>n,o=e=>t?.restore(e)},991,[31]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOut",{enumerable:!0,get:function(){return f}}),_e.setSoldOutBy=m,_e.setSoldOut=function(e,t,n){if(!o.useStore.getState().menu.find(t=>t.id===e))return;n&&m(n);p.add(e);try{o.useStore.getState().updateMenuItem(e,{soldOut:t})}finally{p.delete(e)}},_e.soldOutNow=function(e,t=c()){return(0,i.activeSoldOut)(f.getState().entries,e,t)},_e.linkSoldOut=h,_e.useSoldOutLink=function(e,t,n=!0){const r=_r(d[9]);r.useEffect(()=>{n&&h({adopt:e})},[e,n]),r.useEffect(()=>{n&&m(t)},[t,n])};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),a=_r(d[2]),i=_r(d[3]),s=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]);const c=()=>{try{return(0,o.nowFrom)(o.useStore.getState().clock)}catch{return new Date}},f=(0,r.create)()((0,a.persist)((e,t)=>({entries:[],adopted:{},mark:(t,n,r,a)=>{const u=c(),l=o.useStore.getState().restaurants.find(e=>e.id===t),f=(0,i.soldOutSettingsOf)(l?.settings?.soldOut),S=l?(0,s.hoursFor)(l,u)?.close??null:null,m=(0,i.clearAfterFor)(u,f,S),p={rid:t,itemId:n,name:r.slice(0,120),on:!0,at:u.toISOString(),by:a.slice(0,80),clearAfter:m?.toISOString(),auto:!1,kept:!1};e(e=>({entries:[...e.entries.filter(e=>!(e.rid===t&&e.itemId===n)),p]}))},back:(n,r,a)=>{const i=t().entries.find(e=>e.rid===n&&e.itemId===r);i&&i.on&&e(e=>({entries:e.entries.map(e=>e===i?{...e,on:!1,at:c().toISOString(),by:a.slice(0,80),clearAfter:void 0,kept:!0}:e)}))},expire:(n,r)=>{const a=(0,i.expiredSoldOut)(t().entries,n,r);if(!a.length)return 0;const s=new Set(a.map(e=>e.itemId));return e(e=>({entries:e.entries.map(e=>e.rid===n&&s.has(e.itemId)?{...e,on:!1,by:'Cleared automatically',clearAfter:void 0}:e)})),a.length}}),{name:'covercharge-soldout-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default),partialize:e=>({entries:e.entries.slice(-500),adopted:e.adopted})}));let S='Staff';function m(e){e&&(S=e.replace(' (example)',''))}const p=new Set;let O=null;function h(e){if(O)return O;let t=!1;const n=(e=o.useStore.getState().menu)=>new Map(e.map(e=>[e.id,e.soldOut]));let r=n();if(e.adopt){const e={...f.getState().adopted},t=[];for(const t of o.useStore.getState().menu)e[t.restaurantId];for(const t of o.useStore.getState().menu)e[t.restaurantId]=!0;f.setState(n=>({entries:[...n.entries,...t],adopted:e}))}const a=()=>{const e=c(),a=f.getState().entries,i=o.useStore.getState().menu,s=new Map;for(const t of a){const n=t.on&&(!t.clearAfter||new Date(t.clearAfter).getTime()>e.getTime());s.set(`${t.rid}|${t.itemId}`,n)}const u=i.filter(e=>s.has(`${e.restaurantId}|${e.id}`)&&s.get(`${e.restaurantId}|${e.id}`)!==e.soldOut);if(u.length){t=!0;try{const e=new Map(u.map(e=>[e.id,s.get(`${e.restaurantId}|${e.id}`)]));o.useStore.setState(t=>({menu:t.menu.map(t=>e.has(t.id)?{...t,soldOut:e.get(t.id)}:t)}))}finally{t=!1,r=n()}}},i=o.useStore.subscribe((e,i)=>{if(e.menu===i.menu)return;const s=n(e.menu);let o=!1;if(!t)for(const t of e.menu){const e=r.get(t.id);void 0!==e&&e!==t.soldOut&&(p.has(t.id)?t.soldOut?f.getState().mark(t.restaurantId,t.id,t.name,S):f.getState().back(t.restaurantId,t.id,S):o=!0)}r=s,o&&setTimeout(a,0)}),s=f.subscribe((e,t)=>{e.entries!==t.entries&&a()}),u=()=>{const e=c(),t=new Set(f.getState().entries.filter(e=>e.on).map(e=>e.rid));for(const n of t)f.getState().expire(n,e)};u(),a();const l=setInterval(u,3e4);let m=null;if(e.adopt)try{m=_r(d[8],"./autoSoldOutStore").startAutoSoldOut()}catch{m=null}return O=()=>{i(),s(),clearInterval(l),m&&m(),O=null},O}u.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchLive=e=>(0,l.setLiveData)(!!e),globalThis.__pitchSoldOut=e=>{const t=o.useStore.getState(),n=t.restaurants[0]?.id;if(!n)return;const r=t.menu.filter(e=>e.restaurantId===n&&!e.hidden),a=['Sticky toffee pudding','Cullen skink','Fish supper','Steak pie','Haggis bon bons','Cranachan','Lemon tart','Mussels','Scampi','Venison burger','Chips (large)','Oysters','Lobster thermidor','Crab claws','Tablet ice cream','Beef shin','Smoked salmon','Cheeseboard','Halibut','Clootie dumpling'],i=(new Date).toISOString(),s=Array.from({length:e},(e,t)=>r[t]?{id:r[t].id,name:r[t].name}:{id:`pitch-so-${t}`,name:a[t%a.length]});f.setState(e=>({entries:[...e.entries.filter(e=>e.rid!==n||!s.some(t=>t.id===e.itemId)).map(e=>e.rid===n?{...e,on:!1}:e),...s.map(e=>({rid:n,itemId:e.id,name:e.name,on:!0,at:i,by:'Chef'}))]}))})},992,[1080,1072,1081,1055,832,878,2,1112,1151,31]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBackLayers",{enumerable:!0,get:function(){return f}}),_e.runBackLayer=function(){const e=f.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(e,n,o=!0){const s=(0,t.useRef)(n);s.current=n,(0,t.useEffect)(()=>{if(!e)return;const t=++y,n=(0,u.currentScrollY)(),l=(0,u.screenGeneration)();return f.setState(e=>({layers:[...e.layers,{id:t,fn:()=>s.current(),own:o}]})),()=>{f.setState(e=>({layers:e.layers.filter(e=>e.id!==t)})),(0,u.screenGeneration)()===l&&(0,u.restoreScroll)(n)}},[e,o])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"BACK_GUTTER",{enumerable:!0,get:function(){return w}}),_e.BackTitleRow=function({back:e,onBack:n,title:s}){const[l,u]=(0,t.useState)(0),[f,y]=(0,t.useState)({w:96,h:48}),[p,b]=(0,t.useState)(0),S=Array.from(new Set(String(s??'').split(/\s+/).filter(Boolean)));String(s??'').length>=20&&S.length>=3&&S.push('00000000');const v=Math.max(w,Math.ceil(f.w)+4),j=e&&l>0&&l-2*v0&&(0===l||0===p);return(0,h.jsxs)(o.default,{testID:"screen-title-row",onLayout:e=>u(Math.round(e.nativeEvent.layout.width)),style:{minHeight:44,justifyContent:'center',alignItems:'center',paddingHorizontal:e&&!j?v:0,paddingTop:j?f.h:0},children:[e?(0,h.jsx)(o.default,{style:{position:'absolute',left:0,top:0},onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width),n=Math.round(e.nativeEvent.layout.height);y(e=>e.w===t&&e.h===n?e:{w:t,h:n})},children:(0,h.jsx)(g,{onPress:n})}):null,(0,h.jsx)(c.T,{size:22,weight:"bold",center:!0,style:B?{opacity:0}:void 0,accessibilityRole:"header",children:s}),e&&S.length?(0,h.jsx)(o.default,{"aria-hidden":!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{position:'absolute',left:0,top:0,opacity:0,alignItems:'flex-start'},onLayout:e=>b(Math.ceil(e.nativeEvent.layout.width)),children:S.map(e=>(0,h.jsx)(c.T,{size:22,weight:"bold",numberOfLines:1,style:{alignSelf:'flex-start'},children:e},e))}):null]})},_e.BackButton=g,_e.useWebBack=function(e){const n=(0,t.useRef)(e);n.current=e,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.history?.pushState)return;const e=()=>{try{window.history.pushState({...window.history.state??{},ccBack:Date.now()},'',window.location.href)}catch{}};e();const t=t=>{n.current()&&(t.stopImmediatePropagation?.(),e())};return window.addEventListener('popstate',t,!0),()=>window.removeEventListener('popstate',t,!0)},[])};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]);const f=(0,s.create)(()=>({layers:[]}));let y=0;const p=()=>f(e=>e.layers.some(e=>e.own)),w=100;function g({onPress:e,testID:t="screen-back",label:o="Back"}){return(0,h.jsx)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,h.jsxs)(c.T,{size:18,weight:"semibold",colour:l.colours.gold,children:["\u2039 ",o]})})}},993,[31,123,264,128,1072,824,817,991,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.readBack=B,_e.ReviewSheet=L,_e.Bars=z,_e.CashCharts=A,_e.CashUpScreen=function(e){return e.closer?(0,$.jsx)(N,{rid:e.rid,tonight:e.today,who:e.who}):(0,$.jsx)(E,{...e})},_e.CloserCashUp=N,_e.PastDayCard=O,_e.TodaysTipsCard=function({rid:e,today:t,big:s}){const a=(0,f.useTipsShow)(e),o=(0,f.useCashUp)(e=>e.tips).filter(s=>s.rid===e&&(s.date===t||s.date===(0,x.addDaysYmd)(t,-1))).sort((e,t)=>t.date.localeCompare(e.date))[0],l=G(o?.total??0);return a.showToday&&o?(0,$.jsx)(p.Card,{highlight:y.colours.gold,children:(0,$.jsxs)(c.default,{testID:"todays-tips",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,$.jsx)(Y,{n:Math.ceil(o.total/25)}),(0,$.jsxs)(c.default,{style:{flex:1,gap:2},children:[(0,$.jsx)(p.T,{size:12,weight:"semibold",colour:y.colours.gold,style:{letterSpacing:1.5},children:o.date===t?'TODAY\u2019S TIPS':'LAST NIGHT\u2019S TIPS'}),(0,$.jsx)(p.T,{size:s?40:32,weight:"bold",colour:y.colours.goldLight,children:P(l)}),(0,$.jsxs)(p.Muted,{children:["Cash + card tips for the whole team \xb7 ",M(o.date),". Thank you, everyone."]})]})]})}):null},_e.TipsPotCard=V,_e.postTipsNotice=K,_e.latestDayTips=Z,_e.useTipsPosted=function(e,t,s=!0){const a=(0,f.useCashUp)(e=>e.tips),o=(0,f.useTipsShow)(e);(0,l.useEffect)(()=>{if(!s||!o.showToday)return;const l=Z(a,e,t);l&&K(e,l.date,l.total,t)},[e,t,a,o.showToday,s])},_e.CashUpSettings=function({rid:e}){const t=U(e),s=(t,s)=>f.useCashUp.getState().setFields(e,t,s),l=(e,l)=>(0,$.jsxs)(c.default,{style:{gap:6},children:[(0,$.jsx)(p.T,{weight:"semibold",children:l}),t[e].map((l,n)=>(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(o.TextInput,{testID:`cf-${e}-${l.key}`,value:l.label,onChangeText:a=>s(e,t[e].map((e,t)=>t===n?{...e,label:a.slice(0,40)}:e)),style:{flex:1,minHeight:38,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',color:y.colours.text,paddingHorizontal:8}}),(0,$.jsx)(p.Muted,{children:'money'===l.kind?'\xa3':'number'===l.kind?'#':'text'}),l.fixed?(0,$.jsx)(p.Muted,{children:"needed"}):(0,$.jsx)(a.GoldClose,{size:"sm",label:`Remove ${l.label}`,onPress:()=>s(e,t[e].filter((e,t)=>t!==n))})]},l.key)),(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"secondary",label:"Money figure",onPress:()=>s(e,[...t[e],{key:`f${Date.now().toString(36)}`,label:'New figure',kind:'money'}])}),(0,$.jsx)(p.Button,{small:!0,kind:"secondary",label:"Number",onPress:()=>s(e,[...t[e],{key:`n${Date.now().toString(36)}`,label:'New number',kind:'number'}])})]})]});return(0,$.jsxs)(c.default,{testID:"cashup-settings",style:{gap:12},children:[(0,$.jsx)(p.Muted,{children:"Tip: match these to the boxes on your paper cash up sheet and till printout. Cash tips total and Card tips total are needed for Today\u2019s tips and the Tips pot."}),l('cashFields','Cash up sheet'),l('salesFields','Weekly sales report')]})},_e.TipsSettings=function({rid:e}){const t=(0,f.useTipsShow)(e);return(0,$.jsxs)(c.default,{testID:"tips-settings",style:{gap:8},children:[(0,$.jsx)(p.Muted,{children:"Staff only ever see the team total: never anyone\u2019s share or pay. The Display never shows tips or money."}),(0,$.jsx)(p.Toggle,{testID:"tips-show-today",label:"Show Today\u2019s tips in the staff apps",value:t.showToday,onChange:t=>f.useCashUp.getState().setShow(e,{showToday:t})}),(0,$.jsx)(p.Toggle,{testID:"tips-show-pot",label:"Show the Tips pot in the staff apps",value:t.showPot,onChange:t=>f.useCashUp.getState().setShow(e,{showPot:t})})]})};var t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),n=e(_r(_d[5])),r=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),h=e(_r(_d[9])),c=e(_r(_d[10])),u=e(_r(_d[11])),p=_r(_d[12]),y=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),k=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]),T=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),I=_r(_d[26]),$=_r(_d[27]);const P=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,M=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function B(e){const t=t=>'number'==typeof e[t]?e[t]:null,s=(0,x.combinedTips)(e);return[['Gross',t('gross')],['card',t('card')],['cash',t('cash')],['tips',s],['food',t('food')],['drink',t('drink')]].filter(([,e])=>null!=e).map(([e,t])=>`${e} ${P(t)}`).join(', ')}function R({p:e,h:s}){const[a,o]=(0,l.useState)(e.startsWith('data:')?e:null),n=e.startsWith('data:')||(0,w.photosAllowed)();return(0,l.useEffect)(()=>{!a&&n&&(0,w.photoUrl)(e).then(o)},[e,n]),n?a?(0,$.jsx)(d.default,{source:{uri:a},style:{width:'100%',height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#111')},resizeMode:"contain"}):(0,$.jsx)(c.default,{style:{height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(p.Muted,{children:"Photo"})}):(0,$.jsx)(c.default,{testID:"photo-owners-only",accessible:!0,accessibilityLabel:"Taking-sheet photo. Only owners can view saved photos.",style:{height:Math.min(s,90),borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center',padding:10},children:(0,$.jsx)(p.Muted,{center:!0,children:"Photo saved. Only owners can view it."})})}function L({draft:e,fields:t,onClose:s,onConfirm:n,keyLabel:r,onKey:i,keyChoices:d}){const{width:h,height:f}=(0,u.default)(),m=h>=820;e.only&&(t=t.filter(t=>e.only.includes(t.key)));const[k,b]=(0,l.useState)(()=>Object.fromEntries(t.map(t=>[t.key,(0,x.isBlank)(e.vals[t.key])?'':String(e.vals[t.key])]))),[j,w]=(0,l.useState)(()=>e.categories.map(e=>({name:e.name,amount:String(e.amount)}))),[C,T]=(0,l.useState)(!1),v=Object.fromEntries(t.map(e=>[e.key,'text'===e.kind?k[e.key]?.trim()||null:(0,x.parseAmount)(k[e.key]??'',e.kind)])),S=t.filter(e=>'text'!==e.kind&&(k[e.key]??'').trim()&&null==v[e.key]).map(e=>e.key),D=(0,x.missing)(t,v),I=j.map(e=>({name:e.name.trim(),amount:(0,x.parseAmount)(e.amount)})).filter(e=>e.name),P=I.some(e=>null==e.amount),M=e=>({minHeight:42,borderRadius:10,borderWidth:e?2:1,borderColor:e?y.colours.amber:'rgba(255,255,255,0.15)',backgroundColor:e?'rgba(232,168,56,0.08)':'#141312',color:y.colours.text,paddingHorizontal:10,fontSize:17}),B=(0,$.jsx)(c.default,{testID:"review-photos",style:{gap:8,flex:m?1:void 0},children:e.photos.length?e.photos.map((t,s)=>(0,$.jsx)(R,{p:t,h:m?Math.max(300,.62*f/Math.min(2,e.photos.length)):260},s)):(0,$.jsx)(p.Muted,{children:"No photo: typed by hand."})}),L=(0,$.jsxs)(c.default,{testID:"review-fields",style:{gap:8,flex:m?1:void 0},children:[(0,$.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(p.Muted,{children:r}),d.map(t=>(0,$.jsx)(p.Chip,{label:t.label,selected:e.key===t.value,onPress:()=>i(t.value)},t.value))]}),t.map(e=>{const t='text'!==e.kind&&!(k[e.key]??'').trim()||S.includes(e.key);return(0,$.jsxs)(c.default,{style:{gap:3},children:[(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.T,{weight:"semibold",size:14,children:e.label}),t&&'text'!==e.kind?(0,$.jsx)(p.Badge,{kind:"amber",label:S.includes(e.key)?'Check this':'Not read: type it'}):null]}),(0,$.jsx)(o.TextInput,{testID:`review-${e.key}`,value:k[e.key]??'',onChangeText:t=>b(s=>({...s,[e.key]:t})),keyboardType:'text'===e.kind?'default':'decimal-pad',placeholder:'money'===e.kind?'\xa3':'number'===e.kind?'Number':'Optional',placeholderTextColor:"#777",style:M(t)})]},e.key)}),'sales'===e.kind?(0,$.jsxs)(c.default,{testID:"review-categories",style:{gap:6},children:[(0,$.jsx)(p.T,{weight:"semibold",size:14,children:"Sales by category (if the printout has them)"}),j.map((e,t)=>(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(o.TextInput,{value:e.name,onChangeText:e=>w(s=>s.map((s,a)=>a===t?{...s,name:e}:s)),placeholder:"e.g. Food",placeholderTextColor:"#777",style:[M(!1),{flex:2}]}),(0,$.jsx)(o.TextInput,{value:e.amount,onChangeText:e=>w(s=>s.map((s,a)=>a===t?{...s,amount:e}:s)),placeholder:"\xa3",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:[M(!e.amount.trim()||null==(0,x.parseAmount)(e.amount)),{flex:1}]}),(0,$.jsx)(a.GoldClose,{size:"sm",label:"Remove category",onPress:()=>w(e=>e.filter((e,s)=>s!==t))})]},t)),(0,$.jsx)(p.Button,{small:!0,kind:"secondary",testID:"review-add-cat",label:"Add a category",onPress:()=>w(e=>[...e,{name:'',amount:''}])})]}):null]});return(0,$.jsxs)(p.Sheet,{visible:!0,onClose:s,title:'cashup'===e.kind?'Check the cash up':'Check the weekly sales',maxWidth:1100,testID:"review-sheet",children:[(0,$.jsx)(p.Muted,{children:"Tip: check each figure against the photo. Nothing is saved until you tap Confirm. Amber boxes weren\u2019t read: type them, or leave them blank if the sheet doesn\u2019t have them."}),'edit'===e.reader||e.only?null:e.reader?(0,$.jsx)(p.Banner,{kind:"info",title:"Read from the photo",children:e.note}):e.photos.length?(0,$.jsx)(p.Banner,{kind:"info",title:"Type it from the photo",children:e.note}):null,m?(0,$.jsxs)(c.default,{style:{flexDirection:'row',gap:14},children:[B,L]}):(0,$.jsxs)($.Fragment,{children:[B,L]}),D.length?(0,$.jsxs)(p.Muted,{children:[D.length," figure",1===D.length?'':'s'," still blank. Blank means \u201cnot on the sheet\u201d, never zero."]}):null,(0,$.jsxs)(p.Row,{gap:8,children:[(0,$.jsx)(p.Button,{testID:"review-confirm",label:C?'Saving\u2026':'Confirm and save',disabled:C||!!S.length||P||!t.some(e=>'text'!==e.kind&&null!=v[e.key]),onPress:async()=>{T(!0),await n(v,I.map(e=>({name:e.name,amount:e.amount}))),T(!1)}}),(0,$.jsx)(p.Button,{kind:"secondary",label:"Cancel",onPress:s})]})]})}function z({data:e,height:t=140,testID:s,fmt:a=P}){const o=Math.max(1,...e.map(e=>e.value??0));return(0,$.jsxs)(c.default,{testID:s,style:{gap:4},children:[(0,$.jsx)(c.default,{style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:t},children:e.map((e,s)=>(0,$.jsxs)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'flex-end',height:t},children:[null!=e.value?(0,$.jsx)(p.T,{size:9,colour:y.colours.muted,children:a(e.value).replace('.00','')}):null,(0,$.jsx)(c.default,{style:{width:'80%',height:null==e.value?2:Math.max(3,e.value/o*(t-16)),borderRadius:4,backgroundColor:null==e.value?'#333':e.hi?y.colours.goldLight:y.colours.gold,opacity:null==e.value?.6:1}})]},s))}),(0,$.jsx)(c.default,{style:{flexDirection:'row',gap:4},children:e.map((e,t)=>(0,$.jsx)(p.T,{size:9,colour:y.colours.muted,style:{flex:1,textAlign:'center'},children:e.label},t))})]})}function A({rid:e,today:s}){const a=(0,f.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e),o=(0,f.useCashUp)(e=>e.sales).filter(t=>t.rid===e),l=(0,x.dailySeries)(a,s,14),n=(0,x.dailySeries)(a,s,14,x.combinedTips),r=(0,x.weekStartOf)(s),i=Array.from({length:8},(e,t)=>(0,x.addDaysYmd)(r,7*(t-7))).map(e=>{const t=o.find(t=>t.weekStart===e&&t.confirmedAt),s=t?.vals.net;return{label:M(e).split(' ').slice(1).join(' '),value:'number'==typeof s?s:null,hi:e===r}}),d=[...o].filter(e=>e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0],h=d?(0,x.weekCompare)(o,d.weekStart):null,u=d?.categories??[],m=Math.max(1,...u.map(e=>e.amount)),k=d?(0,x.weekCompare)(o,d.weekStart,'covers'):null;return(0,$.jsxs)(c.default,{testID:"cash-charts",style:{gap:12},children:[(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Takings, last 14 days"}),(0,$.jsx)(p.Muted,{children:"Card + cash from confirmed cash ups. A grey line means no cash up that day."}),(0,$.jsx)(z,{testID:"chart-daily",data:l.map(e=>({label:M(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Tips, last 14 days"}),(0,$.jsx)(p.Muted,{children:"Cash + card tips, team total."}),(0,$.jsx)(z,{testID:"chart-tips",height:100,data:n.map(e=>({label:M(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Weekly net sales"}),h&&null!=h.now?(0,$.jsx)(c.default,{testID:"week-compare",children:(0,$.jsxs)(p.T,{size:15,children:["Week of ",M(d.weekStart),": ",P(h.now),null!=h.prev?` \xb7 week before ${P(h.prev)}`:'',null!=h.change?` \xb7 ${h.change>=0?'\u25b2':'\u25bc'} ${Math.abs(h.change)}%`:'']})}):(0,$.jsx)(p.Muted,{children:"No weekly sales report yet."}),k&&null!=k.now?(0,$.jsxs)(p.Muted,{children:["Covers ",k.now,null!=k.prev?` (week before ${k.prev})`:'']}):null,(0,$.jsx)(z,{testID:"chart-weekly",data:i})]}),u.length?(0,$.jsxs)(p.Card,{children:[(0,$.jsxs)(p.T,{weight:"semibold",children:["By category, week of ",M(d.weekStart)]}),(0,$.jsx)(c.default,{testID:"chart-categories",style:{gap:6},children:u.map(e=>(0,$.jsxs)(c.default,{style:{gap:2},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(p.T,{size:14,children:e.name}),(0,$.jsx)(p.T,{size:14,colour:y.colours.goldLight,children:P(e.amount)})]}),(0,$.jsx)(c.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2826')},children:(0,$.jsx)(c.default,{style:{width:e.amount/m*100+"%",height:10,borderRadius:5,backgroundColor:y.colours.gold}})})]},e.name))})]}):null]})}function U(e){const t=(0,f.useCashSettings)(e),s=(0,m.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings.cashUpRecord);return(0,l.useMemo)(()=>({...t,record:s,cashFields:(0,x.cashFieldsForRecord)(t.cashFields,s)}),[t,s])}const F=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}):'',W=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`;function N({rid:e,tonight:t,who:s}){const a=U(e),o=(0,f.useCashUp)(e=>e.cashUps).find(s=>s.rid===e&&s.date===t),[r,i]=(0,l.useState)(null),[d,u]=(0,l.useState)(null),[m,k]=(0,l.useState)(!1),b=!!o?.confirmedAt,j=async e=>{if(b)return;const s=e?await(0,w.pickPhotos)({source:e}):[];if(e&&!s.length)return void u('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');let o,l={vals:{},reader:null,note:'Type the figures from the sheet.'};s.length&&(k(!0),u('Reading the photo\u2026'),o=await Promise.all(s.map((e,s)=>(0,w.uploadPhoto)('cashup',t,e,s))),l=await(0,C.readSheet)('cashup',o.filter(e=>!!e),a.cashFields),k(!1),u(null)),i({kind:'cashup',key:t,photos:s,vals:l.vals,categories:[],unread:(0,x.missing)(a.cashFields,l.vals),note:l.note,reader:l.reader,uploaded:o})},T=async a=>{if(!r||b)return void i(null);const o=r.uploaded&&r.uploaded.length===r.photos.length?r.uploaded:await Promise.all(r.photos.map((e,s)=>(0,w.uploadPhoto)('cashup',t,e,s))),l=r.photos.map((e,t)=>o[t]??e);f.useCashUp.getState().saveCashUp({rid:e,date:t,vals:a,photos:l,confirmedBy:s.name,confirmedAt:(new Date).toISOString(),readBy:r.reader});const d=B(a);u(`Tonight\u2019s cash up is saved and signed off${d?`: ${d}`:''}.${o.some(e=>null==e)&&r.photos.length?' The photo will be sent when this phone is back online.':''}`);try{n.default.announceForAccessibility?.(`Saved and signed off. ${d}`)}catch{}i(null)};return(0,$.jsxs)(c.default,{testID:"cashup-screen",style:{gap:12,alignItems:'center',width:'100%'},children:[d?(0,$.jsx)(p.Banner,{kind:"info",children:d}):null,(0,$.jsx)(p.Card,{highlight:y.colours.gold,children:(0,$.jsxs)(c.default,{testID:"closer-cashup",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:20,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Tonight\u2019s cash up"}),(0,$.jsxs)(p.T,{center:!0,size:15,colour:y.colours.muted,testID:"closer-day",children:[M(t)," \xb7 ",W(t)]}),b?(0,$.jsxs)(c.default,{testID:"closer-done",accessible:!0,accessibilityLabel:`Tonight's cash up is done. Submitted by ${o?.confirmedBy??'someone'} at ${F(o?.confirmedAt)}. ${B(o.vals)}. It is signed off. If something is wrong, ask an owner to unlock it.`,style:{alignItems:'center',gap:6,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:18,weight:"semibold",colour:y.colours.goldLight,children:"Done and signed off"}),(0,$.jsxs)(p.T,{center:!0,size:15,children:["Submitted by ",o?.confirmedBy??'\u2014'," at ",F(o?.confirmedAt)]}),(0,$.jsx)(p.T,{center:!0,size:15,children:B(o.vals)||'No figures'}),o.photos.length?(0,$.jsxs)(p.Muted,{center:!0,size:13,children:[o.photos.length," photo",o.photos.length>1?'s':''," of the taking sheet sent to the owners."]}):null,(0,$.jsx)(p.Muted,{center:!0,size:13,children:"If something is wrong, ask an owner to unlock it."})]}):(0,$.jsxs)($.Fragment,{children:[a.record?.length?(0,$.jsxs)(c.default,{testID:"cashup-record",accessibilityLabel:`What to record at nightly cash up. ${a.record.join(', ')}`,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"What to record"}),a.record.map(e=>(0,$.jsx)(p.T,{center:!0,children:e},e))]}):null,(0,$.jsx)(h.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:m,onPress:()=>{j('camera')},style:({pressed:e})=>({minHeight:64,width:'100%',borderRadius:16,backgroundColor:e?y.colours.goldLight:y.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:m?.5:1}),children:(0,$.jsx)(p.T,{center:!0,size:20,weight:"semibold",colour:y.colours.onGold,children:m?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,$.jsx)(p.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{j('gallery')}}),(0,$.jsx)(p.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{j(null)}})]}),(0,$.jsx)(p.Muted,{center:!0,size:13,children:"Check the figures, then Confirm. Once confirmed it\u2019s signed off, and the photo goes to the owners only."})]})]})}),(0,$.jsx)(p.Muted,{center:!0,size:12,testID:"closer-note",children:"You can do tonight\u2019s cash up only. Past takings, charts and sales reports are for owners and managers."}),r?(0,$.jsx)(L,{draft:r,fields:a.cashFields,onClose:()=>i(null),onConfirm:e=>T(e),keyLabel:"Day",keyChoices:[{label:'Tonight',value:t}],onKey:()=>{}},`closer-${r.photos.length}`):null]})}function E({rid:e,today:t,canEdit:s,who:a,chartsOnly:o,backdate:r}){const i=U(e),d=(0,f.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e).sort((e,t)=>t.date.localeCompare(e.date)),u=(0,f.useCashUp)(e=>e.sales).filter(t=>t.rid===e).sort((e,t)=>t.weekStart.localeCompare(e.weekStart)),[m,k]=(0,l.useState)(null),[b,j]=(0,l.useState)(null),D=(0,v.useLockedFor)(e),[I,R]=(0,l.useState)(!1),[z,F]=(0,l.useState)(null),W=async(e,s,a,o)=>{const l=a??('cashup'===e?t:(0,x.weekStartOf)((0,x.addDaysYmd)(t,-7)));if(D(e,l))return void j((0,v.lockedMessage)(e,l));const n=s?await(0,w.pickPhotos)({source:s}):[];if(s&&!n.length)return void j('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');const r='cashup'===e?i.cashFields:i.salesFields;let h,c={vals:{},reader:null,note:'Type the figures from the sheet.',categories:[]};n.length&&(R(!0),j('Reading the photo\u2026'),h=await Promise.all(n.map((t,s)=>(0,w.uploadPhoto)(e,l,t,s))),c=await(0,C.readSheet)(e,h.filter(e=>!!e),r),R(!1),j(null));const u=o&&'cashup'===e?d.find(e=>e.date===l)?.vals:void 0;k({kind:e,key:l,photos:n,vals:u?{...c.vals,...u}:c.vals,categories:c.categories??[],unread:(0,x.missing)(r,c.vals),note:c.note,reader:o?'edit':c.reader,uploaded:h,only:o})},N=[0,1,2].map(e=>({label:0===e?'Today':1===e?'Yesterday':M((0,x.addDaysYmd)(t,-e)),value:(0,x.addDaysYmd)(t,-e)}));'cashup'!==m?.kind||N.some(e=>e.value===m.key)||N.push({label:M(m.key),value:m.key});const E=[0,1,2].map(e=>{const s=(0,x.weekStartOf)((0,x.addDaysYmd)(t,-7*e));return{label:0===e?'This week':1===e?'Last week':`w/c ${M(s)}`,value:s}});return(0,$.jsxs)(c.default,{testID:"cashup-screen",style:{gap:12},children:[(0,$.jsx)(p.Muted,{children:"Tip: at the end of the night, tap Take a picture of the taking sheet: the figures are filled in from the photo for you to check beside it, then Confirm. Bigger venues can Upload a spreadsheet (CSV or Excel) for one night or several. Gross takings feed Spend per head. Head Chefs can see the graphs."}),b?(0,$.jsx)(p.Banner,{kind:"info",children:b}):null,(0,$.jsx)(V,{rid:e,today:t,manage:s,who:a}),s&&!o?(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"End of night cash up"}),i.record?.length?(0,$.jsxs)(c.default,{testID:"cashup-record",accessibilityLabel:`What to record at nightly cash up. ${i.record.join(', ')}`,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"What to record at nightly cash up"}),i.record.map(e=>(0,$.jsx)(p.T,{center:!0,children:e},e))]}):null,(0,$.jsx)(h.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:I,onPress:()=>{W('cashup','camera')},style:({pressed:e})=>({minHeight:64,borderRadius:16,backgroundColor:e?y.colours.goldLight:y.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:I?.5:1}),children:(0,$.jsx)(p.T,{size:20,weight:"semibold",colour:y.colours.onGold,children:I?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(p.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{W('cashup','gallery')}}),(0,$.jsx)(p.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{W('cashup',null)}}),(0,$.jsx)(p.Button,{testID:"cashup-sheet",kind:"secondary",label:"Upload a spreadsheet",accessibilityLabel:"Upload a spreadsheet of takings, CSV or Excel, for one night or several",onPress:async()=>{const e=await(0,T.pickSpreadsheet)();e&&('error'in e?j(e.error):F(e))}}),(0,$.jsx)(p.Button,{testID:"cashup-takings",kind:"secondary",label:"Enter takings",accessibilityLabel:"Enter tonight's takings: gross, and food and drink if you have them",onPress:()=>{W('cashup',null,t,x.TAKINGS_KEYS)}})]}),(0,$.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"Weekly sales report"}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(p.Button,{testID:"upload-sales",label:"Upload weekly sales report",onPress:()=>{W('sales','camera')}}),(0,$.jsx)(p.Button,{testID:"sales-gallery",kind:"secondary",label:"Choose from gallery",onPress:()=>{W('sales','gallery')}}),(0,$.jsx)(p.Button,{testID:"sales-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{W('sales',null)}})]}),(0,$.jsx)(p.Muted,{children:"Several pages? Pick them all at once. Fields can be changed in Settings \u203a Advanced \u203a Cash up."})]}):null,s&&r&&!o?(0,$.jsx)(O,{today:t,has:e=>d.some(t=>t.date===e),paid:t=>(0,S.paidOutFor)(t,f.useCashUp.getState().pot,e),onOpen:e=>{if(D('cashup',e))return void j((0,v.lockedMessage)('cashup',e));const t=d.find(t=>t.date===e);k({kind:'cashup',key:e,photos:t?.photos??[],vals:t?.vals??{},categories:[],unread:[],note:t?'':'Type the figures for that day.',reader:'edit'})}}):null,(0,$.jsx)(A,{rid:e,today:t}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Recent cash ups"}),d.length?d.slice(0,10).map(e=>(0,$.jsxs)(c.default,{testID:`cashup-row-${e.date}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)',gap:2},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(p.T,{weight:"semibold",children:M(e.date)}),(0,$.jsx)(p.T,{colour:y.colours.goldLight,children:P((0,x.takings)(e.vals))})]}),(0,$.jsx)(p.Muted,{children:i.cashFields.filter(e=>'text'!==e.kind&&'card'!==e.key&&'cash'!==e.key).map(t=>`${t.label} ${(0,x.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?P(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),(0,$.jsxs)(p.Muted,{children:["Confirmed by ",e.confirmedBy??'\u2014',e.photos.length?` \xb7 ${e.photos.length} photo${e.photos.length>1?'s':''}`:'']}),(0,S.historyLines)(e.vals).slice(0,3).map(t=>(0,$.jsx)(p.Muted,{size:12,testID:`cashup-later-${e.date}`,children:t},t)),s&&!D('cashup',e.date)?(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit",onPress:()=>k({kind:'cashup',key:e.date,photos:e.photos,vals:e.vals,categories:[],unread:[],note:'',reader:'edit'})}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:`takings-edit-${e.date}`,label:null==(0,x.grossOf)(e.vals)?'Add takings':'Edit takings',onPress:()=>k({kind:'cashup',key:e.date,photos:[],vals:e.vals,categories:[],unread:[],note:'',reader:'edit',only:x.TAKINGS_KEYS})})]}):null,s?(0,$.jsx)(v.CashLockControls,{kind:"cashup",item:e,label:M(e.date)}):null]},e.id)):(0,$.jsx)(p.Muted,{children:"None yet."})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Weekly sales reports"}),u.length?u.slice(0,8).map(e=>(0,$.jsxs)(c.default,{style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(p.T,{weight:"semibold",children:["w/c ",M(e.weekStart)]}),(0,$.jsx)(p.T,{colour:y.colours.goldLight,children:P('number'==typeof e.vals.net?e.vals.net:null)})]}),(0,$.jsx)(p.Muted,{children:i.salesFields.filter(e=>'net'!==e.key).map(t=>`${t.label} ${(0,x.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?P(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),s?(0,$.jsx)(v.CashLockControls,{kind:"sales",item:e,label:`w/c ${M(e.weekStart)}`}):null]},e.id)):(0,$.jsx)(p.Muted,{children:"None yet."})]}),z?(0,$.jsx)(T.SpreadsheetImport,{rid:e,file:z,who:a,locked:e=>D('cashup',e),onClose:()=>F(null),onSaved:e=>{j(e),F(null)}}):null,m?(0,$.jsx)(L,{draft:m,fields:'cashup'===m.kind?i.cashFields:i.salesFields,onClose:()=>k(null),onConfirm:async(s,o)=>{if(!m)return;if(D(m.kind,m.key))return j((0,v.lockedMessage)(m.kind,m.key)),void k(null);const l=m.uploaded&&m.uploaded.length===m.photos.length?m.uploaded:await Promise.all(m.photos.map((e,t)=>(0,w.uploadPhoto)(m.kind,m.key,e,t))),r=m.photos.map((e,t)=>l[t]??e),i=(new Date).toISOString();if('cashup'===m.kind){const o=d.find(e=>e.date===m.key),l=m.only&&o?{...o.vals,...s}:s,h=m.keynull==e)&&m.photos.length&&j(e=>`${e??''} The photo is kept on this device only (not signed in or offline).`),k(null)},keyLabel:'cashup'===m.kind?'Day':'Week starting',keyChoices:'cashup'===m.kind?N:E,onKey:e=>k({...m,key:e})},`${m.kind}-${m.photos.length}`):null]})}function O({today:e,has:t,paid:a,onOpen:o}){const[n,r]=(0,l.useState)((0,x.addDaysYmd)(e,-1)),[i,d]=(0,l.useState)((0,I.ukHistoryDate)((0,x.addDaysYmd)(e,-1))),[h,u]=(0,l.useState)(!1),f=(0,I.parseHistoryInput)(i)??'',m=(0,S.backdateProblem)(f,e),k=m?n:f,b=!m&&t(k),j=m?null:a(k),w=e=>{r(e),d((0,I.ukHistoryDate)(e))};return(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsxs)(c.default,{testID:"cashup-backdate",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:20,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Cash up for another day"}),(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.text,children:"Missed a night? Enter or correct takings and tips for any past day. It counts on that day everywhere."}),(0,$.jsx)(c.default,{style:{width:'100%',maxWidth:360},children:(0,$.jsx)(p.Field,{label:"Day (DD/MM/YYYY)",value:i,onChangeText:e=>d((0,s.slashDate)(e,i)),placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"cashup-backdate-date",style:{textAlign:'center'},accessibilityLabel:"Day of the cash up, as day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1})}),m?(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.amber,testID:"cashup-backdate-problem",children:m}):(0,$.jsx)(c.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cashup-backdate-status",children:(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.goldLight,children:b?`There is already a cash up for ${M(k)}: it opens for editing.`:`No cash up yet for ${M(k)}.`})}),j?(0,$.jsx)(c.default,{testID:"cashup-backdate-paid",style:{borderWidth:1,borderColor:y.colours.amber,borderRadius:10,padding:10,maxWidth:520},children:(0,$.jsxs)(p.T,{center:!0,size:14,colour:y.colours.amber,children:["Tips up to ",M(j.throughDate)," were already paid out. Tips you add for this day won\u2019t be in the pot automatically: add a correction in the Tips pot if they should still be shared."]})}):null,(0,$.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center'},children:[(0,$.jsx)(p.Button,{kind:"secondary",label:"Pick a date",testID:"cashup-backdate-pick",accessibilityLabel:`Pick a day from a calendar. Now ${m?'no valid day':M(k)}`,onPress:()=>u(!0),style:{minHeight:56}}),(0,$.jsx)(p.Button,{label:m?'Open cash up':b?`Edit cash up for ${M(k)}`:`Add cash up for ${M(k)}`,testID:"cashup-backdate-open",disabled:!!m,accessibilityLabel:m?'Open cash up, enter a valid past day first':`${b?'Edit':'Add'} the cash up for ${M(k)}`,onPress:()=>{w(k),o(k)},style:{minHeight:56}})]}),(0,$.jsxs)(p.Muted,{center:!0,children:["Saved with your name and the time, e.g. \u201cAdded later by you, ",M(e),"\u201d. Nothing is sent to anyone."]})]}),(0,$.jsx)(D.LookBackCalendar,{visible:h,today:e,selected:m?n:k,purpose:"Cash up for another day",idPrefix:"cashup-backdate",onClose:()=>u(!1),onPick:e=>{w(e),u(!1)}})]})}function Y({n:e,testID:t}){const s=Math.max(1,Math.min(14,e));return(0,$.jsx)(c.default,{testID:t,style:{width:64,height:114,justifyContent:'flex-end'},children:Array.from({length:s}).map((e,t)=>(0,$.jsx)(H,{delay:50*t},t))})}function H({delay:e}){const t=(0,l.useRef)(new r.default.Value(1)).current;return(0,l.useEffect)(()=>{r.default.timing(t,{toValue:0,duration:420,delay:e,easing:i.default.out(i.default.back(1.6)),useNativeDriver:!1}).start()},[]),(0,$.jsx)(r.default.View,{style:{height:7,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[0,-120]})}],opacity:t.interpolate({inputRange:[0,1],outputRange:[1,0]})},children:(0,$.jsx)(c.default,{style:{width:60,height:12,borderRadius:30,backgroundColor:y.colours.gold,borderWidth:1,borderColor:y.colours.goldLight}})})}function G(e){const[t,s]=(0,l.useState)(e),a=(0,l.useRef)(e);return(0,l.useEffect)(()=>{const t=a.current,o=e;if(t===o)return;const l=Date.now(),n=setInterval(()=>{const e=Math.min(1,(Date.now()-l)/1200);s(Math.round(100*(t+(o-t)*(1-Math.pow(1-e,3))))/100),e>=1&&(clearInterval(n),a.current=o)},40);return()=>clearInterval(n)},[e]),t}function V({rid:e,today:t,manage:s,who:a,big:o}){const n=(0,f.useTipsShow)(e),r=(0,f.useCashUp)(e=>e.tips).filter(t=>t.rid===e),i=(0,f.useCashUp)(e=>e.pot).filter(t=>t.rid===e),d=(0,b.useVenuePay)(e).pay,h=(0,k.tipsPeriod)(d,t),u=(0,l.useMemo)(()=>(0,x.tipsPot)(r,i,h.start,t),[r,i,h.start,t]),m=G(u.total),[j,w]=(0,l.useState)(null);return n.showPot||s?(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsxs)(c.default,{testID:"tips-pot",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,$.jsx)(Y,{n:Math.ceil(u.total/100),testID:"tips-pot-coins"},u.total),(0,$.jsxs)(c.default,{style:{flex:1,gap:2},children:[(0,$.jsx)(p.T,{size:12,weight:"semibold",colour:y.colours.gold,style:{letterSpacing:1.5},children:"TIPS POT"}),(0,$.jsx)(p.T,{size:o?40:32,weight:"bold",colour:y.colours.goldLight,children:P(m)}),(0,$.jsxs)(p.Muted,{children:["Tips held for the team since ",M(u.from),h.payday?` \xb7 next tip payday ${M(h.payday)}`:'',". Confirmed cash ups only.",n.showPot?'':' (Hidden from staff.)']})]})]}),s?(0,$.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"secondary",testID:"pot-payout",label:"Mark payout done",onPress:()=>w('payout')}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:"pot-correct",label:"Correct an entry",onPress:()=>w('correct')}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:"pot-history",label:"Past pots",onPress:()=>w('history')})]}):null,'payout'===j?(0,$.jsxs)(p.Sheet,{visible:!0,onClose:()=>w(null),title:"Mark payout done",maxWidth:520,testID:"pot-payout-sheet",children:[(0,$.jsxs)(p.T,{children:["Pay out ",P(u.total)," (tips from ",M(u.from)," to ",M(t),")?"]}),(0,$.jsx)(p.Muted,{children:"The pot goes back to \xa30.00 for the next period. This is logged and kept in Past pots. No money is moved by the app."}),(0,$.jsx)(p.Button,{testID:"pot-payout-confirm",label:"Yes, payout done",onPress:()=>{f.useCashUp.getState().addPotEvent({rid:e,kind:'payout',throughDate:t,amount:u.total,by:a?.name??'Manager'}),w(null)}})]}):null,'correct'===j?(0,$.jsx)(_,{rid:e,today:t,who:a,onClose:()=>w(null)}):null,'history'===j?(0,$.jsxs)(p.Sheet,{visible:!0,onClose:()=>w(null),title:"Past pots and corrections",maxWidth:560,testID:"pot-history-sheet",children:[u.history.length||i.some(e=>'correction'===e.kind)?null:(0,$.jsx)(p.Muted,{children:"No payouts or corrections yet."}),i.slice().sort((e,t)=>t.at.localeCompare(e.at)).map(e=>(0,$.jsxs)(c.default,{style:{paddingVertical:4},children:[(0,$.jsx)(p.T,{weight:"semibold",children:'payout'===e.kind?`Paid out ${P(e.amount)}`:`Correction ${e.amount>=0?'+':'\u2212'}${P(Math.abs(e.amount))} for ${M(e.forDate)}`}),(0,$.jsxs)(p.Muted,{children:['payout'===e.kind?`Tips to ${M(e.throughDate)}`:`\u201c${e.reason}\u201d`," \xb7 ",e.by," \xb7 ",new Date(e.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]})]},e.id))]}):null]}):null}function _({rid:e,today:s,who:a,onClose:n}){const[r,i]=(0,l.useState)(s),[d,h]=(0,l.useState)(''),[c,u]=(0,l.useState)(''),m=(0,x.parseAmount)(d),k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',backgroundColor:(0,t.soutersSurface)('#141312'),color:y.colours.text,paddingHorizontal:10,fontSize:16};return(0,$.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Correct an entry",maxWidth:520,testID:"pot-correct-sheet",children:[(0,$.jsx)(p.Muted,{children:"Tip: add or take off an amount for a day (use a minus for less, e.g. -5). Every correction is logged with your name and the reason."}),(0,$.jsx)(p.Row,{wrap:!0,gap:6,children:[0,1,2,3].map(e=>{const t=(0,x.addDaysYmd)(s,-e);return(0,$.jsx)(p.Chip,{label:0===e?'Today':M(t),selected:r===t,onPress:()=>i(t)},t)})}),(0,$.jsx)(o.TextInput,{testID:"pot-correct-amount",value:d,onChangeText:h,placeholder:"\xa3 e.g. -5.00",placeholderTextColor:"#777",keyboardType:"numbers-and-punctuation",style:k}),(0,$.jsx)(o.TextInput,{testID:"pot-correct-reason",value:c,onChangeText:u,placeholder:"Reason (required)",placeholderTextColor:"#777",maxLength:200,style:k}),(0,$.jsx)(p.Button,{testID:"pot-correct-save",label:"Save correction",disabled:null==m||0===m||!c.trim(),onPress:()=>{f.useCashUp.getState().addPotEvent({rid:e,kind:'correction',forDate:r,amount:m,reason:c.trim(),by:a?.name??'Manager'}),n()}})]})}function K(e,t,s,a){if(!Number.isFinite(s))return;const o=`${e}:${t}`;f.useCashUp.getState().seen[o]!==s&&(f.useCashUp.getState().markSeen(o,s),(0,j.notify)({id:`tips-${o}`,icon:'\ud83e\ude99',kicker:'TIPS',title:`${t===a?'Today\u2019s':'Last night\u2019s'} tips: ${P(s)}`,body:'Cash + card tips for the whole team. Added to the Tips pot. Thank you, everyone.',testID:'tips-notice',timeoutMs:12e3,actions:[{label:'Nice',testID:'tips-notice-ok',onPress:()=>{}}]}))}function Z(e,t,s){return e.filter(e=>e.rid===t&&e.date>=(0,x.addDaysYmd)(s,-1)&&e.date<=s).sort((e,t)=>t.date.localeCompare(e.date))[0]}},994,[887,833,835,873,31,119,121,225,197,264,128,288,817,824,1030,878,13,1078,1415,1066,1422,1426,1427,1430,1431,1084,1438,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},995,[811,31,1066,822,831,821,1120]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:O}={}){const{rid:le,r:ne,now:ie,today:ae,me:oe,role:de}=(0,y.useCtx)(1e4),re=(0,_.useBookings)(le),ue=(0,y.useInStaffApp)(),ce=(0,y.useShiftManager)(),he=(0,_.useWaitlist)(le),[ge,be]=((0,_.useStore)(e=>e.alertAcks),(0,P.useState)(ae)),pe=(0,U.useFrontDoor)(ge),ke=(0,w.useBookingWrite)(),xe=(0,f.useSeatClearFinish)(),[me,ye]=(0,P.useState)(''),[we,je]=(0,P.useState)(!1),[fe,Ie]=(0,P.useState)(2),Be=gee.date===ge).sort((e,s)=>e.time.localeCompare(s.time)),Se=he.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),$e=De.filter(e=>'noshow'===e.status),Te=(0,X.useSync)(e=>!!e.venueId&&'guest'!==e.kind),Ce=De.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Le=(0,p.cancelledDayTally)(re,ge),ve=(0,p.cancelledTallyWords)(Le,ge===ae?'today':'that day'),Ne=De.filter(e=>!e.walkIn),Pe=De.filter(e=>e.walkIn),Oe=re.filter(e=>'pending'===e.status&&e.date>=ae).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[We,Me]=(0,P.useState)(null),Ee=(0,z.parseYmd)(ge);Ee.setHours(12);const Ae=(0,se.hoursFor)(ne,Ee),Re=Ae?.open??new Date(`${ge}T12:00:00`),ze=Ae?.close??new Date(`${ge}T21:00:00`),He=Ae||De.length?Be?'No one seated that day':ge===ae?'No bookings yet today':'No bookings yet':ge===ae?'Closed today':'Closed that day',Ge=Se.length>0||we||'waitlist'===O?(0,te.jsxs)(W.default,{style:{gap:10},children:[(0,te.jsx)(F.SectionHead,{title:`Waitlist (${Se.length})`,sub:`New party waits about ${(0,H.estimateWait)(Se.length+1,ne.settings.turnMins,1)} min (estimate)`}),Se.map((e,s)=>(0,te.jsxs)(W.default,{style:M.styles.card,children:[(0,te.jsxs)(M.Row,{style:{justifyContent:'space-between'},children:[(0,te.jsxs)(M.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,te.jsxs)(M.Muted,{children:[(0,z.minsBetween)(new Date(e.joinedAt),ie)," min \xb7 est. ",(0,H.estimateWait)(s+1,ne.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,te.jsx)(M.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,te.jsxs)(M.Row,{gap:6,children:['waiting'===e.status?(0,te.jsx)(M.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>_.repo.waitlist.setStatus(e.id,'notified')}):null,xe.ok?(0,te.jsx)(M.Button,{small:!0,label:"Seat",onPress:()=>_.repo.waitlist.setStatus(e.id,'seated')}):null,(0,te.jsx)(M.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>_.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,te.jsxs)(M.Row,{gap:6,children:[(0,te.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:me,onChangeText:ye,style:[M.styles.input,{flex:1}]}),(0,te.jsx)(M.Stepper,{value:fe,onChange:Ie,min:1,max:12,label:"party"})]}),(0,te.jsx)(M.Button,{kind:"secondary",label:"Add to waitlist",disabled:me.trim().length<2,onPress:()=>{_.repo.waitlist.join(le,me.trim(),fe),ye('')}})]}):(0,te.jsx)(M.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>je(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===O?(0,te.jsx)(W.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ge}):(0,te.jsxs)(W.default,{style:{gap:12},children:[(0,te.jsx)(l.BookingSaveBanner,{rid:le}),e&&!ue&&'staff'!==de?(0,te.jsx)(M.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===le)&&!ue&&'staff'!==de?(0,te.jsx)(i.VenueRequestList,{rid:le,kind:"table"}):null,!s.IS_WILDINGS&&!ne.settings.hotel?.enabled||ue||'staff'===de?null:(0,te.jsx)(i.VenueRequestList,{rid:le,kind:"room",hotel:ne.settings.hotel??n.WILDINGS_HOTEL}),(0,te.jsx)(Y.BookingsDayNav,{today:ae,date:ge,onDate:be,count:e=>re.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=re.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,te.jsx)(W.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,te.jsx)(ee.DayGraph,{bare:!0,fill:!0,todays:De,open:Re,close:ze,now:ie,turnBase:ne.settings.turnMins,height:128,past:Be,closed:!Ae,emptyText:He})}),Be?(0,te.jsxs)(W.default,{testID:"bookings-past-totals",style:[M.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Y.longDay)(ge)}: ${Ne.length} tables, ${Ce} Covers, ${De.filter(e=>'finished'===e.status).length} finished, ${$e.length} no-shows, ${De.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,te.jsxs)(M.T,{size:17,weight:"semibold",children:["That day: ",Ne.length," booking",1===Ne.length?'':'s',Pe.length?` \xb7 ${Pe.length} walk-in${1===Pe.length?'':'s'}`:''," \xb7 ",Ce," ",1===Ce?'Cover':'Covers']}),(0,te.jsxs)(M.T,{size:16,colour:G.colours.text,children:[De.filter(e=>'finished'===e.status).length," finished \xb7 ",$e.length," no-show",1===$e.length?'':'s'," \xb7 ",De.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,te.jsx)(M.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,te.jsx)(W.default,{testID:"bookings-summary",children:(0,te.jsxs)(M.T,{weight:"semibold",children:[Ne.length," booking",1===Ne.length?'':'s',Pe.length?` \xb7 ${Pe.length} walk-in${1===Pe.length?'':'s'}`:''," \xb7 ",Ce," ",1===Ce?'Cover':'Covers']})}),ue||'staff'===de||Be?null:(0,te.jsx)(h.BookingsMatchStatus,{}),(0,te.jsx)(W.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:ve,style:{alignItems:'center'},children:(0,te.jsx)(M.T,{size:15,colour:G.colours.muted,center:!0,children:ve})}),(0,te.jsxs)(W.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Be?null:(0,te.jsx)(T.QuietButton,{label:"New booking",onPress:pe.openBooking,testID:"add-booking",disabled:!ke.ok,accessibilityHint:ke.hint}),ue&&ce&&ge===ae?(0,te.jsx)(T.QuietButton,{label:"Walk-in",onPress:pe.openWalkIn,testID:"add-walkin",disabled:!ke.ok,accessibilityHint:ke.hint}):null,ge===ae?(0,te.jsx)(C.CloseGardenButton,{quiet:!0,short:!0,rid:le,r:ne,now:ie,by:oe}):null]}),Oe.length?(0,te.jsxs)(W.default,{testID:"pending-requests",style:[M.styles.card,{borderColor:G.colours.amber,gap:8}],children:[(0,te.jsxs)(M.T,{weight:"semibold",colour:G.colours.amber,children:["Needs confirming (",Oe.length,")"]}),(0,te.jsx)(M.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Oe.map(e=>(0,te.jsxs)(W.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:G.colours.border},children:[(0,te.jsxs)(M.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,te.jsxs)(M.Muted,{children:[(0,z.niceDate)((0,z.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,te.jsxs)(M.T,{size:16,children:["Notes: ",e.notes]}):null,e.allergies.length?(0,te.jsx)(M.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,te.jsx)(M.Badge,{kind:"red",label:`${(0,A.allergenLabel)(e.allergen)} \xb7 ${(0,A.severityLabel)(e.severity)}`},e.allergen))}):null,(0,te.jsx)(L.NeedsPills,{b:e,r:ne}),'staff'!==de&&((0,v.needsHoldOk)(e)||e.date===ae&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,te.jsxs)(M.Row,{wrap:!0,gap:6,children:[(0,v.needsHoldOk)(e)?(0,te.jsx)(M.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,L.confirmHolds)(e.id,oe)}):null,e.holdOk&&'seated'===e.status?(0,te.jsx)(M.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,L.serveHolds)(e,oe,'owner')}):null]}):null,We===e.id?(0,te.jsxs)(W.default,{style:{gap:6},children:[(0,te.jsxs)(M.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,te.jsxs)(M.Row,{gap:6,children:[(0,te.jsx)(M.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{_.repo.bookings.decide(e.id,'declined',oe),Me(null)}}),(0,te.jsx)(M.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Me(null)})]})]}):ke.ok?(0,te.jsxs)(M.Row,{gap:6,children:[(0,te.jsx)(M.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>_.repo.bookings.decide(e.id,'confirmed',oe)}),(0,te.jsx)(M.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Me(e.id)}),(0,te.jsx)(Z.WhatsAppGuest,{b:e,rid:le,kind:"change"})]}):(0,te.jsx)(W.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,te.jsx)(M.T,{children:j.BOOKING_VIEW_ONLY})}),(0,te.jsx)(Q.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===De.length?(0,te.jsx)(M.Muted,{children:"No bookings for this day yet."}):null,De.map(e=>{const s='confirmed'===e.status&&ge===ae&&(0,z.minsBetween)(new Date(`${e.date}T${e.time}:00`),ie)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,R.gbp);return(0,te.jsxs)(W.default,{testID:(0,N.isSeatedHighlight)((0,v.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[M.styles.card,(0,N.isSeatedHighlight)((0,v.shownStatus)(e))?(0,N.seatedHighlightStyle)({borderColor:(0,v.hasAllergens)(e)?G.colours.red:G.colours.goldLight}):{borderColor:(0,v.hasAllergens)(e)?G.colours.red:s?G.colours.amber:G.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,te.jsx)(L.AllergenBar,{b:e}),(0,te.jsx)(l.BookingNotSavedLine,{b:e}),(0,te.jsxs)(M.Row,{style:{justifyContent:'space-between'},children:[(0,te.jsxs)(M.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,te.jsxs)(M.T,{weight:"semibold",colour:(0,N.isSeatedHighlight)((0,v.shownStatus)(e))?N.SEATED_FG:G.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,U.walkInLabel)(e)]}),(0,v.hasAllergens)(e)?(0,te.jsx)(E.AllergyIcon,{text:(0,v.allergenText)(e),size:20,colour:(0,N.isSeatedHighlight)((0,v.shownStatus)(e))?'#7A4A00':G.colours.amber,ink:(0,N.isSeatedHighlight)((0,v.shownStatus)(e))?G.colours.gold:G.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,te.jsx)(M.Badge,{kind:'seated'===(0,v.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,v.shownStatus)(e)[0].toUpperCase()+(0,v.shownStatus)(e).slice(1)})]}),n?(0,te.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,N.isSeatedHighlight)((0,v.shownStatus)(e))?(0,te.jsxs)(M.T,{size:14,colour:N.SEATED_MUTED,children:[e.table?(0,K.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,te.jsxs)(M.Muted,{children:[e.table?(0,K.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,te.jsxs)(M.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,b.bookingExtras)(e)?(0,te.jsx)(M.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,b.historyLines)(e)[0]?(0,te.jsxs)(M.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,te.jsxs)(M.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Be||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,te.jsx)(M.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,U.walkInLabel)(e)}`,onPress:()=>_.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:oe,depositPaidAt:(new Date).toISOString()})}),Be?null:(0,te.jsx)(S.WixDepositLink,{b:e,rid:le}),!Be&&ke.ok?(0,te.jsx)(D.WaiveDepositButton,{b:e,who:oe,small:!0}):null,'waived'===t&&e.depositWaived?(0,te.jsx)(M.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,te.jsx)(M.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,te.jsxs)(M.Muted,{children:[(0,J.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,te.jsx)(M.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,te.jsx)(M.Badge,{kind:"red",label:`${(0,A.allergenLabel)(e.allergen)} \xb7 ${(0,A.severityLabel)(e.severity)}`},e.allergen))}):null,(0,v.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,te.jsx)(q.BookingAllergyChain,{b:e,me:oe}):null,e.walkIn?null:(0,te.jsx)(Q.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,te.jsxs)(M.T,{size:13,colour:G.colours.amber,children:["Running ",(0,z.minsBetween)(new Date(`${e.date}T${e.time}:00`),ie)," min late. Call them, then mark no-show if needed."]}):null,ke.ok?(0,te.jsx)(c.BookingEditButton,{rid:le,booking:e,who:oe,role:de,inStaffApp:ue,shiftManager:ce,big:!0,testID:`edit-booking-${e.id}`}):null,(0,te.jsxs)(M.Row,{wrap:!0,gap:6,children:[(0,te.jsx)(u.BookingTableButton,{rid:le,booking:e,readOnly:Be||!ke.ok,turnBase:ne.settings.turnMins,canClear:xe.ok}),ke.ok?null:(0,te.jsx)(W.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,te.jsx)(M.T,{children:j.BOOKING_VIEW_ONLY})}),ke.ok?(0,te.jsxs)(te.Fragment,{children:[Be||e.table||!['seated','confirmed'].includes(e.status)?null:(0,te.jsx)(M.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>pe.assignTable(e)}),!Be&&['seated','confirmed'].includes(e.status)?(0,te.jsx)(M.Button,{small:!0,kind:"secondary",label:(0,K.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,K.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,U.walkInLabel)(e)}`,onPress:()=>pe.combineTables(e)}):null,Be||'confirmed'!==e.status?null:(0,te.jsxs)(te.Fragment,{children:[xe.ok&&e.date===ae?(0,te.jsx)(M.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,U.walkInLabel)(e)} now`,onPress:()=>(0,U.seatBookingNow)(le,e)}):null,(0,te.jsx)(M.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>_.repo.bookings.setStatus(e.id,'noshow')})]}),Be||e.walkIn?null:(0,te.jsx)(r.CancelBookingButton,{rid:le,b:e,name:(0,U.walkInLabel)(e),small:!0,onDone:()=>{}}),Be||e.walkIn?null:(0,te.jsx)(r.ReinstateBookingButton,{b:e,name:(0,U.walkInLabel)(e),today:ae}),!Be&&xe.ok&&'seated'===e.status?(0,te.jsx)(M.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,U.walkInLabel)(e)}, table needs clearing`,onPress:()=>(0,U.finishBookingNow)(le,e)}):null,['confirmed','pending'].includes(e.status)&&e.date>=ae?(0,te.jsx)(Z.WhatsAppGuest,{b:e,rid:le,kind:"auto"}):null,ue?null:(0,te.jsx)($.CopyReviewLink,{rid:le,bookingId:e.id}),!Be&&e.walkIn?(0,te.jsx)(d.CancelWalkInButton,{rid:le,b:e,small:!0}):null,!Be&&e.walkIn?(0,te.jsx)(d.ReinstateWalkInButton,{rid:le,b:e,today:ae,small:!0}):null,(0,te.jsx)(V.BookingUndo,{b:e,rid:le,today:ae,who:(0,U.walkInLabel)(e),allowed:xe.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,te.jsx)(M.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,te.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(re,ge,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:ge===ae?'today':'that day'}),(0,te.jsxs)(M.Card,{children:[(0,te.jsxs)(M.Row,{style:{justifyContent:'space-between'},children:[(0,te.jsx)(M.T,{weight:"semibold",children:"No-shows"}),(0,te.jsx)(M.Badge,{kind:$e.length?'red':'ok',label:`${$e.length} ${ge===ae?'today':(0,z.niceDate)((0,z.parseYmd)(ge)).slice(0,6)}${Te||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,te.jsx)(M.Muted,{children:$e.length?`Marked no-show today: ${$e.slice(0,6).map(e=>`${e.time} ${(0,U.walkInLabel)(e)}`).join(', ')}${$e.length>6?` and ${$e.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,te.jsx)(t.GreensideCashOnly,{}):(0,te.jsxs)(M.Card,{children:[(0,te.jsx)(M.T,{weight:"semibold",children:"Deposits"}),(0,te.jsx)(M.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ne.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,te.jsx)(M.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ge,pe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=(e=O)&&e.__esModule?e:{default:e},M=_r(_d[32]),E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52])},996,[5,1048,1453,11,1625,873,842,1466,1467,1145,1144,1626,816,1468,1620,1621,998,1022,1096,1628,1448,14,1469,1630,841,1021,1044,1023,831,1449,31,128,817,1585,822,818,819,821,877,824,997,1043,828,1631,1436,1036,1083,1012,823,1503,1617,832,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RID",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return d}}),_e.nextStatus=function(e){return'new'===e.status||'acknowledged'===e.status?{to:'preparing',label:'Start preparing'}:'preparing'===e.status?{to:'ready',label:'takeaway'===e.type?'Mark ready (notify customer)':'Mark ready'}:'ready'===e.status?'takeaway'===e.type?{to:'collected',label:'Collected'}:{to:'served',label:'Served'}:null},Object.defineProperty(_e,"LIVE",{enumerable:!0,get:function(){return u}}),_e.busyLevel=b,_e.restOfDayLevel=function(e,t){const r=e.hours.filter(t=>!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},997,[31,264,128,817,824,5,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtH",{enumerable:!0,get:function(){return d.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return d.fmtHDay}}),Object.defineProperty(_e,"authorityRole",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return b}}),_e.useShiftManager=h,_e.useSignedIn=S,_e.useCtx=function(e=1e4){const u=(0,t.useContext)(y),i=(0,r.useOwner)(e=>e.site),f=(0,r.useOwner)(e=>e.previewRole),c=(0,r.useOwner)(e=>e.staffAs),d=S(),l=u||'staff'===o.APP_VARIANT,D=(0,t.useContext)(b),O=h(),A=o.IS_CAR?'owner':l?D&&O?'manager':'staff':d?w(f,p(d)):f,I=(0,r.useOwner)(e=>e.staff),R=(0,n.useRestaurant)(i),M=(0,n.useNow)(e),C=o.IS_CAR?s.CAR_DEVICE_ID:d?d.id:l&&c?c:m[A],P=o.IS_CAR?s.CAR_ACTOR:I.find(e=>e.id===C)?.name??'Team member';return{rid:i,r:R,now:M,role:A,me:P,meId:C,today:(0,a.venueYmd)(M),signedIn:!o.IS_CAR&&!!d}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return A}}),_e.ensureAttendance=function(t,n){if(e.LIVE_VENUE_BUILD||(0,u.isLive)())return;const o=r.useOwner.getState(),s=[],i=o.staff.find(e=>e.active&&'manager'===e.role)??o.staff.find(e=>e.active&&'owner'===e.role),f=new Date(n);f.setDate(n.getDate()-O(n));const c=(0,a.ymd)(f),d=(0,a.ymd)(new Date(f.getFullYear(),f.getMonth(),f.getDate()+6)),m=(e,t,n)=>{const r=new Date(e);return r.setHours(0,0,0,0),r.setMinutes(Math.round(60*t)+n),r.toISOString()};for(let e=42;e>=1;e--){const t=new Date(n);t.setDate(t.getDate()-e);const r=(0,a.ymd)(t);if(o.attendance.some(e=>e.date===r))continue;const u=o.shifts.filter(e=>e.date===r&&!1!==e.published);(u.length?u:o.shifts.filter(e=>e.day===O(t)&&e.date>=c&&e.date<=d&&!1!==e.published)).forEach((n,a)=>{const o=e=>Math.round((7*r.charCodeAt(9)+13*a+e)%17-5),u=n.end-n.start,f=u>8?30:u>6?20:0,c=e>2&&i?{signOff:{by:i.name,byId:i.id,at:m(t,34,a)}}:{};s.push({id:`at-${r}-${n.staffId}`,staffId:n.staffId,date:r,in:m(t,n.start,o(1)),out:m(t,n.end,o(2)),inSite:!0,outSite:!0,breakMins:f,...c})})}s.length&&r.useOwner.setState({attendance:[...r.useOwner.getState().attendance,...s]})},_e.paidMins=function(e,t){if(!e.in)return{worked:0,brk:0,paid:0};const n=Math.max(0,Math.round(((e.out?new Date(e.out):t).getTime()-new Date(e.in).getTime())/6e4)),r=e.breakMins??0;return{worked:n,brk:r,paid:Math.max(0,n-r)}},Object.defineProperty(_e,"hmDur",{enumerable:!0,get:function(){return I}}),_e.payRange=function(e,t,n){const r=new Date(n);if(r.setHours(0,0,0,0),'monthly'===e){const e=new Date(r.getFullYear(),r.getMonth()+t,1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{s:e,e:n,key:`m-${(0,a.ymd)(e)}`}}const o='weekly'===e?7:14,s=new Date(r);s.setDate(r.getDate()-O(r));let u=new Date(s);if('fortnightly'===e){const e=new Date(2026,0,5);(Math.round((s.getTime()-e.getTime())/6048e5)%2+2)%2==1&&u.setDate(u.getDate()-7)}u.setDate(u.getDate()+t*o);const i=new Date(u);return i.setDate(u.getDate()+o-1),{s:u,e:i,key:`${e[0]}-${(0,a.ymd)(u)}`}},_e.useHourly=function(){const e=S(),t=(0,r.useOwner)(e=>e.hourly);return o.IS_CAR||e?t:R};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),r=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]),u=_r(_d[7]),i=_r(_d[8]),f=_r(_d[9]),c=_r(_d[10]),d=_r(_d[11]);const m={owner:c.ROSTER.find(e=>'owner'===e.role)?.id??'',manager:c.ROSTER.find(e=>'manager'===e.role)?.id??'',staff:c.ROSTER.find(e=>'staff'===e.app)?.id??''},l={staff:0,manager:1,owner:2},p=e=>e.ownerAccess?'owner':e.managerAccess&&'staff'===e.role?'manager':e.role,w=(e,t)=>l[e]>l[t]?t:e,y=(0,t.createContext)(!1),D=()=>(0,t.useContext)(y),b=(0,t.createContext)(!1);function h(){const e=(0,t.useContext)(y)||'staff'===o.APP_VARIANT,n=S(),r=(0,u.useSync)(e=>!!e.venueId&&'staff'===e.kind),a=(0,u.useSync)(e=>e.perms);return(0,i.shiftManagerOn)({inStaffApp:e,managerAccess:n?.managerAccess,role:n?.role,app:(0,f.rosterPerson)(n?.id)?.app,live:r,perms:a})}function S(){const e=(0,f.useSession)(e=>e.meId),t=(0,r.useOwner)(e=>e.staff);return e?t.find(t=>t.id===e&&t.active):void 0}const O=e=>(e.getDay()+6)%7,A=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const I=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const R={}},998,[842,31,822,861,821,807,1118,823,1163,865,15,1153]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function i(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_AVATARS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"AVATAR_BGS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"AVATAR_RINGS",{enumerable:!0,get:function(){return j}}),_e.specFor=E,_e.AvatarArt=$,_e.AvatarLook=v,_e.useStaffMember=M,_e.StaffAvatar=function({id:i,name:t,size:s=34,ring:c=!0}){const f=M(i,t),h=f?.id??i,u=(0,n.useAvatars)(i=>h?i.photos[h]:void 0),F=(0,o.useSetup)(i=>h?i.looks[h]:void 0),j=`${(f?.name??t??'Team member').replace(' (example)','')}'s avatar`;return(0,y.jsx)(r.default,{testID:h?`avatar-${h}`:'avatar',accessibilityLabel:j,accessibilityRole:"image",style:{width:s,height:s,borderRadius:s/2,overflow:'hidden',borderWidth:c?Math.max(1,s/22):0,borderColor:x.colours.gold,backgroundColor:(0,e.soutersSurface)('#111')},children:u?(0,y.jsx)(l.default,{source:{uri:u.dataUrl},style:{width:'100%',height:'100%'},accessibilityIgnoresInvertColors:!0}):(0,y.jsx)(v,{look:F,id:h,name:f?.name??t,size:s-(c?2*Math.max(1,s/22):0)})})};var e=_r(d[0]);_r(d[1]);var l=i(_r(d[2])),r=i(_r(d[3])),t=_r(d[4]),s=i(t),c=_r(d[5]),n=_r(d[6]),o=_r(d[7]),x=_r(d[8]),f=_r(d[9]),h=_r(d[10]),y=_r(d[11]);const u=Object.fromEntries(h.ROSTER.map(i=>[i.id,i.avatar])),F=['#2A2520','#B89A72','#D9A441','#4A3F35','#3A3029','#8A6A3B'],j=['#E9B949','#CFA45F'],C=F,p=['#F1C7A5','#E8B48F','#C68B5E','#8D5B3E','#F4D2B8','#A86B45'],A=['#2B1B12','#7A4E2A','#151515','#C2462E','#D9B26A'],b=['quiff','flip','crop','beehive','bob','curls'],k=i=>{let e=7;for(const l of i)e=31*e+l.charCodeAt(0)>>>0;return e};function E(i,e){if(i&&u[i])return u[i];const l=k(i||e||'crew');return{bg:C[l%6],ring:j[l%2],skin:p[(l>>3)%6],hair:A[(l>>6)%5],hairStyle:b[(l>>9)%6],suit:'#F2EAD8',antenna:['ball','star','none'][(l>>12)%3]}}const O=(i,e,l)=>`M${i} ${e-l} Q${i+.18*l} ${e-.18*l} ${i+l} ${e} Q${i+.18*l} ${e+.18*l} ${i} ${e+l} Q${i-.18*l} ${e+.18*l} ${i-l} ${e} Q${i-.18*l} ${e-.18*l} ${i} ${e-l}Z`;function $({spec:i,size:e=40}){const l=i,r='#1B1B1B',c='flip'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M29 50 C26 30 40 22 50 22 C60 22 74 30 71 50 C75 56 79 60 76 65 C72 60 69 58 66 57 L34 57 C31 58 28 60 24 65 C21 60 25 56 29 50Z",fill:l.hair}):'bob'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M30 58 C27 32 40 24 50 24 C60 24 73 32 70 58 L66 60 L34 60Z",fill:l.hair}):'beehive'===l.hairStyle?(0,y.jsxs)(t.G,{children:[(0,y.jsx)(t.Ellipse,{cx:50,cy:25,rx:15,ry:14,fill:l.hair}),(0,y.jsx)(t.Path,{d:"M31 54 C28 34 40 27 50 27 C60 27 72 34 69 54 Z",fill:l.hair})]}):'curls'===l.hairStyle?(0,y.jsx)(t.G,{children:[[34,34],[40,27],[50,24],[60,27],[66,34],[69,43],[31,43]].map(([i,e],r)=>(0,y.jsx)(t.Circle,{cx:i,cy:e,r:7,fill:l.hair},r))}):null,n='quiff'===l.hairStyle?(0,y.jsxs)(t.G,{children:[(0,y.jsx)(t.Path,{d:"M32 42 C31 27 43 23 51 25 C61 22 70 30 68 42 C63 35 57 33 50 34 C43 34 37 37 32 42Z",fill:l.hair}),(0,y.jsx)(t.Path,{d:"M46 26 C51 14 66 14 66 23 C61 20 54 21 50 28Z",fill:l.hair})]}):'crop'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M32 42 C31 28 42 25 50 25 C58 25 69 28 68 42 C64 36 58 33 50 33 C42 33 36 36 32 42Z",fill:l.hair}):'curls'===l.hairStyle?null:(0,y.jsx)(t.Path,{d:"M32 43 C33 30 42 27 50 27 C58 27 67 30 68 43 C61 38 57 33 51 33 C47 37 39 41 32 43Z",fill:l.hair});return(0,y.jsxs)(s.default,{width:e,height:e,viewBox:"0 0 100 100",children:[(0,y.jsx)(t.Circle,{cx:50,cy:50,r:50,fill:l.bg}),(0,y.jsx)(t.Ellipse,{cx:50,cy:50,rx:46,ry:13,fill:"none",stroke:"#FFF4E0",strokeOpacity:.28,strokeWidth:1.6,transform:"rotate(-28 50 50)"}),(0,y.jsx)(t.Path,{d:O(16,24,6),fill:"#FFF4E0",fillOpacity:.85}),(0,y.jsx)(t.Path,{d:O(84,34,4),fill:"#FFF4E0",fillOpacity:.7}),(0,y.jsx)(t.Circle,{cx:80,cy:16,r:1.6,fill:"#FFF4E0",fillOpacity:.8}),(0,y.jsx)(t.Circle,{cx:22,cy:70,r:1.3,fill:"#FFF4E0",fillOpacity:.6}),(0,y.jsx)(t.Path,{d:"M12 100 C14 82 31 74 50 74 C69 74 86 82 88 100 Z",fill:l.suit}),(0,y.jsx)(t.Path,{d:"M36 100 L40 84 L50 90 L60 84 L64 100Z",fill:l.ring,fillOpacity:.35}),(0,y.jsx)(t.Rect,{x:44,y:60,width:12,height:12,fill:l.skin}),c,(0,y.jsx)(t.Ellipse,{cx:50,cy:46,rx:17,ry:18.5,fill:l.skin}),n,l.specs?(0,y.jsxs)(t.G,{stroke:r,strokeWidth:1.6,fill:"#FFFFFF",fillOpacity:.25,children:[(0,y.jsx)(t.Rect,{x:37,y:42,width:11,height:8,rx:4}),(0,y.jsx)(t.Rect,{x:52,y:42,width:11,height:8,rx:4}),(0,y.jsx)(t.Line,{x1:48,y1:45,x2:52,y2:45})]}):null,(0,y.jsx)(t.Ellipse,{cx:42.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,y.jsx)(t.Ellipse,{cx:57.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,y.jsx)(t.Circle,{cx:43.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,y.jsx)(t.Circle,{cx:58.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,y.jsx)(t.Circle,{cx:38,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,y.jsx)(t.Circle,{cx:62,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,y.jsx)(t.Path,{d:"M44.5 55 Q50 60 55.5 55",stroke:r,strokeWidth:1.8,fill:"none",strokeLinecap:"round"}),(0,y.jsx)(t.Ellipse,{cx:50,cy:74,rx:21,ry:5.5,fill:l.ring}),(0,y.jsx)(t.Ellipse,{cx:50,cy:73,rx:16,ry:3,fill:"#000000",fillOpacity:.18}),(0,y.jsx)(t.Circle,{cx:50,cy:88,r:4,fill:l.ring}),(0,y.jsx)(t.Circle,{cx:50,cy:88,r:1.6,fill:l.bg}),(0,y.jsx)(t.Circle,{cx:50,cy:45,r:29,fill:"#FFF4E0",fillOpacity:.1,stroke:"#FFF4E0",strokeOpacity:.85,strokeWidth:2}),(0,y.jsx)(t.Path,{d:"M29 36 A23 23 0 0 1 41 22",stroke:"#FFFFFF",strokeOpacity:.85,strokeWidth:3.2,fill:"none",strokeLinecap:"round"}),(0,y.jsx)(t.Circle,{cx:28.5,cy:42,r:1.5,fill:"#FFFFFF",fillOpacity:.85}),'none'!==l.antenna?(0,y.jsx)(t.Line,{x1:50,y1:16,x2:50,y2:8,stroke:l.ring,strokeWidth:2}):null,'ball'===l.antenna?(0,y.jsx)(t.Circle,{cx:50,cy:6.5,r:3.3,fill:l.ring}):'star'===l.antenna?(0,y.jsx)(t.Path,{d:O(50,6.5,4.5),fill:l.ring}):null]})}function v({look:i,id:e,name:r,size:t=40}){const s=null!=i&&i>=1e3?f.AVATAR_OPTIONS.find(e=>e.look===i):void 0;return s?(0,y.jsx)(l.default,{source:{uri:s.dataUrl},style:{width:t,height:t},accessibilityLabel:s.name}):(0,y.jsx)($,{spec:null!=i?E(`${e??r}#look${i}`):E(e,r),size:t})}const P=i=>(i??'').replace(' (example)','').trim().toLowerCase();function M(i,e){const l=(0,c.useOwner)(i=>i.staff);return i?l.find(e=>e.id===i):e?l.find(i=>P(i.name)===P(e)):void 0}},999,[887,31,197,128,1017,861,1094,1032,824,1068,15,25]); +__d(function(g,_r,i,a,_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 P}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return E}}),_e.personFromStaff=H,_e.signInWithText=V,_e.SignInWithLink=z,_e.signInWithHandover=F,_e.useSignedOutGate=function(){const e=(0,k.useSession)(e=>e.meId),n=(0,b.useSync)(e=>'device'===e.kind&&!!e.venueId);return h.IS_CAR?!S.PITCH&&!n:C.includes(h.APP_VARIANT)&&!S.PITCH&&!e&&!K()},_e.InviteGate=function(){const[e,N]=(0,u.useState)(k.useSession.persist.hasHydrated()),[H,V]=(0,u.useState)(k.START_INVITE||k.START_HANDOVER||k.START_KITCHEN?'checking':'done'),[L,U]=(0,u.useState)(null),[G,B]=(0,u.useState)(null),[Y,$]=(0,u.useState)(0),[X,Q]=(0,u.useState)(!1),[q,J]=(0,u.useState)(null),Z=(0,k.useSession)(e=>e.meId),ee=(0,k.useSession)(e=>!Z||!!e.welcomed[Z]);if((0,u.useEffect)(()=>{const e=k.useSession.persist.onFinishHydration(()=>N(!0));return k.useSession.persist.hasHydrated()&&N(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!C.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=k.useSession.getState().meId;if(k.START_KITCHEN&&'chef'===h.APP_VARIANT&&!e){const e=await(0,b.claimDisplayKitchen)(k.START_KITCHEN);if(!t)return;if('ok'===e.status&&e.id.staffRef){(0,y.markKitchenViaDisplay)(!0,e.id.displayName),M(e.id);try{k.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void V('done')}return U('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void V('done')}if(k.START_HANDOVER&&!k.START_INVITE&&!W){W=!0;const n=await(0,b.claimChromeHandover)(k.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef)M(n.id);else if('refused'===n.status&&!e)return B(n.message),void V('done')}if(k.START_INVITE&&!(e&&await(0,b.signedInHereAs)(e)&&await(0,b.rememberedInviteHere)(k.START_INVITE))){const e=await D(k.START_INVITE,e=>{t&&B(e)});if(!t)return;if('refused'===e.kind)return B(e.message),void V('done');if('offline'===e.kind)return Q(!0),void(n=setTimeout(()=>{t&&$(e=>e+1)},1e4));if(Q(!1),'bad'===e.kind)return void V('bad')}const s=O(k.useSession.getState().meId),o=s&&!1!==w.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)k.useSession.getState().signOut();else if(s&&!R(s)&&!k.START_INVITE&&await(0,b.signedInHereAs)(s.id)){if(await(0,b.forgetSignInHere)(),!t)return;k.useSession.getState().signOut(),J(E(s.app))}else if(s&&!R(s)){const e=(0,k.appUrl)(s.app,k.START_INVITE);if(e)return void window.location.replace(e)}V('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,Y]),!C.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(t.QueuedVenueWelcome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?'This link cannot be used here. Ask your authorised manager.':X?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(o.GreensideStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(r.AbbotsfordStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?'This link cannot be used here. Ask your authorised manager.':X?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(l.KirktonStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(s.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Z){const t=s.IsolatedStaffHome,o=k.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(t,{app:o,message:l})})}if(X)return _('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===H)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if(h.IS_OWNER_DESKTOP&&!Z&&!S.PITCH&&!K())return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(p.DesktopSignIn,{onCode:F,refused:G})});if((0,A.inPhoneApp)()&&!Z&&!S.PITCH)return G&&/already been used/i.test(G)?_(P,'invite-app-used'):G&&(0,x.isPhoneLinked)(G)?_(x.PHONE_LINKED_TEXT,'invite-phone-linked'):G?_(G,'invite-app-refused'):_(v,'invite-app-notsetup');if('bad'===H)return(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,j.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,j.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V('done')}),(0,j.jsx)(I.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(G&&!Z&&(0,x.isPhoneLinked)(G))return(0,j.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${x.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,j.jsx)(I.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,j.jsx)(I.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,j.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(G&&!Z)return(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,j.jsx)(I.Muted,{center:!0,children:G}),(0,j.jsx)(I.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,j.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>B(null)})]});if(q&&!Z)return(0,j.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,j.jsx)(I.Muted,{center:!0,children:q}),(0,j.jsx)(z,{})]});if(L&&!Z){const e=/expired/i.test(L);return(0,j.jsxs)(f.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,j.jsx)(I.Muted,{center:!0,children:L}),(0,j.jsx)(I.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!Z&&!S.PITCH&&!K())return(0,j.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:G?'This link can\u2019t be used here':'Sign in to CoverCharge'}),G?(0,j.jsx)(I.Muted,{center:!0,children:G}):null,(0,j.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,j.jsx)(z,{})]});const ne=(0,k.rosterPerson)(Z);return ne&&!ee&&R(ne)&&!(0,y.isKitchenViaDisplay)()?(0,j.jsx)(T.LaunchWelcome,{p:ne,onDone:()=>k.useSession.getState().markWelcomed(ne.id)}):null};var n=_r(d[0]),t=_r(d[1]),s=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),I=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]),w=_r(d[21]),j=_r(d[22]);const P='This app copy has already been set up on another phone. Ask your manager for a new link.',v='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',_=(e,n)=>(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e})}),C=['owner','staff','chef'],R=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,E=e=>`You now use ${k.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function N(e){k.useSession.getState().signIn(e.id);const n=w.useOwner.getState();w.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function H(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const O=e=>{const n=(0,k.rosterPerson)(e);if(n)return n;const t=e?w.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?H(t):void 0};async function D(e,n){const t=await(0,k.personForInvite)(e);if(t)return N(t),R(t)?((0,b.claimInvite)(e).then(e=>{if('refused'===e.status&&k.useSession.getState().meId===t.id&&(k.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==k.useSession.getState().meId){const n=O(e.id.staffRef);n&&N(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const s=await(0,b.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=O(s.id.staffRef)??H({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return N(o),{kind:'ok',p:o}}async function V(e,n=()=>{}){const t=(0,k.inviteFromText)(e);if(!t)return'bad';const s=await D(t,n);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!R(o)){const e=(0,k.appUrl)(o.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,s]=(0,u.useState)('');return(0,j.jsxs)(f.default,{style:{gap:6},children:[(0,j.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,j.jsx)(I.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await V(e,s);s('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,j.jsx)(I.T,{size:13,colour:m.colours.red,children:t}):null]})}function M(e){if(!e.staffRef)return;N(O(e.staffRef)??H({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function F(e){const n=await(0,b.claimChromeHandover)(e);return'ok'===n.status?n.id.staffRef?(M(n.id),'ok'):'bad':'refused'===n.status?{refused:n.message}:'offline'===n.status?'offline':'bad'}let W=!1;const K=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1000,[5,1632,1633,1634,1635,1636,31,123,47,128,807,1637,865,824,1638,817,823,1302,2,1440,1300,861,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1001,[887,31,121,225,123,264,128,1072,817,824,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const O=(0,x.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,x.useCtx)(3e4),_=(0,y.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,c.useOwner)(e=>e.shifts),q=(0,c.useOwner)(e=>(0,c.liveAttendance)(e.attendance)),V=(0,c.useOwner)(e=>e.staffCanViewSuppliers),G=(0,c.useOwner)(e=>e.quickLinks),U=(0,c.useOwner)(e=>e.chat),Y=(0,c.useOwner)(e=>e.swaps),Q=(0,c.useOwner)(e=>e.leave),K=(0,A.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,k.useOrders)(P.id),se=(0,k.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,I.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!O&&E?(0,N.jsxs)(o.default,{style:{gap:10},children:[(0,N.jsx)(s.DayBar,{app:"staff",today:F}),(0,N.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,N.jsxs)(o.default,{style:{gap:10},children:[O?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(s.DayBar,{app:"staff",today:F}),(0,N.jsx)(t.CoversToday,{rid:P.id})]}),(0,N.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,N.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,N.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,N.jsx)(B.StaffAvatar,{id:z,size:52})}),(0,N.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,N.jsx)(r.Badge,{kind:"gold",label:O?P.name:'Staff app preview'})]}),(0,N.jsx)(r.Muted,{children:O?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,N.jsx)(v.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,N.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,N.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,h.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,N.jsx)(r.Badge,{kind:"ok",label:(0,x.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,N.jsxs)(r.Muted,{children:["Today on the rota: ",(0,x.fmtH)(J.start),"\u2013",(0,x.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,N.jsxs)(r.Muted,{children:["Next on the rota: ",x.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,x.fmtH)(K[0].start),"\u2013",(0,x.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,N.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,N.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,N.jsx)(L.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,N.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff"}),ie.length?(0,N.jsx)(r.Card,{children:(0,N.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,N.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,N.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,N.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,N.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,N.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,N.jsxs)(r.Muted,{children:[e.table?(0,D.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,N.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,N.jsxs)(r.Row,{wrap:!0,gap:6,children:[_.ok&&'seated'===e.status?(0,N.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,M.finishBookingNow)(P.id,e)}):null,e.walkIn?(0,N.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,N.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,N.jsx)(I.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,N.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,N.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",te.length+ae.length,")"]}),(0,N.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),te.map(e=>(0,N.jsx)(w.AllergyChain,{o:e,me:H},e.id)),ae.map(e=>(0,N.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,N.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,D.tablesLabel)(e.table)}`:'']}),(0,N.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,N.jsx)(w.BookingAllergyChain,{b:e,me:H}),(0,N.jsx)(o.default,{style:{flexDirection:'row'},children:(0,N.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})})]},e.id))]}):null,le?(0,N.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,N.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,N.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,N.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,N.jsx)(r.T,{size:14,children:le.text})]}):null,(0,N.jsxs)(r.Card,{children:[(0,N.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,N.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,x.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,N.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,N.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,N.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,N.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,N.jsx)(b.QuickLinksRow,{compact:!0})]}):null,O?null:(0,N.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,N.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),y=_r(d[15]),j=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),B=_r(d[23]),I=_r(d[24]),D=_r(d[25]),$=_r(d[26]),M=_r(d[27]),v=_r(d[28]),L=_r(d[29]),A=_r(d[30]),N=_r(d[31])},1002,[1018,1142,1466,1448,31,264,128,817,861,821,824,1449,1493,1517,998,1628,1089,1035,1036,1074,1503,1037,997,999,1631,828,811,1043,1088,1516,1441,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'signoff'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"8",...n}),(0,e.jsx)(s.Path,{d:"M11 6.5V11l3 2",...n}),(0,e.jsx)(s.Path,{d:"M15.5 19.5l2 2 4-4.2",...n})]}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'rota'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M7 14h4M13 14h4M7 18h6",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1003,[31,1017,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1004,[31,264,207,128,288,824,1003,25]); +__d(function(_g,r,_i,a,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)},1005,[1159,31,264,128,817,861,824,998,823,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&o?(0,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),c={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},u=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.markAllAlertsRead)(t,l.map(e=>e.id),s)?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';T(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:$?'Done':'Select',testID:"alerts-select",accessibilityLabel:$?'Finish selecting alerts':'Select alerts to clear',onPress:()=>{R(!$),B({}),P(null)},style:{minHeight:44}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Clear all",testID:"alerts-clear-all",disabled:!N.length,accessibilityLabel:'all'===m?'Clear all alerts from my list':`Clear all ${G.find(e=>e.id===m)?.label??''} alerts from my list`,onPress:()=>P({ids:Object.fromEntries(N.map(e=>[e.id,e.at])),all:'all'===m}),style:{minHeight:44}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",testID:"alerts-select-all",label:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all (${N.length})`,accessibilityLabel:N.length&&N.every(e=>void 0!==O[e.id])?'Select none':`Select all ${N.length} alerts shown`,onPress:()=>B(N.length&&N.every(e=>void 0!==O[e.id])?{}:Object.fromEntries(N.map(e=>[e.id,e.at]))),style:{minHeight:44}}),(0,H.jsx)(x.Button,{small:!0,kind:"primary",testID:"alerts-clear-selected",label:`Clear selected (${Object.keys(O).length})`,accessibilityLabel:`Clear ${Object.keys(O).length} selected alerts from my list`,disabled:!Object.keys(O).length,onPress:()=>P({ids:O,all:!1}),style:{minHeight:44}})]})}):null,D?(0,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.Muted,{center:!0,children:"They leave your Alerts list on all your phones. Bookings, orders, reviews and emails are not deleted, and nobody else\u2019s alerts change. New alerts still come in."}),(0,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.Button,{kind:"primary",testID:"alerts-clear-yes",label:"Clear",accessibilityLabel:`Yes, clear ${Object.keys(D.ids).length} alerts`,onPress:async()=>{const e=Object.keys(D.ids).length,s=`${e} ${1===e?'alert':'alerts'} cleared${await(0,o.clearAlertsSynced)(t,D.ids,D.all?Math.max(Date.now(),...Object.values(D.ids)):void 0)?'':' on this phone. We\u2019ll sync it when you\u2019re back online'}`;P(null),B({}),R(!1),T(s),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.Button,{kind:"secondary",testID:"alerts-clear-cancel",label:"Cancel",accessibilityLabel:"Cancel, keep the alerts",onPress:()=>P(null),style:{minHeight:44,minWidth:110}})]})]})}):null,S?(0,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(e.id),B({}),P(null)},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,paddingHorizontal:12,paddingVertical:7,minHeight:44,borderRadius:999,borderWidth:1,borderColor:m===e.id?'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),N.map(e=>{const t=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.Card,{highlight:s?t.colour:void 0,onPress:()=>$?B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.default,{testID:`alert-check-${e.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:void 0!==O[e.id]},"aria-checked":void 0!==O[e.id],accessibilityLabel:`Select alert: ${(0,o.alertText)(e).title}`,onPress:()=>B(t=>{const s={...t};return void 0!==s[e.id]?delete s[e.id]:s[e.id]=e.at,s}),style:{width:44,height:44,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_r(_d[13])),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),f=_r(_d[19]),w=_r(_d[20]),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),$=_r(_d[27]),R=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),D=_r(_d[31]),P=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.colours.red})),...a.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:k.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:k.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:k.colours.blue})),...r.filter(e=>'waiting'===e.status).length?[{id:`wl-${r.length}`,tab:'bookings',title:`${r.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'review',label:'Reviews'},{id:'test',label:'Tests'}],Y=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const Q=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function X(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function J(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},1006,[873,992,876,823,1017,1010,1012,31,119,240,123,264,128,288,881,817,822,841,861,819,821,824,997,998,1037,831,1035,1007,1090,1005,1027,1029,1028,1030,13,1054,1034,1101,25]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ChatAsCtx",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return w.dmId}}),Object.defineProperty(_e,"inChannel",{enumerable:!0,get:function(){return w.inChannel}}),_e.autoPost=function(e,t){const n=new Date(globalThis.__ccNow??Date.now()).toISOString();(Array.isArray(e)?e:[e]).forEach(e=>f.useOwner.getState().sys(e,t,n))},_e.ensureChat=D,_e.useChatUnread=A,Object.defineProperty(_e,"DISPLAY_DEVICE_ID",{enumerable:!0,get:function(){return B}}),_e.chatSender=L,_e.Chat=function({go:e}){return(0,O.jsx)(z,{children:(0,O.jsx)(K,{go:e})})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),a=r(d[3]),o=r(d[4]),i=r(d[5]),l=r(d[6]),c=e(r(d[7])),h=e(r(d[8])),u=e(r(d[9])),m=r(d[10]),f=r(d[11]),p=r(d[12]),b=r(d[13]),x=r(d[14]),j=r(d[15]),y=r(d[16]),w=r(d[17]),C=r(d[18]),v=r(d[19]),S=r(d[20]),k=r(d[21]),O=r(d[22]);const R=(0,i.createContext)(null);function I(e){const t=(0,x.useCtx)(e),n=(0,i.useContext)(R);return n?{...t,meId:n.meId,role:n.role}:t}const T=[{id:'all',name:'Team',icon:'\ud83d\udce2'},{id:'kitchen',name:'Kitchen',icon:'\ud83c\udf73',pinned:!0},{id:'foh',name:'Front of house',icon:'\ud83c\udf7d\ufe0f'},{id:'managers',name:'Managers',icon:'\ud83d\udd11'}],M=[],P=e=>(e??'').replace(' (example)','');function D(e){if(a.LIVE_VENUE_BUILD)return;if(o.IS_WILDINGS)return;const t=f.useOwner.getState();if(t.chat.some(e=>'m-seed-all'===e.id&&/this phone only/.test(e.text??''))&&f.useOwner.getState().chatPatch('m-seed-all',{text:'Welcome to the team chat on CoverCharge.'}),t.chat.length)return;const n=(t,n,s,a={})=>{return{id:`m-seed-${t}`,ch:t,from:'system',text:s,at:(o=n,new Date(e.getTime()-6e4*o).toISOString()),reactions:{},seenBy:[],...a};var o};f.useOwner.setState({chat:[n('all',5,'Welcome to the team chat on CoverCharge.',{pinned:!0}),n('kitchen',4,'Kitchen channel: Head Chef, kitchen team and managers.'),n('foh',3,'Front of house channel: front of house, bar and managers.'),n('managers',2,'Managers channel: owners, managers and the supervisor only.')]})}function A(){const{meId:e}=I(3e4),{role:t}=I(3e4),n=(0,f.useOwner)(e=>e.chat),s=(0,f.useOwner)(e=>e.staff),a=(0,f.useOwner)(t=>t.chatMuted[e]??M),o=(0,i.useMemo)(()=>E(s,e,t),[s,e,t]);return(0,i.useMemo)(()=>{const t={};return n.forEach(n=>{n.removed||n.from===e||n.seenBy.includes(e)||!(0,w.inChannel)(n.ch,o)||(t[n.ch]=(t[n.ch]??0)+1)}),{by:t,total:Object.entries(t).filter(([e])=>!a.includes(e)).reduce((e,[,t])=>e+t,0)}},[n,e,a,o])}function E(e,t,n){if(t===j.CAR_DEVICE_ID)return{id:t,name:j.CAR_ACTOR,role:'owner',job:'',active:!0,level:'Owner',dept:''};if('display-device'===t)return{id:t,name:'Display',role:'owner',job:'',active:!0,level:'Owner',dept:''};const s=e.find(e=>e.id===t);return s||!t?s:{id:t,name:'You',role:n,job:'',active:!0,level:'owner'===n?'Owner':'manager'===n?'Manager':'Staff',dept:''}}const B='display-device';function L(e,t){return e===j.CAR_DEVICE_ID?{id:e,name:j.CAR_ACTOR,role:'owner',job:'',active:!0,level:'Owner',dept:''}:e===B?{id:e,name:'Display',role:'owner',job:'',active:!0,level:'Owner',dept:''}:t.find(t=>t.id===e)}class z extends i.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message??e)}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.err&&this.setState({err:null})}render(){return this.state.err?(0,O.jsxs)(u.default,{style:{gap:10},testID:"chat-error",children:[(0,O.jsx)(m.Banner,{kind:"warn",title:"Chat couldn\u2019t open",children:"Something went wrong showing this chat. Your messages are still saved on this phone. Go back and try again; if it keeps happening, close and reopen the app."}),(0,O.jsx)(m.Button,{kind:"secondary",label:"Back to chats",onPress:()=>{this.setState({err:null}),this.props.onBack?.()}})]}):this.props.children}}const $={owner:b.colours.gold,manager:b.colours.blue,staff:'#7a6f5c'};function _({s:e,size:t=34}){return e?(0,O.jsx)(y.StaffAvatar,{id:e.id,size:t}):(0,O.jsx)(u.default,{style:{width:t,height:t,borderRadius:t/2,backgroundColor:(0,n.soutersSurface)('#333'),alignItems:'center',justifyContent:'center'},children:(0,O.jsx)(m.T,{size:.38*t,weight:"bold",colour:"#111",children:"CC"})})}const N=[{caption:'Specials board',tone:'#4A3A22'},{caption:'Plating: Cullen skink',tone:'#3E2A2A'},{caption:'Delivery arrived',tone:'#40362A'},{caption:'Spillage by the bar',tone:'#2E2E40'}],W=['\ud83d\udc4d','\u2764\ufe0f','\ud83d\ude04','\ud83d\udc4f','\ud83d\udd25'];function H({ch:e,go:a,back:o}){const{now:j,meId:S,role:R,today:M}=I(1e4),D=(0,f.useOwner)(e=>e.staff),A=(0,f.useOwner)(e=>e.chat),E=(0,f.useOwner)(e=>e.shifts),B=(0,f.useOwner)(e=>e.leave),z=A.filter(t=>t.ch===e).sort((e,t)=>e.at.localeCompare(t.at)),[H,K]=(D.find(e=>e.id===S),(0,i.useState)('')),[V,U]=(0,i.useState)(null),[Y,q]=(0,i.useState)(!1),[F,G]=(0,i.useState)(!1),J=e.startsWith('dm:')?e.split(':').slice(1).length:D.filter(t=>t.active&&(0,w.inChannel)(e,t)).length;(0,i.useEffect)(()=>{const t=f.useOwner.getState().chat.some(t=>t.ch===e&&t.from!==S&&!t.seenBy.includes(S));f.useOwner.getState().chatSeen(e,S),t&&(0,v.markChatRead)(S,e)},[e,S,z.length]);const Q=t=>f.useOwner.getState().chatSend({ch:e,from:S,at:j.toISOString(),...t});(0,l.useBackLayer)(!0,o);const X=z.filter(e=>e.pinned&&!e.removed),Z=e.startsWith('dm:')?D.find(t=>t.id===e.split(':').slice(1).find(e=>e!==S)):void 0,ee=Z?.name.replace(' (example)','')??T.find(t=>t.id===e)?.name??'Private message',te=t.AVATAR_OPTIONS.find(t=>t.id===('kitchen'===e?'spatula':'bar'===e?'espresso-martini':'waves')),ne=(0,C.useChatSync)(e=>e.synced),se=(0,k.workingShifts)(E,B).filter(e=>e.staffId===S&&e.published&&e.date>=M).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,10);return(0,O.jsxs)(u.default,{style:{gap:8},children:[(0,O.jsxs)(u.default,{testID:"chat-thread-header",style:{gap:6,alignItems:'center'},children:[(0,O.jsx)(u.default,{style:{alignSelf:'flex-start'},children:(0,O.jsx)(l.BackButton,{onPress:o,testID:"chat-thread-back"})}),Z?(0,O.jsx)(y.StaffAvatar,{id:Z.id,size:88}):(0,O.jsx)(c.default,{testID:"chat-group-avatar",source:{uri:te.dataUrl},style:{width:88,height:88},accessibilityLabel:`${ee} group avatar`}),(0,O.jsx)(m.T,{center:!0,weight:"semibold",size:22,children:ee}),(0,O.jsxs)(m.Muted,{center:!0,children:[J," ",1===J?'member':'members']})]}),X.map(e=>(0,O.jsxs)(m.Card,{highlight:b.colours.gold,children:[(0,O.jsxs)(m.T,{size:12,colour:b.colours.gold,children:["\ud83d\udccc ",'system'===e.from?'Pinned note':`Pinned by ${P(D.find(t=>t.id===e.from)?.name)}`]}),(0,O.jsx)(m.T,{size:14,children:e.text})]},e.id)),z.map((t,s)=>{const o=L(t.from,D),i=t.from===S,l=t.seenBy.filter(e=>e!==t.from).length,c=0===s||t.at.slice(0,10)!==z[s-1].at.slice(0,10);return'system'===t.from?(0,O.jsxs)(u.default,{style:{alignItems:'center',gap:2},children:[c?(0,O.jsx)(m.Muted,{children:(0,p.niceDate)(new Date(t.at))}):null,(0,O.jsx)(u.default,{style:{backgroundColor:(0,n.soutersSurface)('#1c1a14'),borderRadius:10,paddingHorizontal:10,paddingVertical:5,borderWidth:1,borderColor:b.colours.border},children:(0,O.jsxs)(m.T,{size:13,colour:/Allergy|86|Sold out/.test(t.text??'')?b.colours.amber:b.colours.muted,children:["CoverCharge \xb7 ",t.text," \xb7 ",(0,p.hm)(new Date(t.at))]})})]},t.id):(0,O.jsxs)(u.default,{style:{gap:2},children:[c?(0,O.jsx)(m.Muted,{center:!0,children:(0,p.niceDate)(new Date(t.at))}):null,(0,O.jsxs)(m.Row,{style:{alignItems:'flex-start',flexDirection:i?'row-reverse':'row'},children:[(0,O.jsx)(_,{s:o}),(0,O.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:`Message from ${o?.name}`,onPress:()=>U(V===t.id?null:t.id),style:{maxWidth:'78%',backgroundColor:i?'#3a2f12':b.colours.surface,borderRadius:14,padding:9,borderWidth:1,borderColor:t.pinned?b.colours.gold:b.colours.border,gap:3},children:[(0,O.jsxs)(m.Row,{gap:6,children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:o?$[o.role]:b.colours.muted,children:P(o?.name)}),(0,O.jsxs)(m.T,{size:11,colour:b.colours.muted,children:[o?f.ROLE_LABEL[o.role]:''," \xb7 ",(0,p.hm)(new Date(t.at))]})]}),t.removed?(0,O.jsx)(m.T,{size:14,colour:b.colours.muted,children:"Message removed by the owner"}):(0,O.jsxs)(O.Fragment,{children:[t.photo?(0,O.jsx)(u.default,{style:{width:200,height:120,borderRadius:10,backgroundColor:t.photo.tone,justifyContent:'flex-end',padding:6},children:(0,O.jsxs)(m.T,{size:12,children:[t.photo.caption," (example image)"]})}):null,t.text?(0,O.jsx)(m.T,{size:15,children:t.text}):null,'cover'===t.action?(0,O.jsx)(m.Button,{small:!0,kind:"secondary",label:"Open cover requests on the rota",onPress:()=>a('more','rota')}):null]}),Object.entries(t.reactions).filter(([,e])=>e.length).length?(0,O.jsx)(m.Row,{wrap:!0,gap:4,children:Object.entries(t.reactions).filter(([,e])=>e.length).map(([e,t])=>(0,O.jsx)(u.default,{style:{borderRadius:10,paddingHorizontal:6,backgroundColor:t.includes(S)?'#4a3c16':'#222'},children:(0,O.jsxs)(m.T,{size:12,children:[e," ",t.length]})},e))}):null,i?(0,O.jsx)(m.T,{size:11,colour:b.colours.muted,children:l?`Seen by ${l}`:'Sent'}):null]})]}),V!==t.id||t.removed?null:(0,O.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:i?'flex-end':'flex-start',paddingLeft:i?0:40},children:[W.map(e=>(0,O.jsx)(h.default,{accessibilityLabel:`React ${e}`,onPress:()=>{f.useOwner.getState().chatReact(t.id,e,S),U(null)},style:{padding:4},children:(0,O.jsx)(m.T,{size:20,children:e})},e)),'staff'===R||e.startsWith('dm:')?null:(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:t.pinned?'Unpin':'Pin',onPress:()=>{f.useOwner.getState().chatPatch(t.id,{pinned:!t.pinned}),U(null)}}),'owner'!==R||i?null:(0,O.jsx)(m.Button,{small:!0,kind:"danger",label:"Remove",onPress:()=>{f.useOwner.getState().chatPatch(t.id,{removed:!0,pinned:!1}),U(null)}})]})]},t.id)}),(0,O.jsxs)(m.Row,{gap:6,children:[(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Send a photo",onPress:()=>q(!0),style:{padding:8},children:(0,O.jsx)(m.T,{size:20,children:"\ud83c\udf9e\ufe0f"})}),(0,O.jsx)(s.TextInput,{accessibilityLabel:"Message",placeholder:`Message ${ee}`,placeholderTextColor:"#7D776C",value:H,onChangeText:K,style:[m.styles.input,{flex:1,minWidth:0,width:0}]}),(0,O.jsx)(m.Button,{small:!0,label:"Send",disabled:!H.trim(),onPress:()=>{Q({text:H.trim()}),K('')}})]}),(0,O.jsx)(m.Row,{wrap:!0,gap:6,children:(0,O.jsx)(m.Button,{small:!0,kind:"secondary",label:"Ask for shift cover",onPress:()=>G(!0)})}),ne?null:(0,O.jsx)(m.Muted,{center:!0,children:"Not shared yet: this message stays on this phone only. Nobody else will see it."}),(0,O.jsx)(m.Sheet,{visible:Y,onClose:()=>q(!1),title:"Send a photo",children:(0,O.jsx)(m.Row,{wrap:!0,gap:8,children:N.map(e=>(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.caption,onPress:()=>{Q({photo:e}),q(!1)},style:{width:'47%',height:100,borderRadius:10,backgroundColor:e.tone,justifyContent:'flex-end',padding:6},children:(0,O.jsx)(m.T,{size:12,children:e.caption})},e.caption))})}),(0,O.jsxs)(m.Sheet,{visible:F,onClose:()=>G(!1),title:"Ask for shift cover",children:[se.length?null:(0,O.jsx)(m.Muted,{children:"You have no shifts on the rota this week."}),se.map(e=>(0,O.jsx)(m.Button,{kind:"secondary",label:`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`,onPress:()=>{const t=`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`;f.useOwner.getState().addSwap({shiftId:e.id,fromId:S,kind:'cover',note:`Cover asked in chat for ${t}`}),Q({text:`Can anyone cover my ${t} shift? I\u2019ve added a cover request on the rota.`,action:'cover'}),G(!1)}},e.id)),(0,O.jsx)(m.Muted,{children:"Creates a cover request in Rota \u203a Swaps & leave for a manager to approve."})]})]})}function K({go:e}){const{now:t,meId:s,role:a}=I(3e4),o=(0,f.useOwner)(e=>e.staff),l=(0,f.useOwner)(e=>e.chat),c=(0,f.useOwner)(e=>e.chatMuted[s]??M),{by:x,total:j}=A(),y=(0,C.useChatSync)(e=>e.synced),k=(0,C.useChatSync)(e=>e.error),R=(0,w.useKitchenExtra)(e=>e.extra),[B,$]=(0,i.useState)(null),[N,W]=(0,i.useState)(!1),[K,V]=(0,i.useState)(!1);(0,i.useEffect)(()=>{D(t)},[]),(0,i.useEffect)(()=>{$(null)},[s]);const U=(0,S.useChatOpen)(e=>e.ch);(0,i.useEffect)(()=>{if(!U)return;const e=U.startsWith('dm:')||T.some(e=>e.id===U)?U:null;e&&(0,w.inChannel)(e,E(o,s,a))&&$(e),S.useChatOpen.getState().request(void 0)},[U,s,a,o]);const Y=E(o,s,a);if(B)return(0,O.jsx)(z,{resetKey:B,onBack:()=>$(null),children:(0,O.jsx)(H,{ch:B,go:e,back:()=>$(null)})});const q=e=>l.filter(t=>t.ch===e).sort((e,t)=>t.at.localeCompare(e.at))[0],F=o.filter(e=>e.active&&e.id!==s).map(e=>{const t=(0,w.dmId)(s,e.id);return{x:e,id:t,u:x[t]??0,l:q(t)?.at??''}}).sort((e,t)=>t.u-e.u||t.l.localeCompare(e.l)||P(e.x.name).localeCompare(P(t.x.name))),G='owner'===a||'manager'===a,J=({id:e,name:t,icon:s,avatar:a})=>{const i=q(e),l=x[e]??0,f=c.includes(e);return(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:`Open ${t}`,onPress:()=>$(e),style:{padding:12,borderTopWidth:1,borderColor:b.colours.border},children:(0,O.jsxs)(m.Row,{children:[a?(0,O.jsx)(_,{s:a}):(0,O.jsx)(u.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:(0,n.soutersSurface)('#222'),alignItems:'center',justifyContent:'center'},children:(0,O.jsx)(m.T,{size:16,children:s})}),(0,O.jsxs)(u.default,{style:{flex:1},children:[(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{weight:l?'bold':'medium',children:[t,f?' \ud83d\udd15':'']}),i?(0,O.jsx)(m.Muted,{children:(0,p.hm)(new Date(i.at))}):null]}),(0,O.jsx)(m.Muted,{numberOfLines:1,children:i?i.removed?'Message removed':`${'system'===i.from?'CoverCharge':P(L(i.from,o)?.name)}: ${i.text??'Photo'}`:'No messages yet'})]}),l?(0,O.jsx)(u.default,{style:{backgroundColor:f?'#555':b.colours.red,borderRadius:10,minWidth:20,height:20,alignItems:'center',justifyContent:'center',paddingHorizontal:5},children:(0,O.jsx)(m.T,{size:11,weight:"bold",children:l})}):null]})})};return(0,O.jsxs)(u.default,{style:{gap:10},children:[y?(0,O.jsx)(u.default,{testID:"chat-synced",children:(0,O.jsx)(m.Muted,{children:"\u2713 Shared with the team: messages reach everyone in the chat on their own phone."})}):(0,O.jsx)(m.Banner,{kind:"warn",title:"On this device only for now",children:"You\u2019re not connected with your personal link (or chat sharing isn\u2019t switched on yet), so anything you send stays on this device and nobody else will see it. Open your personal invite link to share chat with the team. Use your usual group chat for anything urgent."}),y&&k?(0,O.jsx)(u.default,{testID:"chat-sync-error",children:(0,O.jsx)(m.Banner,{kind:"warn",title:"Can\u2019t reach the server right now",children:"Showing the messages on this phone. New messages will be sent and others\u2019 messages will appear when the connection is back; it retries automatically."})}):null,(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.Muted,{children:["Signed in as ",P(Y?.name)," (",'Head Chef'===Y?.level?'Head Chef':f.ROLE_LABEL[a],")"]}),(0,O.jsxs)(m.Row,{gap:6,children:[j||Object.keys(x).length?(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"chat-mark-all",accessibilityLabel:"Mark all chats as read",onPress:()=>(0,v.markChatRead)(s,'*')}):null,(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:"Chat settings",onPress:()=>V(!0)})]})]}),(0,O.jsxs)(u.default,{style:{borderRadius:14,borderWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface,overflow:'hidden'},children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{padding:10},children:"TEAM CHATS"}),T.filter(e=>'all'===e.id||(0,w.inChannel)(e.id,Y)).map(e=>(0,O.jsx)(J,{id:e.id,name:e.pinned?`${e.name} \ud83d\udccc`:e.name,icon:e.icon},e.id))]}),(0,O.jsxs)(u.default,{style:{borderRadius:14,borderWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface,overflow:'hidden'},children:[(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between',padding:10},children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:b.colours.gold,children:"PRIVATE MESSAGES"}),(0,O.jsx)(m.Button,{small:!0,kind:"success",label:"New message",testID:"chat-new-pm",onPress:()=>W(!0)})]}),F.map(e=>(0,O.jsx)(J,{id:e.id,name:P(e.x.name),avatar:e.x},e.id)),F.length?null:(0,O.jsx)(m.Muted,{style:{padding:10},children:"Nobody else on the team yet."})]}),(0,O.jsx)(m.Muted,{children:"Private messages can only be read by the two people in them; owners and managers can\u2019t read other people\u2019s private messages. The Kitchen chat is for owners, managers, head chefs and kitchen staff, and can\u2019t be left."}),(0,O.jsx)(m.Sheet,{visible:N,onClose:()=>W(!1),title:"New private message",children:o.filter(e=>e.active&&e.id!==s).map(e=>(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:`Message ${e.name}`,onPress:()=>{W(!1),$((0,w.dmId)(s,e.id))},style:{paddingVertical:8},children:(0,O.jsxs)(m.Row,{children:[(0,O.jsx)(_,{s:e}),(0,O.jsxs)(u.default,{children:[(0,O.jsx)(m.T,{children:P(e.name)}),(0,O.jsxs)(m.Muted,{children:[f.ROLE_LABEL[e.role]," \xb7 ",e.job]})]})]})},e.id))}),(0,O.jsxs)(m.Sheet,{visible:K,onClose:()=>V(!1),title:"Chat settings",children:[(0,O.jsx)(m.Banner,{kind:"info",title:"Privacy",children:"Chat is for work. Managers and the owner see messages in the channels they belong to and the owner can remove messages in group chats. Private messages can only be read by the two people in them: the server enforces this, so nobody else (not even the owner) can read them. Don\u2019t share customer card or health details beyond what\u2019s needed for service."}),(0,O.jsx)(m.T,{weight:"semibold",children:"Mute channels"}),T.filter(e=>(0,w.inChannel)(e.id,Y)).map(e=>(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{children:[e.icon," ",e.name]}),(0,O.jsx)(m.Toggle,{label:`Mute ${e.name}`,value:c.includes(e.id),onChange:()=>f.useOwner.getState().chatMute(s,e.id)})]},e.id)),(0,O.jsx)(m.Muted,{children:"Muted channels don\u2019t count towards the tab badge. The Kitchen chat can be muted but not left."}),G?(0,O.jsxs)(u.default,{style:{gap:6},testID:"kitchen-members",children:[(0,O.jsx)(m.T,{weight:"semibold",children:"Kitchen chat members"}),(0,O.jsxs)(m.Muted,{children:["Automatic: owners, managers, head chefs and kitchen staff (chefs, kitchen porters). Change who else is in it here",y?'':'; saved on this device for now',"."]}),o.filter(e=>e.active).map(e=>{const t=R[e.id]??(0,w.kitchenByRule)(e);return(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{children:[P(e.name),null!=R[e.id]?' (changed)':'']}),(0,O.jsx)(m.Toggle,{label:`Kitchen chat: ${P(e.name)}`,value:t,onChange:t=>w.useKitchenExtra.getState().set(e.id,t===(0,w.kitchenByRule)(e)?null:t)})]},e.id)})]}):null]})]})}},1007,[1068,887,873,842,5,31,993,197,264,128,817,861,821,824,998,1118,999,1326,1325,823,1446,1441,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return v}}),_e.AssistantFab=function(){const{role:e}=(0,w.useCtx)(6e4),t=(0,j.useAssistant)(e=>e.enabled);return R(e)&&t?(0,A.jsxs)(c.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>v.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:k.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,A.jsx)(M,{size:22}),(0,A.jsx)(b.T,{weight:"bold",colour:I,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=v(e=>e.open),o=()=>v.getState().setOpen(!1),{rid:a,role:p,me:C}=(0,w.useCtx)(3e4),S=(0,j.useAssistant)(),I=B(),[E,L]=(0,r.useState)([]),[W,z]=(0,r.useState)(''),[$,_]=(0,r.useState)(!1),N=(0,r.useRef)(null),F=(0,r.useRef)(null);if((0,r.useEffect)(()=>{setTimeout(()=>N.current?.scrollToEnd?.({animated:!0}),50)},[E.length]),!e||!R(p))return null;const H=(e,t,s)=>j.useAssistant.getState().record({at:(new Date).toISOString(),by:C,role:p,asked:e,action:t,outcome:s}),U=(e,t="result")=>L(s=>[...s,{id:D(),from:'assistant',text:e,kind:t}]),V=async e=>{const t=e.trim();if(!t)return;let s;z(''),L(e=>[...e,{id:D(),from:'you',text:t}]);try{s=await(0,y.getProvider)('xai').interpret(t,I)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&H(t,'\u2014','not understood'),L(e=>[...e,{id:D(),from:'assistant',proposal:s,state:'open',asked:t}])},G=(e,t)=>L(s=>s.map(s=>s.id===e?{...s,state:t}:s)),q=async(e,t,n)=>{if(G(e.id,'confirmed'),'external'===t.kind)return H(e.asked,`${t.title}: \u201c${(n??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void U(T,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await m.repo.bookings.seatWalkIn(a,Number(o.party),s,'Added by Assistant'),s&&(0,f.resetTableLive)(a,s),U(`Done: Walk-in \xb7 ${o.party} seated${s?` at table ${s}`:' (table to assign)'}. It's in Bookings now.`),H(e.asked,t.title,'done');break}case'eightysix':(0,s.setSoldOut)(String(o.itemId),Boolean(o.soldOut)),U(o.soldOut?`Done: ${o.name} is marked sold out. Staff see it on the Display.`:`Done: ${o.name} is back on.`),H(e.asked,t.title,'done');break;case'price':await m.repo.menu.updateItem(String(o.itemId),{price:Number(o.pence)}),U(`Done: ${o.name} is now \xa3${(Number(o.pence)/100).toFixed(2)}.`),H(e.asked,t.title,'done');break;case'offer':x.useOwner.getState().addOffer({title:String(o.title),body:String(o.body),kind:'offer',live:!1}),U(`Done: draft offer \u201c${o.title}\u201d saved in Offers & specials (not live).`),H(e.asked,t.title,'done');break;case'rota':case'bookings':U(String(o.result)),H(e.asked,t.title,'looked up')}},Y=e=>{G(e.id,'cancelled'),H(e.asked,e.proposal?.title??'\u2014','cancelled'),U('Cancelled. Nothing was changed.','note')},K='lite'===S.tier,J=(0,j.tasksUsed)(S);return(0,A.jsx)(l.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:o,children:(0,A.jsx)(h.default,{style:[b.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,A.jsxs)(h.default,{testID:"assistant-sheet",style:{backgroundColor:k.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:k.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,A.jsxs)(b.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(b.Row,{gap:8,style:{flex:1},children:[(0,A.jsx)(h.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,A.jsx)(M,{size:18})}),(0,A.jsx)(b.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,A.jsx)(n.GoldClose,{testID:"assistant-close",onPress:o,style:{marginRight:-6}})]}),(0,A.jsx)(h.default,{testID:"assistant-demo-badge",children:(0,A.jsx)(b.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),K?(0,A.jsxs)(h.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,A.jsx)(b.Banner,{kind:"info",title:"The Assistant is switched off in this preview",children:"Ask for things in plain English \u2014 add a walk-in, mark a dish sold out, check the rota, draft posts and replies \u2014 and confirm each one before anything happens. To use it, turn off the preview switch in More \u203a Account \u203a Assistant settings."}),(0,A.jsx)(b.Button,{kind:"secondary",label:"Close",onPress:o})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(u.default,{ref:N,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===E.length?(0,A.jsxs)(h.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,A.jsxs)(b.T,{children:["Hi ",C.split(' ')[0]," \u2014 what can I do? I\u2019ll always show you what I\u2019m about to do and wait for you to confirm."]}),(0,A.jsx)(b.Muted,{children:"Try:"}),y.SUGGESTED_PROMPTS.map(e=>(0,A.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>V(e),style:{borderWidth:1,borderColor:k.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:k.colours.surface2},children:(0,A.jsx)(b.T,{size:14,children:e})},e))]}):null,E.map(e=>'you'===e.from?(0,A.jsx)(h.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,A.jsx)(b.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,A.jsx)(P,{m:e,onConfirm:(t,s)=>q(e,t,s),onCancel:()=>Y(e)},e.id):'choose'===e.proposal.kind?(0,A.jsxs)(h.default,{style:{gap:6},children:[(0,A.jsx)(b.T,{children:e.proposal.message}),(0,A.jsx)(b.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,A.jsx)(b.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>V(e.prompt)},e.label))})]},e.id):(0,A.jsxs)(h.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,A.jsx)(b.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,A.jsx)(c.default,{accessibilityRole:"button",onPress:()=>V(e),style:{borderWidth:1,borderColor:k.colours.border,borderRadius:12,padding:8},children:(0,A.jsx)(b.T,{size:14,children:e})},e))]},e.id):(0,A.jsx)(h.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?k.colours.amberBg:k.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:k.colours.amber},children:(0,A.jsx)(b.T,{children:e.text})},e.id))]}),(0,A.jsxs)(b.Row,{gap:8,children:[(0,A.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:W,onChangeText:z,onSubmitEditing:()=>V(W),returnKeyType:"send",style:[b.styles.input,{flex:1,minWidth:0,width:40}]}),S.voice?(0,A.jsx)(c.default,{testID:"assistant-mic",accessibilityRole:"button",accessibilityLabel:$?'Stop listening':'Speak',onPress:()=>{const e=O();if(e)if($)F.current?.stop?.();else try{const t=new e;F.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&z(t)},t.onend=()=>_(!1),t.onerror=()=>{_(!1),U("Sorry, I didn't catch that. You can type instead.",'note')},_(!0),t.start()}catch{_(!1),U("Voice input isn't available here. Please type instead.",'note')}else U("Voice input isn't available in this browser (for example Huawei Browser). Please type your request instead.",'note')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:$?k.colours.gold:'transparent'},children:(0,A.jsx)(b.T,{size:20,children:"\ud83c\udfa4"})}):null,(0,A.jsx)(b.Button,{label:"Send",accessibilityLabel:"Send",disabled:!W.trim(),onPress:()=>V(W)})]}),(0,A.jsxs)(b.Muted,{center:!0,children:["Demo on this device \xb7 ",J," of ",j.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,w.useCtx)(6e4),s=(0,j.useAssistant)();return R(t)?(0,A.jsxs)(h.default,{style:{gap:12},children:[(0,A.jsxs)(b.Card,{children:[(0,A.jsxs)(b.Row,{gap:10,children:[(0,A.jsx)(h.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,A.jsx)(M,{size:22})}),(0,A.jsxs)(h.default,{style:{flex:1},children:[(0,A.jsx)(b.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,A.jsx)(b.Muted,{children:"Add walk-ins, mark dishes sold out, change prices, check the rota or bookings, draft offers, posts and replies. You confirm every action."})]})]}),(0,A.jsx)(b.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>v.getState().setOpen(!0)}),(0,A.jsx)(b.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,A.jsxs)(h.default,{testID:"assistant-log",style:{gap:6},children:[(0,A.jsxs)(b.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(b.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,A.jsx)(b.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>j.useAssistant.getState().clearLog()}):null]}),(0,A.jsx)(b.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,A.jsx)(b.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,A.jsxs)(h.default,{style:{borderWidth:1,borderColor:k.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,A.jsxs)(b.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(b.T,{size:12,colour:k.colours.muted,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,")"]}),(0,A.jsx)(b.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,A.jsxs)(b.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,A.jsxs)(b.T,{size:13,colour:k.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,A.jsx)(b.Muted,{children:"The activity log is visible to the owner."})]}):(0,A.jsx)(b.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,w.useCtx)(6e4),t=(0,j.useAssistant)();return R(e)?(0,A.jsxs)(h.default,{style:{gap:12},testID:"assistant-settings",children:[(0,A.jsxs)(b.Card,{children:[(0,A.jsx)(b.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,A.jsx)(b.Muted,{children:"Shows the gold Assistant button on every Managers screen."}),(0,A.jsx)(b.Toggle,{label:"Voice input (microphone)",value:t.voice,onChange:e=>t.set({voice:e})}),(0,A.jsx)(b.Muted,{children:"What you say is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio. If this device can\u2019t record, just type."})]}),(0,A.jsxs)(b.Card,{children:[(0,A.jsx)(b.T,{weight:"semibold",children:"Connected services"}),E.map(e=>(0,A.jsxs)(h.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:k.colours.border,paddingTop:8},children:[(0,A.jsxs)(b.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(b.T,{children:e.name}),(0,A.jsx)(b.Badge,{kind:"neutral",label:"Not connected"})]}),(0,A.jsxs)(b.Muted,{children:["Needed for ",e.does,". Until it\u2019s connected, the Assistant only shows you a preview \u2014 nothing is sent or changed."]})]},e.id)),(0,A.jsx)(b.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,A.jsxs)(b.Card,{children:[(0,A.jsx)(b.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,A.jsx)(b.Muted,{children:"The Assistant comes with Full Restaurant Pro App and the early adopter offer. It isn\u2019t part of Customer & Takeaway App. This switch only shows how the app looks with it switched off."})]}):null,(0,A.jsx)(b.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to the voice assistant to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,A.jsx)(b.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,j.useAssistant)(),t=(0,j.tasksUsed)(e),s=Math.min(1,t/j.FAIR_USE);return(0,A.jsxs)(b.Card,{children:[(0,A.jsxs)(b.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(b.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,A.jsx)(b.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,A.jsx)(h.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${j.FAIR_USE} tasks used`,style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,A.jsx)(h.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:k.colours.gold,borderRadius:4}})}),(0,A.jsxs)(b.Muted,{children:[t," of ",j.FAIR_USE," tasks used this month (mock). A task is one confirmed action or look-up."]})]})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),o=_r(d[3]),a=_r(d[4]),r=_r(d[5]),l=e(_r(d[6]));_r(d[7]);var c=e(_r(d[8])),u=e(_r(d[9])),h=e(_r(d[10])),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),m=_r(d[14]),x=_r(d[15]),y=_r(d[16]),j=_r(d[17]),k=_r(d[18]),w=_r(d[19]),C=_r(d[20]),A=_r(d[21]);const S=!0,T='Nothing was sent or changed: this connection is not set up yet.',I='#1A1408',v=(0,p.create)(e=>({open:!1,setOpen:t=>e({open:t})})),R=e=>'owner'===e||'manager'===e,D=()=>Math.random().toString(36).slice(2,9);function M({size:e=24,colour:t=I}){return(0,A.jsx)(b.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function B(){const{rid:e,r:t,now:s,today:n}=(0,w.useCtx)(3e4),a=(0,m.useAllMenu)(e),l=(0,f.useTableNames)(e),c=(0,m.useBookings)(e),u=(0,x.useOwner)(e=>e.staff),h=(0,x.useOwner)(e=>e.shifts),p=(0,x.useOwner)(e=>e.offers),b=(0,x.useOwner)(e=>e.suppliers);return(0,r.useMemo)(()=>({venue:t.name,now:s.toISOString(),menu:a.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:l,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:(0,C.workingShifts)(h,x.useOwner.getState().leave).filter(e=>e.published&&e.date>=(0,x.addDays)(n,-(0,x.weekdayOf)(n))&&e.date<=(0,x.addDays)(n,6-(0,x.weekdayOf)(n))),bookingsToday:c.filter(e=>e.date===n).sort((e,t)=>e.time.localeCompare(t.time)).map(e=>({name:e.walkIn?'Walk-in':e.name,party:e.partySize,time:e.time,table:e.table,status:e.status})),specials:p.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,o.examplesAllowed)()?{from:`${b[0]?.contact??'Alex Sample'}, ${b[0]?.name??'Example Fish Co.'}`,subject:'Price update for next week (example)',body:'Langoustine is up about 8% next week because of the weather. Haddock and hake unchanged. Same delivery days.'}:null}),[t,s.getMinutes(),a,l,c,u,h,p,b])}function P({m:e,onConfirm:s,onCancel:n}){const o=e.proposal,[a,l]=(0,r.useState)(!1),[c,u]=(0,r.useState)('external'===o.kind?o.text:''),p='open'===e.state;return'inapp'!==o.kind&&'external'!==o.kind?null:(0,A.jsxs)(h.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:p?k.colours.gold:k.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:k.colours.surface2},children:[(0,A.jsxs)(b.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(b.T,{weight:"semibold",style:{flex:1},children:o.title}),'external'===o.kind?(0,A.jsx)(b.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,A.jsx)(b.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===o.kind?(0,A.jsxs)(h.default,{style:{gap:6},children:[o.detail?(0,A.jsx)(b.Muted,{children:o.detail}):null,(0,A.jsx)(b.T,{size:14,colour:k.colours.muted,children:o.label}),a&&p?(0,A.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:c,onChangeText:u,style:[b.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,A.jsx)(h.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:k.colours.gold,paddingLeft:10},children:(0,A.jsxs)(b.T,{children:["\u201c",c,"\u201d"]})}),(0,A.jsxs)(b.Muted,{children:["Sends to: ",o.service.map(e=>y.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,A.jsxs)(h.default,{style:{gap:4},children:[(0,A.jsx)(b.Muted,{children:o.detail}),o.warning?(0,A.jsxs)(b.T,{size:13,colour:k.colours.amber,children:["\u26a0 ",o.warning]}):null]}),p?(0,A.jsxs)(b.Row,{wrap:!0,gap:8,children:[(0,A.jsx)(b.Button,{small:!0,label:'inapp'===o.kind?o.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(o,c)}),'external'===o.kind?(0,A.jsx)(b.Button,{small:!0,kind:"secondary",label:a?'Done editing':'Edit',testID:"edit-action",onPress:()=>l(!a)}):null,(0,A.jsx)(b.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,A.jsx)(b.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),p?(0,A.jsxs)(b.Muted,{children:["Nothing happens until you tap ",'inapp'===o.kind?o.confirmLabel:'Confirm',"."]}):null]})}function O(){return'undefined'==typeof window?null:(0,a.speechRecognizer)()}const E=[{id:'facebook',name:'Facebook (Page & Messenger)',does:'posts and the Messenger auto-reply'},{id:'instagram',name:'Instagram',does:'posts'},{id:'gmail',name:'Gmail',does:'drafting and replying to email'},{id:'wix',name:'Website bookings',does:'website changes such as opening hours'}]},1008,[873,992,835,1112,1133,31,257,123,264,152,128,1072,817,1043,822,861,1648,1119,824,998,1441,25]); +__d(function(g,r,i,a,_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()})}},1009,[805,31,288,128,1072,807,998,1132,25]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1010,[811,990,31,123,264,128,1017,822,824,817,1525,1208,1012,25]); +__d(function(g,_r,_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.']}]},1011,[873,31,123,264,128,817,822,828,1610,824,1611,1613,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},1012,[1526,1527,1529,1528,1530,1120,1531]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},1013,[31,807,1107]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1014,[1072]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SNOOZE_MINS",{enumerable:!0,get:function(){return S}}),e.useScheduledNotices=function({rid:u,staffId:S,name:w,onOpen:D}){const I=(0,t.useRef)(w);I.current=w;const N=(0,t.useRef)(D);N.current=D,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.location?.search)return;const t=new URLSearchParams(window.location.search);if('orderlists'===t.get('open'))o.useListOpen.getState().request(t.get('list')??void 0),setTimeout(()=>N.current?.('orderlists'),0);else if('chat'===t.get('open'))c.useChatOpen.getState().request(t.get('ch')??void 0),setTimeout(()=>N.current?.('chat'),0);else{const s=t.get('open');s&&v.includes(s)&&setTimeout(()=>N.current?.(s),0)}},[]);const O=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),b=(0,d.useReminders)(t=>t.done.length);(0,t.useEffect)(()=>{s.useNotifs.getState().ensure(u);const t=()=>{const t=h(),c=s.useNotifs.getState(),v=n.useOwner.getState().staff.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),w=v.filter(s=>!1!==s.active&&(0,p.shiftNow)(s.id,t).on).map(t=>t.id);for(const n of c.items){if(n.rid!==u)continue;const p=`sched:${n.id}`;if(!S||n.removed||n.paused||!n.sendBy.inApp||!(0,f.isRecipient)(n,S,v,w)){(0,l.dismissNotice)(p);continue}const{due:D,forDate:O}=(0,f.notifDue)(n,t),b=d.useReminders.getState().done.find(t=>t.reminderId===n.id&&t.forDate===O),R=`sched:${n.id}:${O}`;!D||b||(c.snooze[R]??0)>t?(0,l.dismissNotice)(p):(0,l.notify)({id:p,icon:'\ud83d\udd14',kicker:'NOTICE',title:n.title,body:n.message,testID:'sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'sched-notice-done',onPress:()=>d.useReminders.getState().markDone({rid:u,reminderId:n.id,forDate:O,at:new Date(h()).toISOString(),staffRef:S,staffName:I.current.replace(' (example)','')})},...'orderlists'===n.open?.page&&N.current?[{label:'Open list',testID:'sched-notice-open',onPress:()=>{o.useListOpen.getState().request(n.open?.list),N.current?.('orderlists')}}]:[],{label:'Later',kind:'ghost',testID:'sched-notice-later',onPress:()=>s.useNotifs.getState().setSnooze(R,h()+9e5)}]})}};t();const c=setInterval(t,2e4);return()=>clearInterval(c)},[u,S,O,b])};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),u=r(_d[6]),f=r(_d[7]),l=r(_d[8]),p=r(_d[9]);const h=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock).getTime()}catch{return Date.now()}},S=15,v=['bookings','rota','notifications','chat']},1015,[31,1053,861,1062,1446,1051,878,1061,1066,1042]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1016,[868,31,1064,861,878,869,1052,870,1066,1439]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n.default}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=(t=e)&&t.__esModule?t:{default:t}},1017,[1349]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},1018,[811,1433,1142,1448,31,128,1072,817,822,831,832,813,821,824,1154,1023,1503,25]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LastFoodBanner=function({rid:e,now:o,big:c}){const f=(0,l.useRestaurant)(e),h=u(o),$=(0,l.useEvents)(e).filter(e=>e.date===h&&'regular'===e.source),b=f?(0,s.lastFoodOn)(f,h):null;if(!b)return null;const T=new Date(`${h}T${b.time}:00`),p=Math.round((T.getTime()-o.getTime())/6e4),_=$[0],j=_?`${_.title}${_.time?` from ${(0,s.fmt12)(_.time)}`:''}`:'';if(p>90&&!_)return null;if(p<-60)return null;const w=p>=0&&p<=15,x=p<0,D=w?n.colours.redBg:x?n.colours.surface2:n.colours.goldTint,F=w?n.colours.red:x?n.colours.hairline:n.colours.accentBorder,M=w?'#FFD9D4':x?n.colours.muted:n.colours.goldLight,y=c?1.3:1,B=x?`Kitchen closed for food \xb7 last orders were ${(0,s.fmt12)(b.time)}`:w?`Last food orders in ${Math.max(0,p)} min (${(0,s.fmt12)(b.time)})`:`Last food orders ${(0,s.fmt12)(b.time)}`;return(0,d.jsxs)(t.default,{testID:w?'last-food-warning':'last-food-banner',accessibilityRole:"text",style:{borderRadius:14,borderWidth:w?2:1,borderColor:F,backgroundColor:D,paddingVertical:10*y,paddingHorizontal:14,gap:2},children:[(0,d.jsxs)(r.T,{size:17*y,weight:"bold",colour:M,children:[w?'\u23f0 ':'\ud83c\udf7d ',B]}),j||'kitchen closes'!==b.reason?(0,d.jsx)(r.T,{size:13*y,colour:n.colours.muted,children:[j?`Tonight: ${j}`:'','kitchen closes'!==b.reason&&b.reason!==_?.title?`Early last orders (${b.reason})`:''].filter(Boolean).join(' \xb7 ')}):null]})},_r(_d[0]);var e,o=_r(_d[1]),t=(e=o)&&e.__esModule?e:{default:e},r=_r(_d[2]),l=_r(_d[3]),s=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]);const u=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},1019,[31,128,817,822,813,824,25]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useNextFree=j,_e.NextTableFreeCard=function({rid:e,now:s,big:r,always:d}){const u=(0,n.useRestaurant)(e),c=j(e,s);if(!u||!c||!(0,h.nextTableOn)(u))return null;if(!c.full&&!d)return null;const T=c.list.slice(0,3),w=c.waitFor(2),p=c.waitFor(4),y=(0,h.lastFoodOn)(u,x(s)),M=r?1.25:1,F=(e,r)=>(0,g.jsxs)(l.default,{style:{flex:1,borderRadius:12,borderWidth:1,borderColor:f.colours.hairline,backgroundColor:f.colours.tile,padding:10},testID:`wait-for-${e}`,children:[(0,g.jsxs)(o.Muted,{children:["Wait for ",e]}),(0,g.jsx)(o.T,{size:20*M,weight:"bold",colour:f.colours.goldLight,children:r?`About ${Math.max(5,Math.round((r.at.getTime()-s.getTime())/6e4))} min`:'\u2014'}),(0,g.jsx)(o.Muted,{children:r?`${(0,t.tableNumbers)(r.table)} \xb7 ${r.confidence}`:'nothing due yet'})]});return(0,g.jsxs)(l.default,{testID:"next-table-free",accessibilityRole:"summary",style:{borderRadius:16,borderWidth:1,borderColor:f.colours.accentBorder,backgroundColor:f.colours.surface,padding:14,gap:8},children:[(0,g.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(o.T,{size:12,weight:"semibold",colour:f.colours.goldMuted,style:{letterSpacing:1.4},children:c.full?'FULL \xb7 NEXT TABLE FREE':'NEXT TABLE FREE'}),(0,g.jsx)(o.Badge,{kind:"amber",label:"ESTIMATE"})]}),T.length?(0,g.jsxs)(o.T,{size:22*M,weight:"bold",children:["About ",(0,b.hhmm)(T[0].at)," ",(0,g.jsxs)(o.T,{size:16*M,colour:f.colours.muted,children:["(",(0,t.tableNumbers)(T[0].table),", ",T[0].seats," seats \xb7 ",T[0].confidence,")"]})]}):(0,g.jsx)(o.T,{size:18*M,weight:"semibold",children:c.freeNow.length?`Free now: ${c.freeNow.map(e=>`${(0,t.tableNumbers)(e)}`).join(', ')}`:'No table due to free up before its next booking'}),T.slice(1).map(e=>(0,g.jsxs)(o.Muted,{children:["Then about ",(0,b.hhmm)(e.at)," \xb7 ",(0,t.tableNumbers)(e.table)," (",e.seats," seats) \xb7 ",e.confidence," \xb7 ",e.why]},e.table)),T[0]?(0,g.jsxs)(o.Muted,{children:[(0,t.tableNumbers)(T[0].table),": ",T[0].why,"."]}):null,(0,g.jsxs)(o.Row,{gap:8,children:[F(2,w),F(4,p)]}),T.some(e=>e.drinksOnly)&&y?(0,g.jsxs)(o.T,{size:13,colour:f.colours.amber,children:["After last food orders (",(0,h.fmt12)(y.time),") a table is for drinks only."]}):null,(0,g.jsx)(o.Muted,{children:"Tap Bill requested or Table finished on the plan and this updates straight away."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),l=(e=r)&&e.__esModule?e:{default:e},o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),u=_r(_d[6]),c=_r(_d[7]),b=_r(_d[8]),h=_r(_d[9]),f=_r(_d[10]),g=_r(_d[11]);const x=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,T=e=>(0,b.hhmm)(e);function j(e,t){const r=(0,n.useRestaurant)(e),l=(0,u.usePlan)(e),o=(0,n.useBookings)(e),h=(0,n.useOrders)(e),f=(0,u.useFloor)(t=>t.live[e]),g=(0,d.useBlocks)(e=>e.blocks),j=t.getTime()/6e4|0;return(0,s.useMemo)(()=>{if(!r)return null;const s=x(t),n=(0,d.closedAreasAt)(g,e,s,T(t)),u=(0,c.floorView)(l,o,h,f??{},t,r.settings.turnMins,n);return(0,b.nextTablesFree)(r,u,o.filter(e=>e.date===s),t,o)},[r,l,o,h,f,g,j])}},1020,[811,31,128,817,822,827,828,829,1443,813,824,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1021,[31,264,1494,817,824,25]); +__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])},1022,[1096,998]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenBar=p,_e.NeedsPills=k,_e.BookingNeeds=x,Object.defineProperty(_e,"needsIcons",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"confirmHolds",{enumerable:!0,get:function(){return S}}),_e.serveHolds=y,_e.postNewBookingToKitchen=function(e,t){if(!t||'system'===t)return;const s=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),l=[],r=`${e.name}, ${(0,c.niceDate)((0,c.parseYmd)(e.date)).slice(0,3)} ${e.time}${e.table?`, table ${e.table}`:''}`;if((e.holds??[]).filter(e=>e.qty>0).length){const t=I(e.restaurantId);l.push(`${(0,u.holdsText)(e,(0,u.reservablesOf)(s),t)} reserved: ${r}. Tap Platter OK in the Head Chef app.`)}(0,u.hasAllergens)(e)&&l.push(`\u26a0\ufe0f Allergens: ${(0,u.allergenText)(e)} \u2014 ${r}. Please sign \u2018Allergens seen\u2019.`);if(!l.length)return;a.useOwner.getState().chatSend({ch:'kitchen',from:t,text:l.join('\n'),at:(new Date).toISOString()})},_e.useKitchenTodo=D,_e.KitchenSignoffs=function({rid:t,today:s,by:a,app:f,canConfirm:p=!0,showAll:k}){const j=D(t,s),I=(0,o.useBookings)(t),T=(0,o.useRestaurant)(t),O=(0,n.useStockItems)(t),$=(0,u.reservablesOf)(T),A=I.filter(e=>e.date===s&&!['cancelled','noshow'].includes(e.status)&&(e.holds??[]).some(e=>e.qty>0)),C=k?[...j,...A.filter(e=>!j.includes(e))]:j;return C.length?(0,b.jsxs)(l.default,{testID:"kitchen-signoffs",style:{gap:10,padding:16,borderRadius:16,borderWidth:1.5,borderColor:j.length?h.colours.amber:h.colours.hairline,backgroundColor:h.colours.surface},children:[(0,b.jsx)(r.T,{size:12,weight:"semibold",colour:j.length?h.colours.amber:h.colours.goldMuted,style:{letterSpacing:1.6},children:j.length?`KITCHEN SIGN-OFF NEEDED (${j.length})`:'RESERVED TODAY'}),C.map(t=>(0,b.jsxs)(l.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:h.colours.hairline},testID:`signoff-${t.ref}`,children:[(0,b.jsxs)(r.T,{weight:"semibold",children:[t.name," \xb7 ",t.partySize," Covers \xb7 ",t.date===s?'Today':(0,c.niceDate)((0,c.parseYmd)(t.date))," ",t.time,t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:'']}),(0,b.jsx)(x,{b:t}),p?(0,b.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,u.needsAllergenSeen)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"danger",label:"Allergens seen",testID:`allergens-seen-${t.ref}`,onPress:()=>o.useStore.getState().ackBookingAllergy(t.id,a)}):null,(0,u.needsHoldOk)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"success",label:/platter/i.test((0,u.holdsText)(t,$,O))?'Platter OK':'Reservation OK',testID:`platter-ok-${t.ref}`,onPress:()=>S(t.id,a)}):null,t.date===s&&t.holdOk&&(t.holds??[]).some(e=>!e.served)&&['seated','confirmed'].includes(t.status)?(0,b.jsx)(r.Button,{small:!0,kind:"secondary",label:"Served",testID:`served-${t.ref}`,onPress:()=>y(t,a,f)}):null]}):(0,b.jsx)(r.Muted,{children:"The kitchen signs these off."})]},t.id))]}):null},_e.PlattersBooked=function({rid:e,date:t,label:s}){const a=(0,o.useBookings)(e),c=(0,o.useRestaurant)(e),f=(0,n.useStockItems)(e),p=(0,u.heldSummary)(a,t,(0,u.reservablesOf)(c)),k=Object.entries(p.stock).filter(([,e])=>e>0).map(([e,t])=>`${t} ${(f.find(t=>t.key===e)?.name??e).toLowerCase()}`);return p.platters||k.length?(0,b.jsx)(l.default,{testID:"platters-booked",children:(0,b.jsxs)(r.T,{weight:"semibold",colour:h.colours.goldLight,children:[s??'Platters booked',": ",p.platters,k.length?` (${k.join(', ')})`:'']})}):null};var e=_r(d[0]);_r(d[1]);var t,s=_r(d[2]),l=(t=s)&&t.__esModule?t:{default:t},r=_r(d[3]),o=_r(d[4]),n=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);const f=({label:e,bg:t,fg:s,border:o,testID:n})=>(0,b.jsx)(l.default,{testID:n,style:{backgroundColor:t,borderColor:o,borderWidth:1,borderRadius:999,paddingHorizontal:9,paddingVertical:2},children:(0,b.jsx)(r.T,{size:13,weight:"semibold",colour:s,children:e})});function p({b:e,big:t}){return(0,u.hasAllergens)(e)?(0,b.jsxs)(l.default,{testID:`allergen-bar-${e.ref}`,style:{backgroundColor:h.colours.redSolid,borderRadius:10,paddingHorizontal:10,paddingVertical:t?8:5,gap:2},children:[(0,b.jsxs)(r.T,{size:t?16:13,weight:"bold",colour:"#FFFFFF",children:["\u26a0\ufe0f ALLERGENS: ",(0,u.allergenText)(e)]}),e.allergyAck?(0,b.jsxs)(r.T,{size:12,colour:"#FFE3DF",children:["Seen by kitchen: ",e.allergyAck.by]}):(0,b.jsx)(r.T,{size:12,colour:"#FFE3DF",children:"Kitchen hasn\u2019t signed \u2018Allergens seen\u2019 yet"})]}):null}function k({b:t,r:s}){const l=(0,n.useStockItems)(t.restaurantId),o=(0,u.reservablesOf)(s),a=(t.holds??[]).some(e=>e.qty>0),c=[];return t.drinksOnly&&c.push((0,b.jsx)(f,{testID:"pill-drinks",label:"\ud83c\udf77 Drinks only (after last food orders)",bg:h.colours.surface2,fg:h.colours.goldLight,border:h.colours.accentBorder},"x")),(0,u.hasAccess)(t)&&c.push((0,b.jsx)(f,{testID:"pill-access",label:`\u267f ${(0,u.accessText)(t)}`,bg:h.colours.blueBg,fg:"#E2C489",border:h.colours.blue},"a")),(0,u.dogCount)(t)&&c.push((0,b.jsx)(f,{testID:"pill-dog",label:"\ud83d\udc15 "+((0,u.dogCount)(t)>1?`${(0,u.dogCount)(t)} dogs`:'Dog'),bg:h.colours.surface2,fg:h.colours.text,border:h.colours.hairline},"d")),(0,u.dietText)(t)&&c.push((0,b.jsx)(f,{testID:"pill-veg",label:`\u24cb ${(0,u.dietText)(t)}`,bg:"#2A2216",fg:"#E2C489",border:"#CFA45F"},"v")),a&&c.push(t.holdOk?(0,b.jsx)(f,{testID:"pill-platter",label:`\u2713 ${(0,u.holdsText)(t,o,l)} \xb7 confirmed`,bg:h.colours.okBg,fg:"#E2C489",border:h.colours.ok},"h"):(0,b.jsx)(f,{testID:"pill-platter",label:`\ud83e\udd9e ${(0,u.holdsText)(t,o,l)} \xb7 awaiting kitchen`,bg:h.colours.amberBg,fg:"#FFE2A8",border:h.colours.amber},"h")),t.tableReq?.length&&c.push((0,b.jsx)(f,{testID:"pill-request",label:`Requested: ${t.tableReq.map(t=>`${(0,e.tableNumbers)(t)}`).join(' or ')}`,bg:h.colours.goldTint,fg:h.colours.goldLight,border:h.colours.accentBorder},"t")),c.length?(0,b.jsx)(r.Row,{wrap:!0,gap:6,children:c}):null}function x({b:e,big:t}){const s=(0,o.useRestaurant)(e.restaurantId);return(0,b.jsxs)(l.default,{style:{gap:6},children:[(0,b.jsx)(p,{b:e,big:t}),(0,b.jsx)(k,{b:e,r:s})]})}const j=e=>[(0,u.hasAllergens)(e)?'\u26a0\ufe0f':'',(0,u.hasAccess)(e)?'\u267f':'',(0,u.dogCount)(e)?'\ud83d\udc15':'',(0,u.dietText)(e)?'\u24cb':'',(e.holds??[]).some(e=>e.qty>0)?e.holdOk?'\ud83e\udd9e\u2713':'\ud83e\udd9e':''].filter(Boolean).join(' '),S=(e,t)=>o.useStore.getState().updateBooking(e,{holdOk:{by:t,at:(new Date).toISOString()}});function y(e,t,s){const l=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),r=(0,u.stockNeed)(e,(0,u.reservablesOf)(l));for(const[l,o]of Object.entries(r))o>0&&n.shellfish.append({rid:e.restaurantId,kind:l,delta:-o,reason:'sold',by:t,app:s});const a=(new Date).toISOString();o.useStore.getState().updateBooking(e.id,{holds:(e.holds??[]).map(e=>e.served?e:{...e,served:{by:t,at:a}})})}const I=e=>n.useShellStore.getState().items[e]??[];function D(e,t){return(0,o.useBookings)(e).filter(e=>e.date>=t&&!e.walkIn&&((0,u.needsAllergenSeen)(e)||(0,u.needsHoldOk)(e))).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time))}},1023,[811,31,128,817,822,1292,861,831,821,824,25]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysYmd",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"displayName",{enumerable:!0,get:function(){return o}}),e.isOpenBreak=a,e.openWorkingRows=s,e.workingNow=function(n,t,u){const d=new Map(t.map(n=>[n.id,n]));return s(n,u).flatMap(n=>{const t=d.get(n.staffId)?.name,s=t?o(t):'';if(!s)return[];const c=n.date===u?r(n.in):`${r(n.in)} yesterday`,f=a(n),p=f?`${s}, signed in at ${c}, on break`:`${s}, signed in at ${c}`;return[{id:n.id,staffId:n.staffId,name:s,inAt:n.in,inLabel:c,onBreak:f,speech:p}]})},Object.defineProperty(e,"NOBODY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"CARD_TITLE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"cardSpeech",{enumerable:!0,get:function(){return c}});const n=n=>String(n).padStart(2,'0'),t=(t,r)=>{const[o,a,s]=t.split('-').map(Number),u=new Date(o,a-1,s+r);return`${u.getFullYear()}-${n(u.getMonth()+1)}-${n(u.getDate())}`},r=t=>{const r=new Date(t);return`${n(r.getHours())}:${n(r.getMinutes())}`},o=n=>n.replace(' (example)','').trim();function a(n){return!!(n.breaks??[]).some(n=>!n.end)}function s(n,r){const o=t(r,-1),a=n.filter(n=>!n.voided&&n.in&&!n.out&&(n.date===r||n.date===o)),s=new Map;for(const n of a){const t=s.get(n.staffId);(!t||n.in>t.in)&&s.set(n.staffId,n)}return[...s.values()].sort((n,t)=>n.in.localeCompare(t.in))}const u='Nobody signed in',d="Who's on shift",c=n=>n.length?`${d}. ${n.map(n=>n.speech).join('. ')}.`:`${d}. ${u}.`},1024,[]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readinessFor=function(a,d,r){if('takeaway'!==a.type||!a.slotTime)return[];if(['collected','cancelled','closed'].includes(a.status))return[];const s=new Date(a.slotTime),n=d.settings.bufferMins,o=a.lines.map(a=>({name:a.name,qty:a.qty,at:(0,t.addMins)(s,-(a.prepMins+n))})),u=o.reduce((t,a)=>a.at{if(a)return'done';const d=r.getTime()-t.getTime();return d<0?'upcoming':d>3e5?'overdue':'due'},y=['ready','collected'].includes(a.status);return[{id:`${a.id}:cook`,orderId:a.id,stage:'cook',due:u,state:l(u,!!a.readiness.cook||y),detail:o.sort((t,a)=>t.at.getTime()-a.at.getTime()).map(t=>{return`${t.qty}\xd7 ${t.name} at ${a=t.at,`${String(a.getHours()).padStart(2,'0')}:${String(a.getMinutes()).padStart(2,'0')}`}`;var a}).join(' \xb7 ')},{id:`${a.id}:bag`,orderId:a.id,stage:'bag',due:c,state:l(c,!!a.readiness.bag||y),detail:'Bag, add sauces/drinks, check against ticket and allergy flags'},{id:`${a.id}:ready`,orderId:a.id,stage:'ready',due:s,state:l(s,y),detail:'Mark ready \u2014 sends the customer a "your order is ready" notification'}]};var t=_r(_d[0])},1025,[821]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"orderAtTableOn",{enumerable:!0,get:function(){return t}});const t=t=>!!t&&(t.settings.orderAtTable??!0)},1026,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hash",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return r}}),_e.revenueHistory=function(e,t,r=28){const s=[];if(!(0,a.examplesAllowed)())return s;for(let a=r;a>=1;a--){const r=(0,o.addMins)(t,1440*-a),i=!!e.kitchenHours[r.getDay()],d=[1.05,0,0,.6,.7,1,1.2][r.getDay()]*('anchorage'===e.id?1:.6),l=t=>.85+.3*n((0,o.ymd)(r)+t+e.id),u=i?Math.round(24e4*d*l('d')):0,c=i?Math.round(95e3*d*l('t')):0,p=i?Math.round(52e3*d*l('q')):0;s.push({date:r,label:(0,o.niceDate)(r).slice(0,6),byChannel:{'Dine-in':u,Takeaway:c,'Table QR':p},total:u+c+p,covers:i?Math.round(150*d*l('c')):0})}return s},_e.dishStats=function(e){return(0,a.examplesAllowed)()?e.filter(e=>null!=e.price).map(e=>{const t=Math.round(20+260*n(e.id+'s')),o=.24+.22*n(e.id+'c'),a=e.price??0,r=Math.round(a*(1-o));return{item:e,sold:t,revenue:t*a,costPct:o,margin:r,gp:r*t}}):[]},_e.quadrant=function(e,t,o,a){return e>=o?t>=a?'Star':'Plough horse':t>=a?'Puzzle':'Dog'},Object.defineProperty(_e,"QUADRANT_TIP",{enumerable:!0,get:function(){return s}}),_e.crmCustomers=function(){return(0,a.examplesAllowed)()?i.map((e,t)=>{const o=n(e+t);return{id:0===t?'cust-demo':`cr-${t}`,name:`${e} ${d[t]}${0===t?'':' (example)'}`,phone:`07700 900${String(100+7*t).slice(-3)}`,visits:1+Math.round(18*o),lastVisit:`${1+Math.round(27*o)} days ago`,spend:Math.round(3e3+6e4*o),allergies:0===t?['Crustaceans (anaphylaxis)','Mustard']:o>.8?['Gluten (coeliac)']:o<.1?['Peanuts']:[],stamps:0===t?5:Math.round(7*o),optIn:o>.25,channel:r[Math.floor(3*o)%3],birthday:o>.6?`${1+Math.round(27*o)} Nov`:void 0}}):[]},Object.defineProperty(_e,"STOCK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"stockList",{enumerable:!0,get:function(){return u}}),_e.insights=function(e,n,r,s,i,d,u){const p=[];if(!(0,a.examplesAllowed)())return c(e,n,r,s,i,d,u);const h=new Date(d);h.setDate(h.getDate()+((6-h.getDay()+7)%7||7)),h.setHours(0,0,0,0);const b=(0,t.forecastToday)(e,n,r,s,h),m=Math.round(b.restOfDay.covers/Math.max(1,b.multiplier)),y=Math.max(35,Math.round(100*(b.multiplier-1))+35);p.push({id:'sat',icon:'\ud83d\udcc8',tone:'gold',title:`${(0,o.niceDate)(h)} forecast +${y}%: add 1 server 6\u20139pm`,body:`Example: about ${Math.round(m*(1+y/100))} covers expected vs about ${m} on a usual Saturday (bookings pace + Halloween weekend flag).`,action:{label:'Open rota',tab:'more',sub:'rota'}});const f=(0,t.forecastToday)(e,n,r,s,d),v=l[0],w=Math.ceil((f.restOfDay.covers+2*f.restOfDay.takeaway)*v.perCover);p.push({id:'haddock',icon:'\ud83d\udc1f',tone:'red',title:`Haddock low: ${v.onHand} portions left`,body:`Tonight\u2019s forecast needs about ${w}. Call the supplier before 18:00 or mark the fish supper sold out at ${v.onHand} sold.`,action:{label:'Prep list',tab:'more',sub:'prep'}});const k=s.find(e=>/Burns/.test(e.title));if(k){const e=Math.max(1,Math.round((new Date(k.date).getTime()-d.getTime())/6048e5));p.push({id:'burns',icon:'\ud83e\udd43',tone:'blue',title:`Burns Night in ${e} weeks: open bookings?`,body:'Last year\u2019s equivalent nights sold out about 3 weeks ahead (example). Publish the set menu and push to opted-in regulars.',action:{label:'Plan campaign',tab:'more',sub:'marketing'}})}const M=n.filter(e=>e.date===(0,o.venueYmd)(d)&&'noshow'===e.status).length;p.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:M?`${M} no-show today: deposits for 6+?`:'Deposits for bigger tables (example)',body:'Deposits are set per venue in Settings \u203a Advanced \u203a Deposits. Consider them on Fri/Sat after 19:00.',action:{label:'Bookings',tab:'bookings'}});const C=i.filter(e=>e.stars<=2).length;C&&p.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${C} low rating this week: cold chips at collection`,body:'Readiness alerts now time bagging 5 min before pickup. Reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});return p.push({id:'commission',icon:'\ud83d\udcb7',tone:'ok',title:'You kept about \xa31,240 in commission this month',body:'Example: \xa34,140 of direct takeaway orders that would have cost about 30% on delivery apps.',action:{label:'Analytics',tab:'more',sub:'analytics'}}),p.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${u} covers so far today`,body:'Lobster special is the top add-on tonight. Suggest it with the scallops (example).'}),p};var e=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]);const n=e=>{let t=2166136261;for(let o=0;o>>0)/4294967295},r=['Dine-in','Takeaway','Table QR'];const s={Star:'Keep: high margin and popular. Feature it.','Plough horse':'Popular, low margin: nudge the price or trim the cost.',Puzzle:'High margin, few sales: promote it or rename it.',Dog:'Low margin, few sales: consider removing it.'},i=['Alex','Fiona','Iain','Morag','Callum','Eilidh','Ross','Kirsty','Euan','Shona','Hamish','Isla','Craig','Ailsa','Neil','Catriona'],d=['Morgan','Campbell','Fraser','McLeod','Kerr','Wallace','Boyd','Hamilton','Stewart','Murray','Paterson','Duncan','Gilmour','Reid','Ross','Grant'];const l=[{cat:'Fish & seafood',id:'haddock',name:'Haddock fillets',unit:'portions',onHand:8,perCover:.22,par:40},{cat:'Fruit & veg',id:'chips',name:'Chipping potatoes',unit:'kg',onHand:25,perCover:.18,par:40},{cat:'Fish & seafood',id:'langoustine',name:'Langoustines',unit:'kg',onHand:4,perCover:.03,par:6},{cat:'Fish & seafood',id:'mussels',name:'Mussels',unit:'kg',onHand:10,perCover:.05,par:12},{cat:'Fish & seafood',id:'scallops',name:'Scallops',unit:'portions',onHand:14,perCover:.06,par:20},{cat:'Meat',id:'beef',name:'Burger patties',unit:'each',onHand:30,perCover:.1,par:40},{cat:'Fruit & veg',id:'peas',name:'Garden peas',unit:'kg',onHand:6,perCover:.04,par:8},{cat:'Dairy',id:'tartare',name:'House tartare sauce',unit:'tubs',onHand:5,perCover:.05,par:10}],u=()=>(0,a.examplesAllowed)()?l:[];function c(a,n,r,s,i,d,l){const u=[],c=(0,t.forecastToday)(a,n,r,s,d);c.enough||u.push({id:'history',icon:'\ud83d\udcc5',tone:'gold',title:'Not enough history yet',body:c.suggestions[0]?.replace(/^Not enough history yet\. /,'')??'',action:{label:'Settings \u203a Advanced',tab:'more',sub:'advanced'}});const p=(0,o.ymd)(d),h=n.filter(e=>e.date===p&&'noshow'===e.status).length;h&&u.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:`${h} no-show${1===h?'':'s'} today`,body:'Think about a deposit for larger parties (Settings \u203a Advanced \u203a Deposits).',action:{label:'Bookings',tab:'bookings'}});const b=i.filter(e=>e.stars<=2).length;b&&u.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${b} low rating${1===b?'':'s'} to read`,body:'Read what they said, reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});const m=s.filter(e=>e.date>=p).sort((e,t)=>e.date.localeCompare(t.date))[0];return m&&u.push({id:'event',icon:'\ud83d\udcc5',tone:'blue',title:`Coming up: ${m.title}`,body:`${(0,o.niceDate)(new Date(m.date+'T12:00:00'))}. Check your rota and think about a promo.`,action:{label:'Forecast',tab:'forecast'}}),u.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${l} covers so far today`,body:`Seated bookings and walk-ins recorded in CoverCharge today. ${(0,e.laterTodayLine)((0,e.laterTodayCovers)(n,p))}`}),u}},1027,[831,876,821,1112]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useRealHistory=function(e,t){const o=(0,c.useExamples)(),n=(0,r.useBookings)(e),l=(0,r.useOrders)(e),f=(0,u.useCashUp)(e=>e.cashUps),y=(0,k.clampWeeks)((0,h.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings.forecastMinWeeks)),b=t.toDateString();return(0,s.useMemo)(()=>o?null:(0,k.buildHistory)(e,n,l,f.map(e=>({rid:e.rid,date:e.date,takings:(0,p.takings)(e.vals)})),t,y),[o,e,n,l,f,y,b])},Object.defineProperty(_e,"ExampleBadge",{enumerable:!0,get:function(){return b}}),_e.NotEnoughHistory=function({weeks:e,booked:s,what:t="Forecasts",testID:r="not-enough-history"}){return(0,y.jsx)(n.Card,{children:(0,y.jsxs)(o.default,{testID:r,style:{gap:6},children:[(0,y.jsx)(n.T,{weight:"semibold",colour:f.colours.gold,children:"Not enough history yet"}),(0,y.jsx)(n.Muted,{children:'Forecasts'===t?(0,l.notEnoughTip)(e):`${t} start once CoverCharge has ${1===e?'1 week':`${e} weeks`} of your bookings and cash-ups.`}),s?(0,y.jsx)(o.default,{testID:`${r}-booked`,children:(0,y.jsxs)(n.T,{children:["Booked so far: ",s," Covers"]})}):null,(0,y.jsx)(n.Muted,{children:"Tip: upload or add your bookings and do the cash up each night. Managers can change how much history is needed in Settings \u203a Advanced."})]})})};var e,s=_r(d[0]),t=_r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=_r(d[2]),r=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),p=_r(d[8]),k=_r(d[9]),f=_r(d[10]),y=_r(d[11]);const b=()=>(0,y.jsx)(n.Badge,{kind:"amber",label:l.EXAMPLE_LABEL.toUpperCase()})},1028,[31,128,817,822,1030,1112,1029,878,13,1054,824,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useExamples",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const l=()=>(0,t.useSyncExternalStore)(n.onDataModeChange,n.examplesAllowed,n.examplesAllowed)},1029,[31,1112]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"cashUpId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"salesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"cashSettingsId",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"defaultCashSettings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useCashUp",{enumerable:!0,get:function(){return b}}),_e.forgetPastTakings=function(e,t){const s=b.getState(),n=s.cashUps.filter(s=>s.rid!==e||s.date===t),r=s.sales.filter(t=>t.rid!==e);n.length===s.cashUps.length&&r.length===s.sales.length||b.setState({cashUps:n,sales:r})},Object.defineProperty(_e,"useCashSettings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useTipsShow",{enumerable:!0,get:function(){return y}});var t=e(_r(d[0])),s=e(_r(d[1])),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]),u=_r(d[5]),l=_r(d[6]);const c=(e,t)=>(0,o.uuidFrom)(`cashup:${e}:${t}`),p=(e,t)=>(0,o.uuidFrom)(`sales:${e}:${t}`),h=e=>(0,o.uuidFrom)(`cashup-settings:${e}`),f=e=>({id:h(e),cashFields:u.DEFAULT_CASHUP_FIELDS.map(e=>({...e})),salesFields:u.DEFAULT_SALES_FIELDS.map(e=>({...e}))}),S=e=>{const t='number'==typeof e.vals.cashTips?e.vals.cashTips:null,s='number'==typeof e.vals.cardTips?e.vals.cardTips:null;return!e.confirmedAt||null==t&&null==s?null:{rid:e.rid,date:e.date,total:Math.round(100*((t??0)+(s??0)))/100,postedAt:e.confirmedAt,postedBy:e.confirmedBy}},b=(0,n.create)()((0,r.persist)((e,t)=>({cashUps:[],sales:[],tips:[],pot:[],settings:{},show:{},seen:{},saveCashUp:t=>{const s={...t,id:c(t.rid,t.date)},n=S(s);return e(e=>({cashUps:[s,...e.cashUps.filter(e=>e.id!==s.id)],tips:n?[n,...e.tips.filter(e=>!(e.rid===n.rid&&e.date===n.date))]:e.tips})),s},saveSales:t=>{const s={...t,id:p(t.rid,t.weekStart)};return e(e=>({sales:[s,...e.sales.filter(e=>e.id!==s.id)]})),s},setFields:(t,s,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??f(t),[s]:n,updatedAt:(new Date).toISOString()}}})),resetFields:t=>e(e=>({settings:{...e.settings,[t]:{...f(t),updatedAt:(new Date).toISOString()}}})),setShow:(t,s)=>e(e=>({show:{...e.show,[t]:{...e.show[t]??{showToday:!0,showPot:!0},...s}}})),addPotEvent:t=>e(e=>({pot:[{...t,id:(0,l.uuid)(),at:(new Date).toISOString()},...e.pot]})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:s}}))}),{name:'covercharge-cashup-v1',storage:(0,r.createJSONStorage)(()=>s.default),partialize:e=>({...e,cashUps:e.cashUps.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))})),sales:e.sales.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))}))})}));const w=e=>{const s=b(t=>t.settings[e])??f(e);return t.default.useMemo(()=>({...s,cashFields:(0,u.withTakingsFields)(s.cashFields)}),[s])},y=e=>b(t=>t.show[e])??{showToday:!0,showPot:!0}},1030,[31,1080,1072,1081,1104,13,1241]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AXIS_BAND",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"AXIS_FONT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"labelWidth",{enumerable:!0,get:function(){return a}}),e.overlaps=u,e.anyOverlap=i,e.busiestText=s,e.seatedNowText=function(t){return`Seated now ${t} ${1===t?'Cover':'Covers'}`},e.seatedNowCovers=function(t,n){return t.filter(t=>'seated'===t.status&&t.date===n).reduce((t,n)=>t+(Number(n.partySize)||0),0)},e.hourAxis=o,e.dayLabelWidth=c,e.daysAxis=function(n,a,u=1){if(!a.length||n<=0)return[];const i=Math.max(10,n-28-8),s=Math.max(1,a.length-1),o=t=>a.length<=1?28+i/2:28+t/s*i,h=t=>t.every((a,u)=>a.x>=0&&a.x+a.w<=n&&(0===u||t[u-1].x+t[u-1].w+2<=a.x)),x=(i,s)=>{const x=a.map((t,n)=>({t:t,i:n})).filter(({i:t})=>t%i===0).map(({t:a,i:i})=>{const h=a.length>s?a.slice(0,s):a,x=Math.min(n,c(h,u));return{x:Math.max(0,Math.min(n-x,o(i)-x/2)),y:0,w:x,h:t,text:h}});return h(x)?x.map((t,a)=>{const u=0===a?0:(x[a-1].x+x[a-1].w+t.x)/2+1,i=a===x.length-1?n:(t.x+t.w+x[a+1].x)/2-1,s=Math.max(0,t.x-u),o=Math.max(0,i-(t.x+t.w));if(t.x<=.5)return{...t,x:0,w:t.w+o,align:'left'};if(t.x+t.w>=n-.5)return{...t,x:t.x-s,w:t.w+s,align:'right'};const h=Math.min(s,o);return{...t,x:t.x-h,w:t.w+2*h,align:'center'}}):null};for(let t=1;t<=a.length;t++){const n=x(t,3);if(n)return n;if(t>1){const n=x(t,2);if(n)return n}}return[]},e.layoutChart=function(n){const u=Math.max(1,n.width),i=Math.max(10,u-28-8),h=Math.max(1,n.t1-n.t0),x=o(u,n.t0,n.t1,n.hours).map(a=>({...a,y:Math.max(0,n.height-t)}));let c=null;if(n.busiest&&(n.busiest.covers>0||n.busiest.text)){const t=n.busiest.text??s(n.busiest.t,n.busiest.covers),o=Math.min(u,a(t,13)),x=28+(n.busiest.t-n.t0)/h*i-o/2;c={x:Math.max(0,Math.min(u-o,x)),y:1,w:o,h:16,text:t}}return{hours:x,busiest:c}},e.chartLabels=function(t){return t.busiest?[...t.hours,t.busiest]:t.hours};const t=22,n=12,a=(t,n)=>Math.max(1,Math.ceil(t.length*n*.62));function u(t,n){return t.x28+(t-s)/c*x,f=h.map(u=>{const i=String(new Date(u).getHours()).padStart(2,'0'),s=a(i,n);return{x:l(u)-s/2,y:0,w:s,h:t,text:i}});for(let t=1;t<=Math.max(1,f.length);t++){const n=f.filter((n,a)=>a%t===0).map(t=>({...t,x:Math.max(0,Math.min(u-t.w,t.x))}));if(!i(n))return n}return[]}const h='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ',x=[674,613,772,707,513,504,778,692,246,530,599,432,861,703,786,579,788,608,587,541,675,676,976,621,584,541,676,676,607,676,620,329,676,640,246,248,515,246,1030,640,640,676,676,373,522,364,640,561,820,479,563,455,628,320,575,589,629,628,635,546,631,630,267];function c(t,a=1,u=n){const i=[...t].reduce((t,n)=>{const a=h.indexOf(n);return t+(a<0?1e3:x[a])},0)/1e3;return Math.ceil(i*u*Math.max(1,a))+4}},1031,[]); +__d(function(_g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SETUP_STEPS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ACCESS_LEVELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ACCESS_ROLE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"ACCESS_APP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"accessOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PERMS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"DEFAULT_PERMS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"DEFAULT_GRADES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useSetup",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useSiteSetup",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"HOME_SETUP_NAGS_OFF",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"homeSetupNagsHidden",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"setupProgress",{enumerable:!0,get:function(){return v}});var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e},i=_r(d[2]),s=_r(d[3]);const o=[{id:'venue',title:'Venue details & logo',sub:'Name, address, phone, your logo and order at table'},{id:'hours',title:'Opening hours',sub:'When the kitchen is open each day'},{id:'plan',title:'Areas & table plan',sub:'Your areas, tables and seats'},{id:'paygrades',title:'Staff pay rates',sub:'Name, age, role and hourly rate; tap to edit'},{id:'staff',title:'Add staff',sub:'Name, role, access, pay and avatar'},{id:'permissions',title:'Permissions',sub:'What each access level can do'},{id:'email',title:'Link email',sub:'Your work email address'},{id:'website',title:'Link website',sub:'Your website and booking link'},{id:'invites',title:'Staff invite links',sub:'Personal links for each person'}],l=['Owner','Manager','Supervisor','Head Chef','Staff'],u={Owner:'owner',Manager:'manager',Supervisor:'manager','Head Chef':'staff',Staff:'staff'},c={Owner:'Managers',Manager:'Managers',Supervisor:'Managers','Head Chef':'Head Chef',Staff:'Staff'},f=(e,t)=>l.includes(e??'')?e:'owner'===t?'Owner':'manager'===t?'Manager':'Staff',b=[{id:'bookings',label:'Take and change bookings'},{id:'walkins',label:'Seat walk-ins'},{id:'block',label:'Block bookings and close the garden'},{id:'tableplan',label:'Edit the table plan'},{id:'kitchen',label:'Kitchen tickets and allergy ticks'},{id:'menu',label:'Edit the menu and allergens'},{id:'rota',label:'Make the rota'},{id:'timesheets',label:'Approve timesheets'},{id:'pay',label:'See pay and wages'},{id:'takings',label:'See takings and reports'},{id:'staff',label:'Add staff and change access'},{id:'settings',label:'Change venue settings'},{id:'billing',label:'Plan and billing'}],p=e=>Object.fromEntries(b.map(t=>[t.id,e])),g=e=>({...p(!1),...Object.fromEntries(e.map(e=>[e,!0]))}),S={Owner:p(!0),Manager:{...p(!0),staff:!1,billing:!1},Supervisor:g(['bookings','walkins','block','tableplan','kitchen','rota']),'Head Chef':g(['kitchen','menu','rota']),Staff:g(['bookings','walkins'])},h=[{id:'pg-foh',name:'Front of house',pence:1271},{id:'pg-bar',name:'Bar team',pence:1271},{id:'pg-kp',name:'Kitchen porter',pence:1271},{id:'pg-cdp',name:'Chef de partie',pence:1450},{id:'pg-sup',name:'Supervisor',pence:1400}],k=()=>({done:{},grades:h.map(e=>({...e})),staffGrade:{},perms:JSON.parse(JSON.stringify(S)),email:'',website:'',bookingUrl:'',invites:{}}),O=(0,i.create)()((0,s.persist)((e,t)=>({sites:{},looks:{},patch:(t,n)=>e(e=>({sites:{...e.sites,[t]:{...e.sites[t]??k(),...n}}})),markDone:(e,n,r=!0)=>{const i={...(t().sites[e]??k()).done};r?i[n]=(new Date).toISOString():delete i[n],t().patch(e,{done:i})},setPerm:(e,n,r,i)=>{const s=t().sites[e]??k();'Owner'!==n&&t().patch(e,{perms:{...s.perms,[n]:{...s.perms[n],[r]:i}}})},resetPerms:e=>t().patch(e,{perms:JSON.parse(JSON.stringify(S))}),setLook:(t,n)=>e(e=>{const r={...e.looks};return null==n?delete r[t]:r[t]=n,{looks:r}})}),{name:'covercharge-setup-v1',storage:(0,s.createJSONStorage)(()=>r.default),version:1})),P=e=>{const n=O(t=>t.sites[e])??y,r=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return{...n,email:r??n.email}},y=k(),E=['anchorage'],w=e=>E.includes(e),v=e=>{const t=o.filter(t=>e.done[t.id]).length;return{done:t,total:o.length,pct:t/o.length}}},1032,[878,1080,1072,1081]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PERM_CATALOG",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PERM_KEYS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PERM_GROUPS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"permLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ROLE_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ROLE_LABEL",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ownerLevel",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"has",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ticks",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"toggle",{enumerable:!0,get:function(){return f}}),e.effectivePerms=function(t,n,a){const o=[...new Set([...t,...n])];return(o.includes('*')?o:o.filter(t=>!a.includes(t))).sort()},e.tickSource=function(t,n){return t.extra.includes(n)?'extra':t.removed.includes(n)&&!t.base.includes('*')?'removed':c(t.base,n)?'role':'off'},Object.defineProperty(e,"SOURCE_WORDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"isCloser",{enumerable:!0,get:function(){return p}}),e.tradingDay=function(t=new Date,n="Europe/London"){const a=new Date(t.getTime()-216e5),o=new Intl.DateTimeFormat('en-GB',{timeZone:n,year:'numeric',month:'2-digit',day:'2-digit'}).formatToParts(a),s=t=>o.find(n=>n.type===t)?.value??'';return`${s('year')}-${s('month')}-${s('day')}`},Object.defineProperty(e,"ukDay",{enumerable:!0,get:function(){return b}}),e.logWords=function(t){const n=t=>Array.isArray(t)?t:[],a=t=>t&&'object'==typeof t&&!Array.isArray(t)?t:{};let s=[],u=[];if('role'===t.target_kind){const a=n(t.before),o=n(t.after);s=o.filter(t=>!a.includes(t)),u=a.filter(t=>!o.includes(t))}else{const o=a(t.before),l=a(t.after),c=n(o.extra),g=n(l.extra),f=n(o.removed),d=n(l.removed);s=[...g.filter(t=>!c.includes(t)),...f.filter(t=>!d.includes(t))],u=[...d.filter(t=>!f.includes(t)),...c.filter(t=>!g.includes(t))]}const c='role'===t.target_kind?`${l[t.target_ref??'']??t.target_name??'Role'} role`:t.target_name??'Someone',g=[...s.map(t=>`+ ${o(t)}`),...u.map(t=>`\u2212 ${o(t)}`)];return`${t.changed_by_name??'Admin'}: ${c}${g.length?`, ${g.join(', ')}`:', back to their role'}`},e.logWhen=function(t){const n=new Date(t);return new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',year:'numeric',hour:'2-digit',minute:'2-digit',hour12:!1}).format(n).replace(',','')};const t=[{key:'bookings.manage',label:'Take and change bookings',group:'Bookings & floor'},{key:'bookings.settings',label:'Booking settings: times, tables and blocks',group:'Bookings & floor'},{key:'floor.manage',label:'Edit the table plan and seat tables',group:'Bookings & floor'},{key:'orders.manage',label:'Kitchen and table orders',group:'Bookings & floor'},{key:'stock.manage',label:'Stock and deliveries',group:'Kitchen & stock'},{key:'suppliers.manage',label:'Suppliers',group:'Kitchen & stock'},{key:'suppliers.order',label:'Order from suppliers',group:'Kitchen & stock'},{key:'recipes.edit',label:'Edit recipe cards and allergens',group:'Kitchen & stock'},{key:'recipes.signoff',label:'Sign off recipe cards',group:'Kitchen & stock'},{key:'attendance.view',label:'See everyone\u2019s hours',group:'Team'},{key:'rota.manage',label:'Make the rota and approve timesheets',group:'Team'},{key:'rota.kitchen',label:'Make the kitchen rota (kitchen team only)',group:'Team',note:'Add, change and publish shifts for the kitchen team in the Head Chef app. No hours, pay or takings.'},{key:'rota.swap',label:'Approve shift swaps',group:'Team'},{key:'shift.manager',label:'Shift manager features in the Staff app',group:'Team'},{key:'staff.manage',label:'Add staff and change their details',group:'Team'},{key:'takings.view',label:'See takings, past cash ups and sales reports',group:'Money',note:'Without this, \u201cCan use cash up\u201d is tonight\u2019s cash up only.'},{key:'wages.view',label:'See pay and wages',group:'Money'},{key:'wages.manage',label:'Change pay, cash-up settings and any day\u2019s cash up',group:'Money'},{key:'venue.settings',label:'Change venue settings',group:'Venue'},{key:'devices.manage',label:'Pair and remove screens',group:'Venue'},{key:'outbox.view',label:'See messages sent to guests',group:'Venue'}],n=t.map(t=>t.key),a=[...new Set(t.map(t=>t.group))],o=n=>t.find(t=>t.key===n)?.label??n,s=['owner','manager','supervisor','head_chef','staff'],l={owner:'Owner',manager:'Manager',supervisor:'Supervisor',head_chef:'Head Chef',staff:'Staff'},u=t=>t.includes('*'),c=(t,n)=>t.includes('*')||t.includes(n),g=t=>u(t)?[...n]:n.filter(n=>t.includes(n)),f=(t,n,a)=>(a?[...new Set([...t,n])]:t.filter(t=>t!==n)).sort();const d={role:'from their role',extra:'added just for them',removed:'taken off just for them',off:'off'},p=t=>t.cashUp&&!t.takings;const b=t=>/^\d{4}-\d{2}-\d{2}$/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t},1033,[]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1034,[887,31,121,225,123,128,288,1017,817,873,824,1031,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(null),n(i=>i.map(i=>i.id===e?{...i,...t}:i))},v=(e,t)=>{const i=[...o],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],n(i),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var l=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,l.get?l:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(_r(_d[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_r(_d[14])),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{const e=(0,y.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.default,{accessibilityLabel:i.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':i.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(e,t)=>{const i=new Date(t);i.setDate(i.getDate()+e.day);const[l,s]=e.time.split(':').map(Number);return i.setHours(l,s,0,0),i},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(e),o=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return s.length||l.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&l.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&l.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&l.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&l.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&l.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||l.push('Add some text or a photo for Facebook.')):(n||l.push('TikTok and YouTube need a video. Add one from your gallery.'),o&&l.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&l.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!i?(0,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),d=a.find(e=>'ql-wix-view'===e.id)?.url||(l.website?`https://${l.website}`:''),u=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:d||'Set your website in Quick links',text:`Book a table: ${d}`,disabled:!d},{label:"Today's special",sub:u?u.title:'No live special',text:u?`Today's special: ${u.title}. ${u.body}`:'',disabled:!u},{label:'Opening hours',sub:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${i.label}`,disabled:i.disabled,onPress:()=>{e(i.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>l;o(t.id,{status:'done',approvedBy:i,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o(t.id,{status:'declined',approvedBy:i})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>o(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),n?(0,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.map(e=>{const t=1===e.items.length?e.items[0]:null,l='gmail'===t?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,o=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(t),style:{width:'100%',minWidth:0,maxWidth:'100%'}},t.id))})]}),a={flexGrow:1,flexBasis:i?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,y.venueInfo)().tag}`,ytTitle:`${t} at ${(0,y.venueInfo)().name}`.slice(0,C)}},se=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,y.venueInfo)().tag}`,ytTitle:t.slice(0,C)}}},1035,[1032,835,878,887,842,832,1069,1639,31,808,197,240,123,264,128,817,822,861,821,824,997,998,1101,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyChain=j,_e.BookingAllergyChain=function({b:l,me:t,readOnly:k}){const p=(0,i.useOrders)(l.restaurantId),S=(0,o.useStore)(e=>e.ackBookingAllergy);if(!l.allergies.length)return null;const A=p.find(e=>e.allergies.length&&!['cancelled','closed'].includes(e.status)&&(e.bookingId===l.id||!e.bookingId&&(0,c.linkedBooking)(e,[l])?.id===l.id));if(A)return(0,h.jsx)(j,{o:A,me:t,readOnly:k,compact:!0});const I={booked:l.allergyAck,ordered:void 0,kitchen:void 0,pass:void 0,table:void 0};return(0,h.jsxs)(s.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:l.allergyAck?u.colours.border:u.colours.red,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(n.T,{size:13,weight:"semibold",colour:"#FFD9D4",children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(n.Badge,{kind:l.allergyAck?'amber':'red',label:(l.allergyAck?1:0)+" of 5"})]}),(0,h.jsx)(y,{chain:I,next:l.allergyAck?null:'booked',testID:`allergy-steps-${l.ref}`}),l.allergyAck?(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:l.allergyAck.by,size:20,ring:!1}),(0,h.jsxs)(n.Muted,{style:{flex:1},children:["1. Booked: ",b(l.allergyAck.by)," at ",x(l.allergyAck.at),". Steps 2 to 5 are signed on the table's order."]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(n.T,{size:13,children:"Next: 1. Booked. Allergy recorded (who took it)."}),k?null:(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(n.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off Booked on ${l.ref}`,disabled:!t.trim(),onPress:()=>S(l.id,t)}),(0,h.jsxs)(n.Muted,{children:["as ",b(t)]})]})]})]})};var e=r(d[0]);r(d[1]);var l,t=r(d[2]),s=(l=t)&&l.__esModule?l:{default:l},n=r(d[3]),i=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]),h=r(d[9]);const x=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),b=e=>e.replace(' (example)','');function y({chain:e,next:l,testID:t}){return(0,h.jsx)(s.default,{testID:t,accessibilityLabel:`Allergen sign-off ${c.CHAIN_STEPS.filter(l=>e[l.id]).length} of 5`,style:{flexDirection:'row',alignItems:'flex-start'},children:c.CHAIN_STEPS.map((t,i)=>{const o=!!e[t.id],f=l===t.id,y=o?u.colours.ok:f?u.colours.gold:u.colours.border,j=0===i?'flex-start':i===c.CHAIN_STEPS.length-1?'flex-end':'center',k=(0,h.jsxs)(s.default,{style:{width:'200%',alignSelf:j,alignItems:j},children:[(0,h.jsx)(n.T,{size:11,weight:f?'semibold':'regular',colour:o?u.colours.text:f?u.colours.gold:u.colours.muted,style:{textAlign:0===i?'left':i===c.CHAIN_STEPS.length-1?'right':'center'},children:t.label}),e[t.id]?(0,h.jsxs)(n.T,{size:10,colour:u.colours.muted,numberOfLines:1,style:{textAlign:0===i?'left':i===c.CHAIN_STEPS.length-1?'right':'center'},children:[b(e[t.id].by).split(' ')[0]," ",x(e[t.id].at)]}):null]}),p=i%2==1;return(0,h.jsxs)(s.default,{style:{flex:1,alignItems:'center'},children:[(0,h.jsx)(s.default,{style:{minHeight:30,justifyContent:'flex-end',alignSelf:'stretch',alignItems:j},children:p?k:null}),(0,h.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',width:'100%',marginVertical:2},children:[(0,h.jsx)(s.default,{style:{flex:1,height:2,backgroundColor:i?o||f?y:u.colours.border:'transparent'}}),(0,h.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,borderWidth:2,borderColor:y,backgroundColor:o?u.colours.ok:'transparent',alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(n.T,{size:12,weight:"bold",colour:o?'#0B0B0B':f?u.colours.gold:u.colours.muted,children:o?'\u2713':String(t.n)})}),(0,h.jsx)(s.default,{style:{flex:1,height:2,backgroundColor:i<4?o?u.colours.ok:u.colours.border:'transparent'}})]}),(0,h.jsx)(s.default,{style:{minHeight:30,alignSelf:'stretch',alignItems:j},children:p?null:k})]},t.id)})})}function j({o:l,me:t,readOnly:j,compact:k}){const p=(0,i.useBookings)(l.restaurantId),S=(0,o.useStore)(e=>e.signAllergyStep);if(!l.allergies.length)return null;const A=(0,c.linkedBooking)(l,p),I=(0,c.orderChain)(l,A),C=(0,c.nextStep)(l,A),w=c.CHAIN_STEPS.filter(e=>I[e.id]).length,T=C?(0,c.stepInfo)(C):null,B='table'===C&&!['ready','served','collected'].includes(l.status);return(0,h.jsxs)(s.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:C?u.colours.red:u.colours.ok,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(n.T,{size:13,weight:"semibold",colour:C?'#FFD9D4':'#E2C489',children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(n.Badge,{kind:C?'red':'ok',label:C?`${w} of 5`:'Complete'})]}),(0,h.jsx)(y,{chain:I,next:C,testID:`allergy-steps-${l.ref}`}),k?null:c.CHAIN_STEPS.filter(e=>I[e.id]).map(e=>(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:I[e.id].by,size:20,ring:!1}),(0,h.jsxs)(n.Muted,{style:{flex:1},children:[e.n,". ",e.label,": ",b(I[e.id].by)," at ",x(I[e.id].at)]})]},e.id)),T?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(n.T,{size:13,children:["Next: ",T.n,". ",T.label,". ",T.what,"."]}),j?null:(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(n.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off ${T.label} on ${l.ref}`,disabled:!t.trim()||B,onPress:()=>S(l.id,C,t)}),(0,h.jsxs)(n.Muted,{children:["as ",b(t)]})]}),B?(0,h.jsx)(n.Muted,{children:"Signed off at the pass. The table step is signed when the dish is served."}):(0,h.jsx)(n.Muted,{children:"The ticket can't move on until this step is signed off."})]}):(0,h.jsx)(n.Muted,{children:"All five steps signed off. The full chain is in the allergen audit log."})]})}},1036,[887,31,128,817,1074,878,1037,824,999,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CHAIN_STEPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"stepInfo",{enumerable:!0,get:function(){return t}}),e.linkedBooking=l,e.orderChain=o,e.nextStep=s,Object.defineProperty(e,"doneCount",{enumerable:!0,get:function(){return c}}),e.canSign=function(n,t,l){return s(n,l)===t},e.statusBlock=function(n,l,s){if(!n.allergies.length||'cancelled'===l)return null;const c=o(n,s),u=n=>c[n]?null:`${t(n).n}. ${t(n).label} needs signing off first`;return'acknowledged'===l||'preparing'===l||'ready'===l?u('booked')??u('ordered')??u('kitchen'):'served'===l?u('booked')??u('ordered')??u('kitchen')??u('pass'):'collected'===l||'closed'===l?u('booked')??u('ordered')??u('kitchen')??u('pass')??u('table'):null},e.chainNeedsAction=function(n,t){const o=s(n,l(n,t));return!(!o||'table'===o&&!['ready','served'].includes(n.status))},e.bookingNeedsAction=function(n,t){return n.allergies.length>0&&!n.allergyAck&&!t.some(t=>t.allergies.length&&l(t,[n])?.id===n.id)};const n=[{id:'booked',n:1,label:'Booked',what:'Allergy recorded (who took it)'},{id:'ordered',n:2,label:'Ordered',what:'Server confirms with the guest'},{id:'kitchen',n:3,label:'Kitchen',what:'Chef signs off before cooking'},{id:'pass',n:4,label:'Pass',what:'Checked before it leaves the pass'},{id:'table',n:5,label:'Table',what:'Server signs off when served'}],t=t=>n.find(n=>n.id===t);function l(n,t){return n.bookingId?t.find(t=>t.id===n.bookingId):'table'===n.type&&n.tableNo?t.find(t=>t.restaurantId===n.restaurantId&&'seated'===t.status&&!!t.table&&t.table.split('+').includes(String(n.tableNo))):void 0}function o(n,t){return{booked:n.allergyChain?.booked??(t?.allergies.length?t.allergyAck:void 0),ordered:n.allergyChain?.ordered,kitchen:n.allergyAck,pass:n.allergyChain?.pass,table:n.handoverCheck}}function s(t,l){if(!t.allergies.length)return null;const s=o(t,l);return n.find(n=>!s[n.id])?.id??null}const c=(t,l)=>{const s=o(t,l);return n.filter(n=>s[n.id]).length}},1037,[]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,v=(0,f.tipsPeriod)(w,S.start,1),z=(0,f.wagePeriod)(w,D.start,1),H=e=>{l({...a,...e}),x(null)};return(0,M.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,M.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,M.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,M.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,M.jsx)(h.Chip,{label:$[e],selected:a.tipsFrequency===e,onPress:()=>H({tipsFrequency:e})},e))}),(0,M.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,M.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,M.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,M.jsxs)(h.Row,{children:[(0,M.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>H({tipsEndsDaysBefore:e})}),(0,M.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,M.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,M.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>H({wagePayDay:e})})]}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,M.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>H({wageCutoffDay:e})})]}),(0,M.jsxs)(h.Muted,{children:["Period runs the ",R(a.wageCutoffDay)," to the ",R(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,M.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,M.jsx)(h.Chip,{label:B[e],selected:(a.weekendRule??'none')===e,onPress:()=>H({weekendRule:e})},e))})]}),(0,M.jsx)(T.SectionHead,{title:"Preview"}),(0,M.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,M.jsx)(I,{label:"Next tips payday",day:S.payday,period:S}),(0,M.jsx)(I,{label:"Then",day:v.payday,period:v}),(0,M.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,M.jsx)(I,{label:"Next payday",day:D.payday,period:D}),(0,M.jsx)(I,{label:"Then",day:z.payday,period:z})]}),(0,M.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,M.jsx)(h.Banner,{kind:"success",title:y}):null,(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=H,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return V}}),_e.summaryTable=E,_e.detailTable=Y,_e.copyText=G,_e.periodOptions=U,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:$}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:$,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:W}=(0,k.useVenuePay)(s),L=(0,y.useOwner)(e=>e.staff),N=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),J=(0,P.useHourly)(),K=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,M.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,M.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,M.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>U(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>H(ye,L,N,r,J),[ye.key,L,N,J,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage($)?(0,M.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===W?(0,M.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,M.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,M.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,M.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,M.jsx)(_,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,M.jsx)(h.Card,{highlight:b.colours.gold,children:(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,M.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,M.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,M.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,M.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,M.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,M.jsx)(v.HoursExport,{}),B?(0,M.jsx)(i.default,{style:{alignItems:'center'},children:(0,M.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,M.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,M.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,M.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,M.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,M.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await G(F(E(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,V(E(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,V(Y(ge))),Te('CSV downloaded (one line per shift).')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=E(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,M.jsx)(h.Banner,{kind:"success",title:he}):null,K?(0,M.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,M.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,M.jsx)(u.HoursSummaryCard,{name:A(e.person),role:O(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,M.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${A(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,M.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,M.jsx)(o.WideTable,{children:(0,M.jsxs)(i.default,{testID:"hours-table",children:[(0,M.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,M.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:q[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,M.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,M.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${A(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,M.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,M.jsxs)(i.default,{style:{width:q[0]},children:[(0,M.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",A(e.person)]}),(0,M.jsx)(h.Muted,{children:O(e.person)})]}),(0,M.jsx)(h.T,{size:14,style:{width:q[1]},children:e.shifts}),(0,M.jsx)(h.T,{size:14,weight:"semibold",style:{width:q[2]},children:(0,l.durText)(e.confirmed)}),(0,M.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:q[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,M.jsx)(h.T,{size:14,style:{width:q[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,M.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:q[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,M.jsxs)(h.T,{size:14,weight:"semibold",style:{width:q[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,M.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,M.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:q[0]},children:["Total (",ge.length,")"]}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[1]},children:me.s}),(0,M.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:q[2]},children:(0,l.durText)(me.c)}),(0,M.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:q[3]},children:(0,l.durText)(me.p)}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,M.jsx)(h.T,{size:14,style:{width:q[5]},children:" "}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,M.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,M.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,M.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,M.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,M.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,M.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,v]=(0,n.useState)(0),$=(0,f.tipsPeriod)(u,S.period.start,D),[B,R]=(0,n.useState)(''),[I,z]=(0,n.useState)({}),[L,N]=(0,n.useState)(null),E=(0,n.useMemo)(()=>H($,p,T,a,{}),[$.key,p,T]),Y=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>I[e.id]??Y(e),_=E.filter(e=>e.confirmed>0||e.pending>0),q=Math.round(100*Number(B.replace(/[\xa3,\s]/g,''))),J=Number.isFinite(q)&&q>0&&q<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(B),K=_.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:Q}=(0,w.allocate)(J?q:0,K.map(e=>e.confirmed)),X={};K.forEach((e,s)=>{X[e.person.id]=Q[s]});const Z=K.reduce((e,s)=>e+s.confirmed,0),ee=Object.values(X).reduce((e,s)=>e+s,0),se=_.filter(e=>e.pending>0&&!U(e.person)),te=se.reduce((e,s)=>e+s.pending,0),oe=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],..._.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[A(e.person),O(e.person),(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&Z?(e.confirmed/Z*100).toFixed(2):'0.00',s?W(X[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(Z),(0,f.hMm)(Z),Z?'100.00':'0.00',W(ee)]],ne=e=>{N(e),setTimeout(()=>N(null),6e3)};return(0,M.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,M.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,M.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,M.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>v(D-1)}),(0,M.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,M.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)($.start,$.end)}),(0,M.jsxs)(h.Muted,{children:[(0,f.ukDate)($.start)," to ",(0,f.ukDate)($.end)," \xb7 ",$.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)($.payday)]}),0===D?(0,M.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>v(D+1)})]}),(0,M.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,M.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,M.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,M.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,M.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:B,onChangeText:R,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),B&&!J?(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,M.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),se.length?(0,M.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,M.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,M.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(te)," not approved yet"]}),(0,M.jsxs)(h.T,{size:14,children:[se.map(e=>`${A(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):_.length?(0,M.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,M.jsx)(o.WideTable,{children:(0,M.jsxs)(i.default,{testID:"tips-table",children:[(0,M.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,M.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),_.map(e=>{const s=U(e.person),t=X[e.person.id]??0;return(0,M.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,M.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${A(e.person)}`,onPress:()=>z({...I,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,M.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,M.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,M.jsxs)(i.default,{style:{width:150},children:[(0,M.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:A(e.person)}),(0,M.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':O(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,M.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,M.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&Z?`${(e.confirmed/Z*100).toFixed(1)}%`:'\u2013'}),(0,M.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,M.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,M.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",K.length," people)"]}),(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(Z)," h"]}),(0,M.jsx)(h.T,{size:14,style:{width:64},children:Z?'100%':'\u2013'}),(0,M.jsx)(h.T,{size:15,weight:"bold",colour:J&&ee===q?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(ee)})]})]})}),_.length?null:(0,M.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),J&&Z?(0,M.jsxs)(h.Muted,{children:["Check: ",K.length," shares add up to ",(0,x.gbp)(ee)," of ",(0,x.gbp)(q)," ",ee===q?'\u2713':'',". \xa3",(q/100/(Z/60)).toFixed(4)," per confirmed hour."]}):null,(0,M.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!J,onPress:async()=>{const e=await G(F(oe()));ne(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!J,onPress:()=>{(0,j.downloadText)(`tips-${$.start}-to-${$.end}.csv`,V(oe())),ne('CSV downloaded.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!J,onPress:()=>{const e=oe();(0,j.printTable)(`Tips ${(0,f.rangeText)($.start,$.end)} (paid ${(0,f.dayMonth)($.payday)})`,`Total ${(0,x.gbp)(q)} shared by confirmed hours${se.length?` \xb7 WARNING ${(0,f.decH)(te)} h not signed off`:''}`,e[0],e.slice(1))}})]}),L?(0,M.jsx)(h.Banner,{kind:"success",title:L}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,M.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,M.jsx)(r.CardHeading,{right:'none'===n?(0,M.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:["Next tips payday: ",(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,M.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:["Next payday: ",(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,M.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,M.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,M.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,M.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?H(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,M.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,M.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,M.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,M.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,M.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,M.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,M.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),v=_r(_d[26]),M=_r(_d[27]);const $={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},B={none:'Keep the date',before:'Friday before',after:'Monday after'};const R=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function I({label:e,day:s,period:t}){return(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:[e,": ",(0,M.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,M.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const z=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function H(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:z(e.in),outT:z(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const O=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,A=e=>e.name.replace(' (example)',''),W=e=>null==e?'':(e/100).toFixed(2),L=e=>e.replace(/[\t\r\n]+/g,' '),N=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,F=e=>e.map(e=>e.map(L).join('\t')).join('\n'),V=e=>e.map(e=>e.map(N).join(',')).join('\r\n');function E(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[A(e.person),O(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[W(e.rate),W(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',W(d.g)]:[]]]}function Y(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[A(e.person),O(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function G(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function U(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function _({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,M.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,M.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,M.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,M.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,M.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const q=[150,54,100,90,48,62,70]},1038,[873,833,1502,31,1504,123,264,288,128,1505,1506,987,817,878,861,819,1078,824,1146,1088,997,998,1415,1507,807,1508,1512,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1039,[31,128,998,824,817,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:l}=(0,d.useCtx)(3e4),c=(0,d.useSignedIn)(),j=(0,o.useOwner)(e=>(0,o.liveAttendance)(e.attendance)),x=(0,o.useOwner)(e=>e.shifts),p=(0,o.useOwner)(e=>e.leave);if(!c)return null;const b=(0,o.openShiftOf)(j,c.id,t),v=!!b?.breaks?.some(e=>!e.end),w=(0,h.workingShifts)(x,p).filter(e=>e.staffId===c.id&&e.date===l),k=(0,h.leaveCovering)(p,c.id,l),I=k?`${(0,h.leaveLabel)(k)} today`:w.length?w.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,u.jsx)(s.default,{testID:"my-shift-card",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shift"}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:I}),(0,u.jsx)(y,{staffId:c.id}),(0,u.jsx)(n.T,{center:!0,children:b?v?'On a break':`Clocked in since ${f(b.in)}`:'Not clocked in'}),(0,u.jsx)(n.Muted,{center:!0,size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,u.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,u.jsx)(n.Button,{testID:"my-shift-clock",label:b?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,u.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,u.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=y,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),a=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]);const f=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function y({staffId:e,team:t}){const{today:f}=(0,d.useCtx)(6e4),y=(0,o.useOwner)(e=>e.shifts),j=(0,o.useOwner)(e=>e.leave),x=y.filter(t=>t.staffId===e&&!1!==t.published&&t.date>=f).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14),p=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});return(0,u.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,u.jsxs)(n.Card,{children:[(0,u.jsx)(n.T,{weight:"semibold",colour:a.colours.gold,center:!0,accessibilityRole:"header",children:"My shifts"}),x.length?x.map(o=>(0,u.jsxs)(s.default,{style:{gap:4},children:[(0,u.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(n.T,{children:p(o.date)}),(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(n.T,{colour:a.colours.blue,children:(0,h.leaveLabel)((0,h.leaveCovering)(j,o.staffId,o.date))}):(0,u.jsxs)(n.T,{children:[(0,l.fmtH)(o.start),"\u2013",(0,l.fmtH)(o.end)]})]}),t&&!(0,h.leaveCovering)(j,o.staffId,o.date)?(0,u.jsx)(c.TeamOnDay,{date:o.date,meId:e,label:p(o.date)}):null]},o.id)):(0,u.jsx)(n.Muted,{center:!0,children:"No shifts on the rota yet."})]})})}},1040,[31,128,817,861,824,998,1153,1515,1441,25]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTasksProgress=function(e,s){const t=(0,r.useDailyTasks)(t=>t.people[(0,r.personKey)(e,s)]?.tasks)??[],i=(0,r.useDailyTasks)(e=>e.ticks),{ymd:l,dow:o}=T();return(0,c.progress)(t,i,s,l,o)},_e.DailyTasksEditor=j,_e.MyTasksToday=function({rid:e,staffId:s,name:t,onShift:i}){const u=(0,r.useDailyTasks)(t=>t.people[(0,r.personKey)(e,s)]?.tasks)??[],h=(0,r.useDailyTasks)(e=>e.ticks),{ymd:y,dow:x}=T(),p=(0,c.tasksFor)(u,x);if(!s||!p.length)return null;const f=(0,c.progress)(u,h,s,y,x);return(0,k.jsx)(o.default,{testID:"my-tasks-today",children:(0,k.jsxs)(n.Card,{children:[(0,k.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(n.T,{weight:"semibold",colour:d.colours.gold,children:"My tasks today"}),(0,k.jsx)(n.Badge,{kind:f.done===f.total?'gold':'neutral',label:`${f.done} of ${f.total}`})]}),i?null:(0,k.jsx)(n.Muted,{size:12,children:"You\u2019re not on shift right now. You can still tick these when you are."}),p.map(c=>{const u=h.find(t=>t.id===(0,r.tickId)(e,s,c.id,y));return(0,k.jsxs)(l.default,{testID:`my-task-${c.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:!!u},disabled:!i,onPress:()=>r.useDailyTasks.getState().toggleTick(e,s,c.id,y,{id:s,name:t.replace(' (example)','')}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:8,opacity:i?1:.6},children:[(0,k.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:1.5,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:u?'#2a2414':'transparent'},children:u?(0,k.jsx)(n.T,{colour:d.colours.gold,children:"\u2713"}):null}),(0,k.jsxs)(o.default,{style:{flex:1},children:[(0,k.jsx)(n.T,{style:{textDecorationLine:u?'line-through':'none'},children:c.text}),u?(0,k.jsxs)(n.Muted,{size:12,children:["Done at ",b(u.at)]}):null]})]},c.id)}),(0,k.jsx)(n.Muted,{size:12,children:"Tip: tick each one as you finish it. Your manager sees how you\u2019re getting on. They start fresh every day."})]})})},_e.TaskLibrarySettings=function({rid:e}){(0,i.useEffect)(()=>{r.useDailyTasks.getState().ensure(e)},[e]);const t=(0,r.useDailyTasks)(s=>s.library[e]?.items)??[],[l,u]=(0,i.useState)(''),[h,x]=(0,i.useState)({}),f=r.useDailyTasks.getState(),b=s=>f.setLibrary(e,s);return(0,k.jsxs)(o.default,{style:{gap:8},testID:"task-library",children:[(0,k.jsx)(n.Muted,{size:13,children:"Tip: these are quick picks when you add someone\u2019s daily tasks (Staff & roles \u203a a person \u203a Daily tasks). You can always type a new one there too."}),t.map((e,i)=>(0,k.jsxs)(n.Row,{gap:6,style:{opacity:e.archived?.5:1},children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:`Rename ${e.text}`,value:h[e.id]??e.text,onChangeText:s=>x(t=>({...t,[e.id]:s})),onBlur:()=>{const s=(0,c.cleanTaskText)(h[e.id]??'');s&&s!==e.text&&b(t.map(t=>t.id===e.id?{...t,text:s}:t))},style:{...p,flex:1,minWidth:0}}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2191",disabled:0===i,onPress:()=>b((0,c.move)(t,i,-1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2193",disabled:i===t.length-1,onPress:()=>b((0,c.move)(t,i,1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>b(t.map(s=>s.id===e.id?{...s,archived:!s.archived}:s))})]},e.id)),(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:"New library task",testID:"task-lib-new",value:l,onChangeText:u,placeholder:"e.g. Check the beer garden",placeholderTextColor:d.colours.muted,style:{...p,flex:1}}),(0,k.jsx)(n.Button,{small:!0,label:"Add",disabled:!(0,c.cleanTaskText)(l),onPress:()=>{b([...t,{id:(0,y.uuid)(),text:(0,c.cleanTaskText)(l)}]),u('')}})]})]})},_e.KitchenTeamTasks=function({rid:e,actor:s}){const t=(0,x.useOwner)(e=>e.staff).filter(e=>e.active&&s&&(0,c.canEditTasks)(s,e));return(0,k.jsxs)(o.default,{style:{gap:10},testID:"kitchen-team-tasks",children:[(0,k.jsx)(n.Muted,{size:13,children:"Tip: set the daily tasks for your kitchen team here. They see them as \u2018My tasks today\u2019 when they\u2019re on shift and tick them off. Your own list and front of house lists are set by a manager."}),s?null:(0,k.jsx)(n.Muted,{children:"Sign in to change your team\u2019s tasks."}),s&&!t.length?(0,k.jsx)(n.Muted,{children:"No kitchen staff found. A manager can set each person\u2019s department in Staff & roles."}):null,t.map(t=>(0,k.jsxs)(n.Card,{children:[(0,k.jsx)(n.T,{weight:"semibold",children:(0,x.staffLabel)(t).replace(' (example)','')}),(0,k.jsxs)(n.Muted,{size:12,children:[t.job,t.dept?` \xb7 ${t.dept}`:'']}),(0,k.jsx)(j,{rid:e,person:t,actor:s})]},t.id))]})};var s=_r(_d[0]),t=_r(_d[1]),i=_r(_d[2]),l=e(_r(_d[3])),o=e(_r(_d[4])),n=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),k=_r(_d[13]);const p={minHeight:42,borderRadius:10,borderWidth:1,borderColor:d.colours.hairline,backgroundColor:d.colours.surface2,color:d.colours.text,paddingHorizontal:10,fontSize:15},f=[1,2,3,4,5,6,0],b=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),T=(e=Date.now())=>{const s=(0,u.ukClock)(e);return{ymd:s.ymd,dow:new Date(`${s.ymd}T12:00:00Z`).getUTCDay()}};function j({rid:e,person:u,actor:y}){(0,i.useEffect)(()=>{r.useDailyTasks.getState().ensure(e)},[e]);const x=(0,r.useDailyTasks)(s=>s.people[(0,r.personKey)(e,u.id)]?.tasks)??[],j=((0,r.useDailyTasks)(s=>s.library[e]?.items)??[]).filter(e=>!e.archived),w=(0,r.useDailyTasks)(e=>e.ticks),[D,v]=(0,i.useState)(!1),[C,S]=(0,i.useState)(''),[$,I]=(0,i.useState)(null),M=r.useDailyTasks.getState(),P=(0,c.canEditTasks)(y,u),{ymd:R,dow:L}=T(),z=(0,c.progress)(x,w,u.id,R,L),B=s=>M.setTasks(e,u.id,s),A=e=>{const s=x;B(x.filter(s=>s.id!==e.id)),(0,h.notify)({id:`task-undo-${e.id}`,title:`Removed \u201c${e.text}\u201d`,timeoutMs:8e3,actions:[{label:'Undo',testID:'task-undo',onPress:()=>B(s)}]})};return(0,k.jsxs)(o.default,{testID:`tasks-${u.id}`,style:{gap:6},children:[(0,k.jsx)(l.default,{accessibilityRole:"button",testID:`tasks-open-${u.id}`,onPress:()=>v(!D),children:(0,k.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(n.T,{weight:"semibold",colour:d.colours.gold,children:["Daily tasks ",D?'\u25b4':'\u25be']}),(0,k.jsx)(n.Muted,{size:12,children:x.length?`${z.done} of ${z.total} done today`:'None yet'})]})}),D?(0,k.jsxs)(o.default,{style:{gap:6},children:[x.map((s,i)=>{const l=w.find(t=>t.id===(0,r.tickId)(e,u.id,s.id,R));return(0,k.jsxs)(o.default,{testID:`task-row-${i}`,style:{borderTopWidth:1,borderColor:d.colours.hairline,paddingTop:6,gap:4},children:[(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsxs)(n.T,{style:{flex:1},colour:l?d.colours.gold:d.colours.text,children:[l?'\u2713 ':'',s.text]}),P?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2191",accessibilityLabel:`Move ${s.text} up`,disabled:0===i,onPress:()=>B((0,c.move)(x,i,-1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2193",accessibilityLabel:`Move ${s.text} down`,disabled:i===x.length-1,onPress:()=>B((0,c.move)(x,i,1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"Days",onPress:()=>I($===s.id?null:s.id)}),(0,k.jsx)(t.GoldClose,{size:"sm",testID:`task-remove-${i}`,label:`Remove ${s.text}`,onPress:()=>A(s)})]}):null]}),(0,k.jsxs)(n.Muted,{size:12,children:[s.days?.length?s.days.map(e=>c.TASK_DAY_NAMES[e]).join(', '):'Every day',l?` \xb7 ticked by ${l.byName.split(' ')[0]} at ${b(l.at)}`:'']}),$===s.id?(0,k.jsx)(n.Row,{wrap:!0,gap:4,children:f.map(e=>{const t=!!s.days?.includes(e);return(0,k.jsx)(n.Chip,{label:c.TASK_DAY_NAMES[e],selected:t,onPress:()=>B(x.map(i=>i.id===s.id?{...i,days:t?(i.days??[]).filter(s=>s!==e):[...i.days??[],e].sort()}:i))},e)})}):null]},s.id)}),P?(0,k.jsxs)(o.default,{style:{gap:6},children:[(0,k.jsx)(n.Row,{wrap:!0,gap:4,children:j.filter(e=>!x.some(s=>s.text.toLowerCase()===e.text.toLowerCase())).slice(0,12).map(s=>(0,k.jsx)(n.Chip,{testID:"task-lib-chip",label:`${s.text}`,onPress:()=>M.addTask(e,u.id,s.text,s.id)},s.id))}),(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:"New task",testID:`task-new-${u.id}`,value:C,onChangeText:S,placeholder:"Type a task, e.g. Restock the bar fridges",placeholderTextColor:d.colours.muted,style:{...p,flex:1},onSubmitEditing:()=>{(0,c.cleanTaskText)(C)&&(M.addTask(e,u.id,C),S(''))}}),(0,k.jsx)(n.Button,{small:!0,testID:`task-add-${u.id}`,label:"Add",disabled:!(0,c.cleanTaskText)(C),onPress:()=>{M.addTask(e,u.id,C),S('')}})]})]}):(0,k.jsx)(n.Muted,{size:12,children:'staff'===y?.role?'You can\u2019t change this list.':''})]}):null]})}},1041,[873,835,31,264,128,817,824,1050,1324,1052,1066,1241,861,25]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shiftNow=k,e.useShiftReminders=function({rid:c,staffId:u,name:h,kitchen:b,onStartBreak:S}){const D=(0,t.useRef)(S);D.current=S;const v=(0,t.useRef)(h);v.current=h;const I=(0,s.useReminders)(t=>`${t.reminders.length}:${t.done.length}:${JSON.stringify(t.rules[c]??{})}:${t.reminders.map(t=>t.updatedAt??'').join()}`),w=(0,r.useOwner)(t=>`${t.attendance.length}:${t.shifts.length}:${t.leave.length}`);(0,t.useEffect)(()=>{s.useReminders.getState().ensure(c);const t=()=>{const t=f(),{att:h,shift:S,on:I}=k(u,t),w=s.useReminders.getState();if(!I||!u)return w.reminders.forEach(t=>(0,a.dismissNotice)(`rem:${t.id}`)),void(0,a.dismissNotice)('break-reminder');const $=(0,s.rulesOf)(c),R=h?.in?new Date(h.in).getTime():void 0,p=!!h?.breaks?.length,y=`break:${h?.id??S?.id??''}`,M=(0,o.breakDue)({now:t,clockIn:R,shiftStart:S?l(S.date,S.start):void 0,shiftEnd:S?l(S.date,S.end):void 0,rotaBreak:void 0!==S?.breakAt?l(S.date,S.breakAt):void 0,hadBreak:p,rules:$},w.snooze[y]??0);if(M){const r=R??(S?l(S.date,S.start):t);(0,a.notify)({id:'break-reminder',tone:3===M.stage?'warn':'normal',icon:'\ud83e\uded6',kicker:'BREAK REMINDER',testID:'break-reminder',timeoutMs:null,title:M.label,body:`${R?'Clocked in':'Shift started'} at ${m(r)}. ${3===M.stage?'':'Over 6 hours needs a 20-minute break.'}`.trim(),actions:[{label:'Start break',testID:'break-reminder-start',onPress:()=>{if(!h)return D.current?.(),void(0,a.notify)({id:'break-clock-first',title:'Clock in first, then tap Start break.',body:'Your break is started from the clock screen.',timeoutMs:6e3});const t=new Date(f()).toISOString();(0,n.clockAction)('break_start',{rid:c,staffId:u,date:t.slice(0,10),at:t}).then(t=>{t.ok||(0,a.notify)({id:'break-blocked',tone:'warn',title:'Break not started',body:t.message,timeoutMs:1e4}),D.current?.()})}},{label:'Later',kind:'ghost',testID:'break-reminder-later',onPress:()=>{s.useReminders.getState().setSnooze(y,f()+6e4*$.snoozeMins),(0,a.dismissNotice)('break-reminder')}}]})}else(0,a.dismissNotice)('break-reminder');const N=r.useOwner.getState().staff.find(t=>t.id===u),O=b??(0,d.inKitchen)(N);for(const n of w.reminders){if(n.rid!==c)continue;const r=`rem:${n.id}`;if(n.removed||!(0,o.audienceMatch)(n.audience,O)){(0,a.dismissNotice)(r);continue}const{due:d,forDate:m}=(0,o.reminderDue)(n,t),l=w.done.find(t=>t.reminderId===n.id&&t.forDate===m),k=`rem:${n.id}:${m}`;!d||l||(w.snooze[k]??0)>t?(0,a.dismissNotice)(r):(0,a.notify)({id:r,icon:'\ud83e\ude91',kicker:'REMINDER',title:n.text,testID:'venue-reminder',timeoutMs:null,body:`For everyone on shift${'all'===n.audience?'':'kitchen'===n.audience?' in the kitchen':' front of house'}. Tap Done once it\u2019s done.`,actions:[{label:'Done',testID:'venue-reminder-done',onPress:()=>s.useReminders.getState().markDone({rid:c,reminderId:n.id,forDate:m,at:new Date(f()).toISOString(),staffRef:u,staffName:v.current.replace(' (example)','')})},{label:'Later',kind:'ghost',onPress:()=>s.useReminders.getState().setSnooze(k,f()+6e4*$.snoozeMins)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[c,u,I,w,b])};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]);const f=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock).getTime()}catch{return Date.now()}},m=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=(t,n)=>{const[r,s,o]=t.split('-').map(Number);return new Date(r,s-1,o,Math.floor(n),Math.round(n%1*60)).getTime()};function k(t,n){const s=r.useOwner.getState(),a=(0,r.openShiftOf)(s.attendance,t,new Date(n)),d=(0,o.ukClock)(n).ymd,c=(0,u.workingShifts)(s.shifts,s.leave),f=c.find(r=>r.staffId===t&&r.date===d&&!1!==r.published&&l(r.date,r.start)<=n&&nn.staffId===t&&n.date===d&&!1!==n.published):void 0),m=!a&&!!f&&s.attendance.some(n=>n.staffId===t&&n.date===d&&!!n.out&&new Date(n.out).getTime()>=l(f.date,f.start));return{att:a,shift:f,on:!!a||!!f&&!m}}},1042,[31,1439,861,1051,1052,1066,1326,878,1441]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=A,_e.resetTableLive=W,_e.seatBookingNow=E,_e.finishBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'finished'),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=H,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=Y,_e.WalkInSheet=U,_e.WalkInMatchPrompt=Q,_e.AssignTableSheet=V,_e.undoNotice=G,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[i,n]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>n({b:e}),combineTables:e=>n({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(U,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:G}):null,l?(0,L.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,L.jsx)(V,{booking:i.b,combine:i.combine,onClose:()=>n(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=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),B=_r(_d[28]),z=_r(_d[29]),O=_r(_d[30]),N=_r(_d[31]),M=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function A(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function E(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)}function H(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=A(e),a=(0,v.useFloor)(t=>t.live[e])??{},i=(0,v.usePlan)(e),n=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(n,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(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,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function Y({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=i?6:8,f=i?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(n??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],n=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!n,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,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?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:n?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:n?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function U({onClose:e,onSeated:a,wide:i,initialTable:n}){const{rid:r,r:d,now:x}=(0,y.useCtx)(15e3),T=H(r,x),[I,$]=(0,c.useState)(2),[P,B]=(0,c.useState)(!1),[z,N]=(0,c.useState)(n??null),R=(0,v.usePlan)(r),A=(0,k.useBookings)(r),_=(0,D.useBlocks)(e=>e.blocks),U=(0,D.closedAreasAt)(_,r,(0,w.ymd)(x),(0,w.hm)(x)),V=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(T).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(R,A.filter(e=>e.date===(0,w.ymd)(x)),e,I,x,(0,j.turnFor)(I,d.settings.turnMins),90,void 0,{closed:U})?.table??null},[R,A,T,I,U.size,x.getTime()]);(0,c.useEffect)(()=>{z&&(0,v.tablesOf)(z).some(e=>'Closed'===T[e]?.label)&&N(null)},[z,U.size]);const[G,K]=(0,c.useState)(!1),[X,J]=(0,c.useState)(''),Z=(e,t=String(e),s=()=>{B(!1),$(e)})=>{const o='9+'===t?P:!P&&I===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},ee=(0,L.jsx)(s.PartySizeInput,{value:I,onChange:$,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),te=(0,L.jsxs)(m.default,{style:{gap:8,width:i?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>Z(e)),Z(9,'9+',()=>{B(!0),$(e=>e>=9?e:9)})]}),P?ee:null]}),[se,oe]=(0,c.useState)(!1),[le,ae]=(0,c.useState)(null),ie=async(t=z,s=!1)=>{if(!se&&(0,M.guardBookingChange)(F)){if(!s){const e=(0,O.bookingsNearWalkIn)(A,x,I);if(e.length)return void ae({at:t,list:e})}oe(!0);try{const s=await k.repo.bookings.seatWalkIn(r,I,t??void 0,X);W(r,t??void 0),a(s),e()}finally{oe(!1)}}},ne=async(t,s)=>{if(!se&&(0,M.guardBookingChange)(F)){oe(!0);try{const o=s??t.table??null;o&&o!==t.table&&await k.repo.bookings.assignTable(t.id,o),await E(r,{...t,table:o??void 0}),(0,u.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})`}),ae(null),e()}finally{oe(!1)}}},re=(0,L.jsxs)(m.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),z?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>N(null)}):null]}),(0,L.jsx)(Y,{use:T,value:z,onPick:e=>{T[e]&&!T[e].busy?ie(e):N(z===e?null:e)},big:i,dense:i,best:V,bestSet:(0,h.bestTables)(R)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",V&&!z?` (suggested for ${I}: ${(0,l.tableNumbers)(V)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(x)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${I} ${1===I?'person':'people'}${z?` \xb7 ${(0,l.tableNumbers)(z)}`:''}`,disabled:se,onPress:()=>{ie()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[te,re]}):(0,L.jsxs)(L.Fragment,{children:[te,re]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[G?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:X,onChangeText:J,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>K(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),le?(0,L.jsx)(Q,{list:le.list,busy:se,onYes:e=>{ne(e,le.at)},onNo:()=>{const e=le.at;ae(null),ie(e,!0)},onClose:()=>ae(null)}):null]})}function Q({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,L.jsx)(C.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,L.jsxs)(m.default,{style:{gap:14},children:[e.map((e,o)=>(0,L.jsxs)(m.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,L.jsx)(m.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:26,weight:"bold",colour:S.colours.goldLight,testID:"walkin-match-question",children:(0,O.walkInMatchQuestion)(e)})}),e.table?(0,L.jsxs)(C.T,{size:17,colour:S.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,L.jsx)(C.T,{size:17,colour:S.colours.text,children:e.ref}),(0,L.jsx)(C.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,L.jsx)(C.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,y.useCtx)(15e3),n=H(o,i),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(i)),t,e.partySize,i,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,i.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),$=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,P=D.reduce((e,t)=>e+$(t),0),B=D.length>0&&P{if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},O=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${P} seats for ${e.partySize} Covers`:'No tables picked yet'})}),B?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-P," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:O,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(Y,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function G(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:O}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[A,W]=(0,c.useState)(ee.blocks),[_,Y]=(0,c.useState)(!1),[q,U]=(0,c.useState)(''),[Q,V]=(0,c.useState)(2),[G,K]=(0,c.useState)(0),X=Math.min(G,Math.max(0,Q-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ie,ne]=(0,c.useState)('phone'),[re,de]=(0,c.useState)((0,$.emptyNeeds)()),ue=(0,$.needsMissing)(re),[ce,be]=(0,c.useState)(null),ge=(0,v.usePlan)(b),he=(0,z.dogSetUp)(ge),pe=!0===re.dog&&he,me=re.dog?re.dogs:0,fe=(0,w.parseYmd)(A),ye=(0,j.turnFor)(Q,h.settings.turnMins),ke=E.filter(e=>e.date===A),xe=e=>(0,j.freeTablesAt)(ge,ke,Q,new Date(`${A}${(0,l.tableNumbers)(e)}:00`),ye,h.settings.turnMins,{dog:!0,closed:(0,D.closedAreasAt)(H,b,A,e)}),je=pe&&J?xe(J):[];(0,c.useEffect)(()=>{be(null)},[pe,J,Q]);const we=(0,x.bookingSlots)(h,fe,e=>E.filter(t=>t.date===A&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Q,A===(0,w.ymd)(p)?p:(0,w.addMins)(fe,0),e=>E.filter(t=>t.date===A&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Se=(0,T.guestPhone)(se),[Te,Ce]=(0,c.useState)(!1),ve=J?we.find(e=>e.time===J):void 0,De=ve&&ve.left=2&&!!J&&(!$e||Te)&&(0,o.validParty)(Q)&&Se.ok&&(0,T.emailOk)(le)&&(!Pe||Be&&_)&&(!pe||je.length>0)&&!ze,Ne=re.wheelchair>0||re.stepFree;return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(fe)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)($.FirstQuestions,{rid:b,value:re,onChange:de,party:Q,audience:"staff"}),re.dog&&!he?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:A,onChange:e=>{e!==A&&(W(e),Z(null),Y(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===ie,onPress:()=>ne('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===ie,onPress:()=>ne('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:U,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Se.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Se.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,L.jsx)(n.AdultsChildren,{value:(0,r.peopleOf)(Q,X),onChange:e=>{V(e.partySize),K(e.children),Ce(!1)},depositsOn:(0,i.depositOf)(h.settings).on&&(0,i.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:we.map(e=>{const t=pe&&e.available&&!xe(e.time).length||!(0,$.dogTimeOk)(h,E,A,e.time,me);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,A,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),Y(!1),Ce(!1)}},e.time)})}),$e?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[De?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Q,De.left,De.time)}):null,Ie?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ie.time,Ie.cap)}):null,(0,L.jsx)(C.Chip,{label:Te?'Booking over the limit: on':'Book anyway (over the limit)',selected:Te,onPress:()=>Ce(e=>!e),testID:"nb-over-ok"})]}):null,pe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",ge.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),je.length?(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:je.slice(0,10).map((e,t)=>(0,L.jsx)(C.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${Ne&&(0,z.accessibleSetUp)(ge)&&!(0,z.isAccessible)(ge,e.table)?' \xb7 not step-free':''}`,selected:(ce??je[0].table)===e.table,onPress:()=>be(e.table)},e.table))}):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Q," at ",J,". Try another time."]})]}):null,Pe?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Pe.from,"\u2013",Pe.to,Pe.reason?` (${Pe.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:_?'Manager override on':'Override and book anyway',selected:_,onPress:()=>Y(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,we.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(fe)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)($.MoreQuestions,{rid:b,r:h,value:re,onChange:de,party:Q,date:A,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ne&&!(0,z.accessibleSetUp)(ge)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:P.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(h.settings),Q,X))," (",(0,a.gbp)((0,i.depositOf)(h.settings).perPersonPence)," per adult for ",(0,i.depositOf)(h.settings).fromParty,"+",X?`; ${X} ${1===X?'child':'children'} free`:'; children free',"). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsxs)(C.Muted,{children:["The guest gets a confirmation text",le.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ze?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:ue.length?ue[0]:'Save booking',testID:"nb-save",disabled:!Oe,onPress:()=>{if(A<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,$.needsPatch)(re),s=re.tableReq.find(e=>!pe||je.some(t=>t.table===e)),o=pe?null:(0,N.requestedFreeTable)(re.tableReq,{date:A,time:J,partySize:Q},ge.tables.map(e=>e.name),ke,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Q,date:A,time:J,notes:ee.trim(),security:(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?'deposit':'none',depositPaid:0,...X?{children:X}:{},...(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?{depositDue:(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X),depositPolicy:(0,i.depositWords)((0,i.depositOf)(h.settings),Q,h.name,X).join(' '),depositRefundable:(0,i.depositOf)(h.settings).refundable,depositCutoffHours:(0,i.depositOf)(h.settings).cutoffHours}:{},phone:Se.pretty,email:le.trim()||void 0,source:ie,...e,...we.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...pe?{table:ce??s??je[0]?.table}:o?{table:o}:{}}).then(e=>(0,B.postNewBookingToKitchen)(e,O)).catch(()=>{}),u?.({date:A,time:J,name:q.trim()}),t()}})]})}},1043,[873,812,1456,811,819,14,1457,1458,1459,1208,31,1077,264,128,807,998,822,820,829,821,824,826,817,828,827,1460,830,816,1023,831,1465,1454,1453,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'Closed for weather':'For weather',accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),I=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{testID:"block-today",title:"Today",sub:T?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!T,onPress:()=>m('today')}),(0,f.jsx)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1044,[811,31,1504,1494,264,128,827,828,832,821,824,817,1614,1616,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},1045,[873,31,128,817,822,992,861,1055,1151,1152,878,824,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coversSplit=function(o,n){let s=0,c=0;for(const l of o){if('cancelled'===l.status||'noshow'===l.status)continue;if(n&&l.date!==n)continue;const o=l.partySize||0;t(l)?s+=o:c+=o}const l=s+c;if(!l)return{total:0,walkIns:0,bookings:0,walkInPct:0,bookingPct:0,empty:!0,a11y:'No Covers yet'};const u=Math.round(s/l*100),k=100-u;return{total:l,walkIns:s,bookings:c,walkInPct:u,bookingPct:k,empty:!1,a11y:`Walk-ins ${s} Covers, ${u} percent. Bookings ${c} Covers, ${k} percent.`}};const t=t=>!!t.walkIn||'walk-in'===t.source},1046,[]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.venueBusy=function(n,s,a){const d=(0,t.ymd)(new Date(a.getTime()-48384e5)),r=(0,t.ymd)(a),u=n.settings.busyLearningSince,o=u&&/^\d{4}-\d{2}-\d{2}$/.test(u)&&u>d?u:d,l=new Map,y=new Set,c=new Set,h=new Set;for(const a of s){if(h.has(a.id)||a.restaurantId!==n.id||a.date=r||!['confirmed','seated','finished'].includes(a.status)||!Number.isFinite(a.partySize)||a.partySize<=0)continue;h.add(a.id),y.add(a.date);const s=new Date(a.date+'T12:00:00');s.setDate(s.getDate()-(s.getDay()+6)%7),c.add((0,t.ymd)(s));const d=a.date+'T'+a.time.slice(0,2);l.set(d,(l.get(d)??0)+a.partySize)}const w=[...l.values()].sort((t,n)=>t-n),f=[...y].sort(),M=(f.length?Math.round((new Date(r+'T12:00:00').getTime()-new Date(f[0]+'T12:00:00').getTime())/864e5):0)>=28&&c.size>=4&&y.size>=16&&w.length>=40,b=n.settings.busyCoversPerHour,v=Number.isFinite(b)&&b>=1?Math.round(b):30,S=M&&!1!==n.settings.busyLearning,z=S?Math.max(1,Math.ceil(w[Math.ceil(.85*w.length)-1])):v,D=Math.max(1,Math.ceil(z/2));return{busy:z,steady:D,learned:S,weeks:c.size,enough:M,words:`Busy level: ${z} Covers an hour (${S?`learned from your last ${c.size} weeks`:null!=b?'set by you':'starting level'})`}},e.hourlyBand=function(t,n){return t>=n?'Busy':t>=Math.ceil(n/2)?'Steady':'Quiet'};var t=_r(_d[0])},1047,[821]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},1048,[31,817,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1049,[873,31,264,128,817,824,861,878,1074,1303,1304,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"libraryRowId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"personRowId",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"tickId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"personKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"useDailyTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"tasksOf",{enumerable:!0,get:function(){return O}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]);const l=e=>(0,o.uuidFrom)(`daily-task-library:${e}`),y=(e,t)=>(0,o.uuidFrom)(`daily-tasks:${e}:${t}`),b=(e,t,i,s)=>(0,o.uuidFrom)(`daily-task-tick:${e}:${(0,u.tickKey)(t,i,s)}`),f=()=>(new Date).toISOString(),k=(e,t)=>`${e}|${t}`,p=e=>u.DEFAULT_LIBRARY.map((t,i)=>({id:(0,o.uuidFrom)(`daily-task-lib:${e}:${i}`),text:t})),L=(0,s.create)()((0,n.persist)((e,t)=>({library:{},people:{},ticks:[],ensure:i=>{t().library[i]||e(e=>({library:{...e.library,[i]:{items:p(i)}}}))},setLibrary:(t,i)=>e(e=>({library:{...e.library,[t]:{items:i,updatedAt:f()}}})),addLibrary:(e,i)=>{const s=(0,u.cleanTaskText)(i);if(!s)return;const n=t().library[e]?.items??p(e);n.some(e=>e.text.toLowerCase()===s.toLowerCase()&&!e.archived)||t().setLibrary(e,[...n,{id:(0,c.uuid)(),text:s}])},setTasks:(t,i,s)=>e(e=>({people:{...e.people,[k(t,i)]:{tasks:s,updatedAt:f()}}})),addTask:(e,i,s,n)=>{const o=(0,u.cleanTaskText)(s);if(!o)return;const l=t().people[k(e,i)]?.tasks??[];l.some(e=>e.text.toLowerCase()===o.toLowerCase())||t().setTasks(e,i,[...l,{id:(0,c.uuid)(),text:o,...n?{libraryId:n}:{}}])},toggleTick:(t,i,s,n,o)=>e(e=>{const u=b(t,i,s,n);if(e.ticks.some(e=>e.id===u))return{ticks:e.ticks.filter(e=>e.id!==u)};const c=new Date(Date.now()-12096e5).toISOString().slice(0,10);return{ticks:[...e.ticks.filter(e=>e.forDate>=c),{id:u,rid:t,staffRef:i,taskId:s,forDate:n,byRef:o.id,byName:o.name,at:f()}]}}),resetLibrary:e=>t().setLibrary(e,p(e))}),{name:'covercharge-daily-tasks-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)})),O=(e,t)=>L.getState().people[k(e,t)]?.tasks??[]},1050,[1080,1072,1081,1104,1324,1241]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"chairsId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rulesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useReminders",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"rulesOf",{enumerable:!0,get:function(){return A}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},n=_r(d[1]),s=_r(d[2]),u=_r(d[3]),o=_r(d[4]),l=_r(d[5]);const c=e=>(0,u.uuidFrom)(`reminder:chairs:${e}`),p=e=>(0,u.uuidFrom)(`break-rules:${e}`),f=()=>(new Date).toISOString(),b=(0,n.create)()((0,s.persist)((e,r)=>({reminders:[],rules:{},done:[],snooze:{},ensure:t=>{const n=r(),s={};n.reminders.some(e=>e.id===c(t))||(s.reminders=[...n.reminders,{...(0,o.defaultChairs)(c(t),t),rid:t}]),n.rules[t]||(s.rules={...n.rules,[t]:{...o.DEFAULT_BREAK_RULES,id:p(t)}}),Object.keys(s).length&&e(s)},add:(r,t)=>{const n=(0,l.uuid)();return e(e=>({reminders:[...e.reminders,{...t,id:n,rid:r,updatedAt:f()}]})),n},update:(r,t)=>e(e=>({reminders:e.reminders.map(e=>e.id===r?{...e,...t,updatedAt:f()}:e)})),remove:r=>e(e=>({reminders:e.reminders.flatMap(e=>e.id!==r?[e]:e.builtIn?[{...e,removed:!0,paused:!0,updatedAt:f()}]:[])})),resetReminder:r=>e(e=>({reminders:e.reminders.map(e=>e.id===r&&'chairs'===e.builtIn?{...(0,o.defaultChairs)(r,e.rid),rid:e.rid,updatedAt:f()}:e)})),setRules:(r,t)=>e(e=>({rules:{...e.rules,[r]:{...(0,o.clampRules)({...e.rules[r]??o.DEFAULT_BREAK_RULES,...t}),id:p(r),updatedAt:f()}}})),resetRules:r=>e(e=>({rules:{...e.rules,[r]:{...o.DEFAULT_BREAK_RULES,id:p(r),updatedAt:f()}}})),markDone:r=>e(e=>({done:[{...r,id:(0,l.uuid)(),at:r.at??f()},...e.done].slice(0,400)})),setSnooze:(r,t)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[r,t]])}))}),{name:'covercharge-reminders-v1',version:1,storage:(0,s.createJSONStorage)(()=>t.default)})),A=e=>(0,o.clampRules)(b.getState().rules[e]??o.DEFAULT_BREAK_RULES)},1051,[1080,1072,1081,1104,1052,1241]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LEGAL_LIMIT_MINS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_BREAK_RULES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"REMINDER_WINDOW_MINS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CHAIRS_TEXT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ANCHORAGE_CHAIRS_DAYS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultChairs",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AUDIENCE_LABEL",{enumerable:!0,get:function(){return s}}),e.clampRules=c,Object.defineProperty(e,"validTime",{enumerable:!0,get:function(){return d}}),e.ukClock=l,e.reminderDue=function(t,n){const i=l(n);if(t.paused||!d(t.time)||!t.days.includes(i.dow))return{due:!1,forDate:i.ymd};const o=f(t.time);return{due:i.mins>=o&&i.mins=t.shiftEnd))return null;const r=b(t).filter(n=>n.at<=t.now),i=r.length?r[r.length-1]:null;if(!i)return null;if(t.nowr?i:null}return i};const t=360,n={on:!0,afterMins:240,repeatMins:30,snoozeMins:15},r=180,i='Time to put the chairs up on the tables',o=[4,0],a=(t,n)=>'anchorage'===n?{id:t,text:i,days:[...o],time:'21:00',audience:'all',builtIn:'chairs',push:!0}:{id:t,text:i,days:[5,0],time:'21:00',audience:'all',builtIn:'chairs'},u=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],s={all:'Everyone on shift',foh:'Front of house',kitchen:'Kitchen'};function c(r){const i=(t,n,r,i)=>{const o=Math.round(Number(t));return Number.isFinite(o)?Math.min(i,Math.max(r,o)):n};return{on:!1!==r.on,afterMins:i(r.afterMins,n.afterMins,30,t),repeatMins:i(r.repeatMins,n.repeatMins,5,120),snoozeMins:i(r.snoozeMins,n.snoozeMins,5,60)}}const d=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t);function l(t){const n='number'==typeof t?new Date(t):t,r=Object.fromEntries(new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(n).map(t=>[t.type,t.value]));return{dow:u.indexOf(String(r.weekday).slice(0,3)),mins:60*Number(r.hour)+Number(r.minute),ymd:`${r.year}-${r.month}-${r.day}`}}const f=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));const m=(t,n)=>'all'===t||('kitchen'===t?n:!n);function b(t){const n=c(t.rules),r=t.clockIn??t.shiftStart;if(!n.on||void 0===r||t.hadBreak)return[];const i=r+216e5,o=Math.min(void 0!==t.rotaBreak&&t.rotaBreak>r?t.rotaBreak:r+6e4*n.afterMins,i),a=[{stage:1,at:o,label:void 0!==t.rotaBreak&&t.rotaBreak>r&&t.rotaBreak<=i?'Your break on the rota is now.':'Time for your break.'}],u=o+6e4*n.repeatMins;return a.push({stage:2,at:u,label:'Reminder: you haven\u2019t had your break yet.'}),i>u&&a.push({stage:3,at:i,label:'You\u2019ve worked 6 hours without a break. You need a 20-minute break (UK law).'}),a}},1052,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"notifSeedId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"headChefId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"gmId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"seedsFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useNotifs",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),p=r(d[5]),f=r(d[6]),c=r(d[7]);const l=(e,t)=>(0,o.uuidFrom)(`sched-notif:${t}:${e}`),S=()=>p.ROSTER.find(e=>'Head Chef'===e.level)?.id??p.ROSTER.find(e=>'chef'===e.app)?.id??'',b=()=>p.ROSTER.find(e=>'Manager'===e.level)?.id??'',h=e=>'anchorage'===e?(0,u.anchorageSeeds)(t=>l(e,t),S(),b()):[],O=()=>(new Date).toISOString(),v=(0,s.create)()((0,n.persist)((e,t)=>({items:[],snooze:{},ensure:i=>{const s=t().items,n=s.map(e=>(0,c.fixSupplierNames)(e.title)!==e.title||(0,c.fixSupplierNames)(e.message)!==e.message?{...e,title:(0,c.fixSupplierNames)(e.title),message:(0,c.fixSupplierNames)(e.message),updatedAt:O()}:e);n.some((e,t)=>e!==s[t])&&e({items:n});const o=new Set(t().items.map(e=>e.id)),u=h(i).filter(e=>!o.has(e.id)).map(e=>({...e,rid:i}));u.length&&e(e=>({items:[...e.items,...u]}))},add:(t,i)=>{const s=(0,f.uuid)();return e(e=>({items:[...e.items,{...i,id:s,rid:t,updatedAt:O()}]})),s},update:(t,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...i,updatedAt:O()}:e)})),remove:t=>e(e=>({items:e.items.flatMap(e=>e.id!==t?[e]:e.seed?[{...e,removed:!0,paused:!0,updatedAt:O()}]:[])})),resetSeeds:t=>{const i=new Map(h(t).map(e=>[e.id,e]));e(e=>{const s=e.items.map(e=>i.has(e.id)?{...i.get(e.id),rid:t,updatedAt:O()}:e),n=new Set(s.map(e=>e.id));return{items:[...s,...[...i.values()].filter(e=>!n.has(e.id)).map(e=>({...e,rid:t,updatedAt:O()}))]}})},setSnooze:(t,i)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[t,i]])}))}),{name:'covercharge-sched-notifs-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)}))},1053,[1080,1072,1081,1104,1061,15,1241,1322]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_MIN_WEEKS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"clampWeeks",{enumerable:!0,get:function(){return o}}),e.buildHistory=function(o,a,c,u,d,f=n){const l=(0,t.ymd)(d),y=(0,t.ymd)(new Date(d.getTime()-48384e5)),h=t=>t>=y&&tt.rid===o&&h(t.date));for(const t of k)D.add(t.date);const T=[...D].sort(),w=T.length?s(T[0],l):0,j=w>=7*f&&T.length>=2*f,O=t=>{const n={},o={};for(const t of T){const n=new Date(t+'T12:00:00').getDay();o[n]=(o[n]??0)+1}for(const[o,s]of Object.entries(t)){const t=new Date(o+'T12:00:00').getDay();n[t]??={};for(const[o,a]of Object.entries(s))n[t][Number(o)]=(n[t][Number(o)]??0)+a}for(const t of Object.keys(n))for(const s of Object.keys(n[+t]))n[+t][+s]=n[+t][+s]/(o[+t]||1);return n},M=Array.from({length:7},()=>[]);for(const t of k)'number'==typeof t.takings&&t.takings>0&&M[new Date(t.date+'T12:00:00').getDay()].push(Math.round(100*t.takings));const N=M.map(t=>t.length?Math.round(t.reduce((t,n)=>t+n,0)/t.length):null),_=k.filter(t=>'number'==typeof t.takings&&t.takings>0),E=(_.length?s(_.map(t=>t.date).sort()[0],l):0)>=7*f&&_.length>=2*f;return{covers:O(b),takeaway:O(p),days:T.length,spanDays:w,enough:j,minWeeks:f,takingsByDay:N,cashUps:_.length,salesEnough:E}};var t=r(_d[0]);const n=2,o=t=>{const o=Math.round(Number(t));return Number.isFinite(o)&&o>=1&&o<=8?o:n},s=(t,n)=>Math.round((new Date(n+'T12:00:00').getTime()-new Date(t+'T12:00:00').getTime())/864e5)},1054,[821]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SOLD_OUT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOLD_OUT_CLEAR_LABEL",{enumerable:!0,get:function(){return t}}),_e.soldOutSettingsOf=function(t){const n='morning'===t?.clear||'manual'===t?.clear||'close'===t?.clear?t.clear:e.clear,o=/^([01]\d|2[0-3]):[0-5]\d$/.test(t?.morningAt??'')?t.morningAt:e.morningAt;return{clear:n,morningAt:o,auto:!1!==t?.auto}},_e.clearAfterFor=function(e,t,o){if('manual'===t.clear)return;const c=(()=>{const o=n(e,t.morningAt);return ee.getTime()?o:c},_e.activeSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>o)).sort((e,t)=>t.at.localeCompare(e.at)||e.name.localeCompare(t.name))},_e.expiredSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&!!e.clearAfter&&new Date(e.clearAfter).getTime()<=o)},_e.stripText=o,_e.stripNeedsTicker=function(e,t,n){return o(e).length*n*.56>Math.max(0,t-150)},_e.soldOutCount=function(e){return 1===e?'1 dish sold out':`${e} dishes sold out`};const e={clear:'close',morningAt:'05:00',auto:!0},t={close:'When the kitchen closes',morning:'Next morning',manual:'Only when someone taps Back on'};const n=(e,t,n=0)=>{const[o,c]=t.split(':').map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+n,o,c,0,0)};function o(e){return e.join(' \xb7 ')}},1055,[]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1056,[1542,1543,1566,1568]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1057,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1058,[832,821,813]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_LOYALTY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"consentText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"prettyCardNo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"cleanCode",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"cardQr",{enumerable:!0,get:function(){return s}}),_e.readCardQr=function(e){const r=/^covercharge:card:[^:]+:([A-Za-z0-9-]{8,9})$/.exec(e.trim());return r?n(r[1]):null},Object.defineProperty(_e,"codeQr",{enumerable:!0,get:function(){return o}}),_e.checkSettings=function(e){return!Number.isInteger(e.stampsNeeded)||e.stampsNeeded<2||e.stampsNeeded>30?'Stamps needed must be between 2 and 30.':e.reward.trim()?e.reward.length>80?'Keep the reward under 80 letters.':e.gapMinutes<0||e.gapMinutes>1440?'Time between stamps must be 0 to 24 hours.':e.maxPerDay<1||e.maxPerDay>10?'Stamps a day must be 1 to 10.':!Number.isInteger(e.stampExpiryDays)||e.stampExpiryDays<0||e.stampExpiryDays>1095?'Stamps last 0 (never run out) to 1095 days.':!Number.isInteger(e.rewardExpiryDays)||e.rewardExpiryDays<0||e.rewardExpiryDays>1095?'Rewards last 0 (never run out) to 1095 days.':!e.referralOn||e.referralGiver.trim()&&e.referralFriend.trim()?e.referralMonthlyCap<0||e.referralMonthlyCap>50?'Friend rewards a month must be 0 to 50.':null:'Say what both people get before you switch Bring a friend on.':'Say what the reward is, for example Free dessert.'},_e.checkOffer=function(e){if(!e.title.trim())return'Give the offer a title.';if(e.title.length>80)return'Keep the title under 80 letters.';if(e.details.length>500)return'Keep the details under 500 letters.';const r=/^\d{4}-\d{2}-\d{2}$/;return e.startsOn&&!r.test(e.startsOn)?'Start date should look like 2026-11-30.':e.endsOn&&!r.test(e.endsOn)?'End date should look like 2026-11-30.':e.startsOn&&e.endsOn&&e.endsOn`I agree to ${e} keeping my name and the phone or email I give, only to run my stamp card and offers here. I can leave at any time and my details are removed.`,t=e=>e&&8===e.length?`${e.slice(0,4)}-${e.slice(4)}`:e,n=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,''),s=(e,r)=>`covercharge:card:${e}:${r}`;const o=(e,r,t)=>`${e.replace(/\/$/,'')}/customer/${r}/loyalty?code=${t}`;const l=(e,r)=>e.isOn&&(!e.startsOn||e.startsOn<=r)&&(!e.endsOn||e.endsOn>=r),p=r=>r?{saved:!!r.updated_by,cardOn:!!r.card_on,stampsNeeded:r.stamps_needed??8,reward:r.reward??'',stampExpiryDays:r.stamp_expiry_days??0,rewardExpiryDays:r.reward_expiry_days??0,gapMinutes:r.gap_minutes??60,maxPerDay:r.max_per_day??1,referralOn:!!r.referral_on,referralGiver:r.referral_giver??'',referralFriend:r.referral_friend??'',referralMonthlyCap:r.referral_monthly_cap??5}:{...e},u=e=>({card_on:e.cardOn,stamps_needed:e.stampsNeeded,reward:e.reward.trim(),stamp_expiry_days:e.stampExpiryDays,reward_expiry_days:e.rewardExpiryDays,gap_minutes:e.gapMinutes,max_per_day:e.maxPerDay,referral_on:e.referralOn,referral_giver:e.referralGiver.trim(),referral_friend:e.referralFriend.trim(),referral_monthly_cap:e.referralMonthlyCap}),y=e=>({id:String(e.id),title:e.title??'',details:e.details??'',startsOn:e.starts_on??null,endsOn:e.ends_on??null,isOn:!1!==e.is_on})},1059,[]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1060,[1077]); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_FILTER_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOTIF_DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOTIF_GROUP_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"IN_APP_WINDOW_MINS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PUSH_WINDOW_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KITCHEN_OPEN_DAYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"TITLE_MAX",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MESSAGE_MAX",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validHm",{enumerable:!0,get:function(){return u}}),e.ukNow=p,Object.defineProperty(e,"timeOn",{enumerable:!0,get:function(){return m}}),e.notifDue=function(t,n,r=s){const o=p(n),d=m(t,o.dow);if(t.paused||t.removed||!u(d)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd,at:d};const f=l(d);return{due:o.mins>=f&&o.minst.days.includes(n));if(!r.length)return'No days ticked';const s=new Map;for(const n of r){const r=m(t,n);s.set(r,[...s.get(r)??[],n])}const o=t=>7===t.length?'Every day':t.map(t=>n[t]).join(', ');return[...s.entries()].map(([t,n])=>`${o(n)} at ${t}`).join('; ')+' (UK time)'},e.validateNotif=function(t){if(!t.title.trim())return'Give it a name.';if(t.title.length>f)return`Keep the name under ${f} letters.`;if(!t.message.trim())return'Type the message people will see.';if(t.message.length>c)return`Keep the message under ${c} letters.`;if(!u(t.time))return'Type the time as HH:MM, e.g. 21:00.';for(const n of Object.values(t.dayTimes??{}))if(!u(n))return'Type each day\u2019s time as HH:MM.';return t.days.length?t.recipients.staff.length||t.recipients.groups.length||(t.recipients.onShiftIn??[]).length?t.sendBy.inApp||t.sendBy.push?null:'Choose how to send it.':'Tick at least one person or group.':'Tick at least one day.'},e.anchorageSeeds=function(t,n,r){const s={staff:[n,r].filter(Boolean),groups:[]},o={inApp:!0,push:!0};return[{id:t('mills-milk'),seed:'mills-milk',title:'Mills milk order',message:'Make sure an order before 9:30',days:[...d],time:'21:00',dayTimes:{5:'20:55',0:'20:55'},recipients:s,sendBy:o},{id:t('peronis'),seed:'peronis',title:"Pieroni's order",message:"order Pieroni's by phone",days:[...d],time:'21:05',recipients:s,sendBy:o},{id:t('veg-second'),seed:'veg-second',title:'Veg order',message:'Order veg on the app before 11 PM',days:[...d],time:'21:15',recipients:s,sendBy:o},{id:t('reeds'),seed:'reeds',title:'Reids order',message:'Order Reids',days:[3,4],time:'21:25',recipients:s,sendBy:o},{id:t('spezbona'),seed:'spezbona',title:'Spes Bona order',message:'Do we need anything from Spes Bona for this week? Message Anna if we do for Friday delivery.',days:[3],time:'15:00',recipients:s,sendBy:o},{id:t('olsens'),seed:'olsens',title:"Olsen's order",message:"Place Olsen's order before 3:30 PM. By phone.",days:[2],time:'13:00',recipients:{staff:[r],groups:[]},sendBy:o},{id:t('allsons-list'),seed:'allsons-list',title:'Alsons drinks list',message:'Add anything extra to the Alsons drinks list.',days:[0],time:'20:00',recipients:{staff:['st-finn'],groups:[]},sendBy:o,open:{page:'orderlists',list:'allsons'}},{id:t('tea-towels'),seed:'tea-towels',title:'Tea towels',message:'Put a load of tea towels on to wash.',days:[...d],time:'15:00',recipients:{staff:[],groups:[],onShiftIn:['kp'],fallback:{staff:[],groups:['head_chef']}},sendBy:o},{id:t('rota-upload'),seed:'rota-upload',title:'Rota upload',message:"Make sure you have uploaded next week's rota.",days:[0],time:'20:50',recipients:s,sendBy:o}]};const t={kitchen:'On shift: Kitchen',foh:'On shift: Front of house',bar:'On shift: Bar',kp:'On shift: KPs',chefs:'On shift: Chefs'},n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],r={on_shift:'Everyone on shift',everyone:'Everyone',managers:'Owners and managers',head_chef:'Head Chef',kitchen:'Kitchen team',foh:'Front of house'},s=120,o=15,d=[3,4,5,6,0],f=60,c=160,u=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t),l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));function p(t){const r='number'==typeof t?new Date(t):t,s={};for(const t of new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(r))s[t.type]=t.value;return{dow:n.indexOf(String(s.weekday).slice(0,3)),mins:60*Number(s.hour)+Number(s.minute),ymd:`${s.year}-${s.month}-${s.day}`}}const m=(t,n)=>{const r=t.dayTimes?.[String(n)];return r&&u(r)?r:t.time};const h=t=>t.open?`./?open=${t.open.page}${t.open.list?`&list=${encodeURIComponent(t.open.list)}`:''}`:'./',y=(t,n)=>`${t.id}:${n}`,g=t=>(t??'').toLowerCase(),b=t=>t.level?['owner','manager'].includes(g(t.level)):['owner','manager'].includes(g(t.role)),O=t=>'head_chef'===g(t.role)||'head chef'===g(t.level)||'chef'===g(t.app)||/head chef/.test(g(t.job)),P=t=>'kitchen'===g(t.department)||/chef|kitchen|kp|porter/.test(g(t.job))||O(t),k=t=>/\bkp\b|kitchen porter/.test(g(t.job));function j(t,n){const r=g(n.department);return'kitchen'===t?P(n):'kp'===t?k(n):'chefs'===t?O(n)||/chef|commis/.test(g(n.job)):'bar'===t?'bar'===r||/\bbar/.test(g(n.job)):'front of house'===r||!r&&!P(n)&&!b(n)}function _(t,n,r=[]){const s=v(t.recipients,n,r),o=t.recipients.fallback;return s.length||!o?s:v({staff:o.staff,groups:o.groups},n,r)}const w=(t,n,r=[])=>!!t.recipients.fallback&&!v(t.recipients,n,r).length;function v(t,n,r){const s=t,o=n.filter(t=>!1!==t.active),d=new Set;for(const t of s.staff)o.some(n=>n.id===t)&&d.add(t);for(const t of s.groups)for(const n of o)('everyone'===t||'on_shift'===t&&r.includes(n.id)||'managers'===t&&b(n)||'head_chef'===t&&O(n)||'kitchen'===t&&P(n)||'foh'===t&&!P(n)&&!b(n))&&d.add(n.id);for(const t of s.onShiftIn??[])for(const n of o)r.includes(n.id)&&j(t,n)&&d.add(n.id);return[...d].sort()}const M=t=>({id:t.external_ref,role:t.roles?.key??void 0,job:t.job_title??'',department:t.department??'',active:!1!==t.active}),T=(t,n,r,s=[])=>_(t,r,s).includes(n)},1061,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"orderListSeedId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"orderListSettingsId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"orderListSeeds",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useOrderLists",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"orderSettingsOf",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"useListOpen",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),p=r(d[5]),l=r(d[6]);const c=(e,t)=>(0,u.uuidFrom)(`order-list:${t}:${e}`),S=e=>(0,u.uuidFrom)(`order-list-settings:${e}`),f=e=>'anchorage'===e?[{id:c(e,'allsons'),seed:'allsons',name:'Alsons (drinks)',kind:'running'},{id:c(e,'cash-carry'),seed:'cash-carry',name:'Cash and carry',kind:'trip',tripDay:5}]:[],A=()=>(new Date).toISOString(),O=(0,i.create)()((0,n.persist)((e,t)=>({lists:[],items:[],history:[],settings:{},ensure:s=>{const i=t(),n=new Set(i.lists.map(e=>e.id)),u=f(s).filter(e=>!n.has(e.id)).map(e=>({...e,rid:s})),p={},c=i.lists.map(e=>(0,l.fixSupplierNames)(e.name)!==e.name?{...e,name:(0,l.fixSupplierNames)(e.name),updatedAt:A()}:e);c.some((e,t)=>e!==i.lists[t])&&(p.lists=c),u.length&&(p.lists=[...p.lists??i.lists,...u]),i.settings[s]||(p.settings={...i.settings,[s]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(s)}}),Object.keys(p).length&&e(p)},addList:(t,s)=>{const i=(0,p.uuid)();return e(e=>({lists:[...e.lists,{...s,id:i,rid:t,updatedAt:A()}]})),i},updateList:(t,s)=>e(e=>({lists:e.lists.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),addItem:(t,s)=>{const i=(0,p.uuid)(),n=s.addedAt??A();return e(e=>({items:[...e.items,{...s,id:i,rid:t,status:'open',addedAt:n,updatedAt:n}]})),i},bump:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...(0,o.bumpQty)(e,s,i.id,i.name,A()),rid:e.rid}:e)})),updateItem:(t,s)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),setStatus:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,status:s,statusBy:'open'===s?void 0:i.name,statusAt:'open'===s?void 0:A(),updatedAt:A()}:e)})),removeItem:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!0,updatedAt:A()}:e)})),undoRemove:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!1,updatedAt:A()}:e)})),finish:(s,i,n,u)=>{const l=t().lists.find(e=>e.id===i);if(!l)return null;const c=A(),{round:S,drop:f,carriedOver:O}=(0,o.finishOrder)(l,t().items,n,u,c,p.uuid),_=new Set(f),y=new Map(O.map(e=>[e.id,e])),T={...S,rid:s};return e(e=>({items:e.items.filter(e=>!_.has(e.id)).map(e=>y.has(e.id)?{...y.get(e.id),rid:e.rid}:e),history:[T,...e.history].slice(0,300),lists:e.lists.map(e=>e.id===i?{...e,nextTrip:void 0,updatedAt:c}:e)})),T},setSettings:(t,s)=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,...e.settings[t],...s,id:S(t),updatedAt:A()}}})),resetSettings:t=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(t),updatedAt:A()}}}))}),{name:'covercharge-order-lists-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)})),_=e=>({...o.DEFAULT_ORDER_LIST_SETTINGS,...O.getState().settings[e]}),y=(0,i.create)()(e=>({request:t=>e({seed:t})}))},1062,[1080,1072,1081,1104,1063,1241,1322]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_ORDER_LIST_SETTINGS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"UNITS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY_FULL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"normName",{enumerable:!0,get:function(){return a}}),e.findDuplicate=function(t,n,i,s){return t.find(t=>t.listId===n&&!t.removed&&'open'===t.status&&a(t.name)===a(i)&&u(t.unit)===u(s))},e.bumpQty=function(t,n,i,a,u){return{...t,qty:Math.round(100*(t.qty+n))/100,bumps:[...t.bumps??[],{by:i,name:a,qty:n,at:u}],updatedAt:u}},Object.defineProperty(e,"qtyText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"validQty",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"liveItems",{enumerable:!0,get:function(){return d}}),e.finishOrder=function(t,n,i,a,u,s){const o=d(n,t.id),l=o.filter(t=>'got'!==t.status),c={id:s(),listId:t.id,listName:t.name,finishedAt:u,finishedBy:a.id,finishedByName:a.name,items:o.map(t=>({name:t.name,qty:t.qty,unit:t.unit,note:t.note,status:t.status,addedByName:t.addedByName})),carried:i?l.length:0},p=i?l.map(t=>({...t,status:'open',carried:'missing'===t.status?'missing':'not-got',statusBy:void 0,statusAt:void 0,updatedAt:u})):[],m=new Set(p.map(t=>t.id));return{round:c,drop:o.filter(t=>!m.has(t.id)).map(t=>t.id),carriedOver:p}},e.nextTripDate=p,e.tripText=function(t,n,a){const u=p(t,n,a);if(!u)return'Running list';const[,s,o]=u.split('-').map(Number);return"Next trip "+(u===n?'today':u===l(n,1)?'tomorrow':`${i[c(u)]} ${o} ${['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][s-1]}`)},e.initials=function(t){const n=t.replace(/\(.*?\)/g,' ').split(/[^A-Za-z0-9]+/).filter(t=>t&&!['and','the','of','&'].includes(t.toLowerCase()));return n.length?(1===n.length?n[0].slice(0,2):n[0][0]+n[1][0]).toUpperCase():'?'},e.telHref=function(t){if(!t)return null;const n=t.trim().replace(/[^\d+]/g,'').replace(/(?!^)\+/g,'');return n.replace(/\D/g,'').length>=6?`tel:${n}`:null};const t={allowStaff:!0,defaultTripDay:5},n=['','cases','bottles','kegs','boxes','bags','packs','kg','litres','each'],i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],a=t=>t.trim().toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').replace(/s$/,''),u=t=>t.trim().toLowerCase().replace(/s$/,'');const s=t=>`${Number.isInteger(t.qty)?t.qty:t.qty.toFixed(2).replace(/0$/,'')}${t.unit?` ${t.unit}`:''}`,o=t=>Number.isFinite(t)&&t>0&&t<=9999,d=(t,n)=>t.filter(t=>t.listId===n&&!t.removed).sort((t,n)=>('open'===t.status?0:1)-('open'===n.status?0:1)||t.addedAt.localeCompare(n.addedAt));const l=(t,n)=>{const[i,a,u]=t.split('-').map(Number);return new Date(Date.UTC(i,a-1,u+n)).toISOString().slice(0,10)},c=t=>{const[n,i,a]=t.split('-').map(Number);return new Date(Date.UTC(n,i-1,a)).getUTCDay()};function p(n,i,a=t.defaultTripDay){if('trip'!==n.kind)return null;if(n.nextTrip&&n.nextTrip>=i)return n.nextTrip;const u=n.tripDay??a;return l(i,(u-c(i)+7)%7)}},1063,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useClockArea",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"areaOf",{enumerable:!0,get:function(){return _}});var e,t=r(d[0]),n=r(d[1]),s=r(d[2]),u=(e=s)&&e.__esModule?e:{default:e},c=r(d[3]),l=r(d[4]),E=r(d[5]);const o=(0,c.create)()((0,l.persist)(e=>({areas:(0,n.privateClockVenue)(t.VENUE_RID)?{[t.VENUE_RID]:(0,n.venueClockArea)(t.VENUE_RID)}:{},visiting:{},set:(s,u,c)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{...e.areas[s]??{},...u}),updatedAt:(new Date).toISOString(),updatedBy:c}}}),reset:(s,u)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{lat:e.areas[s]?.lat??null,lng:e.areas[s]?.lng??null}),updatedAt:(new Date).toISOString(),updatedBy:u}}}),setVisiting:t=>e(e=>({visiting:Object.fromEntries([...Object.entries(e.visiting).slice(-60),[t,!0]])}))}),{name:'covercharge-clock-area-v1',version:1,storage:(0,l.createJSONStorage)(()=>u.default)})),_=e=>t.IS_ISOLATED_VENUE&&e!==t.VENUE_RID?(0,E.cleanArea)(E.DEFAULT_CLOCK_AREA):(0,n.venueClockArea)(e,o.getState().areas[e]??{})},1064,[5,868,1080,1072,1081,869]); +__d(function(g,_r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inApkWebView=function(){return'undefined'!=typeof navigator&&(/; wv\)/.test(navigator.userAgent)||/CoverChargePhone\//.test(navigator.userAgent))},e.sendTestPush=async function(){if('staff'!==o.useSync.getState().kind)return{ok:!1,message:'Sign in from your personal link first.'};try{const t=(0,n.getSupabase)(),{data:o,error:s}=await t.functions.invoke('push-test',{body:{app:i.APP_VARIANT}});if(s)return{ok:!1,message:'Test notifications aren\u2019t switched on yet. Alerts still show while the app is open.'};const r=o?.sent??0;return r?{ok:!0,message:`Sent. It should appear on this phone in a few seconds${r>1?` (and ${r-1} other device${r>2?'s':''} of yours)`:''}.`}:{ok:!1,message:'No phone is connected for you yet. Tap Turn on alerts first.'}}catch{return{ok:!1,message:'Could not send a test. Check your connection and try again.'}}},e.pushState=f,e.resaveIfAllowed=async function(){if('undefined'==typeof Notification||'granted'!==Notification.permission)return!1;return(await c({silent:!0})).ok},e.turnOnPush=c,e.turnOffPush=async function(){const t=await(navigator.serviceWorker?.getRegistration()),o=await(t?.pushManager.getSubscription());if(!o)return{ok:!0,message:'Phone notifications are off for this device.'};const i=o.endpoint;await o.unsubscribe();try{const t=(0,n.getSupabase)();await t.from('push_subscriptions').delete().eq('endpoint',i)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),i=_r(d[3]);_r(d[4]);const s=t=>{const n=atob(t.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-t.length%4)%4)),o=new Uint8Array(n.length);for(let t=0;t'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),u=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return r()&&!u()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const t=await navigator.serviceWorker.getRegistration();return await(t?.pushManager.getSubscription())?'on':'off'}async function c(r={}){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Chrome has alerts switched off for CoverCharge. Switch them on in Chrome\u2019s settings, then try again.'};const c=o.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if(r.silent&&'granted'!==Notification.permission)return{ok:!1,message:'Alerts are off on this phone.'};if('granted'!==(r.silent?Notification.permission:await Notification.requestPermission()))return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(t.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,n.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:i.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}}},1065,[1414,871,823,807,123]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSliders",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"notify",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"dismissNotice",{enumerable:!0,get:function(){return c}});var t=r(d[0]);let u=0;const s=t=>'urgent'===t.tone?0:'warn'===t.tone?1:2,n=(0,t.create)()((t,n)=>({queue:[],push:n=>t(t=>{const o=t.queue.find(t=>t.id===n.id),c=o?t.queue.map(t=>t.id===n.id?{...n,seq:o.seq}:t):[...t.queue,{...n,seq:++u}];return{queue:(f=c,[...f].sort((t,u)=>s(t)-s(u)||(t.seq??0)-(u.seq??0))).slice(0,40)};var f}),dismiss:u=>{const s=n().queue.find(t=>t.id===u);if(s){t(t=>({queue:t.queue.filter(t=>t.id!==u)}));try{s.onClose?.()}catch{}}},dismissWhere:t=>{for(const u of n().queue.filter(t))n().dismiss(u.id)}})),o=t=>n.getState().push(t),c=t=>n.getState().dismiss(t)},1066,[1072]); +__d(function(g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AvatarOptions=function({value:e,onSelect:h}){const y=[...new Set(l.AVATAR_OPTIONS.map(e=>e.category))],[f,p]=(0,t.useState)(y[0]);return(0,u.jsxs)(n.default,{testID:"avatar-options",style:{gap:12},children:[(0,u.jsx)(c.T,{center:!0,size:20,weight:"semibold",children:"Choose an avatar"}),(0,u.jsx)(c.Muted,{center:!0,children:"Original artwork, including the Bar & kitchen items from Lenny\u2019s game. Your existing avatar stays until you choose another."}),(0,u.jsx)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:y.map(e=>(0,u.jsx)(c.Chip,{label:e,selected:f===e,onPress:()=>p(e)},e))}),(0,u.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:10},children:l.AVATAR_OPTIONS.map((t,n)=>t.category===f?(0,u.jsxs)(s.default,{testID:`avatar-option-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${e===t.dataUrl?'Selected. ':''}Choose ${t.name} avatar, ${t.category}`,accessibilityState:{selected:e===t.dataUrl},onPress:()=>h(t,n),style:{width:156,minHeight:118,padding:8,alignItems:'center',justifyContent:'center',gap:5,borderWidth:2,borderColor:e===t.dataUrl?o.colours.gold:o.colours.border,borderRadius:14},children:[(0,u.jsx)(a.default,{source:{uri:t.dataUrl},style:{width:76,height:76},accessibilityLabel:t.name}),(0,u.jsx)(c.T,{center:!0,size:14,style:{alignSelf:'stretch',width:'100%'},children:t.name})]},t.id):null)})]})};var t=r(d[0]),a=e(r(d[1])),s=e(r(d[2])),n=e(r(d[3])),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7])},1067,[31,197,264,128,1068,824,817,25]); +__d(function(A,B,g,w,C,D,Q){"use strict";Object.defineProperty(D,'__esModule',{value:!0}),Object.defineProperty(D,"AVATAR_OPTIONS",{enumerable:!0,get:function(){return P}});const P=[{category:"Animals",id:"cat",name:"Golden cat",look:1e3,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB3wUxff/zqUTei+hd6QkCKhgQcXeC6ikodjB3vXvT+wdFbErkgIoNlQUe0Gkk4QivfdAQiCN1Nv/exsO7nb3Llf27vaS3c/N7dQ3772ZefvmzeysBeYV8hzISUvplZOZcmlWRsr9WZkpL5KbkpWR+jG5WVmZqd+S+y0rM2VhVkbKyqyM1M1ZGSl7KXwkOzNVYsd+OS4jZRPdV1J4YVZmKpWhshmps7IIVk5m6ltZBDtnRup92Rmpl3CdIc84kwCYAiAEOoEkQaxJS+6UlZl6Lg3GO2jQvkGDcC7dN2ZlplRKYWIDZfleCPG6gHiU3F1CYDy56wVwOblzBcRpQoiBQqC7EKIdhRvbSGe/HCdED7oPpPBpAqAyVFbgekGwJOBuQbAJl8kQmMt1ct3ZGSkbsjNS55KbnJWZfPvK9ORzVs+6sSPlEzb45t24HDAFgAHbZmVGUu/szORbaFBlZmWk5NBT11oZZtlBI+o3GozvEsr30iC8hO49BUQ43YPyk+sWopeMi8B9Apb3rBbL71XV1p2Mc3ZmanZWRmpa1ozU8abGAENepgAIcrNIkyZZcmalJGRnpNxDg+VLGjT7rSJsPWD5EAKJQohBQUbRl+rjhUCKkPCxRFoK0bcvOzNldlZmyl3ZM8bFM+2+ADfL+sYBLm0KAOZCAN2a2aMjc2Ymn56dmfoYDYQfs3tsLZCqRRaEeJMGyzWEShtydfJH9LUFxGgBMQWSlJ3dY9shEnw/ZGUmP5qdkTR8+Qe3RsC8AsoBUwAEiN3ZM1KuyM5MmV5REXNYslr+oWpfoIFwEbnjc3GK8+pXWl6JLXsKsWDVfnz913b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k6crMXDIInwxOyXrmiFJljCHF6kjBIizoz6fXkjpOJQV8hsKrpJnvU/iQhhRfUviF0hZS/nJK20T/eyh+qK4uvpbTJGkj/S+n+MIjZfAlKfYcKvO+AKZT+jOUP5XiF3KdXDd5LJ3ISI0hZb8+KTXz2cEpmZ8kT5yZRwpPE3p1NQTuf1On7P8BAAD//xNsaMkAAAAGSURBVAMAeJBrOqX/MDMAAAAASUVORK5CYII="},{category:"Animals",id:"fox",name:"Copper fox",look:1002,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB3wUxff/zqUTCCWU0HtHSBAQxII/ERV7AZU0BDsWFLt/f2LDjsjPrggpgGJX7B2RJiSh994CBEJIAqm3//cWLtzd7l0ud3t3u8neZ+d2yps3772ZeTvzZnbWAvNneAnkpKV0y8lMuTwrI+WBrMyUF8hNz8pI/ZDc3KzM1K/J/ZqVmbIoKyNlZVZG6pasjJR9FC7IzkyV2LFfjstI2Uz3lRRelJWZSnkob0bq3CzClZOZ+kYW4c6ZnXp/dkbqZVym4QVnMgBTARigEUgSxJq05HZZmakXUme8kzrt69QJ59N9U1ZmSrkUIjYSyLdCiNcExKPk7hEC48ndKIAryV0oIIYIIfoKgc5CiJYUjrGxzn45TogudO9L4SECoDyUV+BGQbgk4F5BuImWqRCYz2Vy2dkZKRuzM1Lnk5ualZl8x8r05P+snntzW4ITNvzmXb8SMBWADutmZUZS9+zM5FupU2VmZaTk0FPXWh5i2Uk96lfqjG8TyROpE15G964CIpTuQbnksoXoJtMicL+A5R2rxfJbRaV1F9OcnZmanZWRmpY1O3W8OWKALn+mAghytUiTJ1ty5qYkZGek3Eed5TPqNLlWEbIBsLwPgUQhRL8gk+hL8fFCIEVI+FCiUQrxtz87M2VeVmbKPdmzx8Yz774gN/P6JgHObSoAlkIA3Zp5o8Jz5iSfk52Z+hh1hO+zu2zLlypFFoSYRp3lOiKlBblaeRF/cYAYJSCmQ5Kys7t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x8MGjn98yHpc37KzUt6ynq7OfTnLZNBMRQEgQz6Mn3gQTsDQZeAalTkvbQgH+faWWamfbh6VkXpKZnP808Yd4EBA+jkkYOGAKgkRXB8fCcdmjavNUkDF6lJ98VpPImRYjaXjRIppFA4INNNwUHMx/UKkkbacC/w7SYzOaeNNCTacBfybQyzUy7D2oxivCCA4YA8IJ5/spK69lbaZBkkUCYTppC36joimYiQhpOAmGSBPO9DYMKv9DAomVHCiFYl8SV76LafyE1/m0hSfdIkCbRQn4qDfhEGvD9aMBfw7QMy8jZRnDGL8Q4YAiAEGsQLXRonbss5crsfBIIHw1Py3miYVBlnUYDqws5kzBhMJ9eS8PxThqAT5B7iUbmO+TepynF5+R+pLgllL6K4rbQfR+FSyx1sV+Ok6TNdF9F4SUNefA5DewFlOcdAbxI8U9Q+p0UvpDr5LpJY+lKQuo0GuzXpqRnPzk8Lfuj1KnzCmjAk0HPUkPo3ps6Zv8PAAD//32vqG4AAAAGSURBVAMAcztRK+jK+zgAAAAASUVORK5CYII="},{category:"Bar & kitchen",id:"espresso-martini",name:"Espresso martini",look:1004,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB3wURRf/z6XTey/SOySRpvipKCqC2EEhDQF7o4mAotgbYgEFkZbcBRS72HtBOrnQu1TpvaXffPMWLlx2Zy+X5HK5S2Z/N7czb9qb/8y8nXkzO2uBugIegdTE+JaptvibUqzxI1Ns8a8I826KNWGmMPNTbAlfCfNLii1+cYo1fnWKNWFbijV+n3CftNsSOBmyazRr/FZxXy3ci1NsCSKOiGtNmJ8i0kq1JbyTItJOTU4YYbcm9KU8Ax44VQAoARAAjYBzsHWJcY1SbAnXis74oOi0b4lO+I24b0mxxWfxILZZBFnIGHuTgY0V5lHGMFSYuxlwszDXMrDLGGMdGUMzxlhd4a7kLDrZNRpjzcW9o3BfxgARR8RluJuJtDjwGBNpC14mg+EbypPytlvjN9utCd8IMznFFvfA6qS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HsZTlwpdE2ek9806xc5dGxSa+Lhp7PzGnrR4E1lEIgofFk+9jDuwrCb58kifn/4kO/xGVlcpMZY+OS7w5Ki7pDcKEsPEJHyqTXASUAMiFomQsNKftGDt3rRAG74sn391iyFs/iGU1E51ksBAIdLDp1pLhzAu5cr5FdPhZVBaLw9FUdPQGosMPpLJSmansXshFJVEEBJQAKAJ4xRVVrGf/KzpJohAIQ8VIoWVI6LmKLIhHC4HQn8Mx7nynwh+iY4llR+FCSV2cMt8jcv9DDONnMs7HcvD+YiE/SnT4CqLDtxIdfhiVpVO8dYcIp35+hoASAH5WITJ2xDr3mciBSXYhED6NjrW+er5TJfYUHauhMBZmQXs6vVZ0x1GiA74qzBTRM2cJ85GYUnwtzK+CtkT4rxG07eK+X7hPOfMiu0bjfJu4rxHuJefj4GvRseeLOLMY8K6gvyr8Rwn3LZQn5S1GLI2EkOopOvu9kXFJr0XHJn0aFTM3VXR4odBz5uC/97LO2f8BAAD//8y5WdoAAAAGSURBVAMAtJIW/px4tPEAAAAASUVORK5CYII="},{category:"Bar & kitchen",id:"coffee",name:"Takeaway coffee",look:1005,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB2AUxdd/s5dO7x2kd0giTbChCPYOCmkoiopd7OUDGzZEsRcUUgBF/Yu9KyoCUpLQu/ReQklyqTffe5vcZW93dnNJLsmV2WRuZ968ab+defumrgLy8nsEMpMTu2WmJV6enpr4QHpa4gto3khPTZqFZn56WtJXaH5NT0tckp6auDo9NWlbemrifnSfzEhL4mTIrtJSE7fifTW6l6SnJWEYDJuaND8d48pMS5qZjnFnzk26PyM16TJK0++BkwUAKQD8oBJwDmxdckL79LSkC7Ex3oGN9jVshN/ifUt6WmIht7HNyPINY+xVBuxRNHczBhPQ3MgArkRzIQN2FmOsH2PQmTHWCt31nUUnu0pjrAve+6H7LAaAYTAsgxsZxsUB7mEYN+ZlBjD4ltKktDNSEzdnpCZ9i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},{category:"Bar & kitchen",id:"steak",name:"Steak and chips",look:1006,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB3wURRf/z116IyGU0EvoNQm9KQhi74IKKSh2RbG3T8XesXcUSIIoioKiKIoNpJNC770TSAgJ6bffvA0X7rZdL0l2fze3M2/ezLx5O/P2zZuyBuhXredAzszUTjmZqZdnZaQ+mJWZ+gp372VlpE3jbnZWZtp87v7IykxdlpWRmpuVkbYjKyP1EA+fys5ME8iRX4RlpG7n91weXpaVmcbT8LQZabOzeF45mWnvZvG8c2alPZCdkXYZlVnrGadXALoAqAWNQBDANsxMaZ2VmTaSd8a7eKd9m3fCBfy+LSsztUIwsq0c5SfG2FsM7HHuJjGGidzdyIAruRvJwAYxxnoxhnjGWDMejjJXnfwijLEO/N6LhwcxgKfhaRluZDwvAbiP8bw5LVPBsIDKpLKzM1K3ZmekLeBualZmyp256SkXrJ99cyuOx8z563f/5YAuAPzw2eRmJHfOzky5jXeqzKyM1Bz+1jVVGA17eY/6g3fGjzjJk3knvIzfOzKwAH73yU8sm7FOIi0MDzAYPjYZDIsrq0z7iObszLTsrIy0mVmz0ibqGgP88tIFgI8fizBliiFndmpidkbq/byzfMc7zRETM24BDJ+BYTxjrLePSXSl+ATGkMoETBO4lsLrdzg7M3VOVmbqpOxZExKo7q5krqd1jQOUWhcAxAUvug1zxgTlfJUyNDsz7QneEX7J7rArX6hiWWDsHd5ZruOkNOWuVv4CQqMRFNEEgfxuDAoHMwRa1YMxxAFsDAN7D4KQnd1h90ku+H7Oykx5PDsjefCaT2+3TgD98jQHdAHgaQ6fzT97VupV2ZmpM8rLQwsEk2EJB7/MO8Il3NWMxTnMqd+ZsgrsPFiIpeuO4Pu/92DWop34csE2fPzDFrwzZyNez1yP56fn4KlP1+DhD1Zh0tTluP21pRj/3D+iIz/BKI5wCJfSUFrKg/KiPClvKoPKKimrlNFaWXIKxsAQBIbHIjgqDqENWyMs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AAAAABJRU5ErkJggg=="},{category:"Bar & kitchen",id:"fishchips",name:"Fish and chips",look:1007,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB0BUx9b+ZpfemzSxYtco2NNjTO9NUxQwPX/aS3nJe0leXkx9een1pccCxvSY3hMTY1fALnYUBRTpSN/7n3MR3N1bdhd2lwX2ssOdOXNm5sy5M+eeOVOuAd6ry3Mgd176kNys9AuyM9Pvyc5K/w+5V7IzM94ltzA7K+NLcr9kZ6Uvy85MX5edmbEjOzP9AIUrcrIyJHbsl2GZ6dvpvo7Cy7KzMigNpc3MWJhNeeVmZbycTXnnLsi4Oycz43wus8szzlsBeAVAF2gEkgSxcV5a3+ysjKnUGf+POu2L1Am/ofu27Kz0Rsko8gjlayHE8wLin+TuEALXk7tKABeRmyogjhdCjBYCyUKIBAqHtVad/TJMiEF0H03h4wVAaSitwFWC8pKAOwXlTbS8AIFvuEwuOyczPS8nM+Mbci9kZ6Xdsm5+2ukbFl7bh/BEa/7eu+dywCsAPPDZrMucOTQnK+1G6lRZ2ZnpufTWNTUaDfnUo36hzvg/Ivku6oTn032wgPChe6f85LKFGCLTInC3gOENk8Hwa1OzaS/TnJOVkZOdmTEve0HG9V6NAR55eQVAJz8WafZsQ+7C9NSczPS/UWf5lDpNkUkYtwKGtyEwQwgxppNJ7EjxKUIgXUh4VyIthepXmJOV/nF2VvodOQtmpXDdO5K5N23HOMCpvQKAueBGt/HjaX65H6SdlJOV8QB1hO9yBu0qk5pFNoR4iTrL5URKHLku+fMJjIBfSCx86W70C4Yw+FrUQwjEA2KagHgFkpSTM2h3KQm+b7Oz0v6ZkznzhDVv3WSZAN7L1RzwCgBXc/ho/jkL0i/OyUqf29AQWC6ZDEsI/BR1hHPJtY3FCdau35H6RuzcX4m/1hfh88V7sOCnnXj/m21444uteOnjTXgmawMem5OLh95ag7+/tgp3vLAcN/33L8x49A/ZsZ9hHMc4jMtpOC3nw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ACSgE0ADx/ZSV79h/USXJIIUylkULP8IjD8cIm00khjJdw3He0U+E76lhkdqQQGusjufDNVPp3NIyfIaS8V0KOJ0N+GnX4OOrwvajDX811GZSVt57Sqa/FEFAKwGI3xEwcsnMfTJ2YW0gK4YP0jLwnjnaqnNHUsTqQ04SG/nx6LXXHu6gDPkHun9Qz3yT3Lk0pPib3NdHmUfxioq2j63YK768ui/1OmpRr6bqYwvOO5sHH1LFnU543BfAC0Z+g+LsofCGXyWXTiKUjKanR1NmvSc3MfTI9I/eDtMkzi6jD04JedQnWvTZ1yf4fAAD//8S3OCMAAAAGSURBVAMAjNaowotdvhIAAAAASUVORK5CYII="},{category:"Sea & harbour",id:"anchor",name:"Gold anchor",look:1012,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB3wUxff/zqUnEEoSCITeQYQkVMtPsfcuSElBRKzYsPv3J/7sitg7CCmAoti7YkWRloTee0tIIAESSL39v3cQuNvdu1zZu9u77H5ubnfezLx5783M25k3ZU0wroCXQEFWRo+C3IzL83Iy7svLzXiO3Ot5OZnTyM3Jy838ktwvebkZ/+TlZCzPy8nclJeTsYf8B/NzMyV2/GyB5WRspPty8v+Tl5tJaShtTuacPMJVkJv5Wh7hLpiVeW9+TuZlnGfAC85gAIYCCIBKIEkQq7LSO+TlZp5HjfE2arSvUCP8hu4b8nIzaqQQsZ6ifC2EeFlAPExuohC4idxIAVxJ7jwBcZoQop8Q6CqEaEP+2HrW+dkCE6Ib3fuR/zQBUBpKKzBSEC4JuEsQbqJlKgS+4Tw57/ycjPX5OZnfkJual5t+6/Ls9HNXzrmxPcUT9fiNu34lYCgAHZbN8py0nvm56TdTo8rNy8kooLeuuSbEtJ1a1C/UGN8mku+hRngZ3bsLiFC6++VnyVuIHhZaBO4VML1jNpnm19aZdzDN+bmZ+Xk5mVl5szJvMnoM0OVlKAA/F4s0ebKpYE5GSn5Oxt3UWD6lRlNoFiHrANP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AAAABklEQVQDAK25FA2T88TBAAAAAElFTkSuQmCC"},{category:"Sea & harbour",id:"sailboat",name:"Golden sailboat",look:1013,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB2AURRf+5hJSCCUBQg0dpEMSaYoiKHawg0AqXelFUFQEsWHD7q+IkgYo9t57QQSS0EFAeg+hBlJv/vcOApfbveRy/ZK57GR32ps338y8nXlT1gD183kEMpPjL8lMi++fnho/NT0t/ikyL6enJiwkszQ9LeFTMj+kp8X/lZ4avyY9NWFbemr8frKfyEhLkGz42eSWGr+V7mvI/ld6WgLFobipCUvTiVZmWsJL6UQ7c3HClIzUhJs5TZ8HTmUASgD4QCWQEmJ9clyT9LSEa6gx3kuN9gVqhF/Q/d/0tPgC6Se2UJDPhRDPC4gHyEwQAiPIDBbALWSuERCXCSE6C4GWQogGZK9RnHV+NrkJ0Yruncl+mQAoDsUVGCyIlgQmCqJNvMyHwBecJqedkRq/JSM14Qsy89PT4u5ZkxJ39bqlwxpTOFFMX929FwElALywbNakxrbJSIsbRY0qLT01PpPeusYCP8MualE/UGN8nVieTI3wZrq3FhD+dPfIZUpbiEtMvAhMETD8z2gw/FhYZNzNPGekJWSkpyYkpy9OGKF6DPDKnxIAHi4WOWeOIXNpfFRGavwkaiwfUKM5aBR+mwHDAgjECCG6eJhFR5KPFALxQmKhpF4K5e9ARlr8svS0+AkZixMjOe+OEFdxHUOAYysBwCi40axfNjAgc0ncFRlpCTOpIXyV0eq/Y7JIpEOIF6mx3Ems1CNTIS/KX31ADBQQL0PKjIxWO7JJ8H2Znhb3QEZq7OWr3hxdBernVgSUAHAT3BmL42/NSItPys8PPi6Nht8p2SepIdxI5sJYnNzsus7kFWD7vpP4Y+1BfPTLTiz+bjve+eJf/O/jzXhx2QY8k7YOcxdl4qE3V+G+V//BhPnLMfrpPxDz6K8mw8/sxn4chsNyHI7LNJgW02TanAandTav0C5ezSMJoCYJvpsEDE9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LX9IDqTIBhHb773JLDfE3y5JU0p91GDf5fzynnmvEfHJd8SFZfyLGPC2LiFD5XIBQSUALgAhWceeEzbOTZpHQmD1+nNN5i6vI38REFLaiSJJBD4YNOtnuHMCalK+S81+Lc5LwajsQU19Ahq8EM4r5xnzrsTUlEkHEBACQAHwHNVVJrP/o8aSTIJhBHUU7ikSsCZ6sJPRpNAGChhnHmuUeEXalg07Ug2eOonOfE9lPov1I1fKKR8QEIOpIn8KGrw1ajBt6EGP5Lz0iU+dQeFU5eXIaAEgJcViB47NM99OnJISgYJhA+iY1PnnWtUyX2pYTUmYxAGdOTTa6k5TqMGOI/MK9Qy3ybzLg0pPiPzI7ktJ/+15Lad7gfIfrI4LX42uUm5je5ryb78XBx8Rg17KcV5WwAvk/s88p9G9ls5TU6beixNSEj1pcY+KjIu5eno2JQPomKSMqnBk0KvOAXvvVd2zv4PAAD//ySkLN8AAAAGSURBVAMAW/Sd7+z5M38AAAAASUVORK5CYII="},{category:"Sea & harbour",id:"lighthouse",name:"Harbour lighthouse",look:1014,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB5wURdZ/1bM5EZaFhV2WnNPuShI9hRMxZ0Flo2A6I4p6hs+TMwfEcHomlN2dART1xOzpmRVUYGfJkiTnnDdOfe8NzO5Md81O6snVv6npyvXev6pevwpdrYC8wh6BqvLinlWm4gsrjcV3VZqKn0TzUqWxZDqa2ZWmko/Q/K/SVDyv0li8uNJYsrbSWLwN3QfNphJOhuxWP2PxGrwvRve8SlMJpsG0xpLZlZhXlankxUrMu2pmyZ1mY8kFVGbYAycZACkAwqARcA5sWXlRTqWp5CzsjH/DTvs8dsJP8b660lRcxw1sFUb5hDH2HAN2H5rbGIOJaK5mABejOYsBO5UxNpAx6MYYa4/uNBvrZLf6MdYd7wPRfSoDwDSYlsHVDPPiALczzBtpmQYMPqUyqWyzsXiV2VjyKZpplaaimxZXFP116exrO2I8Zstf3kM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:"Sea & harbour",id:"shell",name:"Scallop shell",look:1015,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4Aew9B3wUVfrfm910EggkEBKKSEeEBGmKZzl711OwkILd07OXU+/vyenpeaeiZ++SAnjYy1nPXhFIQhGkSA0QICSBtM1md97/+xY27M7MzmyZnZ1NJr99mdff975573vf+773vhHA+ot7DFSXFo+orig+s7K8+JbKiuJ/oHuisrzkJXQLKitK3kX3v8qK4h8qy4uXVZaXrK8sL96O4b1VFSWcHPk9ceXF6/C5DMM/VFaUYBksW16yoBLrqq4o+Xcl1l09r+TmqvKSM6jNuEec1QGwCEAcDALOga0sLRpUWVFyAk7GP+KkfQwn4Qf4XFtZUdzBbWwNZnmfMfYoA3YnuusZg8vRXcQAzkZ3AgN2JGNsHGMwlDHWH8MZ3q6T3xPH2DB8jsPwkQwAy2BZBhcxrIsD3MCwboRlDjD4gNqktqvKi9dUlZd8gG5OZUXRNcvKin6/YsGlAzEf89ZvPc2LAYsAmPDdLCsvHFlVUXQlTqqKyvLialx1xQ6bsBln1P9wMj6DIN+Ek/AMfA5nwOz4jMnP0zZjIzywMLiZgfCsKAifu9ziFoK5qqKkqrK8pLRyXsnlFscApvyzCECMXwufPVuoXlBcUFVefCNOljdw0tSKzPYrgPACMJjJGBsfYxAjaT6fMShmHF7iyKVg/3ZUVRQvrKwovr5q3qx86nsklVtlI8MAlbYIAGHBQLdy4fTE6vlFR1dVlNyFE+HDqmEbGribVQJjj+NkOR9B6YeuS/6wfzkAbDoD9gRwXlU1bGM9Er7/VlYU3VlVXnjUkuevSgDrz1AMWATAIHRXzSs+p6qieK7TmdLIReFbbPZBnAinoevci2NcWL/W9g74bds++G55Lbz11SaY9+lv8MoHa+HZt3+Fxxf+Av+qWAH3vVoNf3l+Cdz21M9w/Zwf4ap/fgcz//a1x5Gf4iiN8lBeKkNlqQ6qi+qkuqkNaqut3RUWrL6FGEBPJHynMxD+Acz2v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bAYTXSiQGLAHSiIjYe2tOOK5y7AonBM7jyXYQsb56NdQzFSTILCQIZNl0XG8h0aJXztTjhX6a+CKJ4KE70ATjhL6a+Up+p7zq0YlURAQYsAhAB8qJVFPXZG3CSlCJBuBw5hREJia3pzMYnIEGYzkG8a/+kgq9wYqHaEUMQqz9OjW/F1r9CNv4lxvmdHPh0VOQX4ITvgRN+JE74K6gv44vLN2I+62cyDFgEwGQvRAkc1HM3519cVoUE4Y0JheUP7Z9UpcfjxBqITmACjCXrtTgdb8UJ+BC6J3FmvozuNdxSvIfuc4z7EdOXY9xv+NyB4X3etsjvieN8PT6XY/jH/WXgPZzYC7DMywzgCYx/CNNvxfA51Ca1jRzLICRSx+NkvzK/qOyfEwrL3iiYObcaJzwK9LwtmPfZ3SH7fwAAAP//GEJZlQAAAAZJREFUAwD6xyQNRACAcwAAAABJRU5ErkJggg=="},{category:"Sports",id:"football",name:"Football",look:1016,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AewdB5QUxbJ69jI555zzHTlJUAQFMYDEi5JEFERQVPwKBhREARWUzEVQEEVQjAgikrk7cs45ZzgubP+qgT12Z2Zzmt2beds7Haq7q2q6a6qrwwigXT7PgfSEmJrpyTFPpSbFjEpNjvkE3ZepSbFz0S1KTY79Cd1fqckx61OTYranJsUeSk2KOYPh62nJsZwc+cW4pJiDeN+O4fWpybGYB/MmxS5KxbLSk2O/SMWy01NiX0tLiu1Gdfo84zQCQBMAPtAIOAe2KyG6Ympy7GPYGV/CTjsVO+HPeD+QmhyTxXVsP4KsYIx9zoC9hW44YzAQXV8G8DS6xxiwVoyxhoxBNcZYGQwXNJBOfjGOsep4b4jhVgwA82BeBn0ZlsUBRjAsG3GZAgx+pjqp7rSkmP1pSbE/o5uSmhw9dHti9KM7F71QAeGYoXztrl4OaAJAhc9me1JUrbTk6MHYqZJTk2LS8a2rz9IJx7FH/YWd8WtEeSR2wm54r8GABeDdKz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VKvhTEumaZ+0aX8yjd2kMaO8pIDFS3gTXCcFxOTJNhqisgXhdmLeBAHpCpoi5JA7oTMLJzBe4daicSySOydgeP/m8nJX3uTy+G0peHPi2Zg+aahsgnwsvTdNK7qT4OiM0f9oj6vPa40RBD+kZxMkd2qETtRpW9Db+ZTQACLCBPiZwziOYXgawmk47WjKg8/EnzCqOzjvl+8ZIJfFo5THb+0rr4i8cXh7DKfRS3KnBDCOjCt8uSSpCJAySZN/KdOMTLF3MA2Zlr5kZ6bxTAFTAHimkV8gklOzviWGTktusaOhBWIwZfovYvZvyfntSzK8FqFHu4akWGyMoSnNcNnZrTByWDv5hNvx13XDQ6N7YTJ12hfo7XxKaJyPj/99HviZwziOYXgawqficlrOg7+K079bY3DeXAb8dkmFpMH/hkZJDzNNklvuaEA0Gkua/O/9VoSOjOoyiKUuVz4Yded95n1Spy1MSc18gZj9CprTJlghepMguJvefP+TgD3BwCsgZUrSburwn3Jduc5c975pmVempGW9yDRh2gQED7OQKgqYAqCKFMF54Dlt79RpK0kYvEVvvhtpyNvCKso7UCcZSwKBDzbdGBzM/FCqJG2gDv8h18Vis7Wnjt6SOvxNXFeuM9fdD6WYWVSDAqYAqAbxaiop2bO3UCfJJIFwK40UOodHnIwXVqkvCYSREmyPnupUmEcdi8yO5EOwLokL30mlz6Nh/AdCkh6RII0kQ34Kdfg46vBdqMPfxnXpk569leDMn8EoYAoAgzWIFjpk5z6RfFNWHgmEz/umZj93qlNlDqOO1YqcRVjQk0+vpe44kTrgc+Rep575IblPaUoxm9xcCltA8SsobDPd95L/mL0sfpbDJGkT3VeQf8GpNJhNHXsGpflQAFMp/DmKn0j+q7hMLptGLK1JSA2jzn57clrW831Tsz5PGTMtnzo8KfTsJRj3Xtcx+38AAAD//2fZzZkAAAAGSURBVAMAj7wjSX61RCIAAAAASUVORK5CYII="},{category:"Sports",id:"tennis",name:"Golden tennis ball",look:1018,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAC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WOrwLanD96IOfwvXZVBi6m7C038a44AuADT2QNTIoXnu4pgJKRkkEL6Oi0999VSnSh5NHasDOYMwoD+fXkvd8WHqgK+Se5965kxyX9CQYhG5Pwm2guI3EGwn3Q9TuKimLPabYJK0g+4bKLziVBosoo49n9LMFMB7BH+V4h+m8P9xmVw2aSwdSUiNps5+a0xCymtx8Slfx06ak0kdngx6NSVo997cKft/AAAA///UGIX5AAAABklEQVQDADLMWe8vOS2UAAAAAElFTkSuQmCC"},{category:"Colours & symbols",id:"sun",name:"Golden sun",look:1020,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB3xUxdY/s5seCAkhgZDQe09CFX0Kiv3ZBYE0FNtnRVGf+vSBvT7sHSHJhiI+u099VkQEaUnovZcECCSUQOrOd84NCbv33i13s+Xu7uxvZ3fmzJmZM/+ZOXf6NYD4+D0CxXnZPYsLsv9eaMp+sLAg+wU0bxaacmaimVdYkPMVmp8LC7KXFJqyVxeacrYVmrIPoPtYUUEOJ0N2iWbK3or/q9G9pLAgB8NgWFPOvEKMq7gg541CjLt4Ts4DRaacKylNvwdOZACEAvCDSsA5sHV5WR0LC3Iuwsb4f9hoX8NG+C3+byksyK7lRrYZWb5hjP2bAXsUzb2MwWQ04xnA1WguYsDOYYwNZAy6McaS0B3TmHWySzTGuuP/QHSfwwAwDIZlMJ5hXBzgPoZxoywzgMG3lCalXWTK3lxkyvkWzYzCgqw7V+dnXbh23s0dkI81xi/+9YuAUAA6LJvVpsxeRQVZt2GjKig0ZRfjU9dcazTsxhb1MzbGd1HkKdgIr8T/HgxYCP775CulzVhPSRYGDzAwvGc2GH6pqzfvIZmLCnKKCk05eYVzciaLHgPo8iMUgI+LhU+fbiiel51WZMq+HxvLf7DRlJqZcROA4UNgkMEYG+RjEZuTfCpjkM04zOTYS8H8lRQVZC8oLMi+t2jOpFTKe3MiF2GbhwCFFgqAUPCiWbdgbFjx3KzzigpyHsOG8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F05WD6416hgDTYsnHZEG3jq4pT5Kcx9DXbjpzPOh3PgXXEiPwQbfAFs8LWxwfclXhpFGo9hOPHTGAJCAGisQNTIwXnum8E948woEOaHhhu/vNeoYtthw6qIxsAM0IBOr8XmOAwb4JdovseWOQPNHBxSLEbzJ7ptRP+d6HYE72fRfj0jL3qW3Dg/jPedaN94Lw4sxoY9G+PMYAAT0f1L9B+G9hcpT8obeyyVUEi1w8beLzgibmxoeNz8kLCYRGzwqNDLyEG7d1+n7P8AAAD//5phB84AAAAGSURBVAMAJJf/pCPxZ/EAAAAASUVORK5CYII="},{category:"Colours & symbols",id:"heart",name:"Copper heart",look:1022,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB3wTR9Z/s3LFuIAxGDC9d9t0SIELIZV0SIIbJb0HklyS+3IhvR7pvYAtGXKkkXJJLrl0Erpleg+9g+ngqvneEwik3ZEtyZJ2Jc3+NNqd9ubNf+a9nb4KyCvkESgtzO9casm/tMScP6nEkv8MmldLzAXvo5lZYin4As3/Siz5f5aY85eUmAvWl5jzd6D9kNVSwMnQs93NnL8O70vQ/meJpQDjYFxzwcwSpFVqKXilBGmXFhfcazUXXEJphjxwMgMgFUAIVALOgS0vzGtdYik4D4XxVhTal1AIv8b72hJLfhU3sTUY5CvG2L8YsAfR3MkYTERzHQO4DM15DNhgxlhvxqADY6w52pMcWadnuxtjHfHeG+2DGQDGwbgMrmNIiwPcxZA28jIVGHxNaVLaVnP+Gqu54Gs0U0ssebcsKcr727KZ41thOOagL+/GRUAqAAOWzRJzbherJe9GFCpLiTm/FN+6tiqTshkl6n8ojG8iy/egEF6C904MWBTedfnZ02ass50XBvcyUN6yKcqP1TW2LcSz1VJgLTEXFJYUF0yULQYw5CUVgM7FwqdMUUpn5mdZzfl3o7B8gkKzy8ZMqwGUd4FBDmOsj84s1if5TMYgn3F4n2MrBfO302rJn1Viyb/TWjwuk/JeH+Iybv0QoNhS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YTeWb9s/83/m40TiHZv7ubMI18lAGGjyGICou6oIHfhVn5KCOBN6QQTH7yL28gv8az5J+DUzye2xswxhN5pX8t2ImIgRG6UxiS+fGW9F2vGc+omTWgoKSij/zYB/Hz7TtM0gMZ0NwM//ne04SbbFCL1NkSrmZb/hn0Va0GW0vLK34cUFp5aPABNiYoocS0oSAMgBNUFhzgWfa4SWzlrIx+Cf/55vIU97uGaKuL98kk9kgILDpGms0i4FUKVfzDf802mJzufrwjd6Db/ir0Va0GW2PgRTFIgoElAGIArx4VeX97O/4JqlggzCFZwr9s7KPtBQZspANwnhJrnuO31T0Ed9YvO3IKbLqIyH8e5b+EU/jnxJS3i1JjueN/AK+4VvwDT+Ab/jr0JYRZfZ1TKe+CYaAMgAJ1iFG6vA+96H8qyudbBBeKCyxP3z8pqo4l2+snnzYhI2GInot34538A34MB9/5zvzaT6e5UeKV/n4gPO+4PIlnPctn7dy+oBHFq7deVKu5fMSTn9xvA69yjf2XK7ztCB6nPMf5vI7OP0TyIRsnrH0YiN1Lt/s1+eXVj5SWFL5QkHxrGq+4XlBzyMhcc/prtn/AwAA//+/FpzTAAAABklEQVQDADbJjODKYFTjAAAAAElFTkSuQmCC"},{category:"Patterns",id:"waves",name:"Gold waves",look:1024,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB1wUx/f/ztGlCFIUAWvU2MESTflF03uPJirFrrFHjf8kv+Sn6YkajTVqLDQ10RTTTDXFGBMbYI8lUQEFKYII0m//761Bj9sFDrg7Dtj73N7t9Jnvzrx9897MGx20T71HICEqvGNCbPiDcTHh0+Niw9+ia3FcTMRqujbGxUZ8TtePcbHhO+NiwvfHxUScjIsJP0fui/GxERJffC/7xYSfoP/95N4ZFxtBaShtTMTGOMorITZiURzlnbA+4tn4mIgHuMx6D5zWAGgEoB50AkmCOBQV1iouNuIOGozP0KBdSIPwK/o/HhcbXizZiWMU5UshxLsC4nm6JguBUXQ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+eOCmIAy6ra1s4XbCE53x3NDumEODdi69na8QjQFY999bwffsx2Ech6chbBWX03IefCpO386+4Ly5DJjtI2WRBP9L4pJmMSbBgYmehNFwkuR/Y7YiTMioMUfRNebG10XbeZ95z9DIP0NCo+ZSZ3+I5rTedhA9iBBMpDffRxJwri7qZZUyJeksDfgPua3cZm57r7Coh0PCoucxJoyNVeqhFXIVAY0AXIWibm54TtsjNPIgEYPl9OZ7mljeADtR3J4GyXAiCGzY9ETd1MwMpUrScRrwa7gtOr2+HQ30QBrwQ7it3GZuuxlK0bKoBQIaAagFeJZKSvrsf2iQRBFBGEWcQkcHx8vuwk7qRQRhkAT9C1cGFX6hgUVqR3Khrj4SF55Epf9CbPxqIUnPS5AGkSI/hAa8Gw34TjTgR3NbeobHnKJ42tfGENAIgI09ELXqkJ47N3hIdDwRhI97hca8fWVQRd1GAyuILp3QoRtbr6XhOIMG4Nt0LaGRuYauD2lK8QVd28jvDwo/QH5/038KuXPKyuJ72U+STtL/AXL/cSUNvqCBvZHSrBHAYvJ/m8JnkPsRLpPLJo6lFRGp22iwjwkOi36nV2j0xyHDIhNowJNAr6wE2/1v7DX7fwAAAP//ZA8xWwAAAAZJREFUAwCasHkr84CvQQAAAABJRU5ErkJggg=="},{category:"Patterns",id:"tiles",name:"Copper tiles",look:1025,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB3xUVdb/3zfpJPQSeu8tCUVE15W1Y3cXVEjB3l3L6ur67Yq9o2svqCQTwMWGDXvHRsmELr1ICRBCC6TP/c4ZSJi89yaZzLxpyX2/ufNuPffc/z33vNvefRrUFfEI5Gdn9svPzTwnz555W15u5iNkns2zZ00nMzsvN+sDMl/l5Wb+nGfPXJJnz1qXZ8/cTu79jtwsyYbtLj975lq6LyH3z3m5WZSG0tqzZucRrfzcrP/mEe38mVm3OuxZZ3OeEQ+cKgCUAogAIZASYnl2Rre83KxTqDFeR432aWqEH9N9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QGEBMlwHb24zCOw8MQTsNpJxENPhP/lomDwLSfumm0Ky/updx3RZprR+Qlp/bCqdR7SenbBswj8wpfLikPATKbZvLHM2a0FHs1Y8hY+kJOpakfAaUA6sfIkhgp6Tkfk0BnpHTe0kqDOJ6I/pOE/WMyln1JhvciDO7ZiiYW2+Hk1I44e2xXTBjX03XC7fV/HYg7Jg3FVGq0j9PT+YjS+DPevOcksJ39OIzj8DCET8XltEyDv4ozamA7MG3OA5Zdci/N4H9EvaQ7GZOULltaEkZTaCb/U8uy8IJQU46iNeXCh6Ls/J758PQZv6amZz9Own4ujWnb2CCGkSK4gZ58/5PA9lDwFZQ8pdxGDf4tLiuXmcuelpF9XmpGzhOMCWMTFD5UJjUIKAVQA0VoLDymHZY+YxkpgxfpyXcJdXk720RFb2okU0gh8MGma0PDmQW5SrmGGvzrXBbN6exFDb0LNfhLuaxcZi67BbkoEn4goBSAH+AFKimtZ2+gRpJNCuEK6in0i445nCRsMo0UwgQJ591HGhW+o4ZFy47kQqguyZn/Qbl/R9346ULKuyTkBFrIT6UGn0gNvj81+Cu5LMMz7RspnvqFGQJKAYRZhZixQ+vcxSmX5jhIIbyTlm5/9Eijyh5HDasrGU1oGMKn11JzvJ0a4KNknqOW+TqZt2hI8SGZr8nvFwpfSn7r6b6D3Aeq82K7y0/KdXRfSu5fjqTBh9SwZ1Oa1wXwLPk/SuG3k/t8zpPzph5LN1JS46ixX5WSkfNYWnrOO6mTZ+RTg6cJveocwvfe1Dn7fwAAAP//+U/iUwAAAAZJREFUAwBirSrRaFK0vwAAAABJRU5ErkJggg=="},{category:"Patterns",id:"dots",name:"Warm dots",look:1026,dataUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAQAElEQVR4AexdB3xUVdb/30knQBIg1ABSpJckgqDYUFRWsQsKaSiKLjbEsup+u7L2ir0hKmmAWBbLqqurKCqIQBK6NCnSCUmA9DL3O2cgOHnvTTKZedOS+35z573bzj3nf+897/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B3+C6or1Znq3i8u8c7ouKTZhAlhYxM6lEIuIaAwgEtQ2MdCY9o+scv3cGbwKX/zjeEib4QLq+nEO8l4zhDoYNMj9qHMAqUKwmHe4ZdQXVRqdUfe0SN5hx9LdaU6U90tUIqShRkIKAzADPCslZTPZx/nnSSRM4SJXFLo6uZe3oK5CP04QxglQP3ChU6FDbxj8WlH7oK9LoEKP8NL38DF+MVMEJ4XIIziE/nRvMP78g7fjXf4h6gufeOTT/B4ys/BEFAYgIM9EDly+Dx3adTYpDTOEL7qF5v8zoVOlTiCd6w23KiYCr3o9FreHZ/mHfAdbj7mPXMJN1/wIcV6bv7gflt4+G7ud4zfs7i7WFsW2TV+gnCU33dz95YLabCed+xVPM0SBnzE/d/h4U9z911UJpXNJZa2nEmN4J19UlRc0rv9YpO+io5Zns47PFfoaUtw3Htzp+z/AAAA//+pl77VAAAABklEQVQDAC8iuf4a+IxiAAAAAElFTkSuQmCC"}]},1068,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1069,[571,1423,1425,1424]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1070,[2,873,31,123,245,128,817,1647,823,824,1038,865,861,808,25]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1071,[873,31,1120,257,128,1461,1462,1149,1044,817,827,828,821,824,998,1213,1212,1641,1134,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})},1072,[1228,1229]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_LOCATION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WILDINGS_ADDRESS",{enumerable:!0,get:function(){return t}}),e.withWildingsAddress=function(r){return'wildings'===r.id?{...r,location:n,address:t}:r},e.withWildingsQuestionnaireAddress=function(n,r){return'wildings'===n&&r?{...r,venue:{...r.venue,address:t}}:r};const n='Maidens, KA26 9NR',t='Maidens Road, Maidens, KA26 9NR'},1073,[]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return n.useStore}}),_e.useNow=function(e=1e4){const r=(0,n.useStore)(e=>e.clock),[,u]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=setInterval(()=>u(e=>e+1),e);return()=>clearInterval(t)},[e]),(0,n.nowFrom)(r)},Object.defineProperty(_e,"useRestaurant",{enumerable:!0,get:function(){return a}}),_e.useRecipeCards=c,_e.useAllMenu=f,_e.useMenu=function(e){const r=f(e);return(0,t.useMemo)(()=>r.filter(e=>!e.hidden),[r])},Object.defineProperty(_e,"useCustomer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBasket",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useOrders",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"useOrderAtTable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useOrder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useBookings",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useWaitlist",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useEvents",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"useStampCard",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useGiftCards",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useRatings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"useAudit",{enumerable:!0,get:function(){return v}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),u=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]);_r(_d[7]);const a=e=>(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)),l=e=>(0,o.recipeCards)().subscribe(e),d=[];function c(e){return(0,t.useSyncExternalStore)(l,()=>e?(0,o.recipeCards)().list(e):d,()=>e?(0,o.recipeCards)().list(e):d)}function f(e){const u=(0,n.useStore)((0,r.useShallow)(t=>t.menu.filter(t=>t.restaurantId===e))),o=c(e);return(0,t.useMemo)(()=>(0,s.resolveMenu)(u),[u,o])}const b=()=>(0,n.useStore)(e=>e.customer),S=()=>(0,n.useStore)(e=>e.basket),g=(e,t)=>'table'!==t.type||(0,u.orderAtTableOn)(e.restaurants.find(e=>e.id===t.restaurantId)),m=e=>(0,n.useStore)((0,r.useShallow)(t=>t.orders.filter(r=>(!e||r.restaurantId===e)&&g(t,r)))),p=e=>(0,n.useStore)(t=>(0,u.orderAtTableOn)(t.restaurants.find(t=>t.id===e))),O=e=>(0,n.useStore)(t=>t.orders.find(t=>t.id===e)),y=e=>(0,n.useStore)((0,r.useShallow)(t=>e?t.bookings.filter(t=>t.restaurantId===e):t.bookings)),w=e=>(0,n.useStore)((0,r.useShallow)(t=>t.waitlist.filter(t=>t.restaurantId===e))),I=[],j=u=>{const s=(0,n.useStore)((0,r.useShallow)(e=>e.events.filter(e=>null===e.restaurantId||e.restaurantId===u))),o=(0,n.useStore)(e=>e.restaurants.find(e=>e.id===u)),a=o?(0,e.regularEventsOf)(o):I,l=(new Date).toISOString().slice(0,7);return(0,t.useMemo)(()=>{if(!u||!a.length)return s;const t=new Date,r=new Date(t.getFullYear(),t.getMonth()-2,1),n=new Date(t.getFullYear()+1,t.getMonth()+1,0),o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`;return[...s,...(0,e.expandEvents)(u,a,o(r),o(n))]},[s,a,u,l])},P=e=>(0,n.useStore)(t=>t.stampCards.find(r=>r.restaurantId===e&&r.customerId===t.customer.id)),h=e=>(0,n.useStore)((0,r.useShallow)(t=>t.giftCards.filter(r=>(!e||r.restaurantId===e)&&r.ownerId===t.customer.id))),M=e=>(0,n.useStore)((0,r.useShallow)(t=>t.ratings.filter(t=>t.restaurantId===e))),v=e=>(0,n.useStore)((0,r.useShallow)(t=>t.audit.filter(t=>t.restaurantId===e)))},1074,[813,31,881,878,1026,1237,839,1210]); +__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1075,[1080,1072,1081]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return f}});var n=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=e(r(d[3])),s=e(r(d[4])),u=e(r(d[5])),p=e(r(d[6])),h=r(d[7]),c=r(d[8]);const f={...Object.fromEntries(Object.entries(n.queuedVenues).map(([e,n])=>[e,(0,h.cleanQuestionnaire)(n.questionnaire,e)??{}])),greenside:(0,h.cleanQuestionnaire)(t.default,'greenside')??{},abbotsford:(0,h.cleanQuestionnaire)(l.default,'abbotsford')??{},kirkton:(0,h.cleanQuestionnaire)(o.default,'kirkton')??{},wildings:(0,h.cleanQuestionnaire)(s.default,'wildings')??{},kirkmichael:(0,h.cleanQuestionnaire)(u.default,'kirkmichael')??{},souters:(0,h.cleanQuestionnaire)(p.default,'souters')??{},anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:c.ANCHORAGE_PAY},saltmarsh:{source:'signup-form',submittedAt:'2026-10-27',venue:{name:'The Venue',tagline:'Seasonal small plates by the harbour (fictional)',address:'4 Quay Street, Port Ailsa (fictional)',phone:'01632 960 418',email:'hello@thevenue.example',website:'thevenue.example'},tables:{template:'bistro',tables:14,covers:48,areas:['Inside','Terrace']},team:[{name:'Morven Reid (example)',role:'owner',job:'Owner',email:'morven@thevenue.example'},{name:'Callum Shaw (example)',role:'manager',job:'General manager',email:'callum@thevenue.example'},{name:'Isla Grant (example)',role:'staff',job:'Head chef'},{name:'Ruaridh Bell (example)',role:'staff',job:'Waiter',phone:'07700 900 311'},{name:'Ellie Muir (example)',role:'staff',job:'Waiter'}],suppliers:[{name:'Ailsa Fish Co (example)',category:'Fish',phone:'01632 960 101'},{name:'Hillside Dairy (example)',category:'Dairy',email:'orders@hillside.example'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-06',tipsEndsDaysBefore:5,wagePayDay:28,wageCutoffDay:20,weekendRule:'before'},accounts:[{provider:'gmail',handle:'hello@thevenue.example'},{provider:'wix',handle:'thevenue.example'},{provider:'instagram',handle:'@thevenue.demo'},{provider:'facebook',handle:'The Venue'},{provider:'google-business',handle:'The Venue'},{provider:'sumup',handle:'The Venue'},{provider:'xero',handle:'The Venue Ltd'}],features:{bookings:!0,takeaway:!0,orderAtTable:!0,tips:!0,rota:!0,games:!1,specials:!0},notes:'Fictional example answers for the demo venue.'}}},1076,[6,1416,1417,1418,1419,1420,1421,1079,3]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},1077,[811,18]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1078,[]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return l}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},l=u(n.name,80);if(!l)return null;const y={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;y[a]=s&&n?[s,n]:null}const b=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:u(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:u(o.submittedAt,10),onboardedAt:u(o.onboardedAt,10),venue:{name:l,tagline:u(n.tagline,120),address:u(n.address,200),phone:u(n.phone,30),email:u(n.email,120),website:u(n.website,120),hasLogo:!!n.hasLogo},hours:{days:y,note:u(o.hours?.note,300)},tables:{template:b,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>u(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:u(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:u(a?.job,60),email:u(a?.email,120),phone:u(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:u(a?.name,80)??'',category:u(a?.category,40),phone:u(a?.phone,30),email:u(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:u(a?.provider,40)??'',handle:u(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:u(o.notes,1e3),...Array.isArray(o.cashUp)?{cashUp:o.cashUp.map(a=>u(a,40)).filter(a=>!!a).slice(0,12)}:{}}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,email:a.email,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...a.cashUp?.length?{cashUp:a.cashUp.slice(0,12)}:{},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features},cashUp:t.cashUp?.length?t.cashUp:a.cashUp}},e.hoursLines=function(a){return l.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return y}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],l=[1,2,3,4,5,6,0],u=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const y={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},1079,[1078]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),f={getItem:e=>u.default.getItem((0,n.venueKey)(e)),setItem:(e,t)=>u.default.setItem((0,n.venueKey)(e),t),removeItem:e=>u.default.removeItem((0,n.venueKey)(e))}},1080,[1222,5]); +__d(function(g,_r,i,_a3,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"combine",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"createJSONStorage",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"devtools",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"persist",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"redux",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"subscribeWithSelector",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"unstable_ssrSafe",{enumerable:!0,get:function(){return S}});const e=(e,t)=>(n,r,o)=>(o.dispatch=t=>(n(n=>e(n,t),!1,t),t),o.dispatchFromDevtools=!0,{dispatch:(...e)=>o.dispatch(...e),...t}),t=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,n=new Map,r=e=>{const t=n.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},o=(e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const o=n.get(r.name);if(o)return{type:"tracked",store:e,...o};const s={connection:t.connect(r),stores:{}};return n.set(r.name,s),{type:"tracked",store:e,...s}},s=(e,t,r)=>{if(void 0===t)return;const o=n.get(e);(null==o?void 0:o.stores[t])===r&&(delete o.stores[t],0===Object.keys(o.stores).length&&n.delete(e))},a=/^at (?:new |async )?(.+?) \(/,l=/^([^@]+)@/;function c(e){var t,n,r;if(!e)return;const o=e.split("\n"),s=o.findIndex(e=>e.includes("api.setState"));if(s<0)return;const c=(null==(t=o[s+1])?void 0:t.trim())||"";return(null==(n=a.exec(c))?void 0:n[1])||(null==(r=l.exec(c))?void 0:r[1])}const u=(e,a={})=>(l,u,p)=>{const{enabled:f,anonymousActionType:y,store:h,...b}=a;let S;try{S=(null!=f?f:"production"!==(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0))&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!S)return e(l,u,p);const{connection:O,..._}=o(h,S,b);let w,E=!0;p.setState=(e,t,n)=>{const o=l(e,t);if(!E)return o;const s=void 0===n?{type:y||c((new Error).stack)||"anonymous"}:"string"==typeof n?{type:n}:n;return void 0===h?(null==O||O.send(s,u()),o):(null==O||O.send({...s,type:`${h}/${s.type}`},{...r(b.name),[h]:p.getState()}),o)},p.devtools={cleanup:()=>{null==w||w(),w=void 0,s(b.name,h,p),void 0!==h&&n.has(b.name)||!O||"function"!=typeof O.unsubscribe||O.unsubscribe()}};const I=(...e)=>{const t=E;E=!1,l(...e),E=t},j=e(p.setState,u,p);if("untracked"===_.type?null==O||O.init(j):(_.stores[_.store]=p,null==O||O.init(Object.fromEntries(Object.entries(_.stores).map(([e,t])=>[e,e===_.store?j:t.getState()])))),t(p)){let e=!1;const t=p.dispatch;p.dispatch=(...n)=>{"production"===(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0)||"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return w=O.subscribe(e=>{var n;const o="object"==typeof b.serialize?b.serialize.reviver:void 0;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):v(e.payload,o,e=>{if("__setState"===e.type){if(void 0===h)return void I(e.state);1!==Object.keys(e.state).length&&console.error("\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");const t=e.state[h];if(null==t)return;return void(JSON.stringify(p.getState())!==JSON.stringify(t)&&I(t))}t(p)&&p.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return I(j),void 0===h?null==O?void 0:O.init(p.getState()):null==O?void 0:O.init(r(b.name));case"COMMIT":return void 0===h?void(null==O||O.init(p.getState())):null==O?void 0:O.init(r(b.name));case"ROLLBACK":return v(e.state,o,e=>{if(void 0===h)return I(e),void(null==O||O.init(p.getState()));I(e[h]),null==O||O.init(r(b.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return v(e.state,o,e=>{void 0!==h?JSON.stringify(p.getState())!==JSON.stringify(e[h])&&I(e[h]):I(e)});case"IMPORT_STATE":{const{nextLiftedState:t}=e.payload,r=null==(n=t.computedStates.slice(-1)[0])?void 0:n.state;if(!r)return;return I(void 0===h?r:r[h]),void(null==O||O.send(null,t))}case"PAUSE_RECORDING":return E=!E}return}}),j},v=(e,t,n)=>{let r;try{r=JSON.parse(e,t)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&n(r)},p=e=>(t,n,r)=>{const o=r.subscribe;r.subscribe=(e,t,n)=>{let s=e;if(t){const o=(null==n?void 0:n.equalityFn)||Object.is;let a=e(r.getState());s=n=>{const r=e(n);if(!o(a,r)){const e=a;t(a=r,e)}},(null==n?void 0:n.fireImmediately)&&t(a,a)}return o(s)};return e(t,n,r)};function f(e,t){return(...n)=>Object.assign({},e,t(...n))}function y(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var r;const o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),s=null!=(r=n.getItem(e))?r:null;return s instanceof Promise?s.then(o):o(s)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const h=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>h(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>h(t)(e)}}},b=(e,t)=>(n,r,o)=>{let s={storage:y(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},a=!1,l=0;const c=new Set,u=new Set;let v=s.storage;if(!v)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...e)},r,o);const p=()=>{const e=s.partialize({...r()});return v.setItem(s.name,{state:e,version:s.version})},f=o.setState;o.setState=(...e)=>(f(...e),p());const b=e((...e)=>(n(...e),p()),r,o);let S;o.getInitialState=()=>b;const O=()=>{var e,t;if(!v)return;const o=++l;a=!1,c.forEach(e=>{var t;return e(null!=(t=r())?t:b)});const f=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=r())?e:b))||void 0;return h(v.getItem.bind(v))(s.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];if(s.migrate){const t=s.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(o!==l)return;const[a,c]=e;return S=s.merge(c,null!=(t=r())?t:b),n(S,!0),a?p():void 0}).then(()=>{o===l&&(null==f||f(r(),void 0),S=r(),a=!0,u.forEach(e=>e(S)))}).catch(e=>{o===l&&(null==f||f(void 0,e))})};return o.persist={setOptions:e=>{s={...s,...e},e.storage&&(v=e.storage)},clearStorage:()=>{++l,null==v||v.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>O(),hasHydrated:()=>a,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},s.skipHydration||O(),S||b};function S(e,t="undefined"==typeof window){return(n,r,o)=>{if(!t)return e(n,r,o);const s=()=>{throw new Error("Cannot set state of Zustand store in SSR")};return o.setState=s,e(s,r,o)}}},1081,[]); +__d(function(g,r,i,a,m,e,_d){"use strict";function t(t,n){const o={};for(let c=0;c<7;c++){o[c]={};const u=n[c]??0;for(const[n,s]of Object.entries(t))o[c][Number(n)]=Math.round(s*u)}return o}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EXAMPLE_HISTORY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EXAMPLE_ACCURACY",{enumerable:!0,get:function(){return f}});const n={12:18,13:26,14:16,15:9,16:10,17:22,18:36,19:38,20:20},o={12:2,13:2,14:1,15:1,16:2,17:4,18:6,19:5,20:2},c={0:1.05,1:0,2:0,3:.6,4:.7,5:1,6:1.15},u={0:.6,1:.5,2:.5,3:.6,4:.7,5:.9,6:1},s={anchorage:{covers:t(n,c),takeaway:t(o,c)},default:{covers:t(n,u),takeaway:t(o,u)}},f='Example: last 4 weeks within \xb118% of actual covers'},1082,[]); +__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'}},1083,[31,128,881,822,826,824,817,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LookBackResult=k,_e.monthCells=function(e){const[o,s]=e.split('-').map(Number),t=new Date(Date.UTC(o,s,0)).getUTCDate();return[...Array(j(`${e}-01`)).fill(null),...Array.from({length:t},(o,s)=>`${e}-${x(s+1)}`)]},_e.calendarDayLabel=function(e,o,s,t="Look back"){const l=(0,b.validPastDate)(e,o);return`${(0,n.longDay)(e)}${e===o?', today':''}${e===s?', selected':''}${l?'':`, not available. ${t} is for past days only`}`},_e.LookBackCalendar=p,_e.LookBack=function(){const{rid:e,today:s}=(0,c.useCtx)(3e4),[l,x]=(0,o.useState)((0,n.addDays)(s,-1)),[j,D]=(0,o.useState)((0,b.ukHistoryDate)(l)),[f,v]=(0,o.useState)(0),[T,C]=(0,o.useState)(!1),$=(0,u.useHistoricalBookingDay)(e,l,s,f),m=(0,b.parseHistoryInput)(j),L=!!m&&(0,b.validPastDate)(m,s);if(!$.allowed)return(0,h.jsx)(d.Card,{children:(0,h.jsx)(d.T,{size:20,children:"Sign in to the Managers app with manager or owner access to Look back."})});const w=e=>{x(e),D((0,b.ukHistoryDate)(e))};return(0,h.jsxs)(i.default,{style:{gap:14},testID:"look-back",children:[(0,h.jsx)(d.Card,{children:(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(d.T,{size:26,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Look back"}),(0,h.jsx)(d.T,{size:18,center:!0,children:"Find bookings for one exact past date. Read-only; nothing is sent or changed."}),(0,h.jsx)(d.Field,{label:"Past booking date (DD/MM/YYYY)",value:j,onChangeText:e=>D((0,t.slashDate)(e,j)),placeholder:"05/11/2025",keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Exact past booking date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"look-back-date",style:{textAlign:'center'}}),L?null:(0,h.jsx)(d.T,{size:18,center:!0,children:"Enter a past date as DD/MM/YYYY, for example 09/11/2026, including the four-digit year."}),(0,h.jsxs)(d.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(d.Button,{kind:"secondary",label:"Pick a date",testID:"look-back-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${(0,n.longDay)(l)}`,onPress:()=>C(!0)}),(0,h.jsx)(d.Button,{label:"Show bookings",accessibilityLabel:`Look back at bookings for ${L&&m?(0,b.historyDateLabel)(m):'a valid past date'}`,disabled:!L,onPress:()=>{m&&w(m),v(f+1)}})]}),(0,h.jsxs)(d.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(d.Button,{kind:"secondary",label:"Previous day",accessibilityLabel:`Previous day, ${(0,n.longDay)((0,n.addDays)(l,-1))}`,onPress:()=>w((0,n.addDays)(l,-1))}),(0,h.jsx)(d.Button,{kind:"secondary",label:"Next day",accessibilityLabel:`Next day, ${(0,n.longDay)((0,n.addDays)(l,1))}`,disabled:!(0,b.validPastDate)((0,n.addDays)(l,1),s),onPress:()=>w((0,n.addDays)(l,1))})]})]})}),(0,h.jsx)(p,{visible:T,today:s,selected:l,onClose:()=>C(!1),onPick:e=>{w(e),C(!1)}}),$.data?(0,h.jsx)(k,{day:$.data}):(0,h.jsx)(d.Card,{children:(0,h.jsx)(d.T,{size:20,children:$.error||'Loading booking history\u2026'})})]})};var e,o=r(_d[0]),s=r(_d[1]),t=r(_d[2]),l=r(_d[3]),i=(e=l)&&e.__esModule?e:{default:e},d=r(_d[4]),n=r(_d[5]),c=r(_d[6]),u=r(_d[7]),b=r(_d[8]),y=r(_d[9]),h=r(_d[10]);function k({day:e}){return(0,h.jsxs)(i.default,{testID:"look-back-result",style:{gap:14},children:[(0,h.jsx)(d.Card,{children:(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(d.T,{size:24,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:(0,b.historyDateLabel)(e.date)}),(0,h.jsxs)(i.default,{accessible:!0,accessibilityLabel:`Booked Covers: ${null===e.booked_covers?'not recorded':e.booked_covers}`,children:[(0,h.jsx)(d.T,{size:20,children:"Booked Covers"}),(0,h.jsx)(d.T,{size:36,weight:"bold",colour:y.colours.gold,children:null===e.booked_covers?'Not recorded':e.booked_covers})]}),e.historical_records?(0,h.jsx)(d.T,{size:20,colour:y.colours.gold,weight:"semibold",children:b.HISTORY_LABEL}):null,(0,h.jsx)(d.T,{size:18,children:b.HISTORY_NOTE}),e.missing_covers?(0,h.jsxs)(d.T,{size:18,children:[e.missing_covers," booking records have no party size; not filled in."]}):null]})}),e.bookings.length?null:(0,h.jsx)(d.Card,{children:(0,h.jsx)(d.T,{size:20,children:"No booking records found for this date. The history is incomplete; this does not prove there were no bookings."})}),e.bookings.map((e,o)=>(0,h.jsx)(d.Card,{children:(0,h.jsxs)(i.default,{testID:"look-back-booking",style:{gap:8},accessible:!0,accessibilityLabel:`${e.time??'Time not recorded'}, party size ${null===e.covers?'not recorded':`${e.covers} Covers`}, ${e.table?`table ${e.table}`:'table not recorded'}, ${e.status??'status not recorded'}${e.counted?'':', excluded from Booked Covers'}`,children:[(0,h.jsxs)(d.Row,{wrap:!0,gap:20,children:[(0,h.jsx)(d.T,{size:26,weight:"bold",colour:y.colours.gold,children:e.time??'Time not recorded'}),(0,h.jsxs)(d.T,{size:22,children:["Party size: ",null===e.covers?'Not recorded':`${e.covers} Covers`]})]}),(0,h.jsxs)(d.T,{size:20,children:["Table: ",e.table??'Not recorded']}),(0,h.jsxs)(d.T,{size:18,children:[e.status??'Status not recorded',e.counted?'':' \xb7 excluded from Booked Covers']}),(0,h.jsxs)(d.T,{size:18,colour:y.colours.muted,children:['favourite_table'===e.source?'previous booking system':'CoverCharge'," \xb7 ",e.ref]})]})},`${e.source}:${e.ref}:${o}`))]})}const x=e=>String(e).padStart(2,'0'),j=e=>{const[o,s,t]=e.split('-').map(Number);return(new Date(Date.UTC(o,s-1,t,12)).getUTCDay()+6)%7};function p({visible:e,today:o,selected:t,onPick:l,onClose:i,purpose:d="Look back",idPrefix:n="look-back"}){return(0,h.jsx)(s.AppDateCalendar,{visible:e,today:o,day:t,showBusy:!0,back:3650,ahead:-1,idPrefix:`${n}-cal`,sheetTestID:`${n}-calendar`,onClose:i,onDay:e=>{e&&l(e)}})}},1084,[31,1154,833,128,817,1436,998,1437,1438,824,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,b.useCtx)(1e4),y=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),k=(0,c.useBookings)(e),v=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=y.map(e=>({o:e,bk:(0,u.linkedBooking)(e,k)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,j.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,j.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,j.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,j.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,j.jsxs)(o.Card,{children:[(0,j.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,j.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,j.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,f.niceDate)(new Date(e.createdAt))]}),(0,j.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,j.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,f.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,j.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,j.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,j.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:v.length?v.slice(0,40).map(e=>(0,j.jsxs)(o.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,j.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,j.jsx)(o.Muted,{children:"This device keeps the sign-off log shown here."}),void p.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),x=r(d[10]),b=r(d[11]),j=r(d[12])},1085,[811,31,128,1036,817,822,818,1037,821,824,997,998,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1086,[31,1614,998,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ee,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return se}}),_e.rotaGrid=ne,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:o}=(0,$.useCtx)(6e4),i=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),r=(0,s.useOwner)(e=>e.shifts),d=(0,$.useHourly)(),u=(0,s.useOwner)(e=>e.availability),m=(0,s.useOwner)(e=>e.leave),x=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[I,M]=(0,l.useState)(0),B=(0,Y.useDateCalendar)(),[P,R]=(0,l.useState)(null),[A,z]=(0,l.useState)(null),[H,W]=(0,l.useState)(null),[F,G]=(0,l.useState)('week'),[Q,ie]=(0,l.useState)(!1),le=(0,$.useSignedIn)()?.name??'',re='staff'!==n,de=(0,C.addMins)(Z(t),7*I*1440);de.setHours(0,0,0,0);const ce=ee(de),ue=ce.sales,he='none'===ce.mode,fe=Array.from({length:7},(e,t)=>{const s=new Date(de);return s.setDate(de.getDate()+t),(0,C.ymd)(s)}),me=(0,s.visibleShifts)(r,re).filter(e=>e.date>=fe[0]&&e.date<=fe[6]),ge=(()=>{const e=new Date(de);return e.setDate(e.getDate()-7),(0,C.ymd)(e)})(),pe=me.filter(e=>!e.published||e.changed).length,xe=r.filter(e=>e.date>=ge&&e.date!!(0,s.leaveOn)(m,e,t),je=fe.map(e=>(0,g.workingShifts)(me,m).filter(t=>t.date===e).reduce((e,t)=>{return e+(X(s=t)-J(X(s)))*(d[s.staffId]??0);var s},0)),we=je.reduce((e,t)=>e+t,0),ye=ue.reduce((e,t)=>e+t,0),ke=(e,t)=>t?Math.round(e/t*100):0,Ie=re?i:i.filter(e=>e.id===o),Se=(0,a.useNarrow)(),Ce=Math.max(0,fe.indexOf((0,C.ymd)(t))),[De,ve]=(0,l.useState)(null),Te=De??Ce,$e=(e,t)=>!Se||t===Te,[Oe,Me]=(0,l.useState)(0),Be=ne(Oe,Se?1:7),Pe=Be.cell,Re=Be.name;return(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Week",selected:'week'===F,onPress:()=>G('week')}),(0,V.jsx)(f.Chip,{label:`Swaps & time off (${x.filter(e=>'open'===e.status).length+m.filter(e=>'pending'===e.status).length})`,selected:'requests'===F,onPress:()=>G('requests')}),(0,V.jsx)(f.Chip,{label:"Availability",selected:'availability'===F,onPress:()=>G('availability')})]}),'week'===F?(0,V.jsxs)(V.Fragment,{children:[!re&&o?(0,V.jsx)(k.RequestTimeOff,{meId:o,me:le,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,V.jsx)(h.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,V.jsx)(f.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,N.timeSheetLabel)(fe[0],fe[6]),onPress:()=>{(0,N.setHoursPreset)(fe[0],fe[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,V.jsxs)(h.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Oe?Math.min(Oe,Be.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{M(I-1),R(null)},style:{minWidth:96}}),(0,V.jsxs)(h.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,V.jsxs)(f.T,{weight:"semibold",center:!0,children:["Week of ",(0,C.niceDate)(de)]}),(0,V.jsxs)(f.Muted,{center:!0,children:[0===I?'This week':1===I?'Next week':-1===I?'Last week':I>0?`In ${I} weeks`:-I+" weeks ago",re?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{M(I+1),R(null)},style:{minWidth:96}})]}),(0,V.jsx)(h.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:B.openCal,style:{minWidth:96}})}),(0,V.jsx)(Y.AppDateCalendar,{visible:B.calOpen,today:(0,C.ymd)(t),day:(0,C.ymd)(de),idPrefix:"rota-cal",onClose:B.closeCal,onDay:e=>{M((0,Y.weekOffsetOf)(e??(0,C.ymd)(t),(0,C.ymd)(t))),R(null)}}),re?(0,V.jsxs)(f.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,V.jsx)(f.Button,{small:!0,kind:"secondary",label:"Copy last week"+(xe?` (${xe})`:''),disabled:!xe,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(ge,fe[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,V.jsx)(f.Button,{small:!0,kind:"success",label:pe?`Publish ${pe} ${1===pe?'change':'changes'}`:'Week published',disabled:!pe,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(fe[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),pe?(0,V.jsx)(f.Badge,{kind:"amber",label:`${pe} unpublished`}):me.length?(0,V.jsx)(f.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,P?(0,V.jsx)(f.Banner,{kind:"success",title:P}):null,Se?(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:$.DAY3.map((e,t)=>q.IS_CAR?(0,V.jsx)(f.Button,{kind:t===Te?'primary':'secondary',label:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}`,accessibilityLabel:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}${t===Te?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>ve(t),style:{minHeight:64,minWidth:96}},e):(0,V.jsx)(f.Chip,{label:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}`,selected:t===Te,onPress:()=>ve(t)},e))}):null,(0,V.jsx)(h.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Oe)>1&&Me(t)},style:{alignSelf:'stretch'},children:(0,V.jsx)(oe,{fits:Se||Be.fits,children:(0,V.jsxs)(h.default,{testID:"rota-grid",style:{gap:se,width:Be.width,alignSelf:'center'},children:[(0,V.jsxs)(h.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:se,backgroundColor:D.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:D.colours.hairline,zIndex:5},Se||Be.fits?ae:null],children:[(0,V.jsx)(h.default,{style:{width:Re,justifyContent:'center'},children:(0,V.jsx)(f.T,{size:11,weight:"semibold",colour:D.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),$.DAY3.map((e,s)=>(0,V.jsx)(h.default,{testID:"rota-date",style:{width:Pe,alignItems:'center'},children:(0,V.jsxs)(f.T,{size:Be.big?13:12,weight:"semibold",center:!0,colour:fe[s]===(0,C.ymd)(t)?D.colours.gold:D.colours.text,children:[e," ",(0,C.parseYmd)(fe[s]).getDate()]})},e)).filter($e)]}),Ie.map(e=>(0,V.jsxs)(h.default,{testID:"rota-row",style:{flexDirection:'row',gap:se,alignItems:'center'},children:[(0,V.jsxs)(h.default,{testID:"rota-name",style:{width:Re,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,V.jsx)(O.StaffAvatar,{id:e.id,size:28}),(0,V.jsxs)(h.default,{style:{flex:1,minWidth:0},children:[(0,V.jsx)(f.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,V.jsx)(f.T,{size:11,colour:D.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),$.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(me,e.id,fe[n]),o=(u[e.id]??[]).includes(n),i=be(e.id,fe[n]),l=(0,p.rotaCellWorked)(a,b,e.id,fe[n],re),r=!(!re||!l.workedLine&&!l.onShiftNow);return(0,V.jsxs)(c.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${$.DAY3[n]}, ${l.speech}${(0,E.badgeSpoken)(a?.badge)}${i?', on time off':''}${o?', unavailable':''}`,disabled:!re,onPress:()=>{a?W({staffId:e.id,date:fe[n],shift:a}):z({staffId:e.id,date:fe[n]})},style:({pressed:e})=>({width:Pe,minHeight:q.IS_CAR?64:r?80:52,height:r||(0,E.cleanBadge)(a?.badge)||q.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:l.differs?D.colours.amber:a?a.published?D.colours.gold:D.colours.amber:D.colours.border,backgroundColor:e?D.colours.goldTint:a?a.published?'#2b2414':'#241f14':i?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,E.cleanBadge)(a?.badge)?6:0}),children:[a?(0,V.jsxs)(f.T,{size:Be.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,$.fmtH)(a.start),"\u2013",(0,$.fmtH)(a.end)]}):l.workedLine?null:(0,V.jsx)(f.T,{size:12,center:!0,colour:D.colours.muted,children:i?'Off':o?'Unavail.':re?'Add':'\u2013'}),(0,E.cleanBadge)(a?.badge)?(0,V.jsx)(h.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:D.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,V.jsx)(f.T,{size:10,weight:"semibold",colour:D.colours.gold,center:!0,numberOfLines:1,children:(0,E.cleanBadge)(a?.badge)})}):null,l.workedLine?(0,V.jsx)(f.T,{testID:"rota-worked",size:10,colour:l.differs?D.colours.amber:D.colours.goldLight,center:!0,children:l.workedLine}):null,l.onShiftNow?(0,V.jsx)(f.T,{testID:"rota-on-shift-now",size:10,colour:D.colours.goldLight,center:!0,children:"On shift now"}):null,l.diffLabel?(0,V.jsx)(f.T,{size:10,colour:D.colours.amber,center:!0,children:l.diffLabel}):null,a&&i?(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.blue,children:(0,g.leaveLabel)((0,s.leaveOn)(m,e.id,fe[n])).toLowerCase()}):a&&o?(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.red,children:"unavailable"}):!a||!re||a.published&&!a.changed||l.workedLine||l.onShiftNow?null:(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter($e)]},e.id)),re?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se,marginTop:4},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:"Labour"})}),je.map((e,t)=>(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,children:(0,S.gbp)(e).replace('.00','')})},t)).filter($e)]}),he?null:(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:'example'===ce.mode?'Fcst sales (ex.)':'Fcst sales'})}),ue.map((e,t)=>(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,colour:D.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter($e)]}),he?null:(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:"Labour %"})}),je.map((e,t)=>{const s=ke(e,ue[t]);return(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,weight:"semibold",colour:ue[t]?s>32?D.colours.red:s>26?D.colours.amber:D.colours.ok:D.colours.muted,children:ue[t]?`${s}%`:'\u2013'})},t)}).filter($e)]})]}):null]})})}),!re&&o?(0,V.jsx)(h.default,{testID:"rota-team-on",children:(0,V.jsx)(f.Card,{children:fe.map((e,t)=>(0,V.jsx)(j.TeamOnDay,{date:e,meId:o,label:(0,C.niceDate)((0,C.parseYmd)(e))},e)).filter($e)})}):null,re&&he?(0,V.jsx)(f.Card,{children:(0,V.jsxs)(h.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Labour this week"}),(0,V.jsx)(h.default,{testID:"labour-week-cost",children:(0,V.jsx)(f.T,{weight:"semibold",children:(0,S.gbp)(we)})})]}),(0,V.jsxs)(f.Muted,{children:[(0,S.gbp)(we)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,V.jsx)(f.T,{weight:"semibold",colour:D.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,V.jsx)(f.Muted,{children:`Forecasts start once CoverCharge has ${1===ce.weeks?'1 week':`${ce.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ce.booked?(0,V.jsx)(h.default,{testID:"labour-booked",children:(0,V.jsxs)(f.T,{children:["Booked so far: ",ce.booked," Covers this week"]})}):null]})}):null,re&&!he?(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,V.jsxs)(f.Row,{gap:6,children:['example'===ce.mode?(0,V.jsx)(L.ExampleBadge,{}):null,(0,V.jsx)(f.Badge,{kind:ke(we,ye)>30?'red':'ok',label:`${ke(we,ye)}% this week`})]})]}),(0,V.jsxs)(f.Muted,{children:[(0,S.gbp)(we)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,S.gbp)(ye)," forecast sales. Target 25\u201330%. ",'example'===ce.mode?'Example figures: forecast sales use an example spend per cover.':'Forecast sales are your average takings for each weekday from your cash-ups.']}),(()=>{const e=ke(je[5],ue[5]);return e&&e<24?(0,V.jsxs)(f.T,{size:14,colour:D.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,re?(0,V.jsx)(f.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===F?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v.SectionHead,{title:"Shift swaps & cover"}),x.filter(e=>re||e.fromId===o||e.toId===o).map(e=>{const t=r.find(t=>t.id===e.shiftId),n=i.find(t=>t.id===e.fromId),a=i.find(t=>t.id===e.toId);return(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,V.jsx)(f.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,V.jsxs)(f.Muted,{children:[t?`${$.DAY3[t.day]} ${(0,$.fmtH)(t.start)}\u2013${(0,$.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&re?(0,V.jsxs)(f.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:i.filter(e=>U(n,e)).map(t=>(0,V.jsx)(f.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,V.jsx)(f.Button,{small:!0,label:"Approve",disabled:!e.toId||!U(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(i.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,T.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${$.DAY3[t.day]} ${(0,$.fmtH)(t.start)}\u2013${(0,$.fmtH)(t.end)})`:''}`)}}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),re?null:(0,V.jsxs)(f.Card,{children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,V.jsx)(f.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,V.jsx)(f.Muted,{testID:"swap-dept-note",children:(0,w.isAnchorageVenue)(y.VENUE_RID)?w.ANCHORAGE_SWAP_NOTE:K(i.find(e=>e.id===o))?w.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),me.filter(e=>e.staffId===o).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=x.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,V.jsxs)(h.default,{style:{gap:4,paddingVertical:4},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:14,weight:"medium",children:[$.DAY3[e.day]," ",(0,$.fmtH)(e.start),"\u2013",(0,$.fmtH)(e.end),(0,E.cleanBadge)(e.badge)?` \xb7 ${(0,E.cleanBadge)(e.badge)}`:'']}),t?(0,V.jsx)(f.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:o,kind:'cover',note:'Can anyone cover?'}),(0,T.autoPost)('all',`Cover needed: ${$.DAY3[e.day]} ${(0,$.fmtH)(e.start)}\u2013${(0,$.fmtH)(e.end)} (${(i.find(e=>e.id===o)?.name??'').replace(' (example)','')})`)}}),i.filter(e=>U(i.find(e=>e.id===o),e)).map(t=>(0,V.jsx)(f.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:o,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),me.some(e=>e.staffId===o)?null:(0,V.jsx)(f.Muted,{children:"No shifts on the rota this week."})]}),(0,V.jsx)(v.SectionHead,{title:"Holiday & time off"}),re?(0,V.jsx)(f.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>ie(!0)}):o?(0,V.jsx)(k.RequestTimeOff,{meId:o,me:le,testID:"rota-requests-time-off"}):null,m.filter(e=>re||e.staffId===o).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,V.jsx)(f.Card,{children:(0,V.jsxs)(h.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:(i.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,V.jsx)(f.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,V.jsxs)(f.Muted,{children:[(0,k.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&re?(0,V.jsxs)(f.Row,{gap:6,style:{justifyContent:'center'},children:[(0,V.jsx)(f.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),re&&o?(0,V.jsx)(k.TimeOffSheet,{visible:Q,onClose:()=>ie(!1),meId:o,me:le,manager:!0}):null]}):null,'availability'===F?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(f.Muted,{children:["Days each person can\u2019t work. ",re?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ie.filter(e=>'owner'!==e.role||!re).map(e=>(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{gap:8,children:[(0,V.jsx)(O.StaffAvatar,{id:e.id,size:30}),(0,V.jsx)(f.T,{weight:"semibold",children:e.name})]}),(0,V.jsx)(f.Row,{wrap:!0,gap:4,children:$.DAY3.map((t,n)=>{const a=(u[e.id]??[]).includes(n);return(0,V.jsx)(f.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,H?(0,V.jsx)(_.AssignRoleSheet,{name:(i.find(e=>e.id===H.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,C.niceDate)((0,C.parseYmd)(H.date))} \xb7 ${(0,$.fmtH)(H.shift.start)}\u2013${(0,$.fmtH)(H.shift.end)}`,current:H.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,E.assignShiftBadge)(s.useOwner.getState().shifts,H.shift.id,e)),W(null)},onEditTimes:()=>{z(H),W(null)},onClose:()=>W(null)}):null,A?(0,V.jsx)(te,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:a,meId:u,me:m,r:g,rid:p}=(0,$.useCtx)(5e3),x=((0,M.useClockArea)(e=>e.areas[p]),(0,M.areaOf)(p));const j=(0,B.privateClockVenue)(p),[w,y]=(0,l.useState)(!1),k=(0,s.useOwner)(e=>e.consent[u]),I=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),S=(0,s.useOwner)(e=>e.shifts),[v,T]=(0,l.useState)(!1),[L,H]=(0,l.useState)(null),[N,W]=(0,l.useState)(null),[Y,F]=(0,l.useState)(void 0),[E,_]=(0,l.useState)(null),[q,K]=(0,l.useState)(!1),[U,G]=(0,l.useState)(null),Q=I.filter(t=>t.staffId===u&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],X=Q&&(0,s.isOnBreak)(Q)?Q.breaks[Q.breaks.length-1]:void 0,J=(0,s.visibleShifts)(S,'staff'!==a).find(e=>e.staffId===u&&e.date===t),Z='staff'!==a,ee=Q?(0,$.paidMins)({in:Q.in},e).worked:0,te=x.on&&(0,P.areaSet)(x),se=Q?.geo?.[Q.geo.length-1],ne=I.filter(e=>e.staffId===u&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],ae=(0,r.useClockNotSent)(Q?.id??E?.id??ne?.id),[oe,re]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if(ae)re(!0);else if(oe){const e=setTimeout(()=>re(!1),6e3);return()=>clearTimeout(e)}},[ae]);const de=!ae&&oe,ce=async(s,n={})=>{H(s),W(null),F(void 0);const a=await(0,R.clockAction)(s,{rid:p,staffId:u,date:t,at:new Date(e.getTime()).toISOString(),...n});return H(null),a.ok?('out'===s&&a.att&&(_(a.att),(0,i.hrSettingsOf)(g.settings?.hr).on&&!o.useHr.getState().hasAnswered(p,a.att.id)&&G(a.att)),'in'===s&&_(null),a.att&&(0,r.markClockUnsent)(a.att.id),!0):(W(a.message),F(a.fix),(0,A.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return k?(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.Row,{gap:10,style:{flex:1},children:[(0,V.jsx)(O.StaffAvatar,{id:u,size:48}),(0,V.jsx)(f.T,{weight:"semibold",style:{flex:1},children:m})]}),(0,V.jsx)(f.Badge,{kind:Q?'ok':'neutral',label:Q?`On shift since ${(0,C.hm)(new Date(Q.in))}`:'Not clocked in'})]}),(0,V.jsx)(f.Muted,{children:J?`Today's shift: ${(0,$.fmtH)(J.start)}\u2013${(0,$.fmtH)(J.end)}`:'No shift on the rota today'}),(0,V.jsx)(h.default,{testID:"clock-area-line",children:(0,V.jsx)(f.T,{size:14,colour:D.colours.muted,children:te?j?`Location is checked only when you choose Clock in, at ${g.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${g.name}.`:x.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),se&&!0===se.inside&&null!=se.dist?(0,V.jsxs)(f.Muted,{children:["Last check: at the venue (about ",se.dist," m from the centre)."]}):null,Q?(0,V.jsx)(f.T,{size:30,weight:"bold",center:!0,children:(0,$.hmDur)(ee)}):null,Q&&X?(0,V.jsx)(h.default,{testID:"on-break",children:(0,V.jsxs)(f.T,{size:15,weight:"semibold",colour:D.colours.gold,center:!0,children:["On a break since ",(0,C.hm)(new Date(X.start))," \xb7 ",(0,s.loggedBreakMins)(Q,e)," min so far"]})}):null,Q?(0,V.jsxs)(V.Fragment,{children:[X?(0,V.jsx)(f.Button,{testID:"break-end",kind:"success",label:'break_end'===L?'Checking your location\u2026':'End break',disabled:!!L,onPress:()=>{ce('break_end')}}):(0,V.jsx)(f.Button,{testID:"break-start",kind:"secondary",label:'break_start'===L?'Checking your location\u2026':'Start break',disabled:!!L,onPress:()=>{ce('break_start')}}),(0,V.jsx)(f.Button,{testID:"clock-out",kind:"danger",label:'out'===L?'Checking your location\u2026':'Clock out',disabled:!!L,onPress:()=>{Q.breaks?.length?ce('out'):(W(null),T(!0))}})]}):(0,V.jsx)(f.Button,{testID:"clock-in",kind:"success",label:'in'===L?'Checking your location\u2026':'Clock in',disabled:!!L,onPress:()=>{j?y(!0):ce('in')}}),ae?(0,V.jsxs)(h.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,V.jsx)(f.T,{size:18,weight:"bold",colour:D.colours.gold,center:!0,children:"Not sent yet"}),(0,V.jsx)(f.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,V.jsx)(f.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{d.mutationQueue.retryNow()}})]}):de?(0,V.jsx)(h.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,V.jsx)(f.T,{size:14,colour:D.colours.ok,center:!0,children:"\u2713 Sent"})}):null,Q?.breaks?.length?(0,V.jsxs)(f.Muted,{center:!0,children:["Breaks today: ",Q.breaks.map(e=>`${(0,C.hm)(new Date(e.start))}\u2013${e.end?(0,C.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(Q,e)," min)"]}):null,N?(0,V.jsx)(h.default,{testID:"clock-message",children:(0,V.jsx)(f.Banner,{kind:"warn",title:"Not recorded",children:N})}):null,N&&'settings'===Y?(0,V.jsx)(f.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:z.openAppSettings}):null,N&&'location'===Y?(0,V.jsx)(f.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:z.openLocationSettings}):null,N&&'update'===Y?(0,V.jsx)(f.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:z.checkAppUpdate}):null]}),Z&&!(0,P.areaSet)(x)?(0,V.jsx)(h.default,{testID:"clock-area-warning",children:(0,V.jsx)(f.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,V.jsx)(c.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>K(!0),style:{alignSelf:'center',padding:6},children:(0,V.jsx)(f.T,{size:14,colour:D.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,V.jsx)(le,{onClose:()=>K(!1)}):null,(0,V.jsx)(b.BreakRoomCard,{staffId:u,name:m,now:e}),E?(()=>{const t=(0,$.paidMins)(E,e);return(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsxs)(f.T,{weight:"semibold",colour:D.colours.gold,children:["Clocked out at ",(0,C.hm)(new Date(E.out))]}),(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["Clocked ",(0,$.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,$.hmDur)(t.paid)]}),(0,V.jsxs)(f.Muted,{children:["In ",(0,C.hm)(new Date(E.in))," \xb7 out ",(0,C.hm)(new Date(E.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",E.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,V.jsx)(f.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,V.jsx)(f.Sheet,{visible:w,onClose:()=>y(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,V.jsxs)(h.default,{style:{gap:12},children:[(0,V.jsxs)(f.T,{children:["We check once that you are at ",g.name,", within about ",x.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,V.jsx)(f.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,V.jsx)(f.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{y(!1),ce('in')}}),(0,V.jsx)(f.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>y(!1)})]})}),Z?(0,V.jsx)(ie,{rid:p,today:t,now:e}):null,U?(0,V.jsx)(n.ShiftCheckout,{rid:p,shiftKey:U.id,day:U.date,meId:u,onClose:()=>G(null)}):null,(0,V.jsx)(f.Sheet,{visible:v,onClose:()=>T(!1),title:"Did you take a break? If so, how long?",children:(0,V.jsxs)(h.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,V.jsx)(f.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,V.jsx)(f.Chip,{testID:`forgot-break-${e}`,label:(0,P.breakLabel)(e),disabled:e>=ee,onPress:()=>{T(!1),ce('out',{addedBreak:e})}},e))}),(0,V.jsx)(f.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{T(!1),ce('out',{breakMins:0})}}),ee>360?(0,V.jsx)(f.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,V.jsx)(f.Muted,{children:j?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,V.jsx)(h.default,{style:{gap:10},children:(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsx)(f.T,{weight:"semibold",colour:D.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(f.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",g.name,", within about ",x.radius," m."]}),(0,V.jsx)(f.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,V.jsxs)(V.Fragment,{children:[" ",(0,V.jsxs)(f.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,V.jsx)(f.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",g.name," (within about ",x.radius," m)."]}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,V.jsx)(f.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(u,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,$.useCtx)(3e4);return s!=='staff'?(0,V.jsx)(de,{now:e,today:t,meId:n}):(0,V.jsx)(re,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]);_r(_d[9]);var c=e(_r(_d[10])),u=e(_r(_d[11])),h=e(_r(_d[12])),f=_r(_d[13]),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),B=_r(_d[32]),P=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),W=_r(_d[40]),Y=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),V=_r(_d[46]);const K=e=>(0,w.deptKey)(e?.dept),U=(e,t)=>(0,w.canSwapWith)(e,t,y.VENUE_RID),G=2650,Q=1900,X=e=>e.end-e.start,J=e=>e>8?.5:e>6?.3333333333333333:0,Z=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,$.weekday)(e)),t};function ee(e){const{rid:t,r:s,now:n}=(0,$.useCtx)(6e4),a=(0,m.useBookings)(t),o=(0,m.useOrders)(t),i=(0,m.useEvents)(t),r=(0,L.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,C.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),n=a.filter(e=>!e.walkIn&&'confirmed'===e.status&&t.some(t=>(0,C.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,H.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:l,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:l,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:l,booked:n,sales:t.map(e=>{const t=(0,I.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*G+t.restOfDay.takeaway*Q:0})}},[s,a,o,i,r,(0,C.ymd)(e)])}function te({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,l.useState)(e.shift?.start??12),[i,r]=(0,l.useState)(e.shift?.end??20),[d,c]=(0,l.useState)(e.shift?.breakAt),[u,m]=(0,l.useState)((0,E.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,V.jsxs)(f.Sheet,{visible:!0,onClose:t,title:(0,F.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,V.jsx)(f.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,k.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,V.jsx)(f.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,V.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,V.jsx)(f.Chip,{label:"None",selected:!u,onPress:()=>m(void 0),testID:"shift-badge-none"}),E.ROLE_BADGES.map(e=>(0,V.jsx)(f.Chip,{label:e,selected:u===e,onPress:()=>m(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,V.jsx)(f.Chip,{label:`${e} ${(0,$.fmtH)(t)}\u2013${(0,$.fmtH)(s)}`,selected:a===t&&i===s,onPress:()=>{o(t),r(s)}},e))}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{children:"Start"}),(0,V.jsx)(f.Stepper,{testID:"shift-start",value:a,step:.5,min:F.SHIFT_MIN_START,max:i-1,onChange:o,format:$.fmtH,label:"Start time"})]}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,V.jsx)(f.T,{children:"End"}),(0,V.jsxs)(h.default,{style:{alignItems:'flex-end'},children:[(0,V.jsx)(f.Stepper,{testID:"shift-end",value:i,step:.5,min:a+1,max:F.SHIFT_MAX_END,onChange:r,format:$.fmtH,label:"End time"}),i>=24?(0,V.jsx)(f.Muted,{children:"next day"}):null]})]}),(0,V.jsxs)(f.Muted,{children:[(i-a).toFixed(1),"h scheduled",J(i-a)?`, ${Math.round(60*J(i-a))}m planned break`:'']}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,V.jsx)(f.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,V.jsx)(f.Chip,{label:"Set a break time",onPress:()=>c(Math.min(i-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(i-a)/2)))/4)))}):(0,V.jsxs)(f.Row,{gap:6,children:[(0,V.jsx)(f.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:i-.25,onChange:c,format:$.fmtH,label:"Break time"}),(0,V.jsx)(f.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,V.jsx)(f.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,V.jsx)(f.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:i,breakAt:g?d:void 0,badge:(0,E.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:i,...void 0!==d&&g?{breakAt:d}:{},...(0,E.cleanBadge)(u)?{badge:(0,E.cleanBadge)(u)}:{}}),t()}}),(0,V.jsx)(f.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,V.jsx)(f.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const se=6;function ne(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*se:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+se),big:o>=104,fits:!e||s+t*(o+se)<=e}}const ae={position:'sticky',top:0};function oe({fits:e,children:t}){return e?(0,V.jsx)(h.default,{style:{alignItems:'center'},children:t}):(0,V.jsx)(u.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function ie({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),i=(0,$.useSignedIn)(),{me:r,meId:d}=(0,$.useCtx)(3e4),[c,u]=(0,l.useState)(null),[h,m]=(0,l.useState)(''),[g,p]=(0,l.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,R.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:i?.id??d,name:i?.name??r},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,A.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),p(null)};return(0,V.jsxs)(f.Card,{children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Record it for someone"}),(0,V.jsx)(f.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:a.map(e=>(0,V.jsx)(f.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:x?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,V.jsx)(f.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,V.jsx)(f.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,V.jsx)(f.T,{size:13,colour:D.colours.red,children:g}):null]}):null]})}function le({onClose:e}){const{now:t,today:n,meId:a}=(0,$.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),i=(0,s.useOwner)(e=>e.shifts),r=Array.from({length:7},(e,t)=>(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(n),1440*-t))),[d,c]=(0,l.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(i,!1).find(e=>e.staffId===a&&e.date===d),[m,g]=(0,l.useState)(u&&!u.out?'out':'in'),[p,b]=(0,l.useState)(h?Math.round(60*h.start):720),[j,w]=(0,l.useState)(h?Math.round(60*h.end):1200),[y,k]=(0,l.useState)(''),[I,S]=(0,l.useState)(!1),v=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==m,O='in'!==m,M=T&&O&&j<=p,B=(e,t)=>(0,V.jsx)(f.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,V.jsxs)(f.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,V.jsx)(f.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,V.jsx)(f.Button,{label:"Done",onPress:e})]}):(0,V.jsxs)(f.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,V.jsx)(f.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:r.map(e=>(0,V.jsx)(f.Chip,{label:e===n?'Today':(0,C.niceDate)((0,C.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,V.jsxs)(f.Muted,{children:[h?`Your rota that day: ${(0,$.fmtH)(h.start)}\u2013${(0,$.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,C.hm)(new Date(u.in))}\u2013${u.out?(0,C.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Forgot to clock in",selected:'in'===m,onPress:()=>g('in')}),(0,V.jsx)(f.Chip,{label:"Forgot to clock out",selected:'out'===m,onPress:()=>g('out')}),(0,V.jsx)(f.Chip,{label:"Forgot both",selected:'both'===m,onPress:()=>g('both')})]}),T?(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["In ",v(p)]}),B(b,p)]}):null,O?(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["Out ",v(j),j>=1440?' (next day)':'']}),B(w,j)]}):null,M?(0,V.jsx)(f.T,{size:13,colour:D.colours.red,children:"Clock-out must be after clock-in."}):null,(0,V.jsx)(f.Field,{label:"Note for your manager (optional)",value:y,onChangeText:k,placeholder:"e.g. phone died",maxLength:200}),(0,V.jsx)(f.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:m,suggestedIn:T?(0,x.isoAt)(d,p):void 0,suggestedOut:O?(0,x.isoAt)(d,j):void 0,note:y.trim(),at:t.toISOString()}),S(!0)}})]})}function re(){const{now:e,today:t,meId:n}=(0,$.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),i=(0,s.useOwner)(e=>e.timeRequests),[r,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),m=(0,C.ymd)(Z(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=m),b=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),w=i.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,V.jsxs)(h.default,{style:{gap:10},testID:"my-timesheet",children:[(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,V.jsxs)(h.default,{children:[(0,V.jsx)(f.T,{size:12,colour:D.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,V.jsx)(f.T,{size:28,weight:"bold",colour:D.colours.ok,children:(0,$.hmDur)(b)})]}),(0,V.jsxs)(h.default,{style:{alignItems:'flex-end'},children:[(0,V.jsx)(f.T,{size:12,colour:D.colours.muted,children:"PENDING SIGN-OFF"}),(0,V.jsx)(f.T,{size:18,weight:"semibold",colour:j?D.colours.amber:D.colours.muted,children:(0,$.hmDur)(j)})]})]}),(0,V.jsx)(f.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,V.jsx)(f.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,V.jsx)(v.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,V.jsxs)(h.default,{style:{flex:1},children:[(0,V.jsxs)(f.T,{size:14,children:[(0,C.niceDate)((0,C.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,V.jsxs)(f.Muted,{children:[e.suggestedIn?`in ${(0,C.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,C.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,V.jsx)(f.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,V.jsx)(v.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,$.paidMins)(t,e),i=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,V.jsxs)(f.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(h.default,{style:{flex:1},children:[(0,V.jsx)(f.T,{weight:"semibold",children:(0,C.niceDate)((0,C.parseYmd)(t.date))}),(0,V.jsxs)(f.Muted,{children:[(0,C.hm)(new Date(t.in)),"\u2013",t.out?(0,C.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,$.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,$.fmtH)(n.start)}\u2013${(0,$.fmtH)(n.end)}`:'']})]}),(0,V.jsx)(f.Badge,{kind:(0,x.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,x.statusLabel)(t)})]}),i?(0,V.jsxs)(f.T,{size:13,colour:D.colours.gold,children:["Adjusted by ",i.by.replace(' (example)',''),i.reason?`: ${i.reason}`:'']}):null,t.signOff?(0,V.jsxs)(f.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,V.jsx)(x.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,V.jsx)(f.Muted,{children:"No clocked shifts yet."}),r?(0,V.jsx)(le,{onClose:()=>d(!1)}):null]})}function de({now:e,today:n}){const o=(0,s.useOwner)(e=>e.staff),i=(0,s.useOwner)(e=>e.shifts),r=(0,$.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),u=(0,s.useOwner)(e=>e.timeRequests),m=(0,s.useOwner)(e=>e.leave),p=(0,s.useOwner)(e=>e.attLog),[b,j]=(0,l.useState)(n),[w,y]=(0,l.useState)(null),[k,I]=(0,l.useState)(!1),[T,M]=(0,l.useState)(!1),B=!!(0,$.useSignedIn)(),P=T?(0,N.pastWeekDays)(b,n):Array.from({length:7},(e,t)=>(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===b&&e.in),A=i.filter(e=>e.date===b&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>P.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),Y=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),F=L.reduce((t,s)=>t+(0,$.paidMins)(s,e).paid/60*(r[s.staffId]??0),0),E=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=o.find(e=>e.id===t.staffId),a=(0,s.shiftOf)(i,t.staffId,t.date),l=(0,$.paidMins)(t,e),d=r[t.staffId]??0;return`${n?.name},${t.date},${a?`${(0,$.fmtH)(a.start)}-${(0,$.fmtH)(a.end)}`:'-'},${(0,C.hm)(new Date(t.in))},${(0,C.hm)(new Date(t.out))},${l.brk},${(l.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(l.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==r[t.staffId]?'Rate not set':n?.noTax&&B?'No tax deducted':''}`}));return(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsx)(W.HoursDayPicker,{testID:"ts-pick",date:b,today:n,custom:T,onDate:e=>{j(e),M(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),M(!1)}}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:P.map(e=>(0,V.jsx)(f.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,N.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':T?(0,N.chipDay)(e):(0,C.niceDate)((0,C.parseYmd)(e)).slice(0,6).trim(),selected:b===e,onPress:()=>j(e)},e))}),(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",testID:"ts-week-title",children:T?(0,N.weekTitle)(b,n):'Last 7 days'}),(0,V.jsx)(f.Badge,{kind:"ok",label:`${(0,$.hmDur)(H)} confirmed`})]}),Y?(0,V.jsxs)(f.T,{size:13,colour:D.colours.amber,children:[(0,$.hmDur)(Y)," pending sign-off (not counted yet)"]}):null,(0,V.jsxs)(f.Muted,{children:["Labour cost ",(0,S.gbp)(Math.round(F))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,V.jsx)(a.WideTable,{children:(0,V.jsxs)(h.default,{style:{gap:2},children:[(0,V.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:D.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,V.jsx)(f.T,{size:12,weight:"semibold",colour:D.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const l=o.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(i,t.staffId,b),d=(0,$.paidMins)(t,e),h=(0,x.flagsFor)(t,r,e,n,u).map(e=>e.label);return(0,V.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,V.jsxs)(f.Row,{gap:4,style:{width:110},children:[(0,V.jsx)(O.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,V.jsx)(f.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:l?.name.replace(' (example)','')})]}),(0,V.jsx)(f.T,{size:12,style:{width:86},colour:D.colours.muted,children:r?`${(0,$.fmtH)(r.start)}\u2013${(0,$.fmtH)(r.end)}`:'\u2013'}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:(0,C.hm)(new Date(t.in))}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:t.out?(0,C.hm)(new Date(t.out)):'on'}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,V.jsx)(f.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,$.hmDur)(d.paid):`${(0,$.hmDur)(d.worked)}\u2026`}),(0,V.jsx)(f.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?D.colours.ok:'open'===(0,s.attStatus)(t)?D.colours.blue:D.colours.amber,children:(0,x.statusLabel)(t)}),(0,V.jsx)(f.T,{size:11,style:{width:140},colour:h.length?D.colours.amber:D.colours.ok,children:h.join(', ')||'OK'}),(0,V.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${l?.name}`,onPress:()=>y(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,V.jsx)(f.T,{size:12,colour:D.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,V.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,V.jsx)(f.T,{size:12,style:{width:110},children:o.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,V.jsxs)(f.T,{size:12,style:{width:86},colour:D.colours.muted,children:[(0,$.fmtH)(t.start),"\u2013",(0,$.fmtH)(t.end)]}),(()=>{const s=(0,g.leaveCovering)(m,t.staffId,t.date);return s?(0,V.jsxs)(f.T,{size:12,colour:D.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,g.leaveLabel)(s)," (rota covered)"]}):(0,V.jsx)(f.T,{size:12,colour:b===n&&60*t.start>60*e.getHours()+e.getMinutes()?D.colours.muted:D.colours.red,children:b===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,V.jsx)(f.Muted,{children:"No shifts or clock records for this day."}),(0,V.jsx)(f.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,V.jsx)(f.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,V.jsx)(v.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,V.jsxs)(f.Muted,{children:[(0,C.niceDate)(new Date(e.at))," ",(0,C.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,V.jsx)(f.Muted,{children:"No manual changes yet."}),w?(0,V.jsx)(x.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>y(null)}):null,(0,V.jsxs)(f.Sheet,{visible:k,onClose:()=>I(!1),title:"Payroll export",children:[(0,V.jsxs)(f.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",Y?`${(0,$.hmDur)(Y)} still pending sign-off is left out.`:'']}),(0,V.jsxs)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[E.slice(0,14).map((e,t)=>(0,V.jsx)(f.T,{size:10,colour:t?D.colours.text:D.colours.gold,children:e},t)),E.length>14?(0,V.jsxs)(f.Muted,{children:["\u2026 ",E.length-14," more rows"]}):null]}),(0,V.jsxs)(f.Muted,{children:[E.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1087,[887,861,1049,1502,1303,1304,31,1160,1162,123,264,152,128,817,822,1441,1514,987,1140,1515,1164,5,1516,876,819,821,824,997,1007,998,999,1064,868,869,1439,1066,1440,1028,1054,1509,1511,1154,1153,1517,1518,807,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return O}}),_e.allocate=D,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:v,role:P,meId:B,me:F}=(0,x.useCtx)(6e4),R=(0,u.useOwner)(e=>e.staff),N=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),A=(0,u.useOwner)(e=>e.shifts),L=(0,u.useOwner)(e=>e.tronc),z=(0,u.useOwner)(e=>e.troncCash),_=(0,u.useOwner)(e=>e.troncHistory),V=(0,u.useOwner)(e=>e.troncLog),U=(0,c.useOrders)(C),q=(0,j.useVenuePay)(C).pay,[H,W]=(0,i.useState)(-1),[Y,K]=(0,i.useState)(''),[G,Q]=(0,i.useState)(!1),[J,X]=(0,i.useState)(!1),[Z,ee]=(0,i.useState)(L.text),[te,se]=(0,i.useState)(null),oe='staff'!==P,ie='owner'===P,{s:ne,e:re,key:le}=(0,j.venueRange)(q,'tips',H,S),ae=`${(0,h.niceDate)(ne)} \u2013 ${(0,h.niceDate)(re)} ${re.getFullYear()}`,de=_.find(e=>e.key===le),ce=e=>u.useOwner.getState().setOwner({tronc:{...L,...e}}),ue=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),pe=Math.round((re.getTime()-ne.getTime())/864e5)+1,he=(0,i.useMemo)(()=>{let e=U.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(ne)&&e.createdAt.slice(0,10)<=(0,h.ymd)(re)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!ue)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[le,U.length,ue]),me=(0,T.useCashUp)(e=>e.cashUps),fe=Math.round(100*(0,k.cashUpTipsBetween)(me,C,(0,h.ymd)(ne),(0,h.ymd)(re))),ye=z[le]??0,ge=de?de.pot:he+fe+ye,xe=(0,i.useMemo)(()=>{const e={};for(let t=0;tv)break;const o=(0,h.ymd)(s);R.forEach(t=>{const s=N.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[le,N.length,A.length,R.length]),je=R.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&L.includeManagers||'owner'===e.role&&L.includeOwner)),be=(0,i.useMemo)(()=>{if(de)return de.rows;const e=je.map(e=>{const t=(xe[e.id]?.paid??0)/60,s=L.points[O(e)]??1;return'hours'===L.method?t:'points'===L.method?t*s:'equal'===L.method?t>0?1:0:L.custom[e.id]??0}),{amounts:t}=D(ge,e),s=e.reduce((e,t)=>e+t,0);return je.map((o,i)=>({staffId:o.id,hours:(xe[o.id]?.paid??0)/60,points:L.points[O(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[de,je.map(e=>e.id).join(),xe,L,ge]),we=be.reduce((e,t)=>e+t.amount,0),Te=de?0:(()=>{const e=be.map(e=>e.pct);return D(ge,e).remainder})(),Ce=Object.entries(L.custom).filter(([e])=>je.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),Se='custom'===L.method&&Math.abs(Ce-100)>.01,ke=new Date(re.getFullYear(),re.getMonth()+2,0),ve=[..._].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==_.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),Me=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(be.map(e=>{const t=R.find(t=>t.id===e.staffId);return`${I(t.name)},${O(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(we/100).toFixed(2)}`]);return oe?(0,M.jsxs)(l.default,{style:{gap:10},children:[(0,M.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,M.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,M.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>W(H-1)}),(0,M.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,M.jsx)(d.T,{weight:"semibold",children:ae}),de?(0,M.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${de.lockedAt}`}):H>=0?(0,M.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,M.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:H>=0,onPress:()=>W(H+1)})]}),(0,M.jsxs)(d.Card,{children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Card tips on orders"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.card:he)})]}),(0,M.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.cashUps??0:fe)})]})}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Other cash tips"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.cash:ye)})]}),de?null:(0,M.jsxs)(d.Row,{gap:6,children:[(0,M.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:Y,onChangeText:K,style:[d.styles.input,{flex:1}]}),(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(Y)>=0)||''===Y.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{...z,[le]:Math.round(100*Number(Y))}}),K('')}})]}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,M.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(ge)})]}),(0,M.jsx)(d.Muted,{children:ue?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),de?(0,M.jsxs)(d.Muted,{children:["Locked with method: ",$[de.method],"."]}):(0,M.jsxs)(d.Card,{children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,M.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys($).map(e=>(0,M.jsx)(d.Chip,{label:$[e],selected:L.method===e,onPress:()=>ie&&ce({method:e})},e))}),ie?null:(0,M.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===L.method?Object.entries(L.points).map(([e,t])=>(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:e}),(0,M.jsx)(d.Row,{gap:6,children:(0,M.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ie&&ce({points:{...L.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===L.method?(0,M.jsxs)(M.Fragment,{children:[je.map(e=>(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{style:{flex:1},children:I(e.name)}),(0,M.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(L.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ce({custom:{...L.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ce({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,M.jsxs)(d.T,{size:13,colour:Se?m.colours.red:m.colours.ok,children:["Total ",Ce.toFixed(1),"%",Se?' (must be 100%)':' \u2713']})]}):null,(0,M.jsx)(d.Toggle,{label:"Include managers",value:L.includeManagers,onChange:e=>ie&&ce({includeManagers:e})}),(0,M.jsx)(d.Toggle,{label:"Include owner",value:L.includeOwner,onChange:e=>ie&&ce({includeOwner:e})}),L.includeOwner?(0,M.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,M.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[be.map(e=>{const t=R.find(t=>t.id===e.staffId);return(0,M.jsxs)(d.Card,{children:[(0,M.jsxs)(d.T,{center:!0,weight:"semibold",children:[I(t?.name),xe[e.staffId]?.est&&!de?'*':'']}),(0,M.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,M.jsxs)(d.T,{center:!0,children:["Points: ",'points'===L.method||'points'===de?.method?e.points.toFixed(1):'\u2013']}),(0,M.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,M.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,M.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(we)]})]}):(0,M.jsx)(r.default,{horizontal:!0,children:(0,M.jsxs)(l.default,{children:[(0,M.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,M.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),be.map(e=>{const t=R.find(t=>t.id===e.staffId);return(0,M.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,M.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[I(t?.name),xe[e.staffId]?.est&&!de?'*':'']}),(0,M.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,M.jsx)(d.T,{size:13,style:{width:54},children:'points'===L.method||'points'===de?.method?e.points.toFixed(1):'\u2013'}),(0,M.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,M.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,M.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,M.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,M.jsx)(d.T,{size:13,weight:"bold",colour:we===ge?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(we)})]})]})}),(0,M.jsxs)(d.Muted,{children:[we===ge?`\u2713 Total equals the pot (${(0,p.gbp)(ge)}).`:'\u2717 Total does not equal the pot.',Te?` Rounding: ${Te}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),de?null:(0,M.jsx)(d.Button,{label:"Approve & lock period",disabled:!ie||H>=0||Se||we!==ge||ge<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${le}`,key:le,label:ae,end:(0,h.ymd)(re),pot:ge,card:he,cash:ye,cashUps:fe,method:L.method,rows:be,lockedAt:e,by:F};u.useOwner.getState().setOwner({troncHistory:[t,..._],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${F} approved & locked tips for ${ae}: ${(0,p.gbp)(ge)} split ${$[L.method].toLowerCase()} between ${be.filter(e=>e.amount>0).length} staff`},...V]})}}),!de&&H>=0?(0,M.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ie||de?null:(0,M.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,M.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>Q(!0)}),de?(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:de.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!de.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${ae} approved: ${(0,p.gbp)(de.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:_.map(e=>e.id===de.id?{...e,shared:(0,h.niceDate)(S)}:e)}),se('Posted to All staff chat.')}}):null]}),te?(0,M.jsx)(d.Banner,{kind:"info",title:te}):null,(0,M.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,M.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(ge)} = allocated ${(0,p.gbp)(we)}`],[L.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(ke)} ${ke.getFullYear()}`],[!0,'Tip records kept for 3 years',`${_.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${V.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,M.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,M.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,M.jsxs)(l.default,{style:{flex:1},children:[(0,M.jsx)(d.T,{size:14,children:t}),(0,M.jsx)(d.Muted,{children:s})]})]},String(t))),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{ee(L.text),X(!0)}})]}),(0,M.jsx)(y.SectionHead,{title:"Tip history & audit log"}),_.map(e=>(0,M.jsxs)(d.Card,{children:[(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{weight:"semibold",children:e.label}),(0,M.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,M.jsxs)(d.Muted,{children:[$[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),V.map(e=>(0,M.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),_.length||V.length?null:(0,M.jsx)(d.Muted,{children:"No approved periods yet."}),(0,M.jsxs)(d.Sheet,{visible:G,onClose:()=>Q(!1),title:"Tips summary export",children:[(0,M.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,M.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Me.map((e,t)=>(0,M.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,M.jsxs)(d.Muted,{children:[ae," \xb7 ",$[de?.method??L.method]]})]}),(0,M.jsxs)(d.Sheet,{visible:J,onClose:()=>X(!1),title:"Tipping policy",children:[(0,M.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ie,value:Z,onChangeText:ee,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ie?(0,M.jsx)(d.Button,{label:"Save policy",onPress:()=>{ce({text:Z}),X(!1)}}):null,(0,M.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,M.jsx)(E,{})},_e.useStaffTips=N,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=N(e,t);(0,i.useEffect)(()=>{if(!o.showToday||F()||P.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=N(e,t),r=`Tip pot this period, ${B(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${B(i)}`;return(0,M.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,M.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,M.jsx)(A,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,M.jsx)(A,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=E;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),v=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);const $={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},O=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',I=e=>(e??'').replace(' (example)','');function D(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const B=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function F(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const R={pot:186.4,today:48.5};function N(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,v.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||P.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),F()?{pot:R.pot,today:R.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function A({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${B(s)}`;return(0,M.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,M.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,M.jsx)(d.Muted,{center:!0,children:o}):(0,M.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:B(s)})]})}function E(e={}){const t=(0,x.useCtx)(6e4),s=N(t.rid,t.today);return(0,M.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,M.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,M.jsx)(A,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,M.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,M.jsx)(A,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1088,[887,873,842,31,264,152,128,288,817,822,861,819,821,824,1007,997,998,1415,1027,823,1030,994,13,1431,1078,2,25]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=j,_e.periodPay=T,_e.MyHoursPay=C,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),j=(0,a.useOwner)(e=>e.staff),k=(0,i.useMemo)(()=>j.filter(e=>e.active),[j]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:M,rid:v}=(0,y.useCtx)(6e4),N=(0,b.useVenuePay)(v).pay,[B,O]=(0,i.useState)(-1),[L,$]=(0,i.useState)(null),[S,H]=(0,i.useState)(''),[I,W]=(0,i.useState)(null),E=(0,i.useMemo)(()=>k.map(e=>({...T(e.id,B,M,R,D[e.id]??0,N,z),person:e})),[k,B,R,D,N,z]),_=E.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),V=E[0]?.label??'',F=k.find(e=>e.id===L),G=Math.round(100*Number(S));return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,f.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,f.jsx)(P,{label:V,offset:B,setOffset:O,badge:0===B?'Current period':void 0}),(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),E.map(e=>(0,f.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>W(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,f.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:x(e.person.name)}),c&&e.person.noTax?(0,f.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),H(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,f.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]$(null),title:`Hourly rate: ${x(F?.name)}`,children:[(0,f.jsx)(l.Muted,{children:F?`${F.level??a.ROLE_LABEL[F.role]} \xb7 ${F.job}${F.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(F,D[F.id],u.gbp)}`:''}),(0,f.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",value:S,onChangeText:H,style:l.styles.input}),Number.isFinite(G)&&G>0&&G{a.useOwner.getState().setRate(L,G),$(null)}}),L&&null!=D[L]?(0,f.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(L),$(null)}}):null]}),(0,f.jsx)(l.Sheet,{visible:!!I,onClose:()=>W(null),title:`What ${x(k.find(e=>e.id===I)?.name)} sees`,children:I?(0,f.jsx)(C,{staffId:I}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const x=e=>(e??'').replace(' (example)',''),w='Before tax and deductions, estimate';function j(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>T(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function T(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function P({label:e,offset:s,setOffset:t,badge:i}){return(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,f.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e}),i?(0,f.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function C({staffId:e}){const{meId:s,now:C,rid:k}=(0,y.useCtx)(6e4),D=e??s,R=(0,b.useVenuePay)(k).pay,z=(0,a.useOwner)(e=>e.staff).find(e=>e.id===D),M=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[D]??0,O=null!=N[D],[L,$]=(0,i.useState)(0),S=j(D,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...T(D,e,C,M,B,R,v)})),[D,M,B,R,v]);return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Banner,{kind:"info",title:w,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,f.jsxs)(l.Muted,{children:[x(z?.name)," \xb7 ",z?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",R.wagePayDay,[1,21,31].includes(R.wagePayDay)?'st':[2,22].includes(R.wagePayDay)?'nd':[3,23].includes(R.wagePayDay)?'rd':'th',", cut-off the ",R.wageCutoffDay,[1,21].includes(R.wageCutoffDay)?'st':[2,22].includes(R.wageCutoffDay)?'nd':[3,23].includes(R.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,f.jsx)(P,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Confirmed paid hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,f.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Gross pay from hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Tips allocated"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,f.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,f.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,f.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,f.jsxs)(l.Muted,{children:[w,". Tips are shown separately and only once a tip period is approved."]})]}),(0,f.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,f.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,f.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,f.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,f.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,f.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,f.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,f.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,f.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,f.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,f.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,f.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.label}),(0,f.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,f.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",w.toLowerCase()]})]})},e.o))]})}},1089,[873,1502,31,264,128,288,817,861,819,821,824,997,998,1415,25]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1090,[873,31,988,993,1241,240,264,128,817,861,819,821,824,997,998,1101,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,p.useSync)(e=>e.venueId)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(0,n.useCallback)(async()=>{if(e)try{r((await(0,p.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=async e=>{try{const s=(await(0,p.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:0===u?null:24*u}))?.[0];s&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,p.rpc)('create_display_code',{p_venue:e,p_label:d.trim()||'Reception screen',p_hours:0===u?null:24*u,p_can_write:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.jsxs)(i.Muted,{center:!0,children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${k(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.open_codes&&!e.revoked_at?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.jsx)(i.Muted,{center:!0,children:"Paired means signed in, not a live connection check. Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_e.TrackedStockPage=function(){const t=(0,d.useOwner)(e=>e.site),a=(0,c.useShellStore)(e=>e.items[t])??[],l=(0,u.useOrderSheets)(e=>e.sheets[t])??[],[r,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),a.map(e=>(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.jsxs)(i.Muted,{children:['roast'===e.group?'Sunday roast (Display, Sundays only) \xb7 ':'','kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(t,e,e.lowAt):e.lowAt," \xb7 ",l.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),w&&!r?(0,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.jsx)(i.Field,{label:'kg'===r.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===r.unit?(0,s.halfStone)((0,s.toStone)(r.lowAt)):r.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!r.name.trim(),onPress:()=>{if(!r)return;const e=r.name.trim();if(!e)return;const s=r.key||(0,h.stockKey)(e);!r.key&&a.some(e=>e.key===s)||(c.useShellStore.getState().saveItem(t,{...r,key:s,name:e,plural:r.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(r.lowAt)||0)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,d.useOwner)(e=>e.site),s=(0,r.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),t=(0,r.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[a,l]=(0,n.useState)(t),c=!a.trim()||!!(0,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{l(''),r.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var a,l=_r(_d[5]),o=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),x=_r(_d[14]),w=_r(_d[15]),j=_r(_d[16]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1091,[1219,1293,1006,31,123,128,817,878,861,1292,1122,1294,823,1644,824,2,1140,25]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ListBadge=C,_e.OrderListsScreen=function({rid:e,who:t,editor:s,today:i}){(0,o.useEffect)(()=>{x.useOrderLists.getState().ensure(e)},[e]);const d=(0,x.useOrderLists)(e=>e.lists).filter(t=>t.rid===e&&!t.archived),n=(0,x.useOrderLists)(e=>e.items);(0,x.useOrderLists)(t=>t.settings[e]);const l=(0,x.orderSettingsOf)(e).allowStaff,h=(0,x.useListOpen)(e=>e.seed),[y,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(!h)return;const e=d.find(e=>e.seed===h);e&&(j(e.id),x.useListOpen.getState().request(void 0))},[h,d.length]);const f=s||l;if(!s&&!l)return(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{children:"Order lists are for managers and the Head Chef here."}),(0,w.jsx)(c.Muted,{children:"Ask a manager to switch on \u201cLet all staff add items\u201d."})]});const b=d.find(e=>e.id===y);if(b)return(0,w.jsx)($,{rid:e,list:b,editor:s,canAdd:f,who:t,today:i,onBack:()=>j(null)});const I=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"order-lists",children:[(0,w.jsxs)(c.Muted,{size:13,children:["Tip: add what\u2019s running low as you notice it. ",s?'On the day, tick what you got, then Finish order.':'A manager or the Head Chef places the order.']}),d.map(t=>{const s=(0,p.liveItems)(n.filter(t=>t.rid===e),t.id).filter(e=>'open'===e.status).length;return(0,w.jsx)(c.Card,{onPress:()=>j(t.id),children:(0,w.jsx)(u.default,{testID:`order-list-card-${t.seed??t.id}`,children:(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,i,I)})]}),(0,w.jsx)(c.Badge,{kind:s?'gold':'neutral',label:`${s} to get`})]})})},t.id)}),d.length?null:(0,w.jsx)(c.Muted,{children:"No order lists yet. Add one in Settings \u203a Advanced \u203a Order lists."})]})};var t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),o=r(_d[3]),d=e(r(_d[4])),n=e(r(_d[5]));r(_d[6]);var l=e(r(_d[7])),u=e(r(_d[8])),c=r(_d[9]),h=r(_d[10]),x=r(_d[11]),p=r(_d[12]),y=r(_d[13]),j=r(_d[14]),f=r(_d[15]),b=r(_d[16]),w=r(_d[17]);const I={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},L=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',v=e=>e.replace(' (example)','').split(' ')[0];function C({list:e,size:s=40}){const i=(0,f.useLogoCache)(t=>t.byList[e.id]),[n,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let t=!0;return!i&&e.logo&&(0,b.orderLogoUrl)(e.logo).then(e=>{t&&l(e)}),()=>{t=!1}},[e.logo,i]);const x=i??n;return x?(0,w.jsx)(d.default,{testID:`list-logo-${e.seed??e.id}`,source:{uri:x},accessibilityLabel:`${e.name} logo`,style:{width:s,height:s,borderRadius:s/2,borderWidth:1,borderColor:h.colours.gold}}):(0,w.jsx)(u.default,{testID:`list-initials-${e.seed??e.id}`,accessibilityLabel:`${e.name}`,style:{width:s,height:s,borderRadius:s/2,backgroundColor:(0,t.soutersSurface)('#1c1a16'),borderWidth:1,borderColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(c.T,{size:.38*s,weight:"bold",colour:h.colours.gold,children:(0,p.initials)(e.name)})})}function D({phone:e}){const t=(0,p.telHref)(e);if(!e||!t)return null;return'undefined'!=typeof navigator&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?(0,w.jsx)(l.default,{testID:"list-phone",accessibilityRole:"link",onPress:()=>{n.default.openURL(t)},children:(0,w.jsxs)(c.T,{colour:h.colours.gold,children:["\ud83d\udcde Call ",e]})}):(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(u.default,{testID:"list-phone",children:(0,w.jsxs)(c.T,{children:["\ud83d\udcde ",e]})}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"list-phone-copy",label:"Copy",onPress:()=>{navigator.clipboard?.writeText(e).then(()=>(0,y.notify)({id:'copied',title:'Number copied',timeoutMs:3e3}))}})]})}function T({list:e}){const t=x.useOrderLists.getState(),s=(0,f.useLogoCache)(t=>!!t.byList[e.id])||!!e.logo,i=async s=>{try{const i=await(0,j.capturePlatingPhoto)(s);if(!i)return;const o=await(0,f.squareLogo)(i.dataUrl,256);f.useLogoCache.getState().put(e.id,o);const d=await(0,b.uploadOrderLogo)(e.id,o);if(d.ok){const s=e.logo;t.updateList(e.id,{logo:d.path}),s&&(0,b.removeOrderLogo)(s)}else'offline'!==d.message&&(0,y.notify)({id:'logo',tone:'warn',title:'Logo saved on this device only',body:d.message,timeoutMs:7e3})}catch(e){(0,y.notify)({id:'logo',tone:'warn',title:'Couldn\u2019t use that picture',body:String(e.message),timeoutMs:7e3})}};return(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-camera",label:s?'Replace: take photo':'Logo: take photo',onPress:()=>{i('camera')}}),(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-library",label:s?'Replace: choose':'Logo: choose image',onPress:()=>{i('library')}}),s?(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"logo-remove",label:"Remove logo",onPress:()=>{f.useLogoCache.getState().drop(e.id),e.logo&&(0,b.removeOrderLogo)(e.logo),t.updateList(e.id,{logo:void 0})}}):null]})}function S({rid:e,list:t,who:i}){const[d,n]=(0,o.useState)(''),[l,y]=(0,o.useState)('1'),[j,f]=(0,o.useState)(''),[b,L]=(0,o.useState)(''),[C,D]=(0,o.useState)(null),T=x.useOrderLists.getState(),S=Number(l.replace(',','.')),B=d.trim().length>0&&(0,p.validQty)(S),$=()=>{n(''),y('1'),L(''),D(null)};return(0,w.jsxs)(u.default,{testID:"order-add",style:{gap:6},children:[(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Item",testID:"order-add-name",value:d,onChangeText:n,placeholder:"Item, e.g. Tennent\u2019s",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Quantity",testID:"order-add-qty",value:l,onChangeText:y,keyboardType:"decimal-pad",style:{...I,width:64,borderColor:(0,p.validQty)(S)?h.colours.hairline:h.colours.red}})]}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:p.UNITS.map(e=>(0,w.jsx)(c.Chip,{label:e||'no unit',selected:j===e,onPress:()=>f(e)},e||'none'))}),(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Note",testID:"order-add-note",value:b,onChangeText:L,placeholder:"Note (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(c.Button,{testID:"order-add-save",label:"Add",disabled:!B,onPress:()=>{const s=(0,p.findDuplicate)(T.items.filter(t=>t.rid===e),t.id,d,j);s?D(s):(T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$())}})]}),(0,w.jsxs)(c.Sheet,{visible:!!C,onClose:()=>D(null),title:"Already on the list",testID:"order-dup",children:[(0,w.jsx)(c.T,{children:C?`${C.name}: ${(0,p.qtyText)(C)} (added by ${v(C.addedByName)})`:''}),(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(c.Button,{testID:"order-dup-bump",label:`Add ${l} more`,onPress:()=>{C&&T.bump(C.id,S,i),$()}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Add as separate item",onPress:()=>{T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$()}})]})]})]})}function B({item:e,editor:t,who:s}){const i=x.useOrderLists.getState(),o='got'===e.status?h.colours.gold:'missing'===e.status?h.colours.amber:h.colours.text;return(0,w.jsxs)(u.default,{testID:`order-item-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.hairline,paddingVertical:8,gap:4},children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",colour:o,style:{flex:1,textDecorationLine:'got'===e.status?'line-through':'none'},children:e.name}),(0,w.jsx)(c.T,{weight:"semibold",children:(0,p.qtyText)(e)})]}),e.note?(0,w.jsxs)(c.Muted,{size:12,children:["Note: ",e.note]}):null,(0,w.jsxs)(c.Muted,{size:12,children:["Added by ",v(e.addedByName)," \xb7 ",L(e.addedAt),e.bumps?.length?` \xb7 +${e.bumps.map(e=>`${e.qty} ${v(e.name)}`).join(', ')}`:'',e.carried?' \xb7 carried over':'']}),'open'!==e.status?(0,w.jsxs)(c.Muted,{size:12,children:['got'===e.status?'Got / ordered':'Missing / not in stock'," \xb7 ",e.statusBy," ",L(e.statusAt)]}):null,t?(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Chip,{testID:`order-got-${e.id}`,label:"\u2713 Got / ordered",selected:'got'===e.status,onPress:()=>i.setStatus(e.id,'got'===e.status?'open':'got',s)}),(0,w.jsx)(c.Chip,{testID:`order-missing-${e.id}`,label:"Missing / not in stock",selected:'missing'===e.status,onPress:()=>i.setStatus(e.id,'missing'===e.status?'open':'missing',s)}),(0,w.jsx)(c.Chip,{testID:`order-remove-${e.id}`,label:"Remove",onPress:()=>{i.removeItem(e.id),(0,y.notify)({id:`undo-${e.id}`,title:`Removed ${e.name}`,timeoutMs:8e3,actions:[{label:'Undo',testID:'order-undo',onPress:()=>i.undoRemove(e.id)}]})}})]}):null]})}function $({rid:e,list:t,editor:d,canAdd:n,who:l,today:j,onBack:f}){(0,i.useBackLayer)(!0,f);const b=(0,x.useOrderLists)(e=>e.items),$=(0,x.useOrderLists)(e=>e.history).filter(e=>e.listId===t.id),P=(0,p.liveItems)(b.filter(t=>t.rid===e),t.id),[k,R]=(0,o.useState)(!1),[O,M]=(0,o.useState)(!1),[A,z]=(0,o.useState)(t.phone??''),N=x.useOrderLists.getState(),q=P.filter(e=>'got'!==e.status).length,H=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:`order-list-${t.seed??t.id}`,children:[(0,w.jsx)(i.BackButton,{onPress:f,testID:"order-list-back"}),(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t,size:48}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{size:18,weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,j,H)})]})]}),(0,w.jsx)(D,{phone:t.phone}),'trip'===t.kind&&d?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(c.Muted,{size:12,children:"Trip day for this trip"}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:[1,2,3,4,5,6,0].map(e=>(0,w.jsx)(c.Chip,{testID:`trip-day-${e}`,label:p.DAY_FULL[e].slice(0,3),selected:(t.tripDay??H)===e,onPress:()=>N.updateList(t.id,{tripDay:e})},e))})]}):null,d?(0,w.jsxs)(u.default,{style:{gap:6},children:[(0,w.jsx)(c.Row,{gap:6,children:(0,w.jsx)(s.TextInput,{accessibilityLabel:"Phone number",testID:"list-phone-edit",value:A,onChangeText:z,onBlur:()=>N.updateList(t.id,{phone:A.trim()||void 0}),placeholder:"Phone (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}})}),(0,w.jsx)(T,{list:t})]}):null]}),n?(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{weight:"semibold",children:"Add to this list"}),(0,w.jsx)(S,{rid:e,list:t,who:l})]}):null,(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",children:"On the list"}),(0,w.jsx)(c.Badge,{kind:"neutral",label:`${P.length}`})]}),P.length?P.map(e=>(0,w.jsx)(B,{item:e,editor:d,who:l},e.id)):(0,w.jsx)(c.Muted,{children:"Nothing on this list yet."}),d&&P.length?(0,w.jsx)(c.Button,{testID:"order-finish",label:"Finish order",onPress:()=>R(!0)}):null]}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"order-history",label:O?'Hide history \u25b4':`History (${$.length}) \u25be`,onPress:()=>M(!O)}),O?$.map(e=>(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.T,{weight:"semibold",children:[L(e.finishedAt)," \xb7 ",v(e.finishedByName)]}),(0,w.jsx)(c.Muted,{size:12,children:e.items.map(e=>`${e.name} ${(0,p.qtyText)(e)}${'missing'===e.status?' (missing)':'open'===e.status?' (not got)':''}`).join(' \xb7 ')}),e.carried?(0,w.jsxs)(c.Muted,{size:12,children:[e.carried," carried over"]}):null]},e.id)):null,(0,w.jsxs)(c.Sheet,{visible:k,onClose:()=>R(!1),title:"Finish this order?",testID:"order-finish-sheet",children:[(0,w.jsxs)(c.T,{children:[P.length-q," got or ordered",q?`, ${q} not got (missing or still open)`:'',"."]}),(0,w.jsx)(c.Muted,{children:"It goes into History with today\u2019s date and your name."}),q?(0,w.jsxs)(c.T,{weight:"semibold",children:["Carry over the ",q," not got to the next order?"]}):null,(0,w.jsxs)(c.Row,{wrap:!0,gap:8,children:[q?(0,w.jsx)(c.Button,{testID:"order-finish-carry",label:"Finish and carry over",onPress:()=>{N.finish(e,t.id,!0,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,body:`${q} carried over`,timeoutMs:6e3})}}):null,(0,w.jsx)(c.Button,{testID:"order-finish-clear",kind:q?'secondary':'primary',label:q?'Finish, don\u2019t carry over':'Finish order',onPress:()=>{N.finish(e,t.id,!1,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,timeoutMs:6e3})}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>R(!1)})]})]})]})}},1092,[887,873,993,31,197,240,123,264,128,817,824,1062,1063,1066,1444,1445,823,25]); +__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},p=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1093,[31,835,128,817,818,1059,1645,1646,824,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAvatars",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),o=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]);const l=(0,s.create)()((0,n.persist)((e,t)=>({photos:{},log:[],clears:{},doneClear:t=>e(e=>{if(!e.clears?.[t])return e;const o={...e.clears};return delete o[t],{clears:o}}),setOwn:(t,o,s,n)=>{if(!t||t!==o||!s.startsWith('data:image/'))return!1;const l=(new Date).toISOString();return e(e=>({clears:Object.fromEntries(Object.entries(e.clears??{}).filter(([e])=>e!==o)),photos:{...e.photos,[o]:{dataUrl:s,at:l}},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'made',by:n,at:l},...e.log].slice(0,100)})),!0},reset:(o,s)=>{if(s.id!==o&&'staff'===s.role)return!1;if(!t().photos[o])return!1;const n={...t().photos};return delete n[o],e(e=>({photos:n,clears:{...e.clears??{},[o]:(new Date).toISOString()},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'reset',by:s.name,at:(new Date).toISOString()},...e.log].slice(0,100)})),!0}}),{name:'covercharge-avatars-v1',storage:(0,n.createJSONStorage)(()=>o.default),version:1}))},1094,[1080,1072,1081]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1095,[31,128,817,824,1161,1536,823,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"BOOKING_VIEW_ONLY",{enumerable:!0,get:function(){return n}}),e.isKitchenPorter=o,e.canChangeBookings=function(n){return!n||(!('owner'!==n.role&&'manager'!==n.role&&!n.ownerAccess&&!n.managerAccess)||('boolean'==typeof n.bookingWrite?n.bookingWrite:!o(n)))},Object.defineProperty(e,"BOOKING_CHANGE_ACTIONS",{enumerable:!0,get:function(){return t}});const n='View only. Ask a manager to change bookings.';function o(n){return!(!n||'staff'!==n.role)&&/porter|KP/i.test(n.job??'')}const t=new Set(['add_walkin','seat_booking','finish_booking','no_show','cancel_booking','move_booking','change_booking','decide_booking','block_table','waitlist_seat'])},1096,[]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"pinProblem",{enumerable:!0,get:function(){return r.pinProblem}}),Object.defineProperty(_e,"ERROR_TEXT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"errorText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useDisplayTiles",{enumerable:!0,get:function(){return u}}),_e.refreshTiles=async function(){const e=await l('display_staff_list',{});Array.isArray(e)&&u.setState({tiles:e,at:Date.now()});const t=await l('display_pin_lengths',{});t&&'object'==typeof t&&!('ok'in t)&&u.setState({lens:t})},_e.refreshManagers=async function(){const e=await l('display_managers',{});Array.isArray(e)&&u.setState({managers:e})},Object.defineProperty(_e,"displayClock",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"displayChangePin",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"displayAddTemp",{enumerable:!0,get:function(){return y}}),_e.setStaffPin=async function(e,n,a=4){const o=_();if(!o)return{ok:!1,error:'Sign in to the venue to set PINs (they are kept on the server only).'};const s=(0,r.pinProblem)(n,a);if(s)return{ok:!1,error:s};try{const{error:r}=await(0,t.getSupabase)().rpc('set_staff_pin',{p_venue:o,p_staff_ref:e,p_pin:n});return r?{ok:!1,error:r.message.replace(/^.*?:\s*(?=The PIN|Pick a PIN)/,'')}:{ok:!0}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},_e.addTempStaff=async function(e){const n=_();if(!n)return{ok:!1,error:'Sign in to the venue to add temp staff (the code is made and kept on the server).'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc('add_temp_staff',{p_venue:n,p_name:e.name,p_dept:e.dept??null,p_rate:e.rate??null,p_until:e.until||null});return a?{ok:!1,error:a.message}:{ok:!0,...r}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},Object.defineProperty(_e,"usePinStatus",{enumerable:!0,get:function(){return k}}),_e.refreshPinStatus=async function(){const e=_();if(!e)return;try{const{data:n}=await(0,t.getSupabase)().rpc('staff_pin_status',{p_venue:e});Array.isArray(n)&&k.setState(Object.fromEntries(n.map(e=>[e.staff_ref,{hasPin:e.has_pin,locked:e.locked}])),!0)}catch{}},_e.localTiles=function(e,t){return e.filter(e=>e.active&&e.displayClock&&!(e.temp&&e.tempUntil&&e.tempUntil({ref:e.id,name:e.name,nickname:e.nickname,dept:e.dept,temp:!!e.temp})).sort((e,t)=>Number(!!e.temp)-Number(!!t.temp)||e.name.localeCompare(t.name))},Object.defineProperty(_e,"displayBlockChange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"displayBlockEdit",{enumerable:!0,get:function(){return h}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]),a=_r(d[4]),o=_r(d[5]);const s={wrong:'That PIN is not right. Try again.',locked:'Too many wrong tries. Locked for 15 minutes, or ask a manager to reset your PIN.',nopin:'No PIN set yet. Ask a manager to set one in Staff & roles.',notallowed:'This person can\u2019t clock in at the Display. A manager can turn it on in Staff & roles.',already:'Already clocked in.',notin:'Not clocked in yet.',onbreak:'Already on a break.',notmanager:'Only an owner or manager can add temp staff.',format:'The new PIN must be 4 to 8 digits (6 or more for managers and owners).',weak:'Pick a PIN that is harder to guess (not all the same digit or a run like 1234).',devicelocked:'Too many wrong PINs on this Display. Wait 15 minutes, then try again.',unpaired:'Pair this Display first (Settings \u203a Devices on the Managers app), then try again.',offline:'No connection. Try again in a moment.'},c=(e,t)=>'format'===e&&t?.min?`The new PIN must be ${t.min} to 8 digits.`:s[e??'']??(e||'Something went wrong. Try again.'),p=()=>'device'===n.useSync.getState().kind&&!!n.useSync.getState().venueId;async function l(e,n){if(a.PITCH)return(0,o.pitchClock)(e,n);if(!p())return{ok:!1,error:'unpaired'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc(e,n);return a?{ok:!1,error:/paired Display/.test(a.message)?'unpaired':a.message}:r}catch{return{ok:!1,error:'offline'}}}const u=(0,e.create)(()=>({tiles:null,managers:[],lens:{}}));const f=(e,t,n,r={})=>l('display_clock',{p_staff_ref:e,p_pin:t,p_action:n,p_break_mins:r.breakMins??null,p_off_rota:!!r.offRota}),m=(e,t,n)=>l('display_change_pin',{p_staff_ref:e,p_old:t,p_new:n}),y=(e,t,n)=>l('display_add_temp',{p_manager_ref:e,p_manager_pin:t,p_name:n.name,p_dept:n.dept??null,p_rate:n.rate??null,p_until:n.until||null}),_=()=>'staff'===n.useSync.getState().kind?n.useSync.getState().venueId:void 0;const k=(0,e.create)(()=>({}));const b=(e,t,n,r,a)=>l('display_block_change',{p_manager_ref:e,p_manager_pin:t,p_block_id:n,p_action:r,p_doc:a}),h=(e,t,n,r)=>l('display_block_edit',{p_block_id:e,p_action:t,p_doc:n,p_by:r})},1097,[1072,871,823,1580,2,1581]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,l.useState)(!1);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...r.look.quiet(e),flexGrow:1}),children:(0,x.jsx)(u.T,{size:15,weight:"semibold",colour:h.colours.goldLight,children:"Clock in / out"})}),e?(0,x.jsx)(I,{onClose:()=>t(!1)}):null]})},_e.PinPad=w,_e.DisplayClockSheet=I,_e.TempCode=T,_e.AddTempForm=S;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),i=e(_r(_d[6])),d=e(_r(_d[7])),c=e(_r(_d[8])),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]),x=_r(_d[17]);const j=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),D={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function w({title:e,sub:t,onDone:n,error:o,busy:s,length:r=4,min:c}){const[p,m]=(0,l.useState)('');(0,l.useEffect)(()=>{o&&m('')},[o]);const f=null!=c,b=f?8:r,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==r||(n(t),setTimeout(()=>m(''),300))},y=f?Math.max(c??4,p.length):r,j=(e,t,n)=>(0,x.jsx)(i.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,x.jsx)(u.T,{size:28,weight:"semibold",children:e})},n);return(0,x.jsxs)(d.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,x.jsx)(u.T,{size:20,weight:"semibold",children:e}),t?(0,x.jsx)(u.Muted,{children:t}):null,(0,x.jsx)(d.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:y},(e,t)=>t).map(e=>(0,x.jsx)(d.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:h.colours.gold,backgroundColor:e(0,x.jsx)(u.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,x.jsxs)(u.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(c??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,x.jsx)(d.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function I({onClose:e,initial:t}){const{width:n}=(0,c.default)(),o=(0,p.useOwner)(e=>e.staff),r=(0,k.useDisplayTiles)(e=>e.tiles),I=(0,k.useDisplayTiles)(e=>e.managers),C=(0,k.useDisplayTiles)(e=>e.lens),P=e=>C[e]?.len??4,v=(0,y.useSync)(e=>'device'===e.kind)||s.PITCH,[B,M]=(0,l.useState)(t??{s:'tiles'}),[$,N]=(0,l.useState)(null),[A,L]=(0,l.useState)(!1),R=(0,l.useRef)(Date.now());(0,l.useEffect)(()=>{(0,k.refreshTiles)(),(0,k.refreshManagers)()},[]),(0,l.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,l.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const Y=(0,l.useMemo)(()=>r??(0,k.localTiles)(o,j()),[r,o]),_=v?I:o.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),E=e=>{N(null),M(e)},F=async(e,t,n,o={})=>{L(!0);const s=await(0,k.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,k.errorText)(s.error));const r=s.at?(0,f.hm)(new Date(s.at)):'';(0,b.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${D[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,k.refreshTiles)(),E({s:'done',text:`${e.name} ${D[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,k.displayClock)(e.ref,t,'status');L(!1),n.ok?E({s:'actions',t:e,pin:t,st:n}):N((0,k.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,x.jsxs)(d.default,{testID:"clock-tiles",style:{gap:12},children:[(0,x.jsx)(u.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,x.jsx)(u.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),Y.length?null:(0,x.jsx)(u.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,x.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:Y.map(t=>(0,x.jsxs)(i.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>E({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?h.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,x.jsx)(u.T,{size:24,weight:"semibold",children:(0,p.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,x.jsxs)(u.Row,{gap:6,wrap:!0,children:[t.dept?(0,x.jsx)(u.Muted,{children:t.dept}):null,t.temp?(0,x.jsx)(u.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,x.jsx)(u.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,x.jsx)(u.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>E({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,x.jsx)(w,{length:P(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,p.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,x.jsxs)(d.default,{testID:"clock-actions",style:{gap:12},children:[(0,x.jsxs)(u.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,f.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,x.jsx)(u.T,{colour:h.colours.amber,children:$}):null,n.clockedIn?null:(0,x.jsx)(u.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void F(e,t,'in'):E({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,x.jsx)(u.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{F(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,x.jsx)(u.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{F(e,t,'break_end')}}):null,n.clockedIn?(0,x.jsx)(u.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void F(e,t,'out'):E({s:'break',t:e,pin:t,worked:o})}):null,(0,x.jsx)(u.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>E({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,x.jsxs)(d.default,{testID:"clock-offrota",style:{gap:12},children:[(0,x.jsx)(u.T,{size:18,children:"Should you be on the rota?"}),(0,x.jsx)(u.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,x.jsx)(u.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{F(t,n,'in',{offRota:!0})}}),(0,x.jsx)(u.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,x.jsxs)(d.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,x.jsx)(u.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,x.jsx)(u.Row,{wrap:!0,gap:6,children:m.DEFAULT_BREAK_OPTIONS.map(o=>(0,x.jsx)(u.Chip,{testID:`forgot-break-${o}`,label:(0,m.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{F(e,t,'out',{breakMins:o})}},o))}),(0,x.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{F(e,t,'out',{breakMins:0})}}),n>360?(0,x.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,x.jsx)(w,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,k.pinProblem)(s,o);return n?void N(n):void E({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,k.displayChangePin)(e.ref,t,s);L(!1),r.ok?E({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,k.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,x.jsxs)(d.default,{testID:"clock-done",style:{gap:12},children:[(0,x.jsx)(u.T,{size:20,weight:"semibold",colour:h.colours.goldLight,children:B.text}),(0,x.jsx)(u.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,x.jsxs)(d.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,x.jsx)(u.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,x.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:_.map(e=>(0,x.jsx)(u.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>E({s:'mgrpin',m:e})},e.ref))}),_.length?null:(0,x.jsx)(u.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,x.jsx)(u.Button,{kind:"secondary",label:"Back",onPress:()=>E({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,x.jsx)(w,{length:P(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>E({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,x.jsx)(S,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,k.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,k.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,k.refreshTiles)(),E({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,x.jsx)(T,{name:B.name,code:B.code,onClose:e}));var W;return(0,x.jsx)(u.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,x.jsx)(d.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function T({name:e,code:t,onClose:n}){return(0,x.jsxs)(d.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,x.jsxs)(u.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,x.jsx)(u.T,{size:48,weight:"bold",colour:h.colours.goldLight,style:{letterSpacing:12},children:t}),(0,x.jsx)(u.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,x.jsx)(u.Button,{label:"Done",onPress:n})]})}const C=['Kitchen','Front of house','Bar'],P=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function S({onSubmit:e,busy:s,error:r,noPay:i}){const[c,p]=(0,l.useState)(''),[m,f]=(0,l.useState)(null),[b,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(''),D=b.trim()?Number(b.replace(/[\xa3,\s]/g,'')):null,w=null!=D&&(!Number.isFinite(D)||D<0||D>200),I=!!y&&(!/^\d{4}-\d{2}-\d{2}$/.test(y)||y(0,x.jsx)(u.Chip,{testID:`temp-dept-${e}`,label:e,selected:m===e,onPress:()=>f(m===e?null:e)},e))}),i?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(u.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,x.jsx)(o.TextInput,{testID:"temp-rate",value:b,onChangeText:k,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:T}),w?(0,x.jsx)(u.T,{colour:h.colours.amber,children:"Check the hourly rate."}):null]}),(0,x.jsx)(u.T,{weight:"semibold",children:"End date (optional)"}),(0,x.jsx)(u.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',P(0)],['In 1 week',P(7)],['In 2 weeks',P(14)]].map(([e,t])=>(0,x.jsx)(u.Chip,{testID:`temp-until-${e}`,label:e,selected:y===t,onPress:()=>j(t)},e))}),(0,x.jsx)(o.TextInput,{testID:"temp-until",accessibilityLabel:"Until (DD/MM/YYYY)",...(0,n.slashBox)(y,j),placeholder:"DD/MM/YYYY",keyboardType:"numbers-and-punctuation",maxLength:10,placeholderTextColor:"#777",style:T}),I?(0,x.jsxs)(u.T,{colour:h.colours.amber,children:["Use a date from today on, like ",P(7),"."]}):null,(0,x.jsx)(u.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),r?(0,x.jsx)(d.default,{testID:"temp-error",children:(0,x.jsx)(u.T,{colour:h.colours.amber,children:r})}):null,(0,x.jsx)(u.Button,{testID:"temp-save",label:"Add and show the code",disabled:s||!c.trim()||w||I,onPress:()=>e({name:c.trim(),dept:m,rate:D,until:y||null})})]})}},1098,[887,833,873,2,1494,31,264,128,288,817,824,861,869,821,1066,1097,823,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return p}}),_e.defaultSimStart=function(e=new Date){const t=new Date(e),r=(5-t.getDay()+7)%7;return t.setDate(t.getDate()+r),t.setHours(17,30,0,0),t},_e.buildSeed=function(u){if(r.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE){const e=I(u);return{...e,restaurants:e.restaurants.filter(e=>'anchorage'===e.id),menu:c.anchorageMenu.map(e=>({...e,signOff:null})),bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:e.events.filter(e=>!e.example),ratings:[],walkIns:{},counters:{order:0,table:0,booking:0},customer:{...e.customer,id:'',referralCode:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}}}}return t.IS_ISOLATED_VENUE?{restaurants:[t.IS_QUEUED_VENUE?(0,e.queuedRestaurant)(t.VENUE_RID):t.IS_ABBOTSFORD?n.ABBOTSFORD_RESTAURANT:t.IS_KIRKTON?n.KIRKTON_RESTAURANT:t.IS_GREENSIDE?n.GREENSIDE_RESTAURANT:t.IS_WILDINGS?n.WILDINGS_RESTAURANT:t.IS_KIRKMICHAEL?n.KIRKMICHAEL_RESTAURANT:s.SOUTERS_RESTAURANT],menu:t.IS_WILDINGS?l.WILDINGS_MENU:t.IS_KIRKMICHAEL?d.KIRKMICHAEL_MENU:t.IS_SOUTERS?i.SOUTERS_MENU:[],customer:{id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}},bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:t.IS_WILDINGS?(0,o.guideCalendarEvents)(o.WILDINGS_GUIDE,'wildings'):t.IS_KIRKMICHAEL?(0,o.guideCalendarEvents)(o.KIRKMICHAEL_GUIDE,'kirkmichael'):t.IS_SOUTERS?(0,o.guideCalendarEvents)(o.SOUTERS_GUIDE,'souters'):[],ratings:[],audit:[],alertAcks:{},walkIns:{},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:0,table:0,booking:0}}:I(u)};var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),s=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),m=_r(_d[11]);const p='cust-demo';function I(e){const t=(0,m.ymd)(e),r=e=>e.toISOString(),s=n.restaurants.map(e=>'anchorage'===e.id?{...e,sections:c.ANCHORAGE_SECTIONS}:e),i={id:p,name:'Alex Morgan',email:'alex.demo@example.com',phone:'07700 900123',allergies:[{allergen:'crustaceans',severity:'anaphylaxis'},{allergen:'mustard',severity:'allergy'}],allergyConsent:!0,referralCode:'ALEX-7K2Q',marketingOptIn:{anchorage:!0}},o=(n,s,i,o,d={})=>({id:n,ref:`BK-${n.slice(-3).toUpperCase()}`,restaurantId:'anchorage',customerId:null,name:s,partySize:i,date:t,time:o,allergies:[],notes:'',status:'confirmed',security:i>=6?'deposit':'none',depositPaid:0,...i>=6?{depositDue:1e3*i}:{},createdAt:r((0,m.addMins)(e,-4320)),...d}),d=[o('bk-101','Campbell',2,'17:00',{table:'12',status:'seated',seatedAt:r((0,m.addMins)(e,-28)),tags:['Regular']}),o('bk-102','Fraser',4,'17:30',{table:'10',tags:['VIP']}),o('bk-103','McLeod',2,'18:00',{table:'11',allergies:[{allergen:'gluten',severity:'coeliac'}],notes:'Anniversary',occasion:'anniversary'}),o('bk-104','Kerr',6,'18:00',{table:'18'}),o('bk-105','Wallace',3,'18:30',{table:'13'}),o('bk-106','Boyd',8,'19:00',{table:'1+2',dog:!0,allergies:[{allergen:'peanuts',severity:'anaphylaxis'}],notes:'Birthday \u2014 bringing a dog',occasion:'birthday'}),o('bk-107','Hamilton',2,'19:00',{table:'5'}),o('bk-108','Stewart',4,'19:30',{table:'19',tags:['Regular']}),o('bk-109','Murray',2,'20:00',{table:'16'})],l=[{id:'wl-1',restaurantId:'anchorage',number:1,name:'Paterson',partySize:2,joinedAt:r((0,m.addMins)(e,-12)),status:'waiting'},{id:'wl-2',restaurantId:'anchorage',number:2,name:'Duncan',partySize:4,joinedAt:r((0,m.addMins)(e,-4)),status:'waiting'}],I=(0,m.atTime)(e,'17:45'),h=[{id:'ord-seed-1',ref:'T-1041',restaurantId:'anchorage',customerId:'cust-other',customerName:'R. Gilmour',type:'takeaway',slotTime:r(I),lines:[{itemId:'a-fishsupper',name:'Fish Supper',qty:2,unitPrice:1800,choices:['Beer-battered'],notes:'',contains:[],may:[],overridden:!1,prepMins:12},{itemId:'a-chips',name:'Triple-Cooked Chips (V)',qty:1,unitPrice:450,choices:[],notes:'Extra salt',contains:[],may:[],overridden:!1,prepMins:6}],subtotal:4050,tip:0,giftCardApplied:0,total:4050,paid:4050,status:'acknowledged',createdAt:r((0,m.addMins)(e,-50)),allergies:[],readiness:{}},{id:'ord-seed-2',ref:'Q-2017',restaurantId:'anchorage',customerId:'cust-other2',customerName:'Table 3 guest',type:'table',tableNo:'3',lines:[{itemId:'a-moules',name:'Moules Marini\xe8re',qty:1,unitPrice:2200,choices:['Main 500g with triple-cooked chips (\xa322.00)'],notes:'',contains:[],may:[],overridden:!1,prepMins:10},{itemId:'a-claymore',name:'The Claymore Burger',qty:1,unitPrice:1800,choices:[],notes:'No gherkins',contains:[],may:[],overridden:!1,prepMins:14}],subtotal:4e3,tip:0,giftCardApplied:0,total:4e3,paid:0,status:'preparing',createdAt:r((0,m.addMins)(e,-18)),allergies:[],readiness:{}}],y=[{restaurantId:'anchorage',customerId:p,stamps:5,rewardsAvailable:0,history:[{at:'2026-08-15',source:'Dine-in (staff scan)'},{at:'2026-08-29',source:'Takeaway'},{at:'2026-09-12',source:'Table QR bill'},{at:'2026-10-02',source:'Takeaway'},{at:'2026-10-16',source:'Referral \u2014 friend\u2019s first visit'}]},{restaurantId:'saltmarsh',customerId:p,stamps:2,rewardsAvailable:0,history:[{at:'2026-09-01',source:'Dine-in'},{at:'2026-10-01',source:'Dine-in'}]}],b=[{id:'gc-1',code:'ANC-G7QX-4M2P-9TRE',restaurantId:'anchorage',initial:5e3,balance:2500,ownerId:p,recipientName:'Alex',message:'Happy birthday! (example)',createdAt:'2026-09-20'},{id:'gc-2',code:'WEB-OLD-10-EXAMPLE',restaurantId:'anchorage',initial:1e3,balance:1e3,ownerId:'legacy',recipientName:'Legacy website bookings voucher (example)',message:'',createdAt:'2026-06-01',legacy:!0}],E=[...u.SCOTTISH_BANK_HOLIDAYS.map((e,t)=>({id:`bh-${t}`,restaurantId:null,date:e.date,title:e.title+(e.notes&&!/substitute/i.test(e.notes)?` (${e.notes.toLowerCase()})`:''),kind:'bank-holiday',description:'Scottish bank holiday',example:!1,source:u.BANK_HOLIDAY_SOURCE})),{id:'ev-halloween',restaurantId:'anchorage',date:(0,m.ymd)(new Date(e.getFullYear(),9,31)),title:'Halloween weekend (example)',kind:'event',description:'Example event \u2014 busy weekend flag for the forecast.',example:!0},{id:'ev-xmas-party',restaurantId:'anchorage',date:'2026-12-04',title:'Christmas party nights begin (example)',kind:'event',description:'Example: festive set menu, deposit required for parties of 8+.',example:!0},{id:'ev-hogmanay',restaurantId:null,date:'2026-12-31',title:'Hogmanay',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-burns',restaurantId:'anchorage',date:'2027-01-25',title:'Burns Night Supper (example)',kind:'event',description:'EXAMPLE event: haggis, neeps & tatties, address to the haggis, set menu \xa348pp. Booking opens via the app.',example:!0},{id:'ev-valentines',restaurantId:null,date:'2027-02-14',title:"Valentine's Day",kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-mothering',restaurantId:null,date:'2027-03-07',title:'Mothering Sunday (UK)',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-live',restaurantId:'anchorage',date:'2026-11-14',title:'Live acoustic music (example)',kind:'event',description:'EXAMPLE: local folk duo from 7pm.',example:!0},{id:'ev-school-xmas',restaurantId:null,date:'2026-12-23',title:'South Ayrshire schools close for Christmas',kind:'school-holiday',description:'23 Dec 2026 \u2013 4 Jan 2027',example:!1},{id:'ev-salt-quiz',restaurantId:'saltmarsh',date:'2026-11-05',title:'Quiz night (fictional)',kind:'event',description:'Fictional demo restaurant event.',example:!0}];return{restaurants:s,menu:[...c.anchorageMenu,...n.demoMenus],customer:i,bookings:d,waitlist:l,orders:h,stampCards:y,giftCards:b,events:E,ratings:[{id:'rt-1',restaurantId:'anchorage',customerId:'cust-x1',customerName:'Fiona (example)',stars:5,comment:'Best fish supper on the coast, and the staff were brilliant with my son\u2019s nut allergy.',createdAt:r((0,m.addMins)(e,-1560)),context:'Takeaway T-1032'},{id:'rt-2',restaurantId:'anchorage',customerId:'cust-x2',customerName:'Iain (example)',stars:4,comment:'Lovely langoustines. Bit of a wait for a table at 7.',createdAt:r((0,m.addMins)(e,-3e3)),context:'Dine-in, Table 6'},{id:'rt-3',restaurantId:'anchorage',customerId:'cust-x3',customerName:'Morag (example)',stars:2,comment:'Chips were cold by the time we collected.',createdAt:r((0,m.addMins)(e,-4320)),context:'Takeaway T-1019'}],audit:[],alertAcks:{},walkIns:{anchorage:6},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:1042,table:2018,booking:110}}}},1099,[6,5,842,3,1230,1231,1232,1233,1234,1235,1236,821]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1100,[1080,1072,1081]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1101,[878,861,5]); +__d(function(_g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normaliseHex=n,e.hexToRgb=r,e.rgbToHex=o,e.hsvToRgb=s,Object.defineProperty(e,"hsvToHex",{enumerable:!0,get:function(){return a}}),e.hexToHsv=function(t){const{r:n,g:o,b:s}=r(t),a=n/255,c=o/255,u=s/255,i=Math.max(a,c,u),h=Math.min(a,c,u),l=i-h;let p=0;l&&(p=i===a?(c-u)/l%6:i===c?(u-a)/l+2:(a-c)/l+4);return{h:(60*p+360)%360,s:i?l/i:0,v:i}},e.luminance=c,e.contrast=u,e.shade=i,e.checkAccent=function(t,r,o,s){const a=n(t)??'#CFA45F',c=u(a,o),h=u(a,s),l=c>=h?o:s,p=[];Math.max(c,h)<4.5?p.push('Button text may be hard to read on this colour. We picked the clearer text colour for you, but a lighter or darker shade will read better.'):l===s&&p.push('This is a dark colour, so buttons use light text.');let b=a,d=0;for(;u(b,r)<4.5&&d<20;)b=i(a,.05*(d+1)),d++;b!==a&&p.push('This colour is hard to read on the dark background, so header text uses a lighter shade of it.');return{onAccent:l,accentText:b,tips:p}},e.pushRecent=function(t,r,o=8){const s=n(r);return s?[s,...(t??[]).filter(t=>t!==s)].slice(0,o):t??[]};const t=(t,n=0,r=1)=>Math.min(r,Math.max(n,t));function n(t){const n=t.trim().replace(/^#/,'');return/^[0-9a-fA-F]{3}$/.test(n)?'#'+n.split('').map(t=>t+t).join('').toUpperCase():/^[0-9a-fA-F]{6}$/.test(n)?'#'+n.toUpperCase():null}function r(t){const r=(n(t)??'#000000').slice(1);return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}}function o({r:n,g:r,b:o}){return'#'+[n,r,o].map(n=>Math.round(t(n,0,255)).toString(16).padStart(2,'0')).join('').toUpperCase()}function s({h:t,s:n,v:r}){const o=(t%360+360)%360/60,s=r*n,a=s*(1-Math.abs(o%2-1)),c=r-s,[u,i,h]=o<1?[s,a,0]:o<2?[a,s,0]:o<3?[0,s,a]:o<4?[0,a,s]:o<5?[a,0,s]:[s,0,a];return{r:255*(u+c),g:255*(i+c),b:255*(h+c)}}const a=t=>o(s(t));function c(t){const n=t=>{const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)},{r:o,g:s,b:a}=r(t);return.2126*n(o)+.7152*n(s)+.0722*n(a)}function u(t,n){const r=c(t),o=c(n);return(Math.max(r,o)+.05)/(Math.min(r,o)+.05)}function i(t,n){const{r:s,g:a,b:c}=r(t),u=n>0?255:0,i=Math.abs(n);return o({r:s+(u-s)*i,g:a+(u-a)*i,b:c+(u-c)*i})}},1102,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtDate",{enumerable:!0,get:function(){return j}}),_e.SignOffLine=$,_e.CardView=P,_e.CardEditor=R,_e.RecipeCards=function({rid:e,actor:s,mode:l}){const h=(0,a.useRecipeCards)(e),u=(0,n.useMemo)(()=>h.filter(e=>!c.OFF_CARD_LIST.has(e.menuItemId)),[h]),[p,x]=(0,n.useState)(''),[b,j]=(0,n.useState)([]),[C,w]=(0,n.useState)('free-from'),[I,$]=(0,n.useState)('all'),[D,T]=(0,n.useState)(null),[k,S]=(0,n.useState)(null),v='edit'===l&&(0,m.canEditCards)(s.role),B=v?u:u.filter(e=>!!e.signOff),L=(0,n.useMemo)(()=>{const e='all'===I?B:B.filter(e=>(0,m.cardState)(e)===I);return(0,m.filterCards)(e,p,b,C).slice().sort((e,t)=>e.section.localeCompare(t.section)||M(e.dish).localeCompare(M(t.dish)))},[B,p,b,C,I]),O=u.filter(e=>!e.signOff).length,A=D?u.find(e=>e.id===D):void 0,N=k&&'new'!==k?u.find(e=>e.id===k)??null:null,z=e=>j(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,y.jsxs)(r.default,{testID:"recipe-cards",style:{gap:12},children:['read'===l?(0,y.jsx)(d.Banner,{kind:"info",title:"Read-only",children:"Signed-off recipe cards only. The head chef keeps these up to date."}):(0,y.jsx)(d.Muted,{center:!0,children:(0,m.maySignOff)(s,{createdBy:s.name,createdByRole:s.role})?'You can add, edit and sign off cards. A card goes live once it is signed off. Editing a card clears the sign-off.':'You can add and edit cards. The Head Chef, an owner or a manager signs it off before it goes live. Editing a card clears the sign-off.'}),u.some(e=>'example'===e.origin)?(0,y.jsx)(d.Banner,{kind:"example",title:"Example data",children:"Cards marked \u201cExample data\u201d are made-up examples to show how recipe cards work. Replace them with your own dishes."}):null,v?(0,y.jsx)(d.Button,{testID:"new-card",label:"New recipe card",onPress:()=>S('new')}):null,(0,y.jsx)(t.TextInput,{testID:"card-search",accessibilityLabel:"Search recipe cards",value:p,onChangeText:x,placeholder:"Search dishes or ingredients",placeholderTextColor:"#7D776C",style:d.styles.input}),(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.T,{size:o.font.small,colour:o.colours.muted,children:"Allergens:"}),(0,y.jsx)(d.Chip,{label:"Free from",selected:'free-from'===C,onPress:()=>w('free-from')}),(0,y.jsx)(d.Chip,{label:"Contains",selected:'contains'===C,onPress:()=>w('contains')}),b.length?(0,y.jsx)(d.Chip,{label:"Clear",onPress:()=>j([])}):null]}),(0,y.jsx)(d.Row,{gap:6,wrap:!0,children:f.ALLERGENS.map(e=>(0,y.jsx)(i.default,{testID:`filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:b.includes(e.id)},onPress:()=>z(e.id),style:{paddingVertical:5,paddingHorizontal:10,minHeight:44,minWidth:44,justifyContent:'center',borderRadius:14,borderWidth:1,borderColor:b.includes(e.id)?o.colours.gold:o.colours.border,backgroundColor:b.includes(e.id)?o.colours.gold:'transparent'},children:(0,y.jsx)(d.T,{size:13,colour:b.includes(e.id)?o.colours.onGold:o.colours.text,children:e.short})},e.id))}),v?(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.Chip,{label:`All (${u.length})`,selected:'all'===I,onPress:()=>$('all')}),(0,y.jsx)(d.Chip,{label:`Awaiting sign-off (${O})`,selected:'awaiting'===I,onPress:()=>$('awaiting')}),(0,y.jsx)(d.Chip,{label:`Signed off (${u.length-O})`,selected:'signed-off'===I,onPress:()=>$('signed-off')})]}):null,(0,y.jsx)(r.default,{testID:"card-count",children:(0,y.jsxs)(d.Muted,{center:!0,children:[L.length," ",1===L.length?'card':'cards',b.length?` ${'free-from'===C?'free from':'containing'} ${b.map(f.allergenLabel).join('free-from'===C?' and ':' or ')}`:'']})}),L.map(e=>(0,y.jsx)(E,{c:e,actor:s,mode:l,editable:v,onPress:()=>T(e.id)},e.id)),L.length?null:(0,y.jsx)(r.default,{testID:"cards-empty",style:{alignItems:'center',paddingVertical:16},children:(0,y.jsx)(d.T,{center:!0,colour:o.colours.muted,children:u.length?'No cards match.':'No recipe cards yet.'})}),(0,y.jsx)(d.Sheet,{visible:!!A&&!k,onClose:()=>T(null),title:A?.dish??'',maxWidth:640,testID:"card-sheet",children:A?(0,y.jsx)(P,{card:A,mode:l,actor:'read'===l?{...s,role:'staff'}:s,onEdit:v?()=>S(A.id):void 0}):null}),(0,y.jsx)(d.Sheet,{visible:!!k,onClose:()=>S(null),title:'new'===k?'New recipe card':`Edit: ${N?.dish??''}`,maxWidth:680,testID:"editor-sheet",children:k?(0,y.jsx)(R,{rid:e,card:N,actor:s,onDone:e=>{S(null),T(e)}},k):null})]})},Object.defineProperty(_e,"addedLabel",{enumerable:!0,get:function(){return m.addedLabel}}),Object.defineProperty(_e,"allergenSentence",{enumerable:!0,get:function(){return m.allergenSentence}}),Object.defineProperty(_e,"unsignedOldestFirst",{enumerable:!0,get:function(){return m.unsignedOldestFirst}}),_e.useUnsignedDishes=O,_e.UnsignedDishList=function({rid:e,actor:t,onClose:s,onOpenCards:l}){const i=O(e),c=(0,a.useRecipeCards)(e),[f,p]=(0,n.useState)(null),[x,b]=(0,n.useState)(null),[j,C]=(0,n.useState)(null);(0,h.useBackLayer)(!0,s);const w=x?c.find(e=>e.id===x):void 0,I=j?c.find(e=>e.id===j)??null:null,$=async e=>{try{await(0,u.recipeCards)().signOff(e.id,t),p(null)}catch(t){p({id:e.id,text:t?.message??'Could not sign off.'})}};return(0,y.jsxs)(r.default,{testID:"unsigned-list",style:{gap:12,alignItems:'stretch'},children:[(0,y.jsx)(h.BackButton,{onPress:s,testID:"unsigned-back"}),(0,y.jsx)(d.T,{center:!0,size:22,weight:"bold",colour:o.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Dishes not signed off"}),(0,y.jsx)(d.Muted,{center:!0,testID:"unsigned-status",children:i.length?`${i.length} ${1===i.length?'dish':'dishes'} waiting, oldest first.`:'Every dish is signed off.'}),i.map(({item:e,card:s,at:n})=>{const i=(0,m.allergenSentence)(s?s.allergens:e.allergens),a=!!s&&(0,m.maySignOff)(t,s),c=s?(0,m.signOffBlock)(s):null;return(0,y.jsxs)(d.Card,{highlight:o.colours.amber,style:{alignItems:'center',gap:8},children:[(0,y.jsxs)(r.default,{testID:`unsigned-row-${e.id}`,accessible:!0,accessibilityLabel:`${e.name}, ${(0,m.addedLabel)(n)}, ${i}`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,y.jsx)(d.T,{center:!0,weight:"bold",size:18,children:e.name}),(0,y.jsx)(d.T,{center:!0,children:(0,m.addedLabel)(n)}),(0,y.jsx)(d.Muted,{center:!0,children:i})]}),s&&a&&!c?(0,y.jsx)(d.Button,{testID:`unsigned-sign-${e.id}`,kind:"success",label:"Sign off",accessibilityLabel:`Sign off ${e.name} as ${t.name}`,onPress:()=>$(s),style:{alignSelf:'stretch'}}):null,s&&a&&c?(0,y.jsx)(d.Muted,{center:!0,children:c}):null,s&&!a?(0,y.jsx)(d.Muted,{center:!0,children:"Only the Head Chef, an owner or a manager can sign it off."}):null,s?(0,y.jsx)(d.Button,{small:!0,kind:"secondary",testID:`unsigned-open-${e.id}`,label:a&&c?'Check the recipe card':'Open recipe card',accessibilityLabel:`Open the recipe card for ${e.name}`,onPress:()=>b(s.id),style:{alignSelf:'stretch'}}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d.Muted,{center:!0,children:"No recipe card yet."}),l?(0,y.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open recipe cards",onPress:l,style:{alignSelf:'stretch'}}):null]}),f&&s&&f.id===s.id?(0,y.jsx)(d.Banner,{kind:"danger",children:f.text}):null]},e.id)}),(0,y.jsx)(d.Sheet,{visible:!!w&&!j,onClose:()=>b(null),title:w?.dish??'',maxWidth:640,testID:"unsigned-card-sheet",children:w?(0,y.jsx)(P,{card:w,actor:t,onEdit:(0,m.canEditCards)(t.role)?()=>C(w.id):void 0}):null}),(0,y.jsx)(d.Sheet,{visible:!!j,onClose:()=>C(null),title:`Edit: ${I?.dish??''}`,maxWidth:680,testID:"unsigned-editor-sheet",children:j&&I?(0,y.jsx)(R,{rid:e,card:I,actor:t,onDone:e=>{C(null),b(e)}},j):null})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),l=e(_r(_d[3])),i=e(_r(_d[4])),r=e(_r(_d[5])),o=_r(_d[6]),d=_r(_d[7]),a=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]);const j=e=>{const t=new Date(e.length<=10?`${e}T12:00:00`:e);return isNaN(+t)?e:t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})},C=e=>`\xa3${(Math.round(e)/100).toFixed(2)}`,w=e=>null==e?'Price on the board':C(e),I={example:p.EXAMPLE_TAG,imported:'Imported from the menu',new:null};function $({card:e,testID:t}){return e.signOff?(0,y.jsx)(r.default,{testID:t??'card-signed-off',accessibilityLabel:`Signed off by ${e.signOff.by}, ${j(e.signOff.at)}`,style:{alignItems:'center',gap:4,width:'100%'},children:(0,y.jsxs)(d.T,{center:!0,weight:"bold",colour:o.colours.gold,children:["Signed off by ",e.signOff.by,", ",j(e.signOff.at)]})}):(0,y.jsxs)(r.default,{testID:t??'card-signed-off',accessibilityLabel:"Not signed off yet",style:{alignItems:'center',gap:4,width:'100%'},children:[(0,y.jsx)(d.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:m.STATE_LABEL.awaiting}),(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,children:c.portionCardItemIds.includes(e.menuItemId)?'A portion card for the kitchen. The dish on the menu is not changed by this card.':e.wasLive?'Edited since the last sign-off. Guests see it as awaiting sign-off until a chef signs it again.':'This dish stays off the menu until a chef signs it off.'})]})}function D({dish:e,photo:t,height:s=180,pending:n,index:i,total:a,radius:c=12}){const h=n?{uri:n}:t?(0,u.recipeCards)().photoSource(t):null,f=i&&a?`Photo ${i} of ${a}`:'Plating photo';return h?(0,y.jsx)(l.default,{testID:i?`card-photo-${i}`:'card-photo',accessibilityLabel:`${f}${e?`: ${e}`:''}`,source:h,style:{width:'100%',height:s,borderRadius:c,backgroundColor:o.colours.surface2},resizeMode:"cover"}):(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:"No plating photo yet"+(e?`, ${e}`:''),style:{width:'100%',height:s,borderRadius:c,backgroundColor:o.colours.goldTint,alignItems:'center',justifyContent:'center',borderWidth:1.5,borderColor:o.colours.gold,gap:2},children:[(0,y.jsx)(d.T,{center:!0,size:Math.min(64,Math.max(30,Math.round(.38*s))),weight:"bold",colour:o.colours.gold,children:(e.trim()[0]??'?').toUpperCase()}),s>=120?(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:o.colours.goldLight,children:"No plating photo yet"}):null]})}function T({map:e}){const t=f.ALLERGENS.filter(t=>e[t.id]).map(e=>e.id);return t.length?(0,y.jsx)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:t.map(t=>{const s='may'===e[t],n=s?`May contain ${(0,f.allergenLabel)(t).toLowerCase()}`:(0,f.allergenLabel)(t);return(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:s?n:`Contains ${(0,f.allergenLabel)(t).toLowerCase()}`,style:{paddingHorizontal:12,paddingVertical:6,borderRadius:999,borderWidth:1.5,borderColor:s?o.colours.amber:o.colours.gold,backgroundColor:s?'transparent':o.colours.gold,maxWidth:'100%'},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"semibold",center:!0,colour:s?o.colours.amber:o.colours.onGold,children:n})},t)})}):(0,y.jsx)(d.Muted,{center:!0,children:"None of the UK 14 allergens."})}const k=({label:e,gold:t,testID:s})=>(0,y.jsx)(r.default,{testID:s,style:{paddingHorizontal:12,paddingVertical:5,borderRadius:999,borderWidth:1,borderColor:t?o.colours.gold:o.colours.accentBorder,backgroundColor:t?o.colours.goldTint:o.colours.surface,maxWidth:'100%'},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"medium",center:!0,colour:t?o.colours.goldLight:o.colours.text,children:e})}),S=({title:e})=>(0,y.jsxs)(r.default,{style:{width:'100%',alignItems:'center',gap:4,paddingTop:4},children:[(0,y.jsx)(d.T,{size:13,weight:"semibold",center:!0,colour:o.colours.goldMuted,accessibilityRole:"header",children:e.toUpperCase()}),(0,y.jsx)(r.default,{style:{width:36,height:2,borderRadius:1,backgroundColor:o.colours.gold}})]});function P({card:e,actor:t,onEdit:s,mode:l="edit"}){const[i,a]=(0,n.useState)(null),c=(0,m.signOffBlock)(e),h=I[e.origin],f=(0,m.cardPhotos)(e),p=(0,m.maySignOff)(t,e),x=(0,b.useCardCosting)(e,t.role,l);return(0,y.jsxs)(r.default,{testID:"card-view",style:{gap:12,alignItems:'center',width:'100%'},children:[f.length?(0,y.jsx)(D,{dish:e.dish,photo:f[0],height:220,index:1,total:f.length,radius:18}):(0,y.jsx)(D,{dish:e.dish,height:180,radius:18}),f.length>1?(0,y.jsx)(d.Row,{gap:8,style:{width:'100%'},children:f.slice(1).map((t,s)=>(0,y.jsx)(r.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(D,{dish:e.dish,photo:t,height:72,index:s+2,total:f.length})},t))}):null,(0,y.jsx)(d.T,{center:!0,size:26,weight:"bold",colour:o.colours.gold,accessibilityRole:"header",children:e.dish}),(0,y.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[h?(0,y.jsx)(d.Badge,{label:h,kind:'example'===e.origin?'blue':'neutral'}):null,(0,y.jsx)(k,{label:e.section,gold:!0}),(0,y.jsx)(k,{label:w(e.price)}),x&&x.summary.lines.length?(0,y.jsx)(k,{testID:"card-yield",label:x.summary.batch/Math.max(1,x.summary.perPortion||1)>1.5?`Makes ${Math.round(x.summary.batch/x.summary.perPortion)} portions`:'1 portion'}):null]}),(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:`Created by ${e.createdBy||'not recorded'}`,style:{width:'100%',alignItems:'center'},children:(0,y.jsxs)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,testID:"card-created-by",children:["Created by ",e.createdBy||'Not recorded']})}),(0,y.jsx)(r.default,{style:{width:'100%',paddingVertical:8,paddingHorizontal:10,borderRadius:14,borderWidth:1,borderColor:e.signOff?o.colours.accentBorder:o.colours.amber,backgroundColor:e.signOff?o.colours.accentBg:o.colours.amberBg},children:(0,y.jsx)($,{card:e,testID:"card-status"})}),(0,y.jsx)(S,{title:"Allergens"}),(0,y.jsx)(r.default,{testID:"card-allergens",style:{width:'100%'},children:(0,y.jsx)(T,{map:e.allergens})}),e.allergenNotes?(0,y.jsx)(d.Muted,{center:!0,children:e.allergenNotes}):null,e.allergensConfirmed?(0,y.jsxs)(d.Muted,{center:!0,children:["Allergen list confirmed by ",e.allergensConfirmed.by," on ",j(e.allergensConfirmed.at),"."]}):null,(0,y.jsx)(S,{title:"Ingredients"}),e.ingredients.length?(0,y.jsx)(r.default,{testID:"card-ingredients",style:{width:'100%',borderRadius:14,borderWidth:1,borderColor:o.colours.border,backgroundColor:o.colours.surface,overflow:'hidden'},children:e.ingredients.map((e,t)=>{const s=[e.qty,e.unit].filter(Boolean).join(' '),n=x?.byRecipeIng[e.id];return(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}${s?`, ${s}`:''}${n?`, ${C(n.cost)}`:''}`,style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:10,paddingHorizontal:12,borderTopWidth:t?1:0,borderColor:o.colours.border,minHeight:48},children:[(0,y.jsx)(d.T,{style:{flex:1,minWidth:0},children:e.name}),(0,y.jsxs)(r.default,{style:{alignItems:'flex-end',flexShrink:0,maxWidth:'40%'},children:[(0,y.jsx)(d.T,{weight:"semibold",colour:o.colours.goldLight,style:{textAlign:'right'},children:s||'\u2013'}),n?(0,y.jsx)(d.T,{size:o.font.small,colour:o.colours.muted,style:{textAlign:'right'},children:C(n.cost)}):null]})]},e.id)})}):(0,y.jsx)(d.Muted,{center:!0,children:"No ingredients on this card yet."}),(0,y.jsx)(S,{title:"Method"}),e.steps.length?(0,y.jsx)(r.default,{testID:"card-method",style:{width:'100%',gap:10},children:e.steps.map((e,t)=>(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`Step ${t+1}. ${e}`,style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,y.jsx)(r.default,{style:{width:32,height:32,borderRadius:16,borderWidth:1.5,borderColor:o.colours.gold,backgroundColor:o.colours.goldTint,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"bold",colour:o.colours.gold,children:t+1})}),(0,y.jsx)(d.T,{style:{flex:1,minWidth:0,paddingTop:4},children:e})]},t))}):(0,y.jsxs)(d.Muted,{center:!0,children:["No method yet.",(0,m.canEditCards)(t.role)?' Tap Edit to add the steps.':'']}),(0,y.jsx)(b.CardGpPanel,{card:e,actor:t,mode:l}),(0,y.jsxs)(d.Muted,{center:!0,children:["Version ",e.version," \xb7 last changed ",j(e.updatedAt)," by ",e.updatedBy]}),(0,m.canEditCards)(t.role)&&s?(0,y.jsx)(d.Button,{testID:"edit-card",kind:"secondary",label:"Edit card",accessibilityLabel:`Edit ${e.dish}`,onPress:s,style:{alignSelf:'stretch'}}):null,p&&!e.signOff?(0,y.jsxs)(r.default,{style:{gap:6,width:'100%'},children:[c?(0,y.jsx)(d.Banner,{kind:"warn",title:"Not ready to sign off",children:c}):null,(0,y.jsx)(d.Button,{testID:"sign-off",kind:"success",label:`Sign off as ${t.name}`,accessibilityLabel:`Sign off ${e.dish} as ${t.name}`,disabled:!!c,onPress:async()=>{try{await(0,u.recipeCards)().signOff(e.id,t),a(null)}catch(e){a(e?.message??'Could not sign off.')}}})]}):null,!(0,m.canEditCards)(t.role)||p||e.signOff?null:(0,y.jsx)(d.Banner,{kind:"info",title:"Sign-off",children:"Only the Head Chef, an owner or a manager can sign it off."}),i?(0,y.jsx)(d.Banner,{kind:"danger",children:i}):null]})}const v=()=>`i-${Math.random().toString(36).slice(2,9)}`,B=(e,t,s)=>e?{id:e.id,dish:e.dish,section:e.section,price:null==e.price?'':(e.price/100).toFixed(2),description:'',createdBy:e.createdBy??'',ingredients:e.ingredients.map(e=>({...e})),steps:[...e.steps],allergens:{...e.allergens},dismissed:[...e.dismissed],allergenNotes:e.allergenNotes??'',photos:(0,m.cardPhotos)(e),pending:[],confirm:!!e.allergensConfirmed}:{id:(0,m.uuid)(),dish:'',section:t,price:'',description:'',createdBy:s,ingredients:[{id:v(),name:'',qty:'',unit:''}],steps:[''],allergens:{},dismissed:[],allergenNotes:'',photos:[],pending:[],confirm:!1},L=e=>{const t=e.replace(/[\xa3\s]/g,'');if(!t)return null;const s=Number(t);return isFinite(s)&&s>=0?Math.round(100*s):'bad'};function R({rid:e,card:l,actor:c,onDone:h}){const p=(0,a.useRestaurant)(e),b=p?.sections??['Mains'],[j,C]=(0,n.useState)(()=>B(l,b[0]??'Mains',c.name)),[w,I]=(0,n.useState)(null),[$,T]=(0,n.useState)(null),[k,S]=(0,n.useState)(!1),P=e=>C(t=>({...t,...e})),R=j.ingredients.filter(e=>e.name.trim()),M={ingredients:R,allergens:j.allergens,dismissed:j.dismissed},O=(0,m.suggestAllergens)(R),E=(0,m.unresolved)(M),A=e=>{const t=j.allergens[e],s={...j.allergens};t?'contains'===t?s[e]='may':delete s[e]:s[e]='contains',P({allergens:s,dismissed:j.dismissed.filter(t=>t!==e),confirm:!1})},N=e=>{const t={...j.allergens};delete t[e],P({allergens:t,dismissed:[...new Set([...j.dismissed,e])],confirm:!1})},z=(e,t)=>P({ingredients:j.ingredients.map((s,n)=>n===e?{...s,...t}:s),confirm:!1}),W=(e,t)=>P({steps:j.steps.map((s,n)=>n===e?t:s)}),H=(e,t)=>{const s=[...j.steps],n=e+t;n<0||n>=s.length||([s[e],s[n]]=[s[n],s[e]],P({steps:s}))},_=j.photos.length+j.pending.length,F=async e=>{if(T(null),_>=m.MAX_RECIPE_PHOTOS)T('A card can hold 5 photos.');else try{const t=await(0,x.capturePlatingPhoto)(e);t&&(P({pending:[...j.pending,t]}),T(`Photo ${_+1} of ${m.MAX_RECIPE_PHOTOS}. Compressed on this device: ${t.width}\xd7${t.height}, ${(0,x.kb)(t.bytes)}${t.originalBytes?` (was ${(0,x.kb)(t.originalBytes)})`:''}.`))}catch(e){T(e?.message??'Could not read that photo.')}},[G,V]=(0,n.useState)(!1),U=j.dish||l?.dish||'this dish';return(0,y.jsxs)(r.default,{testID:"card-editor",style:{gap:12},children:[l?.signOff?(0,y.jsx)(d.Banner,{kind:"warn",title:"Saving a change clears the sign-off",children:"This card is signed off. Any change you save clears it until the Head Chef, an owner or a manager signs it off again."}):null,(0,y.jsx)(d.Field,{testID:"dish-name",label:"Dish name",value:j.dish,onChangeText:e=>P({dish:e}),placeholder:"e.g. Cullen skink"}),(0,y.jsx)(d.Field,{testID:"card-created-by-field",label:"Created by",value:j.createdBy,onChangeText:e=>P({createdBy:e}),placeholder:"Chef's name"}),l?null:(0,y.jsx)(d.Field,{testID:"dish-description",label:"Menu description (optional)",value:j.description,onChangeText:e=>P({description:e}),placeholder:"What guests read on the menu"}),(0,y.jsx)(d.T,{size:o.font.small,weight:"medium",colour:o.colours.muted,children:"Menu section"}),(0,y.jsx)(d.Row,{wrap:!0,gap:6,children:b.map(e=>(0,y.jsx)(d.Chip,{label:e,selected:j.section===e,onPress:()=>P({section:e})},e))}),(0,y.jsx)(d.Field,{testID:"dish-price",label:"Price (\xa3)",value:j.price,onChangeText:e=>P({price:e}),placeholder:"Blank = price on the board",keyboardType:"decimal-pad"}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Photos"}),(0,y.jsx)(d.T,{center:!0,colour:o.colours.muted,children:"Up to 5 photos."}),(0,y.jsxs)(r.default,{testID:"card-photos",style:{gap:10,width:'100%',alignItems:'center'},children:[j.photos.map((e,t)=>(0,y.jsxs)(r.default,{style:{width:'100%',gap:6,alignItems:'center'},children:[(0,y.jsx)(D,{dish:U,photo:e,height:160,index:t+1,total:_||j.photos.length}),(0,y.jsx)(d.Button,{testID:`photo-remove-${t+1}`,kind:"ghost",label:`Remove photo ${t+1}`,accessibilityLabel:`Remove photo ${t+1} of ${U}`,onPress:()=>P({photos:j.photos.filter((e,s)=>s!==t)})})]},e)),j.pending.map((e,t)=>(0,y.jsxs)(r.default,{style:{width:'100%',gap:6,alignItems:'center'},children:[(0,y.jsx)(D,{dish:U,pending:e.dataUrl,height:160,index:j.photos.length+t+1,total:_}),(0,y.jsx)(d.Button,{testID:`photo-remove-new-${t+1}`,kind:"ghost",label:`Remove photo ${j.photos.length+t+1}`,accessibilityLabel:`Remove new photo ${j.photos.length+t+1}`,onPress:()=>P({pending:j.pending.filter((e,s)=>s!==t)})})]},`new-${t}`)),_?null:(0,y.jsx)(D,{dish:U,height:160})]}),(0,y.jsx)(d.Button,{testID:"photo-camera",kind:"secondary",label:"Take photo",accessibilityLabel:"Take a photo for this recipe card",disabled:_>=m.MAX_RECIPE_PHOTOS,onPress:()=>F('camera')}),(0,y.jsx)(d.Button,{testID:"photo-library",kind:"secondary",label:"Choose photo",accessibilityLabel:"Choose a photo for this recipe card",disabled:_>=m.MAX_RECIPE_PHOTOS,onPress:()=>F('library')}),$?(0,y.jsx)(r.default,{testID:"photo-info",children:(0,y.jsx)(d.Muted,{center:!0,children:$})}):(0,y.jsx)(d.Muted,{center:!0,children:'shared'===(0,u.recipeCards)().mode?'Photos are shrunk on this device, then shared with the team. Staff and guests only see them once the card is signed off.':'Photos are shrunk on this device before they are saved.'}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Ingredients"}),(0,y.jsx)(d.Muted,{children:"Quantity, unit and ingredient. We suggest allergens from the ingredient names."}),j.ingredients.map((e,n)=>{const l=e.name.trim()?(0,m.suggestAllergens)([e]):[];return(0,y.jsxs)(r.default,{style:{gap:4},children:[(0,y.jsxs)(d.Row,{gap:6,children:[(0,y.jsx)(t.TextInput,{testID:`ing-qty-${n}`,accessibilityLabel:`Quantity ${n+1}`,value:e.qty,onChangeText:e=>z(n,{qty:e}),placeholder:"Qty",placeholderTextColor:"#7D776C",style:[d.styles.input,{width:64}]}),(0,y.jsx)(t.TextInput,{testID:`ing-unit-${n}`,accessibilityLabel:`Unit ${n+1}`,value:e.unit,onChangeText:e=>z(n,{unit:e}),placeholder:"g / ml / each",placeholderTextColor:"#7D776C",style:[d.styles.input,{width:92}]}),(0,y.jsx)(t.TextInput,{testID:`ing-name-${n}`,accessibilityLabel:`Ingredient ${n+1}`,value:e.name,onChangeText:e=>z(n,{name:e}),placeholder:"Ingredient",placeholderTextColor:"#7D776C",style:[d.styles.input,{flex:1}]}),(0,y.jsx)(s.GoldClose,{size:"sm",label:`Remove ingredient ${n+1}`,onPress:()=>P({ingredients:j.ingredients.filter((e,t)=>t!==n)})})]}),l.length?(0,y.jsxs)(d.Muted,{children:["Suggests: ",l.map(f.allergenLabel).join(', ')]}):null]},e.id)}),(0,y.jsx)(d.Button,{testID:"ing-add",small:!0,kind:"ghost",label:"Add ingredient",onPress:()=>P({ingredients:[...j.ingredients,{id:v(),name:'',qty:'',unit:''}]})}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Method"}),j.steps.map((e,n)=>(0,y.jsxs)(d.Row,{gap:6,style:{alignItems:'flex-start'},children:[(0,y.jsx)(d.T,{colour:o.colours.gold,style:{width:20,paddingTop:10},children:n+1}),(0,y.jsx)(t.TextInput,{testID:`step-${n}`,accessibilityLabel:`Step ${n+1}`,value:e,onChangeText:e=>W(n,e),multiline:!0,placeholder:"Describe this step",placeholderTextColor:"#7D776C",style:[d.styles.input,{flex:1,minHeight:56,textAlignVertical:'top'}]}),(0,y.jsxs)(r.default,{style:{gap:4},children:[(0,y.jsx)(i.default,{accessibilityLabel:`Move step ${n+1} up`,onPress:()=>H(n,-1),hitSlop:6,children:(0,y.jsx)(d.T,{colour:o.colours.muted,children:"\u25b2"})}),(0,y.jsx)(i.default,{accessibilityLabel:`Move step ${n+1} down`,onPress:()=>H(n,1),hitSlop:6,children:(0,y.jsx)(d.T,{colour:o.colours.muted,children:"\u25bc"})}),(0,y.jsx)(s.GoldClose,{size:"sm",label:`Remove step ${n+1}`,onPress:()=>P({steps:j.steps.filter((e,t)=>t!==n)})})]})]},n)),(0,y.jsx)(d.Button,{testID:"step-add",small:!0,kind:"ghost",label:"Add step",onPress:()=>P({steps:[...j.steps,'']})}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Allergens (UK 14)"}),(0,y.jsx)(d.Muted,{children:"Tap to cycle: contains \u2192 may contain \u2192 none. Suggested allergens are marked \u201c?\u201d until you add or rule them out."}),E.length?(0,y.jsxs)(r.default,{testID:"allergen-suggestions",style:{gap:6},children:[(0,y.jsx)(d.Banner,{kind:"warn",title:`Check ${E.length} suggested allergen${1===E.length?'':'s'}`,children:E.map(e=>`${(0,f.allergenLabel)(e)} (from ${(0,m.suggestedBy)(R,e).join(', ')})`).join('; ')}),E.map(e=>(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.T,{style:{flex:1},children:(0,f.allergenLabel)(e)}),(0,y.jsx)(d.Button,{testID:`suggest-add-${e}`,small:!0,label:"Contains",onPress:()=>P({allergens:{...j.allergens,[e]:'contains'},confirm:!1})}),(0,y.jsx)(d.Button,{testID:`suggest-may-${e}`,small:!0,kind:"secondary",label:"May contain",onPress:()=>P({allergens:{...j.allergens,[e]:'may'},confirm:!1})}),(0,y.jsx)(d.Button,{testID:`suggest-dismiss-${e}`,small:!0,kind:"ghost",label:"Not in this dish",onPress:()=>N(e)})]},e)),(0,y.jsx)(d.Button,{testID:"apply-suggestions",small:!0,kind:"secondary",label:"Add all suggestions as \u2018contains\u2019",onPress:()=>{const e={...j.allergens};E.forEach(t=>{e[t]='contains'}),P({allergens:e,confirm:!1})}})]}):null,(0,y.jsx)(d.Row,{wrap:!0,gap:6,children:f.ALLERGENS.map(e=>{const t=j.allergens[e.id],s=O.includes(e.id)&&!t&&!j.dismissed.includes(e.id),n='contains'===t?o.colours.redBg:'may'===t?o.colours.amberBg:o.colours.surface2,l='contains'===t?o.colours.red:'may'===t?o.colours.amber:s?o.colours.gold:o.colours.border;return(0,y.jsx)(i.default,{testID:`allergen-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.short}: ${'contains'===t?'contains':'may'===t?'may contain':'not marked'}`,onPress:()=>A(e.id),style:{paddingVertical:6,paddingHorizontal:10,borderRadius:16,borderWidth:s?2:1,borderStyle:s?'dashed':'solid',borderColor:l,backgroundColor:n},children:(0,y.jsxs)(d.T,{size:o.font.small,colour:'contains'===t?'#FFD9D4':'may'===t?'#FFE2A8':o.colours.text,children:[e.short,'may'===t?' (may)':'',s?' ?':'']})},e.id)})}),j.dismissed.length?(0,y.jsxs)(d.Muted,{children:["Ruled out: ",j.dismissed.map(f.allergenLabel).join(', ')]}):null,(0,y.jsx)(d.Field,{testID:"allergen-notes",label:"Allergen notes (optional)",value:j.allergenNotes,onChangeText:e=>P({allergenNotes:e}),placeholder:"e.g. Cooked in the shared fryer"}),(0,y.jsxs)(i.default,{testID:"confirm-allergens",accessibilityRole:"checkbox",accessibilityState:{checked:j.confirm,disabled:E.length>0},disabled:E.length>0,onPress:()=>P({confirm:!j.confirm}),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:j.confirm?o.colours.ok:o.colours.border,opacity:E.length?.5:1},children:[(0,y.jsx)(r.default,{style:{width:22,height:22,borderRadius:4,borderWidth:2,borderColor:j.confirm?o.colours.ok:o.colours.muted,alignItems:'center',justifyContent:'center',backgroundColor:j.confirm?o.colours.okBg:'transparent'},children:j.confirm?(0,y.jsx)(d.T,{colour:o.colours.ok,children:"\u2713"}):null}),(0,y.jsx)(d.T,{style:{flex:1},children:E.length?'Check the suggested allergens above first':`I have checked the allergen list against the ingredients (${c.name})`})]}),w?(0,y.jsx)(d.Banner,{kind:"danger",children:w}):null,(0,y.jsx)(d.Button,{testID:"card-save",label:G?'Saving\u2026':l?'Save changes':'Save card',disabled:G,onPress:async()=>{I(null);const t=L(j.price);if(!j.dish.trim())return I('Give the dish a name.');if('bad'===t)return I('Price should be in pounds, e.g. 14.50 (or leave it blank for "price on the board").');const s=(0,u.recipeCards)();V(!0);try{const n=[...j.photos];for(const t of j.pending){if(n.length>=m.MAX_RECIPE_PHOTOS)break;n.push(await s.savePhoto(e,j.id,t))}const i=j.steps.map(e=>e.trim()).filter(Boolean),r=j.createdBy.trim(),o={dish:j.dish.trim(),section:j.section,price:t,ingredients:R.map(e=>({...e,name:e.name.trim(),qty:e.qty.trim(),unit:e.unit.trim()})),steps:i,allergens:j.allergens,dismissed:j.dismissed,allergenNotes:j.allergenNotes.trim()||void 0,photo:n[0],photos:n,createdBy:r||void 0};if(l)await s.update(l.id,{...o,confirmAllergens:j.confirm},c),h(l.id);else{const t=await s.create(e,{...o,id:j.id,description:j.description.trim()||void 0},c);j.confirm&&await s.update(t.id,{confirmAllergens:!0},c),h(t.id)}}catch(e){I(e?.message??'Could not save the card.')}finally{V(!1)}}}),(0,y.jsx)(d.Muted,{center:!0,children:(0,m.maySignOff)(c,{createdBy:j.createdBy||c.name,createdByRole:c.role})?'After saving, sign the card off so it goes live.':'After saving, the Head Chef, an owner or a manager signs it off before it goes live.'}),l?k?(0,y.jsxs)(d.Row,{gap:8,children:[(0,y.jsx)(d.Button,{testID:"card-delete-yes",small:!0,kind:"danger",label:"Yes, remove this dish",onPress:async()=>{if(l)try{await(0,u.recipeCards)().remove(l.id,c),h(null)}catch(e){I(e?.message??'Could not remove the card.')}}}),(0,y.jsx)(d.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>S(!1)})]}):(0,y.jsx)(d.Button,{testID:"card-delete",small:!0,kind:"ghost",label:"Remove card and dish from the menu",onPress:()=>S(!0)}):null]})}const M=e=>e.replace(/ \xb7 Starter$/,' \xb7 1').replace(/ \xb7 Main$/,' \xb7 2');function O(e){const t=(0,a.useAllMenu)(e),s=(0,a.useRecipeCards)(e);return(0,n.useMemo)(()=>{const e=new Map(s.map(e=>[e.menuItemId,e]));return(0,m.unsignedOldestFirst)(t,t=>e.get(t.id)??(t.recipeCardId?s.find(e=>e.id===t.recipeCardId):void 0))},[t,s])}function E({c:e,actor:t,mode:s,editable:n,onPress:l}){const a=(0,m.cardPhotos)(e),c=(0,b.useCardCosting)(e,'read'===s?'staff':t.role,s),h=f.ALLERGENS.filter(t=>e.allergens[t.id]).length,u=c?.summary.gp,x=c?.summary.tone,C='ok'===x?o.colours.ok:'amber'===x?o.colours.amber:'red'===x?o.colours.red:o.colours.muted,I=`${e.dish}, ${e.section}, ${w(e.price)}, ${h?`${h} allergen${1===h?'':'s'}`:'no allergens marked'}${null!=u?`, GP ${u.toFixed(1)} percent`:''}, created by ${e.createdBy||'not recorded'}, ${e.signOff?`signed off by ${e.signOff.by}`:'awaiting sign-off'}`;return(0,y.jsxs)(i.default,{testID:`card-${e.menuItemId}`,accessibilityRole:"button",accessibilityLabel:I,onPress:l,style:({pressed:t})=>({width:'100%',minHeight:48,flexDirection:'row',gap:12,alignItems:'center',padding:10,borderRadius:18,borderWidth:1,borderColor:!e.signOff&&n?o.colours.amber:o.colours.accentBorder,backgroundColor:t?o.colours.tilePressed:o.colours.tile}),children:[(0,y.jsx)(r.default,{style:{width:84,flexShrink:0},children:(0,y.jsx)(D,{dish:e.dish,photo:a[0],height:84,radius:14})}),(0,y.jsxs)(r.default,{style:{flex:1,minWidth:0,gap:4,alignItems:'center'},children:[(0,y.jsx)(d.T,{center:!0,weight:"bold",size:18,colour:o.colours.gold,children:e.dish}),(0,y.jsxs)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,children:[e.section," \xb7 ",w(e.price),'example'===e.origin?` \xb7 ${p.EXAMPLE_TAG}`:'']}),(0,y.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,y.jsx)(k,{label:h?`${h} allergen${1===h?'':'s'}`:'No allergens marked'}),null!=u?(0,y.jsx)(r.default,{testID:`card-gp-${e.menuItemId}`,style:{paddingHorizontal:10,paddingVertical:4,borderRadius:999,borderWidth:1.5,borderColor:C},children:(0,y.jsxs)(d.T,{size:o.font.small,weight:"bold",colour:C,children:["GP ",u.toFixed(1),"%"]})}):null]}),(0,y.jsxs)(d.T,{center:!0,size:o.font.small,testID:`card-created-${e.menuItemId}`,children:["Created by ",e.createdBy||'Not recorded']}),(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:e.signOff?o.colours.goldLight:o.colours.amber,children:e.signOff?`Signed off by ${e.signOff.by}, ${j(e.signOff.at)}`:m.STATE_LABEL.awaiting})]})]})}},1103,[873,835,31,197,264,128,824,817,822,1488,993,839,818,1104,1243,1444,1114,25]); +__d(function(_g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canEditCards",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canSignOffCards",{enumerable:!0,get:function(){return r}}),e.maySignOff=function(t,n){return'staff'!==t.role&&('head-chef'===t.role||('head-chef'===t.actual||!('owner'!==t.role&&'manager'!==t.role||'owner'!==t.actual&&'manager'!==t.actual)||!!n.createdBy&&t.name.trim()===n.createdBy.trim()&&'head-chef'===n.createdByRole))},Object.defineProperty(e,"SIGNER_ROLE_LABEL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"signerLabel",{enumerable:!0,get:function(){return o}}),e.cardActorFor=function(t,n,r){const i=r?'Head Chef'===r.level&&'staff'===r.role?'head-chef':r.role:n;return{name:t,role:n,actual:i}},Object.defineProperty(e,"MAX_RECIPE_PHOTOS",{enumerable:!0,get:function(){return a}}),e.cardPhotos=s,e.suggestForIngredient=d,e.suggestAllergens=u,Object.defineProperty(e,"suggestedBy",{enumerable:!0,get:function(){return f}}),e.unresolved=g,e.applySuggestions=function(t){const n={...t.allergens};for(const r of g(t))n[r]='contains';return n},Object.defineProperty(e,"cardState",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"STATE_LABEL",{enumerable:!0,get:function(){return h}}),e.signOffBlock=function(t){if(!t.dish.trim())return'Give the dish a name first.';const n=g(t);return n.length?`Check the suggested allergens first: ${n.map(p).join(', ')}.`:t.allergensConfirmed?null:'Confirm the allergen list first.'},Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"CONTENT_FIELDS",{enumerable:!0,get:function(){return y}}),e.editCard=function(t,n,r,i){const{confirmAllergens:o,...a}=n,l={...a};l.photos&&_(s({photo:l.photo??t.photo,photos:l.photos}),s(t))&&(delete l.photos,void 0!==l.photo&&l.photo!==(t.photo??s(t)[0])||delete l.photo);const c=Object.keys(l).filter(n=>!_(l[n],t[n]));let d={...t};for(const t of c)d[t]=l[t];const f=c.some(t=>'allergens'===t||'dismissed'===t||'ingredients'===t);f&&!_(u(d.ingredients),u(t.ingredients))&&(d.allergensConfirmed=void 0);f&&(c.includes('allergens')||c.includes('dismissed'))&&(d.allergensConfirmed=void 0);let m=!1;!o||d.allergensConfirmed||g(d).length||(d.allergensConfirmed={by:r,at:i},m=!0);const h=c.length>0||m,p=c.length>0&&!!t.signOff;if(!h)return{card:t,changed:!1,resetSignOff:!1};c.length&&(d={...d,signOff:null,version:t.version+1});return{card:{...d,updatedAt:i,updatedBy:r},changed:h,resetSignOff:p}},e.signOffCard=function(t,n,r){return{...t,signOff:{by:n,at:r},wasLive:!0,updatedAt:r,updatedBy:n}},e.unsignedOldestFirst=function(t,n){return t.filter(t=>!t.signOff).map((t,r)=>{const i=n(t);return{item:t,card:i,at:i?.createdAt||null,order:r}}).sort((t,n)=>(t.at&&n.at?t.at.localeCompare(n.at):t.at?-1:n.at?1:0)||t.order-n.order)},e.addedLabel=function(t){const n=t?new Date(t.length<=10?`${t}T12:00:00`:t):null;return n&&!isNaN(+n)?`Added ${n.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}`:'Date not recorded'},e.allergenSentence=function(n){const r=t.ALLERGENS.filter(t=>'contains'===n[t.id]).map(t=>t.short.toLowerCase()),i=t.ALLERGENS.filter(t=>'may'===n[t.id]).map(t=>t.short.toLowerCase());return r.length||i.length?[r.length?`Contains ${r.join(', ')}.`:'',i.length?`May contain ${i.join(', ')}.`:''].filter(Boolean).join(' '):'No allergens listed yet.'},Object.defineProperty(e,"isRetiredMiniAnchors",{enumerable:!0,get:function(){return O}}),e.overlayItem=function(t,n){return n?{...t,name:n.dish,section:n.section,price:n.price,allergens:n.allergens,allergenNotes:n.allergenNotes,signOff:n.signOff?{by:n.signOff.by,at:n.signOff.at.slice(0,10)}:null,hidden:t.hidden||!n.signOff&&!n.wasLive||O(t.id)||O(n.menuItemId),recipeCardId:n.id}:O(t.id)?{...t,hidden:!0}:t},e.dishesFor=function(t,n){const r=t.filter(t=>!t.hidden),i=r.filter(t=>n.some(n=>'contains'===t.allergens[n])),o=r.filter(t=>!i.includes(t)&&n.some(n=>'may'===t.allergens[n])),a=r.filter(t=>!i.includes(t)&&!o.includes(t));return{contains:i,may:o,free:a}},e.filterCards=function(t,n,r,i="free-from"){const o=n.toLowerCase().split(/\s+/).filter(Boolean);return t.filter(t=>{const n=[t.dish,t.section,...t.ingredients.map(t=>t.name)].join(' ').toLowerCase();return!!o.every(t=>n.includes(t))&&(!r.length||('free-from'===i?r.every(n=>!t.allergens[n]):r.some(n=>!!t.allergens[n])))})},e.uuid=function(){const t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();const n=Array.from({length:16},()=>Math.floor(256*Math.random()));n[6]=15&n[6]|64,n[8]=63&n[8]|128;const r=n.map(t=>t.toString(16).padStart(2,'0')).join('');return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`},e.uuidFrom=function(t){let n='';for(let r=0;r<4;r++){let i=2166136261^2654435761*r;for(let n=0;n>>0;n+=i.toString(16).padStart(8,'0')}const r=n.slice(0,12)+'4'+n.slice(13,16)+(3&parseInt(n[16],16)|8).toString(16)+n.slice(17,32);return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`},Object.defineProperty(e,"RECIPE_CARD_EXTRA_COLUMNS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STEP_SEP",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"photoPath",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"RECIPE_PHOTO_BUCKET",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"RECIPE_CARD_TABLE",{enumerable:!0,get:function(){return S}}),e.cardToRow=function(t,n){return{row:{id:t.id,venue_id:n,dish:t.dish,ingredients:t.ingredients.map(({name:t,qty:n,unit:r,allergens:i})=>({name:t,qty:n,unit:r,...i?.length?{allergens:i}:{}})),method:t.steps.join(w),allergens:b(t.allergens,'contains'),may_contain:b(t.allergens,'may'),photo_url:!t.photo||t.photo.startsWith('local:')||t.photo.startsWith('asset:')?null:t.photo,signed_off_by:t.signOff?.by??null,signed_off_at:t.signOff?.at??null,updated_at:t.updatedAt},extra:{menu_item_id:t.menuItemId,section:t.section,price_pence:t.price,dismissed:t.dismissed,allergen_notes:t.allergenNotes??null,allergens_confirmed_by:t.allergensConfirmed?.by??null,allergens_confirmed_at:t.allergensConfirmed?.at??null,was_live:t.wasLive,origin:t.origin,version:t.version,updated_by:t.updatedBy}}},e.rowToCard=function(t,n,r={}){const i={};t.may_contain.forEach(t=>{i[t]='may'}),t.allergens.forEach(t=>{i[t]='contains'});const o=t.updated_at??(new Date).toISOString();return{id:t.id,restaurantId:n,menuItemId:r.menu_item_id??t.id,dish:t.dish,section:r.section??'Mains',price:r.price_pence??null,photo:t.photo_url??void 0,ingredients:t.ingredients.map((n,r)=>({id:`${t.id}-i${r}`,...n})),steps:t.method?t.method.split(w).filter(t=>t.trim()):[],allergens:i,dismissed:r.dismissed??[],allergenNotes:r.allergen_notes??void 0,allergensConfirmed:r.allergens_confirmed_by?{by:r.allergens_confirmed_by,at:r.allergens_confirmed_at}:void 0,signOff:t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:t.signed_off_at}:null,wasLive:r.was_live??!!t.signed_off_by,origin:r.origin??'new',version:r.version??1,createdAt:o,updatedAt:o,updatedBy:r.updated_by??''}};var t=_r(_d[0]);const n=t=>'head-chef'===t||'manager'===t||'owner'===t,r=t=>'head-chef'===t||'manager'===t||'owner'===t;const i={'head-chef':'Head Chef',manager:'Manager',owner:'Owner',staff:'Staff'},o=t=>`${t.name}, ${i[t.actual??t.role]}`;const a=5;function s(t){const n=(t.photos??[]).filter(t=>!!t);return[...t.photo&&!n.includes(t.photo)?[t.photo]:[],...n].slice(0,a)}const l=[[/\b(flour(?!y)|wheat|bread|crumb|panko|pastry|brioche|buns?\b|crouton|crostini|batter|beer|ale\b|lager|stout|barley|malt|rye|spelt|oat|couscous|semolina|pasta|penne|macaroni|spaghetti|noodle|biscuit|sponge|crumble|roux|tempura|digestive|self.raising)/i,['gluten']],[/\b(prawn|langoustine|lobster|crab|shrimp|crayfish|scampi|shellfish)/i,['crustaceans']],[/\b(mussel|scallop|clam|cockle|squid|calamari|octopus|whelk|winkle|oyster(?! mushroom)|oyster sauce)/i,['molluscs']],[/\b(egg|mayonnaise|mayo|aioli|tartare|hollandaise|meringue|custard|brioche|bearnaise)/i,['eggs']],[/\b(fish(?!er)|haddock|cod|salmon|hake|anchov|tuna|mackerel|trout|sea bass|monkfish|pollock|halibut|kipper|worcester|fish sauce|caesar)/i,['fish']],[/\b(peanut|groundnut|satay)/i,['peanuts']],[/\b(almond|hazelnut|walnut|cashew|pecan|pistachio|macadamia|brazil nut|praline|frangipane|marzipan|pesto)/i,['treenuts']],[/\b(soy|soya|tofu|edamame|miso|tamari|tempeh)/i,['soya']],[/\b(milk|butter(?!nut)|cream|cheese|cheddar|parmesan|mozzarella|brie|yoghurt|yogurt|cr[e\xe8]me|ghee|ice cream|custard|butterscotch|toffee|fudge|buttermilk|mascarpone|ricotta|whey)/i,['milk']],[/\b(celery|celeriac|stock cube|beef stock|chicken stock|veg(etable)? stock)/i,['celery']],[/\b(mustard|dijon|vinaigrette|piccalilli)/i,['mustard']],[/\b(sesame|tahini|hummus|houmous)/i,['sesame']],[/\b(wine|vinegar|dried apricot|dried fruit|sulphite|sulfite|prosecco|cider|port\b|sherry|dates?\b|raisin|sultana)/i,['sulphites']],[/\blupin/i,['lupin']]],c=[[/gluten.free|\bgf\b/i,'gluten'],[/dairy.free|vegan (butter|cheese|cream)|oat milk|plant.based/i,'milk'],[/egg.free|vegan mayo/i,'eggs']];function d(n){const r=new Set(n.allergens??[]);for(const[t,i]of l)t.test(n.name)&&i.forEach(t=>r.add(t));for(const[t,i]of c)t.test(n.name)&&!(n.allergens??[]).includes(i)&&r.delete(i);return t.ALLERGENS.map(t=>t.id).filter(t=>r.has(t))}function u(n){const r=new Set(n.flatMap(d));return t.ALLERGENS.map(t=>t.id).filter(t=>r.has(t))}const f=(t,n)=>t.filter(t=>d(t).includes(n)).map(t=>t.name);function g(t){return u(t.ingredients).filter(n=>!t.allergens[n]&&!t.dismissed.includes(n))}const m=t=>t.signOff?'signed-off':'awaiting',h={'signed-off':'Signed off',awaiting:'Awaiting sign-off'};const p=n=>t.ALLERGENS.find(t=>t.id===n)?.short??n,b=(n,r)=>t.ALLERGENS.filter(t=>r?n[t.id]===r:!!n[t.id]).map(t=>t.id),y=['dish','section','price','photo','photos','createdBy','ingredients','steps','allergens','dismissed','allergenNotes'],_=(t,n)=>JSON.stringify(t??null)===JSON.stringify(n??null);const O=t=>'a-mini'===t;const v={menu_item_id:'text',section:'text',price_pence:'integer null',dismissed:'text[]',allergen_notes:'text',allergens_confirmed_by:'text',allergens_confirmed_at:'timestamptz',was_live:'boolean',origin:'text',version:'integer',updated_by:'text'},w='\n',E=(t,n)=>`${t}/${n.id}-v${n.version}.jpg`,C='recipe-photos',S='recipe_cards'},1104,[818]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoucherList=function({mode:e,onClose:o}){const[I,z]=(0,s.useState)([]),[S,$]=(0,s.useState)(!0),[A,P]=(0,s.useState)(''),[U,N]=(0,s.useState)(null),[W,R]=(0,s.useState)(''),[B,L]=(0,s.useState)('unused'),[O,M]=(0,s.useState)('purchased'),[H,_]=(0,s.useState)(null),[V,E]=(0,s.useState)(!1),[G,Y]=(0,s.useState)(''),[F,q]=(0,s.useState)(!1),[J,K]=(0,s.useState)(''),[Q,X]=(0,s.useState)(()=>Date.now()),[Z,ee]=(0,s.useState)(p.NO_RIGHTS),se=t.default.useRef([]);(0,s.useEffect)(()=>{se.current=I},[I]);const{width:te}=(0,u.default)(),re=(0,s.useCallback)(async()=>{try{z(await(0,y.listVouchers)()),P(''),N(await(0,y.voucherSyncState)()),ee(await(0,y.voucherRights)()),X(Date.now())}catch(e){P(`Could not load the vouchers. ${e.message??''}`.trim())}finally{$(!1)}},[]);(0,s.useEffect)(()=>{let e=!0;const s=setTimeout(()=>{re().then(async()=>{(0,y.vouchersLive)()&&e&&(await(0,y.refreshFromWebsite)(),e&&await re())})},0),t=setInterval(()=>{e&&re()},6e4);return()=>{e=!1,clearTimeout(s),clearInterval(t)}},[re]);const oe=(0,s.useMemo)(()=>(0,p.counts)(I,Q),[I,Q]),le=(0,s.useMemo)(()=>(0,p.filterSort)(I,{q:W,filter:B,sort:O,nowMs:Q}),[I,W,B,O,Q]),ie=te<700,ne=()=>{_(null),E(!1),Y(''),K('')},de=async(e=!1)=>{if(H){q(!0);try{const s=await(0,y.markVoucherUsed)(H.id,G,e);K(`${e?'Car'===s.usedBy?'Car override. ':'Manager override. ':''}Marked as used by ${s.usedBy}. The whole ${(0,p.pounds)(H.valuePence)} is used. Nothing is left on it. It is being switched off on the website.`),E(!1),await re(),_(t=>t?{...t,usedAt:(new Date).toISOString(),usedBy:s.usedBy,usedTable:G.trim()||null,overrideBy:e?s.usedBy:null,wixRedeemState:'sent'===t.wixRedeemState?'sent':'not-sent'}:t),setTimeout(()=>{re().then(()=>_(e=>e?se.current.find(s=>s.id===e.id)??e:e))},4e3)}catch(e){K(e.message||'That did not work. Try again.')}finally{q(!1)}}},ae=async()=>{if(H){q(!0);try{await(0,y.undoVoucherUsed)(H.id),K('Undone. The voucher is unused again.'),await re(),_(e=>e?{...e,usedAt:null,usedBy:null,usedTable:null}:e)}catch(e){K(e.message||'That did not work.')}finally{q(!1)}}},ce=(0,y.vouchersLive)()?U?.lastError?`Website check: ${U.lastError}.${U.lastOkAt?` Last copy ${(0,p.ukDateTime)(U.lastOkAt)}.`:''}`:U?.lastOkAt?`Up to date with the website, ${(0,p.ukDateTime)(U.lastOkAt)}.`:'Checking the website\u2026':'Sample vouchers (demo).',ue=H?(0,p.voucherStatus)(H,Q):'unused',he=H?(0,f.jsx)(r.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:ne,supportedOrientations:['portrait','landscape'],children:(0,f.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,f.jsxs)(c.default,{testID:"voucher-detail",accessibilityViewIsModal:!0,style:{width:'100%',maxWidth:620,maxHeight:'96%',backgroundColor:x.colours.surface,borderRadius:20,borderWidth:1.5,borderColor:x.colours.gold,padding:20},children:[(0,f.jsxs)(c.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(c.default,{style:{width:44}}),(0,f.jsxs)(b.T,{size:24,weight:"bold",colour:x.colours.gold,style:{flex:1},center:!0,accessibilityRole:"header",children:[(0,p.pounds)(H.valuePence)," gift voucher"]}),(0,f.jsx)(h.GoldClose,{size:"lg",label:"Close this voucher",testID:"voucher-detail-close",onPress:ne})]}),(0,f.jsxs)(l.default,{contentContainerStyle:{alignItems:'center',gap:2,paddingVertical:8},children:[(0,f.jsxs)(b.T,{size:18,weight:"semibold",colour:w(ue),center:!0,children:[p.STATUS_WORD[ue],(0,p.expiryWarning)(H,Q)?` \xb7 ${(0,p.expiryWarning)(H,Q)}`:'']}),(0,f.jsx)(D,{k:"Code",v:`${(0,p.maskCode)(H.last4)} (check the end of the code matches)`}),(0,f.jsx)(D,{k:"For",v:[H.recipientName,H.recipientEmail].filter(Boolean).join(' \xb7 ')}),(0,f.jsx)(D,{k:"From",v:[H.buyerName,H.buyerEmail].filter(Boolean).join(' \xb7 ')}),(0,f.jsx)(D,{k:"Message",v:H.message}),(0,f.jsx)(D,{k:"Bought",v:`${(0,p.ukDate)(H.purchasedAt)}${H.orderNumber?` \xb7 website order ${H.orderNumber}`:''}`}),(0,f.jsx)(D,{k:"Use by",v:H.expiresAt?(0,p.ukDate)(H.expiresAt):'No use by date'}),H.usedAt?(0,f.jsx)(D,{k:"Used",v:`${(0,p.ukDateTime)(H.usedAt)}${H.usedBy?` by ${H.usedBy}`:''}${H.usedTable?` \xb7 Table ${H.usedTable}`:''}`}):null,'used'!==ue||H.usedAt?null:(0,f.jsx)(D,{k:"Used",v:"On the website"}),H.overrideBy?(0,f.jsx)(D,{k:'Car'===H.overrideBy?'Car override':'Manager override',v:`Allowed after its use by date by ${H.overrideBy}`}):null,(0,p.websiteWords)(H)?(0,f.jsx)(b.T,{testID:"voucher-website",size:15,colour:'failed'===H.wixRedeemState?x.colours.amber:x.colours.muted,center:!0,style:{marginTop:6},children:(0,p.websiteWords)(H)}):null,J?(0,f.jsx)(b.T,{testID:"voucher-msg",size:17,weight:"semibold",colour:x.colours.goldLight,center:!0,style:{marginTop:8},accessibilityLabel:J,children:J}):null,'unused'!==ue&&'expired'!==ue||Z.canMark?null:(0,f.jsx)(b.T,{testID:"voucher-ask",size:17,weight:"semibold",colour:x.colours.goldLight,center:!0,style:{marginTop:12},children:"Ask a manager or use the Display."}),'expired'===ue&&Z.canMark&&!Z.canOverride?(0,f.jsx)(b.T,{testID:"voucher-expired-ask",size:17,weight:"semibold",colour:x.colours.amber,center:!0,style:{marginTop:12},children:"This voucher has run out. Ask a manager: they can allow it in the Managers app."}):null,('unused'===ue||'expired'===ue&&Z.canOverride)&&Z.canMark&&!V?(0,f.jsx)(c.default,{style:{marginTop:14},children:(0,f.jsx)(k,{testID:"voucher-use",label:'expired'===ue?'Manager override: use it':'Mark as used',spoken:'expired'===ue?`Manager override. Use this expired voucher, the whole ${(0,p.pounds)(H.valuePence)}`:`Mark as used. Uses the whole ${(0,p.pounds)(H.valuePence)}`,onPress:()=>{E(!0),K('')}})}):null,('unused'===ue||'expired'===ue&&Z.canOverride)&&Z.canMark&&V?(0,f.jsxs)(c.default,{testID:"voucher-confirm",style:{marginTop:12,alignItems:'center',gap:12,width:'100%',borderTopWidth:1,borderTopColor:x.colours.hairline,paddingTop:12},children:[(0,f.jsx)(b.T,{size:19,weight:"semibold",center:!0,accessibilityRole:"header",children:'expired'===ue?`Manager override: use the whole ${(0,p.pounds)(H.valuePence)} now?`:`Use the whole ${(0,p.pounds)(H.valuePence)} now?`}),'expired'===ue?(0,f.jsxs)(b.T,{size:16,colour:x.colours.amber,center:!0,children:["It ran out on ",(0,p.ukDate)(H.expiresAt),". Your name is recorded as allowing it."]}):null,(0,f.jsxs)(b.T,{size:16,colour:x.colours.muted,center:!0,children:["One time use. Nothing will be left on it. It is also switched off on the website. Check the code ends ",H.last4.toUpperCase(),"."]}),(0,f.jsxs)(c.default,{style:{width:220,alignItems:'center',gap:4},children:[(0,f.jsx)(b.T,{size:13,colour:x.colours.muted,center:!0,children:"Table (optional)"}),(0,f.jsx)(n.default,{testID:"voucher-table",accessibilityLabel:"Table number, optional",value:G,onChangeText:e=>Y(e.slice(0,12)),placeholder:"e.g. 14",placeholderTextColor:"#7D776C",style:{minHeight:52,width:220,textAlign:'center',fontSize:20,color:x.colours.text,borderWidth:1,borderColor:x.colours.border,borderRadius:12,backgroundColor:x.colours.surface2}})]}),(0,f.jsxs)(c.default,{style:{flexDirection:ie?'column':'row',gap:12,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(k,{testID:"voucher-use-yes",label:'expired'===ue?'Yes, allow and use it':'Yes, mark as used',spoken:'expired'===ue?`Yes, manager override, use the expired ${(0,p.pounds)(H.valuePence)} voucher`:`Yes, mark the ${(0,p.pounds)(H.valuePence)} voucher as used`,disabled:F,onPress:()=>{de('expired'===ue)}}),(0,f.jsx)(k,{testID:"voucher-use-no",kind:"quiet",label:"Cancel",spoken:"Cancel, do not mark as used",disabled:F,onPress:()=>E(!1)})]})]}):null,'managers'===e&&Z.canUndo&&(0,p.canUndoNow)(H)?(0,f.jsx)(c.default,{style:{marginTop:12},children:(0,f.jsx)(k,{testID:"voucher-undo",kind:"quiet",label:"Undo, it was not used",spoken:"Undo mark as used. Only before the website switches it off",disabled:F,onPress:()=>{ae()}})}):null]})]})})}):null;return(0,f.jsxs)(c.default,{testID:"voucher-list",style:{flex:1,width:'100%',maxWidth:980,alignSelf:'center',alignItems:'stretch',gap:12,padding:'display'===e?18:0},children:[(0,f.jsxs)(c.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center'},children:[o?(0,f.jsx)(c.default,{style:{width:54}}):null,(0,f.jsx)(b.T,{size:'display'===e?30:24,weight:"bold",colour:x.colours.gold,style:{flex:1},center:!0,accessibilityRole:"header",children:"Gift vouchers"}),o?(0,f.jsx)(h.GoldClose,{size:"lg",label:"Close gift vouchers",testID:"vouchers-close",onPress:o}):null]}),S||Z.canMark?null:(0,f.jsx)(b.T,{testID:"vouchers-viewonly",size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,children:"You can look. Ask a manager or use the Display to mark one as used."}),(0,f.jsx)(b.T,{testID:"vouchers-sync",size:14,colour:U?.lastError?x.colours.amber:x.colours.muted,center:!0,children:ce}),(0,f.jsx)(n.default,{testID:"voucher-search",accessibilityLabel:"Search vouchers by code, name or email",value:W,onChangeText:R,placeholder:"Search code, name or email",placeholderTextColor:"#7D776C",autoCapitalize:"none",autoCorrect:!1,style:{minHeight:58,fontSize:20,textAlign:'center',color:x.colours.text,borderWidth:1.5,borderColor:x.colours.accentBorder,borderRadius:16,backgroundColor:x.colours.surface2,paddingHorizontal:16,alignSelf:'center',width:'100%',maxWidth:640}}),(0,f.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center'},accessibilityLabel:"Show",children:[j.map(e=>(0,f.jsx)(T,{testID:`voucher-filter-${e.id}`,label:`${e.label} ${oe[e.id]}`,spoken:`${e.label}, ${oe[e.id]}`,selected:B===e.id,onPress:()=>L(e.id)},e.id)),oe.cancelled?(0,f.jsx)(T,{testID:"voucher-filter-cancelled",label:`Cancelled ${oe.cancelled}`,spoken:`Cancelled on the website, ${oe.cancelled}`,selected:'cancelled'===B,onPress:()=>L('cancelled')}):null]}),(0,f.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center'},children:v.map(e=>(0,f.jsx)(T,{testID:`voucher-sort-${e.id}`,label:e.label,spoken:e.spoken,selected:O===e.id,onPress:()=>M(e.id)},e.id))}),A?(0,f.jsx)(b.T,{size:16,colour:x.colours.red,center:!0,children:A}):null,(0,f.jsxs)(l.default,{style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:24},children:[S?(0,f.jsx)(b.T,{size:17,colour:x.colours.muted,center:!0,children:"Loading vouchers\u2026"}):null,S||0!==le.length?null:(0,f.jsx)(b.T,{testID:"vouchers-none",size:18,colour:x.colours.muted,center:!0,children:W.trim()?'No voucher matches that search.':`No ${'all'===B?'':p.STATUS_WORD[B].toLowerCase()+' '}vouchers.`}),le.map(e=>(0,f.jsx)(C,{v:e,now:Q,onPress:()=>{_(e),E(!1),K(''),Y('')}},e.id))]}),he]})},Object.defineProperty(_e,"voucherCodeLabel",{enumerable:!0,get:function(){return I}});var s=_r(d[0]),t=e(s),r=e(_r(d[1])),o=e(_r(d[2])),l=e(_r(d[3])),n=e(_r(d[4])),c=e(_r(d[5])),u=e(_r(d[6])),h=_r(d[7]),b=_r(d[8]),x=_r(d[9]),p=_r(d[10]),y=_r(d[11]),f=_r(d[12]);const j=[{id:'unused',label:'Unused'},{id:'used',label:'Used'},{id:'expired',label:'Expired'},{id:'all',label:'All'}],v=[{id:'purchased',label:'Newest bought',spoken:'Sort by date bought, newest first'},{id:'expiry',label:'Use by soonest',spoken:'Sort by use by date, soonest first'}],w=e=>'unused'===e?x.colours.goldLight:'expired'===e?x.colours.red:x.colours.muted;function T({label:e,selected:s,onPress:t,testID:r,spoken:l}){return(0,f.jsx)(o.default,{testID:r,accessibilityRole:"button",accessibilityState:{selected:!!s},accessibilityLabel:`${l??e}${s?', selected':''}`,onPress:t,style:({pressed:e})=>({minHeight:52,minWidth:110,paddingHorizontal:18,borderRadius:26,alignItems:'center',justifyContent:'center',borderWidth:1.5,borderColor:s?x.colours.gold:x.colours.accentBorder,backgroundColor:s?x.colours.gold:e?x.colours.goldTint:'transparent'}),children:(0,f.jsx)(b.T,{size:17,weight:"semibold",colour:s?x.colours.onGold:x.colours.text,center:!0,children:e})})}function k({label:e,onPress:s,testID:t,spoken:r,kind:l="gold",disabled:n}){const c='gold'===l;return(0,f.jsx)(o.default,{testID:t,accessibilityRole:"button",accessibilityLabel:r??e,accessibilityState:{disabled:!!n},disabled:n,onPress:s,style:({pressed:e})=>({minHeight:60,minWidth:200,paddingHorizontal:26,borderRadius:16,alignItems:'center',justifyContent:'center',opacity:n?.4:1,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:c?e?x.colours.goldLight:x.colours.gold:e?x.colours.goldTint:'transparent'}),children:(0,f.jsx)(b.T,{size:19,weight:"semibold",colour:c?x.colours.onGold:x.colours.gold,center:!0,children:e})})}function C({v:e,now:s,onPress:t}){const r=(0,p.voucherStatus)(e,s),l=(0,p.expiryWarning)(e,s),n=e.recipientName||e.buyerName||'No name given',h=(0,u.default)().width<600,y=`${e.recipientName&&e.buyerName&&e.buyerName!==e.recipientName?`From ${e.buyerName} \xb7 `:''}${(0,p.maskCode)(e.last4)}`;return h?(0,f.jsxs)(o.default,{testID:`voucher-${e.id}`,accessibilityRole:"button",accessibilityLabel:(0,p.voucherSpoken)(e,s),accessibilityHint:"Opens this voucher",onPress:t,style:({pressed:e})=>({minHeight:84,borderRadius:16,borderWidth:1,borderColor:l?x.colours.amber:x.colours.border,backgroundColor:e?x.colours.tilePressed:x.colours.tile,paddingVertical:12,paddingHorizontal:14,alignItems:'center',gap:4}),children:[(0,f.jsxs)(b.T,{size:24,weight:"bold",colour:'unused'===r?x.colours.gold:x.colours.muted,center:!0,children:[(0,p.pounds)(e.valuePence)," ",(0,f.jsx)(b.T,{size:14,weight:"semibold",colour:w(r),children:p.STATUS_WORD[r]})]}),(0,f.jsx)(b.T,{size:18,weight:"semibold",center:!0,children:n}),(0,f.jsx)(b.T,{size:14,colour:x.colours.muted,center:!0,children:y}),(0,f.jsxs)(b.T,{size:14,center:!0,children:["Bought ",(0,p.ukDate)(e.purchasedAt)," \xb7 Use by ",(0,f.jsx)(b.T,{size:14,weight:"semibold",colour:'expired'===r?x.colours.red:l?x.colours.amber:x.colours.text,children:e.expiresAt?(0,p.ukDate)(e.expiresAt):'No date'})]}),l?(0,f.jsx)(b.T,{size:14,weight:"semibold",colour:x.colours.amber,center:!0,children:l}):null,'used'===r&&e.usedAt?(0,f.jsxs)(b.T,{size:14,colour:x.colours.muted,center:!0,children:["Used ",(0,p.ukDateTime)(e.usedAt),e.usedBy?` \xb7 ${e.usedBy}`:'',e.usedTable?` \xb7 Table ${e.usedTable}`:'']}):null,'used'!==r||e.usedAt?null:(0,f.jsx)(b.T,{size:14,colour:x.colours.muted,center:!0,children:"Used on the website"})]}):(0,f.jsxs)(o.default,{testID:`voucher-${e.id}`,accessibilityRole:"button",accessibilityLabel:(0,p.voucherSpoken)(e,s),accessibilityHint:"Opens this voucher",onPress:t,style:({pressed:e})=>({minHeight:84,borderRadius:16,borderWidth:1,borderColor:l?x.colours.amber:x.colours.border,backgroundColor:e?x.colours.tilePressed:x.colours.tile,paddingVertical:12,paddingHorizontal:18,flexDirection:'row',alignItems:'center',gap:16}),children:[(0,f.jsxs)(c.default,{style:{width:92,alignItems:'center'},children:[(0,f.jsx)(b.T,{size:26,weight:"bold",colour:'unused'===r?x.colours.gold:x.colours.muted,center:!0,children:(0,p.pounds)(e.valuePence)}),(0,f.jsx)(b.T,{size:13,weight:"semibold",colour:w(r),center:!0,children:p.STATUS_WORD[r]})]}),(0,f.jsxs)(c.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,f.jsx)(b.T,{size:19,weight:"semibold",numberOfLines:1,center:!0,children:n}),(0,f.jsxs)(b.T,{size:14,colour:x.colours.muted,numberOfLines:1,center:!0,children:[e.recipientName&&e.buyerName&&e.buyerName!==e.recipientName?`From ${e.buyerName} \xb7 `:'',(0,p.maskCode)(e.last4)]}),l?(0,f.jsx)(b.T,{size:14,weight:"semibold",colour:x.colours.amber,center:!0,children:l}):null,'used'===r&&e.usedAt?(0,f.jsxs)(b.T,{size:14,colour:x.colours.muted,center:!0,numberOfLines:1,children:["Used ",(0,p.ukDateTime)(e.usedAt),e.usedBy?` \xb7 ${e.usedBy}`:'',e.usedTable?` \xb7 Table ${e.usedTable}`:'']}):null,'used'!==r||e.usedAt?null:(0,f.jsx)(b.T,{size:14,colour:x.colours.muted,center:!0,children:"Used on the website"})]}),(0,f.jsxs)(c.default,{style:{width:132,alignItems:'center'},children:[(0,f.jsx)(b.T,{size:12,colour:x.colours.muted,center:!0,children:"Bought"}),(0,f.jsx)(b.T,{size:15,center:!0,children:(0,p.ukDate)(e.purchasedAt)}),(0,f.jsx)(b.T,{size:12,colour:x.colours.muted,center:!0,children:"Use by"}),(0,f.jsx)(b.T,{size:15,weight:"semibold",colour:'expired'===r?x.colours.red:l?x.colours.amber:x.colours.text,center:!0,children:e.expiresAt?(0,p.ukDate)(e.expiresAt):'No date'})]})]})}function D({k:e,v:s}){return s?(0,f.jsxs)(c.default,{accessible:!0,accessibilityLabel:`${e}: ${s}`,style:{alignItems:'center',paddingVertical:4},children:[(0,f.jsx)(b.T,{size:13,colour:x.colours.muted,center:!0,children:e}),(0,f.jsx)(b.T,{size:18,center:!0,children:s})]}):null}const I=p.spokenCode},1105,[31,257,264,152,274,128,288,835,817,824,1576,1577,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},1106,[31,197,123,264,128,817,999,1067,1094,824,1146,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.refreshReviews=k,_e.ensureReviewSync=function(t,n){const s=`${t}:${n}`;if(_.has(s)||!t)return()=>{};let u=!1,c=null;const l=()=>{u||k(t,n)};l();const v=setInterval(l,3e4);(async()=>{const s=await p('public_venue',{p_venue_slug:w(t)}),l=s.data?.[0]?.id;if(u||!l||!(0,o.isSupabaseConfigured)()||'customer'===e.APP_VARIANT)return;const _=(0,a.getSupabase)().channel(`reviews:${l}:${n}`).on('postgres_changes',{event:'INSERT',schema:'public',table:'review_signals',filter:`venue_id=eq.${l}`},e=>{const a=e.new;'submitted'===a.kind&&a.review_id&&b(t,a.review_id),k(t,n)}).subscribe();c=_,u&&(0,a.getSupabase)().removeChannel(_)})();const f=()=>{u=!0,clearInterval(v),c&&(0,a.getSupabase)().removeChannel(c),_.delete(s)};return _.set(s,f),f},_e.submitReview=async function(e,t,a,o){const n=await p('submit_review',{p_token:e,p_rating:t,p_comment:a,p_public_name:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?{ok:!0}:{ok:!1,error:n.data?.error||'Not sent.'}},_e.moderateReview=async function(e,t,a,o,n){const s=await p('moderate_review',{p_id:t,p_status:a,p_reason:o??null,p_reply:n});return s.error?{ok:!1,error:s.error}:s.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:s.data?.error||'Not saved.'}},_e.setReviewReply=async function(e,t,a){const o=await p('set_review_reply',{p_id:t,p_reply:a});return o.error?{ok:!1,error:o.error}:o.data?.ok?(await k(e,'manage'),{ok:!0}):{ok:!1,error:o.data?.error||'Not saved.'}},_e.optOutReviewEmail=async function(e){const t=await p('opt_out_review_email',{p_token:e});return t.error?{ok:!1,error:t.error}:t.data?.ok?{ok:!0}:{ok:!1,error:t.data?.error||'This opt-out link is not valid.'}},_e.issueReviewLink=async function(e,t){const a=await p('issue_review_token',{p_slug:w(e),p_booking:t});return a.error?{ok:!1,error:a.error}:a.data?.ok&&a.data.token?{ok:!0,token:a.data.token}:{ok:!1,error:a.data?.error||'No review link.'}},_e.saveReviewSettings=async function(e,t,a,o){const n=await p('save_review_settings',{p_slug:w(e),p_google_url:t,p_email_on:a,p_wix_mirror:o});return n.error?{ok:!1,error:n.error}:n.data?.ok?(u.useReviews.getState().setSettings(e,{googleUrl:n.data.google_url??t,emailOn:a,wixOn:o}),{ok:!0}):{ok:!1,error:n.data?.error||'Not saved.'}};var e=r(d[0]),t=r(d[1]),a=r(d[2]),o=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]);const c='This device is not connected to the shared system.',l=new Set,_=new Map;async function p(e,t){if(!(0,o.isSupabaseConfigured)())return{data:null,error:c};try{const{data:o,error:n}=await(0,a.getSupabase)().rpc(e,t);return n?{data:null,error:n.message}:{data:o}}catch(e){return{data:null,error:e instanceof Error?e.message:c}}}function w(e){return(0,t.queuedDatabaseSlug)(e)}function v(e,t){return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:'published',publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:'off',audit:[]}}function f(e,t){const a=(t.audit??[]).map(e=>({at:e.at,by:e.by??'',action:e.action,reason:e.reason??void 0}));return{id:t.id,restaurantId:e,rating:Number(t.rating),comment:t.comment??'',publicName:t.public_name,status:t.status,reason:t.reason??void 0,reply:t.reply??void 0,publicReply:t.public_reply||void 0,createdAt:t.created_at,wix:(o=t.wix_state,'synced'===o?'up_to_date':'pending_push'===o||'pending_delete'===o?'pending':'off'),audit:a};var o}async function k(e,t){const a='manage'===t?'list_reviews':'published_reviews',o=await p(a,{p_slug:w(e)});if(o.error||!o.data)return u.useReviews.getState().setStatus(e,'offline'),o.error??c;const n='manage'===t?o.data.map(t=>f(e,t)):o.data.map(t=>v(e,t));u.useReviews.getState().replaceVenue(e,n);const s=await p('review_venue_settings',{p_slug:w(e)});if(s.data){const t={googleUrl:s.data.google_url??''};'boolean'==typeof s.data.email_on&&(t.emailOn=s.data.email_on),'boolean'==typeof s.data.wix_mirror&&(t.wixOn=s.data.wix_mirror),u.useReviews.getState().setSettings(e,t)}return''}function b(t,a){if('customer'===e.APP_VARIANT||l.has(a))return;l.add(a);const o=`review:${a}`;s.useAlerts.getState().history.some(e=>e.id===o)||(s.useAlerts.getState().raise({id:o,kind:'review',rid:t,at:Date.now(),refId:a,name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}),s.useAlerts.getState().dismiss(o),(0,n.notify)({id:o,kicker:'NEW REVIEW',title:'New review',body:'A guest left a review.',timeoutMs:8e3,testID:'review-alert'}))}},1107,[807,6,871,1136,1066,1012,1108]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REVIEW_POLICY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"REVIEW_REASONS",{enumerable:!0,get:function(){return u}}),_e.reviewEmail=function(e,t,n){return(0,r.reviewRequestText)(e,t,n,'[opt-out link]')},_e.safeGoogleUrl=function(e){const t=(e??'').trim();return/^https:\/\/[^\s]+$/i.test(t)?t:''},Object.defineProperty(_e,"useReviews",{enumerable:!0,get:function(){return v}}),_e.reviewLink=function(e,t){const n=`/customer/${e}/feedback?token=${t}`;return'undefined'!=typeof window&&window.location?.origin?`${window.location.origin}${n}`:n};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),s=_r(d[2]),l=_r(d[3]);const o='We publish genuine reviews, whether they are positive or negative. A review is removed or hidden only when it is fake, abusive, irrelevant to a visit, unlawful, or includes someone\u2019s personal data. The reason is recorded.',u=[{id:'fake',label:'Fake'},{id:'abusive',label:'Abusive'},{id:'irrelevant',label:'Irrelevant'},{id:'unlawful',label:'Unlawful'},{id:'personal_data',label:'Personal data'}],c={googleUrl:'',emailOn:!1,wixOn:!1};const v=(0,s.create)()((0,l.persist)((e,t)=>({reviews:[],settings:{},link:{},settingsFor:e=>t().settings[e]??c,setSettings:(t,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??c,...n,emailOn:n.emailOn??e.settings[t]?.emailOn??!1,wixOn:n.wixOn??e.settings[t]?.wixOn??!1,googleUrl:n.googleUrl??e.settings[t]?.googleUrl??''}}})),setStatus:(t,n)=>e(e=>({link:{...e.link,[t]:n}})),replaceVenue:(t,n)=>e(e=>({reviews:[...e.reviews.filter(e=>e.restaurantId!==t),...n],link:{...e.link,[t]:'live'}}))}),{name:'covercharge-reviews-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:()=>({reviews:[],settings:{},link:{}})}))},1108,[1080,1534,1072,1081]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),v=w.filter(e=>!m(e)).slice(0,8),[k,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?k===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),p?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(a.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),v.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),v.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1109,[811,31,128,817,818,819,883,822,1037,824,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1110,[823,31,119,123,128,875,817,1059,845,824,1643,25]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1111,[5,1048,31,128,817,819,1059,1537,1538,823,845,824,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setLiveData=c,e.requireRealData=function(){t=!0,c(!0)},Object.defineProperty(e,"liveData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"examplesAllowed",{enumerable:!0,get:function(){return l}}),e.onDataModeChange=function(n){return s.add(n),()=>{s.delete(n)}},Object.defineProperty(e,"EXAMPLE_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"notEnoughTip",{enumerable:!0,get:function(){return b}});const n=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("abbotsford");let t=n,o=n;const s=new Set;function c(n){o!==(n=t||n)&&(o=n,s.forEach(n=>n()))}const u=()=>o,l=()=>!o;const f='Example figures',b=n=>`Forecasts start once CoverCharge has ${1===n?'1 week':`${n} weeks`} of your bookings and cash-ups.`},1112,[]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AccidentBook=function({me:e,meId:t,now:s,app:a,seeAll:c}){const p=(0,d.useSafety)(e=>e.accidents),[y,x]=(0,n.useState)(c?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,h.jsxs)(o.default,{style:{gap:12},testID:"accident-book",children:[(0,h.jsx)(u.Tabs,{value:y,onChange:x,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:c?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,h.jsx)(j,{me:e,meId:t,now:s,app:a,onSaved:()=>x('list')}):null,'list'===y?(0,h.jsxs)(u.Box,{testID:"accident-list",children:[(c?p:w).length?(c?p:w).map(e=>(0,h.jsx)(b,{a:e,manager:c},e.id)):(0,h.jsx)(l.Muted,{children:"No entries yet."}),!c&&f>0?(0,h.jsx)(o.default,{testID:"accident-others",children:(0,h.jsxs)(l.Muted,{children:[f," other entr",1===f?'y is':'ies are'," in the book. Only managers can see other people\u2019s entries and personal details."]})}):null]}):null,(0,h.jsx)(l.Muted,{children:"In an emergency call 999 first. The accident book is kept on this device for now; nothing is sent or reported to anyone."})]})};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),a=e(r(_d[3])),o=e(r(_d[4])),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]);const p=e=>String(e).padStart(2,'0'),y=e=>`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}T${p(e.getHours())}:${p(e.getMinutes())}`,x=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${p(t.getHours())}:${p(t.getMinutes())}`};function j({me:e,meId:a,now:p,app:x,onSaved:j}){const[b,w]=(0,n.useState)({date:y(p).slice(0,10),time:y(p).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[f,T]=(0,n.useState)(''),[D,I]=(0,n.useState)(''),S=e=>w({...b,...e}),C='Near miss'===b.category,v=(e,s,n,a=!1)=>(0,h.jsxs)(o.default,{style:{gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:e}),(0,h.jsx)(t.TextInput,{accessibilityLabel:e,value:String(b[s]),onChangeText:e=>S({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:a,style:[l.styles.input,a&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,h.jsxs)(u.Box,{testID:"accident-form",children:[(0,h.jsx)(l.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,h.jsxs)(l.Row,{gap:8,children:[(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Date (DD/MM/YYYY)"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Date (DD/MM/YYYY)",...(0,s.slashBox)(b.date,e=>S({date:e})),placeholder:"DD/MM/YYYY",keyboardType:"numbers-and-punctuation",maxLength:10,placeholderTextColor:"#7D776C",style:[l.styles.input,{minWidth:0,width:40}]})]}),(0,h.jsxs)(o.default,{style:{width:110,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Time"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Time",value:b.time,onChangeText:e=>S({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:l.styles.input})]})]}),(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"What kind?"}),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:d.ACCIDENT_CATEGORIES.map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.category===e,onPress:()=>S({category:e})},e))}),v('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),v('Person involved','person','Name'),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.personType===e,onPress:()=>S({personType:e})},e))}),v('What happened','what','Describe what happened, in order',!0),v('Injury','injury',C?'None (near miss)':'e.g. small cut to left thumb'),v('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),v('Witnesses','witnesses','Names, or none'),v('Reported by','reportedBy','Your name'),f?(0,h.jsx)(l.Banner,{kind:"warn",children:f}):null,(0,h.jsx)(l.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(b.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(b.time)?b.category?b.location.trim()&&b.person.trim()&&b.what.trim()?(d.useSafety.getState().addAccident({when:`${b.date}T${b.time}`,location:b.location.trim(),person:b.person.trim(),personType:b.personType,category:b.category,what:b.what.trim(),injury:b.injury.trim()||(C?'None (near miss)':'Not recorded'),firstAid:b.firstAid.trim()||'None recorded',witnesses:b.witnesses.trim()||'None',reportedBy:b.reportedBy.trim()||e,reportedById:a,app:x}),I(`Saved to the accident book: ${b.category}, ${b.location.trim()}.`),T(''),w({...b,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void j()):T('Fill in where it happened, who was involved and what happened.'):T('Pick what kind of accident or near miss it was.'):T('Enter the date as DD/MM/YYYY and the time as HH:MM.')}),D?(0,h.jsx)(o.default,{testID:"accident-saved",children:(0,h.jsx)(l.T,{size:14,colour:c.colours.ok,children:D})}):null,(0,h.jsx)(l.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function b({a:e,manager:s}){const u=d.RIDDOR_CATEGORIES.includes(e.category),[p,y]=(0,n.useState)(e.riddorNote??''),[j,b]=(0,n.useState)(!1);return(0,h.jsxs)(o.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,gap:4},children:[(0,h.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,h.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(l.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,h.jsx)(l.Badge,{kind:'Near miss'===e.category?'blue':u?'red':'amber',label:'Near miss'===e.category?'Near miss':u?'Serious':'Accident'})]}),(0,h.jsxs)(l.Muted,{children:[x(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||s?(0,h.jsxs)(o.default,{style:{gap:2},children:[(0,h.jsxs)(l.T,{size:14,children:["What happened: ",e.what]}),(0,h.jsxs)(l.T,{size:14,children:["Injury: ",e.injury]}),(0,h.jsxs)(l.T,{size:14,children:["First aid: ",e.firstAid]}),(0,h.jsxs)(l.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,s&&u?(0,h.jsxs)(o.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,h.jsx)(l.Banner,{kind:"danger",title:"Consider RIDDOR",children:"This may need reporting to the HSE under RIDDOR (for example a specified injury, over-7-day incapacitation, or a member of the public taken to hospital). Check the HSE\u2019s RIDDOR guidance and decide. CoverCharge never reports anything for you."}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:y,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:l.styles.input}),(0,h.jsx)(l.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>d.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,h.jsxs)(l.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1113,[873,833,31,264,128,817,1320,824,1146,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CREATOR_TITLE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"pounds",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"numIn",{enumerable:!0,get:function(){return v}}),_e.useOwnCosting=P,_e.DishCreator=function({rid:e,canPublish:t,initial:n="create"}){const l=P(),o=(0,d.useGpCalcView)(),[c,p]=(0,i.useState)(n),[g,h]=(0,i.useState)(()=>C(o.settings.defaultTarget));return l?(0,j.jsxs)(r.default,{style:{gap:12},testID:"dish-creator",children:[o.alerts.map(e=>(0,j.jsx)(r.default,{testID:"margin-alert",children:(0,j.jsx)(a.Banner,{kind:"danger",title:`Margin dropped: ${e.ingredient} ${e.change}`,children:(0,j.jsxs)(r.default,{style:{gap:4},children:[e.dishes.map(e=>(0,j.jsxs)(a.T,{size:14,colour:"#FFE3DF",children:[e.name,": ",(0,u.pct)(e.before)," \u2192 ",(0,u.pct)(e.after),e.belowTarget?' \xb7 below target':'']},e.id)),(0,j.jsx)(s.ToastClose,{label:"Dismiss alert",testID:`margin-alert-close-${e.id}`,onPress:()=>o.dismissAlert(e.id),size:"sm",style:{alignSelf:'flex-end'}})]})})},e.id)),(0,j.jsx)(y.Tabs,{value:c,onChange:p,options:[{id:'create',label:g.name&&o.dishes.some(e=>e.id===g.id)?'Edit dish':'Create'},{id:'saved',label:'Saved dishes & GP'},{id:'items',label:'Ingredient prices'},{id:'settings',label:'VAT & rounding'}]}),'create'===c?(0,j.jsx)(S,{draft:g,setDraft:h,onNew:()=>h(C(o.settings.defaultTarget)),onSaved:()=>p('saved')},g.id):null,'saved'===c?(0,j.jsx)(G,{rid:e,canPublish:t,onEdit:e=>{h({...e,allergens:[...e.allergens??[]]}),p('create')}}):null,'items'===c?(0,j.jsx)(M,{}):null,'settings'===c?(0,j.jsx)(z,{}):null,(0,j.jsx)(a.Muted,{children:"Costs are visible to Managers and the Head Chef only. Prices you enter, not supplier quotes."})]}):(0,j.jsx)(r.default,{testID:"dish-creator-no-access",style:{alignItems:'center',paddingVertical:16},children:(0,j.jsx)(a.Muted,{center:!0,children:"Ingredient prices and dish costs are for the Head Chef, owners and managers."})})},_e.NewIngredient=k,Object.defineProperty(_e,"TALL",{enumerable:!0,get:function(){return A}}),_e.Pick=L,_e.Items=M,_e.useCardCosting=function(e,t,s="edit"){const{ingredients:n,settings:l,cardCosts:r}=(0,d.useGpCalcView)(),a=P();return(0,i.useMemo)(()=>{if(!e||!a||!(0,p.cardCostsVisible)(t,s))return null;const i=r?.[e.id];if(!i?.lines.length)return null;const o=(0,u.cardCostSummary)(i,n,l,e.price),d={};return o.lines.forEach(e=>{e.line.recipeIngId&&(d[e.line.recipeIngId]={cost:(d[e.line.recipeIngId]?.cost??0)+e.cost,label:e.label})}),{summary:o,byRecipeIng:d}},[e,t,s,a,n,l,r])},_e.CardGpPanel=function({card:e,actor:s,mode:n="edit"}){const{ingredients:l,settings:o,cardCosts:c,saveCardCost:g}=(0,d.useGpCalcView)(),h=P()&&(0,p.cardCostsVisible)(s.role,n),y=h&&'staff'!==s.role,f=c?.[e.id]??{lines:[],portions:1},C=(0,u.cardCostSummary)(f,l,o,e.price),[I,$]=(0,i.useState)(''),[S,D]=(0,i.useState)(),[R,G]=(0,i.useState)(!1),[B,M]=(0,i.useState)(f.menuPrice?(f.menuPrice/100).toFixed(2):''),[V,z]=(0,i.useState)(!1),[O,F]=(0,i.useState)(null),[E,U]=(0,i.useState)(!f.lines.length),[H,q]=(0,i.useState)(!1),[_,Y]=(0,i.useState)(null!=f.target?String(f.target):'');if(!h)return null;const X=t=>g(e.id,{...d.useGpCalc.getState().cardCosts[e.id]??f,...t}),K=(e,t)=>{if(t){const s=(0,b.suggestAmount)(t.qty,t.unit,e);if(s.qty>0)return s}const s=e.servings?'serving':(0,u.unitsFor)(e.packUnit)[0];return{qty:'serving'===s||'each'===s?1:0,unit:s}},J=(t,s=S)=>{const i=e.ingredients.find(e=>e.id===s),n={ingId:t.id,...K(t,i),...s?{recipeIngId:s}:{}},l=d.useGpCalc.getState().cardCosts[e.id]??f;X({lines:[...l.lines,n]}),$(''),D(void 0),G(!1),q(!1)},Q=(e,t)=>X({lines:f.lines.map((s,i)=>i===e?{...s,...t}:s)}),Z=new Set(f.lines.map(e=>e.recipeIngId).filter(Boolean)),ee=e.ingredients.filter(e=>e.name.trim()&&!Z.has(e.id)),te=ee.map(e=>({ri:e,i:(0,b.matchIngredient)(e.name,l)})).filter(e=>!!e.i),se=C.price?C.price/(1+o.vatPct/100):null,ie=l.filter(e=>!I.trim()||I.trim().toLowerCase().split(/\s+/).some(t=>t.length>2&&e.name.toLowerCase().includes(t))||e.name.toLowerCase().includes(I.trim().toLowerCase())).slice(0,12),ne=T(B),le=C.tone?w[C.tone]:x.colours.muted,re=null!=e.price&&C.price===e.price;return(0,j.jsxs)(r.default,{testID:"card-gp",accessibilityLabel:"GP calculator",style:{width:'100%',gap:10,padding:14,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,backgroundColor:W},children:[(0,j.jsx)(a.T,{size:20,weight:"bold",center:!0,colour:x.colours.gold,accessibilityRole:"header",children:"GP calculator"}),(0,j.jsxs)(a.T,{size:x.font.small,center:!0,colour:x.colours.goldLight,children:["Costs from the price list (latest delivery prices) \xb7 target ",C.target,"% GP"]}),C.price?(0,j.jsxs)(r.default,{testID:"gp-vat-line",accessible:!0,accessibilityLabel:`Menu price ${(0,u.money)(C.price)} including VAT, ${(0,u.money)(se)} without VAT. GP is worked out on the price without VAT.`,style:{alignItems:'center'},children:[(0,j.jsxs)(a.T,{center:!0,weight:"semibold",children:[(0,u.money)(C.price)," inc VAT \xb7 ",(0,u.money)(se)," ex VAT"]}),(0,j.jsxs)(a.T,{size:x.font.small,center:!0,colour:x.colours.muted,children:[C.priceIsSuggested?'Suggested price':f.menuPrice?'The price you typed':'Menu price on the card'," \xb7 GP is on the ex-VAT price"]})]}):null,f.lines.length?(0,j.jsx)(r.default,{testID:"card-gp-lines",style:{gap:8},children:C.lines.map((e,s)=>{const i=l.find(t=>t.id===e.line.ingId);return(0,j.jsxs)(r.default,{testID:"card-gp-line",style:{gap:6,paddingVertical:8,borderTopWidth:s?1:0,borderColor:x.colours.accentBorder},children:[(0,j.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}, ${e.label}, ${i?`${(0,u.money)(e.cost)}, ${(0,u.lineRatesText)((0,u.lineRates)(e.cost,f.portions||1,i))}`:'not on the price list'}`,style:{flexDirection:'row',gap:8,alignItems:'center',minHeight:32},children:[(0,j.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,j.jsx)(a.T,{weight:"medium",children:e.name}),(0,j.jsx)(a.T,{size:x.font.small,colour:x.colours.muted,children:e.label}),i?(0,j.jsx)(a.T,{testID:"card-gp-line-rates",size:x.font.small,colour:x.colours.goldLight,children:(0,u.lineRatesText)((0,u.lineRates)(e.cost,f.portions||1,i))}):null]}),(0,j.jsx)(a.T,{weight:"semibold",colour:i?x.colours.goldLight:x.colours.amber,children:i?(0,u.money)(e.cost):'Removed'})]}),E&&y&&i?(()=>{const n=(0,u.unitsFor)(i.packUnit,i.servings),l=t=>(0,j.jsx)(L,{testID:`gp-unit-${s}-${t}`,label:'serving'===t?(0,u.servingWord)(i,2):(0,u.unitName)(t,2),accessibilityLabel:`${e.name} by ${'serving'===t?(0,u.servingWord)(i,2):(0,u.unitName)(t,2)}`,selected:e.line.unit===t,onPress:()=>Q(s,{unit:t})},t);return(0,j.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,j.jsx)(t.TextInput,{testID:`gp-qty-${s}`,accessibilityLabel:`Amount of ${e.name}`,value:e.line.qty?String(e.line.qty):'',onChangeText:e=>Q(s,{qty:v(e)??0}),placeholder:"amount",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[a.styles.input,A,{width:90,textAlign:'center'}]}),n.slice(0,-1).map(l),(0,j.jsxs)(r.default,{testID:`gp-unit-end-${s}`,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:6},children:[n.slice(-1).map(l),(0,j.jsx)(L,{testID:`gp-remove-${s}`,label:"Remove",accessibilityLabel:`Remove ${e.name} from the costing`,onPress:()=>X({lines:f.lines.filter((e,t)=>t!==s)})})]})]})})():E&&y?(0,j.jsx)(a.Row,{gap:6,style:{justifyContent:'center'},children:(0,j.jsx)(L,{testID:`gp-remove-${s}`,label:"Remove",accessibilityLabel:`Remove ${e.name} from the costing`,onPress:()=>X({lines:f.lines.filter((e,t)=>t!==s)})})}):null]},s)})}):(0,j.jsx)(r.default,{testID:"card-gp-empty",style:{alignItems:'center',paddingVertical:6},children:(0,j.jsxs)(a.T,{center:!0,colour:x.colours.goldLight,children:["Not costed yet.",y?' Add the ingredients from your price list below.':'']})}),y&&f.lines.length?(0,j.jsx)(a.Button,{small:!0,kind:E?'primary':'secondary',testID:"gp-edit",label:E?'Done':'Change amounts or ingredients',accessibilityLabel:E?'Done changing the costing':`Change the costing for ${e.dish}`,onPress:()=>{U(!E),G(!1)}}):null,y&&E?(0,j.jsxs)(r.default,{style:{gap:8,alignItems:'center'},children:[te.length?(0,j.jsx)(a.Button,{testID:"gp-link-all",label:`Link ${te.length} matching price${1===te.length?'':'s'}`,accessibilityLabel:`Link ${te.length} of this card's ingredients to matching items on the price list`,onPress:()=>{const t=d.useGpCalc.getState().cardCosts[e.id]??f;X({lines:[...t.lines,...te.map(({ri:e,i:t})=>({ingId:t.id,...K(t,e),recipeIngId:e.id}))]}),F(`Linked ${te.length} ingredient${1===te.length?'':'s'} to the price list. Check the amounts below.`)},style:{minHeight:52}}):null,ee.length?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(a.T,{size:x.font.small,center:!0,colour:x.colours.muted,children:"Cost this card\u2019s ingredients"}),(0,j.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:ee.slice(0,10).map(e=>(0,j.jsx)(L,{testID:`gp-cost-${e.id}`,label:e.name.split(',')[0].slice(0,28),accessibilityLabel:`Cost ${e.name}`,selected:S===e.id,onPress:()=>{D(e.id),$(e.name.split(/[,(]/)[0].trim()),G(!0)}},e.id))})]}):null,R?(0,j.jsxs)(r.default,{style:{width:'100%',gap:6},children:[(0,j.jsx)(t.TextInput,{testID:"gp-search",accessibilityLabel:"Search ingredient prices",value:I,onChangeText:$,placeholder:"Search the price list",placeholderTextColor:"#7D776C",style:[a.styles.input,A]}),(0,j.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[ie.map(e=>{const t=(0,u.perServing)(e),s=(0,u.perBaseUnit)(e),i=null!=t?`${(0,u.money)(t)} a ${(0,u.servingWord)(e,1)}`:s?`${(0,u.money)(s.pence)} a ${s.per}`:(0,u.money)(e.packPrice);return(0,j.jsx)(L,{testID:`gp-pick-${e.id}`,label:`${e.name} \xb7 ${i}`,accessibilityLabel:`Add ${e.name}, ${i}`,onPress:()=>J(e)},e.id)}),ie.length?null:(0,j.jsx)(a.T,{center:!0,colour:x.colours.muted,children:l.length?'Nothing on the price list matches.':'The price list is empty. Add a price here, or record a delivery.'})]}),H?(0,j.jsx)(k,{initial:I.trim(),onDone:e=>{q(!1);const t=e?d.useGpCalc.getState().ingredients.find(t=>t.id===e):void 0;t&&J(t)}}):(0,j.jsx)(a.Button,{small:!0,testID:"gp-add-price",label:I.trim()?`Add a price for ${I.trim().slice(0,30)}`:'Add a new price',accessibilityLabel:`Add ${I.trim()||'a new ingredient'} to the price list and cost it on this card`,onPress:()=>q(!0)}),(0,j.jsx)(a.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>{G(!1),D(void 0),$(''),q(!1)}})]}):(0,j.jsx)(a.Button,{small:!0,testID:"gp-add",kind:"secondary",label:"Add from ingredient prices",onPress:()=>{G(!0),D(void 0)}}),(0,j.jsxs)(a.Row,{gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(a.T,{style:{alignSelf:'center'},children:"Target GP %"}),(0,j.jsx)(t.TextInput,{testID:"gp-target",accessibilityLabel:`Target GP percent for this dish, now ${C.target}`,value:_,onChangeText:e=>{Y(e);const t=v(e);null!=t&&t>0&&t<95?X({target:t}):e.trim()||X({target:void 0})},placeholder:String(o.defaultTarget),placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[a.styles.input,A,{width:72,textAlign:'center'}]})]}),(0,j.jsxs)(a.Row,{gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(a.T,{style:{alignSelf:'center'},children:"Portions this makes"}),(0,j.jsx)(t.TextInput,{testID:"gp-portions",accessibilityLabel:"Portions this recipe makes",value:String(f.portions||1),onChangeText:e=>X({portions:Math.max(1,Math.round(v(e)??1))}),keyboardType:"number-pad",style:[a.styles.input,A,{width:72,textAlign:'center'}]})]})]}):null,(0,j.jsxs)(a.Row,{wrap:!0,gap:8,children:[(0,j.jsx)(N,{testID:"gp-food-cost",label:"Food cost per portion",value:(0,u.money)(C.perPortion),colour:x.colours.goldLight,sub:(f.portions||1)>1?`Batch ${(0,u.money)(C.batch)} \xf7 ${f.portions}`:C.missing?`${C.missing} line${1===C.missing?'':'s'} not costed`:void 0}),(0,j.jsx)(N,{testID:"gp-suggested",label:`Suggested at ${C.target}% GP`,value:C.suggested?(0,u.money)(C.suggested):'\u2014',colour:x.colours.gold,sub:C.suggested?"inc VAT"+(o.pricePoints?', rounded up':''):'Add amounts first'})]}),y?(0,j.jsxs)(r.default,{style:{gap:6,alignItems:'center'},children:[(0,j.jsx)(a.T,{size:x.font.small,center:!0,colour:x.colours.muted,children:"Your menu price (inc VAT)"}),(0,j.jsxs)(a.Row,{gap:6,style:{justifyContent:'center'},children:[(0,j.jsx)(a.T,{size:24,style:{alignSelf:'center'},children:"\xa3"}),(0,j.jsx)(t.TextInput,{testID:"gp-price",accessibilityLabel:"Your menu price in pounds, including VAT",value:B,onChangeText:e=>{M(e);const t=T(e);null!=t&&t>0?X({menuPrice:t}):e.trim()||X({menuPrice:void 0})},placeholder:C.price?(C.price/100).toFixed(2):'0.00',placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[a.styles.input,{minHeight:56,width:150,fontSize:24,textAlign:'center'}]})]}),(0,j.jsx)(a.T,{size:x.font.small,center:!0,colour:x.colours.muted,children:ne?'GP below uses the price you typed.':e.price?`Blank uses the menu price, ${(0,u.money)(e.price)}.`:'Blank uses the suggested price.'}),C.suggested&&!ne?(0,j.jsx)(a.Button,{small:!0,kind:"ghost",testID:"gp-use-suggested",label:`Use suggested ${(0,u.money)(C.suggested)}`,accessibilityLabel:`Use the suggested price, ${(0,u.money)(C.suggested)}`,onPress:()=>{M((C.suggested/100).toFixed(2)),X({menuPrice:C.suggested})}}):null]}):null,(0,j.jsxs)(a.Row,{wrap:!0,gap:8,children:[(0,j.jsx)(N,{testID:"gp-gp",label:`GP on ${C.price?(0,u.money)(C.price):'the price'}`,value:null!=C.gp?(0,u.pct)(C.gp):'\u2014',colour:le,sub:null!=C.gp?'ok'===C.tone?'On target':'amber'===C.tone?'Just under target':'Below target':void 0}),(0,j.jsx)(N,{testID:"gp-cash",label:"Cash GP per portion",value:null!=C.cashGp?(0,u.money)(C.cashGp):'\u2014',colour:le,sub:C.price?`${(0,u.money)(C.price/(1+o.vatPct/100))} ex VAT`:void 0})]}),(()=>{const e=(0,u.foodCostTargetOf)(C.target),t=null!=C.foodCostPct?(0,u.foodCostTone)(C.foodCostPct,e):null,s=t?w[t]:x.colours.muted,i=C.price&&C.perPortion>0?(0,u.vatAwareGp)(C.perPortion,C.price,o.vatPct):null;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(a.Row,{wrap:!0,gap:8,children:[(0,j.jsx)(N,{testID:"gp-food-cost-pct",label:"Food cost %",value:null!=C.foodCostPct?(0,u.pct)(C.foodCostPct):'\u2014',colour:s,sub:null!=C.foodCostPct?`Target ${e}% \xb7 ${'ok'===t?'on target':'amber'===t?'just over':'over target'}`:`Target ${e}%`}),(0,j.jsx)(N,{testID:"gp-suggested-target",label:`Price for ${e}% food cost`,value:C.suggested?(0,u.money)(C.suggested):'\u2014',colour:x.colours.gold,sub:C.suggested?'inc VAT':'Add amounts first'})]}),i?(0,j.jsxs)(r.default,{testID:"gp-vat-aware",accessible:!0,accessibilityLabel:`VAT ${(0,u.money)(i.vatPence)} of the ${(0,u.money)(C.price)} goes to the tax office. GP on the price without VAT is ${(0,u.pct)(i.gpPct)}. With VAT left in it would wrongly look like ${(0,u.pct)(i.naiveGpPct)}.`,style:{alignItems:'center',gap:2},children:[(0,j.jsxs)(a.T,{size:x.font.small,center:!0,colour:x.colours.goldLight,children:["VAT ",o.vatPct,"%: ",(0,u.money)(i.vatPence)," of each ",(0,u.money)(C.price)," is VAT"]}),(0,j.jsxs)(a.T,{size:x.font.small,center:!0,colour:x.colours.muted,children:["True GP ",(0,u.pct)(i.gpPct)," (ex VAT) \xb7 would look like ",(0,u.pct)(i.naiveGpPct)," with VAT left in"]})]}):null]})})(),y&&C.price&&!re?V?(0,j.jsxs)(r.default,{testID:"gp-menu-confirm",style:{gap:6,alignItems:'center'},children:[(0,j.jsxs)(a.T,{center:!0,colour:x.colours.amber,children:["Put ",(0,u.money)(C.price)," on the menu? The card goes back to Awaiting sign-off until a chef signs it again."]}),(0,j.jsxs)(a.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(a.Button,{small:!0,testID:"gp-menu-yes",label:`Yes, use ${(0,u.money)(C.price)}`,onPress:async()=>{if(C.price)try{await(0,m.recipeCards)().update(e.id,{price:C.price},s),F(`Menu price set to ${(0,u.money)(C.price)}. The card now waits for sign-off again.`),z(!1)}catch(e){F(e?.message??'Could not change the menu price.')}}}),(0,j.jsx)(a.Button,{small:!0,kind:"secondary",label:"Not now",onPress:()=>z(!1)})]})]}):(0,j.jsx)(a.Button,{small:!0,kind:"secondary",testID:"gp-menu",label:`Use ${(0,u.money)(C.price)} on the menu`,accessibilityLabel:`Use ${(0,u.money)(C.price)} as the menu price for ${e.dish}`,onPress:()=>z(!0)}):null,O?(0,j.jsx)(a.T,{center:!0,size:x.font.small,colour:x.colours.goldLight,children:O}):null,(0,j.jsx)(a.T,{size:x.font.small,center:!0,colour:x.colours.muted,children:"GP is worked out on the price without VAT. Only the Head Chef and managers see costs."})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),r=e(_r(_d[6])),a=_r(_d[7]),o=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),y=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]);const f='New dish creator',w={ok:x.colours.ok,amber:x.colours.amber,red:x.colours.red},T=e=>{const t=e.replace(/[\xa3\s]/g,'').replace(',','.');return/^\d+(\.\d{1,2})?$/.test(t)?Math.round(100*Number(t)):null},v=e=>{const t=e.trim().replace(',','.');return/^\d*\.?\d+$/.test(t)?Number(t):null},C=e=>({id:(0,d.gid)('gd'),name:'',lines:[],portions:1,target:e,status:'draft',allergens:[],description:''});function P(){const e=(0,h.useSession)(e=>e.meId),t=(0,g.useOwner)(t=>e?t.staff.find(t=>t.id===e):void 0);return!e||!!t&&t.active&&(0,p.costsAllowedFor)(t)}function I({n:e,title:t,children:s,testID:i}){return(0,j.jsxs)(y.Box,{testID:i,children:[(0,j.jsxs)(a.Row,{gap:10,children:[(0,j.jsx)(r.default,{style:{width:30,height:30,borderRadius:15,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(a.T,{weight:"bold",colour:x.colours.onGold,children:e})}),(0,j.jsx)(a.T,{size:18,weight:"semibold",style:{flex:1},children:t})]}),s]})}function $({label:e,value:t,colour:s=x.colours.text,testID:i,sub:n}){return(0,j.jsxs)(r.default,{testID:i,style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:14,backgroundColor:x.colours.surface2,borderWidth:1,borderColor:x.colours.border,gap:2},children:[(0,j.jsx)(a.Muted,{children:e}),(0,j.jsx)(a.T,{size:30,weight:"bold",colour:s,children:t}),n?(0,j.jsx)(a.Muted,{children:n}):null]})}function S({draft:e,setDraft:n,onNew:l,onSaved:o}){const{ingredients:p,dishes:g,settings:h,saveDish:m}=(0,d.useGpCalcView)(),[b,f]=(0,i.useState)(''),[C,P]=(0,i.useState)(!1),[S,A]=(0,i.useState)(''),[L,R]=(0,i.useState)(e.menuPrice?'price':'gp'),[G,B]=(0,i.useState)(e.menuPrice?(e.menuPrice/100).toFixed(2):''),[M,V]=(0,i.useState)(String(e.target)),[z,W]=(0,i.useState)(String(e.targetX??4)),N=t=>n({...e,...t}),O=g.filter(t=>t.id!==e.id),F=(0,u.portionCost)(e,p,g),E=h.vatPct,U=v(M)??e.target,H=v(z)??4,q='price'===L?T(G):F>0?'gp'===L?(0,u.suggestPrice)(F,U,E,h.pricePoints):(0,u.suggestForMultiple)(F,H,E,h.multipleBasis,h.pricePoints):null,_=q?(0,u.gpOf)(F,q,E):null,Y=q?(0,u.multipleOf)(F,q,E,h.multipleBasis):0,X=_?(0,u.toneFor)(_.gpPct,U):'ok',K=(0,u.suggestAllergens)(e,p,g),J=t=>{const s=p.find(e=>e.id===t),i=t.startsWith('dish:')?'each':(0,u.unitsFor)(s.packUnit,s.servings)[0],l=[...e.lines,{ingId:t,qty:t.startsWith('dish:')?1:0,unit:i}],r={...e,lines:l},a=(0,u.suggestAllergens)(r,p,g);n({...r,allergens:Array.from(new Set([...e.allergens??[],...a]))})},Q=(t,s)=>N({lines:e.lines.map((e,i)=>i===t?{...e,...s}:e)}),Z=p.filter(e=>!b.trim()||e.name.toLowerCase().includes(b.trim().toLowerCase())),ee=t=>{if(!e.name.trim())return A('Give the dish a name first.');if('ready'===t){if(!e.category)return A('Pick a category to make it menu-ready.');if(!e.lines.length||F<=0)return A('Add ingredients with quantities to make it menu-ready.');if(!q)return A('Set a price to make it menu-ready.')}const s='published'===e.status?'published':t;m({...e,name:e.name.trim(),target:U,targetX:H,menuPrice:q??void 0,status:s}),A('ready'===t?`Saved \u201c${e.name.trim()}\u201d as menu-ready. A manager can publish it to the menu.`:`Saved \u201c${e.name.trim()}\u201d as a draft.`)};return(0,j.jsxs)(r.default,{style:{gap:12},children:[(0,j.jsxs)(I,{n:1,title:"Name and category",testID:"step-name",children:[(0,j.jsx)(t.TextInput,{accessibilityLabel:"Dish name",value:e.name,onChangeText:e=>N({name:e.slice(0,60)}),placeholder:"e.g. Cullen skink",placeholderTextColor:"#7D776C",style:[a.styles.input,{fontSize:20}]}),(0,j.jsx)(a.Row,{wrap:!0,gap:6,children:u.DISH_CATEGORIES.map(t=>(0,j.jsx)(a.Chip,{label:t,selected:e.category===t,onPress:()=>N({category:t})},t))})]}),(0,j.jsxs)(I,{n:2,title:"Add saved items and ingredients",testID:"step-ingredients",children:[O.length?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(a.Muted,{children:"Saved items (tap to add a portion)"}),(0,j.jsx)(a.Row,{wrap:!0,gap:6,children:O.map(e=>(0,j.jsx)(a.Chip,{label:`${e.name}`,onPress:()=>J(`dish:${e.id}`)},e.id))})]}):null,(0,j.jsx)(a.Muted,{children:"Ingredients"}),(0,j.jsx)(t.TextInput,{accessibilityLabel:"Search ingredients",value:b,onChangeText:f,placeholder:"Search ingredients",placeholderTextColor:"#7D776C",style:a.styles.input}),(0,j.jsxs)(a.Row,{wrap:!0,gap:6,children:[Z.slice(0,24).map(e=>(0,j.jsx)(a.Chip,{label:`${e.name}`,onPress:()=>J(e.id)},e.id)),(0,j.jsx)(a.Chip,{label:"New ingredient",onPress:()=>P(!0)})]}),C?(0,j.jsx)(k,{initial:b,onDone:e=>{P(!1),f(''),e&&J(e)}}):null,e.lines.length?(0,j.jsx)(r.default,{style:{gap:8},testID:"dish-lines",children:e.lines.map((i,n)=>{const l=i.ingId.startsWith('dish:'),o=p.find(e=>e.id===i.ingId),d=(c=i.ingId).startsWith('dish:')?g.find(e=>e.id===c.slice(5))?.name??'Saved item':p.find(e=>e.id===c)?.name??'?';var c;return(0,j.jsxs)(r.default,{testID:"dish-line",style:{gap:6,padding:10,borderRadius:12,backgroundColor:x.colours.surface2,borderWidth:1,borderColor:x.colours.border},children:[(0,j.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(a.T,{weight:"medium",style:{flex:1},children:[d,l?' (saved item)':'']}),(0,j.jsx)(a.T,{weight:"semibold",children:(0,u.money)((0,u.lineCost)(i,p,g))}),(0,j.jsx)(s.GoldClose,{size:"sm",label:`Remove ${d}`,onPress:()=>N({lines:e.lines.filter((e,t)=>t!==n)})})]}),(0,j.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(t.TextInput,{accessibilityLabel:`Quantity of ${d}`,value:i.qty?String(i.qty):'',onChangeText:e=>Q(n,{qty:v(e)??0}),placeholder:"qty",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[a.styles.input,{width:90}]}),l?(0,j.jsx)(a.Muted,{children:"portion(s)"}):(0,u.unitsFor)(o.packUnit,o.servings).map(e=>(0,j.jsx)(a.Chip,{label:'serving'===e?(0,u.servingWord)(o,2):(0,u.unitName)(e,2),selected:i.unit===e,onPress:()=>Q(n,{unit:e})},e)),l?null:(0,j.jsx)(t.TextInput,{accessibilityLabel:`Waste % for ${d}`,value:null==i.wastePct?'':String(i.wastePct),onChangeText:e=>Q(n,{wastePct:''===e.trim()?void 0:v(e)??0}),placeholder:`waste ${o.wastePct}%`,placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[a.styles.input,{width:110}]})]})]},n)})}):(0,j.jsx)(a.Muted,{children:"Nothing added yet. Tap a saved item or an ingredient above."}),(0,j.jsxs)(a.Row,{gap:10,children:[(0,j.jsx)(a.T,{style:{flex:1},children:"Portions this makes"}),(0,j.jsx)(t.TextInput,{accessibilityLabel:"Portions per batch",value:String(e.portions),onChangeText:e=>N({portions:Math.max(1,Math.round(v(e)??1))}),keyboardType:"number-pad",style:[a.styles.input,{width:80,textAlign:'center'}]})]}),(0,j.jsx)($,{testID:"cost-per-plate",label:"Cost per plate",value:(0,u.money)(F),sub:e.portions>1?`Batch cost ${(0,u.money)(F*e.portions)} \xf7 ${e.portions}`:'Live: updates as you type'})]}),(0,j.jsxs)(I,{n:3,title:"Price it",testID:"step-price",children:[(0,j.jsx)(y.Tabs,{value:L,onChange:R,options:[{id:'gp',label:'Target GP %'},{id:'x',label:'Target multiple'},{id:'price',label:'Type a price'}]}),'gp'===L?(0,j.jsxs)(a.Row,{wrap:!0,gap:6,children:[[65,70,75].map(e=>(0,j.jsx)(a.Chip,{label:`${e}%`,selected:U===e,onPress:()=>V(String(e))},e)),(0,j.jsx)(t.TextInput,{accessibilityLabel:"Target GP %",value:M,onChangeText:V,keyboardType:"decimal-pad",style:[a.styles.input,{width:80}]})]}):null,'x'===L?(0,j.jsxs)(a.Row,{wrap:!0,gap:6,children:[[3,4,5].map(e=>(0,j.jsx)(a.Chip,{label:`${e}x`,selected:H===e,onPress:()=>W(String(e))},e)),(0,j.jsx)(t.TextInput,{accessibilityLabel:"Target multiple",value:z,onChangeText:W,keyboardType:"decimal-pad",style:[a.styles.input,{width:80}]})]}):null,'price'===L?(0,j.jsxs)(a.Row,{gap:8,children:[(0,j.jsx)(a.T,{size:24,children:"\xa3"}),(0,j.jsx)(t.TextInput,{accessibilityLabel:"Menu price (inc VAT)",value:G,onChangeText:B,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[a.styles.input,{width:140,fontSize:24}]}),(0,j.jsx)(a.Muted,{children:"inc VAT"})]}):null,'price'!==L?(0,j.jsxs)(a.Row,{wrap:!0,gap:8,children:[(0,j.jsx)($,{testID:"suggested-price",label:`Suggested menu price (inc ${E}% VAT)`,value:q?(0,u.money)(q):'\u2014',colour:x.colours.gold,sub:q?`${(0,u.money)(q/(1+E/100))} ex VAT${h.pricePoints?' \xb7 rounded up to .50 / .95':''}`:'Add ingredients first'}),q?(0,j.jsx)(a.Button,{small:!0,kind:"secondary",label:"Type my own price",onPress:()=>{B((q/100).toFixed(2)),R('price')}}):null]}):null,(()=>{const t=(0,u.avgMenuPrice)(g,e.category,e.id);return e.category?(0,j.jsx)(r.default,{testID:"avg-menu-price",children:(0,j.jsx)(a.Muted,{children:t?`Average menu price for ${e.category}: ${(0,u.money)(t.avg)} (${t.count} dish${1===t.count?'':'es'})${q?` \xb7 this dish ${q>=t.avg?'+':'\u2212'}${(0,u.money)(Math.abs(q-t.avg))}`:''}`:`No other priced ${e.category.toLowerCase()} yet to compare with.`})}):null})(),(0,j.jsxs)(a.Row,{wrap:!0,gap:8,children:[(0,j.jsx)($,{testID:"big-gp",label:`GP (target ${U}%)`,value:_?(0,u.pct)(_.gpPct):'\u2014',colour:_?w[X]:x.colours.muted}),(0,j.jsx)($,{testID:"big-x",label:`Multiple (${'inc'===h.multipleBasis?'inc VAT price':'ex VAT price'} \xf7 cost)`,value:_&&F>0?(0,u.fmtX)(Y):'\u2014',colour:x.colours.gold}),(0,j.jsx)($,{testID:"big-profit",label:"Profit per plate (cash GP)",value:_?(0,u.money)(_.cashGp):'\u2014',colour:_?w[X]:x.colours.muted}),(0,j.jsx)($,{testID:"big-foodcost",label:"Food cost",value:_?(0,u.pct)(_.foodCostPct):'\u2014'})]}),(0,j.jsxs)(a.Muted,{children:["GP is worked out on the price without VAT (",E,"% VAT). Gold: at or above target \xb7 amber: up to 5 points under \xb7 red: more than 5 under."]})]}),(0,j.jsxs)(I,{n:4,title:"Photo, allergens and description",testID:"step-details",children:[(0,j.jsx)(D,{value:e.photo,onChange:e=>N({photo:e})}),(0,j.jsx)(a.T,{weight:"medium",children:"Allergens (14 UK allergens)"}),K.length?(0,j.jsx)(r.default,{testID:"allergen-suggest",children:(0,j.jsxs)(a.Muted,{children:["Suggested from the ingredients: ",K.map(e=>c.ALLERGENS.find(t=>t.id===e).short).join(', '),". Check before it goes on the menu."]})}):(0,j.jsx)(a.Muted,{children:"No allergens known from these ingredients yet. Tick any that apply."}),(0,j.jsx)(a.Row,{wrap:!0,gap:6,children:c.ALLERGENS.map(t=>{const s=(e.allergens??[]).includes(t.id);return(0,j.jsx)(a.Chip,{label:`${s?'\u2713 ':''}${t.short}`,sub:K.includes(t.id)?'suggested':void 0,selected:s,onPress:()=>N({allergens:s?e.allergens.filter(e=>e!==t.id):[...e.allergens??[],t.id]})},t.id)})}),(0,j.jsx)(t.TextInput,{accessibilityLabel:"Short description",value:e.description??'',onChangeText:e=>N({description:e.slice(0,160)}),multiline:!0,placeholder:"Short description for the menu (up to 160 characters)",placeholderTextColor:"#7D776C",style:[a.styles.input,{minHeight:70,textAlignVertical:'top'}]}),(0,j.jsxs)(a.Muted,{children:[(e.description??'').length,"/160"]})]}),(0,j.jsxs)(I,{n:5,title:"Save",testID:"step-save",children:[(0,j.jsxs)(a.Row,{wrap:!0,gap:8,children:[(0,j.jsx)(a.Button,{label:"Save as draft",kind:"secondary",testID:"save-draft",onPress:()=>ee('draft'),style:{flexGrow:1}}),(0,j.jsx)(a.Button,{label:"Save as menu-ready dish",testID:"save-ready",onPress:()=>ee('ready'),style:{flexGrow:1}})]}),S?(0,j.jsx)(r.default,{testID:"creator-msg",children:(0,j.jsx)(a.T,{size:15,colour:S.startsWith('Saved')?x.colours.ok:x.colours.amber,children:S})}):null,S.startsWith('Saved')?(0,j.jsxs)(a.Row,{gap:8,children:[(0,j.jsx)(a.Button,{small:!0,label:"See saved dishes",onPress:o}),(0,j.jsx)(a.Button,{small:!0,kind:"secondary",label:"Start a new dish",onPress:()=>{l(),A(''),B(''),R('gp')}})]}):null]})]})}function D({value:e,onChange:t}){return(0,j.jsxs)(a.Row,{gap:10,children:[e?(0,j.jsx)(n.default,{testID:"dish-photo",source:{uri:e},style:{width:96,height:72,borderRadius:10}}):(0,j.jsx)(r.default,{style:{width:96,height:72,borderRadius:10,borderWidth:1,borderStyle:'dashed',borderColor:x.colours.border,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(a.Muted,{children:"No photo"})}),(0,j.jsxs)(r.default,{style:{gap:6},children:[(0,j.jsx)(a.Button,{small:!0,kind:"secondary",label:e?'Change photo':'Add photo (optional)',onPress:()=>{if('undefined'==typeof document)return;const e=document.createElement('input');e.type='file',e.accept='image/*',e.onchange=()=>{const s=e.files?.[0];if(!s)return;const i=new FileReader;i.onload=()=>{const e=new window.Image;e.onload=()=>{const s=Math.min(1,480/Math.max(e.width,e.height)),i=document.createElement('canvas');i.width=Math.round(e.width*s),i.height=Math.round(e.height*s),i.getContext('2d').drawImage(e,0,0,i.width,i.height),t(i.toDataURL('image/jpeg',.8))},e.src=String(i.result)},i.readAsDataURL(s)},e.click()}}),e?(0,j.jsx)(a.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>t(void 0)}):null]})]})}function k({initial:e,onDone:s,edit:n}){const[l,o]=(0,i.useState)(n?.name??e),[p,g]=(0,i.useState)(n?String(n.packSize):''),[h,m]=(0,i.useState)(n?.packUnit??'kg'),[y,b]=(0,i.useState)(n?(n.packPrice/100).toFixed(2):''),[f,w]=(0,i.useState)(n?.wastePct?String(n.wastePct):''),[C,P]=(0,i.useState)(n?.allergens??[]),[I,$]=(0,i.useState)(n?.servings?String(n.servings):''),[S,D]=(0,i.useState)(n?.servingName??''),[k,R]=(0,i.useState)(n?.supplier??''),G=!(!l.trim()||!v(p)||null==T(y)||''!==I.trim()&&!v(I)),B={id:'probe',name:l,packSize:v(p)??0,packUnit:h,packPrice:T(y)??0,wastePct:0,servings:v(I)??void 0,servingName:S.trim()||void 0},M=B.packSize&&B.packPrice?(0,u.perBaseUnit)(B):null,V=B.packPrice?(0,u.perServing)(B):null,z={name:l.trim(),packSize:v(p),packUnit:h,packPrice:T(y),wastePct:Math.min(90,v(f)??0),allergens:C,servings:v(I)??void 0,servingName:S.trim().toLowerCase()||void 0,supplier:k.trim()||void 0};return(0,j.jsxs)(r.default,{testID:n?`edit-ingredient-${n.id}`:'new-ingredient',style:{gap:8,padding:12,borderRadius:14,borderWidth:1,borderColor:x.colours.gold,width:'100%'},children:[(0,j.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:n?`Edit ${n.name}`:'New ingredient'}),(0,j.jsx)(t.TextInput,{accessibilityLabel:"Ingredient name",value:l,onChangeText:o,placeholder:"e.g. Haddock",placeholderTextColor:"#7D776C",style:[a.styles.input,A]}),(0,j.jsx)(a.Muted,{center:!0,children:"Pack price and what you get for it, e.g. \xa3110 for 1 stone, or \xa340 for 5 kg"}),(0,j.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,j.jsx)(t.TextInput,{testID:"ing-pack-price",accessibilityLabel:"Pack price in pounds",value:y,onChangeText:b,placeholder:"\xa3 price",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[a.styles.input,A,{width:110,textAlign:'center'}]}),(0,j.jsx)(a.T,{style:{alignSelf:'center'},children:"for"}),(0,j.jsx)(t.TextInput,{testID:"ing-pack-size",accessibilityLabel:"Pack size",value:p,onChangeText:g,placeholder:"size",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[a.styles.input,A,{width:90,textAlign:'center'}]})]}),(0,j.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.PACK_UNITS.map(e=>(0,j.jsx)(L,{testID:`ing-unit-${e}`,label:(0,u.unitName)(e,2),selected:h===e,onPress:()=>m(e)},e))}),(0,j.jsx)(a.Muted,{center:!0,children:"Optional: roughly how many servings or pieces one pack gives"}),(0,j.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,j.jsx)(a.T,{style:{alignSelf:'center'},children:"averages"}),(0,j.jsx)(t.TextInput,{testID:"ing-servings",accessibilityLabel:"Averages how many servings or pieces",value:I,onChangeText:$,placeholder:"e.g. 30",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[a.styles.input,A,{width:90,textAlign:'center'}]}),(0,j.jsx)(t.TextInput,{testID:"ing-serving-name",accessibilityLabel:"What one is called, for example serving, breast or piece",value:S,onChangeText:D,placeholder:"serving / breast",placeholderTextColor:"#7D776C",style:[a.styles.input,A,{width:150,textAlign:'center'}]})]}),M||null!=V?(0,j.jsx)(r.default,{testID:"ing-derived",accessible:!0,accessibilityLabel:[null!=V?`${(0,u.money)(V)} a ${(0,u.servingWord)(B,1)}`:'',M?`${(0,u.money)(M.pence)} a ${M.per}`:''].filter(Boolean).join(', '),children:(0,j.jsx)(a.T,{center:!0,weight:"semibold",colour:x.colours.gold,children:[null!=V?`${(0,u.money)(V)} a ${(0,u.servingWord)(B,1)}`:'',M?`${(0,u.money)(M.pence)} a ${M.per}`:''].filter(Boolean).join(' \xb7 ')})}):null,(0,j.jsx)(t.TextInput,{accessibilityLabel:"Supplier (optional)",value:k,onChangeText:R,placeholder:"Supplier (optional)",placeholderTextColor:"#7D776C",style:[a.styles.input,A]}),(0,j.jsx)(t.TextInput,{accessibilityLabel:"Yield loss or waste percent (optional)",value:f,onChangeText:w,placeholder:"Trim / waste % (optional, for weights)",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[a.styles.input,A]}),(0,j.jsx)(a.Muted,{center:!0,children:"Allergens in this ingredient (if known)"}),(0,j.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.ALLERGENS.map(e=>(0,j.jsx)(a.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>P(C.includes(e.id)?C.filter(t=>t!==e.id):[...C,e.id])},e.id))}),(0,j.jsxs)(a.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(a.Button,{small:!0,testID:"ing-save",label:n?'Save ingredient':'Add ingredient',disabled:!G,onPress:()=>{if(n){const e=d.useGpCalc.getState();z.packPrice!==n.packPrice&&e.addPricePaid(n.id,z.packPrice);const t=d.useGpCalc.getState().ingredients.find(e=>e.id===n.id)??n;e.saveIngredient({...t,...z,packPrice:t.packPrice}),s(n.id)}else s(d.useGpCalc.getState().addIngredient(z))}}),(0,j.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel",onPress:()=>s()})]})]})}const A={minHeight:48};function L({label:e,selected:t,onPress:s,testID:i,accessibilityLabel:n}){return(0,j.jsx)(l.default,{testID:i,accessibilityRole:"button",accessibilityState:{selected:!!t},accessibilityLabel:`${n??e}${t?', selected':''}`,onPress:s,style:{minHeight:48,minWidth:48,paddingHorizontal:14,justifyContent:'center',alignItems:'center',borderRadius:24,borderWidth:1,borderColor:t?x.colours.gold:x.colours.border,backgroundColor:t?x.colours.gold:x.colours.surface2,maxWidth:'100%'},children:(0,j.jsx)(a.T,{size:x.font.small,weight:"medium",center:!0,colour:t?x.colours.onGold:x.colours.text,children:e})})}const R={draft:{label:'Draft',kind:'neutral'},ready:{label:'Menu-ready',kind:'gold'},published:{label:'On the menu',kind:'ok'}};function G({rid:e,canPublish:t,onEdit:s}){const{dishes:n,ingredients:l,settings:c,saveDish:p}=(0,d.useGpCalcView)(),[g,h]=(0,i.useState)('low'),[m,b]=(0,i.useState)(''),f=(0,i.useMemo)(()=>n.map(e=>{const t=(0,u.portionCost)(e,l,n);return{d:e,cost:t,g:e.menuPrice?(0,u.gpOf)(t,e.menuPrice,c.vatPct):null,x:e.menuPrice?(0,u.multipleOf)(t,e.menuPrice,c.vatPct,c.multipleBasis):0}}).sort((e,t)=>(e.g?e.g.gpPct:999)-(t.g?t.g.gpPct:999)),[n,l,c]),T='low'===g?f:[...f].reverse(),v=f.filter(e=>e.g&&e.g.gpPct{const s={};(t.allergens??[]).forEach(e=>{s[e]='contains'});const i=o.useStore.getState().addMenuItem({restaurantId:e,section:t.category??'Specials',name:t.name,description:t.description??'',price:t.menuPrice??null,dietary:[],allergens:s,prepMins:12,soldOut:!1,signOff:null});p({...t,status:'published',menuItemId:i}),b(`Published \u201c${t.name}\u201d to the menu (${t.category??'Specials'}). It needs allergen sign-off in Menu & allergens.`)};return(0,j.jsxs)(y.Box,{testID:"menu-gp",children:[(0,j.jsx)(a.T,{size:18,weight:"semibold",children:"Saved dishes and items \xb7 Menu GP"}),(0,j.jsxs)(a.Muted,{children:[f.length," saved \xb7 ",v," below target \xb7 multiples on the ",'inc'===c.multipleBasis?'inc-VAT menu price':'ex-VAT price']}),(0,j.jsxs)(a.Row,{gap:6,children:[(0,j.jsx)(a.Chip,{label:"Lowest GP first",selected:'low'===g,onPress:()=>h('low')}),(0,j.jsx)(a.Chip,{label:"Highest GP first",selected:'high'===g,onPress:()=>h('high')})]}),T.map(({d:e,cost:i,g:n,x:l})=>{const o=n?(0,u.toneFor)(n.gpPct,e.target):null;return(0,j.jsxs)(r.default,{testID:"gp-row",style:{paddingVertical:10,borderTopWidth:1,borderColor:x.colours.border,gap:4},children:[(0,j.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,j.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,j.jsx)(a.T,{weight:"semibold",children:e.name}),(0,j.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(a.Badge,{kind:R[e.status??'draft'].kind,label:R[e.status??'draft'].label}),e.category?(0,j.jsx)(a.Muted,{children:e.category}):null]}),(0,j.jsxs)(a.Muted,{children:["Cost ",(0,u.money)(i),e.menuPrice?` \xb7 price ${(0,u.money)(e.menuPrice)}`:' \xb7 no price yet']})]}),(0,j.jsxs)(r.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(a.T,{size:22,weight:"bold",colour:o?w[o]:x.colours.muted,children:n?(0,u.pct)(n.gpPct):'\u2014'}),(0,j.jsx)(a.T,{size:16,weight:"semibold",colour:x.colours.gold,children:n&&i>0?(0,u.fmtX)(l):''})]})]}),n&&n.gpPcts(e)}),t&&'ready'===e.status?(0,j.jsx)(a.Button,{small:!0,label:"Publish to menu",accessibilityLabel:`Publish ${e.name} to menu`,onPress:()=>C(e)}):null,t||'ready'!==e.status?null:(0,j.jsx)(a.Muted,{children:"Waiting for a manager to publish"})]})]},e.id)}),m?(0,j.jsx)(r.default,{testID:"publish-msg",children:(0,j.jsx)(a.T,{size:14,colour:x.colours.ok,children:m})}):null]})}function B(){const{settings:e,setSettings:t}=(0,d.useGpCalcView)(),s=e.priceBasis??'latest',i=e.avgOf??5;return(0,j.jsxs)(r.default,{testID:"price-basis",style:{gap:6},children:[(0,j.jsx)(a.T,{weight:"medium",children:"Cost dishes using"}),(0,j.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(a.Chip,{label:"Latest price paid",selected:'latest'===s,onPress:()=>t({priceBasis:'latest'})}),(0,j.jsx)(a.Chip,{label:`Average price (last ${i})`,selected:'average'===s,onPress:()=>t({priceBasis:'average'})})]}),'average'===s?(0,j.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(a.Muted,{children:"Average of the last"}),[3,5,10].map(e=>(0,j.jsx)(a.Chip,{label:`${e} prices`,selected:i===e,onPress:()=>t({avgOf:e})},e))]}):null,(0,j.jsx)(a.Muted,{children:'average'===s?'Averages smooth out price swings, so GP doesn\u2019t jump every delivery.':'Uses the most recent price you paid.'})]})}function M(){const{ingredients:e,dishes:s,settings:n,cardCosts:l}=(0,d.useGpCalcView)(),[o,c]=(0,i.useState)(''),[u,p]=(0,i.useState)(''),[g,h]=(0,i.useState)(!1),m=e.filter(e=>!u.trim()||`${e.name} ${e.supplier??''}`.toLowerCase().includes(u.trim().toLowerCase())).slice().sort((e,t)=>e.name.localeCompare(t.name));return(0,j.jsxs)(y.Box,{testID:"calc-items",children:[(0,j.jsx)(a.T,{size:18,weight:"semibold",center:!0,accessibilityRole:"header",children:"Ingredient prices"}),(0,j.jsx)(a.Muted,{center:!0,children:"What you pay and what a pack gives you. Recipe cards and dishes cost themselves from this list and update when a price changes."}),(0,j.jsx)(a.Button,{testID:"ing-add-new",label:"Add an ingredient",onPress:()=>{h(!0),c('')}}),g?(0,j.jsx)(k,{initial:u,onDone:e=>{h(!1),e&&c('Added to the price list.')}}):null,(0,j.jsx)(t.TextInput,{accessibilityLabel:"Search ingredient prices",value:u,onChangeText:p,placeholder:"Search ingredients or suppliers",placeholderTextColor:"#7D776C",style:[a.styles.input,A]}),(0,j.jsx)(B,{}),m.map(e=>{return(0,j.jsx)(V,{i:e,n:n.avgOf??5,basis:n.priceBasis??'latest',used:(t=e.id,s.filter(e=>e.lines.some(e=>e.ingId===t)).length+Object.values(l??{}).filter(e=>e.lines.some(e=>e.ingId===t)).length),onSaved:e=>c(e)},e.id);var t}),m.length?null:(0,j.jsx)(r.default,{testID:"ing-empty",style:{alignItems:'center',paddingVertical:12},children:(0,j.jsx)(a.T,{center:!0,colour:x.colours.muted,children:e.length?'No ingredients match.':'No ingredient prices yet. Add the first one above.'})}),o?(0,j.jsx)(r.default,{testID:"items-msg",children:(0,j.jsx)(a.T,{size:14,center:!0,colour:x.colours.ok,children:o})}):null]})}function V({i:e,used:s,n:n,basis:l,onSaved:o}){const[c,p]=(0,i.useState)(String(e.wastePct)),[g,h]=(0,i.useState)(''),[m,y]=(0,i.useState)(!1),[b,f]=(0,i.useState)(!1),w=(0,u.priceStats)(e,n),C=c!==String(e.wastePct),P=T(g),I=(0,u.perBaseUnit)(e),$=(0,u.perServing)(e),S=`${e.name}, ${(0,u.money)(e.packPrice)} for ${e.packSize} ${(0,u.unitName)(e.packUnit,e.packSize)}${e.servings?`, averages ${e.servings} ${(0,u.servingWord)(e,e.servings)}, ${(0,u.money)($)} a ${(0,u.servingWord)(e,1)}`:''}${I?`, ${(0,u.money)(I.pence)} a ${I.per}`:''}${e.supplier?`, from ${e.supplier}`:''}`;return m?(0,j.jsx)(k,{initial:"",edit:e,onDone:t=>{y(!1),t&&o(`Saved ${e.name}. Recipe cards and dishes re-costed.`)}}):(0,j.jsxs)(r.default,{testID:`item-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:x.colours.border,gap:6},children:[(0,j.jsxs)(r.default,{accessible:!0,accessibilityLabel:S,style:{gap:2},children:[(0,j.jsx)(a.T,{weight:"semibold",size:18,center:!0,children:e.name}),(0,j.jsxs)(a.T,{testID:`pack-${e.id}`,center:!0,colour:x.colours.goldLight,children:[(0,u.money)(e.packPrice)," for ",e.packSize," ",(0,u.unitName)(e.packUnit,e.packSize),e.servings?` \xb7 averages ${e.servings} ${(0,u.servingWord)(e,e.servings)}`:'']}),(0,j.jsx)(a.T,{testID:`derived-${e.id}`,center:!0,weight:"semibold",colour:x.colours.gold,children:[null!=$?`${(0,u.money)($)} a ${(0,u.servingWord)(e,1)}`:'',I?`${(0,u.money)(I.pence)} a ${I.per}`:''].filter(Boolean).join(' \xb7 ')}),(0,j.jsx)(a.Muted,{center:!0,children:[s?`used in ${s}`:'not used yet',e.supplier,e.updatedAt?`updated ${new Date(e.updatedAt).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}`:''].filter(Boolean).join(' \xb7 ')})]}),(0,j.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,j.jsxs)(r.default,{testID:`latest-${e.id}`,style:{paddingHorizontal:10,paddingVertical:6,borderRadius:10,backgroundColor:x.colours.surface2,borderWidth:1,borderColor:'latest'===l?x.colours.gold:x.colours.border},children:[(0,j.jsx)(a.Muted,{children:"Latest"}),(0,j.jsx)(a.T,{weight:"bold",children:(0,u.money)(w.latest)})]}),(0,j.jsxs)(r.default,{testID:`avg-${e.id}`,style:{paddingHorizontal:10,paddingVertical:6,borderRadius:10,backgroundColor:x.colours.surface2,borderWidth:1,borderColor:'average'===l?x.colours.gold:x.colours.border},children:[(0,j.jsxs)(a.Muted,{children:["Average (",w.count,")"]}),(0,j.jsx)(a.T,{weight:"bold",colour:x.colours.gold,children:(0,u.money)(w.avg)})]}),w.count>1?(0,j.jsxs)(r.default,{style:{paddingHorizontal:10,paddingVertical:6},children:[(0,j.jsx)(a.Muted,{children:"Range"}),(0,j.jsxs)(a.T,{size:14,children:[(0,u.money)(w.min),"\u2013",(0,u.money)(w.max)]})]}):null]}),(0,j.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,j.jsx)(a.T,{style:{alignSelf:'center'},children:"\xa3"}),(0,j.jsx)(t.TextInput,{accessibilityLabel:`Price paid for ${e.name}`,value:g,onChangeText:h,placeholder:"price paid",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[a.styles.input,A,{width:110}]}),(0,j.jsx)(a.Button,{small:!0,label:"Add price paid",testID:`add-price-${e.id}`,disabled:!P,onPress:()=>{d.useGpCalc.getState().addPricePaid(e.id,P),h(''),o(`Recorded ${(0,u.money)(P)} for ${e.name}. Dishes re-costed.`)}})]}),(0,j.jsxs)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,j.jsx)(t.TextInput,{accessibilityLabel:`Waste % for ${e.name}`,value:c,onChangeText:p,keyboardType:"decimal-pad",style:[a.styles.input,A,{width:60}]}),(0,j.jsx)(a.T,{style:{alignSelf:'center'},children:"% waste"}),C?(0,j.jsx)(a.Button,{small:!0,label:"Save",disabled:null==v(c),onPress:()=>{d.useGpCalc.getState().saveIngredient({...e,wastePct:Math.min(90,v(c))}),o(`Saved ${e.name}. Dishes updated.`)}}):null]}),(0,j.jsxs)(a.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(a.Button,{small:!0,kind:"secondary",testID:`ing-edit-${e.id}`,label:"Edit",accessibilityLabel:`Edit ${e.name}`,onPress:()=>y(!0)}),b?null:(0,j.jsx)(a.Button,{small:!0,kind:"ghost",testID:`ing-delete-${e.id}`,label:"Delete",accessibilityLabel:`Delete ${e.name}`,onPress:()=>f(!0)})]}),b?(0,j.jsxs)(r.default,{testID:`ing-delete-confirm-${e.id}`,style:{gap:6,alignItems:'center'},children:[(0,j.jsxs)(a.T,{center:!0,colour:x.colours.amber,children:["Delete ",e.name," from the price list?",s?` ${s} ${1===s?'dish or card uses':'dishes or cards use'} it and will show it as removed.`:'']}),(0,j.jsxs)(a.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,j.jsx)(a.Button,{small:!0,kind:"danger",testID:`ing-delete-yes-${e.id}`,label:"Yes, delete",accessibilityLabel:`Yes, delete ${e.name}`,onPress:()=>{d.useGpCalc.getState().removeIngredient(e.id),o(`Deleted ${e.name}.`)}}),(0,j.jsx)(a.Button,{small:!0,kind:"secondary",label:"Keep it",onPress:()=>f(!1)})]})]}):null]})}function z(){const{settings:e,setSettings:s}=(0,d.useGpCalcView)(),[n,l]=(0,i.useState)(String(e.vatPct)),[r,o]=(0,i.useState)(String(e.defaultTarget));return(0,j.jsxs)(y.Box,{testID:"calc-settings",children:[(0,j.jsx)(a.T,{size:18,weight:"semibold",children:"VAT and rounding"}),(0,j.jsxs)(a.Row,{gap:8,children:[(0,j.jsx)(a.T,{style:{flex:1},children:"VAT rate %"}),(0,j.jsx)(t.TextInput,{accessibilityLabel:"VAT rate %",value:n,onChangeText:e=>{l(e);const t=v(e);null!=t&&t<=50&&s({vatPct:t})},keyboardType:"decimal-pad",style:[a.styles.input,{width:80}]})]}),(0,j.jsx)(B,{}),(0,j.jsx)(a.Toggle,{label:"Round suggested prices up to .50 / .95",value:e.pricePoints,onChange:e=>s({pricePoints:e})}),(0,j.jsxs)(a.Row,{gap:8,children:[(0,j.jsx)(a.T,{style:{flex:1},children:"Default target GP %"}),(0,j.jsx)(t.TextInput,{accessibilityLabel:"Default target GP %",value:r,onChangeText:e=>{o(e);const t=v(e);null!=t&&t<95&&s({defaultTarget:t})},keyboardType:"decimal-pad",style:[a.styles.input,{width:80}]})]}),(0,j.jsx)(a.T,{weight:"medium",children:"Cost multiple (x) is based on"}),(0,j.jsxs)(a.Row,{gap:6,children:[(0,j.jsx)(a.Chip,{label:"Inc VAT (menu price)",selected:'inc'===e.multipleBasis,onPress:()=>s({multipleBasis:'inc'})}),(0,j.jsx)(a.Chip,{label:"Ex VAT",selected:'ex'===e.multipleBasis,onPress:()=>s({multipleBasis:'ex'})})]}),(0,j.jsx)(a.Muted,{children:"GP % uses the ex-VAT price. The price multiple is the menu price divided by ingredient cost."})]})}const W='#3A2F1E';function N({label:e,value:t,colour:s=x.colours.text,testID:i,sub:n,said:l}){return(0,j.jsxs)(r.default,{testID:i,accessible:!0,accessibilityLabel:l??`${e}, ${t}${n?`, ${n}`:''}`,style:{flexGrow:1,flexBasis:128,minWidth:0,padding:10,borderRadius:14,backgroundColor:x.colours.surface,borderWidth:1,borderColor:x.colours.accentBorder,alignItems:'center',gap:2},children:[(0,j.jsx)(a.T,{size:x.font.small,center:!0,colour:x.colours.muted,children:e}),(0,j.jsx)(a.T,{size:28,weight:"bold",center:!0,colour:s,children:t}),n?(0,j.jsx)(a.T,{size:x.font.small,center:!0,colour:x.colours.muted,children:n}):null]})}},1114,[873,835,31,197,123,264,128,817,878,1209,818,1297,808,861,865,839,824,1146,1298,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MissedBanner=T,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s,rid:i}){const[l,d]=(0,r.useState)('today'),c=(e,t)=>({id:e,label:t}),p='chef'===s?[c('today','Today'),c('units','Fridges & units'),c('record','Quick entry'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:'managers'===s?[c('today','Today'),c('units','Fridges & units'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:[c('today','Today'),c('record','Quick entry'),c('diary','Diary'),c('history','My entries')],m={me:e,meId:t,now:n,mode:s},x=(0,j.useMaySendInspectorLog)(m);x&&p.splice(p.findIndex(e=>'report'===e.id)+1,0,c('inspector','Inspector'));return p.splice(1,0,c('cooksafe','CookSafe records')),(0,v.jsxs)(u.default,{style:{gap:12},testID:"haccp-log",children:[(0,v.jsx)(o.TempSaveBanner,{}),'today'!==l?(0,v.jsx)(T,{mode:s,now:n,onPress:()=>d('today')}):null,(0,v.jsx)(b.Tabs,{value:l,onChange:d,options:p}),'today'===l?(0,v.jsx)(f.TodayView,{who:m}):null,'cooksafe'===l?(0,v.jsx)(w.CookSafeRecords,{who:m,rid:i}):null,'units'===l?(0,v.jsx)(f.UnitsView,{who:m}):null,'record'===l?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(D,{who:m}),(0,v.jsx)(P,{who:m})]}):null,'diary'===l?(0,v.jsx)(f.DiaryView,{who:m}):null,'weekly'===l?(0,v.jsx)(f.WeeklyView,{who:m}):null,'report'===l?(0,v.jsx)(f.ReportView,{who:m}):null,'inspector'===l&&x?(0,v.jsx)(j.InspectorView,{who:m}):null,'history'===l?(0,v.jsx)(R,{who:m}):null,'limits'===l?(0,v.jsx)(L,{mode:s,editable:'chef'===s}):null,'probes'===l?(0,v.jsx)(A,{mode:s,me:e,now:n}):null,(0,v.jsx)(h.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. This is your CookSafe log (Food Standards Scotland): cross-contamination and allergens, cleaning, chilled storage and cooling, cooking, reheating and hot holding, management and records. Shared with every device at the venue: a reading taken offline sends by itself when the connection is back."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=e(_r(_d[7])),c=e(_r(_d[8])),u=e(_r(_d[9])),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]),b=_r(_d[15]),f=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),C=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),S=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function T({now:e,onPress:t,mode:n="managers"}){const o=(0,s.useSafetyView)(n).points,i=(0,s.useSafetyView)(n).entries,l=(0,m.missedChecks)(o,i,e);if(!l.length)return(0,v.jsx)(u.default,{testID:"haccp-uptodate",children:(0,v.jsx)(h.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const r=(0,v.jsx)(u.default,{testID:"haccp-missed",children:(0,v.jsx)(h.Banner,{kind:"warn",title:`${l.length} food safety check${1===l.length?'':'s'} overdue`,children:l.map(e=>`${e.point.name} (due ${e.due})`).join(' \xb7 ')})});return t?(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:r}):r}function I(e,t){p.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,i.chefCanSee)(l.useOwner.getState().site,t.point)).map(t=>{const n=(0,m.isTempKind)(t.point.kind)?(0,m.inRange)(t.point,t.value):!!t.done;return{pointId:t.point.id,name:t.point.name,kind:t.point.kind,at:e.now.toISOString(),by:e.me.replace(' (example)',''),byId:e.meId,app:e.mode,value:t.value,done:t.done,ok:n,corrective:t.corrective?.trim()||void 0,note:t.note?.trim()||void 0,source:t.source,initials:(0,m.initialsOf)(e.me)}}))}function D({who:e}){const o=(0,s.useSafetyView)(e.mode).points,[d,p]=(0,r.useState)(''),[y,f]=(0,r.useState)(null),[j,w]=(0,r.useState)(''),[k,C]=(0,r.useState)(!1),[T,D]=(0,r.useState)(!1),P=(0,r.useRef)(null),R=(t,n)=>{if('chef'===e.mode&&!(0,i.chefCanSee)(l.useOwner.getState().site,t))return f(null),void w('That check is managed in the Managers app.');const s=(0,m.parseQuick)(t,o);D(n),w(''),f(s.map((e,t)=>({key:`${t}-${e.text}`,text:e.text,pointId:e.point?.id,value:null==e.value?'':String(e.value),done:!(!e.point||(0,m.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},B=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),L=(y??[]).map(e=>{const t=o.find(t=>t.id===e.pointId),n=S(e.value),s=!!t&&(0,m.isTempKind)(t.kind),i=!!t&&(s?null!=n:void 0!==e.done),l=t?s?null!=n?(0,m.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:i,ok:l,needsAction:!1===l&&!e.corrective.trim()}}),$=L.length>0&&L.every(e=>e.ready&&!e.needsAction);return(0,v.jsxs)(b.Box,{testID:"haccp-quick",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,v.jsx)(h.Muted,{children:"For example \u201cprep fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:d,onChangeText:p,placeholder:"prep fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>R(d,!1),style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void P.current?.stop();const t=new e;P.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';p(t),t&&R(t,!0)},t.onerror=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>C(!1);try{t.start(),C(!0)}catch{w("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:k?x.colours.gold:'transparent'},children:(0,v.jsx)(h.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,v.jsx)(h.Button,{label:"Check readings",disabled:!d.trim(),onPress:()=>R(d,!1)}),j?(0,v.jsx)(u.default,{testID:"haccp-quick-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:j})}):null,y?(0,v.jsxs)(u.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,v.jsxs)(h.T,{weight:"semibold",children:["Check these ",y.length," reading",1===y.length?'':'s']}),L.map(({d:e,point:s,temp:i,ok:l,needsAction:r})=>(0,v.jsxs)(u.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===l?x.colours.red:x.colours.border,backgroundColor:x.colours.surface2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(h.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,v.jsx)(n.GoldClose,{size:"sm",label:`Remove ${s?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key))})]}),s?(0,v.jsxs)(h.T,{weight:"semibold",children:[s.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 safe: ",(0,m.limitText)(s)]})]}):(0,v.jsxs)(u.default,{style:{gap:6},children:[(0,v.jsx)(h.T,{colour:x.colours.amber,children:e.problem}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(t=>(0,v.jsx)(h.Chip,{label:t.name,onPress:()=>B(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),s&&i?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${s.name}`,value:e.value,onChangeText:t=>B(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:96,fontSize:20}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===l?(0,v.jsx)(h.Badge,{kind:"amber",label:"Type the reading"}):(0,v.jsx)(h.Badge,{kind:l?'ok':'red',label:l?'OK':'OUT OF RANGE'})]}):null,s&&!i?(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===e.done,onPress:()=>B(e.key,{done:!0})}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>B(e.key,{done:!1})})]}):null,!1===l?(0,v.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${s.name}`,value:e.corrective,onChangeText:t=>B(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[h.styles.input,r&&{borderColor:x.colours.red}]}):null,r?(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:`Save ${L.length} reading${1===L.length?'':'s'}`,testID:"haccp-save-quick",disabled:!$,onPress:()=>{I(e,L.map(e=>({point:e.point,value:e.temp?e.v:void 0,done:e.temp?void 0:e.d.done,corrective:e.d.corrective,source:T?'voice':'typed'}))),w(`Saved ${L.length} reading${1===L.length?'':'s'}.`),f(null),p('')},style:{flex:1}}),(0,v.jsx)(h.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),w('Nothing saved.')}})]}),(0,v.jsx)(h.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function P({who:e}){const n=(0,s.useSafetyView)(e.mode).points,[o,i]=(0,r.useState)(n[0]?.id),[l,d]=(0,r.useState)(''),[c,u]=(0,r.useState)(),[p,y]=(0,r.useState)(''),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),C=n.find(e=>e.id===o),T=!!C&&(0,m.isTempKind)(C.kind),D=S(l),P=C?T?null==D?null:(0,m.inRange)(C,D):void 0===c?null:c:null,R=null!==P&&(P||p.trim());return(0,v.jsxs)(b.Box,{testID:"haccp-manual",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Record one check"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:n.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:e.id===o,onPress:()=>{i(e.id),d(''),u(void 0),y(''),k('')}},e.id))}),C?(0,v.jsxs)(h.Muted,{children:[m.KIND_LABEL[C.kind]," \xb7 safe: ",(0,m.limitText)(C)]}):null,T?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:l,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:110,fontSize:22}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===P?null:(0,v.jsx)(h.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===c,onPress:()=>u(!0)}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===c,onPress:()=>u(!1)})]}),!1===P?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(h.Banner,{kind:"danger",title:T?'Out of range':'Check not done',children:"Write what you did about it before saving (e.g. moved food, discarded, called the engineer, re-checked in 30 minutes)."}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:p,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:h.styles.input})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:f,onChangeText:j,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{I(e,[{point:C,value:T?D:void 0,done:T?void 0:c,corrective:p,note:f,source:'typed'}]),d(''),u(void 0),y(''),j(''),k(`Saved: ${C.name}.`)}}),w?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:w}):null]})}function R({who:e}){const t=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).allPoints,[o,i]=(0,r.useState)('7'),[l,d]=(0,r.useState)('all'),[c,p]=(0,r.useState)(!1),[y,f]=(0,r.useState)(''),j='staff'===e.mode,w=(0,r.useMemo)(()=>{const n=new Date(e.now);n.setHours(0,0,0,0);const s='today'===o?n.getTime():'all'===o?0:e.now.getTime()-864e5*Number(o);return t.filter(t=>!(j&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==l&&t.kind!==l||c&&t.ok))},[t,o,l,c,j,e.meId,e.now.getTime()]),k=Array.from(new Set(n.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,v.jsxs)(b.Box,{testID:"haccp-history",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:j?'My entries':'Food safety log'}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,v.jsx)(h.Chip,{label:t,selected:o===e,onPress:()=>i(e)},e))}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"All checks",selected:'all'===l,onPress:()=>d('all')}),k.map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:l===e,onPress:()=>d(e)},e))]}),(0,v.jsx)(h.Toggle,{label:"Out of range only",value:c,onChange:p}),(0,v.jsx)(u.default,{testID:"haccp-count",children:(0,v.jsxs)(h.Muted,{children:[w.length," entr",1===w.length?'y':'ies',w.filter(e=>!e.ok).length?` \xb7 ${w.filter(e=>!e.ok).length} out of range`:'']})}),w.length?w.slice(0,200).map(e=>(0,v.jsx)(B,{e:e},e.id)):(0,v.jsx)(h.Muted,{children:"No entries for these filters yet."}),j?null:(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,v.jsx)(h.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!w.length,onPress:()=>f((0,b.downloadText)(`food-safety-log-${C}.csv`,(0,m.toCsv)(w,n))?`CSV downloaded: ${w.length} entries.`:'Downloads work in the web app.')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!w.length,onPress:()=>f((0,b.printTable)('Food safety log (HACCP)',`${w.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,m.LOG_HEAD,(0,m.logRows)(w,n))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),y?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:y}):null]})}function B({e:e}){return(0,v.jsxs)(u.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border,gap:2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,v.jsx)(h.T,{size:17,weight:"bold",colour:e.ok?x.colours.ok:x.colours.red,children:(0,m.fmtEntryValue)(e)})]}),(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,v.jsxs)(h.Muted,{style:{flex:1},children:[C(e.at)," ",k(e.at)," \xb7 ",e.initials??(0,m.initialsOf)(e.by)," ",e.by,'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 probe':'',e.ok?'':' \xb7 OUT OF RANGE']})]}),e.corrective?(0,v.jsxs)(h.T,{size:13,colour:x.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,v.jsxs)(h.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,v.jsx)(d.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function L({editable:e,mode:t}){const n=(0,s.useSafetyView)(t).points,[o,i]=(0,r.useState)('');return(0,v.jsxs)(b.Box,{testID:"haccp-limits",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,v.jsx)(h.Muted,{children:e?'Set the limits from your own HACCP plan. Leave min or max empty if it doesn\u2019t apply. Due times are daily reminders (24 h, comma separated).':'Set by the Head Chef in CoverCharge for Head Chef.'}),n.map(t=>(0,v.jsx)($,{p:t,editable:e,onSaved:()=>i(`Saved limits for ${t.name}.`)},t.id)),e?(0,v.jsx)(z,{onAdded:e=>i(`Added ${e}.`)}):null,o?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:o}):null]})}function $({p:e,editable:n,onSaved:s}){const[o,i]=(0,r.useState)(null==e.min?'':String(e.min)),[l,d]=(0,r.useState)(null==e.max?'':String(e.max)),[c,y]=(0,r.useState)(e.due.join(', ')),b=(0,m.isTempKind)(e.kind),f=''===c.trim()||c.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),j=o!==(null==e.min?'':String(e.min))||l!==(null==e.max?'':String(e.max))||c!==e.due.join(', '),w=f&&(''===o||null!=S(o))&&(''===l||null!=S(l));return n?(0,v.jsxs)(u.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border},testID:`limit-${e.id}`,children:[(0,v.jsxs)(h.T,{weight:"medium",children:[e.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 ",m.KIND_LABEL[e.kind]]})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[b?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:i,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]}),(0,v.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:l,onChangeText:d,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:c,onChangeText:y,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:140,width:40}]}),j?(0,v.jsx)(h.Button,{small:!0,label:"Save",disabled:!w,onPress:()=>{p.useSafety.getState().setPoint(e.id,{min:''===o?void 0:S(o),max:''===l?void 0:S(l),due:c.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),f?null:(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,v.jsx)(h.T,{size:14,style:{flex:1},children:e.name}),(0,v.jsxs)(h.Muted,{children:[(0,m.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function z({onAdded:e}){const[n,s]=(0,r.useState)(''),[o,d]=(0,r.useState)('fridge');return(0,v.jsxs)(u.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsx)(h.T,{weight:"medium",children:"Add a check point"}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:s,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(m.KIND_LABEL).map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:e===o,onPress:()=>d(e)},e))}),(0,v.jsx)(h.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,i.chefCanSee)(l.useOwner.getState().site,n),onPress:()=>{if(!(0,i.chefCanSee)(l.useOwner.getState().site,n))return;const t='fridge'===o?{max:5}:'freezer'===o?{max:-18}:'cook'===o?{min:75}:'hothold'===o?{min:63}:'cool'===o||'delivery'===o?{max:8}:{};p.useSafety.getState().addPoint({name:n.trim(),kind:o,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),s('')}})]})}function A({me:e,now:n,mode:o}){const d=(0,s.useSafetyView)(o).probes??[],c=(0,s.useSafetyView)(o).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[m,y]=(0,r.useState)(!1),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),[C,S]=(0,r.useState)(null),[T,I]=(0,r.useState)(''),D=c.find(e=>e.id===w);return(0,v.jsxs)(b.Box,{testID:"haccp-probes",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,v.jsx)(h.Muted,{children:"Wireless fridge and freezer probes. Once a probe is connected, its readings go into the food safety log tagged \u201cprobe\u201d with the time they were taken. Out-of-range probe readings still need a corrective action from a person."}),d.length?d.map(e=>(0,v.jsxs)(u.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(u.default,{style:{flex:1,gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",children:e.name}),(0,v.jsx)(h.Muted,{children:e.location})]}),(0,v.jsx)(h.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>p.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,v.jsxs)(u.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Connect your probe"}),(0,v.jsxs)(h.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,v.jsx)(h.T,{size:14,children:"2. Keep this device near the probe."}),(0,v.jsx)(h.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,v.jsx)(u.default,{testID:"probes-empty",children:(0,v.jsx)(h.Muted,{children:"No probes yet."})}),T?(0,v.jsx)(u.default,{testID:"probe-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:T})}):null,m?(0,v.jsxs)(u.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:f,onChangeText:j,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[h.styles.input,{minWidth:0}]}),(0,v.jsx)(h.Muted,{children:"Where is it?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:c.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:w===e.id,onPress:()=>k(e.id)},e.id))}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:"Save probe",disabled:!f.trim()||!D,onPress:()=>{f.trim()&&D&&('chef'!==o||(0,i.chefCanSee)(l.useOwner.getState().site,D))&&(p.useSafety.getState().addProbe({name:f.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:n.toISOString()}),I(`Added \u201c${f.trim()}\u201d for ${D.name}. Next: connect your probe.`),j(''),k(''),y(!1))}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,v.jsx)(h.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,v.jsx)(h.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1115,[873,835,1147,1474,1219,861,31,197,264,128,817,1320,1321,824,999,1146,1519,1521,1523,25]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SpecialsEditor=function({rid:e,me:l,app:n,now:p}){const j=(0,a.useSpecials)(s=>s.current[e]??null),y=(0,a.useSpecials)(e=>e.history).filter(s=>s.restaurantId===e),{post:f,clear:w,reuse:k,remove:T}=a.useSpecials.getState(),[C,S]=(0,s.useState)(!1),[P,v]=(0,s.useState)(null),[D,B]=(0,s.useState)([]),[I,R]=(0,s.useState)(!1),[M,$]=(0,s.useState)(''),[A,N]=(0,s.useState)(''),[L,U]=(0,s.useState)(''),[G,_]=(0,s.useState)({}),[z,W]=(0,s.useState)(!1),[E,O]=(0,s.useState)(null),[F,Y]=(0,s.useState)(null),[H,K]=(0,s.useState)(''),[V,Z]=(0,s.useState)(!1),q=async e=>{Z(!0);const s=await(0,c.pickImageDataUrl)(1100,e);Z(!1),s&&(v(s),K(''))},J=(0,i.parsePrice)(L),Q={name:M,price:J,allergens:G,noAllergens:z},X=(0,i.itemProblems)(Q),ee=''!==L.trim()&&(null===J||Number.isNaN(J)),se=(0,i.draftProblems)({photo:P,items:D,allergensChecked:I});return(0,u.jsxs)(t.default,{style:{gap:12},testID:"specials-editor",children:[(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"On the board now"}),j?(0,u.jsx)(o.Badge,{kind:"ok",label:"Live in customer app"}):(0,u.jsx)(o.Badge,{kind:"neutral",label:"Empty"})]}),(0,u.jsx)(t.default,{testID:"specials-last-updated",children:(0,u.jsx)(o.T,{colour:d.colours.goldLight,children:j?(0,i.lastUpdated)(j,p):'Nothing posted. Customers see \u201cToday\u2019s specials are on their way\u201d.'})}),j?(0,u.jsxs)(o.Muted,{children:[(0,i.boardSummary)(j),j.allergenCheck?` \xb7 allergens signed off by ${j.allergenCheck.by}`:'']}):null,(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-update",label:"Update today\u2019s specials",onPress:()=>{return v((e=!0)?j?.photo??null:null),B(e?j?.items.map(e=>({...e}))??[]:[]),R(!1),$(''),N(''),U(''),_({}),W(!1),S(!0),void K('');var e},style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-clear",kind:"secondary",label:"Clear board",disabled:!j,onPress:()=>O({kind:'clear'}),style:{flexGrow:1}})]})]}),H?(0,u.jsx)(o.Banner,{kind:"success",children:H}):null,C?(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",size:17,children:"Update today\u2019s specials"}),(0,u.jsx)(o.Muted,{children:"Take a photo of the chalkboard, type the specials, or both. Typed specials show prices and allergens to customers."}),(0,u.jsx)(o.T,{weight:"semibold",colour:d.colours.gold,children:"1. Photo of the board"}),P?(0,u.jsxs)(t.default,{style:{gap:6},testID:"specials-photo-preview",children:[(0,u.jsx)(h.BoardPhoto,{photo:P,onPress:()=>Y(P),testID:"specials-editor-photo"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,kind:"secondary",label:"Retake or change photo",onPress:()=>q(!1)}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(null)})]})]}):(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-take-photo",kind:"secondary",label:"Take a photo",disabled:V,onPress:()=>q(!0),style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-upload-photo",kind:"secondary",label:"Upload a photo",disabled:V,onPress:()=>q(!1),style:{flexGrow:1}})]}),(0,u.jsx)(o.Muted,{children:"The photo is shrunk and kept on this device for now. Nothing is uploaded."}),(0,u.jsxs)(o.T,{weight:"semibold",colour:d.colours.gold,children:["2. Typed specials (",D.length,")"]}),D.map(e=>(0,u.jsxs)(t.default,{style:{gap:4},children:[(0,u.jsx)(h.SpecialRow,{it:e,declared:[]}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${e.name}`,onPress:()=>O({kind:'remove-item',id:e.id,label:e.name}),style:{alignSelf:'flex-end'}})]},e.id)),(0,u.jsxs)(t.default,{style:{gap:8,borderWidth:1,borderColor:d.colours.border,borderRadius:12,padding:10},testID:"special-form",children:[(0,u.jsx)(o.Field,{label:"Dish name",value:M,onChangeText:$,placeholder:"e.g. Grilled hake, salsa verde"}),(0,u.jsx)(o.Field,{label:"Short description",value:A,onChangeText:N,placeholder:"One line for customers"}),(0,u.jsx)(o.Field,{label:"Price (\xa3)",value:L,onChangeText:U,placeholder:"e.g. 18.50 (blank: ask your server)",keyboardType:"decimal-pad"}),ee?(0,u.jsx)(o.T,{size:13,colour:d.colours.red,children:"Type the price like 18.50"}):null,(0,u.jsx)(x,{map:G,none:z,onChange:_,onNone:e=>{W(e),e&&_({})}}),M.trim()&&X.length?(0,u.jsx)(o.Muted,{children:X.join(' \xb7 ')}):null,(0,u.jsx)(o.Button,{testID:"special-add",kind:"secondary",label:"Add this special",disabled:!!X.length||ee,onPress:()=>{X.length||ee||(B([...D,{id:b(),name:M.trim(),description:A.trim(),price:J,allergens:G,noAllergens:z||void 0}]),$(''),N(''),U(''),_({}),W(!1),R(!1))}})]}),D.length?(0,u.jsxs)(t.default,{testID:"specials-allergen-check",style:{borderWidth:1,borderColor:I?d.colours.ok:d.colours.amber,borderRadius:12,padding:10,gap:4},children:[(0,u.jsx)(o.Toggle,{label:"I have checked the allergens for every typed special",value:I,onChange:R}),(0,u.jsxs)(o.Muted,{children:["Signed off as ",l," with the time. This joins the allergen log, alongside the sign-off chain for guest allergies."]})]}):null,se.length?(0,u.jsx)(t.default,{testID:"specials-problems",children:(0,u.jsx)(o.Muted,{children:se[0]})}):null,(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Cancel",onPress:()=>S(!1)}),(0,u.jsx)(o.Button,{testID:"specials-post",label:"Post to customer app",disabled:!!se.length,onPress:()=>{se.length||(f(e,{photo:P,items:D,allergensChecked:I},l,n),S(!1),K('Specials board updated. Customers see it now in the app\u2019s Specials tab.'))},style:{flex:1}})]})]}):j?(0,u.jsxs)(t.default,{style:{gap:8},testID:"specials-current",children:[j.photo?(0,u.jsx)(h.BoardPhoto,{photo:j.photo,onPress:()=>Y(j.photo)}):null,j.items.map(e=>(0,u.jsx)(h.SpecialRow,{it:e,declared:[]},e.id))]}):null,(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Past boards"}),(0,u.jsxs)(o.Muted,{children:["The last ",y.length||'few'," boards. Use one again with one tap; it is posted now, signed off as you."]}),y.length?y.map(s=>(0,u.jsxs)(t.default,{testID:"specials-history-row",style:{borderTopWidth:1,borderColor:d.colours.border,paddingTop:8,gap:6},children:[(0,u.jsx)(o.Row,{style:{justifyContent:'space-between'},children:(0,u.jsxs)(t.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"medium",children:(0,i.whenText)(s.postedAt,p).replace(/^./,e=>e.toUpperCase())}),(0,u.jsxs)(o.Muted,{numberOfLines:2,children:[(0,i.boardSummary)(s)," \xb7 ",s.postedBy,s.items.length?` \xb7 ${s.items.map(e=>e.name.replace(' (sample)','')).slice(0,3).join(', ')}`:'']})]})}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,label:"Use again",accessibilityLabel:`Use again: board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>{k(e,s.id,l,n),S(!1),K(`Board from ${(0,i.whenText)(s.postedAt,p)} is live again.`)}}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Delete",accessibilityLabel:`Delete board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>O({kind:'delete',id:s.id,label:(0,i.whenText)(s.postedAt,p)})})]})]},s.id)):(0,u.jsx)(o.Muted,{children:"No past boards yet."})]}),(0,u.jsxs)(o.Sheet,{visible:!!E,onClose:()=>O(null),title:'clear'===E?.kind?'Clear the specials board?':'delete'===E?.kind?'Delete this past board?':'Remove this special?',testID:"specials-confirm",children:[(0,u.jsx)(o.Muted,{children:'clear'===E?.kind?'Customers will see \u201cToday\u2019s specials are on their way\u201d until you post a new board. The current board is kept in Past boards.':'delete'===E?.kind?`The board from ${E.label} will be removed from Past boards. This can\u2019t be undone.`:E?`\u201c${E.label}\u201d will be taken off this draft.`:''}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Keep it",onPress:()=>O(null)}),(0,u.jsx)(o.Button,{testID:"specials-confirm-yes",kind:"danger",style:{flex:1},label:'clear'===E?.kind?'Yes, clear the board':'delete'===E?.kind?'Yes, delete it':'Yes, remove it',onPress:()=>{'clear'===E?.kind&&(w(e,l),S(!1),K('Board cleared. Customers see \u201cToday\u2019s specials are on their way\u201d.')),'delete'===E?.kind&&T(E.id),'remove-item'===E?.kind&&B(D.filter(e=>e.id!==E.id)),O(null)}})]})]}),(0,u.jsx)(h.PhotoZoom,{photo:F,onClose:()=>Y(null)})]})};var s=r(_d[0]),l=e(r(_d[1])),t=e(r(_d[2])),o=r(_d[3]),a=r(_d[4]),n=r(_d[5]),i=r(_d[6]),d=r(_d[7]),c=r(_d[8]),h=r(_d[9]),u=r(_d[10]);let p=0;const b=()=>`sp-${Date.now().toString(36)}${(p++).toString(36)}`;function x({map:e,none:s,onChange:a,onNone:c}){return(0,u.jsxs)(t.default,{style:{gap:6},testID:"special-allergens",children:[(0,u.jsx)(o.T,{size:13,weight:"medium",colour:d.colours.muted,children:"Allergens (tap: contains, tap again: may contain)"}),(0,u.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:n.ALLERGENS.map(t=>{const n=e[t.id],c='contains'===n?d.colours.redBg:'may'===n?d.colours.amberBg:d.colours.surface2,h='contains'===n?d.colours.red:'may'===n?d.colours.amber:d.colours.border;return(0,u.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`${t.short}: ${'contains'===n?'contains':'may'===n?'may contain':'not listed'}`,disabled:s,onPress:()=>a((0,i.cycleAllergen)(e,t.id)),style:{paddingHorizontal:10,paddingVertical:8,minHeight:40,justifyContent:'center',borderRadius:18,borderWidth:1,borderColor:h,backgroundColor:c,opacity:s?.35:1},children:(0,u.jsxs)(o.T,{size:13,weight:"medium",colour:n?d.colours.text:d.colours.muted,children:[t.short,'may'===n?' (may)':'']})},t.id)})}),(0,u.jsx)(o.Toggle,{label:"None of the 14 allergens",value:s,onChange:c})]})}},1116,[31,264,128,817,863,818,864,824,1146,862,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dayKey",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"dayName",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"daySaid",{enumerable:!0,get:function(){return T}}),_e.parseDay=I,Object.defineProperty(_e,"whenSaid",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"ukDay",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"qtyText",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"packSaid",{enumerable:!0,get:function(){return S}}),_e.LField=L,_e.RemoveBtn=R,_e.KitchenCosts=function({rid:e,me:t,actor:s,initial:i="deliveries"}){const a=(0,b.useOwnCosting)(),[m,x]=(0,n.useState)(i),j=(0,r.useGpCalcView)(),k=(0,c.useRecipeCards)(e),v=(0,n.useMemo)(()=>Object.values(j.counts??{}).sort((e,t)=>t.date.localeCompare(e.date)||(t.createdAt??'').localeCompare(e.createdAt??''))[0],[j.counts]),[T]=(0,n.useState)(()=>$(new Date(Date.now()-5184e5))),I=Object.values(j.deliveries??{}).filter(e=>e.date>=T).reduce((e,t)=>e+(0,u.deliveryTotal)(t),0),C=(0,n.useMemo)(()=>k.map(e=>(0,d.cardCostSummary)(j.cardCosts?.[e.id],j.ingredients,j.settings,e.price)).filter(e=>null!=e.gp),[k,j.cardCosts,j.ingredients,j.settings]),D=C.filter(e=>'ok'!==e.tone).length;return a?(0,f.jsxs)(l.default,{style:{gap:12},testID:"kitchen-costs",children:[(0,f.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,f.jsx)(z,{testID:"kc-stock-value",label:"Stock value (last count)",value:v?(0,d.money)((0,u.countValue)(v)):'\u2014',sub:v?`${w(v.date)} \xb7 ${v.by}`:'No count yet',onPress:()=>x('count')}),(0,f.jsx)(z,{testID:"kc-spent",label:"Deliveries, last 7 days",value:(0,d.money)(I),sub:"ex VAT",onPress:()=>x('deliveries')}),(0,f.jsx)(z,{testID:"kc-below",label:"Dishes under target GP",value:C.length?String(D):'\u2014',sub:C.length?`of ${C.length} costed`:'None costed yet',colour:D?h.colours.amber:h.colours.ok,onPress:()=>x('dishgp')})]}),(0,f.jsx)(l.default,{style:{alignItems:'center'},children:(0,f.jsx)(p.Tabs,{value:m,onChange:x,options:[{id:'deliveries',label:'Deliveries'},{id:'count',label:'Stock count'},{id:'prices',label:'Prices'},{id:'dishgp',label:'Dish GP'},{id:'gptrend',label:'GP over time'}]})}),'deliveries'===m?(0,f.jsx)(H,{me:t,rid:e}):null,'count'===m?(0,f.jsx)(_,{me:t}):null,'prices'===m?(0,f.jsx)(b.Items,{}):null,'dishgp'===m?(0,f.jsx)(J,{cards:k,actor:s}):null,'gptrend'===m?(0,f.jsx)(y.GpOverTime,{rid:e}):null,(0,f.jsx)(o.Muted,{center:!0,children:"Shared between the Head Chef and Managers apps. Only the Head Chef, owners and managers see prices and costs."})]}):(0,f.jsx)(l.default,{testID:"kitchen-costs-no-access",style:{alignItems:'center',paddingVertical:16},children:(0,f.jsx)(o.Muted,{center:!0,children:"Deliveries, stock counts, prices and GP are for the Head Chef, owners and managers."})})},Object.defineProperty(_e,"blankLine",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"nextLineKey",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"toLine",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"lineOk",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"lineBlank",{enumerable:!0,get:function(){return M}}),_e.DayPicker=F,_e.ExactCount=q,_e.useKitchenSummary=function(e){const t=(0,r.useGpCalcView)(),s=(0,c.useRecipeCards)(e);return(0,n.useMemo)(()=>{const e=Object.values(t.counts??{}).sort((e,t)=>t.date.localeCompare(e.date)||(t.createdAt??'').localeCompare(e.createdAt??''))[0],n=s.map(e=>(0,d.cardCostSummary)(t.cardCosts?.[e.id],t.ingredients,t.settings,e.price)).filter(e=>null!=e.gp);return{stockValue:e?(0,u.countValue)(e):null,lastCount:e?w(e.date):null,costed:n.length,below:n.filter(e=>'ok'!==e.tone).length,target:t.settings.defaultTarget,avgGp:n.length?n.reduce((e,t)=>e+(t.gp??0),0)/n.length:null,prices:t.ingredients.length}},[t.counts,t.cardCosts,t.ingredients,t.settings,s])};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),l=e(_r(_d[3])),o=_r(_d[4]),i=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),m=_r(_d[13]),y=_r(_d[14]),b=_r(_d[15]),f=_r(_d[16]);const x={ok:h.colours.ok,amber:h.colours.amber,red:h.colours.red};let j=0;const k=e=>(0,a.uuidFrom)(`${e}:${Date.now()}:${Math.random()}:${j++}`),v=e=>String(e).padStart(2,'0'),$=(e=new Date)=>`${e.getFullYear()}-${v(e.getMonth()+1)}-${v(e.getDate())}`,w=e=>{const[t,n,s]=e.split('-').map(Number);return new Date(t,n-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})},T=e=>{const[t,n,s]=e.split('-').map(Number);return new Date(t,n-1,s).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})};function I(e){const t=e.trim().match(/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{2}|\d{4})$/);if(!t)return null;const n=Number(t[1]),s=Number(t[2]),l=2===t[3].length?2e3+Number(t[3]):Number(t[3]),o=new Date(l,s-1,n);return o.getFullYear()!==l||o.getMonth()!==s-1||o.getDate()!==n?null:`${l}-${v(s)}-${v(n)}`}const C=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?'':`${v(t.getDate())}/${v(t.getMonth()+1)}/${t.getFullYear()} at ${v(t.getHours())}:${v(t.getMinutes())}`},D=e=>{const[t,n,s]=e.split('-');return`${s}/${n}/${t}`},P=e=>Number.isInteger(e)?String(e):String(Math.round(1e3*e)/1e3),S=(e,t)=>`${P(e)} ${(0,d.unitName)(t,e)}`;function z({label:e,value:t,sub:n,colour:l=h.colours.gold,testID:i,onPress:r}){return(0,f.jsxs)(s.default,{testID:i,disabled:!r,accessibilityRole:r?'button':void 0,accessibilityLabel:`${e}, ${t}${n?`, ${n}`:''}`,onPress:r,style:({pressed:e})=>({flexGrow:1,flexBasis:150,minWidth:0,padding:12,borderRadius:14,borderWidth:1,borderColor:h.colours.accentBorder,backgroundColor:e?h.colours.goldTint:h.colours.surface,alignItems:'center',gap:2}),children:[(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:e}),(0,f.jsx)(o.T,{size:26,weight:"bold",center:!0,colour:l,children:t}),n?(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:n}):null]})}function L({label:e,value:n,onChange:s,placeholder:i,testID:r,keyboard:c,width:a,said:d}){return(0,f.jsxs)(l.default,{style:{gap:4,alignItems:'center',width:a??'100%',maxWidth:'100%'},children:[(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:e}),(0,f.jsx)(t.TextInput,{testID:r,accessibilityLabel:d??e,value:n,onChangeText:s,placeholder:i,placeholderTextColor:"#7D776C",keyboardType:c??'default',style:[o.styles.input,b.TALL,{width:'100%',textAlign:'center',fontSize:18}]})]})}function R({onPress:e,said:t,testID:n,label:l="Remove"}){return(0,f.jsxs)(s.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,onPress:e,style:({pressed:e})=>({minHeight:48,paddingHorizontal:14,borderRadius:24,borderWidth:1,borderColor:h.colours.accentBorder,backgroundColor:e?h.colours.goldTint:'transparent',flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8}),children:[(0,f.jsx)(i.GoldX,{size:14}),(0,f.jsx)(o.T,{size:h.font.small,colour:h.colours.gold,children:l})]})}let G=0;const N=()=>({k:G++,ingId:'',name:'',packs:'1',size:'',unit:'kg',price:'',count:'',countName:''}),A=()=>G++,B=e=>({k:G++,ingId:e.ingId,name:e.name,packs:P(e.packs),size:P(e.packSize),unit:e.packUnit,price:(e.packPrice/100).toFixed(2),count:e.count?P(e.count):'',countName:e.countName??'',...e.read?{read:e.read}:{}}),V=e=>{const t=(0,b.numIn)(e.count);return{ingId:e.ingId,name:e.name.trim(),packs:(0,b.numIn)(e.packs),packSize:(0,b.numIn)(e.size),packUnit:e.unit,packPrice:(0,b.pounds)(e.price),...t&&t>0?{count:t,countName:e.countName.trim().toLowerCase()||'pieces'}:{},...e.read?{read:e.read}:{}}},O=e=>!!e.name.trim()&&((0,b.numIn)(e.packs)??0)>0&&((0,b.numIn)(e.size)??0)>0&&null!=(0,b.pounds)(e.price),M=e=>!e.name.trim()&&!e.size.trim()&&!e.price.trim();function H({me:e,rid:t}){const[s,i]=(0,n.useState)(!1),{deliveries:c}=(0,r.useGpCalcView)(),[a,d]=(0,n.useState)(null),[u,y]=(0,n.useState)(null),[b,x]=(0,n.useState)(''),j=Object.values(c??{}).sort((e,t)=>t.date.localeCompare(e.date)||(t.createdAt??'').localeCompare(e.createdAt??''));return s?(0,f.jsx)(m.ScanDelivery,{me:e,rid:t,onDone:e=>{i(!1),e&&x(e)}}):a?(0,f.jsx)(U,{me:e,rid:t,edit:'new'===a?void 0:a,onDone:e=>{d(null),e&&x(e)}}):(0,f.jsxs)(p.Box,{testID:"deliveries",children:[(0,f.jsx)(o.T,{size:20,weight:"bold",center:!0,colour:h.colours.gold,accessibilityRole:"header",children:"Deliveries in"}),(0,f.jsx)(o.Muted,{center:!0,children:"Scan the delivery note, or type it in. Every line updates that item\u2019s cost, and every recipe card\u2019s GP re-calculates."}),(0,f.jsx)(o.Button,{testID:"delivery-scan",label:"Scan delivery",sub:"Photo of the delivery note",accessibilityLabel:"Scan delivery. Take a photo of the delivery note and check each line before it goes into stock",onPress:()=>{x(''),i(!0)},style:{minHeight:64}}),(0,f.jsx)(o.Button,{testID:"delivery-new",kind:"secondary",label:"Type a delivery",accessibilityLabel:"Type a delivery in by hand",onPress:()=>{x(''),d('new')},style:{minHeight:56}}),b?(0,f.jsx)(l.default,{testID:"delivery-msg",accessibilityLiveRegion:"polite",children:(0,f.jsx)(o.T,{center:!0,colour:h.colours.goldLight,children:b})}):null,j.length?null:(0,f.jsx)(l.default,{testID:"deliveries-empty",style:{alignItems:'center',paddingVertical:10},children:(0,f.jsx)(o.T,{center:!0,colour:h.colours.muted,children:"No deliveries recorded yet."})}),j.map(e=>(0,f.jsx)(W,{d:e,open:u===e.id,onToggle:()=>y(u===e.id?null:e.id),onEdit:()=>d(e),onDeleted:e=>{y(null),x(e)}},e.id))]})}function W({d:e,open:t,onToggle:i,onEdit:c,onDeleted:a}){const[p,m]=(0,n.useState)(!1),y=(0,u.deliveryTotal)(e);return(0,f.jsxs)(l.default,{testID:`delivery-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.border,paddingTop:8,gap:8},children:[(0,f.jsxs)(s.default,{accessibilityRole:"button",accessibilityState:{expanded:t},accessibilityLabel:`Delivery ${T(e.date)}, ${e.supplier||'supplier not given'}, ${e.lines.length} line${1===e.lines.length?'':'s'}, ${(0,d.money)(y)}. ${t?'Tap to close':'Tap to see the lines'}`,onPress:i,style:({pressed:e})=>({minHeight:56,padding:10,borderRadius:12,backgroundColor:e?h.colours.goldTint:'transparent',alignItems:'center',gap:2}),children:[(0,f.jsx)(o.T,{weight:"semibold",size:18,center:!0,children:w(e.date)}),(0,f.jsxs)(o.T,{center:!0,colour:h.colours.goldLight,children:[e.supplier||'Supplier not given',e.ref?` \xb7 ${e.ref}`:'']}),(0,f.jsxs)(o.T,{center:!0,weight:"bold",colour:h.colours.gold,children:[(0,d.money)(y)," \xb7 ",e.lines.length," line",1===e.lines.length?'':'s']}),(0,f.jsxs)(o.Muted,{center:!0,children:['scan'===e.source?`Scanned by ${e.by}${e.photos?.length?` \xb7 ${e.photos.length} photo${1===e.photos.length?'':'s'} kept`:''}`:`Entered by ${e.by}`," \xb7 ",C(e.createdAt)]})]}),t?(0,f.jsxs)(l.default,{style:{gap:6},children:[e.lines.map((e,t)=>(0,f.jsxs)(l.default,{accessible:!0,accessibilityLabel:`${e.name}, ${P(e.packs)} at ${(0,d.money)(e.packPrice)} for ${S(e.packSize,e.packUnit)}, ${(0,d.money)((0,u.lineTotal)(e))}${e.count?`. Exact count ${P(e.count)} ${e.countName||'pieces'}`:''}`,style:{alignItems:'center',paddingVertical:4},children:[(0,f.jsx)(o.T,{weight:"medium",center:!0,children:e.name}),(0,f.jsxs)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:[P(e.packs)," \xd7 ",(0,d.money)(e.packPrice)," (",S(e.packSize,e.packUnit),") = ",(0,d.money)((0,u.lineTotal)(e))]}),e.count?(0,f.jsxs)(o.T,{size:h.font.small,center:!0,colour:h.colours.goldLight,children:["Exact count ",P(e.count)," ",e.countName||'pieces'," \xb7 ",(0,d.money)(e.packPrice*e.packs/e.count)," per ",(0,u.pieceName)(e)]}):null]},t)),(0,f.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:`delivery-edit-${e.id}`,label:"Edit",accessibilityLabel:`Edit the delivery of ${T(e.date)}`,onPress:c}),p?null:(0,f.jsx)(R,{testID:`delivery-delete-${e.id}`,label:'scan'===e.source?'Undo goods in':'Remove',said:`${'scan'===e.source?'Undo the goods in':'Delete the delivery'} of ${T(e.date)}`,onPress:()=>m(!0)})]}),p?(0,f.jsxs)(l.default,{style:{gap:6,alignItems:'center'},children:[(0,f.jsx)(o.T,{center:!0,colour:h.colours.amber,children:'scan'===e.source?'Undo this goods in? Its prices and exact counts come off the price list, and recipe GP goes back. The photo is kept.':'Delete this delivery? Its prices come off the price list too.'}),(0,f.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,f.jsx)(o.Button,{small:!0,kind:"danger",testID:`delivery-delete-yes-${e.id}`,label:"Yes, delete",onPress:()=>{r.useGpCalc.getState().removeDelivery(e.id),a(`Deleted the delivery of ${w(e.date)}.`)}}),(0,f.jsx)(o.Button,{small:!0,kind:"secondary",label:"Keep it",onPress:()=>m(!1)})]})]}):null]}):null]})}function F({value:e,onChange:s,label:i}){const[r,c]=(0,n.useState)(D(e)),[{today:a,yday:d}]=(0,n.useState)(()=>({today:$(),yday:$(new Date(Date.now()-864e5))})),u=!I(r);return(0,f.jsxs)(l.default,{style:{gap:6,alignItems:'center',width:'100%'},children:[(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:i}),(0,f.jsxs)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,f.jsx)(b.Pick,{testID:"day-today",label:"Today",selected:e===a,onPress:()=>{s(a),c(D(a))}}),(0,f.jsx)(b.Pick,{testID:"day-yesterday",label:"Yesterday",selected:e===d,onPress:()=>{s(d),c(D(d))}}),(0,f.jsx)(t.TextInput,{testID:"day-text",accessibilityLabel:`${i}, day, month, year`,value:r,onChangeText:e=>{c(e);const t=I(e);t&&s(t)},placeholder:"dd/mm/yyyy",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[o.styles.input,b.TALL,{width:150,textAlign:'center',fontSize:18}]})]}),(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:u?h.colours.amber:h.colours.goldLight,children:u?'Type the date as day/month/year':T(e)})]})}function U({me:e,edit:t,onDone:s,rid:i}){const{ingredients:a,deliveries:m}=(0,r.useGpCalcView)(),y=(0,c.useRecipeCards)(i),[x,j]=(0,n.useState)(t?.date??$()),[v,T]=(0,n.useState)(t?.supplier??''),[C,P]=(0,n.useState)(t?.ref??''),[S,z]=(0,n.useState)(t?t.lines.map(B):[N()]),[R,G]=(0,n.useState)(''),A=[...new Set(Object.values(m??{}).map(e=>e.supplier.trim()).filter(Boolean))].slice(0,6),H=(e,t)=>z(n=>n.map(n=>n.k===e?{...n,...t}:n)),W=S.filter(e=>!M(e)),U=W.filter(O).reduce((e,t)=>e+(0,u.lineTotal)({packs:(0,b.numIn)(t.packs),packPrice:(0,b.pounds)(t.price)}),0);return(0,f.jsxs)(p.Box,{testID:"delivery-form",children:[(0,f.jsx)(o.T,{size:20,weight:"bold",center:!0,colour:h.colours.gold,accessibilityRole:"header",children:t?'Edit delivery':'Record a delivery'}),(0,f.jsx)(F,{label:"Delivery date",value:x,onChange:j}),(0,f.jsx)(L,{testID:"delivery-supplier",label:"Supplier",value:v,onChange:T,placeholder:"Supplier name"}),A.length?(0,f.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:A.map(e=>(0,f.jsx)(b.Pick,{label:e,accessibilityLabel:`Supplier ${e}`,selected:v.trim()===e,onPress:()=>T(e)},e))}):null,(0,f.jsx)(L,{testID:"delivery-ref",label:"Invoice or note number (optional)",value:C,onChange:P,placeholder:"e.g. 10452"}),(0,f.jsx)(o.T,{size:18,weight:"semibold",center:!0,accessibilityRole:"header",children:"Items"}),(0,f.jsx)(o.Muted,{center:!0,children:"Price per pack before VAT, as on the invoice. For example 2 packs of 5 kg at \xa340.00."}),S.map((e,t)=>(0,f.jsx)(E,{n:t+1,l:e,ingredients:a,onChange:t=>H(e.k,t),onRemove:S.length>1?()=>z(t=>t.filter(t=>t.k!==e.k)):void 0},e.k)),(0,f.jsx)(o.Button,{testID:"delivery-add-line",kind:"secondary",label:"Add another item",onPress:()=>z(e=>[...e,N()]),style:{minHeight:52}}),(0,f.jsxs)(l.default,{accessible:!0,accessibilityLabel:`Delivery total ${(0,d.money)(U)} before VAT`,style:{alignItems:'center',paddingVertical:6},children:[(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:"Delivery total (ex VAT)"}),(0,f.jsx)(o.T,{testID:"delivery-total",size:30,weight:"bold",center:!0,colour:h.colours.gold,children:(0,d.money)(U)})]}),R?(0,f.jsx)(l.default,{accessibilityLiveRegion:"assertive",children:(0,f.jsx)(o.T,{center:!0,colour:h.colours.amber,children:R})}):null,(0,f.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,f.jsx)(o.Button,{testID:"delivery-save",label:t?'Save changes':'Save delivery',onPress:()=>{if(!I(D(x)))return void G('Check the date.');if(!W.length)return void G('Add at least one item.');const n=W.filter(e=>!O(e));if(n.length)return void G(`${n.length} line${1===n.length?' needs':'s need'} an item, how many, the pack size and the price.`);const l={id:t?.id??k('del'),date:x,supplier:v.trim(),...C.trim()?{ref:C.trim()}:{},by:t?.by??e,createdAt:t?.createdAt??(new Date).toISOString(),...t?.source?{source:t.source}:{},...t?.photos?{photos:t.photos}:{},...t?.reader?{reader:t.reader}:{},lines:W.map(V)},o=new Set(r.useGpCalc.getState().ingredients.map(e=>e.id)),i=r.useGpCalc.getState().saveDelivery(l,y.map(e=>({id:e.id,dish:e.dish,price:e.price}))),c=i.lines.filter(e=>!o.has(e.ingId)).length;s(`Saved the delivery of ${w(x)}: ${i.lines.length} price${1===i.lines.length?'':'s'} updated${c?`, ${c} new item${1===c?'':'s'} added to the price list`:''}. Recipe cards re-costed.`)},style:{minHeight:56,flexGrow:1}}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Cancel",onPress:()=>s(),style:{minHeight:56}})]})]})}function E({n:e,l:t,ingredients:n,onChange:s,onRemove:i}){const r=n.find(e=>e.id===t.ingId),c=t.name.trim().toLowerCase(),a=!r&&c.length>=2?n.filter(e=>e.name.toLowerCase().includes(c)||(0,u.matchIngredient)(t.name,[e])).slice(0,4):[],p=e=>s({ingId:e.id,name:e.name,size:P(e.packSize),unit:e.packUnit,price:(e.packPrice/100).toFixed(2)}),m=O(t),y=m?(0,u.lineTotal)({packs:(0,b.numIn)(t.packs),packPrice:(0,b.pounds)(t.price)}):0;return(0,f.jsxs)(l.default,{testID:`delivery-line-${e}`,style:{gap:8,padding:12,borderRadius:14,borderWidth:1,borderColor:m?h.colours.accentBorder:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(o.T,{weight:"semibold",center:!0,colour:h.colours.goldLight,children:["Item ",e]}),(0,f.jsx)(L,{testID:`dl-name-${e}`,label:"Item",said:`Item ${e}, name`,value:t.name,onChange:e=>s({name:e,ingId:r&&e.trim()===r.name?t.ingId:''}),placeholder:"e.g. Haddock fillet"}),r?(0,f.jsxs)(o.T,{size:h.font.small,center:!0,colour:h.colours.goldLight,children:["On the price list: last paid ",(0,d.money)(r.packPrice)," for ",S(r.packSize,r.packUnit)]}):a.length?(0,f.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:a.map(t=>(0,f.jsx)(b.Pick,{testID:`dl-pick-${e}-${t.id}`,label:t.name,accessibilityLabel:`Use ${t.name} from the price list, last paid ${(0,d.money)(t.packPrice)} for ${S(t.packSize,t.packUnit)}`,onPress:()=>p(t)},t.id))}):t.name.trim().length>=2?(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:"New item: it will be added to the price list."}):null,(0,f.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,f.jsx)(L,{testID:`dl-packs-${e}`,label:"How many",said:`Item ${e}, how many packs`,value:t.packs,onChange:e=>s({packs:e}),keyboard:"decimal-pad",width:110}),(0,f.jsx)(L,{testID:`dl-size-${e}`,label:"Pack size",said:`Item ${e}, pack size`,value:t.size,onChange:e=>s({size:e}),keyboard:"decimal-pad",placeholder:"e.g. 5",width:110}),(0,f.jsx)(L,{testID:`dl-price-${e}`,label:"\xa3 per pack",said:`Item ${e}, price per pack in pounds, before VAT`,value:t.price,onChange:e=>s({price:e}),keyboard:"decimal-pad",placeholder:"0.00",width:120})]}),(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:"Pack size is in"}),(0,f.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:d.PACK_UNITS.map(n=>(0,f.jsx)(b.Pick,{testID:`dl-unit-${e}-${n}`,label:(0,d.unitName)(n,2),accessibilityLabel:`Item ${e}, pack size in ${(0,d.unitName)(n,2)}`,selected:t.unit===n,onPress:()=>s({unit:n})},n))}),(0,f.jsx)(q,{n:e,l:t,onChange:s}),(0,f.jsx)(l.default,{accessible:!0,accessibilityLabel:m?`Item ${e} total ${(0,d.money)(y)}`:`Item ${e} not complete yet`,style:{alignItems:'center'},children:(0,f.jsx)(o.T,{weight:"bold",center:!0,colour:m?h.colours.gold:h.colours.muted,children:m?`Line total ${(0,d.money)(y)}`:'Fill in item, how many, size and price'})}),i?(0,f.jsx)(l.default,{style:{alignItems:'center'},children:(0,f.jsx)(R,{testID:`dl-remove-${e}`,said:`Remove item ${e}${t.name.trim()?`, ${t.name.trim()}`:''}`,onPress:i})}):null]})}function q({n:e,l:t,onChange:n,word:s="Item"}){const i=(0,b.numIn)(t.count),r=(0,b.numIn)(t.packs)??0,c=(0,b.pounds)(t.price),a=i&&i>0&&null!=c&&r>0?c*r/i:null,u=!(!t.count.trim()||i&&i>0);return(0,f.jsxs)(l.default,{style:{gap:6,alignItems:'center'},children:[(0,f.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,f.jsx)(L,{testID:`dl-count-${e}`,label:"Exact count (optional)",said:`${s} ${e}, Exact count`,value:t.count,onChange:e=>n({count:e}),keyboard:"number-pad",placeholder:"e.g. 18",width:150}),(0,f.jsx)(L,{testID:`dl-countname-${e}`,label:"Pieces are",said:`${s} ${e}, what each piece is called, for example fillets`,value:t.countName,onChange:e=>n({countName:e}),placeholder:"fillets",width:150})]}),(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:u?h.colours.amber:null!=a?h.colours.goldLight:h.colours.muted,children:u?'Type the count as a whole number':null!=a?`${(0,d.money)(a)} per ${t.countName.trim()?t.countName.trim().toLowerCase().replace(/s$/,''):'piece'}`:'Leave blank if it\u2019s by weight only'})]})}function _({me:e}){const{counts:t}=(0,r.useGpCalcView)(),[i,c]=(0,n.useState)(null),[a,m]=(0,n.useState)(null),[y,b]=(0,n.useState)(''),x=Object.values(t??{}).sort((e,t)=>t.date.localeCompare(e.date)||(t.createdAt??'').localeCompare(e.createdAt??''));return i?(0,f.jsx)(X,{me:e,edit:'new'===i?void 0:i,last:x[0],onDone:e=>{c(null),e&&b(e)}}):(0,f.jsxs)(p.Box,{testID:"counts",children:[(0,f.jsx)(o.T,{size:20,weight:"bold",center:!0,colour:h.colours.gold,accessibilityRole:"header",children:"Stock count"}),(0,f.jsx)(o.Muted,{center:!0,children:"Count what is on the shelves. It shows the stock value at what you last paid."}),(0,f.jsx)(o.Button,{testID:"count-new",label:"Start a stock count",onPress:()=>{b(''),c('new')},style:{minHeight:56}}),y?(0,f.jsx)(l.default,{testID:"count-msg",accessibilityLiveRegion:"polite",children:(0,f.jsx)(o.T,{center:!0,colour:h.colours.goldLight,children:y})}):null,x.length?null:(0,f.jsx)(l.default,{testID:"counts-empty",style:{alignItems:'center',paddingVertical:10},children:(0,f.jsx)(o.T,{center:!0,colour:h.colours.muted,children:"No stock counts yet."})}),x.map(e=>{const t=(0,u.countValue)(e),n=a===e.id;return(0,f.jsxs)(l.default,{testID:`count-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.border,paddingTop:8,gap:6},children:[(0,f.jsxs)(s.default,{accessibilityRole:"button",accessibilityState:{expanded:n},accessibilityLabel:`Stock count ${T(e.date)} by ${e.by}, ${e.lines.length} items, value ${(0,d.money)(t)}`,onPress:()=>m(n?null:e.id),style:({pressed:e})=>({minHeight:56,padding:10,borderRadius:12,backgroundColor:e?h.colours.goldTint:'transparent',alignItems:'center',gap:2}),children:[(0,f.jsx)(o.T,{weight:"semibold",size:18,center:!0,children:w(e.date)}),(0,f.jsxs)(o.T,{center:!0,weight:"bold",colour:h.colours.gold,children:[(0,d.money)(t)," \xb7 ",e.lines.length," item",1===e.lines.length?'':'s']}),(0,f.jsxs)(o.Muted,{center:!0,children:["Counted by ",e.by]})]}),n?(0,f.jsxs)(l.default,{style:{gap:4},children:[e.lines.map((e,t)=>(0,f.jsxs)(l.default,{accessible:!0,accessibilityLabel:`${e.name}, ${Y(e)}, ${(0,d.money)((0,u.countLineValue)(e))}`,style:{alignItems:'center',paddingVertical:3},children:[(0,f.jsx)(o.T,{center:!0,children:e.name}),(0,f.jsxs)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:[Y(e)," \xb7 ",(0,d.money)((0,u.countLineValue)(e))]})]},t)),(0,f.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:`count-edit-${e.id}`,label:"Edit",accessibilityLabel:`Edit the stock count of ${T(e.date)}`,onPress:()=>c(e)}),(0,f.jsx)(R,{testID:`count-delete-${e.id}`,said:`Delete the stock count of ${T(e.date)}`,onPress:()=>{r.useGpCalc.getState().removeCount(e.id),m(null),b(`Deleted the stock count of ${w(e.date)}.`)}})]})]}):null]},e.id)})]})}const K=(e,t,n)=>'pack'===e?`${1===t?'pack':'packs'} of ${S(n.packSize,n.packUnit)}`:'serving'===e?(0,d.servingWord)(n,t):(0,d.unitName)(e,t),Y=e=>`${P(e.qty)} ${K(e.unit,e.qty,e)}`;function X({me:e,edit:s,last:i,onDone:c}){const{ingredients:a}=(0,r.useGpCalcView)(),[m,y]=(0,n.useState)(s?.date??$()),[x,j]=(0,n.useState)(s?.by??e),[v,T]=(0,n.useState)(''),[I,C]=(0,n.useState)(()=>Object.fromEntries((s?.lines??[]).map(e=>[e.ingId,{qty:P(e.qty),unit:e.unit}]))),[D,z]=(0,n.useState)(''),R=a.slice().sort((e,t)=>e.name.localeCompare(t.name)),G=R.filter(e=>!v.trim()||e.name.toLowerCase().includes(v.trim().toLowerCase())),N=e=>{const t=I[e.id],n=t?(0,b.numIn)(t.qty):null;return null==n?null:{ingId:e.id,name:e.name,qty:n,unit:t.unit,packPrice:e.packPrice,packSize:e.packSize,packUnit:e.packUnit,...e.servings?{servings:e.servings}:{}}},A=R.map(N).filter(e=>!!e),B=A.reduce((e,t)=>e+(0,u.countLineValue)(t),0);return a.length?(0,f.jsxs)(p.Box,{testID:"count-form",children:[(0,f.jsx)(o.T,{size:20,weight:"bold",center:!0,colour:h.colours.gold,accessibilityRole:"header",children:s?'Edit stock count':'Stock count'}),(0,f.jsx)(F,{label:"Count date",value:m,onChange:y}),(0,f.jsx)(L,{testID:"count-by",label:"Counted by",value:x,onChange:j}),(0,f.jsx)(L,{testID:"count-search",label:"Find an item",value:v,onChange:T,placeholder:"Search"}),G.map(e=>{const n=I[e.id]??{qty:'',unit:'pack'},r=N(e),c=r?(0,u.countPacks)(r):null,a=i?.lines.find(t=>t.ingId===e.id);return(0,f.jsxs)(l.default,{testID:`count-item-${e.id}`,style:{gap:6,padding:10,borderRadius:14,borderWidth:1,borderColor:r?h.colours.accentBorder:h.colours.border,backgroundColor:h.colours.surface2,alignItems:'center'},children:[(0,f.jsx)(o.T,{weight:"semibold",size:17,center:!0,children:e.name}),(0,f.jsxs)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:[(0,d.money)(e.packPrice)," for ",S(e.packSize,e.packUnit),a&&!s?` \xb7 last count ${Y(a)}`:'']}),(0,f.jsx)(t.TextInput,{testID:`count-qty-${e.id}`,accessibilityLabel:`${e.name}, how many ${K(n.unit,2,{...e})}`,value:n.qty,onChangeText:t=>C(s=>({...s,[e.id]:{...n,qty:t}})),placeholder:"count",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[o.styles.input,b.TALL,{width:140,textAlign:'center',fontSize:20}]}),(0,f.jsx)(o.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:(0,u.countUnitsFor)(e).map(t=>(0,f.jsx)(b.Pick,{testID:`count-unit-${e.id}-${t}`,label:'pack'===t?'packs':'serving'===t?(0,d.servingWord)(e,2):(0,d.unitName)(t,2),accessibilityLabel:`Count ${e.name} in ${'pack'===t?'packs':'serving'===t?(0,d.servingWord)(e,2):(0,d.unitName)(t,2)}`,selected:n.unit===t,onPress:()=>C(s=>({...s,[e.id]:{...n,unit:t}}))},t))}),r?(0,f.jsx)(o.T,{size:h.font.small,center:!0,weight:"semibold",colour:null==c?h.colours.amber:h.colours.gold,children:null==c?'That unit does not fit this item':`${(0,d.money)((0,u.countLineValue)(r))} at cost`}):null]},e.id)}),(0,f.jsxs)(l.default,{accessible:!0,accessibilityLabel:`Stock value so far ${(0,d.money)(B)}, ${A.length} of ${R.length} items counted`,style:{alignItems:'center',paddingVertical:6},children:[(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:"Stock value so far"}),(0,f.jsx)(o.T,{testID:"count-total",size:30,weight:"bold",center:!0,colour:h.colours.gold,children:(0,d.money)(B)}),(0,f.jsxs)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:[A.length," of ",R.length," items counted"]})]}),D?(0,f.jsx)(l.default,{accessibilityLiveRegion:"assertive",children:(0,f.jsx)(o.T,{center:!0,colour:h.colours.amber,children:D})}):null,(0,f.jsxs)(o.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,f.jsx)(o.Button,{testID:"count-save",label:s?'Save changes':'Save stock count',onPress:()=>{if(!A.length)return void z('Enter at least one count.');if(!x.trim())return void z('Say who counted.');const e={id:s?.id??k('count'),date:m,by:x.trim(),lines:A,createdAt:s?.createdAt??(new Date).toISOString()};r.useGpCalc.getState().saveCount(e),c(`Saved the stock count of ${w(m)}: ${A.length} item${1===A.length?'':'s'}, value ${(0,d.money)(B)}.`)},style:{minHeight:56,flexGrow:1}}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Cancel",onPress:()=>c(),style:{minHeight:56}})]})]}):(0,f.jsxs)(p.Box,{testID:"count-form",children:[(0,f.jsx)(o.T,{size:20,weight:"bold",center:!0,colour:h.colours.gold,accessibilityRole:"header",children:"Stock count"}),(0,f.jsx)(o.T,{center:!0,colour:h.colours.muted,children:"Nothing on the price list yet. Record a delivery or add prices first, then count them here."}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Back",onPress:()=>c()})]})}function J({cards:e,actor:t}){const{ingredients:i,settings:c,cardCosts:a,setSettings:m,deliveries:y}=(0,r.useGpCalcView)(),[j,k]=(0,n.useState)(null),[v,T]=(0,n.useState)(''),I=(0,n.useMemo)(()=>(0,d.menuOverview)(e.map(e=>{const t=(0,d.cardCostSummary)(a?.[e.id],i,c,e.price);return{id:e.id,name:e.dish,gp:t.gp,foodCostPct:t.foodCostPct,tone:t.tone,price:t.price,perPortion:t.perPortion,c:e,s:t}})),[e,a,i,c]),[C]=(0,n.useState)(()=>$(new Date(Date.now()-11232e5))),D=(0,n.useMemo)(()=>(0,d.marginDrops)(Object.values(y??{}),C).filter(t=>e.some(e=>e.id===t.dishId)),[y,C,e]),P=(0,d.foodCostTargetOf)(c.defaultTarget),S=I.filter(e=>null!=e.s.gp),z=S.filter(e=>'ok'!==e.s.tone).length;return(0,f.jsxs)(p.Box,{testID:"dish-gp",children:[(0,f.jsx)(o.T,{size:20,weight:"bold",center:!0,colour:h.colours.gold,accessibilityRole:"header",children:"Dish GP"}),(0,f.jsxs)(o.Muted,{center:!0,children:["Food cost from the latest prices, against the menu price. Menu prices include ",c.vatPct,"% VAT; GP is worked out on the price without VAT."]}),(0,f.jsxs)(o.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:"target-down",label:"\u2212",accessibilityLabel:`Lower the target GP, now ${c.defaultTarget} percent`,onPress:()=>m({defaultTarget:Math.max(40,c.defaultTarget-1)}),style:{minWidth:52,minHeight:52}}),(0,f.jsxs)(l.default,{accessible:!0,accessibilityLabel:`Target GP ${c.defaultTarget} percent`,style:{alignItems:'center',minWidth:120},children:[(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:"Target GP"}),(0,f.jsxs)(o.T,{testID:"target-gp",size:28,weight:"bold",center:!0,colour:h.colours.gold,children:[c.defaultTarget,"%"]})]}),(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:"target-up",label:"+",accessibilityLabel:`Raise the target GP, now ${c.defaultTarget} percent`,onPress:()=>m({defaultTarget:Math.min(90,c.defaultTarget+1)}),style:{minWidth:52,minHeight:52}})]}),(0,f.jsxs)(o.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:"target-fc-down",label:"\u2212",accessibilityLabel:`Lower the target food cost, now ${P} percent`,onPress:()=>m({defaultTarget:(0,d.targetGpForFoodCost)(P-1)}),style:{minWidth:52,minHeight:52}}),(0,f.jsxs)(l.default,{accessible:!0,accessibilityLabel:`Target food cost ${P} percent`,style:{alignItems:'center',minWidth:120},children:[(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:"Target food cost"}),(0,f.jsxs)(o.T,{testID:"target-fc",size:28,weight:"bold",center:!0,colour:h.colours.gold,children:[P,"%"]})]}),(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:"target-fc-up",label:"+",accessibilityLabel:`Raise the target food cost, now ${P} percent`,onPress:()=>m({defaultTarget:(0,d.targetGpForFoodCost)(P+1)}),style:{minWidth:52,minHeight:52}})]}),(0,f.jsxs)(o.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:"vat-down",label:"\u2212",accessibilityLabel:`Lower the VAT rate, now ${c.vatPct} percent`,onPress:()=>m({vatPct:Math.max(0,c.vatPct-1)}),style:{minWidth:52,minHeight:52}}),(0,f.jsxs)(l.default,{accessible:!0,accessibilityLabel:`VAT on menu prices ${c.vatPct} percent`,style:{alignItems:'center',minWidth:120},children:[(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:"VAT on menu prices"}),(0,f.jsxs)(o.T,{testID:"vat-pct",size:22,weight:"bold",center:!0,colour:h.colours.goldLight,children:[c.vatPct,"%"]})]}),(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:"vat-up",label:"+",accessibilityLabel:`Raise the VAT rate, now ${c.vatPct} percent`,onPress:()=>m({vatPct:Math.min(30,c.vatPct+1)}),style:{minWidth:52,minHeight:52}})]}),D.length?(0,f.jsxs)(l.default,{testID:"gp-price-alerts",accessibilityLiveRegion:"polite",style:{gap:6,padding:10,borderRadius:14,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg},children:[(0,f.jsx)(o.T,{weight:"semibold",center:!0,colour:h.colours.amber,accessibilityRole:"header",children:"Price change alerts"}),D.slice(0,8).map(e=>(0,f.jsxs)(o.T,{size:h.font.small,center:!0,children:[e.dish,": GP ",(0,d.pct)(e.before)," \u2192 ",(0,d.pct)(e.after)," after the ",e.supplier||'delivery'," prices on ",w(e.date)]},e.dishId)),(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:"Last 14 days. Check the price or the portion."})]}):(0,f.jsx)(o.T,{testID:"gp-price-alerts-none",size:h.font.small,center:!0,colour:h.colours.muted,children:"No price change alerts in the last 14 days."}),(0,f.jsxs)(o.T,{center:!0,colour:h.colours.goldLight,children:[S.length," of ",I.length," dishes costed \xb7 ",z," under target"]}),(0,f.jsx)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,accessibilityRole:"header",children:"Menu overview: weakest first (lowest GP, highest food cost)"}),i.length?(0,f.jsx)(o.Button,{testID:"gp-link-every",kind:"secondary",label:"Link matching prices on every card",onPress:()=>{const t=r.useGpCalc.getState();let n=0,s=0;for(const l of e){const e=t.cardCosts[l.id]??{lines:[],portions:1},o=new Set(e.lines.map(e=>e.recipeIngId).filter(Boolean)),i=l.ingredients.filter(e=>e.name.trim()&&!o.has(e.id)).map(e=>{const n=(0,u.matchIngredient)(e.name,t.ingredients);return n?{ingId:n.id,...(0,u.suggestAmount)(e.qty,e.unit,n),recipeIngId:e.id}:null}).filter(e=>!!e);i.length&&(t.saveCardCost(l.id,{...e,lines:[...e.lines,...i]}),n+=i.length,s++)}T(n?`Linked ${n} ingredient${1===n?'':'s'} on ${s} card${1===s?'':'s'}. Open a dish to check its amounts.`:'Nothing new to link. Add more prices, or link by hand on each dish.')},style:{minHeight:52}}):(0,f.jsx)(o.T,{center:!0,colour:h.colours.muted,children:"The price list is empty. Record a delivery or add prices first."}),v?(0,f.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,f.jsx)(o.T,{center:!0,colour:h.colours.goldLight,children:v})}):null,I.map(({c:e,s:n})=>{const i=j===e.id,r=n.tone?x[n.tone]:h.colours.muted,a=n.price?n.price/(1+c.vatPct/100):null,u=null!=n.gp?`${e.dish}. GP ${(0,d.pct)(n.gp)}, food cost ${(0,d.pct)(n.foodCostPct??0)}, ${'ok'===n.tone?'on target':'amber'===n.tone?'just under target':'below target'}. Food cost ${(0,d.money)(n.perPortion)}, cash GP ${(0,d.money)(n.cashGp)}, menu price ${(0,d.money)(n.price)} including VAT.`:`${e.dish}. Not costed yet${e.price?`. Menu price ${(0,d.money)(e.price)} including VAT`:''}.`;return(0,f.jsxs)(l.default,{testID:`dish-gp-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.border,paddingTop:8,gap:8},children:[(0,f.jsxs)(s.default,{accessibilityRole:"button",accessibilityState:{expanded:i},accessibilityLabel:`${u} ${i?'Tap to close':'Tap to cost it'}`,onPress:()=>k(i?null:e.id),style:({pressed:e})=>({minHeight:64,padding:10,borderRadius:14,borderWidth:1,borderColor:null!=n.gp?r:h.colours.border,backgroundColor:e?h.colours.goldTint:h.colours.surface,alignItems:'center',gap:2}),children:[(0,f.jsx)(o.T,{weight:"semibold",size:17,center:!0,children:e.dish}),null!=n.gp?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.T,{size:26,weight:"bold",center:!0,colour:r,children:[(0,d.pct)(n.gp)," GP"]}),(0,f.jsxs)(o.T,{testID:"dish-gp-fc",size:h.font.small,center:!0,weight:"semibold",colour:x[(0,d.foodCostTone)(n.foodCostPct??0,P)],children:["Food cost ",(0,d.pct)(n.foodCostPct??0)," (target ",P,"%)"]}),(0,f.jsxs)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:["Cost ",(0,d.money)(n.perPortion)," \xb7 GP ",(0,d.money)(n.cashGp)," \xb7 ",(0,d.money)(n.price)," inc VAT (",(0,d.money)(a)," ex)"]}),'ok'!==n.tone?(0,f.jsxs)(o.T,{size:h.font.small,center:!0,weight:"semibold",colour:r,children:["Under the ",n.target,"% target",n.suggested?` \xb7 price for target ${(0,d.money)(n.suggested)}`:'']}):null]}):(0,f.jsxs)(o.T,{size:h.font.small,center:!0,colour:h.colours.muted,children:["Not costed yet",e.price?` \xb7 ${(0,d.money)(e.price)} inc VAT`:'']})]}),i?(0,f.jsx)(b.CardGpPanel,{card:e,actor:t,mode:"edit"}):null]},e.id)}),I.length?null:(0,f.jsx)(o.T,{center:!0,colour:h.colours.muted,children:"No recipe cards yet."})]})}},1117,[873,31,264,128,817,835,1209,822,1104,1297,1298,824,1146,1497,1143,1114,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_ACTOR",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CAR_DEVICE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"CAR_DEFAULT_LABEL",{enumerable:!0,get:function(){return u}}),e.carDeviceIdentity=c,e.actorStamp=function(t){if(t.isCar)return r;if((0,n.isKitchenViaDisplay)())return(0,n.kitchenActor)();if('device'===t.kind)return'Display';return t.staffRef&&String(t.staffRef).trim()||t.fallback||'Staff'},e.migrateCarStaffIdentity=function(n){return n?.venueId?c({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,label:n.label}):null},e.carPairApproved=function(n){return'approved'===String(n?.status??'')&&!(!n?.venue_id&&!n?.venueId)};var n=_r(d[0]);const r='Car',t='car-device',u='Tesla';function c(n){return{kind:'device',venueId:String(n.venue_id??n.venueId??''),venueSlug:String(n.venue_slug??n.venueSlug??'anchorage'),venueName:String(n.venue_name??n.venueName??'The Anchorage'),canWrite:!0,role:'owner',displayName:r,label:n.label&&String(n.label).trim()||u}}},1118,[1302]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FAIR_USE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useAssistant",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"tasksUsed",{enumerable:!0,get:function(){return b}});var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]);const c=300,u=(0,s.create)()((0,l.persist)(e=>({enabled:!0,voice:!0,tier:'pro',baseUsed:41,log:[],set:t=>e(t),record:t=>e(e=>({log:[{...t,id:`as-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`},...e.log].slice(0,200)})),clearLog:()=>e({log:[]})}),{name:'covercharge-assistant-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:(e,t)=>t<2?{...e,enabled:!0,voice:!0}:e})),b=e=>((0,t.examplesAllowed)()?e.baseUsed:0)+e.log.filter(e=>['done','demo (nothing sent)','looked up'].includes(e.outcome)).length},1119,[1112,1080,1072,1081]); +__d(function(_g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setDisplaySilent",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"soundAllowed",{enumerable:!0,get:function(){return u}}),e.chime=function(t="bright"){if(!u())return void l('__ccChimesBlocked');try{const n=o();if(!n)return;('bright'===t?[880,1318.5]:[659.3]).forEach((o,c)=>{const i=n.currentTime+.16*c,u=n.createOscillator(),l=n.createGain();u.type='sine',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime('bright'===t?.12:.07,i+.02),l.gain.exponentialRampToValueAtTime(1e-4,i+.9),u.connect(l).connect(n.destination),u.start(i),u.stop(i+.95)}),l('__ccChimes')}catch{}},Object.defineProperty(e,"LOW_CHIME_MIN",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"LOW_CHIME_MAX",{enumerable:!0,get:function(){return d}}),e.lowChime=function(t=0){if(!u())return void l('__ccChimesBlocked');const n=s+.095*Math.max(0,Math.min(1,t));'undefined'!=typeof window&&(window.__ccLowChimeLevels=[...window.__ccLowChimeLevels??[],Math.round(1e3*n)/1e3].slice(-40));try{const t=o();if(!t)return;[220,164.8].forEach((o,c)=>{const i=t.currentTime+.42*c,u=t.createOscillator(),l=t.createGain(),s=t.createBiquadFilter?.();u.type='triangle',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime(n,i+.12),l.gain.exponentialRampToValueAtTime(1e-4,i+1.6),s?(s.type='lowpass',s.frequency.value=900,u.connect(s).connect(l).connect(t.destination)):u.connect(l).connect(t.destination),u.start(i),u.stop(i+1.7)}),l('__ccLowChimes')}catch{}},Object.defineProperty(e,"flapSoundOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setFlapSound",{enumerable:!0,get:function(){return w}}),e.flapClick=function(){if('display'!==t.APP_VARIANT&&!c)return;if(!p())return;try{const t=o();if(!t)return;const n=t.currentTime,c=Math.floor(.03*t.sampleRate),i=t.createBuffer(1,c,t.sampleRate),u=i.getChannelData(0);for(let t=0;t{if('undefined'==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;return t?(n||(n=new t),'suspended'===n.state&&n.resume?.().catch?.(()=>{}),n):null};if('undefined'!=typeof window){const t=()=>{try{o()}catch{}window.removeEventListener('pointerdown',t)};window.addEventListener('pointerdown',t)}let c=!1;const i=t=>{c=t},u=()=>'display'!==t.APP_VARIANT&&!c,l=t=>{'undefined'!=typeof window&&(window[t]=(window[t]??0)+1)};const s=.015,d=.11;const f='cc-flap-sound',p=()=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(f)}catch{return!1}},w=t=>{try{localStorage.setItem(f,t?'1':'0')}catch{}}},1120,[123,807]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PhoneAlerts=function({what:e="reminders and alerts set for you"}){const[s,h]=(0,t.useState)(null),[u,p]=(0,t.useState)(null),[y,f]=(0,t.useState)(null);(0,t.useEffect)(()=>{let e=!0;return(0,r.inApkWebView)()?h('apk'):(0,r.pushState)().then(t=>{e&&h(t)}).catch(()=>{e&&p('Could not check alerts. Try again.')}),()=>{e=!1}},[]);const b='on'===s?'Alerts are on for this phone.':'blocked'===s?i.BLOCKED_INTRO:'ios-home-screen'===s?'iPhone: add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.':'unsupported'===s?'This browser can\u2019t get alerts when the phone is locked. Open CoverCharge in Chrome.':null;return(0,c.jsxs)(n.default,{testID:"phone-alerts",style:{gap:10,alignItems:'center'},children:[(0,c.jsxs)(l.T,{center:!0,size:16,children:["Get the ",e," on this phone, even when the app is closed."]}),'apk'===s?(0,c.jsx)(l.T,{size:18,weight:"bold",colour:o.colours.gold,center:!0,testID:"alerts-open-chrome",children:"Open CoverCharge in Chrome to turn on alerts"}):null,b?(0,c.jsx)(l.T,{center:!0,size:15,testID:"alerts-status",children:b}):null,'off'===s?(0,c.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,c.jsx)(l.Button,{label:"Turn on alerts",testID:"turn-on-alerts",accessibilityLabel:"Turn on alerts. Your phone will then ask to allow notifications: tap Allow.",style:{minHeight:64,minWidth:260},onPress:async()=>{p(null);try{const e=await(0,r.turnOnPush)();p(e.message),e.ok?h('on'):h(await(0,r.pushState)())}catch{p('Could not turn on alerts. Please try again.')}}}),(0,c.jsx)(l.T,{size:16,center:!0,testID:"alerts-allow-line",children:"When your phone asks, tap Allow."})]}):null,'blocked'===s?(0,c.jsx)(n.default,{style:{gap:6,alignItems:'center',alignSelf:'stretch'},testID:"alerts-blocked-steps",accessible:!0,accessibilityLabel:i.BLOCKED_SPOKEN,children:i.BLOCKED_STEPS.map((e,t)=>(0,c.jsx)(l.T,{size:15,center:!0,children:`${t+1}. ${e}`},t))}):null,'blocked'===s?(0,c.jsx)(l.Button,{label:"I\u2019ve allowed it, check again",testID:"alerts-recheck",accessibilityLabel:"I\u2019ve allowed it. Check again.",style:{minHeight:64,minWidth:260},onPress:async()=>{p(null);try{if('blocked'===await(0,r.pushState)())return void p(i.STILL_OFF);const e=await(0,r.turnOnPush)();p(e.message),h(e.ok?'on':await(0,r.pushState)())}catch{p('Could not check alerts. Please try again.')}}}):null,'on'===s?(0,c.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,c.jsx)(l.Button,{label:"Send me a test notification",testID:"push-test",accessibilityLabel:"Send me a test notification. It goes only to your own phone.",style:{minHeight:56,minWidth:260},onPress:async()=>{f('Sending\u2026'),f((await(0,r.sendTestPush)()).message)}}),y?(0,c.jsx)(n.default,{accessibilityLiveRegion:"polite",children:(0,c.jsx)(l.T,{size:15,center:!0,testID:"push-test-msg",children:y})}):null,(0,c.jsx)(l.Button,{small:!0,kind:"ghost",label:"Turn off alerts on this phone",testID:"turn-off-alerts",onPress:async()=>{const e=await(0,r.turnOffPush)();p(e.message),h(await(0,r.pushState)())}})]}):null,u?(0,c.jsx)(n.default,{accessibilityLiveRegion:"assertive",accessibilityRole:'alert',children:(0,c.jsx)(l.T,{size:15,center:!0,testID:"push-msg",children:u})}):null,(0,c.jsx)(l.Muted,{center:!0,size:13,children:"For this phone only. Each person turns it on on their own phone."})]})};var e,t=_r(d[0]),s=_r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(d[2]),i=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6])},1121,[31,128,817,990,824,1065,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOrderSheets",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useSheets",{enumerable:!0,get:function(){return f}});var e,s=r(d[0]),t=r(d[1]),h=r(d[2]),n=r(d[3]),o=(e=n)&&e.__esModule?e:{default:e},c=r(d[4]),i=r(d[5]),u=r(d[6]);const p=()=>h.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{}:{anchorage:u.ANCHORAGE_SHEETS.filter(e=>!e.placeholder).map(e=>({...e,items:e.items.map(e=>({...e}))}))},l=(0,c.create)()((0,i.persist)(e=>({sheets:p(),opened:{},upsert:(s,t)=>e(e=>{const h=e.sheets[s]??[];return{sheets:{...e.sheets,[s]:h.some(e=>e.id===t.id)?h.map(e=>e.id===t.id?t:e):[...h,t]}}}),patch:(s,t,h)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).map(e=>e.id===t?{...e,...h}:e)}})),remove:(s,t)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).filter(e=>e.id!==t)}})),markOpened:(s,t)=>e(e=>({opened:{...e.opened,[s]:t}})),reset:s=>e(e=>({sheets:{...e.sheets,[s]:'anchorage'===s&&p().anchorage||[]}}))}),{name:'covercharge-ordersheets-v1',storage:(0,i.createJSONStorage)(()=>o.default),version:3,migrate:async e=>{const h=e;return s.LIVE_VENUE_BUILD?(await(0,t.archiveChefCache)('order-sheets',h),{...h,sheets:{...h.sheets,anchorage:(h.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}}):h}})),_=[],f=e=>l(s=>s.sheets[e])??_},1122,[842,1221,5,1080,1072,1081,1123]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"METHOD_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY3",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAYS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"wd",{enumerable:!0,get:function(){return i}}),e.dayRange=function(t){const n=[...new Set(t)].sort((t,n)=>t-n);if(!n.length)return'';if(7===n.length)return'every day';return n.every((t,o)=>o===0||t===n[o-1]+1)&&n.length>=3?`${o[n[0]]} to ${o[n[n.length-1]]}`:n.map(t=>o[t]).join(', ')},e.nextDelivery=a,Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return d}}),e.remindersFor=function(t,n,o={}){const d=i(n);return t.filter(t=>t.orderDays.includes(d)).flatMap(t=>{if(o[t.id]&&new Date(o[t.id]).toDateString()===n.toDateString())return[];let d=!1;if(/^\d\d:\d\d$/.test(t.cutoff)){const[o,s]=t.cutoff.split(':').map(Number),i=new Date(n);i.setHours(o,s,0,0),d=n>i}const l=a(t,n),c=t.reminder||`Order ${t.name} today${l?` for ${s[i(l)]}`:''}`;return[{supplierId:t.id,name:t.name,text:`${c}${t.cutoff?d?` (cut-off ${t.cutoff} passed)`:` by ${t.cutoff}`:''}`,tone:d?'red':'amber',cutoffPassed:d}]})},e.orderLines=function(n,o,s,i=""){const a=n.items.filter(t=>(o[t.id]??0)>0).map(n=>`${(0,t.fishInStone)(i,n)?(0,t.fishQtyText)(i,n,o[n.id]):`${l(o[n.id])} ${n.unit}`} ${n.name}`.replace(/\s+/g,' ').trim());return s.split('\n').map(t=>t.trim()).filter(Boolean).forEach(t=>a.push(t)),a},e.orderMessage=function(t,n,o,s,i,l){const c=a(t,l);return[`Hi ${t.contact||t.name.split(' (')[0]}, order from ${n}${o?`, ${o}`:''}${c?` for ${d(c)}`:''}:`,...s.map(t=>`- ${t}`),'',`Thanks, ${i}`].join('\n')},e.intlDigits=c,Object.defineProperty(e,"smsLink",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"waLink",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"telLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"sid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_SHEETS",{enumerable:!0,get:function(){return k}});var t=r(_d[0]);const n={online:'Online',phone:'Phone',text:'Text message',whatsapp:'WhatsApp',tbc:'To be decided'},o=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],s=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],i=t=>(t.getDay()+6)%7;function a(t,n){const o=null!=t.deliversOn?[t.deliversOn]:t.deliveryDays;if(!o.length)return null;for(let t=1;t<=7;t++){const s=new Date(n);if(s.setDate(s.getDate()+t),o.includes(i(s)))return s}return null}const d=t=>t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});const l=t=>Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,'');function c(t){const n=t.replace(/[^\d+]/g,'').replace(/^\+/,'');return n.startsWith('00')?n.slice(2):n.startsWith('0')?`44${n.slice(1)}`:n}const u=(t,n)=>`sms:${t.replace(/[^\d+]/g,'')}?&body=${encodeURIComponent(n)}`,m=(t,n)=>`https://wa.me/${c(t)}?text=${encodeURIComponent(n)}`,f=t=>`tel:${t.replace(/[^\d+]/g,'')}`;let p=0;const h=(t="os")=>`${t}-${Date.now().toString(36)}${(p++).toString(36)}`,y=(t,n,o)=>({id:t,name:n,unit:o}),b=t=>({number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:'',...t}),k=[b({id:'os-reids',name:'Reids',goods:'Dry goods and frozen',method:'online',urlLabel:'Open Coldweb',deliveryDays:[0,1,2,3,4],frequency:'Order on Coldweb',items:[y('rd-chips','Frozen chips','boxes'),y('rd-oil','Fryer oil','tubs'),y('rd-flour','Flour','bags'),y('rd-rice','Rice','bags'),y('rd-peas','Frozen peas','bags')],notes:'Order on their Coldweb ordering site. Add the Coldweb link in Managers \u203a Settings \u203a Supplier order sheets, or here.'}),b({id:'os-veg',name:'Veg',goods:'Fruit and veg (supplier to be added)',method:'tbc',placeholder:!0,frequency:'To be added by Gordon',notes:'Placeholder: Gordon will add the veg supplier, how to order and delivery days.'}),b({id:'os-peroni',name:'J. Pieroni & Sons',goods:'Seafood (fish merchant, Ayr)',method:'phone',url:'https://pieronis.com',urlLabel:'Open pieronis.com',deliveryDays:[0,1,2,3,4,5],frequency:'Phone order',items:[y('pa-haddock','Haddock fillets','kg'),y('pa-mussels','Mussels','kg'),y('pa-scallops','Scallops','kg'),y('pa-salmon','Salmon','kg')],notes:'Phone order. Press Call, then read the order from the screen.'}),b({id:'os-spesbona',name:'Spes Bona',goods:'Langoustines and smoked haddock',method:'text',orderDays:[2],deliversOn:4,deliveryDays:[4],frequency:'Text on Wednesday for Friday',reminder:'Text Spes Bona today for Friday\u2019s langoustines and smoked haddock',items:[y('sb-langs','Langoustines','kg'),y('sb-smoked','Smoked haddock','kg')]}),b({id:'os-tarelgin',name:'Tarelgin',goods:'Butcher',method:'text',frequency:'Text order',items:[y('tg-steak','Ribeye steaks',''),y('tg-mince','Steak mince','kg'),y('tg-chicken','Chicken breasts',''),y('tg-sausage','Sausages','kg')]}),b({id:'os-mills',name:'Mills',goods:'Milk',method:'whatsapp',frequency:'WhatsApp message',items:[y('ml-milk','Milk','litres'),y('ml-cream','Double cream','litres'),y('ml-butter','Butter','kg')]}),b({id:'os-kittyfisher',name:'Kittyfisher boat (Big Sean)',goods:'Lobsters and crabs',method:'text',contact:'Sean',frequency:'Whenever stock is low',shellfish:!0,items:[y('kf-lobster','Lobsters',''),y('kf-crab','Crabs','')],notes:'Text Big Sean whenever the lobster or crab count runs low.'}),b({id:'os-lionsmane',name:'Lion\u2019s mane mushroom',goods:'Lion\u2019s mane mushrooms',method:'online',urlLabel:'Open seller',frequency:'Weekly or fortnightly',priceCapPerKg:2500,seller:'Cheapest UK seller (to be chosen)',items:[y('lm-kg','Lion\u2019s mane mushroom','kg')],notes:'Order online from the cheapest UK seller under the price cap. Check the price per kg before you buy.'})]},1123,[1293]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1124,[5,887,31,121,197,123,264,128,288,824,867,1597,817,1213,1066,888,1599,2,1125,1126,822,821,25,110]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},1126,[31,1072,871,823,1125]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from your suppliers',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add supplier links for this venue, with an account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add against a supplier (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and supplier lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cprep fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, supplier lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cprep fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. At The Anchorage, blocks also close those times on website bookings, and blocks made on the website show in CoverCharge. Website bookings can only close the whole venue, not one area or some tables.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display has a Gift vouchers button: it opens the list of website vouchers (search, use by dates, Mark as used), with Show the buy QR code at the bottom. Guests buy on your website.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','per adult','children','waive','waived','regular','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per adult (children never pay: a table of 8 with 3 children pays for 5), the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.','To let a regular off, tap Waive deposit on the booking (or in Edit booking), add why if you like, and tap Yes, waive it. Your name is saved with it.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the small QR card on their table (Managers \u203a Table QR codes prints them, 20 to a page), see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or with their server; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, pick Stickers 50 \xd7 50 mm or Stand cards 50 \xd7 70 mm, then Print all QR cards (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 5 days, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1127,[]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1128,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return w}}),_e.noMoney=k,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return D}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return j.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${$[t.risk]}${O(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=D(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(m.BOOKING_CHANGE_ACTIONS.has(e)&&!(0,b.currentCanChangeBookings)())return{status:'error',message:m.BOOKING_VIEW_ONLY};if(('staff'===a.app||'staff'===a.role)&&!w(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if(O(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(I(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(u.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:S(a.app,a.role)?k(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=Y,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,h.normaliseHeard)(e)).toLowerCase()} `,r=(0,l.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of j){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!w(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):Y(e,t),score:i.s};if('owner'!==o){const t=(0,l.searchHelp)(p.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const d=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(d){const e=P.find(e=>e.words.some(e=>d[1].includes(e)));if(e)return{kind:'action',action:D('open_screen'),params:{screen:e.title},score:2}}const u=(0,l.searchHelp)(p.HELP,e,3);return u.length?{kind:'help',ids:u.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),f=_r(_d[13]),h=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]);const w=e=>!e.apps||e.apps.includes('staff'),y=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function k(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!y.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const v=e=>y.test(e),S=(e,t)=>'display'===e||'staff'===e||'staff'===t,$={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},O=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,I=e=>'send'===e||'pay'===e||'delete'===e,_=e=>(n.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),N=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},C=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},P=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],A=['owner'],M=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],T=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=M.indexOf(t.toLowerCase());return a>0?String(a):t};function E(e,t){if(!e||null==t||''===t)return'';const s=T(t),r=o.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),i=n?r[n]:void 0;return i?i.blocked?`. ${(0,a.tableNumbers)(s)} is marked blocked`:i.dirty?`. ${(0,a.tableNumbers)(s)} still needs clearing`:i.stage?`. ${(0,a.tableNumbers)(s)} already has people seated`:'':''}const j=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:A,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:P.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=P.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:A,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:p.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,p.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,p.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>d.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u2013100)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,h.walkInCovers)(e);a&&(t.covers=a);const s=(0,h.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${T(e.table)}`:' (table to assign)'}${E(t?.rid,e.table)}`,run:async(e,a)=>{const s=Number(e.covers);return(0,t.validParty)(s)?(await i.repo.bookings.seatWalkIn(a.rid,s,e.table?T(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${s} seated${e.table?` at table ${T(e.table)}`:''}. It\u2019s in Bookings now.`):`${t.PARTY_RULE} Say for example \u201cwalk-in of 2 at table 4\u201d.`}},{id:'add_rota_shift',apps:A,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${_(e.staffId)}, ${e.date?N(String(e.date)):'?'}, ${C(Number(e.start))}\u2013${C(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);if(!(e.staffId&&e.date&&a>t))return'That shift isn\u2019t complete.';const s=(0,n.leaveOn)(n.useOwner.getState().leave,String(e.staffId),String(e.date));return s?`${_(e.staffId)} has time off then (${N(s.from)} to ${N(s.to)}). Add the shift on the Rota yourself if they\u2019ve agreed to work.`:(n.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${_(e.staffId)} on ${N(String(e.date))} (${(0,n.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`)}},{id:'publish_rota',apps:A,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:A,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:A,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:A,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${_(e.staffId)}\u2019s shift${e.date?` on ${N(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...c.VOICE_ACTIONS,...f.STAFF_VOICE_ACTIONS,...s.OPS_VOICE_ACTIONS,...r.GAP_VOICE_ACTIONS],D=e=>j.find(t=>t.id===e);const L={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},x=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function R(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function Y(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},r=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);r&&(s.covers=L[r[1]]??Number(r[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,n.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=x.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,n.weekdayOf)(t);s.date=(0,n.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=R(p[1].trim()),t=R(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=n.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,n.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1129,[1652,1456,811,1653,1654,861,822,828,1001,1127,1128,1130,1655,1656,1215,1096,1318]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return p}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[1]),d=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},p=(0,n.create)()((0,d.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,n,d,o,p)=>{const f=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===n&&'draft'===e.status);if(f){const t={...f,lines:[...f.lines,...d]};return e(e=>({drafts:e.drafts.map(e=>e.id===f.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:n,title:'Supplier shopping list',lines:d,by:o,app:p})},decide:(t,s,n)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:n,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,d.createJSONStorage)(()=>s.default)}))},1130,[1080,1072,1081]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1131,[1080,1072,1081]); +__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}}},1132,[1080,1072,1081]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"desktopStt",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"desktopSttState",{enumerable:!0,get:function(){return u}}),_e.warmDesktopStt=function(){o()&&l()},Object.defineProperty(_e,"cleanHeard",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"tabletWithoutMic",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canRecord",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"canListen",{enumerable:!0,get:function(){return w}}),_e.micPermission=b,Object.defineProperty(_e,"RATE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PRE_ROLL_MS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"HANG_MS",{enumerable:!0,get:function(){return A}}),_e.releaseMic=O,Object.defineProperty(_e,"echoWanted",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"micConstraints",{enumerable:!0,get:function(){return j}}),_e.warmMic=async function(){try{if(o()||!y())return;if(!S&&'granted'!==await b())return;if(await D(),C){C.armedUntil=Date.now()+1500;try{C.ctx.resume?.()}catch{}}x()}catch{}},_e.disarmMic=function(){C&&!C.rec&&(C.armedUntil=0,C.ring=[],C.ringLen=0)},_e.askMic=async function(){try{return await D(),x(),!0}catch{return!1}},_e.wavOf=L,Object.defineProperty(_e,"MAX_CLIP_MS",{enumerable:!0,get:function(){return _}}),_e.listen=B,Object.defineProperty(_e,"CloudRecognition",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"speechRecognizer",{enumerable:!0,get:function(){return N}}),_e.levelMeter=async function(e){const t=n()?.navigator?.mediaDevices,r=n()?.AudioContext||n()?.webkitAudioContext;if(!t?.getUserMedia||!r)return()=>{};let o,i,a=0,c=!1;try{if(o=await t.getUserMedia({audio:!0}),c)return o.getTracks().forEach(e=>e.stop()),()=>{};i=new r;const s=i.createMediaStreamSource(o),u=i.createAnalyser();u.fftSize=512,s.connect(u);const l=new Uint8Array(u.fftSize),d=()=>{u.getByteTimeDomainData(l);let t=0;for(let e=0;e{}}return()=>{c=!0;try{n().cancelAnimationFrame(a)}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}}},_e.yesNo=function(e){const t=e.toLowerCase().trim().replace(/[.!,]/g,'');return/^(yes|yeah|yep|yup|aye|confirm|confirmed|do it|go ahead|correct|that's right|ok|okay|yes please)\b/.test(t)?'yes':/^(no|nope|cancel|stop|don't|do not|wrong|never mind)\b/.test(t)?'no':null},Object.defineProperty(_e,"buzz",{enumerable:!0,get:function(){return W}});var e=_r(_d[0]),t=_r(_d[1]);const n=()=>'undefined'==typeof window?void 0:window,r=()=>n()?.ccDesktop,o=()=>!!r()?.stt&&!!r()?.sttWorker;let i=null,a=0;const c=new Map;let s='cold';const u=()=>s;function l(){if(i)return i;const e=n()?.Worker,t=r()?.sttWorker;return e&&t?(i=new e(t,{type:'module'}),s='loading',i.onmessage=e=>{const t=e.data??{};if(t.ready)return void(s='ready');t.failed&&(s='failed');const n=c.get(t.id);n&&(c.delete(t.id),n(t))},i.onerror=()=>{s='failed',c.forEach(e=>e({error:'stt-failed'})),c.clear()},i.postMessage({warm:!0}),i):null}const d=e=>e.replace(/\[[^\]]*\]|\([^)]*\)/g,' ').replace(/\s+/g,' ').trim();function f(e,t){let o,i,s,u,f=!1,p=!1;const y=[];let w=16e3;const b=()=>{try{s?.disconnect(),u?.disconnect()}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}if(p)return;const n=y.reduce((e,t)=>e+t.length,0);if(n<.35*w)return void t('');const r=new Float32Array(n);let f=0;for(const e of y)r.set(e,f),f+=e.length;const b=16e3===w?r:h(r,w,16e3),v=l();if(!v)return void t('','stt-failed');e('Turning speech into text on this Mac\u2026');const M=++a;c.set(M,e=>t(d(e.text??''),e.error)),v.postMessage({id:M,audio:b},[b.buffer])};return(async()=>{try{if(r()?.askMic){if(!await r().askMic())return void t('','not-allowed')}if(o=await n().navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),f)return void b();const e=n().AudioContext||n().webkitAudioContext;try{i=new e({sampleRate:16e3})}catch{i=new e}w=i.sampleRate,u=i.createMediaStreamSource(o),s=i.createScriptProcessor(4096,1,1),s.onaudioprocess=e=>{f||y.push(new Float32Array(e.inputBuffer.getChannelData(0)))},u.connect(s),s.connect(i.destination),l()}catch(e){t('','NotAllowedError'===e?.name?'not-allowed':'audio-capture')}})(),{stop:()=>{f||(f=!0,b())},abort:()=>{p=!0,f=!0,b()}}}function h(e,t,n){const r=Math.round(e.length*n/t),o=new Float32Array(r),i=t/n;for(let t=0;t{const e=String(n()?.navigator?.userAgent??'');return/CoverChargeTablet\//.test(e)&&!/CoverChargeTablet\/[\d.]+ mic/.test(e)},y=()=>!p()&&!(!n()?.MediaRecorder||!n()?.navigator?.mediaDevices?.getUserMedia),w=()=>o()||y();async function b(){try{const e=n()?.navigator?.permissions?.query;if(!e)return'unknown';const t=await Promise.race([n().navigator.permissions.query({name:'microphone'}),new Promise(e=>setTimeout(()=>e(null),1500))]);return'granted'===t?.state||'denied'===t?.state||'prompt'===t?.state?t.state:'unknown'}catch{return'unknown'}}const v=16e3,M=500,A=450;let P,S=null,T=!1,k=!1,C=null;function U(){const e=C;if(C=null,e){try{e.node.disconnect(),e.src.disconnect()}catch{}try{e.ctx.close()}catch{}e.ring=[],e.rec=null}}function O(){clearTimeout(P),U();try{S?.getTracks().forEach(e=>e.stop())}catch{}S=null}const x=()=>{clearTimeout(P),P=setTimeout(O,/iPhone|iPad|iPod|Macintosh/.test(String(n()?.navigator?.userAgent??''))&&!r()?.mac?6e5:6e4)},R=()=>!1,j=(e=R())=>({audio:{channelCount:{ideal:1},sampleRate:{ideal:v},sampleSize:{ideal:16},echoCancellation:e,noiseSuppression:!0,autoGainControl:!0}});async function D(){clearTimeout(P);const e=R();if(S&&T===e&&S.getAudioTracks().some(e=>'live'===e.readyState))return S;if(S&&O(),S=await n().navigator.mediaDevices.getUserMedia(j(e)),T=e,!k){k=!0;try{n().document.addEventListener('visibilitychange',()=>{'hidden'===n().document.visibilityState&&O()})}catch{}}return E(S),S}function E(e){U();try{const t=n().AudioContext||n().webkitAudioContext;if(!t)return;let r;try{r=new t({sampleRate:v})}catch{r=new t}const o=r.createMediaStreamSource(e),i=r.createScriptProcessor(2048,1,1),a={ctx:r,node:i,src:o,rate:r.sampleRate,ring:[],ringLen:0,rec:null,frames:0,armedUntil:0,level:()=>{}},c=Math.round(.5*a.rate);i.onaudioprocess=e=>{const t=new Float32Array(e.inputBuffer.getChannelData(0));if(a.frames+=t.length,a.rec&&a.rec.push(t),!a.rec&&Date.now()>a.armedUntil)return a.ring=[],void(a.ringLen=0);for(a.ring.push(t),a.ringLen+=t.length;a.ring.length>1&&a.ringLen-a.ring[0].length>=c;)a.ringLen-=a.ring[0].length,a.ring.shift();let n=0;for(let e=0;ee+t.length,0),r=new Float32Array(n);let o=0;for(const t of e)r.set(t,o),o+=t.length;const i=t===v?r:h(r,t,v),a=new ArrayBuffer(44+2*i.length),c=new DataView(a),s=(e,t)=>{for(let n=0;n{clearTimeout(c),clearTimeout(s),S&&(S.rec=null,S.level=()=>{}),x()},k=(e,t,n)=>{h||f||(h=!0,o(e,t,n))};let U=!1;const O=async()=>{if(U)return;U=!0;const n=b,o=S?S.frames-P:0;if(T(),f)return;const i=Date.now()-y,a=!!n&&n.length>0&&o/M*1e3>.6*i?L(n,M):new Blob(w,{type:(p?.mimeType||w[0]?.type||'audio/webm').split(';')[0]});if(i<350||a.size<500)return void k('');r('Turning speech into text\u2026');const c=await(0,e.transcribe)(t,a);c.ok?k(c.text.trim(),void 0,{receipt:c.receipt}):k('',c.reason,{message:c.text})};(async()=>{try{const e=await D();if(d)return T(),void k('');if(S=C,S){try{S.ctx.resume?.()}catch{}b=[...S.ring],M=S.rate,P=S.frames-S.ringLen,S.rec=b,S.level=e=>{i?.(e),a&&!d&&(e>.12?(u=!0,l=0):u&&e<.05&&(l=l||Date.now(),Date.now()-l>1500&&j()))}}const t=F();p=new(n().MediaRecorder)(e,t?{mimeType:t,audioBitsPerSecond:48e3}:void 0),p.ondataavailable=e=>{e.data?.size&&w.push(e.data)},p.onstop=()=>{O()},p.onerror=()=>{b?.length?O():(T(),k('','audio-capture'))},p.start(),y=Date.now(),c=setTimeout(()=>{r('That\u2019s the 30-second limit. Sending now\u2026'),R()},_)}catch(e){T(),k('','NotAllowedError'===e?.name||'SecurityError'===e?.name?'not-allowed':'audio-capture')}})();const R=()=>{try{p&&'inactive'!==p.state?p.stop():O()}catch{O()}},j=()=>{d||(d=!0,p&&(s=setTimeout(R,a?0:A)))};return{stop:j,abort:()=>{f=!0,d=!0,clearTimeout(s);try{p&&'inactive'!==p.state&&p.stop()}catch{}T()}}}function B(e,t,n="owner",r,i=!1){return o()?f(e,t):y()?z(n,e,t,r,i):null}class I{lang='en-GB';interimResults=!1;continuous=!1;maxAlternatives=1;onresult=null;onerror=null;onend=null;l=null;start(){const e='customer'===t.APP_VARIANT?'owner':t.APP_VARIANT;if(this.l=B(()=>{},(e,t)=>{if(this.l=null,t)this.onerror?.({error:t});else if(e){const t=Object.assign([{transcript:e,confidence:1}],{isFinal:!0});this.onresult?.({resultIndex:0,results:[t]})}this.onend?.()},e,void 0,!0),!this.l)throw new Error('not-supported')}stop(){this.l?.stop()}abort(){const e=this.l;this.l=null,e?.abort(),e&&this.onend?.()}}const N=()=>w()?I:null;const W=(e=30)=>{try{n()?.navigator?.vibrate?.(e)}catch{}}},1133,[1214,807]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RELEASE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"nightlyEmailAllowed",{enumerable:!0,get:function(){return t}});const n={specialsSync:!0,nightlyEmail:!1,nightlyPush:!1,supportSync:!0,planPhoto:!0},t=(t,l)=>'anchorage'!==t&&l&&n.nightlyEmail},1134,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestSpecialsAfter=function(t,n){return n.ok?n.board?t&&t.postedAt>n.board.postedAt?{board:t,note:''}:{board:n.board,note:''}:{board:null,note:''}:{board:t,note:n.message}},Object.defineProperty(e,"GUEST_SPECIALS_OFFLINE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SUPPORT_NOT_SENT",{enumerable:!0,get:function(){return n}}),e.supportAfterWrite=function(t,o){return t.trim()?o.ok?{text:t,sent:!0,note:''}:{text:t,sent:!1,note:o.message||n}:{text:t,sent:!1,note:''}};const t='The specials board could not be loaded. What is already on this phone is unchanged.',n='Saved on this phone. It was not sent.'},1135,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPABASE_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SUPABASE_ANON_KEY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isSupabaseConfigured",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"REALTIME_TABLES",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n="https://rowdoidkftriylijobuy.supabase.co",o="sb_publishable_rPm723MQz6FwmFVHy6e1SA_ko-_-6GR",u=()=>!t.PITCH&&n.startsWith('https://')&&o.length>20,s=['bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_counts']},1136,[2]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1137,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_BUTTONS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return o}}),e.menuSizes=function(s,o){const t=Math.round(Math.max(300,Math.min(s-24,s>=1600?520:s>=1200?460:420))),l=Math.floor((t-40-2)/3),n=Math.floor(Math.max(84,(o-72-40)/4)),c=o>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,l-28));return{panelW:t,colW:l,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return t}});const s=[{id:'rota',label:'Rota',short:'Rota',icon:'rota',pages:[{id:'rota',label:'Rota'}]},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff',pages:[{id:'signoff',label:'Sign off hours'},{id:'timesheets',label:'Timesheets'}]},{id:'menu',label:'Menu & sold out',short:'Menu',icon:'menu',pages:[{id:'soldout',label:'Sold out'},{id:'menu',label:'Menu & allergens'},{id:'tableqr',label:'Table QR codes'}]},{id:'bookings',label:'Bookings',short:'Bookings',icon:'bookings',pages:[{id:'@bookings',label:'Bookings'},{id:'lookback',label:'Look back'}]},{id:'noshows',label:'No-shows',short:'No-shows',icon:'noshow',pages:[{id:'@noshows',label:'No-shows'}]},{id:'chat',label:'Staff chat',short:'Chat',icon:'chat',pages:[{id:'@chat',label:'Staff chat'}]},{id:'stock',label:'Stock & suppliers',short:'Stock',icon:'stock',pages:[{id:'kitchencosts',label:'Deliveries & GP'},{id:'trackedstock',label:'Tracked stock'},{id:'orderlists',label:'Order lists'},{id:'suppliers',label:'Suppliers'}]},{id:'loyalty',label:'Loyalty',short:'Loyalty',icon:'loyalty',pages:[{id:'loyalty',label:'Stamp card'}]},{id:'takings',label:'Takings & tips',short:'Takings',icon:'takings',pages:[{id:'cashup',label:'Cash up & sales'},{id:'tips',label:'Tips'},{id:'spendhead',label:'Spend per head'}]},{id:'safety',label:'Food safety',short:'Safety',icon:'safety',pages:[{id:'haccp',label:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]},{id:'assistant',label:'Assistant',short:'Assistant',icon:'assistant',pages:[{id:'assistant',label:'Assistant'}]}],o=56;const t=s=>s.split('').join(' ')},1138,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ParkedOnly=function({small:e}){return(0,s.jsx)(n.default,{testID:"parked-only",accessible:!0,accessibilityLabel:"Parked only. Use this screen only when the car is in Park.",style:{minHeight:e?28:36,paddingHorizontal:e?8:12,borderRadius:999,borderWidth:1,borderColor:t.colours.amber,backgroundColor:'rgba(232,168,56,0.12)',alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,s.jsx)(o.T,{size:e?11:13,weight:"semibold",colour:t.colours.amber,center:!0,children:"PARKED ONLY"})})},r(d[0]);var e,l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),s=r(d[4])},1139,[31,128,817,824,25]); +__d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.useGameClock=I,_e.usePlayable=function(e,t){return(0,y.gamePlayable)(I(e,t))},Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return C}}),_e.gameBase=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return C(e?.settings?.gameUrl)??v},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,b.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=I(e,s),u=(0,y.gamePlayable)(c);return n?(0,w.jsxs)(d.Card,{children:[(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(d.T,{size:13,colour:u?x.colours.ok:x.colours.muted,children:u?'Open':'Locked'})]}),(0,w.jsx)(d.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),u?null:(0,w.jsx)(d.Muted,{testID:"break-room-locked-text",children:y.GAME_LOCKED_TEXT}),(0,w.jsx)(d.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,w.jsx)(R,{staffId:e,name:t,playable:u,clock:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return T}}),_e.BreakRoom=R;var t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),n=e(r),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),c=e(_r(_d[6])),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),m=_r(_d[10]),y=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),p=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]),x=_r(_d[17]),w=_r(_d[18]);function I(e,t){const s=(0,m.useOwner)(e=>e.attendance);return(0,y.gameClock)(s,e,t)}const v='https://lennys-kitchen-chaos-13e285.deed.page/',C=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function S(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const T=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:I,playable:R,clock:P,onClose:L,car:M}){const D=(0,m.useOwner)(e=>e.staff),O=(0,f.useAvatars)(e=>e.photos),_=(0,h.useSetup)(e=>e.looks),z=(0,r.useRef)(null),[N,U]=(0,r.useState)({}),[A,B]=(0,r.useState)(!1),[G,q]=(0,r.useState)(null),H=(0,b.useStore)(e=>C(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??v),V=(0,r.useMemo)(()=>S(H),[H]),W=V?.origin??'',$=(0,j.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),K=!(!$||!e||$===e),X=K?null:$??e??null,Y=T(I),[F,J]=(0,r.useState)(''),[Q,Z]=(0,r.useState)(null),ee=(0,r.useRef)(null),te=(0,r.useRef)(0),se=(0,r.useRef)(null),re=(0,r.useRef)(R);re.current=R;const ne=(0,r.useMemo)(()=>D.filter(e=>e.active&&!e.name.includes('(example)')),[D]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const s of ne){const r=null!=_[s.id]&&_[s.id]>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===_[s.id]):void 0;if(r){e[s.id]=r.dataUrl;continue}const n=document.getElementById(`cc-av-${s.id}`)?.querySelector('svg');n&&(e[s.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n.outerHTML.includes('xmlns')?n.outerHTML:n.outerHTML.replace('clearTimeout(e)},[ne,_]);const oe=(0,r.useMemo)(()=>ne.map(e=>{const t=O[e.id]?.dataUrl??N[e.id],s={id:e.id,name:T(e.name),role:e.job||e.level||e.role};return t&&(s.avatarUrl=t),s}),[ne,O,N]),le=(0,r.useCallback)(e=>{try{W&&z.current?.contentWindow?.postMessage(e,W)}catch{}},[W]);return(0,r.useEffect)(()=>{const e=async e=>{if(!W||e.origin!==W||e.source!==z.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return q('string'==typeof t.version?String(t.version).slice(0,12):null),void B(!0);const s=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.listScores)(s,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!X||'string'==typeof e.staffId&&e.staffId!==X)return void le({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,k.listScores)(s,10),id:null}});const r='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.submitScore)(s,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:r,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:X,name:Y})})}'lenny:roundAbandoned'===t.type&&J('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&J(''),'lenny:progress'===t.type&&X&&t.staffId===X&&(0,k.saveProgress)(X,t.progress),'lenny:gameComplete'===t.type&&X&&t.staffId===X&&J(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[le,X,Y,W]),(0,r.useEffect)(()=>{B(!1),ee.current=null,se.current=null},[V?.src]),(0,r.useEffect)(()=>{if(!A)return;const e=e=>{se.current!==e&&(se.current=e,le({type:'lenny:setPlayable',playable:e}))},t=K?null:`${X??''}|${Y}`;if(t&&ee.current===t)return void e(R);const s=++te.current;ee.current=null,se.current&&e(!1),t&&(0,k.loadProgress)(X).catch(()=>null).then(r=>{s===te.current&&(le({type:'lenny:setPlayer',name:Y,staffId:X,...r?{progress:r}:{}}),ee.current=t,e(re.current))})},[A,K,X,Y,R,le]),(0,r.useEffect)(()=>{A&&le({type:'lenny:setRoster',staff:oe})},[A,oe,le]),(0,r.useEffect)(()=>{A&&null!==Q&&le({type:'lenny:setMuted',muted:Q})},[A,Q,le]),(0,w.jsx)(o.default,{visible:!0,animationType:"slide",onRequestClose:L,children:(0,w.jsxs)(c.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,s.soutersSurface)('#000')},children:[M?(0,w.jsx)(E,{status:K?'Switching player\u2026':R?'Parked only \xb7 enjoy!':'Game locked',muted:!!Q,onPause:()=>le({type:'lenny:pause'}),onMute:()=>Z(!Q),onClose:L}):(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:x.colours.bg},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(c.default,{testID:R&&!K?'break-playable':'break-locked',accessibilityLabel:G?`Game version ${G}`:void 0,children:(0,w.jsx)(d.T,{size:13,colour:R?x.colours.ok:x.colours.gold,children:K?'Switching player\u2026':R?'off'===P?'Off shift: enjoy!':'On your break: enjoy!':'Game locked'})}),(0,w.jsxs)(d.Row,{gap:4,children:[(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:Q?'Turn sound and voice on':'Mute sound and voice',onPress:()=>Z(!Q),style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:Q?'Sound on':'Mute'})}),(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",onPress:L,style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:"Close"})})]})]}),R||K?null:(0,w.jsx)(c.default,{testID:"break-locked-text",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.text,children:y.GAME_LOCKED_TEXT})}),F?(0,w.jsx)(c.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.muted,children:F})}):null,V?n.default.createElement('iframe',{ref:z,src:V.src,key:V.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,w.jsx)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(d.Muted,{children:"The Break room opens in the web app."})}),(0,w.jsx)(c.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:ne.map(e=>(0,w.jsx)(c.default,{nativeID:`cc-av-${e.id}`,children:(0,w.jsx)(u.AvatarLook,{look:_[e.id],id:e.id,name:e.name,size:96})},e.id))})]})})}function E({status:e,muted:t,onPause:s,onMute:r,onClose:n}){const o={minHeight:72,minWidth:150,paddingHorizontal:22,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'};return(0,w.jsxs)(c.default,{testID:"car-game-bar",style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:16,paddingVertical:10,backgroundColor:x.colours.bg,borderBottomWidth:1,borderColor:x.colours.border},children:[(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",accessibilityLabel:"Close the game",onPress:n,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Close"})}),(0,w.jsx)(l.default,{testID:"car-game-pause",accessibilityRole:"button",accessibilityLabel:"Pause the game",onPress:s,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Pause"})}),(0,w.jsxs)(c.default,{style:{flex:1,alignItems:'center',minWidth:0},children:[(0,w.jsx)(d.T,{size:22,weight:"semibold",center:!0,numberOfLines:1,children:"Lenny\u2019s Kitchen Chaos"}),(0,w.jsx)(d.T,{size:15,colour:x.colours.goldLight,center:!0,numberOfLines:1,children:`${e} \xb7 touch the big buttons on the game`})]}),(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:t?'Turn sound and voice on':'Mute sound and voice',onPress:r,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:t?'Sound on':'Mute'})}),(0,w.jsx)(c.default,{testID:"car-game-parked",style:{...o,minWidth:0,borderColor:x.colours.goldMuted,backgroundColor:'rgba(201,162,74,0.12)'},children:(0,w.jsx)(d.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:"PARKED ONLY"})})]})}},1140,[1068,887,31,257,123,264,128,999,817,1094,861,1141,1032,878,5,1489,823,824,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GAME_LOCKED_TEXT",{enumerable:!0,get:function(){return t}}),e.gameClock=function(t,n,o){if(!n)return'off';const a=new Date(o).getTime(),c=t.filter(t=>t.staffId===n&&t.in&&!t.out&&a-new Date(t.in).getTime()<72e6).sort((t,n)=>String(n.in).localeCompare(String(t.in)))[0];return c?c.breaks?.some(t=>!t.end)?'break':'working':'off'},Object.defineProperty(e,"gamePlayable",{enumerable:!0,get:function(){return n}});const t='You\u2019re clocked in, so the game is locked. Start your break or clock out in CoverCharge to play.';const n=t=>'working'!==t},1141,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CoversToday=function({rid:e,onPress:p,big:x,sound:$,testID:v="covers-today",day:j,compact:C=!1,snug:w=!1,tight:T=!1,aside:k}){const D=(0,c.useBookings)(e),S=(0,c.useNow)(3e4),I=(0,h.venueYmd)(S),L=j&&j!==I?j:I,_=L!==I,M=(0,u.coversFour)(D,L),R=(0,y.dayWord)(L,I),z=/^(Today|Yesterday|Tomorrow)$/.test(R),O=`COVERS ${R.toUpperCase()}`,P=_?`${z?`${R}\u2019s`:R} bookings \u203a`:'Today\u2019s bookings \u203a',W=_?`${z?`${R}, `:''}${(0,y.dayLong)(L)}`:'today',E=(0,o.useLiveState)();if('ready'!==E)return(0,f.jsx)(o.LiveWait,{state:E,title:"Covers today",testID:`${v}-wait`});const F=x?64:T?28:w?36:44,V=M.total?Math.min(1,M.done/M.total):0,Y=(e,o,t,c)=>(0,f.jsxs)(s.default,{style:{flex:1,alignItems:'center',gap:T?2:w?4:6,minWidth:0},children:[(0,f.jsx)(l.SplitFlap,{value:o,height:F,colour:t,testID:`covers-${c}`,sound:$}),(0,f.jsx)(n.T,{size:T?11:x||C?14:12,weight:"semibold",colour:b.colours.muted,numberOfLines:1,center:C||T,style:{letterSpacing:.4},children:e})]});return(0,f.jsxs)(t.default,{testID:v,dataSet:{centreExempt:'dashboard-card'},accessibilityRole:"button",disabled:!p,onPress:p,accessibilityLabel:`Covers ${W}: ${M.done} done, ${M.seated} seated, ${M.toCome} to come, ${M.total} total.${p?` Opens ${_?'that day\u2019s':'today\u2019s'} bookings.`:''}`,style:({pressed:e})=>({backgroundColor:e?b.colours.tilePressed:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:T?6:16,...w&&!T?{paddingVertical:8,paddingHorizontal:10}:null,gap:T?4:w?8:12}),children:[T?null:(0,f.jsxs)(s.default,{style:{flexDirection:C?'column':'row',justifyContent:'space-between',alignItems:'center',gap:C?w?2:6:void 0},children:[(0,f.jsx)(n.T,{center:C,size:C?16:12,weight:"semibold",colour:b.colours.goldMuted,style:{letterSpacing:1.6},children:O}),p?(0,f.jsx)(n.T,{center:C,size:C?14:12,colour:b.colours.muted,children:P}):null]}),(0,f.jsxs)(s.default,{style:{flexDirection:'row',gap:8},children:[Y('Done',M.done,b.colours.text,'done'),Y('Seated',M.seated,b.colours.text,'seated'),Y('To come',M.toCome,b.colours.text,'tocome'),Y('Total',M.total,b.colours.goldLight,'total')]}),T?null:(0,f.jsx)(s.default,{style:{height:4,borderRadius:2,backgroundColor:'rgba(255,255,255,0.06)',overflow:'hidden'},children:(0,f.jsx)(s.default,{style:{width:`${Math.round(100*V)}%`,height:4,backgroundColor:b.colours.gold,borderRadius:2}})})]})},r(d[0]);var o=r(d[1]),t=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),b=r(d[10]),f=r(d[11])},1142,[31,1413,264,128,1442,817,822,831,821,1433,824,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpOverTime=function({rid:e,width:b}){const $=(0,n.useGpCalcView)(),P=(0,o.useRecipeCards)(e),[w,k]=(0,s.useState)('3m'),[v,D]=(0,s.useState)(b??0),_=(0,s.useMemo)(()=>P.map(e=>({id:e.id,dish:e.dish,price:e.price})),[P]),M=(0,s.useMemo)(()=>(0,a.menuGp)($.ingredients,$.cardCosts??{},_,$.settings),[$.ingredients,$.cardCosts,_,$.settings]),G=(0,s.useMemo)(()=>(0,a.gpHistory)(Object.values($.deliveries??{}),M,w),[$.deliveries,M,w]),T=(0,s.useMemo)(()=>M.dishes.map(e=>{const s=G.points.find(s=>null!=s.dishes[e.id])?.dishes[e.id];return{...e,ch:null!=s?e.gp-s:0}}).sort((e,s)=>Math.abs(s.ch)-Math.abs(e.ch)),[M.dishes,G.points]),[A,I]=(0,s.useState)(null),C=(A??T.slice(0,3).map(e=>e.id)).filter(e=>T.some(s=>s.id===e)).slice(0,3),L=(0,a.gpSummary)(G.points,w),F=240,S=(0,s.useMemo)(()=>v>0?(0,u.gpChartLayout)(v,F,G.points,C,M.dishes.map(e=>e.target)):null,[v,G.points,C,M.dishes]),z=e=>M.dishes.find(s=>s.id===e)?.name??G.names[e]??'Dish';return(0,p.jsxs)(d.Box,{testID:"gp-over-time",children:[(0,p.jsx)(r.T,{size:20,weight:"bold",center:!0,colour:c.colours.gold,accessibilityRole:"header",children:"GP over time"}),(0,p.jsx)(r.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['4w','3m','12m'].map(e=>(0,p.jsx)(h.Pick,{testID:`gp-range-${e}`,label:a.RANGE_SAID[e],accessibilityLabel:`Show ${a.RANGE_SAID[e]}`,selected:w===e,onPress:()=>k(e)},e))}),(0,p.jsxs)(t.default,{testID:"gp-summary",accessible:!0,accessibilityLabel:L,accessibilityLiveRegion:"polite",style:{alignItems:'center',gap:2},children:[(0,p.jsx)(r.T,{size:30,weight:"bold",center:!0,colour:m,children:null!=M.menu?`${M.menu.toFixed(1)}%`:'\u2014'}),(0,p.jsx)(r.T,{size:c.font.small,center:!0,colour:c.colours.muted,children:L.replace(/^Menu GP now [\d.]+ percent, ?/,'').replace(/\.$/,'')||'Menu GP'})]}),(0,p.jsx)(t.default,{testID:"gp-chart",onLayout:b?void 0:e=>D(Math.floor(e.nativeEvent.layout.width)),importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{width:'100%',height:F,alignItems:'center'},children:S?(0,p.jsxs)(l.default,{width:S.width,height:F,children:[S.yTicks.map(e=>(0,p.jsx)(i.Line,{x1:u.GP_LEFT_BAND,x2:S.width-8,y1:e.y,y2:e.y,stroke:c.colours.border,strokeWidth:1},`g${e.v}`)),S.yTicks.map(e=>(0,p.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:u.GP_LEFT_BAND-6,y:e.y+4,fontSize:12,fill:c.colours.muted,textAnchor:"end",children:`${e.v}%`},`y${e.v}`)),null!=S.target?(0,p.jsx)(i.Line,{x1:u.GP_LEFT_BAND,x2:S.width-8,y1:S.target,y2:S.target,stroke:y,strokeDasharray:"4 4",strokeWidth:1}):null,S.area?(0,p.jsx)(i.Path,{d:S.area,fill:y,fillOpacity:.18}):null,S.dishPaths.map((e,s)=>(0,p.jsx)(i.Path,{d:e.d,stroke:x,strokeWidth:2,strokeDasharray:f[s]||void 0,fill:"none"},e.id)),S.menuPath?(0,p.jsx)(i.Path,{d:S.menuPath,stroke:m,strokeWidth:3,fill:"none"}):null,S.menuDots.map((e,s)=>(0,p.jsx)(i.Circle,{cx:e.x,cy:e.y,r:3,fill:m},s)),G.markers.map((e,s)=>{const t=S.xOfWeek(e.week);if(null==t)return null;const l=F-u.GP_AXIS_BAND-2;return(0,p.jsx)(i.Polygon,{points:`${t-5},${l} ${t+5},${l} ${t},${l-8}`,fill:y},`${e.id}${s}`)}),S.xLabels.map(e=>(0,p.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:e.x,y:234,fontSize:12,fill:c.colours.muted,textAnchor:"middle",children:e.text},e.text+e.x))]}):null}),(0,p.jsxs)(r.Row,{wrap:!0,gap:12,style:{justifyContent:'center'},children:[(0,p.jsx)(j,{colour:m,label:"Menu GP"}),C.map((e,s)=>(0,p.jsx)(j,{colour:x,dash:f[s],label:z(e)},e)),(0,p.jsx)(j,{colour:y,label:"Delivery changed costs",tri:!0})]}),T.length?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.T,{size:c.font.small,center:!0,colour:c.colours.muted,children:"Dishes on the chart (up to 3)"}),(0,p.jsx)(r.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:T.slice(0,12).map(e=>(0,p.jsx)(h.Pick,{testID:`gp-dish-${e.id}`,label:`${e.name} ${e.gp.toFixed(0)}%`,accessibilityLabel:`${e.name}, GP ${e.gp.toFixed(1)} percent${Math.abs(e.ch)>=.05?`, ${e.ch>0?'up':'down'} ${Math.abs(e.ch).toFixed(1)} points over ${a.RANGE_SAID[w]}`:', steady'}. ${C.includes(e.id)?'On the chart':'Tap to add to the chart'}`,selected:C.includes(e.id),onPress:()=>{return s=e.id,I(C.includes(s)?C.filter(e=>e!==s):[...C,s].slice(-3));var s}},e.id))})]}):(0,p.jsx)(r.Muted,{center:!0,children:"Cost your recipe cards to see dish GP here."}),G.markers.length?(0,p.jsxs)(t.default,{testID:"gp-markers",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(r.T,{size:c.font.small,center:!0,weight:"semibold",children:"Deliveries that changed costs"}),G.markers.slice(-5).reverse().map(e=>(0,p.jsxs)(r.T,{size:c.font.small,center:!0,colour:null!=e.change&&e.change<-.05?c.colours.amber:c.colours.muted,children:[e.date.split('-').reverse().join('/')," \xb7 ",e.supplier||'Supplier',null!=e.change?` \xb7 menu GP ${e.change>0?'+':''}${e.change.toFixed(1)} pts`:'']},e.id))]}):null]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=_r(_d[2]),l=e(i),r=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const m=c.colours.gold,x='#C9CCD1',y='#B0773B',f=['','6 4','2 4'];function j({colour:e,label:s,tri:n,dash:o}){return(0,p.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',gap:6},accessible:!1,children:[(0,p.jsx)(l.default,{width:18,height:12,children:n?(0,p.jsx)(i.Polygon,{points:"4,11 14,11 9,2",fill:e}):(0,p.jsx)(i.Line,{x1:0,x2:18,y1:6,y2:6,stroke:e,strokeWidth:3,strokeDasharray:o||void 0})}),(0,p.jsx)(r.T,{size:c.font.small,colour:c.colours.muted,children:s})]})}},1143,[31,128,1017,817,1209,822,1299,824,1146,1114,1501,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:l,inStaffApp:n,shiftManager:a,big:o,testID:d}){const[h,p]=(0,t.useState)(!1),x=(0,u.useSession)(e=>e.meId),y=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:n,role:l,shiftManager:a})||x&&!(0,m.canChangeBookings)(y)?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S.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:()=>p(!0),style:{minHeight:o?64:44}}),h?(0,$.jsx)(F,{rid:e,id:s.id,who:i,onClose:()=>p(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:l,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,n.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,$.jsx)(F,{rid:e,id:o,who:i,hidePrivate:a,onClose:l}):(0,$.jsxs)(S.Sheet,{visible:!0,onClose:l,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,$.jsx)(S.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${N(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}, ${N(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,$.jsx)(S.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,$.jsx)(S.Button,{kind:"ghost",label:"Close",onPress:l,style:{minHeight:44}})]})},_e.EditBookingSheet=F;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),l=(e=i)&&e.__esModule?e:{default:e},n=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),u=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),C=_r(_d[19]),f=_r(_d[20]),I=_r(_d[21]),w=_r(_d[22]),k=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]);const P=/^([01]\d|2[0-3]):[0-5]\d$/,O=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const N=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,j.ymd)(s)?'Tomorrow':B(e)};const E=e=>e?(e/100).toFixed(e%100?2:0):'',W=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},B=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',z=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')}`:''},R=e=>e.charAt(0).toUpperCase()+e.slice(1);function L({title:e,children:t,testID:s}){return(0,$.jsxs)(l.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:y.colours.hairline,alignItems:'stretch'},children:[(0,$.jsx)(S.T,{size:17,weight:"semibold",center:!0,colour:y.colours.goldLight,children:e}),t]})}const A=({label:e,value:t,onChange:s,max:i=20,testID:l})=>(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,children:e}),(0,$.jsx)(S.Stepper,{testID:l,value:t,min:0,max:i,onChange:s,label:e})]});function F({rid:e,id:i,who:u,onClose:b,hidePrivate:m=!1}){(0,I.useBlurOutside)();const N=(0,n.useBookings)(e),F=N.find(e=>e.id===i),M=(0,d.useRestaurant)(e),H=(0,a.usePlan)(e),_=(0,o.useBlocks)(e=>e.blocks),[V,Y]=(0,t.useState)(F?(0,c.draftOf)(F):null),[G,U]=(0,t.useState)(null),[q,X]=(0,t.useState)(null),[K,Q]=(0,t.useState)(E(F?(0,c.draftOf)(F).depositDue:0)),[J,Z]=(0,t.useState)(E(F?(0,c.draftOf)(F).depositAmount:0)),[ee,te]=(0,t.useState)(B(F?(0,c.draftOf)(F).depositDate:''));if(!F||!V||!M)return null;const se=e=>{U(null),X(null),Y({...V,...e})},ie=(0,k.depositOf)(M.settings),le=e=>{const t=e.partySize??V.partySize,s=Math.min(e.children??V.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(F)&&V.depositOn&&!V.depositPaid&&W(K||'0')===(0,k.depositDue)(ie,V.partySize,V.children??0)){const e=(0,k.depositDue)(ie,t,s);e>0&&Q(E(e))}se({...e,children:s})},ne=O(V.time),ae=P.test(ne),oe=V.area?H.areas.filter(e=>e.name===V.area).map(e=>e.id):null,de=e=>!oe||e.split('+').every(e=>oe.includes(H.tables.find(t=>t.name===e)?.areaId??'')),re=(0,x.tableOptions)(H,N.filter(e=>e.date===V.date),V.table).filter(e=>de(e)||e===V.table),ce=!(V.depositOn&&(Number.isNaN(W(K||'0'))||V.depositPaid&&(Number.isNaN(W(J||'0'))||ee.trim()&&!z(ee)))),he={...V,time:ne,depositDue:W(K||'0')||0,depositAmount:W(J||'0')||0,depositDate:z(ee)},pe=(0,c.changedFields)(F,he),ue=M.settings.turnMins??90,ge=async()=>{const t=(0,c.editPatch)(F,he,{by:u||'Team member',app:r.APP_VARIANT});if(Object.keys(t).length&&await n.repo.bookings.update(F.id,t),'seated'===F.status&&'table'in t&&t.table!==F.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(F.table),l=s(t.table),n=a.useFloor.getState(),o=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!l.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),l.forEach(t=>n.setLive(e,t,{stage:o,dirty:!1}))}X(`Saved. Changed: ${(0,c.editedWords)(pe)}.`),U(null),b()},be=V.allergies??[],me=e=>se({allergyNone:!1,allergies:be.some(t=>t.allergen===e)?be.filter(t=>t.allergen!==e):[...be,{allergen:e,severity:'allergy'}]}),xe=(0,c.historyLines)(F);return(0,$.jsxs)(S.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${F.name} \xb7 ${F.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,$.jsx)(l.default,{style:{alignItems:'center'},children:(0,$.jsx)(v.DepositChip,{b:F,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(F)?(0,$.jsx)(l.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,$.jsxs)(L,{title:"Deposit",testID:"edit-section-deposit",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"No deposit",selected:!V.depositOn,testID:"edit-deposit-none",onPress:()=>se({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,$.jsx)(S.Chip,{label:"Deposit due",selected:!!V.depositOn&&!V.depositPaid&&!V.depositWaived,testID:"edit-deposit-due",onPress:()=>se({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,$.jsx)(S.Chip,{label:"Deposit paid",selected:!!V.depositOn&&!!V.depositPaid,testID:"edit-deposit-paid",onPress:()=>{J||Z(K),ee||te(B((0,j.ymd)(new Date))),se({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),V.depositOn&&!V.depositPaid&&V.depositWaived?(0,$.jsx)(S.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),V.depositOn&&!V.depositPaid&&V.depositWaived?(0,$.jsxs)(S.T,{size:15,center:!0,colour:y.colours.goldLight,testID:"edit-deposit-waived-by",children:[F.depositWaived?.by?(0,k.waiverText)(F.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,V.depositWaived||pe.includes('deposit')?null:(0,$.jsx)(l.default,{style:{alignItems:'center'},children:(0,$.jsx)(w.WaiveDepositButton,{b:F,who:u,onDone:e=>Y({...V,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e})})}),V.depositOn?(0,$.jsx)(S.Field,{label:"Deposit due (\xa3)",value:K,onChangeText:e=>{Q(e),se({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,V.depositOn&&V.depositPaid?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S.Field,{label:"Amount paid (\xa3)",value:J,onChangeText:e=>{Z(e),se({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"How was it paid?"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,$.jsx)(S.Chip,{label:R(e),selected:V.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>se({depositMethod:e})},e))}),(0,$.jsx)(S.Field,{label:"Date paid (DD/MM/YYYY)",value:ee,onChangeText:e=>{te((0,s.slashDate)(e,ee)),se({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),ee.trim()&&!z(ee)?(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ce?null:(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,$.jsx)(S.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,$.jsxs)(L,{title:"When",testID:"edit-section-when",children:[(0,$.jsx)(D.BookingDatePicker,{r:M,today:new Date,value:V.date,onChange:e=>se({date:e})}),(0,$.jsx)(S.Field,{label:"Time (24-hour, for example 19:15)",value:V.time,onChangeText:e=>se({time:e}),testID:"edit-time"}),ae?null:(0,$.jsx)(S.T,{size:15,colour:y.colours.amber,children:"Write the time like 19:15."}),(0,$.jsx)(C.AdultsChildren,{value:(0,f.peopleOf)(V.partySize,V.children),onChange:e=>le(e),depositsOn:ie.on&&ie.perPersonPence>0,testID:"edit-people"}),(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,children:"Table time"}),(0,$.jsx)(S.Stepper,{testID:"edit-duration",value:V.duration||0,min:0,max:360,step:15,onChange:e=>se({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,$.jsxs)(L,{title:"Where",testID:"edit-section-where",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"Any area",selected:!V.area,testID:"edit-area-any",onPress:()=>se({area:''})}),H.areas.map(e=>(0,$.jsx)(S.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:V.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>se({area:e.name})},e.id))]}),(0,$.jsx)(S.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(V.table)}),(0,x.splitChoices)(V.table).length?(0,$.jsxs)(l.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:"Split the joined tables"}),(0,$.jsx)(S.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,x.splitChoices)(V.table).map(e=>(0,$.jsx)(S.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>se({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,$.jsxs)(S.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Button,{kind:V.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(V.table?'':', chosen'),onPress:()=>se({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),re.map(e=>(0,$.jsx)(S.Button,{kind:e===V.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===V.table?', chosen':''}`,onPress:()=>se({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,$.jsxs)(L,{title:"Guest",testID:"edit-section-guest",children:[(0,$.jsx)(S.Field,{label:"Name",value:V.name,onChangeText:e=>se({name:e}),testID:"edit-name"}),(0,$.jsx)(S.Field,{label:"Phone",value:V.phone,onChangeText:e=>se({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,$.jsx)(S.Field,{label:"Email",value:V.email,onChangeText:e=>se({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"Booked by"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:V.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>se({source:e.id})},e.id))}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(V.tags??[]).includes(e);return(0,$.jsx)(S.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>se({tags:t?(V.tags??[]).filter(t=>t!==e):[...V.tags??[],e].sort()})},e)})})]}),(0,$.jsxs)(L,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,$.jsx)(A,{label:"Dogs",value:V.dogs??0,max:6,onChange:e=>se({dogs:e}),testID:"edit-dogs"}),(0,$.jsx)(A,{label:"High chairs",value:V.highChairs??0,max:10,onChange:e=>se({highChairs:e}),testID:"edit-high-chairs"}),(0,$.jsx)(A,{label:"Wheelchair users",value:V.wheelchair??0,max:10,onChange:e=>se({wheelchair:e}),testID:"edit-wheelchair"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"Occasion"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:(V.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>se({occasion:e.id})},e.id||'none'))})]}),(0,$.jsxs)(L,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"No allergies",selected:!!V.allergyNone&&!be.length,testID:"edit-allergy-none",onPress:()=>se({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,$.jsx)(S.Chip,{label:e.short,selected:be.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>me(e.id)},e.id))]}),be.map(e=>(0,$.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,$.jsxs)(S.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,$.jsx)(S.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>se({allergies:be.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,$.jsx)(S.Field,{label:"Anything else about allergies",value:V.allergyNote,onChangeText:e=>se({allergyNote:e}),testID:"edit-allergy-note"}),pe.includes('allergies')&&be.length?(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,$.jsx)(A,{label:"Vegan",value:V.vegan??0,max:V.partySize,onChange:e=>se({vegan:e}),testID:"edit-vegan"}),(0,$.jsx)(A,{label:"Vegetarian",value:V.vegetarian??0,max:V.partySize,onChange:e=>se({vegetarian:e}),testID:"edit-vegetarian"})]}),(V.holds??[]).length||(F.holds??[]).some(e=>e.qty>0&&!e.served)?(0,$.jsxs)(L,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,$.jsx)(S.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(V.holds??[]).map(e=>{const t=(0,h.reservablesOf)(M),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),n=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,$.jsxs)(l.default,{testID:n,style:{gap:6,width:'100%'},children:[(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,$.jsx)(S.Stepper,{testID:n,value:e.qty,min:0,max:20,onChange:t=>se({holds:(0,c.setEditableHoldQty)(V.holds??[],e.kind,e.id,t)}),label:i})]}),(0,$.jsx)(S.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${n}-remove`,onPress:()=>se({holds:(0,c.removeEditableHold)(V.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(V.holds??[]).length?null:(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==F.status?(0,$.jsxs)(L,{title:"Status",testID:"edit-section-status",children:[(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:V.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>se({status:e.id})},e.id))}),(0,$.jsx)(S.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,$.jsx)(L,{title:"Notes",testID:"edit-section-notes",children:(0,$.jsx)(S.Field,{label:"Notes",value:V.notes,onChangeText:e=>se({notes:e}),placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),G?(0,$.jsxs)(l.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg},children:[G.map(e=>(0,$.jsx)(S.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,$.jsx)(S.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,q?(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:q}):null,(0,$.jsxs)(S.Row,{gap:8,wrap:!0,children:[(0,$.jsx)(S.Button,{label:G?'Save anyway':'Save changes',testID:"edit-save",disabled:!ae||!ce||V.name.trim().length<1||!pe.length,onPress:()=>{const t=ae?(0,o.blockAt)(_,e,V.date,ne):void 0,s=(0,c.editWarnings)(F,he,N,t,ue,H);!s.length||G?ge():U(s)},style:{minHeight:56,flex:1}}),(0,$.jsx)(S.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),xe.length?(0,$.jsx)(L,{title:"Changes",testID:"edit-history",children:xe.slice(0,12).map((e,t)=>(0,$.jsx)(S.T,{size:14,center:!0,colour:y.colours.muted,children:e},t))}):null,(0,$.jsx)(T.CancelBookingButton,{rid:e,b:F,name:F.name,big:!0,onDone:()=>b()}),(0,$.jsx)(T.ReinstateBookingButton,{b:F,name:F.name,today:(0,j.ymd)(new Date),onDone:()=>b()})]})}},1144,[31,833,128,822,828,827,1074,807,816,831,818,865,861,1096,1450,824,821,1460,1448,1457,1458,1459,1469,14,1467,817,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},1145,[31,128,1450,824,1451,817,25]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Tabs=function({value:e,options:o,onChange:i}){return(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:o.map(o=>(0,c.jsx)(t.default,{accessibilityRole:"tab",accessibilityState:{selected:e===o.id},accessibilityLabel:o.label,testID:`tab-${o.id}`,onPress:()=>i(o.id),style:{maxWidth:'100%',minWidth:0,flexShrink:1,paddingHorizontal:14,paddingVertical:9,minHeight:44,justifyContent:'center',borderRadius:999,borderWidth:1,borderColor:e===o.id?r.colours.gold:r.colours.border,backgroundColor:e===o.id?r.colours.goldTint:'transparent'},children:(0,c.jsx)(n.T,{size:14,weight:e===o.id?'semibold':'regular',colour:e===o.id?r.colours.goldLight:r.colours.text,children:o.label})},o.id))})},Object.defineProperty(_e,"Box",{enumerable:!0,get:function(){return a}}),_e.speechRecognition=function(){return'undefined'==typeof window?null:(0,i.speechRecognizer)()},_e.downloadText=function(e,t,o="text/csv"){if('undefined'==typeof document)return!1;const n=new Blob(['\ufeff'+t],{type:`${o};charset=utf-8`}),r=document.createElement('a');return r.href=URL.createObjectURL(n),r.download=e,document.body.appendChild(r),r.click(),setTimeout(()=>{URL.revokeObjectURL(r.href),r.remove()},1e3),!0},_e.printTable=function(e,t,o,n){if('undefined'==typeof window)return!1;const r=window.open('','_blank');return!!r&&(r.document.write(`${l(e)}

${l(e)}

${l(t)}

${o.map(e=>``).join('')}${n.map(e=>`${e.map(e=>``).join('')}`).join('')}
${l(e)}
${l(e)}
+ diff --git a/abbotsford/owner-app/owner.html b/abbotsford/owner-app/owner.html index e3fef61eb03fb794fa9bccd77d3276f7dd3ba56d..c4f6644f21db1153034c6fcd13a8da7e9d09ac2d 100644 --- a/abbotsford/owner-app/owner.html +++ b/abbotsford/owner-app/owner.html @@ -30,6 +30,6 @@
The Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

- + diff --git a/abbotsford/owner-app/sw.js b/abbotsford/owner-app/sw.js index d08ae5937bcb49d4e18140ef5d7319b8705b1653..edb999747bb5415dc6ea125e5bf1c0b0ee39c1bd 100644 --- a/abbotsford/owner-app/sw.js +++ b/abbotsford/owner-app/sw.js @@ -1,4 +1,4 @@ -const V="cc-abbotsford-owner-df8512ccb793009f",B="/abbotsford/owner-app/",P=["/abbotsford/owner-app/apple-touch-icon.png", "/abbotsford/owner-app/favicon.ico", "/abbotsford/owner-app/icon-192.png", "/abbotsford/owner-app/icon-512.png", "/abbotsford/owner-app/brand-logo.png", "/abbotsford/owner-app/index.html", "/abbotsford/owner-app/manifest.webmanifest", "/abbotsford/owner-app/brand-hero.png", "/abbotsford/owner-app/owner.html", "/abbotsford/owner-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/abbotsford/owner-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/abbotsford/owner-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/abbotsford/owner-app/_expo/static/js/web/index-e196fd8b19ecc6189ee08bcd5ff2f404.js", "/abbotsford/owner-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/abbotsford/owner-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/abbotsford/owner-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js", "/abbotsford/owner-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/abbotsford/owner-app/_expo/static/js/web/__common-82c5edd8143a81977246907af3ce8ed3.js", "/abbotsford/owner-app/_expo/static/js/web/[token]-3c722cbf6e54dbbeb30a3a3ee3ece670.js", "/abbotsford/owner-app/_expo/static/js/web/index-2107aa9e6c8a217a444c70efe0364fea.js", "/abbotsford/owner-app/_expo/static/js/web/index-7fc09fb9e425fe86489cd7f975b72892.js", "/abbotsford/owner-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/abbotsford/owner-app/_expo/static/js/web/index-572239673a2eda40ce1d7171531ee6dc.js", "/abbotsford/owner-app/_expo/static/js/web/book-7c4c90140093809a35e48a974143bb55.js", "/abbotsford/owner-app/_expo/static/js/web/_layout-0b153773097e9d9411f7d848b244cf55.js", "/abbotsford/owner-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/abbotsford/owner-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/abbotsford/owner-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js", "/abbotsford/owner-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js", "/abbotsford/owner-app/_expo/static/js/web/index-ea062f48524b23e23943dd0396f5fab4.js", "/abbotsford/owner-app/_expo/static/js/web/whatson-dd3d796ea1e77876d5803d9ecd8c1109.js", "/abbotsford/owner-app/_expo/static/js/web/basket-39cdf98ed8418bbc1a1ff3b2f269cbcb.js", "/abbotsford/owner-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js", "/abbotsford/owner-app/_expo/static/js/web/index-74667fbd35e0bace18ae40e63063348b.js", "/abbotsford/owner-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/abbotsford/owner-app/_expo/static/js/web/waitlist-5949dfe032d315503649cf449ffe870a.js", "/abbotsford/owner-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js", "/abbotsford/owner-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/abbotsford/owner-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/abbotsford/owner-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js", "/abbotsford/owner-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/abbotsford/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/abbotsford/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/abbotsford/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/abbotsford/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/abbotsford/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/abbotsford/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/abbotsford/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/abbotsford/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/abbotsford/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/abbotsford/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/abbotsford/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/abbotsford/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/abbotsford/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/abbotsford/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/abbotsford/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/abbotsford/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/abbotsford/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/abbotsford/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/abbotsford/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/abbotsford/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/abbotsford/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/abbotsford/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/abbotsford/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/abbotsford/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/abbotsford/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/abbotsford/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/abbotsford/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/abbotsford/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/abbotsford/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/abbotsford/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/abbotsford/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/abbotsford/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/abbotsford/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/abbotsford/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/abbotsford/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/abbotsford/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/abbotsford/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/abbotsford/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/abbotsford/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/abbotsford/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/abbotsford/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png"]; +const V="cc-abbotsford-owner-b445591e5fd1ca49",B="/abbotsford/owner-app/",P=["/abbotsford/owner-app/index.html", "/abbotsford/owner-app/icon-192.png", "/abbotsford/owner-app/owner.html", "/abbotsford/owner-app/brand-logo.png", "/abbotsford/owner-app/favicon.ico", "/abbotsford/owner-app/brand-hero.png", "/abbotsford/owner-app/icon-512.png", "/abbotsford/owner-app/apple-touch-icon.png", "/abbotsford/owner-app/manifest.webmanifest", "/abbotsford/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/abbotsford/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/abbotsford/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/abbotsford/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/abbotsford/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/abbotsford/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/abbotsford/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/abbotsford/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/abbotsford/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/abbotsford/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/abbotsford/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/abbotsford/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/abbotsford/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/abbotsford/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/abbotsford/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/abbotsford/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/abbotsford/owner-app/assets/assets/brand/smokinggoat.fff2a9a694b41fed68c80a2c9bfe65da.png", "/abbotsford/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/abbotsford/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/abbotsford/owner-app/assets/assets/brand/drunkencoo.272f746bf13376f503acd81a524a7998.png", "/abbotsford/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/abbotsford/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/abbotsford/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/abbotsford/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/abbotsford/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/abbotsford/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/abbotsford/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/abbotsford/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/abbotsford/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/abbotsford/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/abbotsford/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/abbotsford/owner-app/assets/assets/brand/3idiots-hero.77d66ccb53ec1835c3b8a838e9bcfb5a.png", "/abbotsford/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/abbotsford/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/abbotsford/owner-app/assets/assets/brand/drunkencoo-hero.7c01fed6cb075a3a8e4f969bff1cf103.png", "/abbotsford/owner-app/assets/assets/brand/smokinggoat-hero.b2ae48c4a1fcf2521ae9ff58435a6649.png", "/abbotsford/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/abbotsford/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/abbotsford/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/abbotsford/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/abbotsford/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/abbotsford/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/abbotsford/owner-app/_expo/static/js/web/index-ba5aea4e23e402619315d92ef1e4fc6c.js", "/abbotsford/owner-app/_expo/static/js/web/offers-6f2b11c7e9b64a32d3423807add6fd20.js", "/abbotsford/owner-app/_expo/static/js/web/lost-7bee77f36343c1a233e3418f75d23f28.js", "/abbotsford/owner-app/_expo/static/js/web/index-708cc108b14a03d1e55d135c08408edf.js", "/abbotsford/owner-app/_expo/static/js/web/[n]-3f651c9b2f8da617300d5ff83469d05b.js", "/abbotsford/owner-app/_expo/static/js/web/feedback-27a61e7fde96ed2d1813308c594d5cc2.js", "/abbotsford/owner-app/_expo/static/js/web/index-5740d665c1574792a94f2bf7c7b4c82c.js", "/abbotsford/owner-app/_expo/static/js/web/index-d72f0e09722c49318a402489e965ec4a.js", "/abbotsford/owner-app/_expo/static/js/web/refer-50ef95cc0d574d3f0959e4e46cb16e7b.js", "/abbotsford/owner-app/_expo/static/js/web/__common-17b45fc7dc09bbe35bd0bc963d505d46.js", "/abbotsford/owner-app/_expo/static/js/web/index-43853f84ced3460ceac2fb1eeab7aa41.js", "/abbotsford/owner-app/_expo/static/js/web/[did]-7cffbbc18605a1b0ae43a1dfeeca7cc7.js", "/abbotsford/owner-app/_expo/static/js/web/merch-0ac44aae335d66f6491e7cbd6c74ffb9.js", "/abbotsford/owner-app/_expo/static/js/web/_layout-7f60658acb1eaf9e9caa1b7bb95a26ba.js", "/abbotsford/owner-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/abbotsford/owner-app/_expo/static/js/web/profile-0387106c2cbabb84929c0ac4d099771d.js", "/abbotsford/owner-app/_expo/static/js/web/gift-966535f4abac639aff0285d23187b8d9.js", "/abbotsford/owner-app/_expo/static/js/web/index-cc6d709c3904cf0a0a38e498e6ad1600.js", "/abbotsford/owner-app/_expo/static/js/web/index-15d4c2020578b2261513b0863b18500e.js", "/abbotsford/owner-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js", "/abbotsford/owner-app/_expo/static/js/web/waitlist-30e741e4dd908f6fb56c6dddadb6b155.js", "/abbotsford/owner-app/_expo/static/js/web/[token]-575687ca5d34a1fb861b3398f12bcb98.js", "/abbotsford/owner-app/_expo/static/js/web/book-9eb7d41d6b0df6ba31ab05ad2bca1419.js", "/abbotsford/owner-app/_expo/static/js/web/[oid]-2117fdb09b7aecce4030b2d0969827e2.js", "/abbotsford/owner-app/_expo/static/js/web/index-18a42003614e46ed29f029ff3e81efd8.js", "/abbotsford/owner-app/_expo/static/js/web/basket-ae91521742c19256e50199232baaa16d.js", "/abbotsford/owner-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js", "/abbotsford/owner-app/_expo/static/js/web/index-bebd4a71bd666c5f6dfad1f7e1041c3d.js", "/abbotsford/owner-app/_expo/static/js/web/demo-bb0072f641fdd92aa99cba5bc91fc36d.js", "/abbotsford/owner-app/_expo/static/js/web/index-b591d22f86e75bc5e38941a3fc5d7bd6.js", "/abbotsford/owner-app/_expo/static/js/web/loyalty-abcebc65bafb4689aa385228ee1e65c1.js", "/abbotsford/owner-app/_expo/static/js/web/whatson-7af74fb2cd8ae06419203624b4d3656f.js"]; self.addEventListener('install',e=>e.waitUntil(caches.open(V).then(c=>Promise.all(P.map(u=>fetch(u).then(r=>{if(!r.ok)throw Error('cache');return c.put(u,r)})))).then(()=>self.skipWaiting()))); self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-abbotsford-owner-')&&k!==V).map(k=>caches.delete(k)))).then(()=>self.clients.claim()))); self.addEventListener('fetch',e=>{const u=new URL(e.request.url);if(e.request.method!=='GET'||u.origin!==location.origin||!u.pathname.startsWith(B))return;if(e.request.mode==='navigate'){e.respondWith(fetch(e.request).then(r=>r.ok?r:caches.match(B+'index.html')).catch(()=>caches.match(B+'index.html')));return;}e.respondWith(caches.match(e.request).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/abbotsford/staff-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js b/abbotsford/staff-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js new file mode 100644 index 0000000000000000000000000000000000000000..8039fc81f8fac85dbe1964b30e03ea44f335ea65 --- /dev/null +++ b/abbotsford/staff-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},802,[805,31,807,25]); \ No newline at end of file diff --git a/abbotsford/staff-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js b/abbotsford/staff-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js new file mode 100644 index 0000000000000000000000000000000000000000..283d584fafbdddc8e5e6b0b5633e099144c8d6ba --- /dev/null +++ b/abbotsford/staff-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js @@ -0,0 +1 @@ +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return b}});var n=_r(_d[0]),t=_r(_d[1]),s=_r(_d[2]),a=e(_r(_d[3])),l=e(_r(_d[4])),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]);function b(){const{rid:e,did:b}=(0,t.useLocalSearchParams)(),j=(0,h.useRestaurant)(e),x=(0,h.useMenu)(e).find(e=>e.id===b),y=(0,h.useCustomer)(),m=(0,h.useRecipeCards)(e).find(e=>e.id===x?.recipeCardId),k=m?.signOff&&m.photo?(0,g.recipeCards)().photoSource(m.photo):null,v=(0,h.useStore)(e=>e.addLine),w=(0,n.useTakeawayMenu)(n=>n.byVenue[e]),S=(0,h.useStore)(n=>n.basket.restaurantId===e&&'table'===n.basket.mode),[C,B]=(0,s.useState)(()=>(x?.optionGroups??[]).filter(e=>e.required).map(e=>e.choices[0].id)),[$,I]=(0,s.useState)(1),[P,T]=(0,s.useState)(''),[L,O]=(0,s.useState)(!1),[D,A]=(0,s.useState)(!1),[M,R]=(0,s.useState)(!1),[q,_]=(0,s.useState)(!1),N=(0,s.useMemo)(()=>x?(0,c.effectiveAllergens)(x,C):{},[x,C]);if(!j||!x)return(0,f.jsx)(d.Screen,{title:"Not found",children:(0,f.jsx)(d.T,{children:"Dish not found."})});const G=(0,c.conflictsFor)(N,y.allergies),Y=(x.price??0)+(x.optionGroups??[]).flatMap(e=>e.choices).filter(e=>C.includes(e.id)).reduce((e,n)=>e+n.priceDelta,0),z=S||j.fictional?'on':(0,n.takeawayAvail)(x,w),F=x.soldOut||!x.signOff||null===x.price||'on'!==z,Q=(e,n)=>{const t=x.optionGroups.find(n=>n.id===e);B(e=>{const s=t.choices.map(e=>e.id);return t.multi?e.includes(n)?e.filter(e=>e!==n):[...e,n]:e.includes(n)&&!t.required?e.filter(e=>e!==n):[...e.filter(e=>!s.includes(e)),n]})},V=e=>{h.useStore.getState().basket.restaurantId!==j.id&&h.useStore.getState().startBasket(j.id,'takeaway'),v({itemId:x.id,qty:$,choiceIds:C,notes:P,override:e?{allergens:G.contains,at:(new Date).toISOString()}:void 0}),O(!1),_(!0)};return(0,f.jsxs)(d.Screen,{title:x.name,subtitle:j.name,right:(0,f.jsx)(o.BasketButton,{}),children:[k?(0,f.jsx)(a.default,{testID:"dish-photo",source:k,accessibilityLabel:`${x.name}${'example'===m?.origin?' (example photo)':''}`,style:{width:'100%',height:200,borderRadius:12},resizeMode:"cover"}):null,(0,f.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(d.T,{weight:"bold",size:20,colour:p.colours.gold,children:null===x.price?x.priceNote:(0,u.gbp)(Y)}),x.dietary.map(e=>(0,f.jsx)(d.Badge,{kind:"ok",label:e},e))]}),(0,f.jsx)(d.T,{children:x.description}),G.contains.length?(0,f.jsx)(d.Banner,{kind:"danger",title:`Blocked: contains ${G.contains.map(c.allergenLabel).join(', ')}`,children:`You\u2019ve told us: ${y.allergies.filter(e=>G.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`).join('; ')}. This dish can\u2019t be added unless you deliberately override (for example, ordering for someone else).`}):null,G.may.length?(0,f.jsx)(d.Banner,{kind:"warn",title:`Warning: may contain ${G.may.map(c.allergenLabel).join(', ')}`,children:"Cross-contact is possible (e.g. shared fryer). Please speak to staff before ordering."}):null,(x.optionGroups??[]).map(e=>(0,f.jsxs)(d.Card,{children:[(0,f.jsxs)(d.T,{weight:"semibold",children:[e.name,e.required?' (required)':' (optional)']}),(0,f.jsx)(d.Row,{wrap:!0,gap:6,children:e.choices.map(n=>(0,f.jsx)(d.Chip,{label:n.label,sub:n.priceDelta?`+${(0,u.gbp)(n.priceDelta)}`:void 0,selected:C.includes(n.id),onPress:()=>Q(e.id,n.id)},n.id))})]},e.id)),(0,f.jsx)(d.Card,{children:(0,f.jsx)(r.AllergenPanel,{item:x,map:N,declared:y.allergies})}),j.fictional?null:(0,f.jsx)(d.AllergenNotice,{phone:j.phone}),(0,f.jsx)(d.Field,{label:"Notes for the kitchen (optional)",placeholder:"e.g. no gherkins",value:P,onChangeText:T}),(0,f.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(d.T,{weight:"semibold",children:"Quantity"}),(0,f.jsx)(d.Stepper,{value:$,onChange:I,label:"quantity"})]}),q?(0,f.jsx)(d.Banner,{kind:"success",title:"Added to basket",children:G.contains.length?'Allergy override recorded \u2014 the kitchen will see a large allergy alert.':'Carry on browsing or go to your basket.'}):null,F?(0,f.jsx)(d.Banner,{kind:"warn",children:x.soldOut||'sold-out'===z?'Sold out today.':'off'===z&&x.signOff&&null!==x.price?'This dish isn\u2019t on the takeaway menu. You can have it when you eat in.':x.signOff?'Price on the specials board \u2014 ask staff.':'Not available to order online until the head chef signs off its allergens.'}):G.contains.length?(0,f.jsxs)(l.default,{style:{gap:8},children:[(0,f.jsx)(d.Button,{kind:"secondary",label:"Choose something else",onPress:()=>t.router.back()}),(0,f.jsx)(d.Button,{kind:"danger",label:"Override and add anyway\u2026",onPress:()=>{A(!1),R(!1),O(!0)},testID:"override-open"})]}):(0,f.jsxs)(d.Row,{gap:8,children:[(0,f.jsx)(d.Button,{style:{flex:1},label:`Add ${$} to basket \xb7 ${(0,u.gbp)(Y*$)}`,onPress:()=>V(!1),testID:"add-to-basket"}),q?(0,f.jsx)(d.Button,{kind:"secondary",label:"Basket",onPress:()=>t.router.push('/customer/basket')}):null]}),(0,f.jsxs)(d.Sheet,{visible:L,onClose:()=>O(!1),title:"Allergy override",children:[(0,f.jsx)(d.Banner,{kind:"danger",title:`${x.name} contains ${G.contains.map(c.allergenLabel).join(', ')}`,children:`Your profile says: ${y.allergies.filter(e=>G.contains.includes(e.allergen)).map(e=>`${(0,c.allergenLabel)(e.allergen)} \u2014 ${(0,c.severityLabel)(e.severity)}`).join('; ')}.`}),(0,f.jsx)(d.Toggle,{label:"I understand this dish contains an allergen I have declared",value:D,onChange:A}),(0,f.jsx)(d.Toggle,{label:"It is for someone without this allergy, or I have spoken to staff",value:M,onChange:R}),(0,f.jsx)(d.Muted,{children:"The override is logged and shown to the kitchen as an allergy alert that must be acknowledged."}),(0,f.jsx)(d.Button,{kind:"danger",disabled:!D||!M,label:"Confirm override and add",onPress:()=>V(!0),testID:"override-confirm"})]})]})}},779,[836,805,31,197,128,837,838,818,819,820,823,839,825,25]); \ No newline at end of file diff --git a/abbotsford/staff-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js b/abbotsford/staff-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js new file mode 100644 index 0000000000000000000000000000000000000000..1bcd14167edfb4176466ea1f3be5800f7b8a603b --- /dev/null +++ b/abbotsford/staff-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),u=_r(d[4]),c=_r(d[5]),s=_r(d[6]),l=_r(d[7]);function f(){const{n:f,r:b}=(0,r.useLocalSearchParams)(),E=(0,u.useStore)(t=>t.startBasket),[_,h]=(0,n.useState)(!1),S=b??c.VENUE_RID,j=(0,u.useOrderAtTable)(S),I=(0,s.guestServer)();return(0,n.useEffect)(()=>{t.LIVE_VENUE_BUILD||I||(j&&E(S,'table',String(f)),h(!0))},[S,f,j,I]),t.LIVE_VENUE_BUILD||I?(0,l.jsx)(o.Screen,{title:"Order at the table",children:(0,l.jsx)(o.Banner,{kind:"demo",title:"Scan the code on your table",children:"To order from your table, scan the QR code printed on it. Or order at the bar."})}):_?(0,l.jsx)(r.Redirect,{href:`/customer/${S}`}):null}},795,[842,805,31,818,823,5,845,25]); \ No newline at end of file diff --git a/abbotsford/staff-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js b/abbotsford/staff-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js new file mode 100644 index 0000000000000000000000000000000000000000..ff5510d14e2cb246f1f5b3730dd146368851dce4 --- /dev/null +++ b/abbotsford/staff-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js @@ -0,0 +1,3 @@ +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=_r(d[0]),l=_r(d[1]),s=_r(d[2]),r=_r(d[3]),n=(e=r)&&e.__esModule?e:{default:e},o=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),y=_r(d[10]),b=_r(d[11]),j=_r(d[12]);const x=[['new','Placed'],['acknowledged','Accepted'],['preparing','Cooking'],['ready','Ready to collect'],['collected','Collected']],w=[['new','Sent'],['acknowledged','Accepted'],['preparing','Cooking'],['served','Food out'],['closed','Paid']];function f(){const{oid:e}=(0,l.useLocalSearchParams)(),r=(0,p.useOrder)(e),f=(0,p.useRestaurant)(r?.restaurantId),[k,T]=(0,s.useState)(0),[S,C]=(0,s.useState)(''),[v,M]=(0,s.useState)(!1),[P,A]=(0,s.useState)(0),[R,$]=(0,s.useState)(r?.split?.ways??1);if(!r||!f)return(0,j.jsx)(i.Screen,{title:"Order",children:(0,j.jsx)(i.T,{children:"Order not found."})});const O='takeaway'===r.type?x:w,I=Math.max(0,O.findIndex(([e])=>e===r.status)),N=Math.round(r.subtotal*P/100),B='table'===r.type?r.subtotal+(r.split?r.tip:N):r.total,_=B-r.paid,H=r.split?.ways??R,D=r.split?.paidShares??0,F=Math.ceil(B/H),q='collected'===r.status||'closed'===r.status;return(0,j.jsxs)(i.Screen,{title:`Order ${r.ref}`,subtitle:`${f.name} \xb7 ${'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Collection at ${r.slotTime?(0,h.hm)(new Date(r.slotTime)):'\u2014'}`}`,children:['takeaway'===r.type?(0,j.jsx)(b.TakeawayPayCard,{o:r,phone:f.phone}):null,'takeaway'===r.type&&'awaiting_payment'!==r.status&&'cancelled'!==r.status?(0,j.jsx)(i.Banner,{kind:"success",title:'ready'===r.status?'Your order is ready!':'Order placed',children:'ready'===r.status?'Head to the bar and give your order number. Staff will check allergies with you at handover.':`Show order number ${r.ref} at the bar when you arrive.`}):null,'awaiting_payment'===r.status||'cancelled'===r.status?null:(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.H2,{children:"Status"}),O.map(([e,t],l)=>(0,j.jsxs)(i.Row,{gap:10,children:[(0,j.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:l<=I?y.colours.gold:y.colours.surface2,borderWidth:1,borderColor:y.colours.gold}}),(0,j.jsx)(i.T,{weight:l===I?'semibold':'regular',colour:l<=I?y.colours.text:y.colours.muted,children:t})]},e)),r.allergyAck?(0,j.jsxs)(i.Muted,{children:["Kitchen signed off your allergies (",r.allergyAck.by,", ",(0,h.hm)(new Date(r.allergyAck.at)),")"]}):r.allergies.length?(0,j.jsx)(i.Muted,{children:"Waiting for the kitchen to sign off your allergies\u2026"}):null,'takeaway'!==r.type||q?null:(0,j.jsxs)(i.Row,{gap:8,children:[(0,j.jsx)(i.Button,{small:!0,kind:'on-my-way'===r.customerSignal?'primary':'secondary',label:"On my way",onPress:()=>p.repo.orders.customerSignal(r.id,'on-my-way')}),(0,j.jsx)(i.Button,{small:!0,kind:'here'===r.customerSignal?'primary':'secondary',label:"I\u2019m here",onPress:()=>p.repo.orders.customerSignal(r.id,'here')})]})]}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.H2,{children:"Items"}),r.lines.map((e,t)=>(0,j.jsxs)(n.default,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(i.T,{style:{flex:1},children:[e.qty,"\xd7 ",e.name]}),(0,j.jsx)(i.T,{children:(0,u.gbp)(e.unitPrice*e.qty)})]}),e.choices.length?(0,j.jsx)(i.Muted,{children:e.choices.join(' \xb7 ')}):null,e.overridden?(0,j.jsx)(i.Badge,{kind:"red",label:`Allergy override: ${e.contains.map(c.allergenLabel).join(', ')}`}):null]},t)),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Subtotal"}),(0,j.jsx)(i.T,{children:(0,u.gbp)(r.subtotal)})]}),r.giftCardApplied?(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Of which gift card"}),(0,j.jsxs)(i.T,{colour:y.colours.ok,children:["\u2212",(0,u.gbp)(r.giftCardApplied)]})]}):null,r.tip?(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Muted,{children:"Tip"}),(0,j.jsx)(i.T,{children:(0,u.gbp)(r.tip)})]}):null,(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Paid (test, no real money)"}),(0,j.jsx)(i.T,{weight:"semibold",colour:y.colours.gold,children:(0,u.gbp)(r.paid)})]})]}),'table'===r.type&&'closed'!==r.status&&'cancelled'!==r.status?(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsxs)(i.H2,{children:["Your bill \u2014 ",(0,t.tableNumbers)(r.tableNo)]}),r.split?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(i.T,{children:["Total ",(0,u.gbp)(B)," \xb7 split ",H," way",H>1?'s':''," \xb7 ",(0,u.gbp)(F)," each"]}),(0,j.jsxs)(i.T,{children:["Shares paid: ",D," of ",H," \xb7 remaining ",(0,u.gbp)(_)]}),(0,j.jsx)(i.Muted,{children:"Pay with a member of staff at your table. Online card payment for the table bill isn\u2019t set up."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Add a tip?"}),(0,j.jsx)(i.Row,{wrap:!0,children:[0,10,12.5,15].map(e=>(0,j.jsx)(i.Chip,{label:e?`${e}%`:'No tip',selected:P===e,onPress:()=>A(e)},e))}),(0,j.jsx)(i.Muted,{children:"Tips go to staff under the restaurant\u2019s tipping policy (Employment (Allocation of Tips) Act 2023)."}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Split evenly between"}),(0,j.jsx)(i.Stepper,{value:R,onChange:$,min:1,max:8,label:"people"})]}),(0,j.jsxs)(i.T,{children:["Total ",(0,u.gbp)(r.subtotal+N),R>1?` \xb7 ${(0,u.gbp)(Math.ceil((r.subtotal+N)/R))} each`:'']}),(0,j.jsx)(i.Button,{label:"Get the bill",onPress:()=>p.repo.orders.setSplit(r.id,R,N),testID:"get-bill"})]})]}):null,!q||r.rated||v?null:(0,j.jsxs)(i.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(i.H2,{children:"How was everything?"}),(0,j.jsxs)(i.Muted,{children:["One tap \u2014 this goes privately to ",f.name," only, never published."]}),(0,j.jsx)(o.Stars,{value:k,onChange:T}),k?(0,j.jsx)(i.Field,{label:"Anything to add? (optional)",value:S,onChangeText:C}):null,(0,j.jsx)(i.Button,{label:"Send feedback",disabled:!k,onPress:()=>{p.repo.feedback.add({restaurantId:f.id,orderId:r.id,customerId:r.customerId,customerName:r.customerName,stars:k,comment:S,context:'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Takeaway ${r.ref}`}),M(!0)},testID:"send-rating"})]}),v||r.rated?(0,j.jsx)(i.Banner,{kind:"success",children:"Thanks \u2014 your feedback went privately to the restaurant."}):null,q?(0,j.jsx)(i.Button,{kind:"secondary",label:"View stamp card",onPress:()=>l.router.push(`/customer/${f.id}/loyalty`)}):null]})}},792,[812,805,31,128,840,818,819,820,822,823,825,882,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPayCard=function({o:e,phone:y}){const[f,k]=(0,n.useState)(Date.now()),[w,x]=(0,n.useState)(!1),[j,b]=(0,n.useState)(''),[P,v]=(0,n.useState)(null),_=(0,n.useRef)(!1),B=(0,c.payView)(e,f);(0,n.useEffect)(()=>{const e=setInterval(()=>k(Date.now()),1e3);return()=>clearInterval(e)},[]);const T='pay'===B.kind||'expired'===B.kind&&_.current&&'awaiting_payment'===e.status;(0,n.useEffect)(()=>{if(!T||!_.current)return;const n=setInterval(()=>{(0,h.checkPaid)(e.id)},1e4),r=t.default.addEventListener('change',n=>{'active'===n&&(0,h.checkPaid)(e.id)});return()=>{clearInterval(n),r.remove()}},[T,e.id]);if('none'===B.kind)return null;if('sending'===B.kind)return(0,p.jsx)(s.Banner,{kind:"warn",title:"Saving your order\u2026",children:"Sending it to the restaurant. Card payment opens in a moment."});if('refused'===B.kind)return(0,p.jsxs)(s.Banner,{kind:"danger",title:"The restaurant couldn\u2019t take this order",children:[(0,p.jsx)(s.T,{size:14,colour:"#FFE3DF",children:`${B.reason} Nothing has been charged.`}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to the menu",onPress:()=>o.router.replace(`/customer/${e.restaurantId}`)})]});if('paid'===B.kind)return(0,p.jsx)(s.Banner,{kind:"success",title:`Paid ${(0,l.gbp)(B.amount)} by card`,children:B.late?'Your payment came in after the time ran out. The restaurant has your order and will contact you if the collection time needs to change.':'Your order has gone to the kitchen.'});if('expired'===B.kind)return(0,p.jsxs)(s.Banner,{kind:"warn",title:'awaiting_payment'===e.status?'Checking your payment\u2026':'Time ran out: order not sent',children:[(0,p.jsx)(s.T,{size:14,children:'awaiting_payment'===e.status?'We\u2019re checking with the payment page. If you paid, your order will show as paid shortly.':`Nothing has been charged. You can order again${y?` or ring ${y}`:''}.`}),'awaiting_payment'!==e.status?(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Order again",onPress:()=>o.router.replace(`/customer/${e.restaurantId}`)}):null]});return(0,p.jsxs)(s.Card,{highlight:u.colours.gold,children:[(0,p.jsx)(s.H2,{children:"Pay to send your order"}),(0,p.jsxs)(s.T,{children:["Your order goes to the kitchen once it\u2019s paid. Time left to pay: ",(0,p.jsx)(s.T,{weight:"bold",colour:B.secondsLeft<120?u.colours.red:u.colours.gold,children:(0,c.mmss)(B.secondsLeft)})]}),(0,p.jsx)(s.Button,{label:w?'Opening the payment page\u2026':`Pay ${(0,l.gbp)(e.total)} by card`,disabled:w||B.secondsLeft<120,onPress:async()=>{x(!0),b('');const n='undefined'!=typeof window?window.open('','_blank'):null,t=await(0,h.getPayLink)(e.id);if(x(!1),!t.ok)return n?.close(),void b(t.message);if(v(t.url),_.current=!0,n)try{return void(n.location.href=t.url)}catch{}},testID:"pay-card"}),B.secondsLeft<120?(0,p.jsx)(s.Muted,{children:"Not enough time left to pay. Wait for this order to expire, then order again."}):null,P?(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Open the payment page again",onPress:()=>{'undefined'!=typeof window?window.open(P,'_blank'):r.default.openURL(P)}}):null,P?(0,p.jsx)(s.Button,{small:!0,kind:"ghost",label:"I\u2019ve paid: check now",onPress:()=>{(0,h.checkPaid)(e.id)}}):null,j?(0,p.jsx)(s.T,{size:14,colour:u.colours.red,children:j}):null,(0,p.jsx)(s.Muted,{children:"Secure card payment on the restaurant\u2019s website. Apple Pay and Google Pay may be offered there."})]})};var n=_r(d[0]),t=e(_r(d[1])),r=e(_r(d[2]));_r(d[3]);var o=_r(d[4]),s=_r(d[5]),l=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10])},882,[31,232,240,123,805,818,820,825,836,883,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_OFF",{enumerable:!0,get:function(){return o}}),e.getPayLink=async function(u){try{if(!await(0,n.guestSession)())return{ok:!1,message:'Can\u2019t reach the restaurant. Check your signal and try again.'};const{data:c,error:y}=await(0,t.getSupabase)().functions.invoke('takeaway-pay',{body:{order_id:u}}),f=await s(c,y);return f&&'string'==typeof f.url&&f.url.startsWith('https://')?{ok:!0,url:f.url,expiresAt:String(f.expiresAt??''),amountPence:Number(f.amountPence??0)}:{ok:!1,message:'string'==typeof f?.error?f.error:o}}catch{return{ok:!1,message:o}}},e.checkPaid=async function(o){try{const{data:u,error:c}=await(0,t.getSupabase)().functions.invoke('takeaway-pay-check',{body:{order_id:o}}),y=await s(u,c);return(0,n.nudgeGuestSync)(),y?.off?'off':String(y?.state??'unknown')}catch{return'unknown'}};var t=r(d[0]),n=r(d[1]);const o='Card payment isn\u2019t available right now. Nothing has been charged. Please ring the restaurant.';async function s(t,n){if(t&&'object'==typeof t)return t;const o=n?.context;try{const t=o?.json?await o.json():null;return t&&'object'==typeof t?t:null}catch{return null}}},883,[872,824]); \ No newline at end of file diff --git a/abbotsford/staff-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js b/abbotsford/staff-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js new file mode 100644 index 0000000000000000000000000000000000000000..aa5686de2b7746d4738fdfd057a3991ab57eb798 --- /dev/null +++ b/abbotsford/staff-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);r(d[1]);var n=r(d[2]),c=r(d[3]),o=r(d[4]),f=r(d[5]);function s(){const{section:s}=(0,t.useLocalSearchParams)();return(0,c.canShow)('chef')?s&&(0,o.chefSectionAllowed)(String(s))?(0,f.jsx)(n.ChefApp,{section:String(s)},String(s)):(0,f.jsx)(t.Redirect,{href:"/kitchen"}):(0,f.jsx)(t.Redirect,{href:c.ENTRY[c.APP_VARIANT]})}},776,[805,31,806,807,808,25]); \ No newline at end of file diff --git a/abbotsford/staff-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js b/abbotsford/staff-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js new file mode 100644 index 0000000000000000000000000000000000000000..4ab9c83ccd4d5db63de5f806f1ae8fc169929c85 --- /dev/null +++ b/abbotsford/staff-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js @@ -0,0 +1,3 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]);function u(){const{token:u}=(0,t.useLocalSearchParams)(),h=(0,c.cleanToken)(u);return h?(0,s.guestServer)()?(0,l.jsx)(o.TableOrderLive,{token:h}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"demo",title:"Not connected",children:"This preview isn't connected to a venue, so table orders can't be sent from here."})}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"warn",title:"This code isn't working",children:"Please scan the QR code on your table again, or ask a member of staff."})})}},796,[805,31,818,885,887,845,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},885,[874,812,31,128,818,819,820,887,886,823,825,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})},886,[872,824,887]); \ No newline at end of file diff --git a/abbotsford/staff-app/_expo/static/js/web/__common-3b974beb5fe67ef162fce1dc85149441.js b/abbotsford/staff-app/_expo/static/js/web/__common-3b974beb5fe67ef162fce1dc85149441.js new file mode 100644 index 0000000000000000000000000000000000000000..67782580e58e0648ee8b56e679d898b563eda6fa --- /dev/null +++ b/abbotsford/staff-app/_expo/static/js/web/__common-3b974beb5fe67ef162fce1dc85149441.js @@ -0,0 +1,580 @@ +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}Object.defineProperty(e,"__esModule",{value:!0}),r(d[0]),t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e)},805,[1298,1299,1309,1310,1312]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:i,me:n,now:K}=(0,z.useChef)(3e4);(0,we.useReviewAlerts)(i);const V=(0,_.useSignedIn)(),X=V?.id??z.CHEF_ID,Z=V?.ownerAccess&&'owner'!==V.role?'owner privileges':V?.managerAccess&&'staff'===V.role?'manager privileges':'',Ce=(0,Se.useSync)(e=>e.perms),Pe=Ce.includes('*')||Ce.includes('takings.view');(0,o.useSoldOutLink)(!0,(V?.name??n).replace(' (example)',''));const Oe=e?Be[e]:void 0,[Ee,Le]=(0,A.useState)(Oe?.tab??'home'),[Ne,We]=(0,A.useState)(Oe?.k??null),[Fe,Ge]=(0,A.useState)(Oe?.stock??'levels'),[Ke,Me]=(0,A.useState)(void 0),[Ve,ze]=(0,A.useState)(Oe?.gp??'dishes'),Ue=(0,A.useRef)(null),qe=(0,y.ymd)(K),Qe=(0,y.ymd)(new Date(K.getTime()+864e5));(0,p.useTipsPosted)(i,qe);const Ye=(0,ie.useTravelDay)('chef',qe),Je='home'===Ee&&!Ye;(0,S.useKitchenTodoChime)(i,qe,()=>tt('kitchen','bookings')),(0,me.useAlertWatcher)(i,{kinds:['takeaway']}),(0,A.useEffect)(()=>{(0,_.ensureAttendance)((new Date).toISOString().slice(0,10),K)},[]);const Xe=(0,A.useRef)({t:'home',k:null});Xe.current={t:Ee,k:Ne};const Ze=(0,A.useRef)([]),et=(0,r.useScrollMemory)(Ue),tt=(0,A.useCallback)((e,t=null)=>{'takings'!==t||Pe||(t=null);const s=Xe.current;s.t===e&&s.k===t||(Ze.current=[...Ze.current,{...s,y:et.leave()}].slice(-30),et.restore(0)),Le(e),We(t)},[Pe]),st=(0,A.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Xe.current;let t=Ze.current.pop();for(;t&&t.t===e.t&&t.k===e.k;)t=Ze.current.pop();if(!t&&'home'===e.t&&!e.k)return!1;const s=t??{t:'home',k:null};return et.leave(),Le(s.t),We(s.k),et.restore(s.y??0),!0},[]);(0,l.useWebBack)(st);const it=(0,l.useInnerBackShown)();(0,A.useEffect)(()=>{c.PITCH&&(globalThis.__pitchGo=(e,t=null,s)=>{'stock'===e&&s&&Ge(s),'gp'===e&&s&&ze(s),tt(e,t)})},[tt]),(0,b.useShiftReminders)({rid:i,staffId:X,name:n,kitchen:!0}),(0,T.useScheduledNotices)({rid:i,staffId:V?.id??'',name:n,onOpen:e=>{'orderlists'===e&&tt('kitchen','orderlists'),'chat'===e&&tt('kitchen','live')}}),(0,P.useOffRotaPrompt)({rid:i,staffId:V?.id??''}),(0,A.useEffect)(()=>{const e=B.default.addEventListener('hardwareBackPress',st);return()=>e.remove()},[st]),(0,A.useEffect)(()=>{'takings'!==Ne||Pe||(We(null),Le('kitchen'))},[Ne,Pe]),(0,Se.useSync)(e=>e.perms.join(','));const at=(0,H.kitchenHistoryAccess)(i),ot=Ae.filter(e=>('takings'!==e.id||Pe)&&('bookinghistory'!==e.id||at)&&('kitchensetup'!==e.id||at)),nt=Ne&&('takings'!==Ne||Pe)?Ae.find(e=>e.id===Ne):null,rt=((0,E.default)().width,nt?nt.title:{home:'Today in the kitchen',stock:c.PITCH?'Stock':'Deliveries & stock',gp:'GP & costing',creator:ge.CREATOR_TITLE,orders:'Orders',rota:'Rota',kitchen:'Kitchen'}[Ee]);return(0,Re.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:M.colours.bg},edges:['top','bottom'],children:[(0,Re.jsxs)(L.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:M.colours.border,gap:6},children:[(0,Re.jsx)(L.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center'},children:(0,Re.jsx)(F.VoiceSlot,{size:44})}),(0,Re.jsxs)(L.default,{testID:"header-me-wrap",style:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',gap:8,minHeight:44,maxWidth:'80%',paddingRight:8},children:[(0,Re.jsx)(L.default,{testID:"header-me",accessibilityLabel:`Signed in as ${n.replace(' (example)','')}, Head Chef${Z?`, ${Z}`:''}`,style:{borderWidth:1,borderColor:M.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%'},children:(0,Re.jsxs)(G.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,Re.jsx)(ue.StaffAvatar,{id:z.CHEF_ID,size:24,ring:!1}),(0,Re.jsxs)(L.default,{style:{flexShrink:1},children:[(0,Re.jsxs)(G.T,{size:13,weight:"semibold",colour:M.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)','')," \xb7 Head Chef"]}),Z?(0,Re.jsx)(G.Muted,{center:!1,size:10,numberOfLines:1,children:Z}):null]})]})}),(0,f.openedFromDisplay)()?(0,Re.jsx)(f.BackToDisplayButton,{compact:!0}):null]}),(0,Re.jsx)(W.VenueHeaderBlock,{rid:i,name:s.name,badge:"CHEF",place:"Head Chef app"}),(0,Re.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,he.appUrl)('staff');e&&window.location.assign(e)},style:{alignSelf:'center',borderWidth:1,borderColor:M.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,Re.jsx)(G.T,{size:13,colour:M.colours.gold,children:"Staff app \u203a"})})]}),(0,Re.jsxs)(O.default,{ref:Ue,...et.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Ee?(0,Re.jsx)(ce.AlertsBanner,{}):null,'home'===Ee?(0,Re.jsx)(de.WhosOnShift,{}):null,(0,Re.jsx)(l.BackTitleRow,{back:!('home'===Ee&&!Ne||it),onBack:st,title:rt}),'home'===Ee?(0,Re.jsx)(ie.DayBar,{app:"chef",today:qe}):null,'home'===Ee&&Ye?(0,Re.jsx)(ie.DayView,{rid:i,day:Ye,today:qe,app:"chef"}):null,'home'===Ee?(0,Re.jsx)(le.WhoBar,{}):null,Je&&V?(0,Re.jsx)(h.MyTasksToday,{rid:i,staffId:V.id,name:V.name,onShift:(0,b.shiftNow)(V.id,K.getTime()).on}):null,Je&&(0,k.isKitchenViaDisplay)()?(0,Re.jsx)($e,{go:(e,t)=>{'stock'===e&&t&&Ge(t),'gp'===e&&t&&ze(t),'orders'===e&&Me(t),tt(e,'kitchen'===e?t??null:null)}}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(p.TodaysTipsCard,{rid:i,today:qe}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(p.TipsPotCard,{rid:i,today:qe}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)(x.CoversToday,{rid:i,onPress:()=>tt('kitchen','bookings')}):null,Je?(0,Re.jsx)(j.LastFoodBanner,{rid:i,now:K}):null,Je?(0,Re.jsx)(w.NextTableFreeCard,{rid:i,now:K}):null,Je?(0,Re.jsx)(v.KitchenSignoffs,{rid:i,today:qe,by:n,app:"chef"}):null,Je?(0,Re.jsxs)(L.default,{style:{gap:4},children:[(0,Re.jsx)(v.PlattersBooked,{rid:i,date:qe,label:"Platters booked today"}),(0,Re.jsx)(v.PlattersBooked,{rid:i,date:Qe,label:"Platters booked tomorrow"})]}):null,Je?(0,Re.jsx)(Te.ChefAssistantButton,{}):null,Je&&!(0,k.isKitchenViaDisplay)()?(0,Re.jsx)($e,{go:(e,t)=>{'stock'===e&&t&&Ge(t),'gp'===e&&t&&ze(t),'orders'===e&&Me(t),tt(e,'kitchen'===e?t??null:null)}}):null,'stock'!==Ee||c.PITCH?null:(0,Re.jsx)(te.KitchenCosts,{rid:i,me:(V?.name??n).replace(' (example)',''),actor:{name:(V?.name??n).replace(' (example)',''),role:'head-chef'},initial:'deliveries'===Fe?'deliveries':'take'===Fe?'count':'deliveries'},`s-${Fe}`),'gp'!==Ee||c.PITCH?null:(0,Re.jsx)(te.KitchenCosts,{rid:i,me:(V?.name??n).replace(' (example)',''),actor:{name:(V?.name??n).replace(' (example)',''),role:'head-chef'},initial:"dishgp"},`g-${Ve}`),'stock'===Ee&&c.PITCH?(0,Re.jsx)(ee.StockScreen,{initial:Fe},Fe):null,'gp'===Ee&&c.PITCH?(0,Re.jsx)(U.GpScreen,{initial:Ve},Ve):null,'creator'===Ee?(0,Re.jsx)(ge.DishCreator,{rid:i,canPublish:!1}):null,'orders'===Ee?(0,Re.jsx)(Y.OrdersScreen,{focus:Ke},Ke??'all'):null,'rota'===Ee?(0,Re.jsx)(G.Card,{children:(0,Re.jsx)(J.KitchenRotaTab,{today:qe})}):null,'kitchen'!==Ee||nt?null:(0,Re.jsxs)(L.default,{style:{gap:10},children:[(0,Re.jsxs)(L.default,{style:{borderRadius:14,borderWidth:1,borderColor:M.colours.border,backgroundColor:M.colours.surface,overflow:'hidden'},children:[He.map(e=>(0,Re.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.title}. ${e.sub}`,onPress:()=>tt(e.id),style:({pressed:e})=>({padding:12,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Re.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Re.jsxs)(L.default,{style:{flex:1},children:[(0,Re.jsx)(G.T,{weight:"medium",children:e.title}),(0,Re.jsx)(G.Muted,{children:e.sub})]}),(0,Re.jsx)(G.T,{colour:M.colours.muted,children:"\u203a"})]})},e.id)),ot.map(e=>(0,Re.jsx)($.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>tt(Ee,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:1,borderColor:M.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,Re.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Re.jsxs)(L.default,{style:{flex:1},children:[(0,Re.jsx)(G.T,{weight:"medium",children:e.title}),(0,Re.jsx)(G.Muted,{children:e.sub})]}),(0,Re.jsx)(G.T,{colour:M.colours.muted,children:"\u203a"})]})},e.id))]}),(0,Re.jsx)(G.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,Re.jsxs)(G.Muted,{center:!0,children:["Head Chef app \xb7 ",d.APP_VERSION," \xb7 ",'live'===Se.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===Ne&&X?(0,Re.jsxs)(L.default,{style:{gap:10},testID:"chef-myshift",children:[(0,Re.jsx)(ne.ClockInOut,{}),(0,Re.jsx)(re.MyUpcomingShifts,{staffId:X,team:!0})]}):null,'mypay'===Ne?(0,Re.jsxs)(L.default,{style:{gap:10},testID:"chef-mypay",children:[(0,Re.jsx)(ae.MyPeriods,{staffId:X}),(0,Re.jsx)(se.MyHoursPay,{staffId:X}),(0,Re.jsx)(oe.MyTips,{staffId:X}),(0,Re.jsx)(G.Card,{children:(0,Re.jsx)(u.PhoneAlerts,{})})]}):null,'alerts'===Ne?(0,Re.jsx)(L.default,{testID:"chef-alerts",children:(0,Re.jsx)(u.PhoneAlerts,{})}):null,'avatar'===Ne?(0,Re.jsx)(t.AvatarMaker,{meId:V?.id??z.CHEF_ID,me:n}):null,'reviews'===Ne?(0,Re.jsx)(je.ReviewsSection,{rid:i,mode:"read",venueName:s.name}):null,'bookinghistory'===Ne?(0,Re.jsx)(R.BookingHistory,{rid:i,today:qe}):null,'bookings'===Ne?(0,Re.jsx)(I.TodaysBookings,{rid:i,today:qe,by:n,app:"chef"}):null,'specials'===Ne?(0,Re.jsx)(fe.SpecialsEditor,{rid:i,me:n,app:"chef",now:K}):null,'forecast'===Ne?(0,Re.jsx)(q.ChefForecast,{openPrep:()=>tt('kitchen','prep')}):null,'prep'===Ne?(0,Re.jsx)(Q.PrepScreen,{}):null,'live'===Ne?(0,Re.jsx)(Q.TeamScreen,{}):null,'waste'===Ne?(0,Re.jsx)(Q.WasteScreen,{}):null,'recipes'===Ne?(0,Re.jsx)(xe.RecipeCards,{rid:i,actor:{name:n,role:'head-chef'},mode:"edit"}):null,'allergens'===Ne?(0,Re.jsx)(Q.AllergenScreen,{openCards:()=>tt('kitchen','recipes')}):null,'takings'===Ne&&Pe?(0,Re.jsx)(p.CashUpScreen,{rid:i,today:qe,canEdit:!1,chartsOnly:!0,who:{id:X,name:n.replace(' (example)','')}}):null,'board'===Ne?(0,Re.jsx)(ve.QuestionBoard,{rid:i,today:qe,manager:!1,by:""}):null,'teamtasks'===Ne?(0,Re.jsx)(h.KitchenTeamTasks,{rid:i,actor:V}):null,'orderlists'===Ne?(0,Re.jsx)(C.OrderListsScreen,{rid:i,today:qe,editor:!0,who:{id:X,name:n.replace(' (example)','')}}):null,'kitchensetup'===Ne?at?(0,Re.jsx)(D.TempUnitsSetup,{}):(0,Re.jsx)(G.T,{center:!0,children:"Kitchen setup is for the Head Chef, managers and owners."}):null,'haccp'===Ne||'compliance'===Ne||'foodsafety'===Ne?(0,Re.jsx)(ke.HaccpLog,{mode:"chef",me:n,meId:z.CHEF_ID,now:K,rid:i}):null,'accidents'===Ne?(0,Re.jsx)(pe.AccidentBook,{app:"chef",me:n,meId:z.CHEF_ID,now:K,seeAll:!1}):null]}),(0,Re.jsx)(Ie.BottomTabs,{tablist:!0,background:M.colours.surface,active:'orders'===Ee?'kitchen':Ee,onPress:e=>tt(e),tabs:De.map(e=>({id:e.id,label:e.label,short:'creator'===e.id?'Creator':void 0,icon:e.icon,a11y:'rota'===e.id?'Rota, the kitchen rota':void 0}))}),(0,Re.jsx)(Te.ChefAssistantSheet,{go:(e,t)=>{'orders'===e?(Me(t),tt('orders')):'gp'===e?tt('gp'):tt('kitchen',e)}}),(0,Re.jsx)(be.AlertHost,{variant:"chef",rid:i,skipTakeaway:!0}),(0,Re.jsx)(ye.KitchenFlash,{rid:i,me:n})]})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),k=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]),C=_r(_d[20]),T=_r(_d[21]),P=_r(_d[22]),S=_r(_d[23]),I=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),H=_r(_d[27]),A=_r(_d[28]),B=e(_r(_d[29]));_r(_d[30]);var $=e(_r(_d[31])),O=e(_r(_d[32])),E=e(_r(_d[33])),L=e(_r(_d[34])),N=_r(_d[35]),W=_r(_d[36]),F=_r(_d[37]),G=_r(_d[38]),K=_r(_d[39]),M=_r(_d[40]),_=_r(_d[41]),V=_r(_d[42]),z=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),ie=_r(_d[54]),ae=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),re=_r(_d[58]),le=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),ke=_r(_d[66]),fe=_r(_d[67]),be=_r(_d[68]),ye=_r(_d[69]),me=_r(_d[70]),xe=_r(_d[71]),je=_r(_d[72]),we=_r(_d[73]),ve=_r(_d[74]),Ce=_r(_d[75]),Te=_r(_d[76]),Pe=_r(_d[77]),Se=_r(_d[78]),Ie=_r(_d[79]),Re=_r(_d[80]);s.LIVE_HEAD_CHEF&&(0,i.requireRealData)();const De=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:ge.CREATOR_TITLE,icon:'sparkle'},{id:'rota',label:'Rota',icon:'rota'},{id:'kitchen',label:'Kitchen',icon:'platter'}],He=[{id:'orders',title:'Orders',sub:'Supplier order sheets, what is due today and cut-off times. Nothing is sent until you press Send'}],Ae=[{id:'alerts',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'avatar',title:'My avatar',sub:'Animals, Bar & kitchen, sea, sport, colours, patterns or your own photo'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookinghistory',title:'Booking history',sub:'Past days: bookings, covers and walk-ins, by day or week. Read-only'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, probe checks, cleaning, training, House Rules, allergen matrix'},{id:'kitchensetup',title:'Kitchen setup',sub:'Fridges and freezers: add, rename, archive, type, location, safe limits and check times'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'forecast',title:'Forecast',sub:'Covers per day for the week ahead, and prep from the forecast'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'}],Be={'booking-history':{tab:'kitchen',k:'bookinghistory'},'kitchen-setup':{tab:'kitchen',k:'kitchensetup'},stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},rota:{tab:'rota'},'kitchen-rota':{tab:'rota'},forecast:{tab:'kitchen',k:'forecast'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'haccp'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function $e({go:e}){const{k:t,c:s,menu:i,now:o,rid:r,me:l}=(0,z.useChef)(3e4),d=(0,X.useSheetReminders)(),u=(0,z.useWeek)(),{covers:h,label:p,enough:k,booked:f}=(0,z.useForecast)(),b=(0,Y.useSuggestions)(),y=t.ingredients.filter(e=>e.onHand<=0||(0,z.isLow)(e.onHand,e.par)),x=b.filter(e=>e.ordersToday&&!e.placedToday),j=(0,V.priceImpacts)(i,t.recipes,t.ingredients,t.targetGp).filter(e=>e.dropped.length),w=t.deliveries.filter(e=>'expected'===e.status),v=!t.recipes.length||!t.ingredients.length,C=v?[]:s.filter(e=>e.below),T=(0,n.useLiveState)(),P=(0,Ce.useRecipeCards)(r).filter(e=>!e.signOff),S=(0,te.useKitchenSummary)(r),[I,R]=(0,A.useState)(!1);return(0,Re.jsxs)(L.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,Re.jsx)(ke.MissedBanner,{mode:"chef",now:o,onPress:()=>e('kitchen','haccp')}),d.map(t=>(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('orders',t.supplierId),children:(0,Re.jsxs)(G.Banner,{kind:'red'===t.tone?'danger':'warn',title:`\u23f0 ${t.text}`,children:["Tap to open the ",t.name," order sheet. Nothing is sent until you press Send."]})},t.supplierId)),P.length?(0,Re.jsx)($.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,Re.jsxs)(G.Banner,{kind:"warn",title:`${P.length} recipe card${1===P.length?'':'s'} awaiting your sign-off`,children:[P.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,Re.jsx)(Z.ShellfishTile,{rid:r,by:l,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,Re.jsx)(G.Button,{testID:"chef-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>R(!0),style:{minHeight:56}}),(0,Re.jsxs)(G.Row,{wrap:!0,gap:10,children:[c.PITCH?null:(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"Dishes under target GP",value:S.costed?`${S.below} of ${S.costed}`:'Nothing yet',sub:S.costed?`Average ${(0,z.pct1)(S.avgGp??0)} \xb7 target ${S.target}%`:'Record a delivery, then cost your recipe cards',tone:S.costed?S.below?'amber':'ok':void 0,onPress:()=>e('gp','dishes')}),c.PITCH?v?(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,Re.jsx)(z.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,z.pct1)(u.theo),sub:`Target ${t.targetGp}% \xb7 actual ${(0,z.pct1)(u.actual)}`,tone:u.theoe('gp','week')}):null,c.PITCH?null:(0,Re.jsx)(z.Tile,{testID:"tile-stock",label:"Stock value",value:null!=S.stockValue?(0,K.gbp)(S.stockValue):'Nothing yet',sub:S.lastCount?`At cost, counted ${S.lastCount}`:'No stock counted yet',onPress:()=>e('stock','take')}),c.PITCH?(0,Re.jsx)(z.Tile,{testID:"tile-stock",label:"Stock value",value:t.ingredients.length?(0,K.gbp)((0,z.stockValue)(t.ingredients)):'Nothing yet',sub:t.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}):null,(0,Re.jsx)(z.Tile,{label:"Items low or out",value:t.ingredients.length?`${y.length}`:'Nothing yet',sub:t.ingredients.length?y.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:y.some(e=>e.onHand<=0)?'red':y.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,Re.jsx)(z.Tile,{label:"Waste this week",value:t.waste.length?(0,K.gbp)(u.wasteWeek):'Nothing yet',sub:u.sales?`${(0,z.pct1)(u.wasteWeek/u.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),k?(0,Re.jsx)(z.Tile,{testID:"tile-forecast",label:"Covers forecast today",value:`${h}`,sub:p,onPress:()=>e('kitchen','forecast')}):(0,Re.jsx)(z.Tile,{testID:"tile-booked",label:"Booked so far today",value:'ready'===T?`${f}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','bookings')}),(0,Re.jsx)(z.Tile,{label:"Orders due today",value:`${x.length}`,sub:x.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:x.some(e=>e.cutPassed)?'red':x.length?'amber':'ok',onPress:()=>e('orders')})]}),j.map(e=>(0,Re.jsxs)(G.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),w.length?(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,Re.jsx)(G.Banner,{kind:"info",title:`${w.length} deliver${1===w.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,Re.jsx)($.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,Re.jsxs)(G.Banner,{kind:"warn",title:`${C.length} dishes below ${t.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,Re.jsx)(G.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[ge.CREATOR_TITLE,'creator'],['Forecast','forecast'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([t,s])=>(0,Re.jsx)($.default,{accessibilityRole:"button",accessibilityLabel:t,onPress:()=>'creator'===s?e('creator'):e('kitchen',s),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:M.colours.gold,backgroundColor:M.colours.surface},children:(0,Re.jsxs)(G.T,{weight:"semibold",children:[t," \u203a"]})},s))}),(0,Re.jsx)(G.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"}),(0,Re.jsx)(Pe.SoldOutSheet,{visible:I,onClose:()=>R(!1),rid:r,by:l,hideLinks:!0,testID:"chef-soldout-sheet"})]})}},806,[1066,1387,1218,942,1388,1041,1042,1043,2,1056,1045,1046,979,1165,1000,822,944,1414,1415,993,1055,1053,1054,947,1419,1428,1430,1177,31,234,123,264,152,288,128,290,868,948,818,820,825,953,1440,1442,1443,1444,1446,1454,1453,1455,974,1457,1458,1060,945,1061,1063,1062,1475,1039,940,1040,996,866,1064,1449,1065,1483,961,1491,963,1050,841,950,1051,823,1495,941,824,1059,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"IS_OWNER_DESKTOP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"IS_CAR",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"APP_VARIANT",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"ENTRY",{enumerable:!0,get:function(){return l}}),_e.isAllowedPath=function(e,n=f){return!(t.IS_ISOLATED_VENUE&&/^\/(customer|table)(\/|$)/.test(e)&&![`/customer/${t.VENUE_RID}`,`/customer/${t.VENUE_RID}/`].includes(e))&&('/'===e||''===e||_[n].test(e))},_e.canShow=function(e,t=f){return t===e||'owner'===t&&'customer'===e};var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};const u=o.default.expoConfig?.extra?.appVariant??void 0??'owner',c=!1,s=!1,f=['owner','staff','customer','display','chef'].includes(u)?u:'owner',l={owner:'/owner',staff:'/team',customer:`/customer/${t.VENUE_RID}`,display:'/display',chef:'/kitchen'},_={owner:/^\/(owner|customer|table)(\/|$)/,customer:/^\/(customer|table)(\/|$)/,staff:/^\/team(\/|$)/,display:/^\/display(\/|$)/,chef:/^\/kitchen(\/|$)/}},807,[5,409]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PERMISSIONS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"CHEF_SECTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"chefSectionAllowed",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"rotaView",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"chatView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ticketView",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"supplierView",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"auditView",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"CARD_ROLE_APP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"cardCostsVisible",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"ownJobSeesCosts",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"costsAllowedFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ownJobManagesLinks",{enumerable:!0,get:function(){return h}});const e={owner:'all',manager:'all',staff:new Set(['rota-shifts','tickets','eighty-six','allergens']),chef:new Set(['stock','costing','gp','waste','dish-sales','prep','ordering','allergens','compliance','rota-shifts','kitchen-chat','tickets','eighty-six','specials'])},t=(t,n)=>{const a=e[t];return'all'===a||a.has(n)},n={stock:'stock','stock-take':'stock',deliveries:'stock',gp:'gp','price-changes':'gp','gp-week':'gp','menu-engineering':'dish-sales',orders:'ordering',forecast:'prep',prep:'prep',live:'tickets',waste:'waste',allergens:'allergens',compliance:'compliance',haccp:'compliance',accidents:'compliance','new-dish':'gp',specials:'specials',recipes:'allergens','recipe-cards':'allergens'},a=e=>e in n&&t('chef',n[e]),s=(e,n,a)=>t(e,'staff-personal')?{staff:n,shifts:a}:{staff:n.filter(e=>e.active).map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},job:e.job})),shifts:a.filter(e=>e.published).map(({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l})=>({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l}))},c=(e,t)=>'chef'===e?t.filter(e=>'kitchen'===e.ch&&!e.removed):t,l=(e,n)=>t(e,'customer-personal')?n:n.map(({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:f,handoverCheck:u,allergyChain:p,bookingId:b,readiness:m,createdAt:h,restaurantId:k,notes:y,accepted:w,allergyTicks:O})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),f=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text)),u={'head-chef':'chef',manager:'manager',owner:'owner',staff:'staff'},p=(e,n="edit")=>'edit'===n&&t(u[e]??'staff','costing'),b=e=>'owner'===e.role||'manager'===e.role||'Head Chef'===e.level,m=e=>!e||b(e),h=e=>'owner'===e.role||'manager'===e.role},808,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},812,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},813,[31,264,274,128,1174,825,818,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_DWELL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"dwellBands",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"bandLabel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fmtMins",{enumerable:!0,get:function(){return o}}),_e.dwellFor=function(e,t,r=[]){const o=n(e),i=Math.max(0,o.findIndex(e=>t<=e.upTo)),s=o[i]??o[o.length-1];if(!1===e?.settings.dwellLearn)return{mins:s.mins,learned:!1,samples:0};const a=0===i?1:o[i-1].upTo+1,u=r.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt&&e.partySize>=a&&e.partySize<=s.upTo).map(e=>(new Date(e.finishedAt).getTime()-new Date(e.seatedAt).getTime())/6e4).filter(e=>e>=20&&e<=360).sort((e,t)=>e-t);if(u.length<8)return{mins:s.mins,learned:!1,samples:u.length};const l=u[Math.floor(u.length/2)];return{mins:5*Math.round((s.mins+l)/2/5),learned:!0,samples:u.length}},Object.defineProperty(_e,"DAYS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ruleText",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"ANCHORAGE_EVENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"regularEventsOf",{enumerable:!0,get:function(){return l}}),_e.occursOn=m,_e.nextOccurrence=function(e,t){const n=f(t);for(let t=0;t<400;t++){const r=c(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t));if(m(e,r))return r}return null},_e.expandEvents=function(e,t,n,r){const o=[];if(!t.some(e=>e.active))return o;const i=f(n),s=f(r);for(let n=i;n<=s;n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)){const r=c(n);for(const n of t)m(n,r)&&o.push({id:`${n.id}:${r}`,restaurantId:e,date:r,title:n.name,kind:'event',example:!1,source:'regular',description:[n.time?`from ${n.time}`:'',n.lastFood?`last food orders ${n.lastFood}`:'',n.notes??''].filter(Boolean).join(' \xb7 '),busier:n.busier,lastFood:n.lastFood,time:n.time})}return o},_e.lastFoodOn=function(t,n){if(!t)return null;const r=f(n).getDay(),o=t.settings.lastFoodByDay?.[r],s=(0,e.kitchenHoursOn)(t,f(n));let a=s?{time:s[1],reason:'kitchen closes'}:null;o&&(!a||oe?.settings.dwellBands?.length?e.settings.dwellBands:t,r=(e,t)=>{const n=0===t?1:e[t-1].upTo+1,r=e[t].upTo;return r>=9999?`${n} or more covers`:n===r?`${n} cover${1===n?'':'s'}`:`${n}\u2013${r} covers`},o=e=>e%60==0?`${e/60} hour${60===e?'':'s'}`:e>60?`${Math.floor(e/60)} h ${e%60} min`:`${e} min`;const i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],s=['','first','second','third','fourth'],a=e=>'last'===e.kind?`Last ${i[e.weekday]} of every month`:'nth'===e.kind?`${s[e.n][0].toUpperCase()}${s[e.n].slice(1)} ${i[e.weekday]} of every month`:'weekly'===e.kind?`Every ${i[e.weekday]}`:`One-off: ${e.date}`,u=[{id:'ev-music-night',name:'Open Mic Night',rule:{kind:'last',weekday:0},time:'20:00',notes:'Live music from 8pm.',busier:!0,lastFood:'19:00',active:!0}],l=e=>e?.settings.regularEvents??('anchorage'===e?.id?u:[]),d=e=>String(e).padStart(2,'0'),c=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`,f=e=>new Date(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)));function m(e,t){if(!e.active)return!1;const n=e.rule;if('once'===n.kind)return n.date===t;const r=f(t);return r.getDay()===n.weekday&&('weekly'===n.kind||('nth'===n.kind?Math.ceil(r.getDate()/7)===n.n:new Date(r.getFullYear(),r.getMonth(),r.getDate()+7).getMonth()!==r.getMonth()))}const b=e=>e?.settings.afterLastFood??'drinks',p=e=>{const[t,n]=e.split(':').map(Number);return`${t%12||12}${n?`:${d(n)}`:''}${t<12?'am':'pm'}`},y=e=>e?.settings.showTakeaway??'anchorage'!==e?.id,h=e=>!1!==e?.settings.coversCounter,O=e=>!1!==e?.settings.nextTableFree,$=e=>!1!==e?.settings.dogQuestion,w=e=>!1!==e?.settings.dietQuestion,F=e=>!1!==e?.settings.accessQuestion,k=(e,t)=>e?.settings.holidayFullNames?t:t.replace(/\s*\(substitute day\)/gi,'').trim()},814,[833]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},815,[874,31,123,128,25]); +__d(function(_g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.startForm=function(t=Date.now()){return{openedAt:t,hp:''}},e.guardFor=function(t,n=Date.now()){return{hp:t.hp,formMs:Math.max(0,Math.round(n-t.openedAt))}},e.rememberGuard=function(n,o){t.set(n,o)},e.takeGuard=function(n){const o=t.get(n);return o?(t.delete(n),o):{}};const t=new Map},816,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedFields=W,_e.historyText=D,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=W(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:D(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${A(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!W(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return E}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: 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.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],h=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],u=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],w=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),k=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return k(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){const i=y(e);return l.filter(e=>M(e,i)!==M(e,t))}const j=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,A=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function D(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${j(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${j(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${j(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${h.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=w(o.holds),i=w(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${A(s)}`}const E=e=>e.map(e=>f[e]).join(', ')},817,[832,1174,1420,960]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return W.webLine}}),_e.T=L,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return A}}),_e.BrandBar=z,_e.Screen=function({children:e,title:t,subtitle:r,back:o=!0,right:l,maxWidth:n=640,footer:s,scroll:c=!0}){const u=(0,B.jsxs)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:[e,'customer'===S.APP_VARIANT?(0,B.jsx)(v,{}):null]});return(0,B.jsxs)(j.SafeAreaView,{style:{flex:1,backgroundColor:C.colours.bg},edges:['top','left','right'],children:[(0,B.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:(0,B.jsx)(z,{title:t,subtitle:r,back:o,right:l})}),c?(0,B.jsx)(b.default,{contentContainerStyle:{paddingBottom:40},children:u}):(0,B.jsx)(p.default,{style:{flex:1},children:u}),s?(0,B.jsx)(p.default,{style:N.footer,children:(0,B.jsx)(p.default,{style:{width:'100%',maxWidth:n,alignSelf:'center'},children:s})}):null]})},_e.Button=F,_e.Card=H,_e.Badge=function({label:e,kind:t="neutral"}){const r={neutral:[C.colours.surface2,C.colours.muted,C.colours.border],gold:[C.colours.goldTint,C.colours.goldLight,C.colours.gold],red:[C.colours.redBg,'#FFD9D4',C.colours.red],amber:[C.colours.amberBg,'#FFE2A8',C.colours.amber],ok:[C.colours.okBg,C.colours.goldLight,C.colours.ok],blue:[C.colours.blueBg,C.colours.goldLight,C.colours.blue]}[t];return(0,B.jsx)(p.default,{style:[N.badge,{backgroundColor:r[0],borderColor:r[2],maxWidth:'100%',alignSelf:D?'center':'flex-start'}],children:(0,B.jsx)(L,{size:13,weight:"medium",colour:r[1],style:{flexShrink:1},children:e})})},_e.Banner=E,Object.defineProperty(_e,"AllergenNotice",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return $}}),_e.Row=O,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return _}}),_e.Field=function({label:e,...t}){return(0,B.jsxs)(p.default,{style:{gap:4,alignSelf:'stretch',width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,B.jsx)(L,{size:C.font.small,weight:"medium",colour:C.colours.muted,center:!0,children:e}),(0,B.jsx)(o.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...t,style:[N.input,t.multiline&&{minHeight:70,textAlignVertical:'top'},t.style]})]})},_e.Chip=function({label:e,selected:t,onPress:r,disabled:o,sub:l,testID:n,accessibilityLabel:s}){return(0,B.jsxs)(h.default,{testID:n,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!o},accessibilityLabel:`${s??e}${!s&&l?`, ${l}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:o,onPress:r,style:[N.chip,t&&{backgroundColor:C.colours.gold,borderColor:C.colours.gold},o&&{opacity:.35}],children:[(0,B.jsx)(L,{size:C.font.small,weight:"medium",colour:t?C.colours.onGold:C.colours.text,center:!0,children:e.trim()}),l?(0,B.jsx)(L,{size:12,colour:t?C.colours.onGold:C.colours.muted,center:!0,children:l}):null]})},_e.Toggle=function({value:e,onChange:t,label:r,testID:o,disabled:l,a11y:n}){return(0,B.jsxs)(O,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,B.jsx)(L,{style:{flex:1,flexShrink:1},children:r}),(0,B.jsx)(y.default,{testID:o,disabled:l,accessibilityLabel:n??r,value:e,onValueChange:t,trackColor:{true:C.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:C.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:r=1,max:o=20,label:l,step:n=1,format:s,testID:c}){const u=s?s(e):String(e),b=e=>Math.round(e/n)*n;return(0,B.jsxs)(O,{gap:10,children:[(0,B.jsx)(h.default,{testID:c?`${c}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${l??''}`,disabled:e<=r,onPress:()=>t(Math.max(r,b(e-n))),style:[N.stepBtn,e<=r?{opacity:.4}:null],children:(0,B.jsx)(L,{size:20,colour:C.colours.gold,children:"\u2212"})}),(0,B.jsx)(p.default,{testID:c?`${c}-value`:void 0,accessibilityLabel:l?`${l}: ${u}`:u,children:(0,B.jsx)(L,{weight:"semibold",size:C.font.large,style:{minWidth:s?64:28,textAlign:'center'},children:u})}),(0,B.jsx)(h.default,{testID:c?`${c}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${l??''}`,disabled:e>=o,onPress:()=>t(Math.min(o,b(e+n))),style:[N.stepBtn,e>=o?{opacity:.4}:null],children:(0,B.jsx)(L,{size:20,colour:C.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:o,title:l,children:n,maxWidth:c,testID:f,footer:y,centerTitle:w}){const{height:W}=(0,x.default)(),k=s.default.useContext(j.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},S=(0,r.useTyping)(),I=(0,r.useVisibleArea)(),D=S&&I&&I.height({minHeight:44,minWidth:72,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?'rgba(201,162,77,0.22)':'rgba(201,162,77,0.10)',alignItems:'center',justifyContent:'center'}),children:(0,B.jsx)(L,{size:15,weight:"semibold",colour:C.colours.goldLight,center:!0,children:"Done"})}):null,R?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:o,hitSlop:8,testID:"sheet-close",style:{minWidth:72,minHeight:48,alignItems:'center',justifyContent:'center',marginRight:-8},children:(0,B.jsx)(L,{size:18,colour:C.colours.text,children:"Close"})}):(0,B.jsx)(t.GoldClose,{onPress:o,testID:"sheet-close",style:{marginRight:-6,minWidth:48,minHeight:48}})]}),(0,B.jsx)(b.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:n}),y?(0,B.jsx)(p.default,{style:{borderTopWidth:1,borderTopColor:C.colours.border,paddingTop:10,marginTop:8},testID:f?`${f}-footer`:void 0,children:y}):null]})})})},_e.SectionTitle=function({children:e}){return(0,B.jsx)(L,{weight:"semibold",size:12,colour:C.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return N}}),_r(d[0]);var t=_r(d[1]),r=_r(d[2]),o=_r(d[3]),l=_r(d[4]),n=_r(d[5]),s=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8]));_r(d[9]);var h=e(_r(d[10])),b=e(_r(d[11])),f=e(_r(d[12])),y=e(_r(d[13])),p=e(_r(d[14])),x=e(_r(d[15])),j=_r(d[16]),C=_r(d[17]),w=_r(d[18]),W=_r(d[19]),k=_r(d[20]),S=_r(d[21]),I=_r(d[22]),B=_r(d[23]);const R=['kirkton','abbotsford'].includes(k.VENUE_RID),D='display'!==S.APP_VARIANT;function L({children:e,style:t,size:r=C.font.body,weight:l="regular",colour:n=C.colours.text,numberOfLines:s,center:c,testID:u,accessibilityRole:h,accessibilityLabel:b}){const y='string'==typeof e&&/^(https?:\/\/|www\.)\S+$/.test(e.trim()),p=y?{minWidth:0,maxWidth:'100%',overflowWrap:'anywhere',wordBreak:'break-all',alignSelf:'stretch'}:void 0,x=f.default.flatten(t)||{},j=1===x.flex||1===x.flexGrow||'number'==typeof x.width||'left'===x.textAlign,k=c??(D&&('semibold'===l||'bold'===l)&&!j);return(0,B.jsx)(o.Text,{testID:u??(y?'cc-url':void 0),...k?{dataSet:{centre:'heading'}}:{},accessibilityRole:h,accessibilityLabel:b,numberOfLines:s,style:[{minWidth:0,fontFamily:C.fonts[l],fontSize:r,color:n,lineHeight:(0,w.lineFor)(r)},k&&{textAlign:'center',alignSelf:'center',maxWidth:'100%'},t,p,(0,W.webLine)(t,r),k&&'left'!==x.textAlign?{textAlign:'center'}:null],children:e})}const P=e=>(0,B.jsx)(L,{size:C.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,B.jsx)(L,{size:C.font.large,weight:"semibold",center:!0,...e}),A=e=>(0,B.jsx)(L,{colour:C.colours.muted,size:C.font.small,...e,center:e.center??D});function z({title:e,back:t=!0,right:r,subtitle:o}){return(0,B.jsxs)(p.default,{style:N.brandBar,children:[(0,B.jsxs)(p.default,{style:N.row,children:[(0,B.jsx)(p.default,{style:N.brandSide,children:t?(0,B.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>l.router.canGoBack()?l.router.back():l.router.replace(S.ENTRY[S.APP_VARIANT]),style:N.backBtn,hitSlop:10,children:(0,B.jsx)(L,{size:18,weight:"semibold",colour:C.colours.gold,children:"\u2039 Back"})}):null}),(0,B.jsx)(h.default,{onPress:()=>l.router.push(S.ENTRY[S.APP_VARIANT]),accessibilityLabel:"Home",style:N.brandCenter,children:(0,B.jsx)(I.RestaurantBrand,{size:I.HEADER_LOGO})}),(0,B.jsx)(p.default,{style:[N.brandSide,{alignItems:'flex-end'}],children:r?(0,B.jsx)(p.default,{style:{flexShrink:0},children:r}):null})]}),e?(0,B.jsx)(P,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,o?(0,B.jsx)(A,{center:!0,style:{alignSelf:'stretch'},children:o}):null]})}function v(){const e=(0,l.useLocalSearchParams)().rid??k.VENUE_RID,t=(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return t?(0,B.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:`Email ${t}`,onPress:()=>{c.default.openURL(`mailto:${t}`)},style:{minHeight:44,justifyContent:'center',alignItems:'center',maxWidth:'100%'},children:(0,B.jsx)(L,{center:!0,size:14,colour:C.colours.gold,children:t})}):null}function F({label:e,sub:t,onPress:r,kind:o="primary",disabled:l,small:n,style:s,accessibilityLabel:c,accessibilityHint:u,testID:b}){const f={primary:C.colours.gold,secondary:C.colours.tile,danger:C.colours.redSolid,ghost:'transparent',success:C.colours.accentBg}[o],y={primary:C.colours.onGold,secondary:C.colours.text,danger:'#FFFFFF',ghost:C.colours.gold,success:C.colours.goldLight}[o],p={primary:'transparent',secondary:C.colours.hairline,danger:'transparent',ghost:'transparent',success:C.colours.accentBorder}[o];return(0,B.jsxs)(h.default,{testID:b,accessibilityRole:"button",accessibilityLabel:c??e,accessibilityHint:u,accessibilityState:{disabled:!!l},disabled:l,onPress:r,style:({pressed:e})=>[N.btn,{backgroundColor:e&&'secondary'===o?C.colours.tilePressed:f,borderColor:p,opacity:l?.4:e?.85:1},n&&{paddingVertical:8,paddingHorizontal:14,minHeight:w.control.min,minWidth:44},s],children:[(0,B.jsx)(L,{weight:"semibold",size:n?C.font.small:C.font.body,colour:y,center:!0,children:e.trim()}),t?(0,B.jsx)(L,{size:n?C.font.small-2:C.font.small,colour:y,center:!0,testID:b?`${b}-sub`:void 0,children:t}):null]})}function H({children:e,style:t,onPress:r,highlight:o}){const l=o===C.colours.gold||o===C.colours.accentBorder,n=(0,B.jsx)(p.default,{testID:"cc-card",style:[N.card,{alignItems:'stretch'},o?{borderColor:l?C.colours.accentBorder:o,borderWidth:l?1:2}:null,t],children:e});return r?(0,B.jsx)(h.default,{accessibilityRole:"button",onPress:r,style:({pressed:e})=>({opacity:e?.85:1}),children:n}):n}function E({kind:e="info",title:t,children:r}){const o={info:[C.colours.surface,C.colours.gold,C.colours.text],warn:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],danger:[C.colours.redBg,C.colours.red,'#FFE3DF'],success:[C.colours.okBg,C.colours.ok,C.colours.goldLight],example:[C.colours.amberBg,C.colours.amber,'#FFE2A8'],demo:[C.colours.goldTint,C.colours.gold,C.colours.goldLight]}[e];return(0,B.jsxs)(p.default,{accessibilityRole:"summary",style:[N.banner,{backgroundColor:o[0],borderLeftColor:o[1]}],children:[t?(0,B.jsx)(L,{weight:"semibold",colour:o[2],center:!0,children:t}):null,s.default.Children.toArray(r).every(e=>'string'==typeof e||'number'==typeof e)?(0,B.jsx)(L,{size:C.font.small,colour:o[2],center:!0,children:r}):r]})}A.statusLine=!0,F.centreRow=!0;const V=({phone:e})=>(0,B.jsx)(E,{kind:"warn",title:"Allergies",children:"All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions. "+(e?`If you have an allergy, phone us on ${e} before ordering.`:'If you have an allergy, phone the restaurant before ordering.')}),$=()=>(0,B.jsx)(E,{kind:"demo",title:"Demo restaurant: no real payment",children:"No card is charged and no payment provider is contacted."});function O({children:e,style:t,gap:r=8,wrap:o}){const l=s.default.Children.map(e,e=>{if(!s.default.isValidElement(e))return e;const t=e,r=f.default.flatten(t.props.style)||{};return 1!==r.flex&&1!==r.flexGrow?e:s.default.cloneElement(t,{style:[t.props.style,{minWidth:Math.max(t.type===H?240:180,'number'==typeof r.minWidth?r.minWidth:0)}]})}),n=f.default.flatten(t)||{},c=s.default.Children.toArray(l).filter(s.default.isValidElement),u=e=>e.type;if(D&&'space-between'===n.justifyContent&&1!==n.flex&&2===c.length&&c.some(e=>u(e).statusLine))return(0,B.jsx)(p.default,{dataSet:{centre:'status'},style:{alignItems:'center',alignSelf:'stretch',width:'100%',gap:r},children:c});const h=D&&c.length>=2&&c.every(e=>u(e).centreRow)&&'flex-start'!==n.justifyContent&&'space-between'!==n.justifyContent;return(0,B.jsx)(p.default,{...h?{dataSet:{centre:'buttons'}}:{},style:[N.row,{gap:r},h&&{justifyContent:'center',flexWrap:'wrap'},o&&{flexWrap:'wrap',justifyContent:'center'},t],children:l})}const _=()=>(0,B.jsx)(p.default,{style:{height:1,backgroundColor:C.colours.border,marginVertical:4}});const N=f.default.create({row:{flexDirection:'row',alignItems:'center',flexWrap:'wrap',minWidth:0,maxWidth:'100%'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:C.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{minWidth:0,maxWidth:'100%',flexShrink:1,borderRadius:w.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:w.control.min,alignSelf:'stretch'},card:{minWidth:0,maxWidth:'100%',backgroundColor:C.colours.surface,borderRadius:C.radius.l,padding:16,borderWidth:1,borderColor:C.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:C.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,boxSizing:'border-box',backgroundColor:C.colours.surface2,borderColor:C.colours.border,borderWidth:1,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:10,color:C.colours.text,fontSize:C.font.body,fontFamily:C.fonts.regular},chip:{maxWidth:'100%',flexShrink:0,borderWidth:1,borderColor:C.colours.border,borderRadius:C.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:C.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:C.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:C.colours.surface,borderRadius:w.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:C.colours.gold},footer:{borderTopWidth:1,borderTopColor:C.colours.border,backgroundColor:C.colours.surface,padding:12}})},818,[1164,835,1347,874,805,881,31,240,257,123,264,152,47,272,128,288,290,825,1345,1348,5,807,868,25]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ALLERGENS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"allergenLabel",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEVERITIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"severityLabel",{enumerable:!0,get:function(){return s}}),e.effectiveAllergens=function(l,n=[]){const t={...l.allergens};for(const s of l.optionGroups??[])for(const l of s.choices)if(n.includes(l.id)&&l.allergens)for(const[n,s]of Object.entries(l.allergens))'contains'!==t[n]&&(t[n]=s);return t},e.conflictsFor=function(l,n){const t=[],s=[];for(const a of n)'contains'===l[a.allergen]?t.push(a.allergen):'may'===l[a.allergen]&&s.push(a.allergen);return{contains:t,may:s}},Object.defineProperty(e,"hasConflict",{enumerable:!0,get:function(){return a}});const l=[{id:'gluten',label:'Cereals containing gluten',short:'Gluten'},{id:'crustaceans',label:'Crustaceans',short:'Crustaceans'},{id:'molluscs',label:'Molluscs',short:'Molluscs'},{id:'eggs',label:'Eggs',short:'Eggs'},{id:'fish',label:'Fish',short:'Fish'},{id:'peanuts',label:'Peanuts',short:'Peanuts'},{id:'treenuts',label:'Tree nuts',short:'Tree nuts'},{id:'soya',label:'Soya',short:'Soya'},{id:'milk',label:'Milk',short:'Milk'},{id:'celery',label:'Celery',short:'Celery'},{id:'mustard',label:'Mustard',short:'Mustard'},{id:'sesame',label:'Sesame',short:'Sesame'},{id:'sulphites',label:'Sulphur dioxide / sulphites',short:'Sulphites'},{id:'lupin',label:'Lupin',short:'Lupin'}],n=n=>l.find(l=>l.id===n)?.short??n,t=[{id:'intolerance',label:'Intolerance'},{id:'allergy',label:'Allergy'},{id:'coeliac',label:'Coeliac disease'},{id:'anaphylaxis',label:'Severe \u2014 anaphylaxis risk'}],s=l=>t.find(n=>n.id===l)?.label??l;const a=l=>l.contains.length>0||l.may.length>0},819,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"gbp",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return n}});const t=t=>`\xa3${(t/100).toFixed(2)}`,n=t=>Math.round(100*t)},820,[]); +__d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.bookingSlotMinutesOf=s,e.bookingNoticeMinsOf=r,e.bookingCoversPerStartOf=u,e.bookingPartiesPerStartOf=l,e.onlinePartyBounds=c,Object.defineProperty(e,"COVERS_WINDOW_MINS",{enumerable:!0,get:function(){return f}}),e.coversInHalfHour=m,e.countInStartSlot=p,e.bookingLimitsHint=function(t){const n=s(t),o=u(t),f=l(t),m=r(t),p=c(t);if(null!=o||null!=f){const t=[];return null!=o&&null!=f?t.push(`up to ${o} people and ${f} bookings at each start time`):null!=o?t.push(`up to ${o} people at each start time`):t.push(`up to ${f} bookings at each start time`),(p.max<100||p.min>1)&&t.push(`parties of ${p.min} to ${p.max}`),t.push(`from ${m} minutes ahead`),t.push('table rules still apply'),`Times are every ${n} minutes: ${t.join(', ')}.`}return`Times are every ${n} minutes. Covers per slot (${t.settings.bookingCoversPerSlot} per half hour) and table rules still apply.`},e.takeawaySlots=function(o,s,r){const u=(0,t.hoursFor)(o,r);if(!u)return[];const l=o.settings.slotMinutes,c=(0,n.addMins)(r,o.settings.leadMins),f=[];for(let t=new Date(u.open);t<=u.close;t=(0,n.addMins)(t,l)){if(tn.restaurantId===o.id&&'takeaway'===n.type&&'cancelled'!==n.status&&n.slotTime&&new Date(n.slotTime).getTime()===t.getTime()).length;f.push({time:new Date(t),label:(0,n.hm)(t),taken:r,cap:o.settings.slotCap,full:r>=o.settings.slotCap})}return f},e.bookingSlots=function(c,f,d,h,k,M=()=>0){const y=(0,t.hoursFor)(c,f);if(!y)return[];const S=[],$=y.close,P=(0,o.lastFoodOn)(c,b(f)),v=P?(0,n.atTime)(f,P.time):$,I='drinks'===(0,o.afterLastFood)(c),O=s(c),C=r(c),N=u(c),T=l(c);for(let t=new Date(y.open);t<=$;t=(0,n.addMins)(t,O)){const o=(0,n.hm)(t),s=t>v;if(s&&!I)continue;const r=null!=N?p(d,o,O):m(d,o),u=(N??c.settings.bookingCoversPerSlot)-r,l=null!=T?p(M,o,O):0,f=null!=T?T-l:void 0,b=t.getTime()=1;S.push({time:o,left:u,available:!b&&u>=h&&y,past:b,...s?{drinksOnly:!0}:{},...null!=f?{partiesLeft:f,partiesCap:T}:{}})}return S};var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]);function s(t){const n=t.settings.bookingSlotMinutes;return 5===n||10===n||15===n||20===n||30===n?n:15}function r(t){const n=t.settings.bookingNoticeMins;return'number'==typeof n&&Number.isInteger(n)&&n>=0&&n<=1440?n:30}function u(t){const n=t.settings.bookingCoversPerStart;return'number'==typeof n&&Number.isInteger(n)&&n>0&&n<=200?n:null}function l(t){const n=t.settings.bookingPartiesPerStart;return'number'==typeof n&&Number.isInteger(n)&&n>0&&n<=50?n:null}function c(t){const n=t.settings.onlinePartyMin,o=t.settings.onlinePartyMax,s='number'==typeof n&&Number.isInteger(n)&&n>=1&&n<=100?n:1;return{min:s,max:'number'==typeof o&&Number.isInteger(o)&&o>=s&&o<=100?o:100}}const f=30;function m(t,o){const s=Math.floor((0,n.toMins)(o)/f)*f;let r=0;for(let o=0;o`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},821,[833,822,814]); +__d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"pad",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return n}}),e.venueYmd=function(t,u="Europe/London"){try{const n=new Intl.DateTimeFormat('en-CA',{timeZone:u,year:'numeric',month:'2-digit',day:'2-digit'}).format(t);if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n}catch{}return n(t)},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseYmd",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toMins",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fromMins",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"atTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"addMins",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"dayShort",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"dayLong",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"monthLong",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"niceDate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"niceDateYear",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"minsBetween",{enumerable:!0,get:function(){return P}});const t=t=>String(t).padStart(2,'0'),n=n=>`${n.getFullYear()}-${t(n.getMonth()+1)}-${t(n.getDate())}`;const u=n=>`${t(n.getHours())}:${t(n.getMinutes())}`,a=t=>{const[n,u,a]=t.split('-').map(Number);return new Date(n,u-1,a)},o=t=>{const[n,u]=t.split(':').map(Number);return 60*n+u},c=n=>`${t(Math.floor(n/60))}:${t(n%60)}`,d=(t,n)=>{const u=new Date(t);return u.setHours(0,0,0,0),u.setMinutes(o(n)),u},m=(t,n)=>new Date(t.getTime()+6e4*n),b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],y=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],f=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],l=['January','February','March','April','May','June','July','August','September','October','November','December'],p=t=>b[t.getDay()],s=t=>y[t.getDay()],O=t=>l[t],M=t=>`${b[t.getDay()]} ${t.getDate()} ${f[t.getMonth()]}`,j=t=>`${M(t)} ${t.getFullYear()}`,P=(t,n)=>Math.round((n.getTime()-t.getTime())/6e4)},822,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"repo",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=t.localRepositories},823,[1349,1081]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return Q.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return Q.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return Q.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return Q.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return Q.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return et}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ct}}),i.rotaReconcile=Dt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();de.useOwner.getState().chatMarkRead(e,{[t]:a});const s=de.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>de.useOwner.getState().chatSeen(t,e)),Qt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await De().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(de.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,managerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setTempOwnerAccess=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await De().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return n?{ok:!1,message:/owner/i.test(n.message)?'Only an owner can change this.':'Could not save. Try again.'}:(de.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,ownerAccess:t}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},i.setManagerAccess=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await De().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(n)return{ok:!1,message:n.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=String(s??'');return de.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...vt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(me.PITCH)return Se.unlockCashUp(e,t,a);const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await De().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(i)return{ok:!1,message:i.message};const r=String(n);return'cashup'===e?le.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):le.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})),{ok:!0,until:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.readCashAudit=async function(e){if(me.PITCH)return Se.cashAudit(e);const t=Ue.getState().venueId;if(!t)return[];let a=De().from('cash_up_audit').select('at, action, changed_by_name, tbl, for_date, reason, old_row, new_row').eq('venue_id',t).order('at',{ascending:!1}).limit(50);e&&(a=a.eq('row_id',e));const{data:s,error:n}=await a;return n||!Array.isArray(s)?[]:s.map(e=>({at:String(e.at),action:String(e.action),by:String(e.changed_by_name??'\u2014'),tbl:String(e.tbl),forDate:e.for_date??void 0,reason:e.reason??void 0,changed:(0,A.changedFields)(e.old_row,e.new_row)}))},i.setPushLive=async function(e){const t=Ue.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await De().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(ya.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=_a,i.readAccessLog=async function(){const e=Ue.getState().venueId;if(!e)return[];try{const{data:t}=await De().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ue.getState().venueId;if(!e)return[];const{data:t,error:a}=await De().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await De().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return i?{ok:!1,message:i.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.orderLogoUrl=async function(e){const t=ha.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await De().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return ha.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await De().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return ya}}),i.claimInvite=Na,i.makeChromeHandover=async function(){const e=Ue.getState();if(me.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await De().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Ke});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(me.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await De().rpc('claim_chrome_handover',{p_code:e,p_app:Ke});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),Le&&ja(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(me.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{Me();const{data:t,error:a}=await De().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(me.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await De().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),Le&&ja(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{Me(),await De().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Aa)}catch{}},i.signedInHereAs=async function(e){Me();const t=await L.kv.get(Aa,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return Me(),await L.kv.get(Ca,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ue.getState();if(!u.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==u.VENUE_UUID||e.staffRef!==C.useSession.getState().meId)return null;Me();const t=await L.kv.get(Ca,null);return t?(0,C.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ue.getState();if(!u.IS_WILDINGS||'staff'!==e.kind||e.venueId!==u.VENUE_UUID||e.staffRef!==C.useSession.getState().meId)return null;Me();const t=await L.kv.get(Ca,null);return t?(0,C.appUrl)('staff',t):null},i.forgetSignInHere=async function(){Me(),await L.kv.remove(Aa),await L.kv.remove(Ca),Ee({mode:'signin',perms:[]});try{await Ba()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ue.getState().venueId;if(me.PITCH||!s||'staff'!==Ue.getState().kind)return{ok:!0};if(!(0,ue.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await qa('approve_shift_swap',{p_venue:s,p_shift:e,p_to_ref:t,p_kind:a}),{ok:!0}}catch(e){return{ok:!1,message:String(e?.message??e).replace(/^.*?:\s*/,'')||'Not allowed'}}},i.claimInviteForSync=async function(e){const t=await Na(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(me.PITCH)return Se.reissueInvite(e);const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await De().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=a,i=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===i||'chef'===i?i:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.currentStaffAppLinks=async function(e){const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return qa('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return qa('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return qa('staff_app_link_history',{p_venue:Ue.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await qa('revoke_staff_app_link',{p_venue:Ue.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(me.PITCH)return Se.linkPhones();const e=Ue.getState().venueId;if(!e||'staff'!==Ue.getState().kind)return{};try{const t=await qa('staff_link_phones',{p_venue:e}),a={};for(const e of t??[])a[String(e.staff_ref)]={phones:Number(e.phones??0),since:String(e.since)};return a}catch{return{}}},i.resetStaffLinkPhone=async function(e){if(me.PITCH)return Se.resetPhone(e);const t=Ue.getState().venueId;if(!t||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');return Number(await qa('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(me.PITCH)return Se.inviteStatus();const e=Ue.getState().venueId;if(!e)return{};const{data:t,error:a}=await De().rpc('invite_status',{p_venue:e});if(a||!Array.isArray(t))return{};const s={};for(const e of t)s[String(e.staff_ref)]={state:e.state,expiresAt:e.expires_at??void 0,usedAt:e.used_at??void 0,devices:Number(e.devices??0)};return s},i.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Ta();const{data:t,error:a}=await De().rpc(u.IS_QUEUED_VENUE?'claim_'+u.VENUE_RID+'_pairing_code':u.IS_GREENSIDE?'claim_greenside_pairing_code':u.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':u.IS_KIRKTON?'claim_kirkton_pairing_code':u.IS_WILDINGS?'claim_wildings_pairing_code':u.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':u.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:e});if(a)throw a;const s=t?.[0];if(!s)return{ok:!1,error:'That code was not accepted. It may have expired. Ask a manager for a new one.'};const n={kind:'device',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,canWrite:s.can_write,label:s.label};return await L.kv.set(Oa,n),ja(),{ok:!0,venueName:s.venue_name}}catch(e){const t=String(e?.message??e);return/fetch|network/i.test(t)?{ok:!1,error:'No connection. Check the tablet\u2019s Wi-Fi and try again.'}:/rate|too many/i.test(t)?{ok:!1,error:'Too many tries from this network. Wait a little and try again.'}:{ok:!1,error:/valid|switched off/i.test(t)?t:`Couldn\u2019t pair: ${t}`}}},i.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Ta();const{data:e,error:t}=await De().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ka,a.request_id),{ok:!0,requestId:a.request_id,code:a.code,expiresAt:a.expires_at}):{ok:!1,error:'No code came back. Try again.'}}catch(e){return{ok:!1,error:Pa(e)}}},i.carPairPoll=async function(e){try{Me();const t=e??await L.kv.get(Ka,null);if(!t)return'unknown';const{data:a,error:s}=await De().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,Y.carPairApproved)(n)){const e=(0,Y.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Oa,null);await L.kv.set(Oa,e),await L.kv.remove(Aa),C.useSession.getState().meId&&C.useSession.getState().signOut(),de.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||ja()}return'revoked'!==i&&'unknown'!==i||await Ma(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{Me(),await De().rpc('car_sign_out')}catch{}await Ma(),await Ba();try{await De().auth.signOut({scope:'local'})}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ue.getState().venueId;if(!a||'staff'!==Ue.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await qa('car_pair_approve',{p_venue:a,p_code:e,p_label:t}))?.[0];return s?.id?{ok:!0}:{ok:!1,message:String(s?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:Pa(e)}}},i.carList=async function(){const e=Ue.getState().venueId;if(!e)return[];return(await qa('car_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,staffName:e.staff_name,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0}))},i.carRevoke=async function(e){const t=Ue.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await qa('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:Pa(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Oa),await Ba();try{await De().auth.signOut()}catch{}Ee({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Aa),await L.kv.remove(Ca),await Ba();try{await De().auth.signOut()}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'Disconnected. Open your personal invite link to connect again.'})},i.wipeThisDevice=async function(e={}){try{await Ba()}catch{}try{(0,K.isSupabaseConfigured)()&&await De().auth.signOut({scope:'local'})}catch{}let t=0;try{const e='undefined'!=typeof navigator?navigator:null,t=await(e?.serviceWorker?.getRegistration?.()),a=await(t?.pushManager?.getSubscription?.());a&&await a.unsubscribe()}catch{}for(const e of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(e)try{const a=[];for(let t=0;te.startsWith(`cc-venue:${u.VENUE_RID}:`)):(0,O.keysToWipe)(a).filter(e=>!e.startsWith('cc-venue:')))e.removeItem(s),t++}catch{}try{const e='undefined'!=typeof caches?caches:null;if(e)for(const t of await e.keys())!u.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ee({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This device has been wiped.'}),!1!==e.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return t},i.guestSession=xa,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return qa}}),i.mendSession=Fa,i.startAppSync=async function(e=u.VENUE_RID){if(u.IS_ISOLATED_VENUE&&e!==u.VENUE_RID)return;if(Le)return;Le=!0,$a=e,'customer'===Ke&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(Me(),'customer'!==Ke){const t=e=>new Promise(t=>{try{if(!e?.persist||e.persist.hasHydrated())return t();const a=e.persist.onFinishHydration(()=>{a?.(),t()});setTimeout(t,3e3)}catch{t()}}),a='chef'===Ke&&(0,w.isAnchorage)(e)?[z.useStore,de.useOwner,re.useKitchen,oe.useSafety,ae.useCardStore,S.useGpCalc,se.useOrderSheets,y.useSpecials,D.useHr]:[z.useStore,de.useOwner,re.useKitchen];if(await Promise.all(a.map(t)),'chef'===Ke&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ee({mode:'offline',message:'Saved kitchen data could not be backed up. Nothing was cleared. Free some device storage, then reopen.',lastError:'Legacy kitchen archive not ready'});try{await Cs(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ee({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ee({mode:'off'});$.mutationQueue.subscribe(()=>{const e=$.mutationQueue.waiting,t=e[0];Ee({pending:$.mutationQueue.pending.length,failed:$.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,j.describeWrite)(t)}: ${(0,j.plainReason)({...t.lastErr},'retry')}`:void 0})}),$.mutationQueue.onFailed(e=>Ee({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:$.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,j.describeWrite)(e),why:'conflict'===e.reason?(0,j.plainReason)({code:'conflict'},'refused'):(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),qe.push((0,P.onConnectivity)(e=>Ee({mode:e?Ue.getState().venueId?'live':Ue.getState().mode:Ue.getState().venueId?'offline':Ue.getState().mode}))),await Wa()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return Ga}}),i.serverOrder=es,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ts}}),i.nudgeGuestSync=function(){as?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return ss}}),i.stockSaveBlocker=ns,i.stockEventStatus=function(e){if(et(e))return{state:'saved'};const t=$.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,j.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=is,i.saveStockEventsNow=rs,i.bookingSaveBlocker=ds,i.resendUnsavedBookings=ls,i.saveBookingsNow=fs,i.waitForBookingSave=function(e,t=12e3){if(!Ne())return Promise.resolve({state:'local'});const a=ds();if(a)return Promise.resolve({state:'refused',why:a});const s=us()[0]?.venueId??'',n=()=>os.some(t=>$.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,P.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push($.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push($.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||us().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||us().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=Ss,i.tempLogState=function(){const e=hs()[0]?.venueId??'',t=hs().find(e=>'temp_readings'===e.spec.table),a=$.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!$.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(H.useTempSaves.getState().notSaved),i=oe.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ys,i.waitForTempSave=function(e,t,a=1e4){if(!Ne()||!hs().length)return Promise.resolve({state:'local'});const s=Ss(e);if(s)return Promise.resolve({state:'refused',why:s});const n=hs()[0]?.venueId??'',i=hs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>H.useTempSaves.getState().notSaved[(0,H.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>$.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=ks,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return Ls}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=qs.get(a);if('customer'!==Ke||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():qs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),qa('public_day',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],i=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:Fe(a.booking_time),partySize:Number(a.covers)||0,table:(a.table_ids??[]).join('+')||void 0,durationMins:a.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):i.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:Fe(a.from_time),to:Fe(a.to_time),areaId:a.area_id??void 0,tables:Array.isArray(a.table_ids)&&a.table_ids.length?a.table_ids.map(String):void 0,by:'',createdAt:''})}),qs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),Ls.setState(e=>({n:e.n+1}))}).catch(()=>{const e=qs.get(a);e&&!e.ok&&qs.delete(a)}));const n=qs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ue.getState().venueId;if(!n||'staff'!==Ue.getState().kind)throw new Error('Connect to your venue first.');const i=await qa('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ue.getState().venueId;if(!e||'staff'!==Ue.getState().kind)return null;return(await qa('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ue.getState().venueId;if(!s||'staff'!==Ue.getState().kind)throw new Error('Connect to the venue first.');await qa('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})};var o=t(r[0]),d=t(r[1]),u=t(r[2]),c=t(r[3]),l=t(r[4]),f=t(r[5]),p=t(r[6]),g=t(r[7]),m=t(r[8]),_=t(r[9]),S=t(r[10]),h=t(r[11]),y=t(r[12]),w=t(r[13]),v=t(r[14]),b=t(r[15]),k=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),E=t(r[24]),T=t(r[25]),N=t(r[26]),K=t(r[27]),P=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),L=t(r[32]),B=t(r[33]),j=t(r[34]),F=t(r[35]),$=t(r[36]),W=t(r[37]),H=t(r[38]),Q=t(r[39]),V=t(r[40]),G=t(r[41]),J=t(r[42]),z=t(r[43]),Z=t(r[44]),Y=t(r[45]),X=t(r[46]),ee=t(r[47]),te=t(r[48]),ae=t(r[49]),se=t(r[50]),ne=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),Se=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(a){if('default'!==a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,t})(_e),he=t(r[64]),ye=t(r[65]),we=t(r[66]),ve=t(r[67]),be=t(r[68]),ke=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]);const De=()=>(0,N.getSupabase)();$.mutationQueue.setExecutor(B.executeMutation),(0,x.setClockServer)(()=>'staff'===Ue.getState().kind);const Ue=(0,T.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ee=e=>Ue.setState(e),Te=e=>{const t=Ue.getState().perms;return t.includes('*')||t.includes(e)},Ne=()=>{const e=Ue.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ue.subscribe(()=>(0,Re.setLiveData)(Ne()));let Ke=Z.IS_CAR?'car':Z.APP_VARIANT,Pe=!1;const Me=()=>{Pe||((0,L.setSyncNamespace)(Ke),Pe=!0)};let xe=[],qe=[],Le=!1;const Be=()=>(new Date).toISOString().slice(0,10),je=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),Fe=e=>e?e.slice(0,5):'',$e=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],We=e=>JSON.parse(JSON.stringify(e));function He(e,t){const a=je(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write')),filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=We(e);if(t)return{id:e.id,venue_id:a,walk_date:e.date,arrived_at:e.seatedAt??e.createdAt,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:$e(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,i='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),r=n.externalSource??(i?'Wix':null),o=n.externalId??(i?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,ue.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:$e(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...r?{external_source:r}:{},...o?{external_id:o}:{}}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};if(!t&&a.status&&'declined'!==a.status&&(s.status=a.status),!t){const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];s.table=e.length?e.join('+'):void 0}if(t){s.walkIn=!0,'left'===a.status?s.status='finished':'undone'===a.status?s.status='cancelled':'seated'===a.status&&(s.status='seated');const e=Array.isArray(a.table_ids)?a.table_ids.map(String).map(e=>e.trim()).filter(Boolean):[];e.length&&(s.table=e.join('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{bookings:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Qe(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>'guest'!==Ue.getState().kind,filter:e=>e.gte('created_at',t),inWindow:e=>e.createdAt>=t,toRow:(e,t)=>({id:e.id,venue_id:t,ref:e.ref,customer_id:(0,ue.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:We(e.lines??[]),allergies:$e(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:We(e.allergyChain??{}),readiness:We(e.readiness??{}),allergy_ticks:We(e.allergyTicks??{}),handover_check:e.handoverCheck?We(e.handoverCheck):null,accepted:e.accepted?We(e.accepted):null,doc:We(e)}),fromRow:t=>t.doc&&'object'==typeof t.doc?{...t.doc,id:String(t.id),restaurantId:e,status:t.status??t.doc.status}:null,apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Ve(e){const t=je(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...X.useBlocks.getState().blocks,...X.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==Ue.getState().kind,filter:e=>e.gte('block_date',t),inWindow:e=>e.date>=t,toRow:(e,t)=>({id:e.id,venue_id:t,block_date:e.date,from_time:e.from,to_time:e.to,reason:e.reason??null,note:e.note??null,area_id:e.areaId??null,area_name:e.areaName??null,created_by:e.by,created_at:e.createdAt,doc:We(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,X.blockClock)(t.from_time)??a?.from,n=(0,X.blockClock)(t.to_time)??a?.to,i='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&i?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:i,from:s,to:n,reason:(t.reason??a?.reason)||void 0,note:t.note??a?.note,areaId:t.area_id??a?.areaId,areaName:t.area_name??a?.areaName}:a?{...a,id:String(t.id),rid:e}:null},apply:(e,t)=>X.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id)),o=[...i,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>X.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ge=null,Je='Main plan';function ze(e){const t=e=>We({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ee.useFloor.getState().plans[e]??(0,ee.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Te('floor.manage')||Te('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ge??(0,Oe.uuidFrom)(`plan:${a}`),venue_id:a,name:Je||'Main plan',is_active:!0,...t(e),updated_by:(0,Y.actorStamp)({isCar:Z.IS_CAR,kind:Ue.getState().kind,staffRef:Ue.getState().staffRef,fallback:Ke})}),fromRow:e=>(Ge=String(e.id),Je=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,Ae.withSeedBest)(e,t[0]):void 0;a&&ee.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ee.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Ze(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>te.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Te('stock.manage'),matchKey:e=>({key:e}),toRow:(e,t)=>({venue_id:t,key:e.key,name:e.name,plural:e.plural,unit:e.unit,low_at:e.lowAt,supplier_id:e.supplierId?(0,ue.isUuid)(e.supplierId)?e.supplierId:(0,Oe.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active,display_group:e.group??null}),fromRow:e=>{return{key:e.key,name:e.name,plural:e.plural,unit:e.unit,lowAt:Number(e.low_at),icon:e.icon??'\u2022',sort:e.sort??0,active:!1!==e.active,...'roast'===e.display_group?{group:'roast'}:{},...e.supplier_id?{supplierId:(t=String(e.supplier_id),lt.get(t)??t)}:{}};var t},apply:(t,a)=>te.useShellStore.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>i.get(e.key)??e),o=new Set(r.map(e=>e.key));return{items:{...s.items,[e]:[...r,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>te.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Ye=new Set,Xe=new Set;$.mutationQueue.onDone(e=>{'stock_events'===e.table&&Xe.add(e.rowKey)});const et=e=>Xe.has(e)||Ye.has(e),tt=()=>Te('*')||Te('staff.manage')||Te('recipes.edit')||Te('recipes.signoff'),at=()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write'));function st(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>te.useShellStore.getState().events.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,ue.isUuid)(t.id)&&!!(te.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==Ue.getState().kind&&('device'!==Ue.getState().kind||Te('device.write')),filter:e=>e.gte('at',t).order('at',{ascending:!1}),inWindow:e=>e.at>=t,toRow:(e,t)=>({id:e.id,venue_id:t,item:e.kind,delta:e.delta,reason:e.reason,undoes:e.undoes&&(0,ue.isUuid)(e.undoes)&&(et(e.undoes)||$.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Ye.add(String(t.id)),{id:String(t.id),rid:e,kind:t.item,delta:Number(t.delta),reason:t.reason,by:t.by_name??'',app:t.app??'',at:new Date(t.at).toISOString(),...t.undoes?{undoes:String(t.undoes)}:{}}),apply:(e,t)=>te.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>te.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function nt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(te.useShellStore.getState().server[e]?.counts??{}).map(([e,t])=>({item:e,quantity:t})),key:e=>e.item,rowKey:e=>String(e.item),syncable:()=>!1,writable:()=>!1,toRow:()=>({}),fromRow:e=>({item:String(e.item),quantity:Number(e.quantity)}),apply:(a,s)=>{t={...te.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;te.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Ye]}}}))},afterRead:()=>{te.useShellStore.getState().server[e]||te.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Ye]}}}))},subscribe:()=>()=>{}}}const it=new Set;function rt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ae.useCardStore.getState().cards.filter(t=>t.restaurantId===e).map(e=>({card:e,item:t.find(t=>t.id===e.menuItemId)}))},key:e=>e.card.id,rowKey:e=>String(e.id),syncable:t=>(0,ue.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Te('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Oe.photoPath)(a,s),t=ot(s.photo);t&&((0,ae.cachePhotoAs)(e,t),dt(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Oe.cardToRow)(s,a);return{...i,...r,doc:We({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(a.card))return null;const s=t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:new Date(t.signed_off_at).toISOString()}:null;return{card:{...a.card,id:String(t.id),restaurantId:e,signOff:s&&a.card.signOff?a.card.signOff:s,...t.photo_url?{photo:t.photo_url}:{}},item:a.item?{...a.item,restaurantId:e,signOff:(0,w.isAnchorage)(e)&&(0,w.demoActor)(a.item.signOff?.by)?null:a.item.signOff}:void 0}},supersededBy:(e,t)=>t.some(t=>t.card.menuItemId===e.card.menuItemId&&t.card.id!==e.card.id),apply:(e,t)=>{if(!Te('recipes.edit')&&t.length){const e=new Set(t);ae.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ae.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),i=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),r=t.cards.filter(e=>!a.has(e.id)&&(s.has(e.id)||!n.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return i.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>i.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...i]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),n=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!n.has(e.id))]}})},subscribe:e=>{const t=ae.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ot=e=>(0,ae.readLocalPhoto)(e);async function dt(e,t){if(!it.has(e)){it.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await De().storage.from(Oe.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){it.delete(e),Ee({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const ut=new Map,ct=(0,T.create)(()=>({n:0}));(0,ae.setStoragePhotoResolver)(e=>{const t=ut.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ue.getState().mode?(t||(ut.set(e,{url:'',at:Date.now()}),De().storage.from(Oe.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(ut.set(e,{url:t.signedUrl,at:Date.now()}),ct.setState(e=>({n:e.n+1})),ae.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const lt=new Map;const ft=(e,t)=>{const a=(0,ue.isUuid)(t)?t:(0,Oe.uuidFrom)(`sup:${e}:${t}`);return lt.set(a,t),a};function pt(e){return{name:'order_sheets',table:'suppliers',list:()=>se.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Te('suppliers.manage'),toRow:(e,t)=>({id:ft(t,e.id),venue_id:t,name:e.name||'Supplier',category:e.goods||null,contact:e.contact??null,phones:e.number?[e.number]:[],website:e.url||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,notes:e.notes||null,doc:{kind:'sheet',localId:e.id,sheet:We(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(lt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>se.useOrderSheets.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>i.get(e.id)??e),o=new Set(r.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...r,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>se.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,ue.isUuid)(e)?e:(0,Oe.uuidFrom)(`sup:${Ue.getState().venueId}:${e}`)})}}let gt=!1,mt=!1;const _t=new Map,St=new Map,ht=new Map,yt=new Map,wt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',vt=e=>'owner'===e?{role:'owner',level:'Owner'}:'manager'===e?{role:'manager',level:'Manager'}:'supervisor'===e?{role:'manager',level:'Supervisor'}:'head_chef'===e?{role:'staff',level:'Head Chef'}:{role:'staff',level:'Staff'},bt=(e,t)=>({...e,managerAccess:t}),kt=()=>({nickname:gt,display:mt}),It=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=bt({role:e.role,level:e.level??vt(wt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},kt())};const Rt=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ot=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},At=e=>{const t=de.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,c.isKitchenTeam)(t)},Ct=2e3;function Dt(e,t){return t||!e.length||e.length>=Ct?null:e=>(0,ue.isUuid)(e.id)}function Ut(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Dt(t,Te('rota.manage')):null,keepOnEmpty:()=>e&&!Te('rota.manage'),list:()=>de.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&_t.has(e.staffId)&&(Te('rota.manage')||At(e.staffId)),writable:()=>Te('rota.manage')||Te('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(Rt());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ot(e.start),end_time:Ot(e.end),published:!!e.published,doc:We(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,i]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,i).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{shifts:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Et(){const e=je(62),t=e=>Te('rota.manage')||e.staffId===Ue.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>de.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ue.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=je(2)&&e.staffId===Ue.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:We(e.breaks??[]),break_mins:e.breakMins??0,doc:We((0,v.privateAttendance)(u.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(u.VENUE_RID,{...e.doc,id:String(e.id)});return'confirmed'===e.status?t.signOff={by:String(e.confirmed_by_name??t.signOff?.by??'Manager'),byId:t.signOff?.byId??'',at:e.confirmed_at?new Date(e.confirmed_at).toISOString():t.signOff?.at??''}:delete t.signOff,t},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{attendance:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Tt(){const e=je(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>de.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&e.staffId===Ue.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ue.getState().kind,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:_t.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,ue.isUuid)(e.attendanceId)?e.attendanceId:null,kind:e.kind,suggested_in:e.suggestedIn??null,suggested_out:e.suggestedOut??null,note:(e.note??'').slice(0,300)||null,status:'open',doc:We({...e,status:'open'})}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),date:String(e.work_date).slice(0,10),attendanceId:e.attendance_id?String(e.attendance_id):t.attendanceId,kind:e.kind,suggestedIn:e.suggested_in?new Date(e.suggested_in).toISOString():void 0,suggestedOut:e.suggested_out?new Date(e.suggested_out).toISOString():void 0,note:e.note??'',at:t.at??new Date(e.created_at).toISOString(),status:e.status,resolvedBy:e.resolved_by_name??void 0,resolvedAt:e.resolved_at?new Date(e.resolved_at).toISOString():void 0}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Nt(e){de.leaveRemote.decide=t=>!(!Te('rota.manage')||!(0,ue.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&($.mutationQueue.enqueue({table:'staff_leave',venueId:e,kind:'rpc',fn:'staff_leave_decide',rowKey:t.id,values:{p_id:t.id,p_status:t.status}}),!0),qe.push(()=>{de.leaveRemote.decide=null})}function Kt(e){de.timesheetRemote.send=(t,a)=>{if(!Te('rota.manage')||!(0,ue.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return $.mutationQueue.enqueue({table:'time_requests',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_status:s.status,p_doc:We(s)}}),!0}const s=a;if('attendance_void'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&($.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return $.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:'attendance_override',rowKey:s.id,values:{p_id:s.id,p_venue:e,p_staff_ref:s.staffId,p_work_date:s.date,p_clock_in:s.in,p_clock_out:s.out??null,p_break_mins:s.breakMins??0,p_breaks:We(s.breaks??[]),p_reason:n,p_doc:We((0,v.privateAttendance)(u.VENUE_RID,s))}}),!0},qe.push(()=>{de.timesheetRemote.send=null})}function Pt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('created_at',new Date(Date.now()-2592e6).toISOString()),inWindow:()=>!1,toRow:(e,t)=>{return{id:(a=e.id,(0,ue.isUuid)(a)?a:(0,Oe.uuidFrom)(`outbox:${a}`)),local_id:e.id,venue_id:t,channel:e.channel,kind:e.kind,to_address:e.to||'',to_name:e.toName||null,subject:e.subject??null,body:e.body,html:e.html??null,ref_type:e.refType,ref_id:(0,ue.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:We(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.useStore.setState(t=>{const a=new Set(t.outbox.map(e=>e.id));return{outbox:[...e.filter(e=>!a.has(e.id)),...t.outbox].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,300)}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const Mt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function xt(e,t){if(!Array.isArray(t))return;const a=t.filter(e=>e&&'string'==typeof e.id&&'string'==typeof e.date&&'string'==typeof e.title).map(t=>({...t,restaurantId:e,example:!1}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function qt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[We({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ee.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:Mt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Te('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...Bt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...Bt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...Bt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Lt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Lt=t.feature_flags??{},Bt=t.settings??{};const a=t.settings?.app?.restaurant;if(!a)return null;const s='string'==typeof t.settings?.whatsapp?t.settings.whatsapp:void 0;return s&&!a.settings?.whatsapp&&(a.settings={...a.settings,whatsapp:s}),We({restaurant:{...a,id:e},msgTemplates:t.settings?.ops?.msgTemplates??{},display:t.settings?.ops?.display??{},games:!1!==t.feature_flags?.games,...Array.isArray(t.settings?.app?.events)?{events:t.settings.app.events}:{}})},apply:t=>{const a=t[0];a&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,p.withWildingsAddress)({...a.restaurant,id:e,settings:{...a.restaurant.settings,games:a.games}}):t),msgTemplates:{...t.msgTemplates,[e]:a.msgTemplates??{}}})),a.display&&Object.keys(a.display).length&&ee.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&xt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ee.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Lt=null,Bt=null;const jt=()=>new Date(Date.now()-2592e6).toISOString(),Ft=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>_t.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},$t=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,ve.dmId)(t[0],t[1]):null},Wt=()=>Ue.getState().perms.includes('*');function Ht(){const e=()=>Ue.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>de.useOwner.getState().chat.filter(e=>(0,ue.isUuid)(e.id)).map(e=>We({id:e.id,ch:e.ch,from:e.from,text:e.text,photo:e.photo,at:e.at,removed:!!e.removed})),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>!!Ft(t.ch)&&(t.from===e()||Wt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('created_at',jt()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=jt(),toRow:(e,t)=>{const a=Ft(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:_t.get(e.from)??null;return{id:e.id,venue_id:t,channel:a,from_staff:s,body:e.text??null,photo:e.photo??null,removed:e.removed,created_at:e.at}},fromRow:e=>{const t=$t(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?We({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>de.useOwner.setState(s=>{const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>i.has(e.id)?{...e,...i.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=r&&s.chatRead?.[r]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===r?[e.from]:r&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[r]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=$t(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=de.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,ve.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,be.soundAllowed)())try{(0,be.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Qt(e,t,a){const s=Ue.getState();if(!we.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=_t.get(e),i='*'===t?'*':Ft(t);if(n&&i)try{await De().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Vt(e){const t=Ue.getState().staffRef,a=t?_t.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await De().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const i={};for(const e of s){const t='*'===e.channel?'*':$t(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&de.useOwner.getState().chatMarkRead(t,i)}catch{}}function Gt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=U.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:We(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:We(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'break_rules'===e.kind?'break_rules':'reminder',doc:e.doc??{}}),apply:(t,a)=>U.useReminders.setState(s=>{const n=new Set(a),i={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)i[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};i[e]&&n.has(i[e].id)&&delete i[e];const o=new Map(t.filter(e=>'reminder'===e.kind).map(t=>[t.id,{...t.doc,id:t.id,rid:e}])),d=s.reminders.filter(e=>!n.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:i,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>U.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function Jt(e){const t=je(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>U.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.reminderId)&&e.staffRef===Ue.getState().staffRef,writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('for_date',t).order('done_at',{ascending:!1}),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,reminder_id:e.reminderId,for_date:e.forDate,staff_ref:e.staffRef,staff_name:e.staffName.slice(0,80),done_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,reminderId:String(t.reminder_id),forDate:String(t.for_date).slice(0,10),staffRef:t.staff_ref??'',staffName:t.staff_name??'Team',at:new Date(t.done_at).toISOString()}),apply:(e,t)=>U.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...i].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>U.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function zt(e,t,a,s=()=>!0){const n=new Set(a),i=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&i.has(e.id)?i.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const Zt=e=>null==e||''===e?null:Number(e),Yt=e=>e.filter(e=>!e.startsWith('data:')),Xt=()=>Te('takings.view');function ea(e){const t=!Xt();return{name:'cash_ups',table:'cash_ups',list:()=>le.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,k.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,k.tradingDay)()&&!e.onServer),writable:()=>Te('wages.manage')||(0,b.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,k.tradingDay)()):e.gte('for_date',je(400)),...t?{inWindow:e=>e.date===(0,k.tradingDay)()}:{},toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:We(e.vals),cash_tips:'number'==typeof e.vals.cashTips?e.vals.cashTips:null,card_tips:'number'==typeof e.vals.cardTips?e.vals.cardTips:null,photos:Yt(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,date:String(t.for_date),vals:t.vals??{},photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>le.useCashUp.setState(s=>({cashUps:zt(s.cashUps,t.map(e=>{const t=s.cashUps.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function ta(e){return{name:'sales_reports',table:'sales_reports',list:()=>le.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Te('wages.manage')||(0,b.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:We(e.vals),categories:e.categories,photos:Yt(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,weekStart:String(t.week_start),vals:t.vals??{},categories:t.categories??[],photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>le.useCashUp.setState(s=>({sales:zt(s.sales,t.map(e=>{const t=s.sales.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function aa(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=le.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,le.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Te('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:We({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,le.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>le.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function sa(e){return{name:'day_tips',table:'day_tips',list:()=>le.useCashUp.getState().tips.filter(t=>t.rid===e).map(e=>({...e,id:e.date})),key:e=>e.id,rowKey:e=>String(e.for_date),syncable:()=>!1,writable:()=>!1,deletes:!1,filter:e=>e.gte('for_date',je(120)),toRow:()=>({}),fromRow:t=>({id:String(t.for_date),rid:e,date:String(t.for_date),total:Number(t.total),postedAt:String(t.posted_at),postedBy:t.posted_by??void 0}),apply:t=>le.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),n=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...n]}}),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function na(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>le.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('wages.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,for_date:e.forDate??null,through_date:e.throughDate??null,amount:e.amount,reason:e.reason??null,by_name:e.by,at:e.at}),fromRow:t=>({id:String(t.id),rid:e,kind:'payout'===t.kind?'payout':'correction',forDate:t.for_date??void 0,throughDate:t.through_date??void 0,amount:Zt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>le.useCashUp.setState(s=>({pot:zt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function ia(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=le.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Te('wages.manage'),toRow:(e,t)=>({venue_id:t,show_today:e.showToday,show_pot:e.showPot,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'show',showToday:!1!==e.show_today,showPot:!1!==e.show_pot}),apply:t=>le.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>le.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function ra(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>ce.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:We(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ce.useNotifs.setState(s=>({items:zt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ce.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function oa(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=fe.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,ue.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:We(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:We(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings')||Te('suppliers.order'),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'settings'===e.kind?'settings':'list',doc:e.doc??{}}),apply:(t,a)=>fe.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...pe.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const i=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:zt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function da(e){const t=()=>Te('venue.settings')||Te('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>fe.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,ue.isUuid)(a.id)&&(0,ue.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,fe.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ue.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...n}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:Ue.getState().staffRef)||null,doc:We(n),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),listId:String(t.list_id),status:t.status??'open',rid:e}),apply:(t,a)=>fe.useOrderLists.setState(s=>({items:zt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){const t=je(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>fe.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('venue.settings')||Te('suppliers.order'),filter:e=>e.gte('finished_at',t).order('finished_at',{ascending:!1}).limit(300),toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,list_id:e.listId,finished_at:e.finishedAt,finished_by:e.finishedByName.slice(0,80),doc:We(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useOrderLists.setState(s=>({history:zt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>fe.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function ca(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=ge.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:We(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Te('venue.settings'),toRow:(e,t)=>({venue_id:t,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'area',doc:e.doc??{}}),apply:t=>{const a=t[0];a&&ge.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>ge.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function la(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=he.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,he.libraryRowId)(e),kind:'library',doc:We({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,i]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,he.personRowId)(e,i),kind:'person',staffRef:i,doc:We({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=de.useOwner.getState().staff.find(e=>e.id===Ue.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=de.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ye.canEditTasks)(t,a)},writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,staff_ref:e.staffRef??null,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'library'===e.kind?'library':'person',staffRef:e.staff_ref??void 0,doc:e.doc??{}}),apply:t=>he.useDailyTasks.setState(a=>{const s={...a.library},n={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(n[(0,he.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>he.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function fa(e){const t=je(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>he.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ue.getState();return e.byRef===t.staffRef||Te('staff.manage')},writable:()=>'staff'===Ue.getState().kind,filter:e=>e.gte('for_date',t),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffRef,task_id:e.taskId,for_date:e.forDate,ticked_by_ref:e.byRef,ticked_by_name:e.byName.slice(0,80),ticked_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,staffRef:String(t.staff_ref),taskId:String(t.task_id),forDate:String(t.for_date).slice(0,10),byRef:String(t.ticked_by_ref??''),byName:String(t.ticked_by_name??''),at:String(t.ticked_at)}),apply:(t,a)=>he.useDailyTasks.setState(s=>({ticks:zt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>he.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function pa(e,t=!1){const a=je(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ke.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ue.getState().kind||Te('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Oe.uuidFrom)(`soldout:${a}:${e.itemId}`),venue_id:a,item_id:e.itemId.slice(0,80),name:e.name.slice(0,120),is_on:e.on,marked_at:e.at,by_name:(e.by||'Staff').slice(0,80),clear_after:e.clearAfter??null,...t?{auto:!!e.auto,kept:!!e.kept}:{}}),fromRow:a=>({rid:e,itemId:String(a.item_id),name:String(a.name??''),on:!0===a.is_on,at:String(a.marked_at),by:String(a.by_name??''),clearAfter:a.clear_after?String(a.clear_after):void 0,...t?{auto:!0===a.auto,kept:!0===a.kept}:{}}),apply:(t,a)=>ke.useSoldOut.setState(s=>{const n=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ke.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Ie.autoSync.soldOutRead.add(e)}}}function ga(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Ie.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:(0,Oe.uuidFrom)(`soldoutlink:${t}:${e.itemId}`),venue_id:t,item_id:e.itemId.slice(0,80),uses:e.uses.slice(0,10).map(e=>({key:String(e.key).slice(0,40),qty:Math.max(0,Math.min(99,Number(e.qty)||0))})),auto:!!e.auto,updated_at:e.at,updated_by:(e.by||'Staff').slice(0,80)}),fromRow:t=>({rid:e,itemId:String(t.item_id),uses:(Array.isArray(t.uses)?t.uses:[]).map(e=>({key:String(e.key??''),qty:Number(e.qty)||0})).filter(e=>e.key&&e.qty>0),at:String(t.updated_at??''),by:String(t.updated_by??''),...!0===t.auto?{auto:!0}:{}}),apply:(t,a)=>Ie.useSoldOutLinks.setState(s=>{const n=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(n.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>Ie.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Ie.autoSync.linksRead.add(e)}}}async function ma(e,t="*"){const a='*'===t?`table:${e}`:`table:${e}.${t}`;try{const s=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:n}=await Promise.race([De().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function _a(){const e=Ue.getState().venueId;if(e)try{const{data:t}=await De().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();ya.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const ha=new Map;const ya=(0,T.create)(()=>({live:!1,known:!1}));async function wa(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([De().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function va(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([De().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const ba=(e,t)=>We({id:String(e.id),venue:t,body:String(e.body??''),kind:'yesno'===e.kind?'yesno':'up',up:Number(e.up_count??0),yes:Number(e.yes_count??0),no:Number(e.no_count??0),hidden:!!e.hidden,reply:e.reply??void 0,replyAt:e.reply_at??void 0,postedOn:String(e.posted_on??'').slice(0,10)}),ka='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Ia(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>D.useHr.getState().questions.filter(t=>t.venue===e&&(0,ue.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>ba(t,e),filter:e=>e.gte('posted_on',new Date(Date.now()-10368e6).toISOString().slice(0,10)),apply:(e,t)=>{const a=new Set(t);D.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),n=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),i=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!i.has(e.id))]}})},subscribe:e=>D.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Ra(e,t){const a=(t,a,s)=>{$.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(D.hrRemote,{live:!0,checkout:t=>a('hr_checkout',t.token,{p_venue:e,p_day:t.day,p_token:t.token,p_morale:t.morale,p_staffing:t.staffing,p_question:t.question??null,p_kind:t.kind??'up',p_shout_to:t.shoutTo??null,p_shout_body:t.shoutBody??null}),post:(t,s,n,i)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:i}),vote:(e,t,s)=>a('hr_vote',e,{p_question:e,p_token:t,p_vote:s}),moderate:(e,t,s)=>a('hr_moderate',e,{p_question:e,p_action:t,p_reason:s}),reply:(e,t)=>a('hr_reply',e,{p_question:e,p_reply:t}),trend:async(t,a,s)=>{try{const{data:t,error:n}=await De().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return n?null:(t??[]).map(e=>({day:String(e.day).slice(0,10),answers:Number(e.answers),morale:Number(e.morale),staffing:null==e.staffing?null:Number(e.staffing),short:Number(e.short),perfect:Number(e.perfect),over:Number(e.over)}))}catch{return null}},shouts:async(a,s)=>{try{const{data:a,error:n}=await De().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return n?null:(a??[]).map(e=>({id:String(e.id),venue:t,day:String(e.day).slice(0,10),to:String(e.to_name),body:e.body??void 0}))}catch{return null}},log:async()=>{try{const{data:a,error:s}=await De().from('hr_mod_log').select('id,question_id,action,reason,by_name,at').eq('venue_id',e).order('at',{ascending:!1}).limit(30);return s?null:(a??[]).map(e=>({id:String(e.id),venue:t,questionId:String(e.question_id??''),action:e.action,reason:e.reason??void 0,by:String(e.by_name??'A manager'),at:String(e.at)}))}catch{return null}},refresh:async()=>{try{const{data:a,error:s}=await De().from('hr_questions').select(ka).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||D.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>ba(e,t)))}catch{}}}),qe.push(()=>{Object.assign(D.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Oa='pair:v1',Aa='staff:v1',Ca='staff:rejoin:v1';async function Da(e){const t=u.IS_QUEUED_VENUE?'claim_'+u.VENUE_RID+'_invite':u.IS_GREENSIDE?'claim_greenside_invite':u.IS_ABBOTSFORD?'claim_abbotsford_invite':u.IS_KIRKTON?'claim_kirkton_invite':u.IS_WILDINGS?'claim_wildings_invite':u.IS_KIRKMICHAEL?'claim_kirkmichael_invite':u.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',a={p_token:e,p_app:Ke,p_device:(0,C.deviceId)()},s=await De().rpc(t,{...a,p_phone:(0,C.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?De().rpc(t,a):s}async function Ua(){if('display'===Ke||'customer'===Ke||me.PITCH)return'none';const e=await L.kv.get(Ca,null);if(!e)return'none';try{await Ta();const{data:t,error:a}=await Da(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ca),await L.kv.remove(Aa),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Aa,{kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name}),'ok'):(await L.kv.remove(Ca),'refused')}catch{return'offline'}}const Ea=e=>/jwt|refresh|token|401|not authenticated|invalid claim|session/i.test(String(e?.message??e))&&!/fetch|network/i.test(String(e?.message??e));async function Ta(){Me();const{data:e}=await De().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await De().auth.signInAnonymously();if(!t)return;const a=429===t.status||/rate|too many/i.test(t.message);if(!a||e>=2){if(a)throw new Error('Too many people are connecting from this network right now. Wait a few minutes, or switch to mobile data, and open the link again.');throw t}Ee({message:'Lots of people are connecting at once. Trying again in a moment\u2026'}),await new Promise(t=>setTimeout(t,0===e?15e3:45e3))}}async function Na(e){if(me.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Ta();const{data:t,error:a}=await Da(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,u.venueKey)(`cc-pending-invite:${Ke}`))}catch{}return{status:'refused',message:e}}throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:s.venue_id,venueSlug:s.venue_slug,venueName:s.venue_name,staffRef:s.external_ref,staffUuid:s.staff_id,role:s.role_key,displayName:s.display_name};return await L.kv.set(Aa,n),await L.kv.set(Ca,e),Le&&ja(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ee({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ka='car:request:v1',Pa=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check the car has Wi-Fi or mobile data, then try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function Ma(){await L.kv.remove(Oa),await L.kv.remove(Aa),await L.kv.remove(Ka),C.useSession.getState().meId&&C.useSession.getState().signOut()}async function xa(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Ta(),!0}catch{return!1}}const qa=async(e,t={})=>{if(me.PITCH)return(0,_e.pitchRpc)(e,t);const{data:a,error:s}=await De().rpc(e,t);if(s)throw s;return a};let La=null;async function Ba(){for(const e of qe)try{e()}catch{}qe=[],xe.forEach(e=>e.stop()),xe=[],La&&(clearInterval(La),La=null)}async function ja(){await Ba(),await Wa()}async function Fa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Ke||me.PITCH)return!1;try{Me();const{data:e}=await De().auth.getSession();if(e.session){const{error:e}=await De().auth.refreshSession();if(!e)return!0}if('display'===Ke)return!1;if(!await L.kv.get(Ca,null))return!1;if(e.session)try{await De().auth.signOut({scope:'local'})}catch{}return'ok'===await Ua()&&(ja(),!0)}catch{return!1}}(0,l.setSessionMender)(Fa);let $a=u.VENUE_RID;async function Wa(){try{const e='undefined'!=typeof navigator?navigator.storage:null;e?.persist&&e.persist()}catch{}try{const e='undefined'!=typeof window?window.CoverChargeNative:null;e&&'function'==typeof e.checkUpdate&&/CoverChargePhone\//.test(navigator.userAgent)&&e.checkUpdate()}catch{}const e=$a;try{if(Ee({mode:'connecting'}),await $.mutationQueue.load(),'customer'===Ke)return void await za(e);let t=await L.kv.get(Oa,null),a=await L.kv.get(Aa,null);if(Z.IS_CAR&&!t&&a){const e=(0,Y.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Oa,t)),await L.kv.remove(Aa),a=null,C.useSession.getState().meId&&C.useSession.getState().signOut()}if(u.IS_ISOLATED_VENUE&&(t&&!(0,u.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,u.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ee({mode:'display'===Ke?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await De().auth.getSession();if('display'!==Ke&&!Z.IS_CAR&&a&&!s.session){const t=await Ua();if('offline'===t)return Ee({venueId:a.venueId,venueSlug:a.venueSlug,venueName:a.venueName,kind:a.kind,role:a.role,staffRef:a.staffRef,staffUuid:a.staffUuid,mode:'offline'}),void setTimeout(()=>{$a===e&&ja()},6e4);'refused'===t&&a.staffRef&&C.useSession.getState().meId===a.staffRef&&C.useSession.getState().signOut(),a=await L.kv.get(Aa,null),({data:s}=await De().auth.getSession())}const n='display'===Ke||Z.IS_CAR?t:a;if(!s.session||!n)return void Ee({mode:'display'===Ke||Z.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await qa('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Ke||Z.IS_CAR?await L.kv.remove(Oa):(await L.kv.remove(Aa),await L.kv.remove(Ca)),'staff'===n.kind&&n.staffRef&&C.useSession.getState().meId===n.staffRef&&C.useSession.getState().signOut(),void Ee({mode:'display'===Ke||Z.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Ke?'This display was unpaired by a manager.':Z.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});i=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&i.push('device.write')}catch(t){if(!(0,P.isOnline)()||/fetch|network/i.test(String(t?.message)))Ee({mode:'offline'});else if(Ea(t)&&'display'!==Ke){const{error:t}=await De().auth.refreshSession();t&&'ok'===await Ua()&&setTimeout(()=>{$a===e&&ja()},500)}i=Ue.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ee({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Z.IS_CAR&&'staff'===n.kind&&n.staffRef&&C.useSession.getState().meId!==n.staffRef&&(C.useSession.getState().signIn(n.staffRef),de.useOwner.setState({staffAs:n.staffRef})),Z.IS_CAR&&(C.useSession.getState().meId&&C.useSession.getState().signOut(),de.useOwner.setState({previewRole:'owner'})),await Qa(n.venueId,e,n.kind)}catch(e){Ee({mode:'local',lastError:String(e?.message??e)})}}const Ha=new Set(['venues','staff','bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_items','stock_events','stock_counts','recipe_cards','suppliers','supplier_orders','rota_shifts','attendance','time_requests','game_scores','floor_live','chat_messages','venue_reminders','reminder_done']);async function Qa(e,a,s){if(!(0,u.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Z.IS_CAR&&'device'===s;await ks(a),qe.push(xs(e));try{const{data:t}=await De().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])ht.set(e.key,e.id),yt.set(e.id,e.key)}catch{}const i=[qt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>de.useOwner.getState().staff.map(It),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Te('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,kt()),toRow:(e,t)=>(0,F.staffRow)(e,t,kt(),e.managerAccess||e.ownerAccess?null:ht.get(wt(e))),fromRow:e=>{if(!e.external_ref)return null;_t.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ns.set(String(e.external_ref),e.avatar_path??null);const t=bt(vt(yt.get(String(e.role_id))),!0===e.manager_access);return(0,F.staffSyncItem)({id:String(e.external_ref),name:e.display_name,job:e.job_title??'',active:!1!==e.active,dept:e.department??'',nickname:e.nickname??null,displayClock:!!e.display_clock,temp:!!e.temp,tempUntil:e.temp_until??null,...t,ownerAccess:!0===e.owner_access,bookingWrite:'boolean'==typeof e.can_change_bookings?e.can_change_bookings:void 0},kt())},apply:e=>de.useOwner.setState(t=>{const a=new Map(e.map(e=>[e.id,e])),s=t.staff.map(e=>a.has(e.id)?{...e,...a.get(e.id)}:e),n=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!n.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ms()},onRemote:()=>{Ms()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=de.useOwner.getState(),t=ie.useSetup.getState().sites[$a]?.staffGrade??{};return e.staff.filter(e=>_t.has(e.id)).map(a=>We({id:a.id,hourly:e.hourly[a.id]??null,salaried:!!a.salaried,noTax:!!a.noTax,grade:t[a.id]||void 0}))},key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>_t.has(e.id),writable:()=>Te('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:_t.get(e.id),venue_id:t,hourly_rate:null==e.hourly?null:e.hourly/100,salaried:e.salaried,no_tax:e.noTax,pay_grade:e.grade??null}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?We({id:t,hourly:null==e.hourly_rate?null:Math.round(100*Number(e.hourly_rate)),salaried:!!e.salaried,noTax:!!e.no_tax,grade:e.pay_grade||void 0}):null},apply:e=>de.useOwner.setState(t=>{const a={...t.hourly},s=new Map(e.map(e=>[e.id,e]));for(const t of e)null==t.hourly?delete a[t.id]:a[t.id]=t.hourly;if(e.length){const t=ie.useSetup.getState().sites[$a],a={...t?.staffGrade??{}};let s=!1;for(const t of e)(a[t.id]||void 0)!==t.grade&&(s=!0,t.grade?a[t.id]=t.grade:delete a[t.id]);s&&ie.useSetup.getState().patch($a,{staffGrade:a})}return{hourly:a,staff:t.staff.map(e=>s.has(e.id)?{...e,salaried:s.get(e.id).salaried,noTax:s.get(e.id).noTax}:e)}}),subscribe:e=>{const t=de.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=ie.useSetup.subscribe((t,a)=>{t.sites[$a]?.staffGrade!==a.sites[$a]?.staffGrade&&e()});return()=>{t(),a()}}},He(a,!1),He(a,!0),Ve(a),ze(a),Qe(a),Ze(a),st(a),nt(a),pt(a),{name:'supplier_directory',table:'suppliers',list:()=>de.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,ue.isUuid)(e.id),writable:()=>Te('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,name:e.name||'Supplier',category:e.category,contact:e.contact||null,phones:e.phones.filter(Boolean),email:e.email||null,website:e.website||null,account_ref:e.account||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,doc:{kind:'directory',localId:e.id,supplier:We(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{suppliers:[...i,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>de.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.supplierId),writable:()=>Te('suppliers.order')||Te('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Be(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:We(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},rt(a),Us(a)];Te('wages.view')&&i.push(Es(a)),n&&(i.push(Ut(!0),Et(),Tt(),Pt(a)),Kt(e)),n&&await ma('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>de.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,ue.isUuid)(e.id)&&/^\d{4}-\d{2}-\d{2}$/.test(e.from)&&/^\d{4}-\d{2}-\d{2}$/.test(e.to)&&e.to>=e.from&&(e.staffId===Ue.getState().staffRef&&'pending'===e.status||Te('rota.manage')),writable:()=>'staff'===Ue.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffId,from_date:e.from,to_date:e.to,reason:(e.reason??'').slice(0,200)||null,status:e.status,doc:We(e)}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),from:String(e.from_date).slice(0,10),to:String(e.to_date).slice(0,10),reason:e.reason??t.reason??'Holiday',status:e.status,by:e.requested_by_name??t.by,decidedBy:e.decided_by_name??void 0}},apply:(e,t)=>de.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),i=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),r=new Set(i.map(e=>e.id));return{leave:[...e.filter(e=>!r.has(e.id)),...i]}}),subscribe:e=>de.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ha.add('staff_leave'),Nt(e));const o=n&&await va();if(we.useChatSync.setState({synced:o,checked:!0}),qe.push(()=>we.useChatSync.setState({synced:!1})),o&&i.push(Ht(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(ve.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>_t.has(e.id),writable:()=>Te('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:_t.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:_t.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>ve.useKitchenExtra.setState(a=>{const s={...a.extra};return t.forEach(e=>{delete s[e]}),e.forEach(e=>{s[e.id]=e.include}),{extra:s}}),subscribe:e=>ve.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ma('hr_questions')&&(i.push(Ia(a)),Ha.add('hr_questions'),Ra(e,a)),'guest'!==s&&'customer'!==Ke&&await ma('temp_readings')&&(i.push((0,Q.tempUnitsSpec)(oe.useSafety,tt),(0,Q.tempReadingsSpec)(oe.useSafety,at)),Ha.add('temp_units'),Ha.add('temp_readings')),'guest'!==s&&'customer'!==Ke&&await ma('cooksafe_records')&&(i.push((0,V.cooksafeSpec)(oe.useSafety,G.useCookSafe,oe.isSeedAccident,at)),Ha.add('cooksafe_records')),'guest'!==s&&await ma('sold_out_items')?(i.push(pa(a,await ma('sold_out_items','auto'))),Ha.add('sold_out_items')):Ie.autoSync.soldOutRead.add(a),'guest'!==s&&await ma('sold_out_links')?(i.push(ga(a)),Ha.add('sold_out_links')):Ie.autoSync.linksRead.add(a),U.useReminders.getState().ensure(a),'guest'!==s&&await wa()&&(i.push(Gt(a)),n&&i.push(Jt(a))),ce.useNotifs.getState().ensure(a),fe.useOrderLists.getState().ensure(a),n){gt=await ma('staff','nickname'),mt=await ma('staff','display_clock');const[e,t,s,n]=await Promise.all([ma('scheduled_notifications'),ma('order_lists'),ma('venue_clock_area'),ma('daily_tasks')]);he.useDailyTasks.getState().ensure(a),n&&(i.push(la(a),fa(a)),Ha.add('daily_tasks'),Ha.add('daily_task_ticks')),e&&(i.push(ra(a)),_a()),t&&i.push(oa(a),da(a),ua(a)),s&&i.push(ca(a));for(const[a,n]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&Ha.add(n)}if('guest'!==s&&await ma('day_tips')){i.push(sa(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ha.add(e);await ma('tips_pot_events')&&i.push(na(a),ia(a)),n&&(Xt()||(0,le.forgetPastTakings)(a,(0,k.tradingDay)()),i.push(ea(a),aa(a)),Ha.add('cash_ups'),Xt()&&(i.push(ta(a)),Ha.add('sales_reports')),t(r[76])(r[75],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Ut(),Et()),await ma('scheduled_notifications')&&i.push(ra(a)));let d=!1;const c=()=>{if(Z.IS_CAR&&n&&Te('recipes.edit'))return!0;const e=de.useOwner.getState().staff.find(e=>e.id===Ue.getState().staffRef);return!!e&&e.active&&Te('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&c()&&await ma('ingredient_prices')&&(i.push((0,S.gpSyncSpec)('ing',c)),Ha.add('ingredient_prices'),await ma('card_costs')&&(i.push((0,S.gpSyncSpec)('card',c)),Ha.add('card_costs')),await ma('kitchen_deliveries')&&(i.push((0,S.gpSyncSpec)('del',c)),Ha.add('kitchen_deliveries')),await ma('kitchen_stock_counts')&&(i.push((0,S.gpSyncSpec)('count',c)),Ha.add('kitchen_stock_counts'))),(0,Ce.specialsSyncOn)()&&'guest'!==s&&await ma('specials_boards')&&(i.push((0,Ce.specialsBoardSpec)(a,()=>Te('recipes.edit')||Te('floor.manage')||Te('*'))),Ha.add('specials_boards'));const l={onActivity:()=>Ee({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ee({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ee({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await qa('whoami')??[]).some(t=>t.venue_id===e))return void($a===a&&ja());for(const a of xe){if(a.spec.name!==t)continue;const{count:s,error:n}=await De().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',e);!n&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{d=!1}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ds()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||H.useTempSaves.getState().mark({id:t,table:e,why:Ss(e)??'this screen could not send it'})}};xe=i.map(t=>new J.EntityBridge(t,e,l)),await Promise.all(xe.map(e=>e.start()));let f=0;const p=async()=>{if(!(f&&Date.now()-f<6e4)){f=Date.now();try{await g()}finally{f=0}}},g=async()=>{if(n&&(0,P.isOnline)())try{const t=await qa('whoami');if(!t?.some(t=>t.venue_id===e))return void($a===a&&ja())}catch(e){if(Ea(e)){if(Z.IS_CAR)return void($a===a&&ja());const e=await Ua();return void('ok'!==e&&'refused'!==e||$a===a&&ja())}}let t=0;for(const[a,s]of xe.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(we.useChatSync.getState().error&&we.useChatSync.setState({error:void 0}),await Vt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&we.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,P.setOnline)(!0),Ee({mode:'live',lastSyncAt:e,lastServerAt:e}),$.mutationQueue.flush()}else Ee({mode:'offline'});if(!Te('wages.view')){const e=Ue.getState().staffRef;de.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([p(),new Promise(e=>setTimeout(e,3e4))]);const m=new Map;for(const e of xe)m.set(e.spec.table,[...m.get(e.spec.table)??[],e]);const _=[...m.keys()].filter(e=>Ha.has(e)).map(e=>({table:e,venueColumn:m.get(e)[0].spec.venueColumn}));let y=!1;const w=(0,J.venueChannel)(e,_,(e,t,a)=>{for(const s of m.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ee({lastSyncAt:s,lastServerAt:s})},e=>{Ee({realtime:e}),'SUBSCRIBED'===e?(y&&p(),y=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(y=!0)});qe.push(()=>{De().removeChannel(w)}),qe.push((0,P.onConnectivity)(e=>{e&&p()}));const v=xe.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),b=(0,M.superviseSync)({fastMs:Ga(Ke),readFast:async()=>{for(const e of v)await e.read()},readAll:p,flush:()=>{$.mutationQueue.flush()},wake:()=>{$.mutationQueue.retryNow()},restart:()=>{$a===a&&ja()},realtime:()=>Ue.getState().realtime,lastServerAt:()=>{const e=Ue.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,P.setOnline)(!0),Ee({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Ea,refreshAuth:async()=>{await De().auth.refreshSession()},heartbeat:()=>Va(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});qe.push(b.stop)}async function Va(e){const t=Ue.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await qa('sync_heartbeat',{p_venue:e,p_device:(0,C.deviceId)()??'unknown',p_app:Ke,p_version:q.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const Ga=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ue.getState(),queue:$.mutationQueue.pending.map(e=>e.table),failedTables:$.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),me.PITCH&&(window.__ccSyncPreview=e=>Ee(e)));const Ja='guest:sent:v1';async function za(e){Ee({kind:'guest',venueSlug:e,perms:[]});try{const t=(await qa('public_venue',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!u.IS_ISOLATED_VENUE||t.id===u.VENUE_UUID)){Ee({venueId:t.id,venueName:t.name}),await ks(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,p.withWildingsAddress)({...a,id:e}):t)})),xt(e,t.app?.events)}await Za(e),Ee({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ee({mode:(0,P.isOnline)()?'local':'offline'})}const t=setInterval(()=>{Za(e).catch(()=>{})},6e4);qe.push(()=>clearInterval(t)),u.IS_ISOLATED_VENUE||await Ya(e)}async function Za(e){const t=await qa('public_menu',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ae.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.useStore.setState(e=>{const t=new Map(a.map(e=>[e.id,e])),s=e.menu.map(e=>t.get(e.id)??e),n=new Set(s.map(e=>e.id));return{menu:[...s,...a.filter(e=>!n.has(e.id))]}});try{const t=await qa('public_takeaway_menu',{p_venue_slug:(0,f.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function Ya(e){let t=await L.kv.get(Ja,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,ue.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,ue.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await xa())return;for(const a of n)try{const s=(await qa('guest_create_booking',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_booking:{...We(a),...(0,R.takeGuard)(a.id),allergies:$e(a.allergies)}}))?.[0];t={...t,[a.id]:'booking'};const n={};s?.status&&s.status!==a.status&&(n.status=s.status),'string'==typeof s?.ref&&s.ref&&s.ref!==a.ref&&(n.ref=s.ref),Object.keys(n).length&&z.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===a.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(t={...t,[a.id]:'failed'},Ee({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await qa('guest_create_takeaway',{p_venue_slug:(0,f.queuedDatabaseSlug)(e),p_order:{...We(a),...(0,R.takeGuard)(a.id),allergies:$e(a.allergies)}}))?.[0];t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?es(e,s):e)}))}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ee({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ts(s)}}:e)})))}await L.kv.set(Ja,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await qa('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ja,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await qa('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.useStore.setState(e=>({bookings:e.bookings.map(e=>{const a=t.get(e.id);return a&&a.status&&a.status!==e.status&&'declined'!==a.status?{...e,status:a.status}:'declined'===a?.status&&'cancelled'!==e.status?{...e,status:'cancelled'}:e}),orders:e.orders.map(e=>{const a=t.get(e.id);if(!a)return e;const s=es(e,a);return Xa(s)===Xa(e)?e:s})})),Ee({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ee({mode:(0,P.isOnline)()?Ue.getState().mode:'offline'})}finally{a=!1}}};qe.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),La=setInterval(()=>{n()},15e3),as=()=>{n()},n()}const Xa=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function es(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ts=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let as=null;const ss={bridges:()=>xe,restart:ja};function ns(){const e=Ue.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Te('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function is(){const e=xe.find(e=>'stock_events'===e.spec.table);if(!e||ns())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&($.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function rs(){const e=xe.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}is();try{await $.mutationQueue.retryNow()}catch{}}Ue.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{rs()},3e3)});const os=['bookings','walk_ins'];function ds(){const e=Ue.getState();return Ne()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Te('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const us=()=>xe.filter(e=>os.includes(e.spec.table)),cs=e=>$.mutationQueue.failed.some(t=>os.includes(t.table)&&t.rowKey===e);function ls(e=!1){return ds()?0:us().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&cs(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function fs(e=!1){const t=ds();if(t)return t;for(const e of us())try{await e.read()}catch{}ls(e);try{await $.mutationQueue.retryNow()}catch{}return e&&ps(),null}function ps(){const e=us()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(us().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||cs(s)||os.some(t=>$.mutationQueue.hasPending(t,e,s))||t.clear(s)}$.mutationQueue.onFailed(e=>{os.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),$.mutationQueue.onDone(e=>{os.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let gs=null;const ms=(e=2500)=>{gs&&clearTimeout(gs),gs=setTimeout(()=>{gs=null,fs(!1)},e)};(0,P.onConnectivity)(e=>{e&&ms()}),Ue.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Te('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&ms(3e3)});const _s=['temp_readings','temp_units'];function Ss(e="temp_readings"){const t=Ue.getState();return Ne()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||tt()?'device'!==t.kind||Te('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const hs=()=>xe.filter(e=>_s.includes(e.spec.table));async function ys(e=!1){const t=Ss();if(t)return t;for(const e of hs())try{await e.read()}catch{}const a=hs()[0]?.venueId??'';for(const t of hs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,$.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await $.mutationQueue.retryNow()}catch{}if(e){const e=H.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=hs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||$.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,H.tempKey)(t.table,t.id))}}return null}$.mutationQueue.onFailed(e=>{_s.includes(e.table)&&H.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,j.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),$.mutationQueue.onDone(e=>{_s.includes(e.table)&&H.useTempSaves.getState().clear((0,H.tempKey)(e.table,e.rowKey))});let ws=null;const vs=(e=3e3)=>{ws&&clearTimeout(ws),ws=setTimeout(()=>{ws=null,ys(!1)},e)};(0,P.onConnectivity)(e=>{e&&vs()}),Ue.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Te('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&vs(3500)});const bs='golive:v1:';async function ks(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Cs(e):(await L.kv.get(bs+e,!1)||await Cs(e),await L.kv.get(Os+e,!1)||(As(e),await L.kv.set(Os+e,!0)),await L.kv.get(Is+e,!1)||(Rs(),await L.kv.set(Is+e,!0)))}const Is='golive:v3:';function Rs(){const e=e=>JSON.stringify(e).includes('(example)');try{re.useKitchen.setState(t=>({waste:t.waste.filter(t=>!e(t)),stockTakes:t.stockTakes.filter(t=>!e(t)),deliveries:t.deliveries.filter(e=>'dl-today-fish'!==e.id&&'dl-today-veg'!==e.id)}))}catch{}}const Os='golive:v2:';function As(e){const t=e=>JSON.stringify(e).includes('(example)');z.useStore.setState(t=>({customer:{...t.customer,name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}},stampCards:t.stampCards.filter(t=>t.restaurantId!==e),giftCards:t.giftCards.filter(t=>t.restaurantId!==e),ratings:t.ratings.filter(t=>t.restaurantId!==e),events:t.events.filter(t=>!(t.example&&(t.restaurantId===e||null===t.restaurantId)))})),de.useOwner.setState(e=>({referrals:[],coats:[],merchOrders:[],lost:[],customerTags:{},offers:e.offers.filter(e=>!t(e)),changeRequests:e.changeRequests.filter(e=>!t(e)),campaigns:e.campaigns.filter(e=>!t(e)),supplierOrders:e.supplierOrders.filter(e=>!t(e)),chat:e.chat.filter(e=>e.id.startsWith('m-seed-')).map((e,t)=>({...e,at:new Date(Date.now()-6e4*(5-t)).toISOString()}))}))}async function Cs(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,re.stripKitchenExamples)(re.useKitchen.getState()),s=de.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:oe.useSafety.getState().accidents.filter(e=>!(0,oe.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(re.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',re.useKitchen.getState()),re.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),de.useOwner.setState(n)),r(oe.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',oe.useSafety.getState()),oe.useSafety.setState(i));const o=(0,D.stripHrSamples)(D.useHr.getState());r(D.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',D.useHr.getState()),D.useHr.setState(o));const d=(0,S.stripGpSamples)(S.useGpCalc.getState());r(S.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',S.useGpCalc.getState()),S.useGpCalc.setState(d));const u=se.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),se.useOrderSheets.setState(c));const l=ae.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ae.useCardStore.setState(f)),void await L.kv.set(bs+e,!0)}const t=t=>t.restaurantId===e&&!(0,ue.isUuid)(t.id);z.useStore.setState(a=>({bookings:a.bookings.filter(e=>!t(e)),orders:a.orders.filter(e=>!t(e)),waitlist:a.waitlist.filter(t=>t.restaurantId!==e),walkIns:Object.fromEntries(Object.entries(a.walkIns).filter(([t])=>!t.includes(e)))})),X.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,ue.isUuid)(t.id))})),ee.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),de.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,ue.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,ue.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,ue.isUuid)(e.id)),leave:e.leave.filter(e=>(0,ue.isUuid)(e.id)),swaps:[]}));try{re.useKitchen.setState(e=>(0,re.stripKitchenExamples)(e))}catch{}de.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,ue.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,ue.isUuid)(e.id)&&(0,ue.isUuid)(e.supplierId))}));try{oe.useSafety.setState(e=>({accidents:e.accidents.filter(e=>{return!String(e.id).startsWith('acc-ex')&&(t=e,!JSON.stringify(t).includes('(example)'));var t})}))}catch{}await L.kv.set(bs+e,!0)}const Ds=(e,t)=>We({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Us(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ee.useFloor.getState().live[e]??{}).map(([e,t])=>Ds(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ue.getState().kind||Te('device.write'),deletes:!1,matchKey:e=>({table_name:e}),toRow:(e,t)=>({venue_id:t,table_name:e.name,stage:e.stage??null,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note?e.note.slice(0,200):null,updated_by:(0,Y.actorStamp)({isCar:Z.IS_CAR,kind:Ue.getState().kind,staffRef:Ue.getState().staffRef,fallback:Ke})}),fromRow:e=>Ds(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ee.useFloor.setState(s=>{const n={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;n[t]=a}for(const e of a)delete n[e];return{live:{...s.live,[e]:n}}}),subscribe:e=>ee.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Es(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(ie.useSetup.getState().sites[e]?.grades??ie.DEFAULT_GRADES).map((e,t)=>({id:e.id,name:e.name,pence:e.pence,sort:t})),key:e=>e.id,rowKey:e=>String(e.grade_id),syncable:e=>!!e.id&&!!e.name,writable:()=>Te('wages.manage'),matchKey:e=>({grade_id:e}),toRow:(e,t)=>({venue_id:t,grade_id:e.id,name:e.name.slice(0,60),pence:Math.max(0,Math.min(1e5,Math.round(e.pence))),sort:e.sort}),fromRow:e=>({id:String(e.grade_id),name:String(e.name),pence:Number(e.pence),sort:Number(e.sort??0)}),apply:(t,a)=>{if(!t.length&&!a.length)return;const s=ie.useSetup.getState().sites[e]?.grades??[],n=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)n.set(e.id,e);for(const e of a)n.delete(e);const i=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));ie.useSetup.getState().patch(e,{grades:i})},subscribe:t=>ie.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ts='staff-avatars',Ns=new Map;let Ks=!1;const Ps=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ms(){if(!Ks){Ks=!0;try{for(const[e,t]of Ns){const a=ne.useAvatars.getState().photos[e];if(!t){a?.path&&ne.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ue.getState().staffRef)continue;const{data:s,error:n}=await De().storage.from(Ts).download(t);if(n||!s)continue;const i=await Ps(s);i.startsWith('data:image/')&&ne.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ks=!1}}}function xs(e){const t=async()=>{const t=Ue.getState().staffRef,a=t?_t.get(t)??Ue.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ue.getState().kind)return;const s=ne.useAvatars.getState().photos[t];try{const n=Ns.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&De().storage.from(Ts).remove([t]).catch(()=>{})};if(!s){const e=!!ne.useAvatars.getState().clears?.[t];return e&&n&&(await qa('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ns.set(t,null),i(n)),void(e&&ne.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ee({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===r.type?'jpg':'image/webp'===r.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await De().storage.from(Ts).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await qa('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ns.set(t,d),n!==d&&i(n),ne.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ee({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ne.useAvatars.getState().photos},s=ne.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Te('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ue.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ns.set(t,null),ne.useAvatars.getState().doneClear(t),qa('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>De().storage.from(Ts).remove([e])).catch(()=>{})}});return t(),s}const qs=new Map,Ls=(0,T.create)(()=>({n:0}))},824,{"0":836,"1":1269,"2":5,"3":1270,"4":1171,"5":6,"6":1194,"7":842,"8":1195,"9":1198,"10":1167,"11":808,"12":864,"13":1084,"14":869,"15":1047,"16":1049,"17":980,"18":816,"19":1274,"20":13,"21":866,"22":1276,"23":998,"24":1183,"25":995,"26":872,"27":1170,"28":1279,"29":1169,"30":1044,"31":1043,"32":1268,"33":1281,"34":1280,"35":1284,"36":1074,"37":1285,"38":1286,"39":1287,"40":1288,"41":1290,"42":1166,"43":881,"44":807,"45":977,"46":828,"47":829,"48":1086,"49":1168,"50":1087,"51":1225,"52":1096,"53":1291,"54":1180,"55":863,"56":1099,"57":997,"58":1048,"59":1057,"60":1293,"61":1294,"62":2,"63":1295,"64":1181,"65":1182,"66":1296,"67":1192,"68":946,"69":942,"70":982,"71":1218,"72":1179,"73":1069,"74":877,"75":1075,"76":29,"paths":{}}); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"colours",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"font",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return A}}),e.brandColour=function(I,S=F.gold){const r=/^#([0-9a-f]{6})$/i.exec(I??'');if(!r)return S;const _=parseInt(r[1],16),t=(_>>16)/255,E=(_>>8&255)/255,n=(255&_)/255,o=Math.max(t,E,n),A=Math.min(t,E,n),l=o-A;if(l<.12)return I;const D=o===t?((E-n)/l+6)%6*60:o===E?60*((n-t)/l+2):60*((t-E)/l+4);return D>65&&D<320?S:I};var I=_r(_d[0]),S=_r(_d[1]),r=_r(_d[2]),_=_r(_d[3]),t=_r(_d[4]),E=_r(_d[5]);const F={bg:I.IS_SOUTERS?'#56152A':I.IS_WILDINGS?'#272A2F':'#0B0B0B',surface:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#141414',surface2:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#363A42':'#1D1C1A',border:I.IS_SOUTERS?'#87435B':I.IS_WILDINGS?'#50545C':'#34302A',gold:I.IS_WILDINGS?'#FFE3A5':I.IS_KIRKMICHAEL?'#B87754':I.IS_SOUTERS?'#A4622E':'#CFA45F',goldLight:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',goldTint:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',goldMuted:I.IS_WILDINGS?'#DDC694':I.IS_KIRKMICHAEL?'#C2937A':I.IS_SOUTERS?'#C18F67':'#BFA06C',hairline:'rgba(255,255,255,0.09)',tile:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#18171A',tilePressed:I.IS_SOUTERS?'#64223B':I.IS_WILDINGS?'#393D45':'#211F1C',accentBg:I.IS_WILDINGS?'rgba(255,227,165,0.13)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.13)':I.IS_SOUTERS?'rgba(164,98,46,0.13)':'rgba(207,164,95,0.13)',accentBorder:I.IS_WILDINGS?'rgba(255,227,165,0.38)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.38)':I.IS_SOUTERS?'rgba(164,98,46,0.38)':'rgba(207,164,95,0.38)',text:'#F5F1E8',muted:'#B8B0A0',onGold:I.IS_WILDINGS?'#272A2F':I.IS_KIRKMICHAEL?'#0B0B0B':I.IS_SOUTERS?'#FFFFFF':'#0B0B0B',red:'#FF6B5E',redBg:'#4A1310',redSolid:'#C62F22',amber:'#FFB547',amberBg:'#3F2C05',shellfishFree:'#6EC470',ok:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',okBg:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',blue:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',blueBg:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#39352C':'#1E1A12',...I.IS_GREENSIDE?r.GREENSIDE_PALETTE:{},...I.IS_QUEUED_VENUE?S.QUEUED_PALETTE:{},...I.IS_KIRKTON?t.KIRKTON_PALETTE:{},...I.IS_ABBOTSFORD?_.ABBOTSFORD_PALETTE:{}},n={regular:'Poppins_400Regular',medium:'Poppins_500Medium',semibold:'Poppins_600SemiBold',bold:'Poppins_700Bold'},o={small:E.type.small,body:E.type.body,large:E.type.large,title:E.type.title,hero:E.type.hero},A={s:E.radii.s,m:E.radii.m,l:E.radii.l}},825,[5,1342,1193,1343,1344,1345]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},826,[240]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.templatesFor=function(t){const n={...r.DEFAULT_TEMPLATES};for(const o of Object.keys(r.DEFAULT_TEMPLATES))n[o]={...r.DEFAULT_TEMPLATES[o],...t?.[o]??{}};return n},e.composeBooking=function(t,n,o,c,u){if(n.walkIn)return[];return s(t,'booking-confirmation'===t?'booking':'booking-request'===t?'request':'declined',(0,r.bookingVars)(n,o),{phone:n.phone,email:n.email,name:n.name},{refType:'booking',refId:n.id,ref:n.ref},o,c,u)},e.composeOrder=function(t,n,o,c){return'takeaway'!==t.type?[]:s('order-confirmation','order',(0,r.orderVars)(t,n),{phone:t.phone,email:t.email,name:t.customerName},{refType:'order',refId:t.id,ref:t.ref},n,o,c)},e.deliverQueued=async function(r,n){if(!(0,t.isLive)())return;const o=(0,t.activeProvider)();for(const t of r){const r=await o.deliver(t);n(t.id,r.ok?{status:'sent'}:{status:'failed',error:r.error})}},e.statusLabel=function(t){const r='sms'===t.channel?'Text':'Email';return'preview'===t.status?`${r}: Ready (preview mode)`:'queued'===t.status?`${r}: Sending\u2026`:'sent'===t.status?`${r} sent`:`${r}: Not sent (failed)`},Object.defineProperty(e,"PREVIEW_BANNER",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);Object.keys(t).forEach(function(r){'default'===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})});var r=_r(d[1]);Object.keys(r).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var n=_r(d[2]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=()=>`msg-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-4)}`;function s(s,c,u,l,f,m,p,b){const y=[],v=(0,t.isLive)()?'queued':'preview',h=(0,t.activeProvider)().id,E=(0,n.guestPhone)(l.phone);if(E.ok&&y.push({id:o(),restaurantId:m.id,at:b,channel:'sms',kind:s,to:E.pretty,toName:l.name,body:(0,r.toGsm)((0,r.fill)(p[c].sms,u.sms)),...f,status:v,provider:h}),l.email?.trim()){const t=(0,r.fillEmailText)(p[c].body,u.email),n=(0,r.fill)(p[c].subject,u.email);y.push({id:o(),restaurantId:m.id,at:b,channel:'email',kind:s,to:l.email.trim(),toName:l.name,subject:n,body:t,html:(0,r.emailHtml)(t,{venue:m.name,preheader:n}),...f,status:v,provider:h})}return y}const c='Preview mode, not sent yet. Connect a text and email service to go live.'},827,[1214,1215,1216]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCK_REASONS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return m}}),_e.blockClock=function(e){if('string'==typeof e){const t=/(\d{1,2}):(\d{2})/.exec(e);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}return e instanceof Date&&!Number.isNaN(e.getTime())?`${String(e.getHours()).padStart(2,'0')}:${String(e.getMinutes()).padStart(2,'0')}`:void 0},Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return k}}),_e.blockedTablesAt=v,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return M}}),_e.closedAreasAt=function(e,t,o,n){const a=(0,u.toMins)(n),s=p(e,t,o).filter(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).map(e=>e.areaId);return new Set([...s,...[...v(e,t,o,n)].map(M)])},_e.blockAt=S,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,u.toMins)(e.to)>(0,u.toMins)(n))).sort((e,t)=>e.date===t.date?(0,u.toMins)(e.from)-(0,u.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o={...t,id:(0,a.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,a.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)}))},remove:(t,o)=>{if(!(0,f.currentCanChangeBookings)())throw new Error(l.BOOKING_VIEW_ONLY);e(e=>{const n=e.blocks.find(e=>e.id===t);return n?{blocks:e.blocks.filter(e=>e.id!==t),removed:[...e.removed,{...n,removedAt:(new Date).toISOString(),removedBy:o??n.by}]}:e})},put:t=>e(e=>{const o=e.blocks.filter(e=>e.id!==t.id),n=e.removed.filter(e=>e.id!==t.id);return t.removedAt?{blocks:o,removed:[...n,t]}:{blocks:[...o,t],removed:n}})}),{name:'covercharge-blocks-v1',storage:(0,c.createJSONStorage)(()=>n.default),version:2,migrate:e=>{const t=e??{};return{blocks:t.blocks??[],removed:t.removed??[]}}}));const k=e=>!e.areaId&&!e.tables?.length;function v(e,t,o,n){const a=(0,u.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to)).flatMap(e=>e.tables))}const O=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&k(e)).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),p=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,u.toMins)(e.from)-(0,u.toMins)(t.from)),M=e=>`tbl:${e}`;function S(e,t,o,n){const a=(0,u.toMins)(n);return O(e,t,o).find(e=>a>=(0,u.toMins)(e.from)&&a<(0,u.toMins)(e.to))}const $=(e,t,o,n)=>S(e,t,o,n),h=e=>e.privateFunction?`${e.privateFunction.title} \xb7 ${e.privateFunction.covers} Covers \xb7 ${e.areaName??'Whole venue'} \xb7 until ${e.to}`:e.tables?.length?`${e.tables.map(t.tableNumbers).join(', ')} blocked until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:e.areaId?`${e.areaName??'Area'} closed until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:`Bookings paused until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`,y=(e,t)=>{const o=m(e=>e.blocks);return O(o,e,t)}},828,[812,1190,1099,995,1191,822,992,1175]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SETTINGS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"seedPlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useFloor",{enumerable:!0,get:function(){return p}}),_e.hashOldPins=f,Object.defineProperty(_e,"usePlan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useDisplaySettings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"planOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j}}),_e.tablesLabel=v,_e.tableCardLabel=function(e){return(0,t.withTableWord)(v(e))},Object.defineProperty(_e,"joinTables",{enumerable:!0,get:function(){return S}});var e,n=r(d[0]),t=r(d[1]),a=r(d[2]),s=(e=a)&&e.__esModule?e:{default:e},i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});const u={privacy:!0,idleMins:2,pinOn:!1,...i.DEFAULT_WAKE,tonightCards:!0},b=e=>'souters'===e||n.IS_ISOLATED_VENUE&&'souters'===n.VENUE_RID?{areas:[{id:'su-restaurant',name:'Restaurant'},{id:'su-bar',name:'Bar'},{id:'su-mezzanine',name:'Mezzanine / private dining'},{id:'su-garden',name:'Beer garden',outdoor:!0},{id:'su-icecream',name:'Ice cream & cake corner'}],tables:[],joins:[],sections:[],fixtures:[]}:'kirkmichael'===e||n.IS_ISOLATED_VENUE&&'kirkmichael'===n.VENUE_RID?{areas:[{id:'km-restaurant',name:'Restaurant'},{id:'km-bar',name:'Bar'},{id:'km-private',name:'Private dining',label:'The Room (about 18 covers) \u2014 table plan to confirm'}],tables:[],joins:[],sections:[],fixtures:[]}:['wildings','greenside'].includes(e)||n.IS_ISOLATED_VENUE?{areas:[],tables:[],joins:[],sections:[],fixtures:[]}:'anchorage'===e?(0,c.anchoragePlan)():(0,c.starterPlan)(),p=(0,l.create)()((0,o.persist)((e,t)=>{const a=e=>t().plans[e]??b(e);return{plans:n.IS_ISOLATED_VENUE?{[n.VENUE_RID]:b(n.VENUE_RID)}:{anchorage:(0,c.anchoragePlan)()},live:{},settings:{},smsLog:[],setPlan:(n,t)=>e(e=>({plans:{...e.plans,[n]:t}})),updateTable:(n,t,s)=>{const i=a(n);e(e=>({plans:{...e.plans,[n]:{...i,tables:i.tables.map(e=>e.id===t?{...e,...s}:e)}}}))},addTable:(n,t)=>{const s=a(n);e(e=>({plans:{...e.plans,[n]:{...s,tables:[...s.tables,t]}}}))},removeTable:(n,t)=>{const s=a(n),i=s.tables.find(e=>e.id===t);e(e=>({plans:{...e.plans,[n]:{...s,tables:s.tables.filter(e=>e.id!==t),joins:s.joins.filter(e=>!i||!e.tables.includes(i.name))}}}))},setLive:(n,t,a)=>e(e=>({live:{...e.live,[n]:{...e.live[n]??{},[t]:{...e.live[n]?.[t]??{},...a}}}})),setSettings:(n,t)=>e(e=>({settings:{...e.settings,[n]:{...u,...e.settings[n]??{},...t}}})),logSms:(n,t,a)=>e(e=>{return{smsLog:[{id:(s='sms',`${s}-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`),rid:n,at:t,text:a},...e.smsLog].slice(0,50)};var s}),resetPlan:n=>e(e=>({plans:{...e.plans,[n]:b(n)}}))}},{name:'covercharge-floor-v1',version:6,storage:(0,o.createJSONStorage)(()=>s.default),migrate:(e,n)=>{const t=e??{};let a=t;if(n<2){const e={};for(const[n,a]of Object.entries(t.plans??{}))e[n]='anchorage'===n?(0,c.anchoragePlan)():(0,c.normalisePlan)(a);e.anchorage=(0,c.anchoragePlan)(),a={...t,plans:e,live:{}}}else if(n<3)a={...t,plans:{...t.plans??{},anchorage:(0,c.anchoragePlan)()}};else if(n<4){const e=t.plans?.anchorage;e&&(a={...t,plans:{...t.plans,anchorage:{...e,joins:(e.joins??[]).filter(e=>!(2===e.tables.length&&e.tables.includes('1')&&e.tables.includes('2')))}}})}return n<5&&(a={...a,settings:f(a.settings)}),n<6&&a.plans?.anchorage&&(a={...a,plans:{...a.plans,anchorage:(0,c.withSeedBest)('anchorage',a.plans.anchorage)}}),a}}));function f(e){const n={};for(const[t,a]of Object.entries(e??{})){const{pin:e,...s}=a??{};n[t]={...u,...s,...'pinHash'in s?{}:(0,i.fromOldPin)(e)}}return n}const h=e=>p(n=>n.plans[e])??E(e),N={};function E(e){return N[e]??=b(e)}const O=e=>{const n=p(n=>n.settings[e]);return n?{...u,...n}:u},P=e=>p.getState().plans[e]??E(e),j=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[];function v(e){const n=j((0,t.tableNumbers)(e));if(!n.length)return'';if(1===n.length)return n[0];const a=n.map(e=>/^\d+$/.test(e)?Number(e):NaN),s=a.every(e=>!Number.isNaN(e))?[...n].sort((e,n)=>Number(e)-Number(n)):n;return a.every(e=>!Number.isNaN(e))&&s.length>=3&&s.every((e,n)=>0===n||Number(e)===Number(s[n-1])+1)?`${s[0]}\u2013${s[s.length-1]}`:s.join(' + ')}const S=e=>[...new Set(e)].sort((e,n)=>/^\d+$/.test(e)&&/^\d+$/.test(n)?Number(e)-Number(n):e.localeCompare(n)).join('+')},829,[5,812,1190,986,995,1191,1069]); +__d(function(_g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STATUS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"STAGE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"turnFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"startOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"durOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"endOf",{enumerable:!0,get:function(){return f}}),e.clashes=function(a,s=90){const n=new Set,l=a.filter(t=>g(t)&&t.table);for(let a=0;a(0,t.tablesOf)(d.table).includes(a))&&(u(o)t.date===n&&!['cancelled','noshow'].includes(t.status)).sort((t,a)=>t.time.localeCompare(a.time));for(const s of a.tables){const a=i.filter(a=>(0,t.tablesOf)(a.table).includes(s.name)),n=a[0],o=(0,t.tablesOf)(n?.table);l[s.name]={table:s,status:n?'soon':'free',next:n,covers:n?.partySize??0,dayBookings:a.length?a:void 0,group:o.length>1?o:void 0,allergy:!(!n?.allergies?.length&&!n?.allergyNote),vip:n?.tags?.find(t=>'VIP'===t)??n?.tags?.find(t=>'Regular'===t),occasion:n?.occasion??h(n?.notes)}}return l},e.floorView=function(a,n,l,i,o,d=90,c){const b={},g=n.filter(t=>t.date===S(o));for(const n of a.tables){const a=i[n.name]??{},y=g.filter(a=>(0,t.tablesOf)(a.table).includes(n.name)),S=y.find(t=>'seated'===(0,s.shownStatus)(t)),v=y.filter(t=>'confirmed'===t.status).sort((t,a)=>t.time.localeCompare(a.time)).find(t=>O(o,t)>=-20),T=v?Math.round(O(o,v)):void 0,w=S?void 0:p(y,o,d),F=l.find(t=>'table'===t.type&&t.tableNo===n.name&&!['closed','cancelled','collected'].includes(t.status));let j='free';a.blocked?j='blocked':S?j=a.stage??'seated':!c?.has(n.areaId)&&!c?.has(`tbl:${n.name}`)||F?a.dirty?j='dirty':F?j=a.stage??'seated':v&&(j='soon'):j='blocked';const A=S,P=A?.tags?.find(t=>'VIP'===t)??A?.tags?.find(t=>'Regular'===t)??(A?void 0:v?.tags?.[0]);b[n.name]={table:n,status:j,booking:A,next:v,due:w,nextIn:T,covers:A?.partySize??0,group:(()=>{const a=(0,t.tablesOf)((A??('soon'===j?v:void 0))?.table);return a.length>1?a:void 0})(),orderOnly:!A&&!!F,note:a.note,seatedMins:A?Math.max(0,Math.round((o.getTime()-u(A).getTime())/6e4)):void 0,freeAt:A?f(A,d):void 0,allergy:!!(A?.allergies?.length||A?.allergyNote||!A&&(v?.allergies?.length||v?.allergyNote)||F?.allergies?.length),vip:P,occasion:A?.occasion??(A?void 0:v?.occasion??h(v?.notes))??h(A?.notes)}}return b},e.dueOnTable=p,Object.defineProperty(e,"OCCASION_ICON",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"tableAllowed",{enumerable:!0,get:function(){return v}}),e.suggestTable=function(s,n,l,i,o,d,c=90,b,p){const h=[...s.tables.map(t=>({name:t.name,seats:t.maxSeats,min:t.minSeats,parts:[t.name]})),...s.joins.map(t=>{const a=s.tables.filter(a=>t.tables.includes(a.name));return{name:t.tables.join('+'),seats:a.reduce((t,a)=>t+a.maxSeats,0),min:a.reduce((t,a)=>t+a.minSeats,0),parts:t.tables}})].filter(t=>t.parts.every(t=>v(s,t,p))),y=o.getTime()+6e4*d,O=new Set((0,a.bestTables)(s));let S=null;for(const a of h){if(a.seats['blocked'].includes(l[t]?.status)))continue;const s=!!l&&a.parts.some(t=>['seated','mains','dessert','bill','dirty'].includes(l[t]?.status)),d=n.filter(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()o.getTime()).length,p=1===a.parts.length&&O.has(a.parts[0])?12:0,h=(s?1e3:0)+100*d+10*(a.seats-i)+(i({name:t.name,seats:t.maxSeats,parts:[t.name]})),...s.joins.map(t=>({name:t.tables.join('+'),seats:s.tables.filter(a=>t.tables.includes(a.name)).reduce((t,a)=>t+a.maxSeats,0),parts:t.tables}))].filter(t=>t.seats>=l&&t.parts.every(t=>v(s,t,c))).filter(a=>!n.some(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()i.getTime())),y=new Set((0,a.bestTables)(s)),O=t=>1===t.parts.length&&y.has(t.parts[0])?0:1;return h.sort((t,a)=>t.seats-a.seats||t.parts.length-a.parts.length||O(t)-O(a)).map(t=>({table:t.name,seats:t.seats,area:s.areas.find(a=>a.id===s.tables.find(a=>a.name===t.parts[0])?.areaId)?.name??''}))},e.seatedPartiesAt=function(a,s,n){return s.filter(s=>s.date===n&&'seated'===s.status&&(0,t.tablesOf)(s.table).includes(a))},Object.defineProperty(e,"unseatStatus",{enumerable:!0,get:function(){return T}});var t=r(_d[0]),a=r(_d[1]),s=r(_d[2]);const n={colour:'#3A2F1E',fg:'#F1DDB0'},l={colour:'#CFA45F',fg:'#0B0B0B'},i={free:{label:'Free',...n},soon:{label:'Booked later',colour:'#9A3050',fg:'#FFF6F0'},seated:{label:'Seated',...l},mains:{label:'Seated',...l},dessert:{label:'Seated',...l},bill:{label:'Seated',...l},dirty:{label:'Needs clearing',colour:'#6E6555',fg:'#FFFFFF'},blocked:{label:'Blocked',...n}},o={seated:'Seated',mains:'Mains',dessert:'Dessert',bill:'Bill requested'},d=['seated','mains','dessert','bill'],c=(t,a=90)=>Math.min(a+60,a+15*Math.max(0,Math.ceil((t-2)/2))),u=t=>'seated'===(0,s.shownStatus)(t)&&t.seatedAt?new Date(t.seatedAt):new Date(`${t.date}T${t.time}:00`),b=(t,a=90)=>t.durationMins??c(t.partySize,a),f=(t,a=90)=>new Date(u(t).getTime()+6e4*b(t,a)),g=t=>!['cancelled','noshow','finished'].includes(t.status);function p(t,a,s=90){return t.filter(t=>'confirmed'===t.status&&O(a,t)<=45&&-O(a,t)t.time.localeCompare(a.time))[0]}const h=t=>t?/birthday/i.test(t)?'birthday':/anniversary/i.test(t)?'anniversary':void 0:void 0,y={birthday:'\ud83c\udf82',anniversary:'\ud83d\udc9d',celebration:'\ud83e\udd42'},O=(t,a)=>(new Date(`${a.date}T${a.time}:00`).getTime()-t.getTime())/6e4,S=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,v=(t,a,s)=>{const n=t.tables.find(t=>t.name===a);if(!n)return!1;const l=t.areas.find(t=>t.id===n.areaId);return!(s?.dog&&!(void 0!==n.dogOk?n.dogOk:l?.dogs))&&(!s?.closed?.has(n.areaId)&&!s?.closed?.has(`tbl:${n.name}`))};const T=t=>t.walkIn?'cancelled':'confirmed'},830,[829,1069,832]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"emptyNeeds",{enumerable:!0,get:function(){return w}}),_e.needsMissing=function(e,l=[]){const s=[];null===e.allergy?s.push('Answer the allergy question first'):'yes'!==e.allergy||e.allergens.length||l.length||e.allergyNote.trim()||s.push('Pick the allergens or describe them');null===e.dog&&s.push('Say whether a dog is coming');return s},_e.needsPatch=function(e,l=[]){const s='yes'===e.allergy?e.allergens.filter(e=>!l.some(l=>l.allergen===e)).map(l=>({allergen:l,severity:e.severity})):[],t=Object.entries(e.holds).filter(([,e])=>e>0).map(([e,l])=>{const s=e.indexOf(':');return{kind:e.startsWith('item:')?'item':'stock',id:s>=0?e.slice(s+1):e,qty:l}}),a=e.dog?Math.max(1,e.dogs):0,n={...e.wheelchair?{wheelchair:e.wheelchair}:{},...e.stepFree?{stepFree:!0}:{},...e.toilet?{toilet:!0}:{},...e.assistDog?{assistDog:!0}:{},...e.accessNote.trim()?{note:e.accessNote.trim()}:{}},r={...e.vegan?{vegan:e.vegan}:{},...e.vegetarian?{vegetarian:e.vegetarian}:{}};return{allergies:[...l,...s],allergyNone:'none'===e.allergy&&!l.length||void 0,allergyPeople:'yes'===e.allergy?e.allergyPeople:void 0,allergyNote:'yes'===e.allergy&&e.allergyNote.trim()?e.allergyNote.trim():void 0,dog:a>0,dogs:a||void 0,access:Object.keys(n).length?n:void 0,diet:Object.keys(r).length?r:void 0,holds:t.length?t:void 0,tableReq:e.tableReq.length?e.tableReq:void 0}},_e.FirstQuestions=function({rid:e,value:l,onChange:a,party:r,audience:i,profile:o=[]}){const y=e=>a({...l,...e}),b=(0,p.usePlan)(e),[x,j]=(0,t.useState)(!1),k=(0,s.dogQuestionOn)((0,u.useRestaurant)(e));(0,t.useEffect)(()=>{k||null!==l.dog||a({...l,dog:!1})},[k,l.dog]);const w=x?m.ALLERGENS:m.ALLERGENS.filter(e=>['gluten','milk','peanuts','treenuts','crustaceans','molluscs','fish','eggs','sesame'].includes(e.id)||l.allergens.includes(e.id)),q=[...o.map(e=>e.allergen),...l.allergens],M=(0,f.dogSetUp)(b);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(R,{tone:"red",testID:"q-allergens",children:[(0,v.jsx)(C,{sub:'guest'===i?'We ask everyone first, so the kitchen can keep you safe.':'Ask every guest first. It goes to the kitchen in red.',children:"\u26a0\ufe0f Does anyone in the party have a food allergy?"}),o.length?(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(e=>(0,v.jsx)(h.Badge,{kind:"red",label:`${m.ALLERGENS.find(l=>l.id===e.allergen)?.short} (from your profile)`},e.allergen))}):null,(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No allergies",selected:'none'===l.allergy,onPress:()=>y({allergy:'none',allergens:[]})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes, allergies",selected:'yes'===l.allergy,onPress:()=>y({allergy:'yes'})})})]}),'none'===l.allergy&&o.length?(0,v.jsx)(h.Muted,{children:"Your profile allergies above are still shared with the kitchen."}):null,'yes'===l.allergy?(0,v.jsxs)(n.default,{style:{gap:10},testID:"allergen-picker",children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"Which allergens? (the 14 UK allergens)"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[w.map(e=>(0,v.jsx)(h.Chip,{label:e.short,selected:l.allergens.includes(e.id)||o.some(l=>l.allergen===e.id),disabled:o.some(l=>l.allergen===e.id),onPress:()=>y({allergens:l.allergens.includes(e.id)?l.allergens.filter(l=>l!==e.id):[...l.allergens,e.id]})},e.id)),x?null:(0,v.jsx)(h.Chip,{label:"All 14\u2026",onPress:()=>j(!0)})]}),(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"How serious?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:m.SEVERITIES.map(e=>(0,v.jsx)(h.Chip,{label:e.label,selected:l.severity===e.id,onPress:()=>y({severity:e.id})},e.id))}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many people with allergies?"}),(0,v.jsx)(h.Stepper,{value:Math.min(l.allergyPeople,r),onChange:e=>y({allergyPeople:e}),min:1,max:Math.max(1,r),label:"people with allergies"})]}),(0,v.jsx)(h.Field,{label:"Anything else the kitchen should know? (optional)",value:l.allergyNote,onChangeText:e=>y({allergyNote:e}),placeholder:"e.g. traces of sesame, one child with coeliac disease",testID:"allergy-note"}),q.length?(0,v.jsx)(c.MenuAllergyCheck,{rid:e,allergens:q,audience:i}):null]}):null]}),k?(0,v.jsxs)(R,{tone:"gold",testID:"q-dogs",children:[(0,v.jsx)(C,{sub:M?'Well-behaved dogs are welcome at our dog-friendly tables.':'staff'===i?'Dog-friendly tables aren\u2019t marked yet (Managers \u203a Booking options), so any table is offered for now.':void 0,children:"\ud83d\udc15 Are you bringing a dog?"}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No",selected:!1===l.dog,onPress:()=>y({dog:!1})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes",selected:!0===l.dog,onPress:()=>y({dog:!0,dogs:Math.max(1,l.dogs)})})})]}),l.dog?(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many dogs?"}),(0,v.jsx)(h.Stepper,{value:l.dogs,onChange:e=>y({dogs:e}),min:1,max:4,label:"dogs"})]}):null]}):null]})},_e.useReserveAvailability=q,_e.MoreQuestions=function({rid:e,r:l,value:a,onChange:r,party:i,date:o,time:c,today:y,bookings:m,audience:b,showTables:x}){const j=e=>r({...a,...e}),w=l.settings,S=(0,u.useMenu)(e),P=(0,t.useMemo)(()=>S.filter(e=>/\((V|VG|Ve)\)|vegan|vegetarian/i.test(`${e.name} ${e.tags?.join(' ')??''}`)).slice(0,4),[S.length]),N=q(e,l,o,y,m,b),T=e=>a.holds[e]??0,D=(0,f.stockNeed)({holds:Object.entries(a.holds).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.indexOf(':')>=0?e.slice(e.indexOf(':')+1):e,qty:l}))},N.items),$=(e,l)=>Math.min(10,...e.map(e=>{const s=(D[e.key]??0)-T(l)*e.qty;return Math.floor(((N.free[e.key]??0)-s)/e.qty)})),I=(e,l,s,t)=>{const r=T(e),i=t<=0&&0===r;return(0,v.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'center',gap:10,opacity:i?.55:1},testID:`reserve-${e.replace(':','-')}`,children:[(0,v.jsxs)(n.default,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(h.T,{weight:"semibold",children:l}),(0,v.jsx)(h.Muted,{children:i?'Unavailable \u2014 none left for this day':s})]}),i?(0,v.jsx)(h.Badge,{kind:"neutral",label:"Unavailable"}):(0,v.jsx)(h.Stepper,{value:r,onChange:l=>j({holds:{...a.holds,[e]:Math.max(0,Math.min(l,Math.max(r,t)))}}),min:0,max:Math.max(r,Math.min(10,t)),label:l})]},e)},O=N.items.length>0||!1!==w.reserveStock&&N.stock.length>0,A=(0,p.usePlan)(e);return(0,v.jsxs)(v.Fragment,{children:[(0,s.accessQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-access",children:[(0,v.jsx)(C,{sub:"Optional. Tell us and we\u2019ll have the right table ready.",children:"\u267f Access needs"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Wheelchair users"}),(0,v.jsx)(h.Stepper,{value:a.wheelchair,onChange:e=>j({wheelchair:e}),min:0,max:Math.max(1,i),label:"wheelchair users"})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"Step-free access",selected:a.stepFree,onPress:()=>j({stepFree:!a.stepFree})}),(0,v.jsx)(h.Chip,{label:"Accessible toilet",selected:a.toilet,onPress:()=>j({toilet:!a.toilet})}),(0,v.jsx)(h.Chip,{label:"Assistance dog",selected:a.assistDog,onPress:()=>j({assistDog:!a.assistDog})})]}),(0,v.jsx)(h.Field,{label:"Anything else? (optional)",value:a.accessNote,onChangeText:e=>j({accessNote:e}),placeholder:"e.g. needs a chair with arms"}),w.accessStatement?.trim()?(0,v.jsx)(h.Muted,{children:w.accessStatement.trim()}):null]}):null,(0,s.dietQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-veg",children:[(0,v.jsx)(C,{sub:"We\u2019d love to look after you. Optional.",children:"\u24cb Any vegans or vegetarians?"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegan"}),(0,v.jsx)(h.Stepper,{value:a.vegan,onChange:e=>j({vegan:e}),min:0,max:Math.max(1,i),label:"vegans"})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegetarian"}),(0,v.jsx)(h.Stepper,{value:a.vegetarian,onChange:e=>j({vegetarian:e}),min:0,max:Math.max(1,i),label:"vegetarians"})]}),!1!==w.vegTeaser&&P.length&&(a.vegan||a.vegetarian)?(0,v.jsxs)(h.Muted,{children:["On the menu: ",P.map(e=>e.name).join(' \xb7 ')]}):null]}):null,O?(0,v.jsxs)(R,{tone:"gold",testID:"q-reserve",children:[(0,v.jsx)(C,{sub:N.known?'Held for you from today\u2019s count.':o>y||'guest'===b?'Held for you; the kitchen confirms and orders in.':void 0,children:"\ud83e\udd9e Reserve with your table"}),N.items.map(e=>I(`item:${e.id}`,`${e.name}${k(e.price)}`,e.description||e.uses.map(e=>`${e.qty} ${N.stock.find(l=>l.key===e.key)?.name.toLowerCase()??e.key}`).join(' + '),$(e.uses,`item:${e.id}`))),!1!==w.reserveStock?N.stock.map(e=>I(`stock:${e.key}`,`Reserve ${e.name.toLowerCase()}`,N.known?`${N.free[e.key]} available today`:'Held for the kitchen to order',$([{key:e.key,qty:1}],`stock:${e.key}`))):null,'staff'===b&&N.known?(0,v.jsxs)(h.Muted,{children:["Today: ",N.stock.map(e=>`${N.free[e.key]} ${e.plural.toLowerCase()} free (${N.reserved[e.key]??0} reserved)`).join(' \xb7 ')]}):null]}):null,x&&!1!==w.tableRequests&&A.tables.length?(0,v.jsx)(M,{rid:e,value:a,onChange:r,party:i,hide:w.tableRequestHide??[]}):null]})},_e.dogTimeOk=function(e,l,s,t,a){if(!a)return!0;const n=e.settings.maxDogsPerSlot;return!n||(0,f.dogsAt)(l,s,t)+a<=n},Object.defineProperty(_e,"accessibleSetUp",{enumerable:!0,get:function(){return f.accessibleSetUp}});var e,l=_r(d[0]),s=_r(d[1]),t=_r(d[2]),a=_r(d[3]),n=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),i=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),p=_r(d[10]),y=_r(d[11]),m=_r(d[12]),b=_r(d[13]),x=_r(d[14]),f=_r(d[15]),j=_r(d[16]),v=_r(d[17]);const k=e=>'display'===x.APP_VARIANT?'':` \xb7 ${(0,b.gbp)(e)}`,w=()=>({allergy:null,allergens:[],severity:'allergy',allergyPeople:1,allergyNote:'',dog:null,dogs:1,wheelchair:0,stepFree:!1,toilet:!1,assistDog:!1,accessNote:'',vegan:0,vegetarian:0,holds:{},tableReq:[]});const R=({children:e,tone:l,testID:s})=>(0,v.jsx)(n.default,{testID:s,style:{gap:10,padding:16,borderRadius:16,borderWidth:'plain'===l?1:1.5,borderColor:'red'===l?j.colours.red:'gold'===l?j.colours.accentBorder:j.colours.hairline,backgroundColor:'red'===l?'#1E1110':j.colours.surface},children:e}),C=({children:e,sub:l})=>(0,v.jsxs)(n.default,{style:{gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:e}),l?(0,v.jsx)(h.Muted,{children:l}):null]});function q(e,l,s,t,a,n,i){const o=(0,f.reservablesOf)(l),c=(0,y.useStockItems)(e),h=(0,y.useShellStore)((0,r.useShallow)(l=>(0,y.venueCounts)(l,e))),u=(0,y.useShellStore)(l=>!!l.server[e]),p=(0,f.reservedOn)(a,s,o,i),m=s===t&&('staff'===n||u),b={};for(const e of c)b[e.key]=m?Math.max(0,Math.floor((h[e.key]??0)-(p[e.key]??0))):1/0;return{items:o,stock:c,free:b,reserved:p,known:m}}function M({rid:e,value:s,onChange:a,party:r,hide:c}){const u=(0,p.usePlan)(e),y=u.areas.filter(e=>u.tables.some(l=>l.areaId===e.id&&!c.includes(l.name))),[m,b]=(0,t.useState)(y[0]?.id??''),x=s.dog?s.dogs:0,k=e=>c.includes(e)?'Not bookable':(0,f.tableBlockReason)(u,e,r,x,s.wheelchair>0||s.stepFree),w=Object.fromEntries(u.tables.map(e=>[e.name,{table:e,status:k(e.name)?'blocked':'free',covers:0,allergy:!1}])),q=e=>{if(k(e))return;const l=s.tableReq.includes(e)?s.tableReq.filter(l=>l!==e):[...s.tableReq,e].slice(-2);a({...s,tableReq:l})},M=u.tables.filter(e=>e.areaId===m&&!c.includes(e.name));return(0,v.jsxs)(R,{tone:"plain",testID:"q-table",children:[(0,v.jsx)(C,{sub:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best.",children:"\ud83e\ude91 Request a table (optional)"}),y.length>1?(0,v.jsx)(i.AreaTabs,{plan:u,area:m,onPick:b}):null,(0,v.jsx)(n.default,{testID:"q-table-plan",style:{height:240,borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:j.colours.hairline},children:(0,v.jsx)(o.FloorCanvas,{plan:u,areaId:m,mode:"live",view:w,privacy:!0,fit:"contain",crop:!0,maxH:260,highlight:s.tableReq,onTap:e=>q(e.name)})}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:M.map(e=>{const t=k(e.name),a=s.tableReq.indexOf(e.name);return(0,v.jsx)(h.Chip,{label:`${(0,l.tableNumbers)(e.name)}`,sub:t||(0===a?'1st choice':1===a?'2nd choice':`${e.maxSeats} seats`),selected:a>=0,disabled:!!t,onPress:()=>q(e.name)},e.name)})}),s.tableReq.length?(0,v.jsxs)(h.T,{size:14,colour:j.colours.goldLight,children:["Requested: ",s.tableReq.map((e,s)=>`${(0,l.tableNumbers)(e)}${s?' (2nd choice)':''}`).join(', ')]}):(0,v.jsx)(h.Muted,{children:"Tap a table; tap another for a second choice."})]})}},831,[812,814,31,128,884,955,954,1426,818,823,829,1086,819,820,807,832,825,25]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ACTIVE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ANCHORAGE_RESERVABLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"reservablesOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"holdId",{enumerable:!0,get:function(){return s}}),e.stockNeed=a,e.reservedBookingsOn=function(t,r,o,i){return t.filter(t=>t.date===r&&n(t)&&'finished'!==t.status).map(t=>({booking:t,qty:a(t,o)[i]??0})).filter(t=>t.qty>0).sort((t,r)=>t.booking.time.localeCompare(r.booking.time))},e.reservedOn=c,e.usedOn=function(t,r,n){const o={};for(const i of t)if(i.date===r)for(const t of i.holds??[])if(t.served)for(const[r,s]of Object.entries(a({...i,holds:[{...t,served:void 0}]},n)))o[r]=(o[r]??0)+s;return o},e.heldSummary=function(t,r,o){const i={},a={};for(const o of t)if(o.date===r&&n(o))for(const t of o.holds??[])if(!t.served){const r=s(t.id);'item'===t.kind?i[r]=(i[r]??0)+t.qty:a[r]=(a[r]??0)+t.qty}return{platters:Object.values(i).reduce((t,r)=>t+r,0),byItem:i,single:a,stock:c(t,r,o)}},e.holdsText=function(t,r,n){return(t.holds??[]).filter(t=>t.qty>0).map(t=>{const o=s(t.id);return`${'item'===t.kind?l(r.find(t=>t.id===o)?.name??'Reserved item'):n.find(t=>t.key===o)?.name??o} x${t.qty}${t.served?' (served)':''}`}).join(', ')},Object.defineProperty(e,"shortItem",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"needsAllergenSeen",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"needsHoldOk",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"hasAllergens",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"allergenText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"dogCount",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"hasAccess",{enumerable:!0,get:function(){return p}}),e.accessText=function(t){const r=t.access;return r?[r.wheelchair?`${r.wheelchair} wheelchair user${1===r.wheelchair?'':'s'}`:'',r.stepFree?'step-free access':'',r.toilet?'accessible toilet':'',r.assistDog?'assistance dog':'',r.note?.trim()??''].filter(Boolean).join(', '):''},Object.defineProperty(e,"dietText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"accessibleSetUp",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"dogSetUp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"isAccessible",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isDogOk",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dogsAt",{enumerable:!0,get:function(){return P}}),e.tableBlockReason=function(t,n,o,i,s){const a=t.tables.find(t=>t.name===n);return a?a.maxSeats0&&k(t)&&!(0,r.tableDogOk)(t,a)?'No dogs here':s&&O(t)&&!a.accessible?'Not step-free':'':'Not available'},Object.defineProperty(e,"holidayName",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"coverDone",{enumerable:!0,get:function(){return w}}),e.shownStatus=$,e.seatedCoversOn=function(t,r){return t.filter(t=>t.date===r&&['seated','finished'].includes($(t))).reduce((t,r)=>t+(r.partySize||0),0)},e.laterTodayCovers=function(t,r){return t.filter(t=>t.date===r&&!t.walkIn&&'walk-in'!==t.source&&['confirmed','pending'].includes($(t))).reduce((t,r)=>t+(r.partySize||0),0)},Object.defineProperty(e,"laterTodayLine",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"isWalkInBooking",{enumerable:!0,get:function(){return q}}),e.partiesLine=function(t){const r=t.filter(n),o=r.filter(t=>!q(t)).length,i=r.length-o;return`${o} ${1===o?'booking':'bookings'} \xb7 ${i} ${1===i?'walk-in':'walk-ins'}`},Object.defineProperty(e,"COVERS_FOUR_LABELS",{enumerable:!0,get:function(){return N}}),e.coversFour=T,e.coversCard=function(t,r,o){const i=t.filter(t=>t.date===r&&n(t)),s=t=>t.reduce((t,r)=>t+(r.partySize||0),0);return{...T(t,r),booked:s(i.filter(t=>!q(t))),walkIns:s(i.filter(q))}},e.coversToday=function(t,r){return T(t,r)};var t=_r(_d[0]),r=_r(_d[1]);const n=t=>!['cancelled','noshow'].includes(t.status),o=[{id:'seafood-platter-2',name:'Seafood Platter for 2',price:16e3,description:'Whole crab and lobster with all the trimmings, for two to share.',uses:[{key:'crab',qty:1},{key:'lobster',qty:1}],active:!0}],i=t=>(t?.settings.reservables??('anchorage'===t?.id?o:[])).filter(t=>t.active),s=t=>t.startsWith(':')?t.slice(1):t;function a(t,r,n=!1){const o={};for(const i of t.holds??[]){if(i.served&&!n)continue;const t=s(i.id);if('stock'===i.kind)o[t]=(o[t]??0)+i.qty;else for(const n of r.find(r=>r.id===t)?.uses??[])o[n.key]=(o[n.key]??0)+n.qty*i.qty}return o}function c(t,r,o,i){const s={};for(const c of t)if(c.date===r&&n(c)&&'finished'!==c.status&&c.id!==i)for(const[t,r]of Object.entries(a(c,o)))s[t]=(s[t]??0)+r;return s}const l=t=>/platter/i.test(t)?'Platter':t.replace(/ for \d+$/i,''),d=t=>n(t)&&(t.allergies.length>0||!!t.allergyNote?.trim())&&!t.allergyAck,u=t=>n(t)&&(t.holds??[]).some(t=>t.qty>0&&!t.served)&&!t.holdOk,f=t=>t.allergies.length>0||!!t.allergyNote?.trim(),b=r=>[r.allergies.map(r=>(0,t.allergenLabel)(r.allergen)).join(', '),r.allergyNote?.trim()].filter(Boolean).join(' \xb7 ')+(r.allergyPeople?` (${r.allergyPeople} ${1===r.allergyPeople?'person':'people'})`:''),y=t=>t.dogs??(t.dog?1:0),p=t=>!(!t.access||!(t.access.wheelchair||t.access.stepFree||t.access.toilet||t.access.assistDog||t.access.note?.trim()));const h=t=>[t.diet?.vegan?`${t.diet.vegan} vegan`:'',t.diet?.vegetarian?`${t.diet.vegetarian} vegetarian`:''].filter(Boolean).join(', '),O=t=>t.tables.some(t=>t.accessible),k=t=>t.tables.some(t=>void 0!==t.dogOk)||t.areas.some(t=>t.dogs),v=(t,r)=>r.split('+').every(r=>!!t.tables.find(t=>t.name===r.trim())?.accessible),j=(t,n)=>n.split('+').every(n=>{const o=t.tables.find(t=>t.name===n.trim());return!!o&&(0,r.tableDogOk)(t,o)}),P=(t,r,o,i)=>t.filter(t=>t.id!==i&&t.date===r&&t.time===o&&n(t)).reduce((t,r)=>t+y(r),0);const S=t=>t.replace(/\s*\(substitute day\)/gi,'').trim(),w=t=>'finished'===t.status;function $(t){if('seated'===t.status&&t.seatedAt){const r=new Date(t.seatedAt);if((isNaN(r.getTime())?t.date:r.toLocaleDateString('en-CA',{timeZone:'Europe/London'}))t>0?`${t} more ${1===t?'cover':'covers'} booked for later today.`:'No more bookings for later today.',q=t=>!!t.walkIn||'walk-in'===t.source;const N=['Done','Seated','To come','Total'];function T(t,r){const o=t.filter(t=>t.date===r&&n(t)),i=t=>t.reduce((t,r)=>t+(r.partySize||0),0),s=i(o.filter(w)),a=i(o.filter(t=>!w(t)&&'seated'===$(t))),c=i(o.filter(t=>!q(t)&&['confirmed','pending'].includes($(t))));return{done:s,seated:a,toCome:c,total:s+a+c}}},832,[819,1069]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SEASONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hourSetsOf",{enumerable:!0,get:function(){return n}}),e.seasonOn=s,e.kitchenHoursOn=l,e.hoursFor=function(r,n){const u=l(r,n);return u?{open:(0,t.atTime)(n,u[0]),close:(0,t.atTime)(n,u[1])}:null};var t=_r(_d[0]);const r=[{id:'winter',name:'Winter',hours:{0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']}},{id:'summer',name:'Summer',hours:null}],n=t=>t.settings.hourSets??('anchorage'===t.id?r:[]),u=t=>`${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,o=t=>`${t.getFullYear()}-${u(t)}`;function s(t,r){const o=n(t).filter(t=>t.hours);if(!o.length)return null;const s=o.filter(t=>t.start).sort((t,r)=>t.start.localeCompare(r.start));if(s.length<2)return s[0]??o[0];const l=u(r);return[...s].reverse().find(t=>t.start<=l)??s[s.length-1]}function l(t,r){const n=(t.settings.hourOverrides??[]).find(t=>t.date===o(r));if(n)return n.hours;const u=s(t,r);return u?.hours?u.hours[r.getDay()]??null:t.kitchenHours[r.getDay()]??null}},833,[822]); +__d(function(g,r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DATE_FORMAT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"slashDay",{enumerable:!0,get:function(){return n}}),e.slashDate=s,e.dayFromSlash=c,e.slashBox=function(t,l){const i=n(t??'');return{value:i,onChangeText:t=>{const n=s(t,i);l(''===n?'':c(n)??n)}}};const t='DD/MM/YYYY',n=t=>{const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??'');return n?`${n[3]}/${n[2]}/${n[1]}`:t??''};function s(t,n=""){const s=(t??'').length<(n??'').length,c=/^\s*(\d{4})[\s/.-](\d{1,2})[\s/.-](\d{1,2})\s*$/.exec(t??'');if(c)return`${c[3].padStart(2,'0')}/${c[2].padStart(2,'0')}/${c[1]}`;let l=(t??'').trim().replace(/[\s.\-\\]+/g,'/').replace(/[^\d/]/g,'').replace(/\/{2,}/g,'/').replace(/^\//,'');if(!l.includes('/')){const t=l.slice(0,8);return t.length<2||s&&2===t.length?t:(l=t.slice(0,2)+'/'+t.slice(2,4)+(t.length>4||4===t.length&&!s?'/'+t.slice(4):''),l)}const i=l.split('/');2===i.length&&i[1].length>2&&i.splice(1,1,i[1].slice(0,2),i[1].slice(2));const o=i.slice(0,3).map((t,n)=>t.slice(0,2===n?4:2));let u=o.join('/');return!s&&o.length<3&&2===o[o.length-1].length&&(u+='/'),u}function c(t){const n=/^\s*(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})\s*$/.exec(t??'');if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,c=new Date(s+'T12:00:00Z');return Number.isNaN(c.getTime())||c.toISOString().slice(0,10)!==s?void 0:s}},834,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GoldX=h,_e.GoldClose=j,Object.defineProperty(_e,"TEXT_ONLY_CLOSE",{enumerable:!0,get:function(){return x}}),_e.ToastClose=function({onPress:e,label:o="Close",testID:s,size:l="md",style:c,colour:h}){return x?(0,b.jsx)(t.default,{testID:s,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:[{minWidth:64,minHeight:48,alignItems:'center',justifyContent:'center',paddingHorizontal:8},c],children:(0,b.jsx)(u.Text,{style:{fontSize:16,color:h??n.colours.text},children:"Close"})}):(0,b.jsx)(j,{onPress:e,label:o,testID:s,size:l,style:c})},r(d[0]);var t=e(r(d[1])),o=e(r(d[2])),s=r(d[3]),l=e(s),n=r(d[4]),c=r(d[5]),u=r(d[6]),b=r(d[7]);function h({size:e=16,colour:t=n.colours.gold,stroke:o}){const c=o??(e>=20?2.4:2.2);return(0,b.jsx)(l.default,{width:e,height:e,viewBox:"0 0 24 24",accessible:!1,focusable:!1,pointerEvents:"none",children:(0,b.jsx)(s.Path,{d:"M6 6 L18 18 M18 6 L6 18",stroke:t,strokeWidth:Math.min(4,c*(24/e)),strokeLinecap:"round",fill:"none"})})}const f={sm:32,md:38,lg:46},y={sm:13,md:15,lg:18};function j({onPress:e,label:s="Close",testID:l,size:c="md",style:u,disabled:j,hint:x}){const C=f[c],I=Math.max(44,C+8);return(0,b.jsx)(t.default,{testID:l,accessibilityRole:"button",accessibilityLabel:s,accessibilityHint:x,disabled:j,onPress:e,dataSet:{goldClose:'1'},style:[{width:I,height:I,alignItems:'center',justifyContent:'center',flexShrink:0,opacity:j?.4:1},u],children:({pressed:e,hovered:t})=>(0,b.jsx)(o.default,{style:{width:C,height:C,borderRadius:C/2,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:e||t?n.colours.gold:n.colours.accentBorder,backgroundColor:e?n.colours.goldTint:t?n.colours.accentBg:'rgba(0,0,0,0.18)'},children:(0,b.jsx)(h,{size:y[c],colour:e?n.colours.goldLight:n.colours.gold})})})}const x=['kirkton','abbotsford'].includes(c.VENUE_RID)},835,[31,264,128,989,825,5,874,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return l}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,l=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},836,[995]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:l,declared:s}){return(0,c.jsxs)(a.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,c.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(d.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,n.isLiveVenue)()?null:(0,c.jsx)(d.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,c.jsx)(a.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:t.ALLERGENS.map(e=>{const n=l[e.id],u=s.find(l=>l.allergen===e.id),f='contains'===n?o.colours.redBg:'may'===n?o.colours.amberBg:o.colours.surface2,h='contains'===n?'#FFD9D4':'may'===n?'#FFE2A8':o.colours.muted;return(0,c.jsxs)(a.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:u?2:1,borderColor:u?o.colours.red:o.colours.border},children:[(0,c.jsx)(d.T,{size:14,weight:"medium",colour:n?h:o.colours.text,children:e.label}),(0,c.jsxs)(d.T,{size:13,colour:h,children:['contains'===n?'Contains':'may'===n?'May contain':'Not listed',u?` \xb7 YOUR ALLERGY (${(0,t.severityLabel)(u.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,c.jsxs)(d.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,c.jsx)(a.default,{testID:"allergen-signoff",children:(0,c.jsx)(d.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${u(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,c.jsx)(d.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:l,declared:n,signedOff:s}){const a=Object.entries(l);return a.length?(0,c.jsx)(d.Row,{wrap:!0,gap:5,children:a.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,l])=>{const s=n.some(l=>l.allergen===e);return(0,c.jsx)(d.Badge,{label:`${s?'\u26a0 ':''}${(0,t.allergenLabel)(e)}${'may'===l?' (may)':''}`,kind:s?'contains'===l?'red':'amber':'neutral'},e)})}):(0,c.jsx)(d.Muted,{children:(0,e.noAllergenWords)(s)})};var e=r(_d[0]);r(_d[1]);var l,n=r(_d[2]),s=r(_d[3]),a=(l=s)&&l.__esModule?l:{default:l},t=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]);const u=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},837,[1269,31,1098,128,819,825,818,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BasketButton=function(){const s=(0,l.useBasket)().lines.reduce((e,s)=>e+s.qty,0);return s?(0,c.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Basket, ${s} items`,onPress:()=>e.router.push('/customer/basket'),style:{backgroundColor:u.colours.gold,borderRadius:999,paddingHorizontal:12,paddingVertical:6},children:(0,c.jsxs)(n.T,{weight:"semibold",colour:u.colours.onGold,size:14,children:["Basket \xb7 ",s]})}):null};var e=r(d[0]);r(d[1]);var s,t=r(d[2]),o=(s=t)&&s.__esModule?s:{default:s},l=r(d[3]),u=r(d[4]),n=r(d[5]),c=r(d[6])},838,[805,31,264,823,825,818,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setRecipeCardRepository=function(n){t=n,r.forEach(t=>t())},e.recipeCards=function(){if(!t)throw new Error('Recipe card repository not set up');return t},Object.defineProperty(e,"hasRecipeCards",{enumerable:!0,get:function(){return n}}),e.onRepositorySwap=function(t){return r.add(t),()=>{r.delete(t)}};let t=null;const r=new Set;const n=()=>!!t},839,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Stars=function({value:e,onChange:s,size:n=36}){return(0,c.jsx)(t.Row,{gap:6,children:[1,2,3,4,5].map(u=>(0,c.jsx)(l.default,{disabled:!s,accessibilityRole:"button",accessibilityLabel:`${u} star${u>1?'s':''}`,onPress:()=>s?.(u),hitSlop:4,children:(0,c.jsx)(t.T,{size:n,colour:u<=e?o.colours.gold:'#555',children:"\u2605"})},u))})},r(d[0]);var e,s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),c=r(d[4])},840,[31,264,825,818,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ReviewsSection=function({rid:e,mode:l,venueName:o}){const p=(0,c.useReviews)((0,n.useShallow)(t=>t.reviews.filter(t=>t.restaurantId===e))),f=(0,c.useReviews)(t=>t.settingsFor(e)),b=(0,c.useReviews)(t=>t.link[e]);(0,t.useEffect)(()=>(0,d.ensureReviewSync)(e,l),[e,l]);const[y,x]=(0,t.useState)(0),[j,R]=(0,t.useState)('all'),[k,S]=(0,t.useState)(''),[N,C]=(0,t.useState)({}),[M,P]=(0,t.useState)(f.googleUrl),T='manage'===l?p:p.filter(e=>'published'===e.status),O=T.filter(e=>!(y&&e.rating!==y||'manage'===l&&'all'!==j&&e.status!==j)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return(0,u.jsxs)(s.default,{testID:"reviews-section",style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(r.T,{center:!0,size:20,weight:"semibold",accessibilityRole:"header",children:"Reviews"}),(0,u.jsx)(r.Muted,{center:!0,children:'manage'===l?'Newest first. Publish genuine reviews, positive or negative.':'Published reviews, newest first.'}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:h.map(e=>(0,u.jsx)(r.Chip,{testID:`review-star-${e||'all'}`,label:e?`${e} star${e>1?'s':''}`:'All ratings',selected:y===e,onPress:()=>x(e)},e))}),'manage'===l?(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:['all','pending','published','hidden','removed'].map(e=>(0,u.jsx)(r.Chip,{label:'all'===e?'All':e[0].toUpperCase()+e.slice(1),selected:j===e,onPress:()=>R(e)},e))}):null,0===O.length?(0,u.jsx)(r.Muted,{center:!0,children:0===T.length?'No reviews yet':'No reviews for this filter.'}):null,'offline'===b&&T.length?(0,u.jsx)(r.Muted,{center:!0,children:"Showing reviews saved on this device."}):null,O.map(e=>(0,u.jsx)(v,{review:e,mode:l,venueName:o,reason:k,setReason:S,reply:N[e.id]??e.publicReply??'',setReply:t=>C({...N,[e.id]:t}),wixOn:f.wixOn},e.id)),'manage'===l?(0,u.jsxs)(r.Card,{children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Review policy"}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(r.Field,{label:"Google review link (https)",value:M,onChangeText:P,placeholder:"Leave blank if you do not have one",autoCapitalize:"none"}),(0,u.jsx)(r.Button,{label:"Save Google link",onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(M),f.emailOn,f.wixOn).then(e=>{e.ok&&P((0,c.safeGoogleUrl)(M)),(0,a.notify)({id:'review-google',title:e.ok?(0,c.safeGoogleUrl)(M)?'Google link saved':'Google link cleared. Only an https address is kept.':e.error||'Not saved',timeoutMs:4e3})})}}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Website"}),(0,u.jsx)(r.Muted,{center:!0,children:f.wixOn?'The website mirror is on. Only published reviews are sent.':'The website mirror is off. Nothing is sent until you switch it on.'}),(0,u.jsx)(r.Button,{kind:"secondary",label:f.wixOn?'Switch website mirror off':'Switch website mirror on',onPress:()=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(f.googleUrl),f.emailOn,!f.wixOn).then(e=>(0,a.notify)({id:'review-wix',title:e.ok?f.wixOn?'Website mirror off':'Website mirror on':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(w,{rid:e,venueName:o})]}):null]})},_e.ReviewAskCard=w,_e.CopyReviewLink=function({rid:e,bookingId:n}){const[a,h]=(0,t.useState)('');return(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(l.default,{testID:`copy-review-link-${n}`,accessibilityRole:"button",accessibilityLabel:"Copy review link",onPress:()=>{(0,d.issueReviewLink)(e,n).then(t=>{if(!t.ok||!t.token)return void h(t.error||'No review link.');const l=(0,c.reviewLink)(e,t.token),s='undefined'!=typeof navigator?navigator.clipboard:void 0;s?s.writeText(l).then(()=>h('Review link copied.')).catch(()=>h(l)):h(l)})},style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:12,borderWidth:1,borderColor:o.colours.gold},children:(0,u.jsx)(r.T,{colour:o.colours.gold,children:"Copy review link"})}),a?(0,u.jsx)(r.Muted,{style:{textAlign:'left'},children:a}):null]})},_e.ReviewOptOut=function({token:e}){const[l,s]=(0,t.useState)('Checking this link.');return(0,t.useEffect)(()=>{(0,d.optOutReviewEmail)(e).then(e=>{s(e.ok?'You will not get a review email after a visit. Nothing else was sent.':e.error||'This opt-out link is not valid.')})},[e]),(0,u.jsx)(r.Muted,{center:!0,accessibilityRole:"text",children:l})},_e.ReviewForm=function({rid:e,venueName:n,token:a}){const h=(0,c.useReviews)(t=>t.settingsFor(e)),p=(0,c.safeGoogleUrl)(h.googleUrl);(0,t.useEffect)(()=>{(0,d.refreshReviews)(e,'read')},[e]);const[w,v]=(0,t.useState)(0),[f,b]=(0,t.useState)(''),[y,x]=(0,t.useState)(''),[j,R]=(0,t.useState)(''),[k,S]=(0,t.useState)('');return(0,u.jsxs)(s.default,{testID:"review-form",style:{gap:12},children:[(0,u.jsx)(r.T,{center:!0,size:22,weight:"semibold",accessibilityRole:"header",children:"How was your visit?"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Your rating, comments and chosen public name may appear on the ",n," website and app after moderation under the review policy. Honest feedback is welcome, positive or negative."]}),(0,u.jsx)(r.Muted,{center:!0,children:c.REVIEW_POLICY}),(0,u.jsx)(s.default,{style:{flexDirection:'row',justifyContent:'center',gap:8,alignSelf:'center'},children:[1,2,3,4,5].map(e=>(0,u.jsx)(l.default,{testID:`review-rate-${e}`,accessibilityRole:"button",accessibilityLabel:`${e} star${e>1?'s':''}${w===e?', selected':''}`,accessibilityState:{selected:w===e},onPress:()=>v(e),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,u.jsx)(r.T,{size:32,colour:e<=w?o.colours.gold:'#555',children:"\u2605"})},e))}),(0,u.jsx)(r.Field,{label:"Your review",value:f,onChangeText:b,multiline:!0,placeholder:"What should others know about your visit?"}),(0,u.jsx)(r.Field,{label:"Name to show with the review",value:y,onChangeText:x,placeholder:"The name guests will see"}),k?(0,u.jsx)(r.Muted,{center:!0,children:k}):null,j?(0,u.jsx)(r.Muted,{center:!0,children:j}):(0,u.jsx)(r.Button,{testID:"review-submit",label:"Send review",disabled:!w||y.trim().length<2,onPress:()=>{(0,d.submitReview)(a,w,f,y).then(t=>{t.ok?(S(''),R('Thank you. A manager will read it before anything is published.'),(0,d.refreshReviews)(e,'read')):S(t.error||'Not sent.')})}}),p?(0,u.jsx)(r.Button,{kind:"secondary",label:"Also review us on Google",accessibilityLabel:"Also review us on Google",onPress:()=>{window.open(p,'_blank','noopener')}}):null]})};var t=_r(_d[0]);_r(_d[1]);var l=e(_r(_d[2])),s=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]);const h=[0,1,2,3,4,5];function p(e){const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}function w({rid:e,venueName:t}){const l=(0,c.useReviews)(t=>t.settingsFor(e)),n=(0,c.reviewEmail)(t,'[link]',(0,c.safeGoogleUrl)(l.googleUrl));return(0,u.jsxs)(s.default,{style:{gap:8},children:[(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Post-visit email"}),(0,u.jsx)(r.Toggle,{testID:"review-email-toggle",label:"Ask guests for a review after their visit",value:l.emailOn,onChange:t=>{(0,d.saveReviewSettings)(e,(0,c.safeGoogleUrl)(l.googleUrl),t,l.wixOn).then(e=>(0,a.notify)({id:'review-email',title:e.ok?t?'Saved. Review emails are on. Nothing is sent from this screen.':'Saved. Review emails are off. Nothing is sent.':e.error||'Not saved',timeoutMs:4e3}))}}),(0,u.jsx)(r.Muted,{center:!0,children:l.emailOn?'On. A finished visit with an email address is asked once, about two and a half hours later, or at 10:00 the next morning if that would be after 9pm.':'Off. No review email is sent.'}),(0,u.jsx)(r.T,{center:!0,weight:"semibold",children:"Email preview"}),(0,u.jsxs)(r.Muted,{center:!0,children:["Subject: ",n.subject]}),(0,u.jsx)(r.Muted,{center:!0,children:n.body}),(0,u.jsx)(r.Muted,{center:!0,children:"Nothing is sent from this screen."})]})}function v({review:e,mode:t,venueName:l,reason:n,setReason:h,reply:w,setReply:v,wixOn:f}){const b=t=>{(0,d.moderateReview)(e.restaurantId,e.id,t,'published'===t?void 0:n,e.reply??'').then(l=>{(0,a.notify)({id:`review-mod-${e.id}`,title:l.ok?`Review ${t}`:l.error||'Not saved',timeoutMs:4e3})})},y='up_to_date'===e.wix?'Website up to date':'pending'===e.wix?'Website update pending':f?'Website mirror is on':'Website mirror is off';return(0,u.jsxs)(r.Card,{children:[(0,u.jsxs)(s.default,{style:{alignItems:'flex-start',gap:4},children:[(0,u.jsx)(r.T,{weight:"semibold",style:{textAlign:'left'},children:e.publicName}),(0,u.jsxs)(r.T,{style:{textAlign:'left'},children:[(x=e.rating,'\u2605\u2605\u2605\u2605\u2605'.slice(0,x)+'\u2606\u2606\u2606\u2606\u2606'.slice(0,5-x))," (",e.rating," of 5)"]}),(0,u.jsx)(r.T,{size:16,style:{textAlign:'left'},children:e.comment||'No written comment.'}),(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[p(e.createdAt),'manage'===t?` \xb7 ${e.status}`:'']}),'manage'===t?(0,u.jsxs)(r.Muted,{style:{textAlign:'left'},children:[y,e.reason?` \xb7 ${e.reason.replace('_',' ')}`:'']}):null,!e.publicReply||'read'!==t&&'published'!==e.status?null:(0,u.jsxs)(s.default,{accessibilityRole:"text",accessibilityLabel:`Reply from ${l}. ${e.publicReply}`,style:{alignSelf:'stretch',gap:4,marginTop:8},children:[(0,u.jsxs)(r.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:["Reply from ",l]}),(0,u.jsx)(r.Muted,{center:!0,children:e.publicReply})]})]}),'manage'===t?(0,u.jsxs)(s.default,{style:{gap:8},children:[e.audit.length?(0,u.jsxs)(r.Muted,{center:!0,children:["History: ",e.audit.map(e=>`${p(e.at)} ${e.action}${e.reason?` (${e.reason.replace('_',' ')})`:''} by ${e.by}`).join('. ')]}):null,'published'!==e.status?(0,u.jsx)(r.Muted,{center:!0,children:"Guests do not see a reply unless the review is published."}):null,(0,u.jsx)(r.Field,{label:"Public reply",accessibilityLabel:`Public reply to ${e.publicName}`,value:w,onChangeText:v,multiline:!0}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{testID:`review-reply-save-${e.id}`,label:e.publicReply?'Save public reply':'Write public reply',accessibilityLabel:e.publicReply?'Save public reply':'Write public reply',onPress:()=>{(0,d.setReviewReply)(e.restaurantId,e.id,w).then(t=>{(0,a.notify)({id:`review-reply-${e.id}`,title:t.ok?w.trim()?'Public reply saved':'Public reply removed':t.error||'Not saved',timeoutMs:4e3})})}}),e.publicReply?(0,u.jsx)(r.Button,{kind:"secondary",testID:`review-reply-delete-${e.id}`,label:"Delete public reply",accessibilityLabel:"Delete public reply",onPress:()=>{v(''),(0,d.setReviewReply)(e.restaurantId,e.id,'').then(t=>(0,a.notify)({id:`review-reply-del-${e.id}`,title:t.ok?'Public reply removed':t.error||'Not saved',timeoutMs:4e3}))}}):null]}),(0,u.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:c.REVIEW_REASONS.map(e=>(0,u.jsx)(r.Chip,{label:e.label,selected:n===e.id,onPress:()=>h(e.id)},e.id))}),(0,u.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,alignSelf:'center'},children:[(0,u.jsx)(r.Button,{label:"Publish",onPress:()=>b('published')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Hide",onPress:()=>b('hidden')}),(0,u.jsx)(r.Button,{kind:"secondary",label:"Remove",onPress:()=>b('removed')})]})]}):null]});var x}},841,[31,123,264,128,884,818,825,980,1492,1493,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_VENUE_SLUGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LIVE_VENUE_BUILD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return n}});var c=r(d[0]);const b=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"],f=b.includes(c.VENUE_RID),n=c=>b.includes(c)||['6349aa07-3fec-46e9-8c69-7b1b08494793','41ce63ca-ae46-432d-a5ba-25e1b801e64d','43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6','47f86b36-4c99-466a-be9c-30eb3d79f1e1','e0afad1d-cbc1-414a-add6-92e47d302139','24624ea5-d1e3-4182-b0d1-73402b8a1532','1bc2a056-2ef6-4585-abfd-b7d21c84f215',"59766322-119e-4036-a18a-f6909f60a8d2","596c6f7e-9797-4e16-84fe-db4a99fa1bdc","5d500571-e205-4ead-bb58-60e986b6f40e","f43f20ad-55d0-4008-88c8-7738dc1698df","6abc2793-93ab-4e23-a705-b4011a5cc011","78bff97d-5f07-440a-bb99-f6a6118da7a3","cd985ff5-2443-458d-ac8b-342d553628cf","35f870fc-772c-4aad-bb9e-09a9a16bc925","f500ef12-b405-438b-9671-e54289bec5dd"].includes(c)},842,[5]); +__d(function(_g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MockPay=function({visible:e,onClose:h,amount:p,restaurantId:j,allowGiftCard:b=!0,onPaid:x,title:f="Pay"}){const y=(0,o.useRestaurant)(j),g=(0,o.useGiftCards)(j).filter(e=>e.balance>0),[m,w]=(0,s.useState)(),[P,C]=(0,s.useState)('Test card \u2022\u2022\u2022\u2022 4242'),[T,v]=(0,s.useState)(!1),M=g.find(e=>e.code===m),R=M?Math.min(M.balance,p):0,_=p-R;if(!y?.fictional)return(0,u.jsxs)(c.Sheet,{visible:e,onClose:h,title:f,children:[(0,u.jsxs)(c.T,{children:["Online card payment isn\u2019t set up for this yet, so nothing can be paid here. Please ask at the restaurant",y?.phone?` or phone ${y.phone}`:'',"."]}),(0,u.jsx)(c.Button,{kind:"secondary",label:"Close",onPress:h})]});return(0,u.jsxs)(c.Sheet,{visible:e,onClose:h,title:f,children:[(0,u.jsx)(c.DemoPaymentNotice,{}),b&&g.length>0?(0,u.jsxs)(l.default,{style:{gap:6},children:[(0,u.jsx)(c.T,{weight:"semibold",children:"Use a gift card"}),(0,u.jsxs)(c.Row,{wrap:!0,children:[(0,u.jsx)(c.Chip,{label:"None",selected:!m,onPress:()=>w(void 0)}),g.map(e=>(0,u.jsx)(c.Chip,{label:`${e.code.slice(0,8)}\u2026`,sub:`${(0,n.gbp)(e.balance)} left`,selected:m===e.code,onPress:()=>w(e.code)},e.id))]})]}):null,(0,u.jsx)(c.T,{weight:"semibold",children:"Payment method"}),(0,u.jsx)(c.Row,{wrap:!0,children:['Test card \u2022\u2022\u2022\u2022 4242','Apple Pay (test)','Google Pay (test)'].map(e=>(0,u.jsx)(c.Chip,{label:e,selected:P===e,onPress:()=>C(e)},e))}),(0,u.jsxs)(l.default,{style:{gap:2},children:[(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.Muted,{children:"Amount"}),(0,u.jsx)(c.T,{children:(0,n.gbp)(p)})]}),R?(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.Muted,{children:"Gift card"}),(0,u.jsxs)(c.T,{colour:r.colours.ok,children:["\u2212",(0,n.gbp)(R)]})]}):null,(0,u.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(c.T,{weight:"semibold",children:"To pay now"}),(0,u.jsx)(c.T,{weight:"bold",size:20,colour:r.colours.gold,children:(0,n.gbp)(_)})]})]}),T?(0,u.jsx)(t.default,{color:r.colours.gold}):(0,u.jsx)(c.Button,{label:`Pay ${(0,n.gbp)(_)} \u2014 demo`,onPress:()=>{v(!0),setTimeout(()=>{v(!1),x({giftCardCode:m,giftApplied:R,method:P})},700)},testID:"mock-pay-confirm"})]})};var s=_r(d[0]),t=e(_r(d[1])),l=e(_r(d[2])),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7])},843,[31,247,128,823,820,825,818,25]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftLive=function({slug:e,venue:n}){const{info:x,mine:b,err:S,load:w,pay:k}=j(e),[T,P]=(0,t.useState)(null),[D,C]=(0,t.useState)(''),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(''),[I,M]=(0,t.useState)(''),[E,L]=(0,t.useState)(!1),[R,A]=(0,t.useState)(''),[_,H]=(0,t.useState)(null),F=f(e);if(!x)return(0,h.jsx)(a.Screen,{title:"Gift cards",subtitle:n,children:S?(0,h.jsx)(a.Banner,{kind:"warn",title:S}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const N=D?(0,o.poundsToPence)(D)??0:T??x.amounts[1]??x.amounts[0]??0;return(0,h.jsxs)(a.Screen,{title:"Gift cards",subtitle:`${n}: used only at ${n}`,children:[_?(0,h.jsx)(s.default,{testID:"gift-made",children:(0,h.jsx)(a.Card,{highlight:u.colours.gold,children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift card code"}),(0,h.jsx)(a.T,{size:26,weight:"bold",colour:u.colours.gold,center:!0,children:_.code}),(0,h.jsxs)(a.Muted,{center:!0,children:["Shown once and kept on this phone. Write it down or take a screenshot to give it to ",O||'them',"."]}),(0,h.jsxs)(a.Banner,{kind:"warn",title:`Pay ${(0,l.gbp)(_.pence)} at the bar or till`,children:["Show reference ",_.ref,". The card works once staff mark it paid.",k.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"gift",id:_.id,pay:k})]})})}):null,(0,h.jsx)(g,{onDone:w}),(0,h.jsx)(s.default,{testID:"gift-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift cards"}),b.cards.length?b.cards.map(t=>(0,h.jsxs)(s.default,{style:{gap:2},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{style:{flex:1},children:F[t.id]??`\u2022\u2022\u2022\u2022 ${t.last4}`}),(0,h.jsxs)(a.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balancePence)," of ",(0,l.gbp)(t.initialPence)]})]}),(0,h.jsxs)(a.Muted,{size:12,children:[o.STATUS_WORDS[t.status]??t.status,t.expiresAt?` \xb7 use by ${p(t.expiresAt)}`:'','waiting-payment'===t.status?` \xb7 reference ${t.ref}`:'']}),'waiting-payment'===t.status&&_?.id!==t.id?(0,h.jsx)(m,{slug:e,kind:"gift",id:t.id,pay:k}):null]},t.id)):(0,h.jsx)(a.Muted,{children:"None yet."})]})})}),x.giftsOn?(0,h.jsx)(s.default,{testID:"gift-buy",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:8},children:[(0,h.jsx)(a.H2,{children:"Buy a gift card"}),(0,h.jsx)(a.Row,{wrap:!0,children:x.amounts.map(e=>(0,h.jsx)(a.Chip,{label:(0,l.gbp)(e),selected:!D&&N===e,onPress:()=>{C(''),P(e)}},e))}),(0,h.jsx)(a.Field,{label:`Or another amount (\xa3${x.minPence/100} to \xa3${x.maxPence/100})`,keyboardType:"decimal-pad",value:D,onChangeText:C,placeholder:"e.g. 40",testID:"gift-custom"}),(0,h.jsx)(a.Field,{label:"Who it\u2019s for",value:O,onChangeText:$,testID:"gift-recipient"}),(0,h.jsx)(a.Field,{label:"From",value:v,onChangeText:B}),(0,h.jsx)(a.Field,{label:"Message",value:I,onChangeText:M,multiline:!0,placeholder:"Happy birthday!"}),(0,h.jsxs)(a.Muted,{size:12,children:["Use within ",(0,o.expiryWords)(x.expiryMonths)," of paying. Part-use leaves a balance.",x.terms?` ${x.terms}`:'']}),(0,h.jsx)(s.default,{testID:"gift-pay-placeholder",children:(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER})}),R?(0,h.jsx)(a.Banner,{kind:"warn",title:R}):null,(0,h.jsx)(a.Button,{label:E?'Saving\u2026':`Get a ${(0,l.gbp)(N)} gift card, pay at the till`,testID:"gift-buy-btn",disabled:E||Nx.maxPence,onPress:async()=>{L(!0),A('');try{const t=await(0,c.buyGift)(e,{amount:N,recipient:O,from:v,message:I});t.code&&y(e,t.id,t.code),H({id:t.id,code:t.code??'',ref:t.ref,pence:t.initialPence}),w()}catch(e){A((0,r.plainError)(e))}finally{L(!1)}}})]})})}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n} isn\u2019t selling gift cards in the app yet`,children:"Ask at the bar."})]})},_e.ShopLive=function({slug:e,venue:n,guestName:p}){const{info:x,mine:f,err:y,load:b,pay:S}=j(e),[w,k]=(0,t.useState)({}),[T,P]=(0,t.useState)(p),[D,C]=(0,t.useState)(!1),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(null);if(!x)return(0,h.jsx)(a.Screen,{title:"Shop",subtitle:n,children:y?(0,h.jsx)(a.Banner,{kind:"warn",title:y}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const I=Object.entries(w).filter(([,e])=>e>0).map(([e,t])=>({id:e,qty:t})),M=(0,o.basketTotal)(I,x.products);return(0,h.jsxs)(a.Screen,{title:"Shop",subtitle:`${n}: collect at the venue`,children:[v?(0,h.jsxs)(s.default,{testID:"shop-done",children:[(0,h.jsxs)(a.Banner,{kind:"warn",title:`Order ${v.ref}: pay ${(0,l.gbp)(v.total)} at the bar or till`,children:["Staff will have it ready to collect once it\u2019s paid.",S.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"shop",id:v.id,pay:S})]}):null,(0,h.jsx)(g,{onDone:b}),x.shopOn?(0,h.jsxs)(h.Fragment,{children:[x.products.length?x.products.map(e=>(0,h.jsx)(s.default,{testID:`shop-item-${e.id}`,children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,h.jsx)(a.T,{colour:u.colours.gold,children:(0,l.gbp)(e.pricePence)})]}),e.details?(0,h.jsx)(a.Muted,{children:e.details}):null,e.soldOut?(0,h.jsx)(a.Badge,{kind:"amber",label:"Sold out"}):(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(a.Muted,{children:"How many"}),(0,h.jsx)(a.Stepper,{value:w[e.id]??0,min:0,max:20,label:`${e.name} quantity`,onChange:t=>k({...w,[e.id]:t})})]})]})})},e.id)):(0,h.jsx)(a.Muted,{children:"Nothing in the shop yet."}),I.length?(0,h.jsx)(s.default,{testID:"shop-basket",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",children:"Total"}),(0,h.jsx)(a.T,{weight:"semibold",colour:u.colours.gold,children:(0,l.gbp)(M)})]}),(0,h.jsx)(a.Field,{label:"Name for collection",value:T,onChangeText:P,testID:"shop-name"}),(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER}),O?(0,h.jsx)(a.Banner,{kind:"warn",title:O}):null,(0,h.jsx)(a.Button,{label:D?'Sending\u2026':'Order, pay at the till',testID:"shop-order-btn",disabled:D||!T.trim(),onPress:async()=>{C(!0),$('');try{const t=await(0,c.shopOrder)(e,I,T);B({id:t.id,ref:t.ref,total:t.totalPence}),k({}),b()}catch(e){$((0,r.plainError)(e))}finally{C(!1)}}})]})})}):null]}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n}\u2019s shop isn\u2019t open in the app yet`,children:"Ask at the bar."}),f.orders.length?(0,h.jsx)(s.default,{testID:"shop-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsx)(a.H2,{children:"Your shop orders"}),f.orders.map(e=>(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(a.T,{style:{flex:1},children:[e.ref," \xb7 ",e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')]}),(0,h.jsx)(a.Muted,{children:o.STATUS_WORDS[e.status]??e.status})]},e.ref))]})})}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},a=_r(d[2]),l=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]);const p=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},x=e=>`cc-gift-codes:${e}:v1`;function f(e){try{return JSON.parse(globalThis.localStorage?.getItem(x(e))||'{}')}catch{return{}}}function y(e,t,n){try{const s=f(e);s[t]=n,globalThis.localStorage?.setItem(x(e),JSON.stringify(s))}catch{}}function j(e){const[n,s]=(0,t.useState)(null),[a,l]=(0,t.useState)({cards:[],orders:[]}),[o,u]=(0,t.useState)(''),[h,p]=(0,t.useState)({provider:'none',cardOn:!1,testMode:!0}),x=(0,t.useCallback)(()=>{u(''),(0,c.shopPublic)(e).then(s).catch(e=>u((0,r.plainError)(e))),(0,c.myShop)(e).then(l).catch(()=>{}),(0,c.payPublic)(e).then(p)},[e]);return(0,t.useEffect)(()=>{x()},[x]),{info:n,mine:a,err:o,load:x,pay:h}}function g({onDone:e}){const[n,l]=(0,t.useState)('');return(0,t.useEffect)(()=>{const t='undefined'!=typeof window?new URLSearchParams(window.location.search).get('paid'):null;if(!t||!/^[0-9a-f-]{36}$/.test(t))return;let n=0;const s=()=>(0,c.payStatus)(t).then(t=>{l(t.status),'paid'===t.status?e():n++<10&&setTimeout(s,2e3)}).catch(()=>{});s()},[e]),n?(0,h.jsx)(s.default,{testID:"pay-back",children:(0,h.jsx)(a.Banner,{kind:'paid'===n?'success':'warn',title:'paid'===n?'Paid by card (TEST MODE: no real money)':'expired'===n?'The card payment timed out. Pay at the bar or till.':'Checking the card payment\u2026'})}):null}function m({slug:e,kind:n,id:l,pay:o}){const[u,p]=(0,t.useState)(!1),[x,f]=(0,t.useState)('');return o.cardOn?(0,h.jsxs)(s.default,{testID:`pay-card-${n}`,style:{gap:4},children:[(0,h.jsx)(a.Button,{label:u?'Opening card payment\u2026':'Pay by card (TEST MODE)',kind:"secondary",disabled:u,onPress:async()=>{p(!0),f('');try{const t=await(0,c.payStart)(e,n,l);window.location.assign(t.url)}catch(e){f((0,r.plainError)(e))}finally{p(!1)}}}),(0,h.jsx)(a.Muted,{size:12,children:"Test mode: use a Stripe test card. No real money is taken."}),x?(0,h.jsx)(a.Banner,{kind:"warn",title:x}):null]}):null}},844,[31,128,818,820,1071,1072,1073,825,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"guestServer",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"useGuestLoyalty",{enumerable:!0,get:function(){return _}}),e.refreshGuest=async function(t){if(!c())return;_.setState(n=>({loading:{...n.loading,[t]:!0}}));try{const n=await(0,o.rpc)('loyalty_public',{p_venue_slug:t});if(_.setState(r=>({info:{...r.info,[t]:n}})),await(0,o.guestSession)()){const n=await(0,o.rpc)('loyalty_my_card',{p_venue_slug:t});_.setState(r=>({card:{...r.card,[t]:n??null}}))}}finally{_.setState(n=>({loading:{...n.loading,[t]:!1}}))}},e.guestJoin=async function(t,n){if(!await(0,o.guestSession)())throw new Error('No connection. Try again when you are back online.');const r=await(0,o.rpc)('loyalty_guest_join',{p_venue_slug:t,p_name:n.name.trim(),p_phone:n.phone.trim()||null,p_email:n.email.trim()||null,p_consent:n.consent,p_consent_text:n.consentText,p_referral:n.referral?(0,l.cleanCode)(n.referral):null});return p(t,r),r},e.guestClaim=async function(t,n){if(!await(0,o.guestSession)())return{ok:!1,error:'No connection. Try again when you are back online.'};const r=await(0,o.rpc)('loyalty_guest_claim',{p_venue_slug:t,p_code:(0,l.cleanCode)(n)});return r?.error?{ok:!1,error:String(r.error)}:(p(t,r),{ok:!0,card:r,linked:!!r.linked})},e.guestLinkCode=async function(t){return(0,o.rpc)('loyalty_guest_link_code',{p_venue_slug:t})},e.guestLeave=async function(t){await(0,o.rpc)('loyalty_guest_leave',{p_venue_slug:t}),p(t,null)},Object.defineProperty(e,"staffFind",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"staffCard",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"staffStamp",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"staffRedeem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"staffJoin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"staffCode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"staffRemove",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"loyaltySummary",{enumerable:!0,get:function(){return P}}),e.readSettings=async function(){const{data:t,error:n}=await u().from('loyalty_settings').select('*').eq('venue_id',y()).maybeSingle();if(n)throw n;return(0,l.settingsFromRow)(t)},e.saveSettings=async function(t){const{error:n}=await u().from('loyalty_settings').upsert({venue_id:y(),...(0,l.settingsToRow)(t),updated_by:(o.useSync.getState().staffRef??'').slice(0,80)||'manager',updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readOffers=k,e.saveOffer=C,e.watchLoyalty=function(t){if(!f())return()=>{};const n=y();let r=u().channel(`cc-loyalty:${n}:${Math.random().toString(36).slice(2,8)}`);for(const o of['loyalty_settings','loyalty_offers','loyalty_guests','loyalty_stamps','loyalty_rewards','loyalty_referrals'])r=r.on('postgres_changes',{event:'*',schema:'public',table:o,filter:`venue_id=eq.${n}`},()=>t());return r.subscribe(),()=>{try{u().removeChannel(r)}catch{}}},e.migrateLocalOnce=async function(t,n,r){if(!f())return 0;const o=`loyalty:migrated:${y()}`;if(await n(o))return 0;let s=0;if(!(await k()).length)for(const n of t.offers.filter(t=>'offer'===t.kind&&!JSON.stringify(t).includes('(example)')))await C({title:n.title.slice(0,80),details:(n.body??'').slice(0,500),startsOn:null,endsOn:n.until??null,isOn:!!n.live}),s++;return await r(o),s};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=_r(d[3]),s=_r(d[4]),l=_r(d[5]);const u=()=>(0,n.getSupabase)(),c=()=>(0,r.isSupabaseConfigured)()&&!s.PITCH,f=()=>c()&&'staff'===o.useSync.getState().kind&&!!o.useSync.getState().venueId,y=()=>{const t=o.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},_=(0,t.create)(()=>({info:{},card:{},loading:{}}));const p=(t,n)=>_.setState(r=>({card:{...r.card,[t]:n}}));const b=t=>(0,o.rpc)('loyalty_staff_find',{p_venue:y(),p_q:t}),w=t=>(0,o.rpc)('loyalty_staff_card',{p_guest:t}),v=t=>(0,o.rpc)('loyalty_staff_stamp',{p_guest:t}),S=t=>(0,o.rpc)('loyalty_staff_redeem',{p_reward:t}),O=t=>(0,o.rpc)('loyalty_staff_join',{p_venue:y(),p_name:t.name.trim(),p_phone:t.phone.trim()||null,p_email:t.email.trim()||null,p_consent:t.consent,p_consent_text:t.consentText}),h=(t,n)=>(0,o.rpc)('loyalty_staff_code',{p_venue:y(),p_kind:t,p_guest:n??null}),j=t=>(0,o.rpc)('loyalty_staff_remove',{p_guest:t}),P=()=>(0,o.rpc)('loyalty_summary',{p_venue:y()});async function k(){const{data:t,error:n}=await u().from('loyalty_offers').select('*').eq('venue_id',y()).order('created_at');if(n)throw n;return(t??[]).map(l.offerFromRow)}async function C(t){const n={venue_id:y(),title:t.title.trim(),details:t.details.trim(),starts_on:t.startsOn||null,ends_on:t.endsOn||null,is_on:t.isOn,updated_at:(new Date).toISOString()},{error:r}=t.id?await u().from('loyalty_offers').update(n).eq('id',t.id):await u().from('loyalty_offers').insert(n);if(r)throw r}},845,[995,872,1170,824,2,1071]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return b}}),_e.LauncherLine=function(){return(0,u.jsx)(t.default,{style:{borderTopWidth:1,borderColor:s.colours.border,paddingTop:10,marginTop:4},children:(0,u.jsx)(n.Muted,{center:!0,children:b})})},_e.HubTile=function({icon:e,label:b,sub:f,onPress:p,badge:x}){const j=(0,l.default)().width<600;return(0,u.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:b,onPress:p,style:({pressed:e})=>({flexBasis:j?'45%':'30%',flexGrow:1,maxWidth:j?'100%':'31.5%',minWidth:j?140:96,backgroundColor:e?'#1d1a14':s.colours.surface,borderRadius:14,borderWidth:1,borderColor:s.colours.border,padding:10,gap:2,alignItems:'center',justifyContent:'center'}),children:[h.includes(e)?(0,u.jsx)(c.Icon,{name:e,size:24,colour:s.colours.gold}):(0,u.jsx)(n.T,{size:22,children:e}),(0,u.jsx)(n.T,{size:13,weight:"semibold",center:!0,children:b}),f?(0,u.jsx)(n.T,{size:11,colour:s.colours.muted,center:!0,children:f}):null,x?(0,u.jsx)(t.default,{style:{position:'absolute',top:6,right:6,backgroundColor:s.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,u.jsx)(n.T,{size:10,weight:"bold",colour:s.colours.onGold,children:x})}):null]})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),l=e(r(d[3])),n=r(d[4]),s=r(d[5]),c=r(d[6]),u=r(d[7]);const b='Card payments: not set up yet';const h=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},862,[31,264,128,288,818,825,1461,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"leaveOn",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"leaveRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return b}}),_e.liveAttendance=function(e){const t=y.get(e);if(t)return t;const n=e.some(e=>e.voided)?e.filter(e=>!e.voided):e;return y.set(e,n),n},Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return P}}),_e.openShiftOf=A,_e.loggedBreakMins=M,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return F}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),n=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,n)=>t&&n.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${n} (${t})`:n},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return Q}});var e,t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),i=_r(_d[3]),s=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=(e=d)&&e.__esModule?e:{default:e},f=_r(_d[8]),u=_r(_d[9]),l=_r(_d[10]),p=_r(_d[11]);const m=(e,t,n)=>e.find(e=>e.staffId===t&&'approved'===e.status&&e.from<=n&&n<=e.to),h={decide:null},g=e=>e.out?e.signOff?'confirmed':'awaiting':'open',b=e=>!!e.out&&!!e.signOff,y=new WeakMap;const k={send:null},I=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,w=e=>{const[t,n,a]=e.split('-').map(Number);return(new Date(t,n-1,a).getDay()+6)%7},E=(e,t)=>{const[n,a,i]=e.split('-').map(Number);return I(new Date(n,a-1,i+t))},S=e=>E(e,-w(e)),O=(e,t)=>e.filter(e=>e.date===t),v=(e,t,n)=>e.find(e=>e.staffId===t&&e.date===n),R=(e,t)=>t?e:e.filter(e=>e.published),_=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],$=1271,L=6,D=['ql-wix-view','ql-wix-edit'],T=e=>D.includes(e.id)||'Website bookings'===e.group,P=[{id:'ql-gmail',label:'Work email (Gmail)',url:'',icon:'\u2709\ufe0f',kind:'gmail',staff:!1,builtIn:!0},{id:'ql-wix-view',label:'View site',url:'https://www.anchoragedunure.com',icon:'\ud83c\udf10',kind:'link',group:'Website bookings',staff:!1,builtIn:!0},{id:'ql-wix-edit',label:'Edit site',url:'https://manage.wix.com',icon:'\ud83d\udd8a\ufe0f',kind:'link',group:'Website bookings',staff:!1,builtIn:!0}];function A(e,t,n){const a=new Date(n).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&a-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function M(e,t=new Date){const n=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():n)-new Date(t.start).getTime()),0)/6e4)}const j=e=>!!e?.breaks?.some(e=>!e.end),N=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,C=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function B(){return l.ROSTER.map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},role:e.role,job:e.job,active:!0,level:e.level,dept:e.dept,salaried:e.salaried,noTax:e.noTax,...U.includes(e.id)?{displayClock:!0}:{}}))}const U=['st-jack'];function V(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const q=()=>{const e={tronc:{method:'hours',points:{FOH:1,Bar:1,Kitchen:.8,KP:.6,Manager:1},includeManagers:!0,includeOwner:!1,custom:{},text:'The Anchorage tipping policy (template)\n\n1. 100% of tips paid by card and cash tips put in the tip jar go to staff. Nothing is deducted.\n2. Tips are pooled and shared by paid hours worked in each pay period (breaks excluded).\n3. The owner does not take a share. Managers share only for hours worked on the floor or in the kitchen.\n4. Tips are paid with wages, no later than the end of the month after the tip was paid.\n5. Tip records are kept for 3 years. Ask a manager for your records at any time.'},troncCash:{},troncHistory:[],troncLog:[],chat:[],chatMuted:{},chatRead:{},referral:{giverReward:'Free dessert',friendReward:'\xa35 off first order',active:!0},referrals:[],reminders:{h24:!0,h2:!0,confirmText:!0},coats:[],merch:[],merchOrders:[],marketingDraft:void 0,socialAccounts:{facebook:!0,instagram:!0,tiktok:!0,youtube:!0},socialPosts:[],socialDraft:void 0,quickLinks:P.map(e=>({...e})),workEmail:'',staff:B(),rosterVersion:l.ROSTER_VERSION,previewRole:'owner',staffAs:l.ROSTER.find(e=>'staff'===e.app)?.id??l.ROSTER[0]?.id??'',offers:[],photos:[],changeRequests:[],changesUsed:2,site:t.VENUE_RID,branding:{},checks:{},lost:[],lostReports:[],campaigns:[],shifts:[],rotaPublished:void 0,leave:[],swaps:[],availability:{},attendance:[],attLog:[],timeRequests:[],geofence:{lat:55.4047,lng:-4.7606,radius:100},simLocation:'venue',consent:{},hourly:V(),payPeriod:'weekly',suppliers:[],supplierOrders:[],staffCanViewSuppliers:!1,readNotes:{},customerTags:{'cust-demo':['Allergy','Regular'],'cr-2':['VIP'],'cr-5':['Takeaway']}};if(s.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE)return{...e,changesUsed:0,customerTags:{},socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1}};if(!t.IS_ISOLATED_VENUE)return e;for(const t of Object.keys(e))Array.isArray(e[t])&&(e[t]=[]);return{...e,site:t.VENUE_RID,staffAs:'',hourly:{},customerTags:{},geofence:{lat:0,lng:0,radius:100},tronc:{...e.tronc,text:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].name+' tipping policy \u2014 to confirm.':t.IS_ABBOTSFORD?'The Abbotsford Hotel tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKTON?'The Kirkton Inn tipping policy \u2014 awaiting venue confirmation.':t.IS_GREENSIDE?'The Greenside Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_WILDINGS?'Wildings Hotel & Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKMICHAEL?"The Kirkmichael Arms tipping policy \u2014 awaiting venue confirmation.":"Souter's Inn tipping policy \u2014 awaiting venue confirmation."},changesUsed:0,socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1},quickLinks:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?[]:t.IS_GREENSIDE?[{id:'greenside-phone',label:'Call 01655 889685',url:'tel:01655889685',icon:'',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_WILDINGS?[{id:'wildings-phone',label:'Call to book',url:'tel:01655331401',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0},{id:'wildings-email',label:'Email to book',url:'mailto:bookings@wildingsrestaurant-hotel.co.uk',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_KIRKMICHAEL?[{id:'kirkmichael-site',label:'Venue website',url:'https://www.kirkmichaelarms.co.uk/',icon:'\ud83c\udf10',kind:'link',group:'Website',staff:!0,builtIn:!0}]:[{id:'souters-book',label:'Guest table requests',url:'https://covercharge-apps.static.hf.space/souters/customer-app/',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}],branding:{[t.VENUE_RID]:{accent:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?a.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},x=(0,f.create)()((0,u.persist)((e,n)=>({...q(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,n,a)=>e(e=>({staff:[...e.staff,{id:N('st'),name:t,role:n,job:a,active:!0,level:W[n]}]})),saveSupplier:t=>e(e=>({suppliers:e.suppliers.some(e=>e.id===t.id)?e.suppliers.map(e=>e.id===t.id?t:e):[...e.suppliers,t]})),setRate:(t,n)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(n))}})),clearRate:t=>e(e=>{const n={...e.hourly};return delete n[t],{hourly:n}}),updateStaff:(t,n)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...n}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:N('of')},...e.offers]})),updateOffer:(t,n)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...n}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:N('ph'),caption:t,tone:C[e.photos.length%C.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,n)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:N('cr'),text:t,at:n,status:'requested'},...e.changeRequests]}),setSite:n=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:n}),setBranding:(t,n)=>e(e=>{const a={...e.branding};return n?a[t]={...a[t],...n}:delete a[t],{branding:a}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:N('sp')},...e.socialPosts]})),setSocialPost:(t,n)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...n}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,n,a)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[n]??[];return{...e,reactions:{...e.reactions,[n]:i.includes(a)?i.filter(e=>e!==a):[...i,a]}}})})),chatSeen:(t,n)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(n))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(n)?e:{...e,seenBy:[...e.seenBy,n]})}:e),chatMarkRead:(t,n)=>e(e=>{const a={...e.chatRead?.[t]??{}};for(const[e,t]of Object.entries(n))(!a[e]||Date.parse(t)>Date.parse(a[e]))&&(a[e]=t);const i=e=>Math.max(Date.parse(a['*']??'')||0,Date.parse(a[e]??'')||0),s=e.chat.some(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch))?e.chat.map(e=>!e.seenBy.includes(t)&&Date.parse(e.at)<=i(e.ch)?{...e,seenBy:[...e.seenBy,t]}:e):e.chat;return{chatRead:{...e.chatRead??{},[t]:a},chat:s}}),chatPatch:(t,n)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...n}:e)})),chatMute:(t,n)=>e(e=>{const a=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),sys:(t,n,a)=>e(e=>({chat:[...e.chat,{id:N('m'),ch:t,from:'system',text:n,at:a,reactions:{},seenBy:[]}]})),tick:(t,n,a,i)=>e(e=>({checks:{...e.checks,[t]:{by:n,at:a,value:i}}})),untick:t=>e(e=>{const n={...e.checks};return delete n[t],{checks:n}}),addLost:t=>e(e=>({lost:[{...t,id:N('lp'),status:'held'},...e.lost]})),setLost:(t,n)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...n}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:N('cp')},...e.campaigns]})),setCampaign:(t,n)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...n}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:w(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:w(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,a)=>{const i=n(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const n=E(t,e),o=E(a,e);i.shifts.filter(e=>e.date===n&&s.has(e.staffId)&&!m(i.leave,e.staffId,o)&&!i.shifts.some(t=>t.staffId===e.staffId&&t.date===o)&&!r.some(t=>t.staffId===e.staffId&&t.date===o)).forEach(e=>r.push({id:(0,p.uuid)(),staffId:e.staffId,date:o,day:w(o),start:e.start,end:e.end,note:e.note,published:!1}))}return r.length&&e({shifts:[...i.shifts,...r]}),r.length},publishWeek:t=>{const n=E(t,6);let a=0;return e(e=>({shifts:e.shifts.map(e=>e.daten||e.published&&!e.changed?e:(a++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),a},removeShift:t=>e(e=>({shifts:e.shifts.filter(e=>e.id!==t)})),markRead:t=>e(e=>({readNotes:{...e.readNotes,...Object.fromEntries(t.map(e=>[e,!0]))}})),toggleTag:(t,n)=>e(e=>{const a=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>{const n={...t,id:(0,p.uuid)(),status:t.status??'pending'};return e(e=>({leave:[n,...e.leave]})),n},setLeave:(t,a)=>{e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:a}:e)}));const i=n().leave.find(e=>e.id===t);i&&h.decide?.(i)},addSwap:t=>e(e=>({swaps:[{...t,id:N('sw'),status:'open'},...e.swaps]})),setSwap:(t,n)=>e(e=>{const a=e.swaps.find(e=>e.id===t);return{shifts:'approved'===n&&a?.toId?e.shifts.map(e=>e.id===a.shiftId?{...e,staffId:a.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:n}:e)}}),toggleAvail:(t,n)=>e(e=>{const a=e.availability[t]??[];return{availability:{...e.availability,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),clock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.filter(e=>e.staffId===t&&e.in&&!e.out&&new Date(i).getTime()-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0];if('in'===a)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:n,in:i,inSite:s}]};const d=e=>e?.map(e=>e.end?e:{...e,end:i});return o?{attendance:e.attendance.map(e=>e.id===o.id?{...e,out:i,outSite:s,breakMins:r??M({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.find(e=>e.id===t),d=e.staff.find(e=>e.id===o?.staffId),c=o?.[n]?new Date(o[n]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[n]:a,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:N('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${n} from ${c} to ${new Date(a).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,n,a)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...n,geo:a?[...e.geo??[],a].slice(-20):e.geo}:e)})),breakToggle:(t,a,i)=>{const s=n(),r=A(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===a?d:!d)return!1;const c='start'===a?[...o,{start:i}]:o.map(e=>e.end?e:{...e,end:i});return e({attendance:s.attendance.map(e=>e.id===r.id?{...e,breaks:c,breakMins:M({breaks:c})}:e)}),!0},adjustBreak:(t,n,a,i,s)=>e(e=>{const r=e.attendance.find(e=>e.id===t),o=e.staff.find(e=>e.id===r?.staffId);return{attendance:e.attendance.map(e=>e.id===t?{...e,breakMins:n,adjusted:{by:a,at:s,reason:i}}:e),attLog:[{id:N('al'),at:s,text:`${a} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${n}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const a=n(),i=t.id?a.attendance.find(e=>e.id===t.id):void 0,s=t.reason.trim();if(s.length<3)return null;if(t.out&&t.out<=t.in)return null;const r=e=>e?new Date(e).toTimeString().slice(0,5):'none',o=(e,n,a)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:n,to:a,reason:s}),d=a.staff.find(e=>e.id===t.staffId)?.name??'staff';let c;const f=[];if(i){const e=[...i.audit??[]];if(i.signOff&&(e.push(o('reopened','Confirmed','Awaiting sign-off')),f.push(`${t.by} reopened ${d}'s confirmed ${i.date} entry`)),i.in!==t.in&&(e.push(o('clock_in',r(i.in),r(t.in))),f.push(`${t.by} changed ${d} clock-in from ${r(i.in)} to ${r(t.in)}: ${s}`)),(i.out??'')!==(t.out??'')&&(e.push(o('clock_out',r(i.out),r(t.out))),f.push(`${t.by} changed ${d} clock-out from ${r(i.out)} to ${r(t.out)}: ${s}`)),(i.breakMins??0)!==t.breakMins&&(e.push(o('break',`${i.breakMins??0}m`,`${t.breakMins}m`)),f.push(`${t.by} changed ${d} break from ${i.breakMins??0}m to ${t.breakMins}m: ${s}`)),e.length===(i.audit??[]).length)return i;const n=t.out?i.breaks?.map(e=>e.end?e:{...e,end:t.out}):i.breaks;c={...i,in:t.in,out:t.out,breakMins:t.breakMins,breaks:n,signOff:void 0,adjusted:{by:t.by,at:t.now,reason:s},audit:e}}else c={id:t.id??(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:s},audit:[o('added',void 0,`${r(t.in)}\u2013${t.out?r(t.out):'open'}, break ${t.breakMins}m`)]},f.push(`${t.by} added ${d}'s ${t.date} entry ${r(t.in)}\u2013${t.out?r(t.out):'open'} (break ${t.breakMins}m): ${s}`);return t.request&&(c={...c,audit:[...c.audit??[],o('request_applied')]}),k.send?.('attendance_override',c,{reason:s}),e(e=>({attendance:i?e.attendance.map(e=>e.id===i.id?c:e):[...e.attendance,c],attLog:[...f.reverse().map(e=>({id:N('al'),at:t.now,text:e})),...e.attLog]})),c},voidEntry:(t,a,i,s,r)=>{const o=n(),d=o.attendance.find(e=>e.id===t);if(!d||d.voided||d.signOff||s.trim().length<3)return!1;const c={...d,voided:{by:a,at:r,reason:s.trim()},audit:[...d.audit??[],{at:r,by:a,byId:i,action:'voided',from:'In hours',to:'Removed',reason:s.trim()}]};k.send?.('attendance_void',c,{reason:s.trim()});const f=o.staff.find(e=>e.id===d.staffId)?.name??'staff';return e({attendance:o.attendance.map(e=>e.id===t?c:e),attLog:[{id:N('al'),at:r,text:`${a} removed ${f}'s ${d.date} shift (kept in the history): ${s.trim()}`},...o.attLog]}),!0},deleteEntry:(t,a,i,s)=>{const r=n(),o=r.attendance.find(e=>e.id===t);if(!o)return{ok:!1,message:'Not found.'};if(o.signOff)return{ok:!1,message:"This shift has been signed off and can't be deleted."};const d={...o,audit:[...o.audit??[],{at:s,by:a,byId:i,action:'voided',from:'In hours',to:'Deleted'}]};k.send?.('attendance_delete',d);const c=r.staff.find(e=>e.id===o.staffId)?.name??'staff';return e({attendance:r.attendance.filter(e=>e.id!==t),attLog:[{id:N('al'),at:s,text:`${a} deleted ${c}'s ${o.date} shift`},...r.attLog]}),{ok:!0}},addPastShift:t=>{if(!t.staffId||!t.in||!t.out||t.out<=t.in)return null;const a=(t.note??'').trim()||'Past shift (historical entry)',i={id:(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:a},signOff:{by:t.by,byId:t.byId,at:t.now},audit:[{at:t.now,by:t.by,byId:t.byId,action:'added',to:`${t.in}\u2013${t.out}, break ${t.breakMins}m`,reason:a},{at:t.now,by:t.by,byId:t.byId,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed',reason:'Historical entry'}]};k.send?.('attendance_add_past',i,{reason:a});const s=n().staff.find(e=>e.id===t.staffId)?.name??'staff';return e(e=>({attendance:[...e.attendance,i],attLog:[{id:N('al'),at:t.now,text:`${t.by} entered ${s}'s past shift on ${t.date}`},...e.attLog]})),i},confirmEntries:(t,a,i,s)=>{const r=n(),o=new Set(t),d=[],c=r.attendance.map(e=>{if(!o.has(e.id)||!e.out||e.signOff)return e;const t={...e,signOff:{by:a,byId:i,at:s},audit:[...e.audit??[],{at:s,by:a,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>k.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:N('al'),at:s,text:`${a} confirmed ${d.length} ${1===d.length?'entry':'entries'} (${[...new Set(d.map(e=>e.date))].join(', ')})`},...r.attLog]}),d.length):0},addTimeRequest:t=>e(e=>({timeRequests:[{...t,id:(0,p.uuid)(),status:'open'},...e.timeRequests]})),resolveTimeRequest:(t,a,i,s)=>{const r=n().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:a,resolvedBy:i,resolvedAt:s};k.send?.('time_request_resolve',o),e(e=>({timeRequests:e.timeRequests.map(e=>e.id===t?o:e)}))},setGeofence:t=>e(e=>({geofence:{...e.geofence,...t}})),setSimLocation:t=>e({simLocation:t}),giveConsent:(t,n)=>e(e=>({consent:{...e.consent,[t]:n}})),resetOwner:()=>e(q()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const n=new Set(e.staff.map(e=>e.id)),a=B().filter(e=>!n.has(e.id));return{staff:a.length?[...e.staff,...a]:e.staff,hourly:{...e.hourly,...V()},rosterVersion:l.ROSTER_VERSION}})}),{name:'covercharge-owner-v1',version:6,storage:(0,u.createJSONStorage)(()=>c.default),migrate:async(e,t)=>{if(s.LIVE_VENUE_BUILD&&e)return await(0,o.archiveChefCache)('owner',e),{...e,...(0,i.stripOwnerLiveSamples)(e)};if(e&&t<2&&Array.isArray(e.quickLinks)&&(e.quickLinks=e.quickLinks.map(e=>D.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=q();Object.assign(e,{staff:t.staff,hourly:t.hourly,shifts:t.shifts,leave:t.leave,swaps:t.swaps,availability:t.availability,attendance:[],attLog:[],consent:{},chat:[],chatMuted:{},troncHistory:[],staffAs:t.staffAs,previewRole:'owner',rosterVersion:l.ROSTER_VERSION,rotaPublished:void 0})}if(e&&t<4){const t=S(I(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:E(t,e.day??0),published:!0}),e.timeRequests=e.timeRequests??[]}return s.LIVE_VENUE_BUILD&&e&&(Object.assign(e,(0,i.stripOwnerLiveSamples)(e)),e.chat=(e.chat||[]).filter(e=>!(0,r.isSeedChefChat)(e)),e.suppliers=(e.suppliers||[]).filter(e=>!/^sup-[1-9]$/.test(e.id)||!/^(Example|Sample)\b/.test(e.name)),e.supplierOrders=(e.supplierOrders||[]).filter(e=>!/\(example\)/i.test(e.by||''))),e}})),K=(e,t,n)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${n(t)}/h`,W={owner:'Owner',manager:'Manager',staff:'Staff'},F={forecasts:e=>'staff'!==e,manage:e=>'staff'!==e,staffAdmin:e=>'owner'===e,billing:e=>'owner'===e,takings:e=>'staff'!==e,publishSocial:e=>'staff'!==e};const G=e=>[e.name.replace(/\s*\([^)]*\)\s*$/,'').replace(' (example)',''),e.nickname??''].map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>[e,e.split(' ')[0]]).filter((e,t,n)=>n.indexOf(e)===t),H=(e,t)=>{const n=t.trim().toLowerCase();if(!n)return!1;const a=G(e);return a.includes(n)||a.includes(n.split(' ')[0])},Q=(e,t)=>{const n=t.trim().toLowerCase();return!n||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(n))}},863,[5,6,1193,1195,842,1084,1198,1190,995,1191,15,1099]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSpecials",{enumerable:!0,get:function(){return _}});var e,t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),n=r(_d[3]),o=r(_d[4]),c=(e=o)&&e.__esModule?e:{default:e},l=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),y=r(_d[9]);const p=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock)}catch{return new Date}};let S=0;const f=()=>`sb-${Date.now().toString(36)}${(S++).toString(36)}`,b=(e,t)=>u.useStore.setState(s=>({audit:[{id:`au-${f()}`,restaurantId:e,at:p().toISOString(),kind:'allergy',text:t},...s.audit].slice(0,300)})),_=(0,l.create)()((0,d.persist)((e,t)=>({...n.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{current:{},history:[]}:(0,h.seedSpecials)(p()),post:(t,s,i,n)=>{e(e=>(0,h.postBoard)(e,t,s,i,n,p(),f())),s.items.length&&b(t,`Specials board: allergens for ${s.items.length} typed special${1===s.items.length?'':'s'} checked and signed off by ${i}`)},clear:(t,s)=>{e(e=>(0,h.clearBoard)(e,t)),b(t,`Specials board cleared by ${s}`)},reuse:(s,i,n,o)=>{const c=t().history.find(e=>e.id===i);e(e=>(0,h.reuseBoard)(e,s,i,n,o,p(),f())),c?.items.length&&b(s,`Specials board re-used: ${c.items.length} typed special${1===c.items.length?'':'s'}, allergens as previously checked, signed off by ${n}`)},remove:t=>e(e=>(0,h.deleteFromHistory)(e,t))}),{name:'covercharge-specials-v1',storage:(0,d.createJSONStorage)(()=>c.default),version:1,partialize:e=>({current:e.current,history:e.history})})),E=async()=>{if(!(0,y.liveData)())return;const e=_.getState(),n=e=>String(e.id).startsWith('sb-seed')&&(!s.LIVE_VENUE_BUILD||(0,t.demoActor)(e.postedBy)&&(!e.allergenCheck||(0,t.demoActor)(e.allergenCheck.by))&&(!e.photo||e.photo===h.SAMPLE_PHOTO)&&e.items.every(e=>/\(sample\)/i.test(e.name))),o=Object.fromEntries(Object.entries(e.current).filter(([,e])=>!(e&&n(e)))),c=e.history.filter(e=>!n(e));Object.keys(o).length===Object.keys(e.current).length&&c.length===e.history.length||(s.LIVE_VENUE_BUILD&&await(0,i.archiveChefCache)('specials',{current:e.current,history:e.history}),_.setState({current:o,history:c}))};(0,y.onDataModeChange)(E);try{_.persist?.onFinishHydration?.(E)}catch{}E()},864,[1084,842,1198,5,1190,995,1191,865,881,1218]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAMPLE_PHOTO",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_MAX",{enumerable:!0,get:function(){return n}}),e.parsePrice=function(t){const n=t.trim().replace(/^\xa3\s*/,'');return n?/^\d{1,3}(\.\d{1,2})?$/.test(n)?Math.round(100*parseFloat(n)):NaN:null},Object.defineProperty(e,"priceText",{enumerable:!0,get:function(){return s}}),e.itemProblems=a,e.draftProblems=i,e.cycleAllergen=function(t,n){const s={...t};s[n]?'contains'===s[n]?s[n]='may':delete s[n]:s[n]='contains';return s},e.postBoard=function(t,n,s,a,l,c,d){const u=i(s);if(u.length)throw new Error(u[0]);const p={id:d,restaurantId:n,photo:s.photo,app:l,postedBy:a,postedAt:c.toISOString(),items:s.items.map(t=>({...t,name:t.name.trim(),description:t.description.trim()})),allergenCheck:s.items.length?{by:a,at:c.toISOString()}:null};return{current:{...t.current,[n]:p},history:o(t.history,t.current[n],n)}},e.clearBoard=function(t,n){return{current:{...t.current,[n]:null},history:o(t.history,t.current[n],n)}},e.reuseBoard=function(t,n,s,a,i,l,c){const d=t.history.find(t=>t.id===s&&t.restaurantId===n);if(!d)return t;const u={...d,id:c,app:i,postedBy:a,postedAt:l.toISOString(),reusedFrom:d.id,allergenCheck:d.items.length?{by:a,at:l.toISOString()}:null},p={...t,history:t.history.filter(t=>t.id!==s)};return{current:{...t.current,[n]:u},history:o(p.history,t.current[n],n)}},e.deleteFromHistory=function(t,n){return{...t,history:t.history.filter(t=>t.id!==n)}},Object.defineProperty(e,"historyFor",{enumerable:!0,get:function(){return l}}),e.whenText=h,Object.defineProperty(e,"isToday",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"freshness",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"lastUpdated",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"boardSummary",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SAMPLE_ITEMS",{enumerable:!0,get:function(){return k}}),e.seedSpecials=function(n){const s=60*n.getHours()+n.getMinutes()>=702?S(n,0,11,42):new Date(n.getTime()-6e5),a=S(n,1,11,20),i=S(n,3,12,5);return{current:{anchorage:{id:'sb-seed-today',restaurantId:'anchorage',photo:null,items:k,postedAt:s.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:{by:'Head Chef (example)',at:s.toISOString()}}},history:[{id:'sb-seed-yday',restaurantId:'anchorage',photo:null,postedAt:a.toISOString(),postedBy:'Duty Manager (example)',app:'managers',allergenCheck:{by:'Duty Manager (example)',at:a.toISOString()},items:[{id:'sp-y1',name:'Pan-fried sea bass, samphire, brown shrimp butter (sample)',description:'Sample dish.',price:2100,allergens:{fish:'contains',crustaceans:'contains',milk:'contains'}},{id:'sp-y2',name:'Smoked haddock fishcake, poached egg (sample)',description:'Sample dish: with wholegrain mustard sauce.',price:1250,allergens:{fish:'contains',eggs:'contains',gluten:'contains',milk:'contains',mustard:'contains'}},{id:'sp-y3',name:'Lemon posset, shortbread (sample)',description:'Sample pudding.',price:750,allergens:{milk:'contains',gluten:'contains'}}]},{id:'sb-seed-photo',restaurantId:'anchorage',photo:t,items:[],postedAt:i.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:null}]}};const t='sample:chalkboard',n=8;const s=t=>null===t?'Ask your server':`\xa3${(t/100).toFixed(2)}`;function a(t){const n=[];t.name.trim().length<3&&n.push('Add a dish name'),null!==t.price&&(!Number.isFinite(t.price)||t.price<=0||t.price>5e4)&&n.push('Check the price');const s=Object.keys(t.allergens).length;return s||t.noAllergens||n.push('Choose its allergens, or tick \u201cNone of the 14\u201d'),s&&t.noAllergens&&n.push('Allergens chosen and \u201cNone of the 14\u201d both ticked'),n}function i(t){const n=[];return t.photo||t.items.length||n.push('Add a photo of the board or type at least one special'),t.items.forEach((t,s)=>a(t).forEach(t=>n.push(`Special ${s+1}: ${t}`))),t.items.length&&!t.allergensChecked&&n.push('Confirm you have checked the allergens'),n}const o=(t,s,a)=>{if(!s)return t;return[...[s,...t.filter(t=>t.restaurantId===a&&t.id!==s.id)].slice(0,n),...t.filter(t=>t.restaurantId!==a)]};const l=(t,n)=>t.history.filter(t=>t.restaurantId===n),c=t=>String(t).padStart(2,'0'),d=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],p=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate();function h(t,n){const s=new Date(t),a=`${c(s.getHours())}:${c(s.getMinutes())}`;if(p(s,n))return`today at ${a}`;const i=new Date(n);return i.setDate(i.getDate()-1),p(s,i)?`yesterday at ${a}`:`${d[s.getDay()]} ${s.getDate()} ${u[s.getMonth()]} at ${a}`}const m=(t,n)=>p(new Date(t),n),y=(t,n)=>`Updated ${h(t.postedAt,n)}`,f=(t,n)=>`Last updated ${h(t.postedAt,n)} by ${t.postedBy}`,b=t=>[t.photo?'Photo':'',t.items.length?`${t.items.length} typed special${1===t.items.length?'':'s'}`:''].filter(Boolean).join(' + '),S=(t,n,s,a)=>{const i=new Date(t);return i.setDate(i.getDate()-n),i.setHours(s,a,0,0),i},k=[{id:'sp-hake',name:'Grilled hake, crushed new potatoes, salsa verde (sample)',description:'Sample dish: day-boat hake, lemon and caper salsa verde.',price:1950,allergens:{fish:'contains',mustard:'contains',sulphites:'may'}},{id:'sp-scallops',name:'Half-shell scallops, garlic and herb butter (sample)',description:'Sample dish: three scallops grilled in the shell, crusty bread.',price:1400,allergens:{molluscs:'contains',milk:'contains',gluten:'contains'}},{id:'sp-crab',name:'Crab and chilli linguine (sample)',description:'Sample dish: brown and white crab meat, chilli, parsley, lemon.',price:1850,allergens:{crustaceans:'contains',gluten:'contains',eggs:'contains',molluscs:'may'}},{id:'sp-mussels',name:'Mussels in cider and leek cream (sample)',description:'Sample dish: rope-grown mussels, dry cider, leeks, cream. Main with chips.',price:1300,allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',celery:'may'}}]},865,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addressWithoutInvite",{enumerable:!0,get:function(){return u.addressWithoutInvite}}),Object.defineProperty(_e,"inviteFromLocation",{enumerable:!0,get:function(){return u.inviteFromLocation}}),Object.defineProperty(_e,"useSession",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"rosterPerson",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"APP_NAME",{enumerable:!0,get:function(){return S}}),_e.sha256Hex=y,_e.inviteFromText=function(e){const t=e.trim(),n=t.match(/[?&#](?:invite|i)=([A-Za-z0-9_-]{10,})/);return n?n[1]:/^[A-Za-z0-9_-]{10,}$/.test(t)?t:null},_e.personForInvite=async function(e){if(a.IS_ISOLATED_VENUE)return;const t=await y(e);return t?l.ROSTER.find(e=>e.tokenHash===t):void 0},Object.defineProperty(_e,"DEVICE_KEY",{enumerable:!0,get:function(){return p}}),_e.deviceId=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(p);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(p,e)}return e}catch{return null}},Object.defineProperty(_e,"PHONE_KEY",{enumerable:!0,get:function(){return I}}),_e.phoneKey=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(I);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(I,e)}return e}catch{return null}},Object.defineProperty(_e,"START_INVITE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"START_HANDOVER",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"START_KITCHEN",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"START_GO",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"START_LOYALTY_CODE",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"START_TABLE_TOKEN",{enumerable:!0,get:function(){return O}}),_e.appUrl=function(e,t){if('undefined'==typeof window||!window.location)return null;const{origin:n,pathname:o}=window.location,i=o.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/),a=i?i[1]:'/';return`${n}${a}${e}-app/index.html${t?`#invite=${encodeURIComponent(t)}`:''}`},_e.levelJob=function(e,t){const n=(e??'').trim(),o=(t??'').trim();return n?!o||o.toLowerCase().startsWith(n.toLowerCase())?o||n:`${n} \xb7 ${o}`:o};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]),a=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]),u=r(d[7]),f=r(d[8]);const w={getItem:e=>{try{if((0,f.isKitchenViaDisplay)())return Promise.resolve('undefined'!=typeof sessionStorage?sessionStorage.getItem((0,f.kitchenSessionStoreName)()):null)}catch{}return n.default.getItem(e)},setItem:(e,t)=>{try{if((0,f.isKitchenViaDisplay)())return sessionStorage.setItem((0,f.kitchenSessionStoreName)(),t),Promise.resolve()}catch{}return n.default.setItem(e,t)},removeItem:e=>{try{(0,f.isKitchenViaDisplay)()&&sessionStorage.removeItem((0,f.kitchenSessionStoreName)())}catch{}return n.default.removeItem(e)}},h=(0,o.create)()((0,i.persist)(e=>({meId:null,welcomed:{},signIn:t=>e({meId:t,signedInAt:(new Date).toISOString()}),signOut:()=>e({meId:null,signedInAt:void 0}),markWelcomed:t=>e(e=>({welcomed:{...e.welcomed,[t]:(new Date).toISOString()}}))}),{name:c.IS_CAR?'covercharge-car-session-v1':'covercharge-session-v1',storage:(0,i.createJSONStorage)(()=>w),version:c.IS_CAR?2:1,partialize:e=>(0,s.persistedSessionSlice)(c.IS_CAR,e),migrate:e=>c.IS_CAR?(0,s.migrateCarSession)(e):e})),m=e=>!a.IS_ISOLATED_VENUE&&e?l.ROSTER.find(t=>t.id===e):void 0,S={owner:'CoverCharge for Managers',staff:'CoverCharge for Staff',chef:'CoverCharge for Head Chef'};async function y(e){const t=globalThis.crypto?.subtle;if(!t)return null;const n=await t.digest('SHA-256',(new TextEncoder).encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,'0')).join('')}const p=(0,a.venueKey)('covercharge-device-id');const I=(0,a.venueKey)('covercharge-phone-key');const v=(()=>{try{if('undefined'==typeof window||!window.location)return null;if(c.IS_CAR){try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(null,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}return null}const e=(0,a.venueKey)(`cc-pending-invite:${c.APP_VARIANT}`);let t=(0,u.inviteFromLocation)(window.location.search,window.location.hash);try{t?localStorage.setItem(e,t):t=localStorage.getItem(e)}catch{}if(t&&!/^[A-Za-z0-9_-]{10,64}$/.test(t)&&(t=null),t&&window.history?.replaceState){const e=()=>{try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};e();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[?&#]invite=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const t of[300,1e3,2500,5e3,1e4,2e4])setTimeout(e,t)}return t}catch{return null}})(),A=(()=>{try{if('undefined'==typeof window||!window.location||c.IS_CAR)return null;const e=(0,u.handoverFromHash)(window.location.hash);if(!e)return null;const t=()=>{try{/[#&]ccchrome=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};t();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[#&]ccchrome=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const e of[300,1e3,2500,5e3])setTimeout(t,e);return e}catch{return null}})(),b=(()=>{try{if('undefined'==typeof window||!window.location||c.IS_CAR)return null;const e=(0,f.kitchenTicketFromHash)(window.location.hash);if(!e)return null;const t=()=>{try{/[#&]cckitchen=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};t();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[#&]cckitchen=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const e of[300,1e3,2500,5e3])setTimeout(t,e);return e}catch{return null}})(),_=(()=>{try{return'undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('go'):null}catch{return null}})(),T=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('loyalty'):null;return e&&/^[A-Za-z0-9-]{4,12}$/.test(e)?e.toUpperCase():null}catch{return null}})(),O=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('table'):null;return e&&/^[A-Za-z2-9]{16}$/.test(e)?e.toUpperCase():null}catch{return null}})()},866,[1190,995,1191,5,807,1275,15,1274,979]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},867,[31,128,878,818,823,866,1071,845,825,25]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BUILTIN_LOGOS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HERO_LOGOS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"HEADER_LOGO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACCENTS",{enumerable:!0,get:function(){return z}}),_e.useBrandRid=k,_e.useBrand=A,_e.PoweredBy=H,_e.RestaurantLogo=L,_e.RestaurantHero=function({rid:e,size:r=200,showPlace:o=!0}){const c=A(e),u='wildings'===c.rid||'greenside'===c.rid||'kirkton'===c.rid||'abbotsford'===c.rid||(0,t.isQueuedVenue)(c.rid),x='yasmins'===c.rid?c.logo:u?S[c.rid]:c.custom?c.logo:S[c.rid]??c.logo;return(0,p.jsxs)(s.default,{testID:"restaurant-hero",style:{alignItems:'center',gap:6},children:[x?(0,p.jsx)(l.default,{source:x,accessibilityLabel:`${c.name} logo`,style:{width:r,height:r,borderRadius:!u&&c.custom?r/2:0},resizeMode:"contain"}):(0,p.jsx)(L,{rid:c.rid,size:r}),u?null:(0,p.jsx)(n.Text,{testID:"restaurant-hero-name",style:[{fontFamily:f.fonts.semibold,fontSize:26,lineHeight:34,color:f.colours.text,textAlign:'center'},(0,h.webLine)({lineHeight:34},26)],children:c.name}),o&&c.place?(0,p.jsx)(n.Text,{style:[{fontFamily:f.fonts.regular,fontSize:14,lineHeight:20,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:20},14)],children:c.place}):null]})},_e.VenueName=I,_e.RestaurantBrand=function({rid:e,sub:t,size:r=T,nameSuffix:o,beside:l}){const c=A(e);if('display'===x.APP_VARIANT||l)return(0,p.jsx)(s.default,{style:{gap:2,flexShrink:1},children:(0,p.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,p.jsx)(L,{rid:c.rid,size:r}),(0,p.jsxs)(s.default,{style:{flexShrink:1,flex:1,minWidth:0},children:[(0,p.jsx)(I,{name:c.name+(o??''),lines:2,bold:!0}),(0,p.jsx)(s.default,{testID:"display-powered-by",style:{marginLeft:14,marginTop:-1},children:(0,p.jsx)(H,{})}),t?(0,p.jsx)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:c.accentText},(0,h.webLine)({lineHeight:16},12)],children:t}):null]})]})});return(0,p.jsxs)(s.default,{testID:"venue-header-block",dataSet:{centre:'heading'},style:{gap:4,alignItems:'center',alignSelf:'center',maxWidth:420,width:'100%'},children:[(0,p.jsx)(L,{rid:c.rid,size:r}),(0,p.jsx)(I,{name:c.name+(o??'')}),t?(0,p.jsx)(n.Text,{numberOfLines:2,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:16},12)],children:t}):null,(0,p.jsx)(H,{})]})},_e.VenueHeaderBlock=function({rid:e,name:t,badge:r,place:o}){return(0,p.jsxs)(s.default,{testID:"venue-header-block",dataSet:{centre:'heading'},style:{flexDirection:'row',alignItems:'center',justifyContent:'center',alignSelf:'center',gap:12,maxWidth:420,width:'100%'},children:[(0,p.jsx)(L,{rid:e,size:44}),(0,p.jsxs)(s.default,{style:{flexShrink:1,minWidth:0,alignItems:'center',gap:2},children:[(0,p.jsx)(I,{name:t}),(0,p.jsx)(s.default,{testID:"app-badge",accessibilityLabel:`${r} app`,style:{borderWidth:1,borderColor:f.colours.gold,borderRadius:6,paddingHorizontal:6,paddingVertical:1},children:(0,p.jsx)(n.Text,{style:[{fontFamily:f.fonts.bold,fontSize:10,lineHeight:14,color:f.colours.gold,textAlign:'center'},(0,h.webLine)({lineHeight:14},10)],children:r})}),o?(0,p.jsx)(n.Text,{testID:"venue-header-place",dataSet:{centre:'heading'},style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:f.colours.muted,textAlign:'center'},(0,h.webLine)({lineHeight:16},12)],children:o}):null,(0,p.jsx)(H,{})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=e(_r(d[3])),l=e(_r(d[4]));_r(d[5]);var s=e(_r(d[6])),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),x=_r(d[11]),b=_r(d[12]),y=_r(d[13]),j=_r(d[14]),p=_r(d[15]);const w={"3idiots":_r(d[16]),cecchinis:_r(d[17]),mrbasrais:_r(d[18]),yasmins:_r(d[19]),williewastles:_r(d[20]),rupeeroom:_r(d[21]),smokinggoat:_r(d[22]),pizzaioli:_r(d[23]),drunkencoo:_r(d[24]),abbotsford:_r(d[25]),kirkton:_r(d[26]),greenside:_r(d[27]),wildings:_r(d[28]),kirkmichael:_r(d[29]),souters:_r(d[30]),anchorage:_r(d[31]),saltmarsh:_r(d[32]),brae:_r(d[33])},S={"3idiots":_r(d[34]),cecchinis:_r(d[35]),mrbasrais:_r(d[36]),yasmins:_r(d[37]),williewastles:_r(d[38]),rupeeroom:_r(d[39]),smokinggoat:_r(d[40]),pizzaioli:_r(d[41]),drunkencoo:_r(d[42]),abbotsford:_r(d[43]),kirkton:_r(d[44]),greenside:_r(d[45]),wildings:_r(d[46]),kirkmichael:_r(d[47]),souters:_r(d[30]),anchorage:_r(d[48])};y.PITCH&&!y.PITCH_ANCHORAGE&&(delete w.anchorage,delete S.anchorage);const T=48,z=['#CFA45F','#D4AF61','#C9A24A','#E2C489','#F2EDE4','#A88B5A','#B08D57','#D9774B'];function k(e){const t=(0,r.useGlobalSearchParams)(),n=(0,u.useOwner)(e=>e.site),o='string'==typeof t.rid?t.rid:void 0;return b.IS_ISOLATED_VENUE?b.VENUE_RID:e??o??n??b.VENUE_RID}function A(e){const t=k(e),n=(0,c.useStore)(e=>e.restaurants.find(e=>e.id===t)),r=(0,u.useOwner)(e=>e.branding[t]),l=r?.logoUri?{uri:r.logoUri}:w[t],s=r?.accent??f.colours.gold,h=o.default.useMemo(()=>(0,j.checkAccent)(s,f.colours.bg,f.colours.onGold,f.colours.text),[s]);return{rid:t,name:n?.name??'Restaurant',place:n?.location??'',logo:l,accent:s,accentText:h.accentText,onAccent:h.onAccent,custom:!!r?.logoUri}}function H({size:e=10}){return(0,p.jsxs)(n.Text,{accessibilityLabel:"powered by CoverCharge",style:[{fontFamily:f.fonts.regular,fontSize:e,lineHeight:Math.round(1.35*e),color:f.colours.muted,textAlign:'center'},(0,h.webLine)({lineHeight:Math.round(1.35*e)},e)],children:["powered by ",(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.text},children:"Cover"}),(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.gold},children:"Charge"})]})}function L({rid:e,size:t=T}){const r=A(e);if(r.logo)return(0,p.jsx)(l.default,{source:r.logo,accessibilityLabel:`${r.name} logo`,style:{width:t,height:t,borderRadius:r.custom?t/2:0},resizeMode:"contain"});const o=r.name.replace(/^The /,'').split(/\s+/).map(e=>e[0]).join('').slice(0,2).toUpperCase();return(0,p.jsx)(s.default,{accessibilityLabel:`${r.name} logo`,style:{width:t,height:t,borderRadius:t/2,borderWidth:2,borderColor:r.accentText,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(n.Text,{style:{fontFamily:f.fonts.bold,color:r.accentText,fontSize:.36*t},children:o})})}function I({name:e,size:t=17,lines:r,bold:o}){return(0,p.jsx)(n.Text,{testID:"venue-header-name",accessibilityRole:"header",accessibilityLabel:e,numberOfLines:r,style:[{fontFamily:o?f.fonts.bold:f.fonts.semibold,fontSize:t,lineHeight:Math.ceil(1.35*t),color:f.colours.text,textAlign:'center',flexShrink:1,minWidth:0},(0,h.webLine)({lineHeight:Math.ceil(1.35*t)},t),{overflowWrap:'normal',wordBreak:'keep-all'}],children:e})}},868,[6,874,805,31,197,123,128,823,863,825,1348,807,5,2,1346,25,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PUB_LOCATIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"privateClockVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"pubLocation",{enumerable:!0,get:function(){return s}}),e.venueClockArea=function(a,o={}){if((0,t.isQueuedVenue)(a)&&!t.queuedVenues[a].clockArea.on)return(0,n.cleanArea)({...o,on:!0===o.on&&'number'==typeof o.lat&&'number'==typeof o.lng,offRotaPrompt:!1});const l=s(a);if(!l)return(0,n.cleanArea)(o);const c=(0,n.cleanArea)({lat:l.lat,lng:l.lng,radius:150,...o});return{...c,lat:c.lat??l.lat,lng:c.lng??l.lng,on:!0,offRotaPrompt:!1}},e.venueClockGeo=l,e.privateAttendance=function(n,a){if(!o(n)&&!(0,t.isQueuedVenue)(n))return a;const s={...a};for(const t of['lat','lng','latitude','longitude','coords','position','location','acc','dist','accuracy','distance','outSite'])delete s[t];a.geo&&(s.geo=a.geo.map(t=>l(n,t)).filter(t=>!!t));return s};var t=r(d[0]),n=r(d[1]);const a={"3idiots":{name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",lat:55.4650286,lng:-4.6283062,source:"Verified exact-address venue pack"},cecchinis:{name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",lat:55.461505,lng:-4.6345736,source:"Verified exact-address venue pack"},williewastles:{name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",lat:55.4646261,lng:-4.6323929,source:"Verified exact-address venue pack"},smokinggoat:{name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",lat:55.464226,lng:-4.6326035,source:"Verified exact-address venue pack"},drunkencoo:{name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",lat:55.4570308,lng:-4.6294663,source:"Verified exact-address venue pack"},abbotsford:{name:'The Abbotsford Hotel',address:'14 Corsehill Road, Ayr KA7 2ST',lat:55.4488797,lng:-4.6314856,source:'Official FSA1696388, exact address match verified6 Nov2026'},kirkton:{name:'The Kirkton Inn',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',lat:55.3971215,lng:-4.5920177,source:'Public FSA establishment1955433 verified6 November2026'},greenside:{name:'The Greenside Restaurant',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',lat:55.3542369,lng:-4.6851418,source:'Official Find us Google Maps link, place point, verified 6 November 2026'},kirkmichael:{name:'The Kirkmichael Arms',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',lat:55.3458202,lng:-4.6180793,source:'venue-profile.json geo, matched to the venue address'},souters:{name:"Souter\u2019s Inn",address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',lat:55.3297218,lng:-4.7772979,source:'Food Standards Agency establishment 1863840, address matched'}},o=t=>Object.prototype.hasOwnProperty.call(a,t),s=t=>o(t)?a[t]:void 0;function l(n,a){return o(n)||(0,t.isQueuedVenue)(n)?'in'===a.action?{action:'in',at:a.at,inside:a.inside,...a.override?{override:{by:a.override.by,byId:a.override.byId,reason:a.override.reason}}:{}}:void 0:a}},869,[6,870]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_RADIUS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_RADIUS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ACCURACY_CAP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_BREAK_OPTIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_CLOCK_AREA",{enumerable:!0,get:function(){return r}}),e.distanceM=s,Object.defineProperty(e,"validLat",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validLng",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"areaSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"clampRadius",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"accuracyAllowance",{enumerable:!0,get:function(){return p}}),e.isInside=h,e.cleanArea=function(t){const n=(t.breakOptions??a).map(t=>Math.round(Number(t))).filter(t=>Number.isFinite(t)&&t>0&&t<=180);return{...r,...t,lat:c(t.lat)?t.lat:null,lng:l(t.lng)?t.lng:null,radius:f(t.radius??r.radius),on:!1!==t.on,offRotaPrompt:!1!==t.offRotaPrompt,breakOptions:[...new Set(n)].sort((t,n)=>t-n).slice(0,12),offRotaTitle:(t.offRotaTitle??'').trim().slice(0,80)||r.offRotaTitle,offRotaBody:(t.offRotaBody??'').trim().slice(0,160)||r.offRotaBody}},Object.defineProperty(e,"ACTION_WORD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DENIED_TEXT",{enumerable:!0,get:function(){return m}}),e.gate=function(t,n,o,a,r="browser"){if(!t.on||!d(t)){const r={action:n,at:a,inside:null,unchecked:!0};return'object'==typeof o&&Object.assign(r,{lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc)}),{allowed:!0,geo:r,warn:t.on?'The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':void 0}}if('object'!=typeof o){const t='app-phone-off'===r?m['app-phone-off']:'denied'===o?m[r]:'timeout'===o?'Your phone couldn\u2019t find your location in time. Step outside or near a window and try again.':'unsupported'===o?'This phone or browser can\u2019t share its location. Ask a manager to record it for you.':'Your phone couldn\u2019t find your location. Check Location is on, then try again.';return{allowed:!1,message:`You need to be at the venue to ${b[n]}. ${t}`,geo:{action:n,at:a,inside:!1}}}const u=h(t,o),s={action:n,at:a,lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc),dist:u.dist,inside:u.inside};if(u.inside)return{allowed:!0,geo:s};const c=u.dist>=1e3?`${(u.dist/1e3).toFixed(1)} km`:`${u.dist} m`;return{allowed:!1,geo:s,message:`You need to be at the venue to ${b[n]}. You look to be about ${c} away (allowed ${u.limit} m). If you\u2019re at the venue, try again in a moment or ask a manager to record it for you.`}},e.overrideGeo=function(t,n,o,a){const r=a.trim();return r.length<3?null:{action:t,at:n,inside:null,override:{by:o.name,byId:o.id,reason:r.slice(0,200)}}},e.offRotaDue=function(t){return!(!(t.area.offRotaPrompt&&d(t.area)&&t.inside)||t.clockedIn||t.dismissedToday)&&!t.shifts.some(n=>t.nowHours>=n.start-1&&t.nowHours<(n.end<=n.start?n.end+24:n.end))},Object.defineProperty(e,"breakLabel",{enumerable:!0,get:function(){return O}});const t=50,n=2e3,o=50,a=[5,10,15,20,30,45,60],r={lat:null,lng:null,radius:100,on:!0,breakOptions:[...a],offRotaPrompt:!0,offRotaTitle:'Do you want to sign in?',offRotaBody:'Should you be on the rota?'},u=t=>t*Math.PI/180;function s(t,n){const o=u(n.lat-t.lat),a=u(n.lng-t.lng),r=Math.sin(o/2)**2+Math.cos(u(t.lat))*Math.cos(u(n.lat))*Math.sin(a/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(r)))}const c=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-90&&t<=90,l=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-180&&t<=180,d=t=>c(t.lat)&&l(t.lng),f=o=>Number.isFinite(o)?Math.min(n,Math.max(t,Math.round(o))):r.radius,p=t=>Number.isFinite(t)&&t>0?Math.min(t,o):0;function h(t,n){const o=s({lat:t.lat,lng:t.lng},n),a=f(t.radius)+p(n.acc);return{inside:o<=a,dist:Math.round(o),limit:Math.round(a)}}const b={in:'clock in',out:'clock out',break_start:'start a break',break_end:'end your break'},m={browser:'Location is turned off for this browser. Turn it on in your phone\u2019s settings (Location \u203a allow for this browser), then try again.',iphone:'Location is turned off for this app. On your iPhone open Settings \u203a Privacy & Security \u203a Location Services \u203a Safari Websites and choose While Using the App, then try again.',app:'Location is turned off for this app. Tap Open app settings, then Permissions \u203a Location \u203a Allow only while using the app. Then come back and try again.','app-old':'This version of the app can\u2019t use location. Tap Update the app at the bottom of the screen, then tap Allow when your phone asks.','app-phone-off':'Location is switched off on your phone. Tap Open location settings, turn on Use location, then come back and try again.'};const y=t=>Math.round(1e6*t)/1e6;const O=t=>60===t?'1 hour':t%60==0?t/60+" hours":t>60?`${Math.floor(t/60)} h ${t%60} min`:`${t} min`},870,[]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},871,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FETCH_TIMEOUT_MS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"READER_TIMEOUT_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"fetchLimitMs",{enumerable:!0,get:function(){return _}}),_e.fetchWithTimeout=S,_e.getSupabase=function(){if(c)return c;if(!(0,s.isSupabaseConfigured)())throw new Error('Supabase is not configured: set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in .env.local');return c=(0,o.createClient)(s.SUPABASE_URL,s.SUPABASE_ANON_KEY,{auth:{storage:n.default,persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!1,storageKey:`${(0,u.syncNamespace)()}auth`},realtime:{params:{eventsPerSecond:10}},global:{fetch:S}}),c},_e.setSupabaseClient=function(e){c=e};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),u=r(d[3]);let c=null;const f=2e4,l=15e4,b=/\/functions\/v1\/(delivery-read|plan-photo-read)(\?|$)/,_=e=>b.test(e)?l:/\/storage\/v1\//.test(e)?12e4:f;function S(e,t){const n='string'==typeof e?e:e instanceof URL?e.href:e.url,o=_(n);if('undefined'==typeof AbortController)return fetch(e,t);const s=new AbortController,u=t?.signal;u&&(u.aborted?s.abort():u.addEventListener('abort',()=>s.abort(),{once:!0}));const c=setTimeout(()=>s.abort(),o);return fetch(e,{...t,signal:s.signal}).catch(e=>{if(s.signal.aborted&&!u?.aborted)throw new TypeError(`Failed to fetch (network timeout after ${o/1e3} s)`);throw e}).finally(()=>clearTimeout(c))}},872,[1190,1226,1170,1268]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedSessions=o,e.queuedRequestSlots=u,e.queuedRequestError=function(t,o,s,a=new Date){if(o.name.trim().length<2||o.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(o.phone)||!/^[0-9]{7,15}$/.test(o.phone.replace(/\D/g,''))||o.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email))return'Enter your name, phone number and email.';if(o.notes.length>2e3)return'Keep notes under 2000 characters.';const c=(0,n.localDate)(a),d=(0,n.localDate)(new Date(+a+63072e6));if(!o.date||o.dated||!u(t,o.date,s).includes(o.time||''))return'Choose a future date and a time within confirmed kitchen service hours.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return o.date===c&&(o.time||'')<=l?'Choose a future time.':!Number.isInteger(o.covers)||o.covers<1||o.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]),n=r(_d[1]);function o(n){const o=t.queuedVenues[n];return o?.kitchenSessionsByDay??o?.hours.sessionsByDay??void 0}const s=t=>60*+t.slice(0,2)+ +t.slice(3);function u(n,u,a){if(!/^\d{4}-\d{2}-\d{2}$/.test(u))return[];const c=new Date(u+'T12:00:00Z');if(!Number.isFinite(+c)||c.toISOString().slice(0,10)!==u)return[];const d=(a??o(n))?.[c.getUTCDay()];if(!Array.isArray(d))return[];const l=[],f=t.queuedVenues[n]?.booking.lastSittingMinutesBeforeClose??0;for(const t of d){if(!Array.isArray(t)||2!==t.length||!t.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))continue;const n=s(t[0]),o=s(t[1]);if(!(n>=o))for(let t=n;t(0,t.getSupabase)();const s=e=>{const t=String(e?.message||'');return/^(Requests are not enabled|Too many|Please complete|Enter your|Choose |This request|Only this venue)/.test(t)?t:'Unable to send or load requests. Check your connection and try again, or call the hotel.'}},875,[6,872]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_BG",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SOUTERS_SURFACE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_TYPE_SCALE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"soutersFont",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"soutersSurface",{enumerable:!0,get:function(){return f}}),e.soutersInk=function(o){if(!t.IS_SOUTERS)return o;const c=(0,n.normaliseHex)(o);return c?'#A4622E'===c?'#D9AD8A':(0,n.contrast)(c,u)<4.5?'#FFFFFF':o:o};var t=r(d[0]),n=r(d[1]);const u='#56152A',o='#43122F',c=.88,S=n=>t.IS_SOUTERS?Math.round(n*c*100)/100:n,f=n=>t.IS_SOUTERS?o:n},876,[5,1346]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.specialsBoardSpec=function(r,s){return{name:'specials_boards',table:'specials_boards',conflict:'venue_id',deletes:!1,list:()=>[{id:r,board:t.useSpecials.getState().current[r]??null}],key:()=>r,rowKey:()=>r,syncable:t=>!t.board||!String(t.board.id).startsWith('sb-seed'),writable:s,toRow:(t,s)=>({venue_id:s,doc:{board:t.board?{...t.board,restaurantId:r}:null},updated_at:(new Date).toISOString()}),fromRow:t=>({id:r,board:t.doc?.board??null}),apply:s=>{const n=s[0];if(!n)return;const o=n.board;o&&o.restaurantId&&o.restaurantId!==r||t.useSpecials.setState(t=>({current:{...t.current,[r]:o}}))},subscribe:r=>t.useSpecials.subscribe((t,s)=>{t.current!==s.current&&r()})}},Object.defineProperty(e,"specialsSyncOn",{enumerable:!0,get:function(){return c}}),e.watchGuestSpecials=function(c,l=()=>{}){if(!r.RELEASE.specialsSync||!(0,n.isSupabaseConfigured)())return()=>{};let u=!1;const p=async()=>{const r=t.useSpecials.getState().current[c]??null;let n;try{const t=(0,o.getSupabase)(),{data:r,error:l}=await t.rpc('guest_specials',{p_slug:c});if(l)n={ok:!1,message:s.GUEST_SPECIALS_OFFLINE};else if(r&&'object'==typeof r){const t=r,s='string'==typeof t.postedAt?t.postedAt:'',o=Array.isArray(t.items)?t.items:[],l=t.photo??null;n=s||l||o.length?{ok:!0,board:{id:`sb-sync-${c}`,restaurantId:c,photo:l,items:o,postedAt:s||new Date(0).toISOString(),postedBy:'',app:'managers',allergenCheck:null}}:{ok:!0,board:null}}else n={ok:!0,board:null}}catch{n={ok:!1,message:s.GUEST_SPECIALS_OFFLINE}}if(u)return;const p=(0,s.guestSpecialsAfter)(t.useSpecials.getState().current[c]??null,n);p.board!==r&&t.useSpecials.setState(t=>({current:{...t.current,[c]:p.board}})),l(p.note)};p();const S=setInterval(()=>{p()},6e4);return()=>{u=!0,clearInterval(S)}};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),n=_r(d[3]),o=_r(d[4]);const c=()=>r.RELEASE.specialsSync},877,[864,1068,1297,1170,872]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},878,[31,128,1496,825,25]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.forecastToday=function(u,c,h,f,p,v){const k=(0,e.venueBusy)(u,c,p),M=(0,a.examplesAllowed)(),b=(0,n.clampWeeks)(u.settings.forecastMinWeeks),w=M?null:v??(0,n.buildHistory)(u.id,c,h,[],p,b),H=M||!!w?.enough,O=(0,r.hoursFor)(u,p),S=[],C=(0,s.ymd)(p);let I=1;for(const e of f.filter(e=>e.date===C&&(null===e.restaurantId||e.restaurantId===u.id)))S.push(e.title.replace(/\s*\(substitute day\)/gi,'')),!1!==e.busier&&(I*='bank-holiday'===e.kind?1.25:'event'===e.kind?1.15:1.1);if(!O)return{busy:k,open:!1,hours:[],restOfDay:{covers:0,low:0,high:0,takeaway:0,booked:0},flags:S,suggestions:['Kitchen closed today (per listed hours).'],multiplier:I,example:M,enough:H,minWeeks:b};const x=M?o.EXAMPLE_HISTORY[u.id]??o.EXAMPLE_HISTORY.default:H&&w?w:{covers:{},takeaway:{}},E=p.getDay(),N=l(u,p),$=(0,t.lastFoodOn)(u,C);let _=O.close.getMinutes()>0?O.close.getHours():O.close.getHours()-1;if($){const[e,t]=$.time.split(':').map(Number);_=Math.min(_,t>0?e:e-1),'kitchen closes'!==$.reason&&S.push(`Last food orders ${$.time} (${$.reason})`)}const P=c.filter(e=>e.restaurantId===u.id&&e.date===C&&['confirmed','seated','finished'].includes(e.status)),T=P.filter(e=>!e.walkIn&&'finished'!==e.status).map(e=>Number(e.time.slice(0,2))),A=Math.min(N[0],O.open.getHours(),...T),L=Math.max(N[1],_,...T),R=[];for(let e=A;e<=L;e++){const t=e>=O.open.getHours()&&e<=_,o=x.covers[E]?.[e]??0,r=x.takeaway[E]?.[e]??0,a=P.filter(t=>!t.walkIn&&'finished'!==t.status&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),n=P.filter(t=>t.walkIn&&['seated','finished'].includes(t.status)&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),i=t?Math.round(o*u.settings.walkInShare*I):0,c=H&&t?Math.max(0,Math.round(o*I*(1-u.settings.walkInShare))-a):0,l=Math.max(n,i)+c,f=a+l,p=h.filter(t=>t.restaurantId===u.id&&'takeaway'===t.type&&'cancelled'!==t.status&&t.slotTime&&new Date(t.slotTime).getHours()===e&&(0,s.ymd)(new Date(t.slotTime))===C).length,y=t?Math.max(p,Math.round(r*I)):p;R.push({hour:e,booked:a,walkIns:l,covers:f,coversLow:H?Math.round(.8*f):f,coversHigh:H?Math.round(1.2*f):f,takeawayPlaced:p,takeaway:y,historicalCovers:o})}const D=y(u,E);if(H&&D){const e=D-R.reduce((e,t)=>e+t.covers,0),t=R.filter(e=>e.hour>=O.open.getHours()&&e.hour<=_);if(e>0&&t.length){const o=t.map(e=>e.historicalCovers),r=i(e,o.reduce((e,t)=>e+t,0)>0?o:t.map(()=>1));t.forEach((e,t)=>{const o=r[t];o&&(e.floorAdded=o,e.walkIns+=o,e.covers+=o,e.coversHigh=Math.max(e.coversHigh,Math.round(1.2*e.covers)))})}const o=R.reduce((e,t)=>e+t.coversLow,0);if(oMath.max(1,e.covers)));t.forEach((t,o)=>{t.coversLow=Math.min(t.covers,t.coversLow+e[o])})}}const j=p.getHours()+(p.getMinutes()>=30?1:0),W=R.filter(e=>e.hour>=j),F=W[0],B=e=>W.reduce((t,o)=>t+e(o),0),G={covers:B(e=>e.covers),low:B(e=>e.coversLow),high:B(e=>e.coversHigh),takeaway:B(e=>e.takeaway),booked:B(e=>e.booked)},z=[],V=u.settings.capacityPerHour,X=W.reduce((e,t)=>!e||t.covers>e.covers?t:e,void 0);X&&X.covers>=.85*V&&z.push(`Dining room near capacity around ${String(X.hour).padStart(2,'0')}:00 (about ${X.covers} of ${V} covers) \u2014 consider pausing or capping takeaway slots then.`);const Y=W.find(e=>e.historicalCovers>0&&e.covers>1.1*e.historicalCovers);Y&&z.push(`Busier than a usual ${['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][E]} from ${String(Y.hour).padStart(2,'0')}:00 \u2014 consider one more on the floor.`);G.takeaway>=10&&z.push(`About ${G.takeaway} takeaway orders expected \u2014 prep extra haddock and chips.`);H||z.unshift(`Not enough history yet. ${(0,a.notEnoughTip)(b)}`);z.length||z.push('Looks like a normal service \u2014 no action suggested.');return{busy:k,open:!0,nextHour:F,hours:R,restOfDay:G,flags:S,suggestions:z,multiplier:I,example:M,enough:H,minWeeks:b,minCovers:D??void 0}},_e.spread=i,Object.defineProperty(_e,"ANCHORAGE_FORECAST_HOURS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"forecastHoursOf",{enumerable:!0,get:function(){return c}}),_e.forecastWindow=l,Object.defineProperty(_e,"ANCHORAGE_MIN_COVERS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"MIN_COVERS_NOTE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"minCoversOf",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"minCoversOn",{enumerable:!0,get:function(){return y}}),_e.coversRange=function(e,t,o=!0){const r=Math.min(e,t),s=Math.max(e,t),a=r===s?String(r):`${r} to ${s}`;return o?`${a} ${1===s?'Cover':'Covers'}`:a};var e=_r(d[0]),t=_r(d[1]),o=_r(d[2]),r=_r(d[3]),s=_r(d[4]),a=_r(d[5]),n=_r(d[6]);function i(e,t){const o=t.reduce((e,t)=>e+t,0)||1,r=t.map(t=>e*t/o),s=r.map(Math.floor);let a=e-s.reduce((e,t)=>e+t,0);return r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]).forEach(([,e])=>{a>0&&(s[e]++,a--)}),s}const u={0:['12:00','22:00'],1:null,2:null,3:['12:00','22:00'],4:['12:00','22:00'],5:['12:00','22:00'],6:['12:00','22:00']},c=e=>e.settings.forecastHours??('anchorage'===e.id?u:{});function l(e,t){const o=(0,r.hoursFor)(e,t),s=o.close.getMinutes()>0?o.close.getHours():o.close.getHours()-1,a=c(e)[t.getDay()];if(!a)return[o.open.getHours(),s];const[n]=a[0].split(':').map(Number),[i,u]=a[1].split(':').map(Number);return[Math.min(n,o.open.getHours()),Math.max(u>0?i:i-1,s)]}const h={0:50,6:50},f='Gordon, 4 Nov 2026',p=e=>e.settings.minCoversByDay??('anchorage'===e.id?h:{}),y=(e,t)=>{const o=p(e)[t];return o&&o>0?Math.round(o):null}},879,[933,814,1441,833,822,1218,1093]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.estimateWait=function(t,n,u){const o=Math.max(6,Math.round(n/6*u));return t*o}},880,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return y.uuid}}),_e.nowFrom=S,_e.linesFromBasket=w,Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return u.DEMO_CUSTOMER_ID}});var e,t=_r(d[0]),a=_r(d[1]),r=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),o=(e=i)&&e.__esModule?e:{default:e},l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),g=_r(d[9]),m=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),k=_r(d[14]),y=_r(d[15]);const $=(e,t,a)=>e.reduce((e,a)=>a.startsWith(t)?Math.max(e,Number(a.slice(t.length))||0):e,a)+1,I=e=>`${e}-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-3)}`;function S(e){return'live'===e.mode?new Date:new Date(e.simStartMs+(Date.now()-e.anchorRealMs))}function h(){const e=(0,u.defaultSimStart)();return{clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},...(0,u.buildSeed)(e),outbox:[],msgTemplates:{}}}function w(e,t,a){return e.lines.flatMap(e=>{const r=t.find(t=>t.id===e.itemId);if(!r)return[];const n=(0,b.resolveItem)(r),s=(n.optionGroups??[]).flatMap(t=>t.choices.filter(t=>e.choiceIds.includes(t.id))),i=(n.price??0)+s.reduce((e,t)=>e+t.priceDelta,0),o=(0,p.conflictsFor)((0,p.effectiveAllergens)(n,e.choiceIds),a);return[{itemId:n.id,name:n.name,qty:e.qty,unitPrice:i,choices:s.map(e=>e.label),notes:e.notes,contains:o.contains,may:o.may,overridden:!!e.override&&o.contains.every(t=>e.override.allergens.includes(t)),prepMins:n.prepMins,choiceIds:s.map(e=>e.id)}]})}const O=e=>{const t='ABCDEFGHJKLMNPQRSTUVWXYZ23456789',a=()=>Array.from({length:4},()=>t[Math.floor(32*Math.random())]).join('');return`${e}-${a()}-${a()}-${a()}`},C=(0,l.create)()((0,c.persist)((e,t)=>{const a=()=>S(t().clock),r=(t,r,n)=>e(e=>({audit:[{id:I('au'),restaurantId:t,at:a().toISOString(),kind:r,text:n},...e.audit].slice(0,300)})),n=(a,n,s)=>{if(!a||s<=0)return 0;const i=t().giftCards.find(e=>e.code===a&&e.restaurantId===n);if(!i||i.balance<=0)return 0;const o=Math.min(i.balance,s);return e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-o}:e)})),r(n,'giftcard',`Gift card ${a.slice(0,8)}\u2026 redeemed \xa3${(o/100).toFixed(2)} (balance \xa3${((i.balance-o)/100).toFixed(2)})`),o},s=e=>{const a=t().restaurants.find(t=>t.id===e.restaurantId);a&&e.customerId===t().customer.id&&e.subtotal>=a.settings.stampMinSpend&&t().addStamp(e.restaurantId,e.customerId,'takeaway'===e.type?'Takeaway (auto on collection)':'Table QR bill (auto on payment)')},i=e=>(0,f.templatesFor)(t().msgTemplates[e]),o=a=>{a.length&&(e(e=>({outbox:[...a,...e.outbox].slice(0,300)})),(0,f.deliverQueued)(a.filter(e=>'queued'===e.status),(e,a)=>t().updateOutbox(e,a)))},l=(e,r)=>{const n=t().restaurants.find(e=>e.id===r.restaurantId);n&&o((0,f.composeBooking)(e,r,n,i(n.id),a().toISOString()))},c=e=>{const r=t().restaurants.find(t=>t.id===e.restaurantId);r&&o((0,f.composeOrder)(e,r,i(r.id),a().toISOString()))};return{...h(),resetDemo:()=>e(h()),setClockMode:()=>e({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),skipMinutes:()=>{},updateCustomer:t=>e(e=>({customer:{...e.customer,...t}})),setAllergy:(t,a)=>e(e=>{const r=e.customer.allergies.filter(e=>e.allergen!==t);return{customer:{...e.customer,allergies:a?[...r,{allergen:t,severity:a}]:r}}}),startBasket:(t,a,r)=>e(e=>{const n=e.basket.restaurantId===t&&e.basket.mode===a&&e.basket.tableNo===r;return{basket:{restaurantId:t,mode:a,tableNo:r,lines:n?e.basket.lines:[]}}}),addLine:t=>e(e=>({basket:{...e.basket,lines:[...e.basket.lines,{...t,key:I('ln')}]}})),setLineQty:(t,a)=>e(e=>({basket:{...e.basket,lines:a<=0?e.basket.lines.filter(e=>e.key!==t):e.basket.lines.map(e=>e.key===t?{...e,qty:a}:e)}})),overrideLine:(t,r)=>e(e=>({basket:{...e.basket,lines:e.basket.lines.map(e=>e.key===t?{...e,override:{allergens:r,at:a().toISOString()}}:e)}})),clearBasket:()=>e(e=>({basket:{...e.basket,lines:[]}})),placeOrder:({slotTime:n,tip:s,notes:i,phone:o,email:l,customerName:u})=>{const g=t(),m=g.basket,p=m.restaurantId,b=w(m,g.menu,g.customer.allergies),f=b.reduce((e,t)=>e+t.unitPrice*t.qty,0),k='table'===m.mode,I=$(g.orders.filter(e=>e.restaurantId===p).map(e=>e.ref),k?'Q-':'T-',k?g.counters.table:g.counters.order),S=!k,h=f+(S?0:s),O=(u??'').trim()||g.customer.name,C={id:(0,y.uuid)(),ref:`${k?'Q':'T'}-${I}`,restaurantId:p,customerId:g.customer.id,customerName:O,type:m.mode,tableNo:m.tableNo,slotTime:n,lines:b,subtotal:f,tip:S?0:s,giftCardApplied:0,giftCardCode:void 0,total:h,paid:0,status:S?'awaiting_payment':'new',createdAt:a().toISOString(),allergies:g.customer.allergies,readiness:{},notes:i,channel:'app',...'takeaway'===m.mode?{phone:o??g.customer.phone,email:l??g.customer.email}:{}};e(e=>({orders:[C,...e.orders],basket:{...e.basket,lines:[]},counters:k?{...e.counters,table:I}:{...e.counters,order:I}}));const v=b.filter(e=>e.overridden);return r(p,'order',`Order ${C.ref} placed (${k?`Table ${m.tableNo}`:'takeaway'})${v.length?` \u2014 ALLERGY OVERRIDE on ${v.map(e=>e.name).join(', ')}`:''}`),C.allergies.length&&r(p,'allergy',`Allergies declared and confirmed by customer on ${C.ref}: ${C.allergies.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),'awaiting_payment'!==C.status&&c(C),C},setOrderStatus:(a,n,i)=>{const o=t().orders.find(e=>e.id===a);o&&((0,k.statusBlock)(o,n,(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===a?{...e,status:n}:e)})),r(o.restaurantId,'order',`${o.ref} \u2192 ${n}${i?` by ${i}`:''}`),'collected'===n&&'takeaway'===o.type&&s(o)))},ackOrderAllergy:(n,s)=>{const i=t().orders.find(e=>e.id===n);if(!i||!(0,k.canSign)(i,'kitchen',(0,k.linkedBooking)(i,t().bookings)))return;const o={by:s,at:a().toISOString()};e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyAck:o,status:'new'===e.status?'acknowledged':e.status}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 3/5 Kitchen on ${i.ref}: ${s} (chef signed off before cooking)`)},tickOrderAllergy:(n,s,i,o=!0)=>{const l=t().orders.find(e=>e.id===n);if(!l)return;const c={...l.allergyTicks??{}};o?c[s]={by:i,at:a().toISOString()}:delete c[s],e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyTicks:c}:e)})),r(l.restaurantId,'allergy',`${l.ref}: kitchen ${o?'confirmed':'unticked'} ${s} (${i})`)},ackReadiness:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);o&&('cook'===s&&(0,k.statusBlock)(o,'preparing',(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,readiness:{...e.readiness,[s]:{by:i,at:a().toISOString()}},status:'cook'===s&&['new','acknowledged'].includes(e.status)?'preparing':e.status}:e)})),r(o.restaurantId,'order',`${o.ref}: ${'cook'===s?'started cooking':'bagged'} (${i})`)))},handoverCheck:(n,s)=>{const i=t().orders.find(e=>e.id===n);i&&(0,k.canSign)(i,'table',(0,k.linkedBooking)(i,t().bookings))&&(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,handoverCheck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 5/5 Table on ${i.ref}: ${s} (served and checked with the guest; chain complete)`))},signAllergyStep:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o||!i.trim())return!1;const l=(0,k.linkedBooking)(o,t().bookings);if(!(0,k.canSign)(o,s,l))return!1;if('kitchen'===s)return t().ackOrderAllergy(n,i),!0;if('table'===s)return t().handoverCheck(n,i),!0;const c={by:i,at:a().toISOString()};'booked'===s&&l&&l.allergies.length&&!l.allergyAck?e(e=>({bookings:e.bookings.map(e=>e.id===l.id?{...e,allergyAck:c}:e)})):e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyChain:{...e.allergyChain,[s]:c}}:e)}));const u=(0,k.stepInfo)(s);return r(o.restaurantId,'allergy',`Allergen sign-off ${u.n}/5 ${u.label} on ${o.ref}: ${i} (${u.what.toLowerCase()})`),!0},customerSignal:(t,a)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,customerSignal:a}:e)})),setSplit:(t,a,r)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,tip:r,total:e.subtotal+r,split:{ways:a,paidShares:e.split?.paidShares??0}}:e)})),payTable:(a,{shares:i,giftCardCode:o})=>{const l=t().orders.find(e=>e.id===a);if(!l)return;const c=l.split?.ways??1,u=Math.ceil(l.total/c),g=Math.min(c,(l.split?.paidShares??0)+i),m=g>=c,p=m?l.total-l.paid:Math.min(l.total-l.paid,u*i),b=n(o,l.restaurantId,p),f={...l,giftCardApplied:l.giftCardApplied+b,giftCardCode:b?o:l.giftCardCode,paid:l.paid+p,split:{ways:c,paidShares:g},status:m?'closed':l.status};e(e=>({orders:e.orders.map(e=>e.id===a?f:e)})),r(l.restaurantId,'order',`${l.ref} (Table ${l.tableNo}) ${m?'bill paid in full':`share ${g}/${c} paid`} (paid at the till)`),m&&s(f)},createBooking:n=>{const s=$(t().bookings.filter(e=>e.restaurantId===n.restaurantId).map(e=>e.ref),'BK-',t().counters.booking),i=t().restaurants.find(e=>e.id===n.restaurantId)?.settings,o='online'===n.source&&!!i&&(n.partySize>(i.autoAcceptUpTo??7)||!!i.reviewRequests&&!!n.notes.trim()),c={...n,id:(0,y.uuid)(),ref:`BK-${s}`,status:o?'pending':'confirmed',createdAt:a().toISOString()};return e(e=>({bookings:[...e.bookings,c],counters:{...e.counters,booking:s}})),r(c.restaurantId,'booking',`Booking ${o?'request ':''}${c.ref}: ${c.name}, ${c.partySize} on ${c.date} ${c.time}${c.source?` (${c.source})`:''}${c.allergies.length?' \u2014 allergies declared':''}`),l(o?'booking-request':'booking-confirmation',c),c},decideBooking:(n,s,i)=>{const o=t().bookings.find(e=>e.id===n);if(!o||'pending'!==o.status)return;const c={by:i,at:a().toISOString(),outcome:s},u='confirmed'===s?'confirmed':'cancelled';e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:u,decided:c}:e)})),r(o.restaurantId,'booking',`Booking request ${o.ref} (${o.name}, ${o.partySize}) ${s} by ${i}`),l('confirmed'===s?'booking-confirmation':'booking-declined',{...o,status:u})},addOutbox:t=>e(e=>({outbox:[...t,...e.outbox].slice(0,300)})),updateOutbox:(t,a)=>e(e=>({outbox:e.outbox.map(e=>e.id===t?{...e,...a}:e)})),clearOutbox:t=>e(e=>({outbox:e.outbox.filter(e=>e.restaurantId!==t)})),setTemplate:(t,a,r)=>e(e=>{const n={...e.msgTemplates[t]??{}};return null===r?delete n[a]:n[a]={...n[a]??{},...r},{msgTemplates:{...e.msgTemplates,[t]:n}}}),acceptOrder:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o)return!1;const l='new'===o.status&&!!(0,k.statusBlock)(o,'acknowledged',(0,k.linkedBooking)(o,t().bookings)),c=a(),u=i?new Date(c.getTime()+6e4*i).toISOString():o.readyBy;return e(e=>({orders:e.orders.map(e=>e.id===n?{...e,status:'new'!==e.status||l?e.status:'acknowledged',accepted:e.accepted??{by:s,at:c.toISOString()},readyBy:u}:e)})),r(o.restaurantId,'order',`${o.ref} accepted by ${s}${i?`, ready by ${String(new Date(u).getHours()).padStart(2,'0')}:${String(new Date(u).getMinutes()).padStart(2,'0')}`:''}`),!l},setBookingStatus:(n,s)=>{const i=t().bookings.find(e=>e.id===n),o=a().toISOString();e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:s,...'seated'===s?{seatedAt:o}:'finished'===s?{finishedAt:o,table:void 0}:{}}:e)})),i&&r(i.restaurantId,'booking',`${i.ref} ${i.name} \u2192 ${s}`)},seatWalkIn:(n,s,i,o)=>{const l=a(),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,u=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,g=t().bookings.filter(e=>e.restaurantId===n&&e.walkIn&&e.date===c).reduce((e,t)=>Math.max(e,Number(t.ref.slice(2))||0),0)+1,m={id:(0,y.uuid)(),ref:`W-${g}`,restaurantId:n,customerId:null,name:'Walk-in',partySize:s,date:c,time:u,table:i||void 0,allergies:[],notes:(o??'').trim(),status:'seated',security:'none',depositPaid:0,createdAt:l.toISOString(),seatedAt:l.toISOString(),walkIn:!0,source:'walk-in'};return e(e=>({bookings:[...e.bookings,m]})),r(n,'walkin',`Walk-in ${m.ref} seated: ${s} cover(s)${i?`, Table ${i}`:', table to assign'}`),m},setBookingTable:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,table:n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.name} \u2192 ${n?n.includes('+')?`Tables ${n.split('+').join(' + ')}`:`Table ${n}`:'no table'}`)},updateBooking:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,...n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.walkIn?'Walk-in':s.name} moved/updated${n.table?` \u2192 Table ${n.table}`:''}${n.time?` at ${n.time}`:''}${n.durationMins?` for ${n.durationMins} min`:''}`)},undoWalkIn:a=>{const n=t().bookings.find(e=>e.id===a);n&&n.walkIn&&(e(e=>({bookings:e.bookings.filter(e=>e.id!==a)})),r(n.restaurantId,'walkin',`Walk-in ${n.ref} undone`))},ackBookingAllergy:(n,s)=>{const i=t().bookings.find(e=>e.id===n);i&&!i.allergyAck&&(e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,allergyAck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 1/5 Booked on ${i.ref} (${i.name}): ${s} (allergy recorded)`))},joinWaitlist:(n,s,i,o)=>{const l=t().waitlist.filter(e=>e.restaurantId===n).reduce((e,t)=>Math.max(e,t.number),0)+1,c={id:I('wl'),restaurantId:n,number:l,name:s,partySize:i,joinedAt:a().toISOString(),status:'waiting',customerId:o};return e(e=>({waitlist:[...e.waitlist,c]})),r(n,'waitlist',`${s} (${i}) joined the waitlist as #${l}`),c},setWaitlistStatus:(a,n)=>{const s=t().waitlist.find(e=>e.id===a);e(e=>({waitlist:e.waitlist.map(e=>e.id===a?{...e,status:n}:e)})),s&&(r(s.restaurantId,'waitlist',`Waitlist #${s.number} ${s.name} \u2192 ${n}`),'seated'===n&&t().addWalkIn(s.restaurantId,s.partySize))},addWalkIn:(t,a)=>{e(e=>({walkIns:{...e.walkIns,[t]:(e.walkIns[t]??0)+a}})),r(t,'walkin',`Walk-in seated: ${a} cover(s)`)},addStamp:(n,s,i)=>{const o=t().restaurants.find(e=>e.id===n);o&&(e(e=>{const t=e.stampCards.find(e=>e.restaurantId===n&&e.customerId===s),r=t??{restaurantId:n,customerId:s,stamps:0,rewardsAvailable:0,history:[]};let l=r.stamps+1,c=r.rewardsAvailable;l>=o.settings.stampTarget&&(l=0,c+=1);const u={...r,stamps:l,rewardsAvailable:c,history:[{at:a().toISOString(),source:i},...r.history]};return{stampCards:t?e.stampCards.map(e=>e===t?u:e):[...e.stampCards,u]}}),r(n,'stamp',`Stamp added (${i})`))},redeemReward:(t,a)=>{e(e=>({stampCards:e.stampCards.map(e=>e.restaurantId===t&&e.customerId===a&&e.rewardsAvailable>0?{...e,rewardsAvailable:e.rewardsAvailable-1}:e)})),r(t,'stamp','Loyalty reward redeemed')},buyGiftCard:(n,s,i,o)=>{const l=n.slice(0,3).toUpperCase(),c={id:I('gc'),code:O(l),restaurantId:n,initial:s,balance:s,ownerId:t().customer.id,recipientName:i,message:o,createdAt:a().toISOString()};return e(e=>({giftCards:[c,...e.giftCards]})),r(n,'giftcard',`Gift card sold \xa3${(s/100).toFixed(2)} (demo payment)`),c},redeemGiftCard:(a,n,s)=>{const i=t().giftCards.find(e=>e.code.toUpperCase()===a.trim().toUpperCase());return!(!i||n<=0||n>i.balance)&&(e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-n}:e)})),r(i.restaurantId,'giftcard',`Gift card ${i.code} redeemed \xa3${(n/100).toFixed(2)} by ${s}`),!0)},honourLegacyCard:(t,n,s,i)=>{const o={id:I('gc'),code:n.trim().toUpperCase(),restaurantId:t,initial:s,balance:s,ownerId:'legacy',recipientName:'Legacy website bookings gift card',message:`Honoured by ${i}`,createdAt:a().toISOString().slice(0,10),legacy:!0};return e(e=>({giftCards:[o,...e.giftCards]})),r(t,'giftcard',`Legacy website bookings gift card ${o.code} honoured (\xa3${(s/100).toFixed(2)}) by ${i}`),o},addEvent:t=>e(e=>({events:[...e.events,{...t,id:I('ev')}]})),addRating:t=>{e(e=>({ratings:[{...t,id:I('rt'),createdAt:a().toISOString()},...e.ratings],orders:t.orderId?e.orders.map(e=>e.id===t.orderId?{...e,rated:!0}:e):e.orders})),r(t.restaurantId,'rating',`Private rating ${t.stars}/5 from ${t.customerName}`)},updateMenuItem:(a,n)=>{const{name:s,section:i,price:o,allergens:l,allergenNotes:c,...u}=n,g={};void 0!==s&&(g.dish=s),void 0!==i&&(g.section=i),'price'in n&&(g.price=o??null),void 0!==l&&(g.allergens=l),'allergenNotes'in n&&(g.allergenNotes=c);const m='optionGroups'in n,p=(0,b.menuCardBridge)();p&&(Object.keys(g).length||m)&&p.menuEdited(a,g,'CoverCharge for Managers',m);const f=p?u:n;Object.keys(f).length&&e(e=>({menu:e.menu.map(e=>e.id===a?{...e,...f}:e)}));const k=t().menu.find(e=>e.id===a);k&&Object.keys(f).length&&r(k.restaurantId,'menu',`Menu: ${(0,b.resolveItem)(k).name} updated`)},setSignOff:(t,r)=>{const n=(0,b.menuCardBridge)();n?r?n.signOff(t,r):n.menuEdited(t,{},'CoverCharge for Managers',!0):e(e=>({menu:e.menu.map(e=>e.id===t?{...e,signOff:r?{by:r,at:a().toISOString().slice(0,10)}:null}:e)}))},addAudit:(e,t,a)=>r(e,t,a),updateSettings:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,settings:{...e.settings,...a}}:e)})),'takeawayPaused'in a&&r(t,'order',"Takeaway slots "+(a.takeawayPaused?'PAUSED':'resumed'))},addMenuItem:t=>{const a=I('m');return e(e=>({menu:[...e.menu,{...t,id:a}]})),(0,b.menuCardBridge)()?.menuItemAdded({...t,id:a}),r(t.restaurantId,'menu',`Menu: ${t.name} added (recipe card awaiting head chef sign-off)`),a},updateRestaurant:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,...a}:e)})),r(t,'menu',`Restaurant info updated (${Object.keys(a).join(', ')})`)},placeManualOrder:({restaurantId:n,type:s,channel:i,customerName:o,phone:l,email:u,tableNo:g,slotTime:m,lines:f,allergies:k,notes:I,by:S})=>{const h=t(),w=f.flatMap(({itemId:e,qty:t})=>{const a=h.menu.find(t=>t.id===e);if(!a||t<=0)return[];const r=(0,b.resolveItem)(a),n=(0,p.conflictsFor)((0,p.effectiveAllergens)(r),k);return[{itemId:e,name:r.name,qty:t,unitPrice:r.price??0,choices:[],notes:'',contains:n.contains,may:n.may,overridden:!1,prepMins:r.prepMins}]}),O=w.reduce((e,t)=>e+t.unitPrice*t.qty,0),C='table'===s,v=$(h.orders.filter(e=>e.restaurantId===n).map(e=>e.ref),C?'Q-':'T-',C?h.counters.table:h.counters.order),A={id:(0,y.uuid)(),ref:`${C?'Q':'T'}-${v}`,restaurantId:n,customerId:`manual-${i}`,customerName:o||(C?`Table ${g}`:'Walk-in'),type:s,tableNo:g,slotTime:m,lines:w,subtotal:O,tip:0,giftCardApplied:0,total:O,paid:0,status:'new',createdAt:a().toISOString(),allergies:k,readiness:{},notes:I,channel:i,...l?{phone:l}:{},...u?{email:u}:{},...k.length?{allergyChain:{booked:{by:S,at:a().toISOString()}}}:{}};return e(e=>({orders:[A,...e.orders],counters:C?{...e.counters,table:v}:{...e.counters,order:v}})),r(n,'order',`Order ${A.ref} taken by ${S} (${'phone'===i?'phone':'walk-in'===i?'walk-in takeaway':`Table ${g}`})`),k.length&&r(n,'allergy',`Allergen sign-off 1/5 Booked on ${A.ref}: ${S} recorded ${k.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),(l||u)&&c(A),A},ackAlert:(t,r)=>e(e=>({alertAcks:{...e.alertAcks,[t]:{by:r,at:a().toISOString()}}}))}},{name:'covercharge-demo-v1',version:9,migrate:async(e,t)=>{if(!e)return e;if(n.LIVE_VENUE_BUILD)return await(0,s.archiveChefCache)('core',e),Object.assign(e,(0,r.stripCoreLiveSamples)(e)),e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},e;if(e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},t<6){try{e.restaurants=(e.restaurants??[]).map(e=>'saltmarsh'===e?.id?{...e,name:'The Venue'}:e)}catch{}try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e?.id&&JSON.stringify(e.kitchenHours)===JSON.stringify(g.ANCHORAGE_KITCHEN_OLD)?{...e,kitchenHours:g.ANCHORAGE_KITCHEN,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.'}:e)}catch{}}if(t<5)try{e.events=(e.events??[]).map(e=>'string'==typeof e?.title&&/\(substitute day\)/i.test(e.title)?{...e,title:e.title.replace(/\s*\(substitute day\)/gi,'').trim()}:e)}catch{}if(t<4)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id&&e.settings&&!e.settings.pay?{...e,settings:{...e.settings,pay:g.ANCHORAGE_PAY}}:e)}catch{}if(t<3)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id?{...e,settings:{...e.settings,orderAtTable:!1}}:e),e.orders=(e.orders??[]).filter(e=>'ord-seed-3'!==e.id&&'Q-2018'!==e.ref),e.audit=(e.audit??[]).filter(e=>!String(e.text??'').includes('Q-2018'))}catch{}if(t>=2)return e;try{const t=(0,u.buildSeed)((0,u.defaultSimStart)()),a=new Map(t.bookings.map(e=>[e.id,e])),r=new Set((0,m.anchoragePlan)().tables.map(e=>e.name)),n=e=>!e||e.split('+').every(e=>r.has(e));e.bookings=(e.bookings??[]).map(e=>{const t=a.get(e.id);return t?{...e,table:t.table,dog:t.dog,notes:t.notes}:'anchorage'!==e.restaurantId||n(e.table)?e:{...e,table:void 0}})}catch{}return e},merge:(e,r)=>{const n={...r,...e};return a.IS_WILDINGS&&(n.restaurants=n.restaurants.map(t.withWildingsAddress)),n},storage:(0,c.createJSONStorage)(()=>o.default)}))},881,[1194,5,1195,842,1198,1190,995,1191,1207,3,1069,819,1188,827,976,1099]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShallow",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]);function o(e){const t=u.default.useRef(void 0);return u=>{const o=e(u);return(0,n.shallow)(t.current,o)?t.current:t.current=o}}},884,[31,1217]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLE_ORDER_DEFAULT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"cleanToken",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"isTableNo",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fromRow",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"toRow",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"hm",{enumerable:!0,get:function(){return l}}),_e.openAt=function(e,t){const r=a(t),n=e.openFrom?a(e.openFrom):null,o=e.lastOrders?a(e.lastOrders):null;return null!==n&&null!==o?n<=o?r>=n&&r=n||r=n:null===o||r{const t=(e??'').trim().toUpperCase();return/^[A-Z2-9]{16}$/.test(t)?t:null},r=e=>/^[0-9]{1,4}$/.test(e),n=t=>t?{on:!!t.is_on,tables:Array.isArray(t.tables)?t.tables.map(String):null,staffAccept:!1!==t.staff_accept,openFrom:t.open_from?String(t.open_from).slice(0,5):null,lastOrders:t.last_orders?String(t.last_orders).slice(0,5):null,guestTip:t.guest_tip??''}:{...e},o=e=>({is_on:e.on,tables:e.tables&&e.tables.length?e.tables.filter(r):null,staff_accept:e.staffAccept,open_from:e.openFrom,last_orders:e.lastOrders,guest_tip:e.guestTip.slice(0,300)}),a=e=>{const[t,r]=e.split(':').map(Number);return 60*t+r},l=e=>`${String(Math.floor(e/60)%24).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`;const s=(e,t)=>e.reduce((e,r)=>e+r.qty*(t.find(e=>e.id===r.id)?.pricePence??0),0),u=(e,t,r)=>e.map(e=>t.find(t=>t.id===e.id)).filter(e=>!!e&&(e.allergens.some(e=>r.includes(e))||e.mayContain.some(e=>r.includes(e)))),c=(e,t)=>`${e.replace(/\/$/,'')}/t?k=${t}`,f=(e,t)=>`${e.replace(/\/$/,'')}/customer-app/index.html?table=${t}`,p=e=>{const t=e.trim();return t.length>=2&&t.length<=40&&/\p{L}/u.test(t)},b=e=>{const t=e.trim();return!t||/^\+?[0-9][0-9 ()-]{6,19}$/.test(t)},m=e=>'table'===e.type&&'table-qr'===e.channel,y=e=>m(e)&&!!e.held&&!e.accepted&&'cancelled'!==e.status,h=e=>!y(e),O=e=>'cancelled'===e.status?e.cancelReason?`Cancelled: ${e.cancelReason}`:'Cancelled by the staff.':e.held&&!e.accepted?'Sent. Waiting for a member of staff to accept it.':'served'===e.status||'collected'===e.status||'closed'===e.status?'Served. Enjoy!':'ready'===e.status?'Ready: on its way to your table.':'Accepted: the kitchen has your order.',P=['Sold out','Wrong table','Sent twice','Kitchen closed','Guest asked to cancel'],j='Pay at the bar or with your server. Paying by card from your phone is coming later.'},887,[]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.venueBusy=function(n,s,a){const d=(0,t.ymd)(new Date(a.getTime()-48384e5)),r=(0,t.ymd)(a),u=n.settings.busyLearningSince,o=u&&/^\d{4}-\d{2}-\d{2}$/.test(u)&&u>d?u:d,l=new Map,y=new Set,c=new Set,h=new Set;for(const a of s){if(h.has(a.id)||a.restaurantId!==n.id||a.date=r||!['confirmed','seated','finished'].includes(a.status)||!Number.isFinite(a.partySize)||a.partySize<=0)continue;h.add(a.id),y.add(a.date);const s=new Date(a.date+'T12:00:00');s.setDate(s.getDate()-(s.getDay()+6)%7),c.add((0,t.ymd)(s));const d=a.date+'T'+a.time.slice(0,2);l.set(d,(l.get(d)??0)+a.partySize)}const w=[...l.values()].sort((t,n)=>t-n),f=[...y].sort(),M=(f.length?Math.round((new Date(r+'T12:00:00').getTime()-new Date(f[0]+'T12:00:00').getTime())/864e5):0)>=28&&c.size>=4&&y.size>=16&&w.length>=40,b=n.settings.busyCoversPerHour,v=Number.isFinite(b)&&b>=1?Math.round(b):30,S=M&&!1!==n.settings.busyLearning,z=S?Math.max(1,Math.ceil(w[Math.ceil(.85*w.length)-1])):v,D=Math.max(1,Math.ceil(z/2));return{busy:z,steady:D,learned:S,weeks:c.size,enough:M,words:`Busy level: ${z} Covers an hour (${S?`learned from your last ${c.size} weeks`:null!=b?'set by you':'starting level'})`}},e.hourlyBand=function(t,n){return t>=n?'Busy':t>=Math.ceil(n/2)?'Steady':'Quiet'};var t=_r(_d[0])},933,[822]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEEN",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOUTERS_GUIDE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"KIRKMICHAEL_GUIDE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WILDINGS_GUIDE",{enumerable:!0,get:function(){return o}}),_e.guideCalendarEvents=function(e,t){return e.events.filter(e=>e.date).map(e=>({id:`${t}-ev-${e.date}-${e.title.toLowerCase().replace(/[^a-z0-9]+/g,'-').slice(0,40)}`,restaurantId:t,date:e.date,title:e.title,kind:'event',description:`${e.when}. ${e.detail}`,example:!1,source:e.source,time:e.time}))};const e='10 November 2026',t={id:'souters',name:"Souter's Inn",place:'Kirkoswald, Ayrshire',about:["Souter's Inn is a restaurant and bar in the village of Kirkoswald, Ayrshire. The official site describes a cosy country welcome and menus built around regional produce, with a bar, an ice cream shop and cake corner, and an upstairs dining room for private events.","The building stands on the site of the school house that Robert Burns attended in 1772, according to the official about page. Souter Johnnie's house and the old parish church and graveyard, known from Tam o' Shanter, are nearby.",'The official menu page says the inn can seat up to 130 diners. It also has a takeaway menu and lists breakfast every day.'],hoursTitle:'Opening hours',hoursLines:['Open daily from 9am, seven days a week.','Breakfast: 9am\u201311.45am, Monday to Sunday.','\xc0 la carte, children\u2019s, vegetarian and takeaway menus: 12 noon\u20139pm, Monday to Sunday.','Desserts: 9am\u20139pm, Monday to Sunday.','Meat Feast menu: every Tuesday, 12 noon\u20139pm.'],hoursNotes:['These kitchen hours are from the official menu page, checked 10 November 2026. The official homepage also says the inn is open daily from 9am.','Destination South Ayrshire, checked the same day, lists the inn open 9am\u20139pm, seven days a week, and says food is served all day.','Christmas Day and other festive closing times were not published on the official site on 10 November 2026. Bar last orders are not listed separately from the 9pm food hours.'],hoursSource:'https://www.soutersinn.com/menu and https://www.soutersinn.com/ (10 November 2026); Destination South Ayrshire listing also checked the same day.',festive:{title:'Festive flavours, from 1 December',lines:['Festive dishes are served from 1 December, alongside the usual menu.','A set festive menu is offered for tables of 10 or more: two courses \xa329.95 or three courses \xa335.95, Monday to Sunday 12 noon\u20139pm, with crackers included. Coffee or tea with a mince pie is \xa33.00.'],source:'https://www.soutersinn.com/ and the Festive Menu PDF linked from https://www.soutersinn.com/menu (10 November 2026).'},eventsIntro:'The official What\u2019s On page describes regular quiz nights and live music, but on 10 November 2026 the only dated listing was already in the past. Upcoming details below are taken from the official homepage and festive menu. Call 01655 760653 to ask about dates.',events:[{title:'Festive dishes and set festive menu',when:'From 1 December 2026',date:'2026-12-01',detail:'Festive dishes join the usual menu from 1 December. The set festive menu is for tables of 10 or more, two courses \xa329.95 or three courses \xa335.95, 12 noon\u20139pm, crackers included.',source:'https://www.soutersinn.com/ and festive menu PDF (10 November 2026).'}],regularEvents:[{title:'Meat Feast Tuesdays',detail:'Every Tuesday, 12 noon\u20139pm, with a dedicated meat feast menu.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Quiz nights and live music',detail:'The official What\u2019s On page says quiz nights and weekend live music are a regular part of the calendar. No future dates were published on 10 November 2026 \u2014 call to ask what\u2019s next.',source:'https://www.soutersinn.com/whatson (10 November 2026).'}],address:'47 Main Road, Kirkoswald, Ayrshire KA19 8HY',phone:'01655 760653',email:'souters@southernayr.com',website:'https://www.soutersinn.com/',websiteLabel:'soutersinn.com',socials:[{label:'Facebook',url:'https://www.facebook.com/soutersinn'},{label:'Instagram',url:'https://www.instagram.com/soutersinn/'},{label:'TikTok',url:'https://www.tiktok.com/@souters_inn'}],mapQuery:'Souter\'s Inn, 47 Main Road, Kirkoswald, KA19 8HY',booking:['Send a table request in this app, or call 01655 760653. Staff will confirm. No payment is taken here.','A general table deposit and cancellation policy was not published on the official website on 10 November 2026.'],policies:[{title:'Allergens',body:'Menus can change with the season and fresh produce. Please tell waiting staff about allergens or other dietary needs before you order.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Parking and access',body:'Destination South Ayrshire, checked 10 November 2026, lists parking, blue badge parking, disabled access, free Wi-Fi, and a welcome for walkers and cyclists. The official website does not spell these out itself.',source:'https://destinationsouthayrshire.co.uk/eat-and-drink/souters-inn/ (10 November 2026).'},{title:'Children',body:'A children\u2019s menu is served Monday to Sunday, 12 noon\u20139pm.',source:'https://www.soutersinn.com/menu (10 November 2026).'},{title:'Dogs',body:'A dog policy was not published on the official website or the Destination South Ayrshire listing on 10 November 2026. Please call to ask.',source:'Official site and Destination South Ayrshire, 10 November 2026.'}],drinks:{title:'The bar',body:'The official menu page describes a bar with wines, ales, whiskies and cocktails. A priced drinks list was not published on the pages checked on 10 November 2026.',source:'https://www.soutersinn.com/menu (10 November 2026).'},awards:['TripAdvisor Travellers\u2019 Choice 2026, and 4.3 out of 5 from 1,119 TripAdvisor reviews, checked 10 November 2026.'],reviews:[{summary:'4.3 out of 5 from 1,119 reviews on TripAdvisor, and a Travellers\u2019 Choice award in 2026.',source:'TripAdvisor listing for Souter\u2019s Inn, Kirkoswald, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g3649164-d6729564-Reviews-Souter_s_Inn-Kirkoswald_South_Ayrshire_Ayrshire_Scotland.html',quotes:[{text:'Absolute perfection from start to finish! \u2026 The atmosphere is warm and welcoming, and the service was top-notch right from the moment we walked through the door.',by:'Anna',date:'6 October 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'},{text:'The staff were superb, the ambiance was amazing. By far the best pub food I have ever had. Could not fault this establishment at all.',by:'johnhK5391CS',date:'28 September 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'},{text:'Really put these guys to the test today, table of 12 from toddlers to grandparents, everyone enjoyed their food, service was fantastic.',by:'Kate',date:'9 October 2026',source:'https://www.soutersinn.com/ (guest review shown on the official homepage, 10 November 2026).'}]}],functions:[{title:'Upstairs private dining',body:'The official functions page says the upstairs room comfortably seats 45, or 60 standing, with its own private bar. It is offered for birthdays, family dinners, funeral gatherings, baby showers, ticketed events and live music, with options from afternoon tea and buffets to three-course menus.',source:'https://www.soutersinn.com/functions (10 November 2026).'},{title:'Mezzanine seating',body:'The official menu page describes the upper mezzanine as a private dining area with its own oak bar, overlooking the patisserie and the lower bar, and says it can seat up to 70 guests. That figure differs from the 45 seated / 60 standing numbers on the functions page. Both are from the official site; please ask the venue which applies to your booking.',source:'https://www.soutersinn.com/menu and https://www.soutersinn.com/functions (10 November 2026).'}],giftVouchers:'Gift vouchers are listed on the official website. Call 01655 760653 or use the Gift Voucher link on soutersinn.com to ask. No payment is taken in this app.',photos:[{file:'gallery-1.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7160-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'gallery-2.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7187-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'gallery-3.jpg',alt:'A photograph from the official Souter\u2019s Inn gallery',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/IMG_7218-1920w.jpg',page:'https://www.soutersinn.com/gallery'},{file:'upstairs-1.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+1-1920w.jpg',page:'https://www.soutersinn.com/functions'},{file:'upstairs-2.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+2-1920w.jpg',page:'https://www.soutersinn.com/functions'},{file:'upstairs-3.jpg',alt:'The upstairs private dining room at Souter\u2019s Inn',source:'https://irp.cdn-website.com/0b18b888/dms3rep/multi/opt/Upstairs+3-1920w.jpg',page:'https://www.soutersinn.com/functions'}],gaps:['Christmas Day and other festive closing times not published on the official site (10 November 2026).','Dog policy not published.','Priced wine, ale and cocktail lists not on the official pages checked.','A general table deposit policy was not published (ticketed events have used a deposit in the past).','Bar last orders not listed separately.','A current VisitScotland listing was not retrieved today (the page request failed).','No live Google review count was confirmed today \u2014 TripAdvisor figures were used instead.'],conflicts:['Functions page: upstairs seats 45, or 60 standing. Menu page: mezzanine seats up to 70. Prefer neither figure alone \u2014 both are official; shown together.','Official about page: Burns attended the school house in 1772. Destination South Ayrshire says 1775. The app uses 1772 from the official site.']},s={id:'kirkmichael',name:'The Kirkmichael Arms',place:'Kirkmichael, Ayrshire',about:['The Kirkmichael Arms is a Michelin-listed restaurant and bar in the village of Kirkmichael, South Ayrshire. The official site says it has been a pub since 1700, and names it Best Scottish Pub at The Scotsman Scran Awards 2025.','Chef and owner Justin Galea, who trained in Melbourne, took the pub on sight unseen after it closed in 2023, when two locals set out to bring it back as the heart of the village. The Herald has named him one of the 50 most exciting chefs working in Scotland.','The kitchen smokes its own salmon, churns butter, cures bacon and bakes bread, drawing on Scottish produce with classical French technique and occasional Asian influences. The official site is clear that it is still a proper pub \u2014 Sunday lunch, a pint by the fire, or a full dinner.'],hoursTitle:'Opening hours',hoursLines:['Monday to Wednesday: closed.','Thursday to Sunday: from 1pm, until 10.30pm.'],hoursNotes:['The visible official website copy, checked 10 November 2026, says \u201cThursday to Sunday from 1pm\u201d and does not print a closing time. The same official homepage publishes hours data of 13:00\u201322:30 on those days, which is what is shown above.','Kitchen last orders are not listed separately from closing time.','Opening times between Christmas and New Year were still \u201cto be confirmed\u201d on the official Christmas 2026 page (updated 9 October 2026, checked 10 November 2026). The restaurant is closed on Christmas Day.'],hoursSource:'https://www.kirkmichaelarms.co.uk/ (visible copy and published hours data, 10 November 2026).',festive:{title:'Christmas and New Year 2026',lines:['Christmas Day boxes, for cooking at home, can be collected on Wednesday 23 December: \xa3205 feeds 4, or \xa3310 feeds 6, paid when you order. Email enquiries@thekirkmichaelarms.co.uk. Optional extras include beech-smoked salmon at \xa310 per 100g and bottled cocktails at \xa335\u2013\xa340.','Friday 11 December: Secret Santa name share. Friday 18 December: Christmas quiz, Secret Santa and pub Christmas party. Saturday 19 December: carol night, with loaded hot chocolate, mulled wine and mince pies. Sunday 20 December: Unofficial Christmas Lunch (also the Sunday carvery).','Christmas Eve (24 December): \xe0 la carte, no set festive menu. Christmas Day: restaurant closed. Boxing Day (26 December): dinner. Sunday 27 December: open as normal. New Year\u2019s Eve (31 December): \xa3125 per person.','Sunday carvery from 1pm on 6, 13, 20 and 27 December. Private Christmas parties and pub buyouts are available \u2014 email to discuss.'],source:'https://www.kirkmichaelarms.co.uk/wilderness-journal/best-christmas-dining-ayrshire (updated 9 October 2026, checked 10 November 2026).'},eventsIntro:'The official bar page mentions quiz nights and open-mic jams as part of pub life, without a dated public calendar beyond the Christmas 2026 lineup below.',events:[{title:'Secret Santa name share',when:'Friday 11 December 2026',date:'2026-12-11',detail:'Share your name for the Secret Santa, or drop your name and gift in any time before 18 December.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas quiz, Secret Santa and pub party',when:'Friday 18 December 2026',date:'2026-12-18',detail:'Festive quiz and the Matt Davey Secret Santa Extravaganza, with a stick-or-twist gift draw.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Carol night at the Arms',when:'Saturday 19 December 2026',date:'2026-12-19',detail:'Christmas music by the fire, with loaded hot chocolate, mulled wine and mince pies.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Unofficial Christmas Lunch and Sunday carvery',when:'Sunday 20 December 2026, from 1pm',date:'2026-12-20',time:'13:00',detail:'A proper Christmas roast on the Sunday before Christmas Day, and a Sunday carvery from 1pm.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas box collection',when:'Wednesday 23 December 2026',date:'2026-12-23',detail:'Collect Christmas Day boxes ordered in advance (\xa3205 for 4 or \xa3310 for 6). Restaurant is closed on Christmas Day.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Christmas Eve dining',when:'Thursday 24 December 2026',date:'2026-12-24',detail:'\xc0 la carte, with no set Christmas menu.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Boxing Day dinner',when:'Saturday 26 December 2026',date:'2026-12-26',detail:'Open for dinner on Boxing Day.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'Sunday carvery',when:'Sunday 27 December 2026, from 1pm',date:'2026-12-27',time:'13:00',detail:'Open as normal, with Sunday carvery from 1pm.',source:'Official Christmas 2026 page, checked 10 November 2026.'},{title:'New Year\u2019s Eve',when:'Thursday 31 December 2026',date:'2026-12-31',detail:'New Year\u2019s Eve, \xa3125 per person. Opening times earlier in that week were still to be confirmed.',source:'Official Christmas 2026 page, checked 10 November 2026.'}],regularEvents:[{title:'Quiz nights and open-mic jams',detail:'The official bar page lists quiz nights and open-mic jams as part of regular pub life. No separate future dates were published on 10 November 2026, apart from the Christmas quiz on 18 December.',source:'https://www.kirkmichaelarms.co.uk/bar (10 November 2026).'},{title:'Sunday carvery',detail:'Sunday carvery is a regular service. In December 2026 it is from 1pm on the 6th, 13th, 20th and 27th.',source:'Official Christmas 2026 page and Sunday carvery journal, 10 November 2026.'},{title:'Whisky tasting',detail:'The official site has a whisky tasting page and describes a carefully chosen malt list. Ask staff about current tastings and prices \u2014 many list prices were unpublished on the sample drinks menus.',source:'https://www.kirkmichaelarms.co.uk/ (10 November 2026).'}],address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',phone:'01655 750 200',email:'enquiries@thekirkmichaelarms.co.uk',website:'https://www.kirkmichaelarms.co.uk/',websiteLabel:'kirkmichaelarms.co.uk',socials:[{label:'Facebook',url:'https://www.facebook.com/kirkmichaelarms/'},{label:'Instagram',url:'https://www.instagram.com/kirkmichaelarms_unfiltered/'}],mapQuery:'The Kirkmichael Arms, 3-5 Straiton Road, Kirkmichael, KA19 7PH',booking:['Send a table request in this app, or call 01655 750 200, or email enquiries@thekirkmichaelarms.co.uk. Staff will confirm. No payment is taken here.','The official website, checked 10 November 2026, says: if you cancel less than 48 hours before your booking, or do not show up, there is a \xa325 charge per person. Parties of 6 or more are asked for a \xa315 per person deposit, redeemed when you visit.','Pub buyouts: Monday to Thursday \xa33,500; Friday to Sunday \xa35,000. Email for availability.'],policies:[{title:'Cancellation and deposits',body:'The venue\u2019s own website says a \xa325 per person charge applies if you cancel less than 48 hours before your booking or do not show up. Larger parties of 6 or more are asked to pay a \xa315 per person deposit, redeemed at the time of your visit. No deposit is taken in this app.',source:'https://www.kirkmichaelarms.co.uk/booking (10 November 2026).'},{title:'Dogs',body:'The official Sunday carvery journal says dogs are welcome in the pub area, and that there is no dress code.',source:'https://www.kirkmichaelarms.co.uk/wilderness-journal/best-sunday-carvery-ayrshire (10 November 2026).'},{title:'Children',body:'A sample children\u2019s menu is published, at \xa314.95 for three courses.',source:'https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'},{title:'Parking',body:'The official Sunday carvery journal says there is plenty of parking in the village. A dedicated venue car park is not described on the official pages checked.',source:'Official Sunday carvery journal, 10 November 2026.'},{title:'Accessibility',body:'An accessibility statement was not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Allergens',body:'Please speak to staff about allergens. Allergen information was not published on the sample menus checked on 10 November 2026.',source:'https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'}],drinks:{title:'The bar',body:'The official bar page describes a proper pub, with local beers, carefully chosen wines and malts, quiz nights and open-mic jams. Sample whisky and wine menus are on the official menus page; many prices were unpublished (ask staff).',source:'https://www.kirkmichaelarms.co.uk/bar and https://www.kirkmichaelarms.co.uk/menus (10 November 2026).'},awards:['Best Scottish Pub, The Scotsman Scran Awards 2025 (official site, 10 November 2026).','Michelin-listed / Michelin-recommended (official site, 10 November 2026).','Justin Galea named among The Herald\u2019s 50 most exciting chefs in Scotland (official site, 10 November 2026).'],reviews:[{summary:'4.6 out of 5 from 700 reviews on TripAdvisor, checked 10 November 2026.',source:'TripAdvisor listing for The Kirkmichael Arms, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g551837-d2637644-Reviews-The_Kirkmichael_Arms-Maybole_South_Ayrshire_Ayrshire_Scotland.html',quotes:[]}],functions:[{title:'Private Christmas parties and pub buyouts',body:'The official Christmas page says larger gatherings can have a dedicated space and festive menus, and that pub buyouts are offered. The official booking page lists buyout rates of \xa33,500 Monday to Thursday and \xa35,000 Friday to Sunday.',source:'Official Christmas 2026 page and https://www.kirkmichaelarms.co.uk/booking (10 November 2026).'}],photos:[{file:'exterior.jpg',alt:'The Kirkmichael Arms, from the official website',source:'https://www.kirkmichaelarms.co.uk/photos/Kirkmichael%20Arms-20_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/'},{file:'interior.jpg',alt:'Inside The Kirkmichael Arms, from the official website',source:'https://www.kirkmichaelarms.co.uk/photos/Kirkmichael%20Arms-895_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/'},{file:'bar.jpg',alt:'The bar at The Kirkmichael Arms',source:'https://www.kirkmichaelarms.co.uk/photos/bar/Kirkmichael-Arms-825.jpg',page:'https://www.kirkmichaelarms.co.uk/bar'},{file:'restaurant.jpg',alt:'The restaurant at The Kirkmichael Arms',source:'https://www.kirkmichaelarms.co.uk/photos/restaurant/Kirkmichael-Arms-412_websize.jpg',page:'https://www.kirkmichaelarms.co.uk/restaurant'},{file:'story.jpg',alt:'The Kirkmichael Arms, from the official story page',source:'https://cdn.sanity.io/images/1er2n88p/production/6f2f9988ce1bf9df9c63a12af667ae89d5442bfb-1600x1067.jpg',page:'https://www.kirkmichaelarms.co.uk/our-story'},{file:'contact.jpg',alt:'The Kirkmichael Arms, from the official contact page',source:'https://www.kirkmichaelarms.co.uk/photos/contact/Kirkmichael%20Arms-544.jpg',page:'https://www.kirkmichaelarms.co.uk/contact'}],gaps:['Kitchen last orders not published separately.','Hours between Christmas and New Year still to be confirmed on the official Christmas page.','Accessibility details not published.','No official guest quotes on the website \u2014 only the TripAdvisor rating is shown.','A live Google review count was not confirmed today.','VisitScotland listing not confirmed today.','Many whisky and wine prices unpublished on the sample drinks menus.'],conflicts:['Visible official copy says \u201cfrom 1pm\u201d; official hours data on the same homepage lists 13:00\u201322:30. The app shows both, and uses 22:30 as the published close.']},o={id:'wildings',name:'Wildings Hotel & Restaurant',place:'Maidens, Ayrshire',about:['Wildings is a family-run hotel and restaurant in the harbour village of Maidens, on the Ayrshire coast, looking out over the Firth of Clyde towards Arran. The official site says it has two contemporary restaurants and 11 comfortable bedrooms, many with sea views.','It is run by the Sage family, now in its second generation. The official homepage names the owners as Dorothy, Sonya and Nicola. They describe warm hospitality and food made from local, seasonal produce from land and sea.','The village sits by a sandy beach and a historic harbour, with Culzean Castle and Country Park along the coast and golf courses nearby.'],hoursTitle:'Kitchen hours',hoursLines:['Lunch, Monday to Saturday: 12 noon\u20132pm.','Sunday lunch: 12 noon\u20132.30pm.','Dinner, every day: 6pm\u20139pm.'],hoursNotes:['These hours are from the official homepage, checked 10 November 2026. The kitchen is closed between lunch and dinner.','The lunch menu PDF still prints Sunday lunch as 12 noon\u20132.00pm, which is earlier than the website\u2019s 2.30pm. The app follows the official website for hours, and notes the PDF difference.','Bar opening hours, and Christmas or other seasonal closing times, were not published on the official pages checked on 10 November 2026. Please call 01655 331 401 to ask.'],hoursSource:'https://www.wildingshotel.com/ (10 November 2026). Lunch PDF conflict noted from the official menus linked at https://www.wildingshotel.com/team.',eventsIntro:'No dated public events, quiz nights or festive opening hours were published on the official pages checked on 10 November 2026. Call or email to ask about private dining, celebrations and seasonal hours.',events:[],regularEvents:[],address:'Maidens Rd, Maidens, Girvan, KA26 9NR',phone:'01655 331 401',email:'bookings@wildingsrestaurant-hotel.co.uk',website:'https://www.wildingshotel.com/',websiteLabel:'wildingshotel.com',socials:[{label:'Facebook',url:'https://www.facebook.com/profile.php?id=100057663900963'},{label:'Instagram',url:'https://www.instagram.com/wildingsmaidens/'}],mapQuery:'Wildings Hotel, Maidens Rd, Maidens, Girvan, KA26 9NR',booking:['Send a table or room request in this app, or call 01655 331 401, or email bookings@wildingsrestaurant-hotel.co.uk. Staff will confirm. No payment is taken here.','A deposit or cancellation policy was not published on the official website on 10 November 2026.','Visit Girvan, a local guide checked the same day, says booking is essential, especially at weekends, in summer and during busy golf events on the coast, and that hours can shift seasonally \u2014 confirm when you book.'],policies:[{title:'Allergens',body:'Please tell the person taking your order about any allergies. The official menus say the venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.',source:'Official menu PDFs linked from https://www.wildingshotel.com/team (10 November 2026).'},{title:'Parties of six or more',body:'Parties of six or more: no separate or split bills.',source:'Official menu PDFs, 10 November 2026.'},{title:'Children',body:'A children\u2019s menu is offered for under 11s, at \xa39 for one course, \xa310 for two courses or \xa311 for three courses, with extra servings at \xa33.95.',source:'Official kids menu PDF, 10 November 2026.'},{title:'Parking',body:'The official website does not itself describe parking. A guest testimonial on the official homepage mentions \u201cplenty of parking\u201d. TripAdvisor\u2019s hotel listing, checked 10 November 2026, lists free parking. Visit Girvan says parking is at the Harbour Road car park.',source:'Official homepage testimonial; TripAdvisor hotel listing; https://www.girvanholidayhome.co.uk/wildings-restaurant-maidens.html (all 10 November 2026).'},{title:'Dogs',body:'A dog policy was not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Accessibility',body:'Accessibility details were not published on the official pages checked on 10 November 2026. Please call to ask.',source:'Official site, 10 November 2026.'},{title:'Check-in and check-out',body:'Check-in and check-out times were not published on the official website on 10 November 2026. Please ask the hotel when you book.',source:'Official site, 10 November 2026.'}],drinks:{title:'Drinks',body:'A guest testimonial on the official homepage mentions a good selection of alcoholic and non-alcoholic drinks. A priced wine or bar list was not published on the official pages checked on 10 November 2026. Ask staff.',source:'https://www.wildingshotel.com/ (10 November 2026).'},awards:[],reviews:[{summary:'On TripAdvisor, checked 10 November 2026: the restaurant listing is 4.4 out of 5 from 1,326 reviews, and the hotel listing is 4.6 out of 5 from 89 reviews.',source:'TripAdvisor restaurant and hotel listings for Wildings, Maidens, checked 10 November 2026.',url:'https://www.tripadvisor.co.uk/Restaurant_Review-g947977-d951940-Reviews-Wildings_Hotel_and_Restaurant-Maidens_South_Ayrshire_Ayrshire_Scotland.html',quotes:[{text:'Huge room (room 2), lovely view of the seafront \u2026 Room was comfortable and warm. Always amazing food expertly prepared \u2026 Staff are all friendly and chatty \u2026 plenty of parking.',by:'Lynn Pope',source:'Testimonial on https://www.wildingshotel.com/ (10 November 2026).'}]}],rooms:{intro:'The official site lists 11 bedrooms, including single, double, king, twin and family rooms, many with sea views and a full Scottish breakfast included. Call reception on 01655 331 401, or email, to enquire.',items:[{name:'Double room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'King room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'Twin room',price:'\xa3162',note:'Including full Scottish breakfast.'},{name:'Family room',price:'From \xa3205',note:'Including full Scottish breakfast.'}],source:'https://www.wildingshotel.com/prices (10 November 2026).',notes:['Single rooms are mentioned on the official accommodation page, but no single-room price was published on 10 November 2026 \u2014 please call to ask.','Prices can change. Confirm with the hotel when you book.']},functions:[{title:'Private dining',body:'The official website shows a private dining room among its restaurant photographs. No published capacity, hire rate or wedding package was found on the official pages checked on 10 November 2026. Call or email to ask.',source:'https://www.wildingshotel.com/ (10 November 2026).'}],photos:[{file:'exterior.jpg',alt:'The exterior of Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/out1-508w.jpg',page:'https://www.wildingshotel.com/'},{file:'room.jpg',alt:'A bedroom at Wildings, from the official accommodation page',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Room+Wildings+edit-680w.png',page:'https://www.wildingshotel.com/prices'},{file:'booths.jpg',alt:'Restaurant booths at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+boths+in+restaurant-1920w.png',page:'https://www.wildingshotel.com/'},{file:'restaurant.jpg',alt:'The main restaurant at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+main+restaurant-1920w.png',page:'https://www.wildingshotel.com/'},{file:'private-dining.jpg',alt:'Private dining at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Wildings+restaurant+private-1920w.png',page:'https://www.wildingshotel.com/'},{file:'fish.jpg',alt:'A fish dish at Wildings, from the official website',source:'https://irp.cdn-website.com/dd331502/dms3rep/multi/opt/Fish+close+up+widlings-1920w.png',page:'https://www.wildingshotel.com/'}],gaps:['Bar hours not published.','Christmas and seasonal hours not published.','Dog policy, accessibility, and official check-in / check-out times not published.','Single-room price not published.','No priced drinks list.','No official events calendar found.','A live Google review count was not confirmed today.','VisitScotland listing not confirmed today.'],conflicts:['Official footer and contact page use Maidens Rd, Maidens, Girvan, KA26 9NR. TripAdvisor listings (hotel and restaurant) and some older pages use Harbour Road, same postcode. The app uses Maidens Rd from the official site.','Official website Sunday lunch to 2.30pm; official lunch PDF still says 12 noon\u20132.00pm. The app follows the website for hours.']}},934,[]); +__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])},935,[31,1069,825,818,25]); +__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])},936,[992,953]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},937,[31,128,1420,825,990,818,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:l,inStaffApp:n,shiftManager:a,big:o,testID:d}){const[h,p]=(0,t.useState)(!1),x=(0,u.useSession)(e=>e.meId),y=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:n,role:l,shiftManager:a})||x&&!(0,m.canChangeBookings)(y)?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S.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:()=>p(!0),style:{minHeight:o?64:44}}),h?(0,$.jsx)(F,{rid:e,id:s.id,who:i,onClose:()=>p(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:l,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,n.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,$.jsx)(F,{rid:e,id:o,who:i,hidePrivate:a,onClose:l}):(0,$.jsxs)(S.Sheet,{visible:!0,onClose:l,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,$.jsx)(S.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${N(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}, ${N(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,$.jsx)(S.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,$.jsx)(S.Button,{kind:"ghost",label:"Close",onPress:l,style:{minHeight:44}})]})},_e.EditBookingSheet=F;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),l=(e=i)&&e.__esModule?e:{default:e},n=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),u=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),C=_r(_d[19]),f=_r(_d[20]),I=_r(_d[21]),w=_r(_d[22]),k=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]);const P=/^([01]\d|2[0-3]):[0-5]\d$/,O=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const N=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,j.ymd)(s)?'Tomorrow':B(e)};const E=e=>e?(e/100).toFixed(e%100?2:0):'',W=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},B=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',z=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')}`:''},R=e=>e.charAt(0).toUpperCase()+e.slice(1);function L({title:e,children:t,testID:s}){return(0,$.jsxs)(l.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:y.colours.hairline,alignItems:'stretch'},children:[(0,$.jsx)(S.T,{size:17,weight:"semibold",center:!0,colour:y.colours.goldLight,children:e}),t]})}const A=({label:e,value:t,onChange:s,max:i=20,testID:l})=>(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,children:e}),(0,$.jsx)(S.Stepper,{testID:l,value:t,min:0,max:i,onChange:s,label:e})]});function F({rid:e,id:i,who:u,onClose:b,hidePrivate:m=!1}){(0,I.useBlurOutside)();const N=(0,n.useBookings)(e),F=N.find(e=>e.id===i),M=(0,d.useRestaurant)(e),H=(0,a.usePlan)(e),_=(0,o.useBlocks)(e=>e.blocks),[V,Y]=(0,t.useState)(F?(0,c.draftOf)(F):null),[G,U]=(0,t.useState)(null),[q,X]=(0,t.useState)(null),[K,Q]=(0,t.useState)(E(F?(0,c.draftOf)(F).depositDue:0)),[J,Z]=(0,t.useState)(E(F?(0,c.draftOf)(F).depositAmount:0)),[ee,te]=(0,t.useState)(B(F?(0,c.draftOf)(F).depositDate:''));if(!F||!V||!M)return null;const se=e=>{U(null),X(null),Y({...V,...e})},ie=(0,k.depositOf)(M.settings),le=e=>{const t=e.partySize??V.partySize,s=Math.min(e.children??V.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(F)&&V.depositOn&&!V.depositPaid&&W(K||'0')===(0,k.depositDue)(ie,V.partySize,V.children??0)){const e=(0,k.depositDue)(ie,t,s);e>0&&Q(E(e))}se({...e,children:s})},ne=O(V.time),ae=P.test(ne),oe=V.area?H.areas.filter(e=>e.name===V.area).map(e=>e.id):null,de=e=>!oe||e.split('+').every(e=>oe.includes(H.tables.find(t=>t.name===e)?.areaId??'')),re=(0,x.tableOptions)(H,N.filter(e=>e.date===V.date),V.table).filter(e=>de(e)||e===V.table),ce=!(V.depositOn&&(Number.isNaN(W(K||'0'))||V.depositPaid&&(Number.isNaN(W(J||'0'))||ee.trim()&&!z(ee)))),he={...V,time:ne,depositDue:W(K||'0')||0,depositAmount:W(J||'0')||0,depositDate:z(ee)},pe=(0,c.changedFields)(F,he),ue=M.settings.turnMins??90,ge=async()=>{const t=(0,c.editPatch)(F,he,{by:u||'Team member',app:r.APP_VARIANT});if(Object.keys(t).length&&await n.repo.bookings.update(F.id,t),'seated'===F.status&&'table'in t&&t.table!==F.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(F.table),l=s(t.table),n=a.useFloor.getState(),o=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!l.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),l.forEach(t=>n.setLive(e,t,{stage:o,dirty:!1}))}X(`Saved. Changed: ${(0,c.editedWords)(pe)}.`),U(null),b()},be=V.allergies??[],me=e=>se({allergyNone:!1,allergies:be.some(t=>t.allergen===e)?be.filter(t=>t.allergen!==e):[...be,{allergen:e,severity:'allergy'}]}),xe=(0,c.historyLines)(F);return(0,$.jsxs)(S.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${F.name} \xb7 ${F.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,$.jsx)(l.default,{style:{alignItems:'center'},children:(0,$.jsx)(v.DepositChip,{b:F,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(F)?(0,$.jsx)(l.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold},children:(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,$.jsxs)(L,{title:"Deposit",testID:"edit-section-deposit",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"No deposit",selected:!V.depositOn,testID:"edit-deposit-none",onPress:()=>se({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,$.jsx)(S.Chip,{label:"Deposit due",selected:!!V.depositOn&&!V.depositPaid&&!V.depositWaived,testID:"edit-deposit-due",onPress:()=>se({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,$.jsx)(S.Chip,{label:"Deposit paid",selected:!!V.depositOn&&!!V.depositPaid,testID:"edit-deposit-paid",onPress:()=>{J||Z(K),ee||te(B((0,j.ymd)(new Date))),se({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),V.depositOn&&!V.depositPaid&&V.depositWaived?(0,$.jsx)(S.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),V.depositOn&&!V.depositPaid&&V.depositWaived?(0,$.jsxs)(S.T,{size:15,center:!0,colour:y.colours.goldLight,testID:"edit-deposit-waived-by",children:[F.depositWaived?.by?(0,k.waiverText)(F.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,V.depositWaived||pe.includes('deposit')?null:(0,$.jsx)(l.default,{style:{alignItems:'center'},children:(0,$.jsx)(w.WaiveDepositButton,{b:F,who:u,onDone:e=>Y({...V,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e})})}),V.depositOn?(0,$.jsx)(S.Field,{label:"Deposit due (\xa3)",value:K,onChangeText:e=>{Q(e),se({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,V.depositOn&&V.depositPaid?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S.Field,{label:"Amount paid (\xa3)",value:J,onChangeText:e=>{Z(e),se({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"How was it paid?"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,$.jsx)(S.Chip,{label:R(e),selected:V.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>se({depositMethod:e})},e))}),(0,$.jsx)(S.Field,{label:"Date paid (DD/MM/YYYY)",value:ee,onChangeText:e=>{te((0,s.slashDate)(e,ee)),se({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),ee.trim()&&!z(ee)?(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ce?null:(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,$.jsx)(S.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,$.jsxs)(L,{title:"When",testID:"edit-section-when",children:[(0,$.jsx)(D.BookingDatePicker,{r:M,today:new Date,value:V.date,onChange:e=>se({date:e})}),(0,$.jsx)(S.Field,{label:"Time (24-hour, for example 19:15)",value:V.time,onChangeText:e=>se({time:e}),testID:"edit-time"}),ae?null:(0,$.jsx)(S.T,{size:15,colour:y.colours.amber,children:"Write the time like 19:15."}),(0,$.jsx)(C.AdultsChildren,{value:(0,f.peopleOf)(V.partySize,V.children),onChange:e=>le(e),depositsOn:ie.on&&ie.perPersonPence>0,testID:"edit-people"}),(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,children:"Table time"}),(0,$.jsx)(S.Stepper,{testID:"edit-duration",value:V.duration||0,min:0,max:360,step:15,onChange:e=>se({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,$.jsxs)(L,{title:"Where",testID:"edit-section-where",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"Any area",selected:!V.area,testID:"edit-area-any",onPress:()=>se({area:''})}),H.areas.map(e=>(0,$.jsx)(S.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:V.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>se({area:e.name})},e.id))]}),(0,$.jsx)(S.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(V.table)}),(0,x.splitChoices)(V.table).length?(0,$.jsxs)(l.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:"Split the joined tables"}),(0,$.jsx)(S.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,x.splitChoices)(V.table).map(e=>(0,$.jsx)(S.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>se({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,$.jsxs)(S.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Button,{kind:V.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(V.table?'':', chosen'),onPress:()=>se({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),re.map(e=>(0,$.jsx)(S.Button,{kind:e===V.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===V.table?', chosen':''}`,onPress:()=>se({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,$.jsxs)(L,{title:"Guest",testID:"edit-section-guest",children:[(0,$.jsx)(S.Field,{label:"Name",value:V.name,onChangeText:e=>se({name:e}),testID:"edit-name"}),(0,$.jsx)(S.Field,{label:"Phone",value:V.phone,onChangeText:e=>se({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,$.jsx)(S.Field,{label:"Email",value:V.email,onChangeText:e=>se({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"Booked by"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:V.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>se({source:e.id})},e.id))}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(V.tags??[]).includes(e);return(0,$.jsx)(S.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>se({tags:t?(V.tags??[]).filter(t=>t!==e):[...V.tags??[],e].sort()})},e)})})]}),(0,$.jsxs)(L,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,$.jsx)(A,{label:"Dogs",value:V.dogs??0,max:6,onChange:e=>se({dogs:e}),testID:"edit-dogs"}),(0,$.jsx)(A,{label:"High chairs",value:V.highChairs??0,max:10,onChange:e=>se({highChairs:e}),testID:"edit-high-chairs"}),(0,$.jsx)(A,{label:"Wheelchair users",value:V.wheelchair??0,max:10,onChange:e=>se({wheelchair:e}),testID:"edit-wheelchair"}),(0,$.jsx)(S.T,{size:16,center:!0,children:"Occasion"}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:(V.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>se({occasion:e.id})},e.id||'none'))})]}),(0,$.jsxs)(L,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,$.jsxs)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,$.jsx)(S.Chip,{label:"No allergies",selected:!!V.allergyNone&&!be.length,testID:"edit-allergy-none",onPress:()=>se({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,$.jsx)(S.Chip,{label:e.short,selected:be.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>me(e.id)},e.id))]}),be.map(e=>(0,$.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,$.jsxs)(S.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,$.jsx)(S.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>se({allergies:be.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,$.jsx)(S.Field,{label:"Anything else about allergies",value:V.allergyNote,onChangeText:e=>se({allergyNote:e}),testID:"edit-allergy-note"}),pe.includes('allergies')&&be.length?(0,$.jsx)(S.T,{size:15,center:!0,colour:y.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,$.jsx)(A,{label:"Vegan",value:V.vegan??0,max:V.partySize,onChange:e=>se({vegan:e}),testID:"edit-vegan"}),(0,$.jsx)(A,{label:"Vegetarian",value:V.vegetarian??0,max:V.partySize,onChange:e=>se({vegetarian:e}),testID:"edit-vegetarian"})]}),(V.holds??[]).length||(F.holds??[]).some(e=>e.qty>0&&!e.served)?(0,$.jsxs)(L,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,$.jsx)(S.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(V.holds??[]).map(e=>{const t=(0,h.reservablesOf)(M),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),n=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,$.jsxs)(l.default,{testID:n,style:{gap:6,width:'100%'},children:[(0,$.jsxs)(S.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,$.jsx)(S.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,$.jsx)(S.Stepper,{testID:n,value:e.qty,min:0,max:20,onChange:t=>se({holds:(0,c.setEditableHoldQty)(V.holds??[],e.kind,e.id,t)}),label:i})]}),(0,$.jsx)(S.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${n}-remove`,onPress:()=>se({holds:(0,c.removeEditableHold)(V.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(V.holds??[]).length?null:(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==F.status?(0,$.jsxs)(L,{title:"Status",testID:"edit-section-status",children:[(0,$.jsx)(S.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,$.jsx)(S.Chip,{label:e.label,selected:V.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>se({status:e.id})},e.id))}),(0,$.jsx)(S.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,$.jsx)(L,{title:"Notes",testID:"edit-section-notes",children:(0,$.jsx)(S.Field,{label:"Notes",value:V.notes,onChangeText:e=>se({notes:e}),placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),G?(0,$.jsxs)(l.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg},children:[G.map(e=>(0,$.jsx)(S.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,$.jsx)(S.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,q?(0,$.jsx)(S.T,{size:16,center:!0,colour:y.colours.goldLight,children:q}):null,(0,$.jsxs)(S.Row,{gap:8,wrap:!0,children:[(0,$.jsx)(S.Button,{label:G?'Save anyway':'Save changes',testID:"edit-save",disabled:!ae||!ce||V.name.trim().length<1||!pe.length,onPress:()=>{const t=ae?(0,o.blockAt)(_,e,V.date,ne):void 0,s=(0,c.editWarnings)(F,he,N,t,ue,H);!s.length||G?ge():U(s)},style:{minHeight:56,flex:1}}),(0,$.jsx)(S.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),xe.length?(0,$.jsx)(L,{title:"Changes",testID:"edit-history",children:xe.slice(0,12).map((e,t)=>(0,$.jsx)(S.T,{size:14,center:!0,colour:y.colours.muted,children:e},t))}):null,(0,$.jsx)(T.CancelBookingButton,{rid:e,b:F,name:F.name,big:!0,onDone:()=>b()}),(0,$.jsx)(T.ReinstateBookingButton,{b:F,name:F.name,today:(0,j.ymd)(new Date),onDone:()=>b()})]})}},938,[31,834,128,823,829,828,1081,807,817,832,819,866,863,992,1420,825,822,1425,994,1422,1423,1424,1076,14,991,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useScreensaverAsleep",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"useDisplayToolsH",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(0,t.create)(t=>({asleep:!1,set:n=>t({asleep:n})})),s=(0,t.create)(()=>({h:65}))},939,[995]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhosOnShift=function({compact:e=!1}={}){const{today:t}=(0,l.useCtx)(15e3),u=(0,n.useOwner)(e=>(0,n.liveAttendance)(e.attendance)),f=(0,n.useOwner)(e=>e.staff),x=(0,r.workingNow)(u,f,t),b=(0,r.cardSpeech)(x);if(e)return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:b,style:{paddingVertical:2,paddingHorizontal:10,alignItems:'center',flexShrink:1,minWidth:0},children:(0,h.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'nowrap',gap:8,justifyContent:'center',alignItems:'center',minWidth:0},children:[(0,h.jsx)(c.T,{weight:"semibold",size:13,colour:o.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",style:{flexShrink:0},children:r.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:13,colour:o.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{flexDirection:'row',flexWrap:'wrap',columnGap:10,rowGap:2,justifyContent:'center',alignItems:'center',flexShrink:1,minWidth:0},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',gap:4,flexShrink:0},children:[(0,h.jsx)(c.T,{size:13,weight:"semibold",colour:o.colours.text,children:e.name}),(0,h.jsx)(c.T,{size:12,colour:o.colours.muted,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})});return(0,h.jsx)(s.default,{testID:"whos-on-shift",accessible:!0,accessibilityLabel:b,children:(0,h.jsxs)(c.Card,{style:{alignItems:'center'},children:[(0,h.jsx)(c.T,{weight:"semibold",size:22,colour:o.colours.gold,center:!0,accessibilityRole:"header",testID:"whos-on-shift-title",children:r.CARD_TITLE}),0===x.length?(0,h.jsx)(c.T,{size:18,colour:o.colours.muted,center:!0,testID:"whos-on-shift-empty",children:r.NOBODY}):(0,h.jsx)(s.default,{testID:"whos-on-shift-list",style:{gap:14,alignItems:'center',alignSelf:'stretch',width:'100%'},children:x.map(e=>(0,h.jsxs)(s.default,{testID:`whos-on-shift-${e.staffId}`,accessible:!0,accessibilityLabel:e.speech,style:{alignItems:'center',gap:2,minHeight:48,justifyContent:'center'},children:[(0,h.jsx)(c.T,{size:20,weight:"semibold",colour:o.colours.text,center:!0,children:e.name}),(0,h.jsx)(c.T,{size:16,colour:o.colours.muted,center:!0,children:e.inLabel}),e.onBreak?(0,h.jsx)(c.Badge,{kind:"amber",label:"On break"}):null]},e.id))})]})})},_r(d[0]);var e,t=_r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},l=_r(d[2]),n=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),h=_r(d[7])},940,[31,128,953,863,1476,825,818,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=f,_e.SoldOutSheet=function({visible:e,onClose:t,rid:s,by:o,hideLinks:n=!0,testID:i="soldout-sheet"}){return(0,k.jsx)(l.Sheet,{visible:e,onClose:t,title:"Add sold out",maxWidth:520,testID:i,children:(0,k.jsx)(f,{rid:s,by:o,hideLinks:n})})};var e,t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),a=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),k=_r(_d[12]);const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])r.useOwner.getState().sys(s,e,t)};function f({rid:e,by:o,canMark:r=!0,hideLinks:f=!1}){const b=(0,d.useSoldOut)(e=>e.entries),p=(0,i.useStore)(e=>e.clock),w=(0,i.useStore)(e=>e.menu),S=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[I,$]=(0,s.useState)(''),C=(0,h.nowFrom)(p),D=(0,a.activeSoldOut)(b,e,C),M=new Set(D.map(e=>e.itemId)),L=(0,a.soldOutSettingsOf)(S?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),v=b.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),O=(0,s.useMemo)(()=>w.filter(t=>t.restaurantId===e&&!t.hidden&&!M.has(t.id)&&(!I.trim()||t.name.toLowerCase().includes(I.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[w,e,I,D.length]),B=t=>d.useSoldOut.getState().entries.some(s=>s.rid===e&&s.itemId===t&&s.on),A=(t,s)=>{const n=b.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));w.some(e=>e.id===t)&&(0,d.setSoldOut)(t,!1,o),B(t)&&d.useSoldOut.getState().back(e,t,o),x(`Back on: ${s}${n?' (kept on until the count changes)':''}`)};return(0,k.jsxs)(n.default,{testID:"soldout-list",style:{gap:10},children:[(0,k.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,k.jsx)(l.T,{size:13,colour:D.length?m.colours.amber:m.colours.muted,children:D.length?(0,a.soldOutCount)(D.length):'Nothing sold out'})]}),D.length?D.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,k.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,k.jsxs)(l.Muted,{children:["Since ",y(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${y(e.clearAfter)}`:''}`]})]}),r?(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Cancel sold out: ${e.name}, put ${e.name} back on`,onPress:()=>A(e.itemId,e.name)}):null]},e.itemId)):(0,k.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),v.length?(0,k.jsx)(n.default,{testID:"soldout-kept",children:(0,k.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",v.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,k.jsxs)(l.Muted,{children:["Clears by itself: ",a.SOLD_OUT_CLEAR_LABEL[L.clear].toLowerCase(),". ",L.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),!f&&T.items.length?(0,k.jsx)(j,{rid:e,by:o,canEdit:r,auto:L.auto,view:T}):null,r?(0,k.jsxs)(l.Card,{children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,k.jsx)(t.TextInput,{testID:"soldout-search",value:I,onChangeText:$,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),O.slice(0,60).map(t=>(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{children:t.name}),(0,k.jsx)(l.Muted,{children:t.section})]}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${t.id}`,accessibilityLabel:`Mark sold out: ${t.name}`,onPress:()=>{return s=t.id,n=t.name,(0,d.setSoldOut)(s,!0,o),B(s)||d.useSoldOut.getState().mark(e,s,n,o),void x(`Sold out: ${n}`);var s,n}})]},t.id)),O.length?null:(0,k.jsx)(l.Muted,{children:I?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})}const b={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},p=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function j({rid:e,by:t,canEdit:o,auto:i,view:d}){const[r,a]=(0,s.useState)(!1),[h,y]=(0,s.useState)(null),[x,f]=(0,s.useState)([]),j=d.dishes.filter(t=>t.uses.length||'none'===t.source&&d.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(r?d.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=d.items.map(e=>`${e.name.toLowerCase()} ${p(d.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>f(o=>o.map(o=>o.key===e?{...o,qty:Math.max(0,Math.min(20,o.qty+s*('half'===t.unit?.5:1)))}:o)),$=(s,o)=>{u.useSoldOutLinks.getState().setLink(e,s,o,t),y(null)};return(0,k.jsx)(n.default,{testID:"soldout-links",children:(0,k.jsxs)(l.Card,{children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,k.jsx)(n.default,{testID:"soldout-links-counts",children:(0,k.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,k.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,k.jsxs)(n.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,k.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,k.jsxs)(n.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,k.jsx)(l.T,{weight:"semibold",children:e.name}),(0,k.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,d.items)}`:'Not linked to the counts',b[e.source]?` \xb7 ${b[e.source]}`:'']})]}),o&&h!==e.id?(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,y(t),void f(d.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,k.jsxs)(n.default,{style:{gap:6},children:[d.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,k.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,k.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,k.jsx)(n.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,k.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:p(s)})}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,k.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),d.items)}.`:'Not linked: never marked from the counts.']}),(0,k.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,k.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,k.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y(null)})]}),(0,k.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,d.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,k.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,k.jsx)(l.Button,{small:!0,kind:"ghost",label:r?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>a(!r)})]})})}},941,[874,31,128,818,823,942,863,984,982,983,881,825,25]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOut",{enumerable:!0,get:function(){return f}}),_e.setSoldOutBy=m,_e.setSoldOut=function(e,t,n){if(!o.useStore.getState().menu.find(t=>t.id===e))return;n&&m(n);p.add(e);try{o.useStore.getState().updateMenuItem(e,{soldOut:t})}finally{p.delete(e)}},_e.soldOutNow=function(e,t=c()){return(0,i.activeSoldOut)(f.getState().entries,e,t)},_e.linkSoldOut=h,_e.useSoldOutLink=function(e,t,n=!0){const r=_r(d[9]);r.useEffect(()=>{n&&h({adopt:e})},[e,n]),r.useEffect(()=>{n&&m(t)},[t,n])};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),a=_r(d[2]),i=_r(d[3]),s=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]);const c=()=>{try{return(0,o.nowFrom)(o.useStore.getState().clock)}catch{return new Date}},f=(0,r.create)()((0,a.persist)((e,t)=>({entries:[],adopted:{},mark:(t,n,r,a)=>{const u=c(),l=o.useStore.getState().restaurants.find(e=>e.id===t),f=(0,i.soldOutSettingsOf)(l?.settings?.soldOut),S=l?(0,s.hoursFor)(l,u)?.close??null:null,m=(0,i.clearAfterFor)(u,f,S),p={rid:t,itemId:n,name:r.slice(0,120),on:!0,at:u.toISOString(),by:a.slice(0,80),clearAfter:m?.toISOString(),auto:!1,kept:!1};e(e=>({entries:[...e.entries.filter(e=>!(e.rid===t&&e.itemId===n)),p]}))},back:(n,r,a)=>{const i=t().entries.find(e=>e.rid===n&&e.itemId===r);i&&i.on&&e(e=>({entries:e.entries.map(e=>e===i?{...e,on:!1,at:c().toISOString(),by:a.slice(0,80),clearAfter:void 0,kept:!0}:e)}))},expire:(n,r)=>{const a=(0,i.expiredSoldOut)(t().entries,n,r);if(!a.length)return 0;const s=new Set(a.map(e=>e.itemId));return e(e=>({entries:e.entries.map(e=>e.rid===n&&s.has(e.itemId)?{...e,on:!1,by:'Cleared automatically',clearAfter:void 0}:e)})),a.length}}),{name:'covercharge-soldout-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default),partialize:e=>({entries:e.entries.slice(-500),adopted:e.adopted})}));let S='Staff';function m(e){e&&(S=e.replace(' (example)',''))}const p=new Set;let O=null;function h(e){if(O)return O;let t=!1;const n=(e=o.useStore.getState().menu)=>new Map(e.map(e=>[e.id,e.soldOut]));let r=n();if(e.adopt){const e={...f.getState().adopted},t=[];for(const t of o.useStore.getState().menu)e[t.restaurantId];for(const t of o.useStore.getState().menu)e[t.restaurantId]=!0;f.setState(n=>({entries:[...n.entries,...t],adopted:e}))}const a=()=>{const e=c(),a=f.getState().entries,i=o.useStore.getState().menu,s=new Map;for(const t of a){const n=t.on&&(!t.clearAfter||new Date(t.clearAfter).getTime()>e.getTime());s.set(`${t.rid}|${t.itemId}`,n)}const u=i.filter(e=>s.has(`${e.restaurantId}|${e.id}`)&&s.get(`${e.restaurantId}|${e.id}`)!==e.soldOut);if(u.length){t=!0;try{const e=new Map(u.map(e=>[e.id,s.get(`${e.restaurantId}|${e.id}`)]));o.useStore.setState(t=>({menu:t.menu.map(t=>e.has(t.id)?{...t,soldOut:e.get(t.id)}:t)}))}finally{t=!1,r=n()}}},i=o.useStore.subscribe((e,i)=>{if(e.menu===i.menu)return;const s=n(e.menu);let o=!1;if(!t)for(const t of e.menu){const e=r.get(t.id);void 0!==e&&e!==t.soldOut&&(p.has(t.id)?t.soldOut?f.getState().mark(t.restaurantId,t.id,t.name,S):f.getState().back(t.restaurantId,t.id,S):o=!0)}r=s,o&&setTimeout(a,0)}),s=f.subscribe((e,t)=>{e.entries!==t.entries&&a()}),u=()=>{const e=c(),t=new Set(f.getState().entries.filter(e=>e.on).map(e=>e.rid));for(const n of t)f.getState().expire(n,e)};u(),a();const l=setInterval(u,3e4);let m=null;if(e.adopt)try{m=_r(d[8],"./autoSoldOutStore").startAutoSoldOut()}catch{m=null}return O=()=>{i(),s(),clearInterval(l),m&&m(),O=null},O}u.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchLive=e=>(0,l.setLiveData)(!!e),globalThis.__pitchSoldOut=e=>{const t=o.useStore.getState(),n=t.restaurants[0]?.id;if(!n)return;const r=t.menu.filter(e=>e.restaurantId===n&&!e.hidden),a=['Sticky toffee pudding','Cullen skink','Fish supper','Steak pie','Haggis bon bons','Cranachan','Lemon tart','Mussels','Scampi','Venison burger','Chips (large)','Oysters','Lobster thermidor','Crab claws','Tablet ice cream','Beef shin','Smoked salmon','Cheeseboard','Halibut','Clootie dumpling'],i=(new Date).toISOString(),s=Array.from({length:e},(e,t)=>r[t]?{id:r[t].id,name:r[t].name}:{id:`pitch-so-${t}`,name:a[t%a.length]});f.setState(e=>({entries:[...e.entries.filter(e=>e.rid!==n||!s.some(t=>t.id===e.itemId)).map(e=>e.rid===n?{...e,on:!1}:e),...s.map(e=>({rid:n,itemId:e.id,name:e.name,on:!0,at:i,by:'Chef'}))]}))})},942,[1190,995,1191,984,833,881,2,1218,982,31]); +__d(function(g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dismissNotice",{enumerable:!0,get:function(){return u.dismissNotice}}),Object.defineProperty(_e,"notify",{enumerable:!0,get:function(){return u.notify}}),Object.defineProperty(_e,"useSliders",{enumerable:!0,get:function(){return u.useSliders}}),Object.defineProperty(_e,"SLIDER",{enumerable:!0,get:function(){return j}}),_e.SliderButton=k,_e.SliderCard=C,_e.SliderHost=function(){y();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);(0,t.useEffect)(()=>{if(p)return window.ccSlider=e=>(0,u.notify)(e),()=>{delete window.ccSlider}},[]),(0,t.useEffect)(()=>{if(o.current&&clearTimeout(o.current),!n)return;const e=void 0!==n.timeoutMs?n.timeoutMs:n.actions?.length||n.content?null:6e3;return e&&(o.current=setTimeout(()=>u.useSliders.getState().dismiss(n.id),e)),()=>{o.current&&clearTimeout(o.current)}},[n?.id,n?.timeoutMs]);const[l,c]=(0,t.useState)(0);if((0,t.useEffect)(()=>{if(!p||!n)return;const e=()=>{const e=document.querySelector('[data-testid="app-bottom-tabs"]');c(e?Math.max(0,Math.round(window.innerHeight-e.getBoundingClientRect().top)):0)};e();const t=setTimeout(e,300);return window.addEventListener('resize',e),()=>{clearTimeout(t),window.removeEventListener('resize',e)}},[n?.id]),!n)return null;const a=p?'fixed':'absolute';return(0,f.jsxs)(f.Fragment,{children:[n.modal?(0,f.jsx)(s.default,{...x('dim'),style:{position:a,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,f.jsx)(s.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:a,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...p?{bottom:l?`${12+l}px`:'calc(12px + env(safe-area-inset-bottom))'}:{}},children:(0,f.jsx)(C,{n:n,waiting:e.length-1,onClose:()=>u.useSliders.getState().dismiss(n.id)},n.id+':'+(n.seq??0))})]})};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=e(r(d[4])),l=e(r(d[5])),c=r(d[6]),a=r(d[7]),u=r(d[8]),b=r(d[9]),f=r(d[10]);const p='undefined'!=typeof document,h="\n[data-ccsl=\"in\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccsl-in{from{opacity:0;transform:translate3d(0,110%,0)}to{opacity:1;transform:none}}\n[data-ccsl=\"urgent\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both,ccsl-red 1.6s ease-in-out .45s infinite}\n@keyframes ccsl-red{0%,100%{box-shadow:0 10px 30px rgba(0,0,0,.6),0 0 0 1px rgba(255,107,94,.55)}50%{box-shadow:0 10px 40px rgba(0,0,0,.6),0 0 0 2px #FF6B5E,0 0 34px rgba(255,107,94,.45)}}\n[data-ccsl=\"dim\"]{animation:ccsl-dim .3s ease both}\n@keyframes ccsl-dim{from{opacity:0}to{opacity:1}}\n@media (prefers-reduced-motion: reduce){[data-ccsl]{animation:none !important}}\n",x=e=>p?{dataSet:{ccsl:e}}:{};function y(){(0,t.useEffect)(()=>{if(!p||document.getElementById('cc-slider-css'))return;const e=document.createElement('style');e.id='cc-slider-css',e.textContent=h,document.head.appendChild(e)},[])}const j={bg:'#17140F',border:'rgba(207,164,95,.55)',text:'#F5F1E8',quiet:'#A89A80',gold:c.colours.gold,ink:'#17130D'},w=(e="normal")=>'urgent'===e?c.colours.red:'warn'===e?c.colours.amber:c.colours.gold,S=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':j.border;function k({a:e,onDone:t,big:o}){const s=e.kind??'primary';return(0,f.jsx)(n.default,{testID:e.testID,accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{try{e.onPress?.()}finally{e.keepOpen||t()}},style:({pressed:e})=>({minHeight:o?56:44,minWidth:44,paddingHorizontal:'ghost'===s?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===s?j.gold:'transparent',borderWidth:'danger'===s?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,f.jsx)(a.T,{size:o?18:'ghost'===s?14:15,weight:'primary'===s?'bold':'medium',colour:'primary'===s?j.ink:'danger'===s?c.colours.red:j.quiet,children:e.label})})}function C({n:e,onClose:t,waiting:n=0,maxWidth:c=520}){y();const u=e.tone??'normal',h=w(u),C=e.content,z=!!e.big,{height:I}=(0,l.default)(),D=e.actions??[];return(0,f.jsxs)(s.default,{testID:e.testID??'cc-slider',accessibilityRole:"summary",accessibilityLabel:`${e.kicker?e.kicker+': ':''}${e.title}`,...x('urgent'===u?'urgent':'in'),style:{width:'100%',maxWidth:z?Math.max(c,900):c,alignSelf:'center',borderRadius:14,backgroundColor:j.bg,borderWidth:1,borderColor:S(u),overflow:'hidden',...p?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,f.jsx)(s.default,{style:{position:'absolute',left:0,top:0,bottom:0,width:5,backgroundColor:h}}):null,(0,f.jsxs)(o.default,{style:{maxHeight:Math.max(220,I-40)},contentContainerStyle:{paddingVertical:z?18:12,paddingLeft:'normal'!==u?z?24:18:z?20:14,paddingRight:z?20:14,gap:z?10:6},children:[(0,f.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:12},children:[e.icon?(0,f.jsx)(a.T,{size:z?34:22,children:e.icon}):null,(0,f.jsxs)(s.default,{style:{flex:1,gap:2},children:[e.kicker?(0,f.jsx)(a.T,{size:z?15:11,weight:"bold",colour:h,style:{letterSpacing:1.4},children:e.kicker}):null,(0,f.jsx)(a.T,{size:z?24:15,weight:"medium",colour:j.text,children:e.title}),e.body?(0,f.jsx)(a.T,{size:z?18:13,colour:j.quiet,children:e.body}):null]}),D.length||C?null:(0,f.jsx)(b.ToastClose,{testID:"cc-slider-ok",label:`Close: ${e.title}`,onPress:t,size:z?'lg':'md',colour:j.quiet})]}),C?(0,f.jsx)(C,{close:t}):null,D.length?(0,f.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:D.map(e=>(0,f.jsx)(k,{a:e,onDone:t,big:z},e.label))}):null,n>0?(0,f.jsxs)(a.T,{size:z?14:11,colour:j.quiet,center:!0,style:{alignSelf:'stretch'},children:[n," more waiting"]}):null]})]})}},943,[31,123,264,152,128,288,825,818,980,835,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CoversToday=function({rid:e,onPress:p,big:x,sound:$,testID:v="covers-today",day:j,compact:C=!1,snug:w=!1,tight:T=!1,aside:k}){const D=(0,c.useBookings)(e),S=(0,c.useNow)(3e4),I=(0,h.venueYmd)(S),L=j&&j!==I?j:I,_=L!==I,M=(0,u.coversFour)(D,L),R=(0,y.dayWord)(L,I),z=/^(Today|Yesterday|Tomorrow)$/.test(R),O=`COVERS ${R.toUpperCase()}`,P=_?`${z?`${R}\u2019s`:R} bookings \u203a`:'Today\u2019s bookings \u203a',W=_?`${z?`${R}, `:''}${(0,y.dayLong)(L)}`:'today',E=(0,o.useLiveState)();if('ready'!==E)return(0,f.jsx)(o.LiveWait,{state:E,title:"Covers today",testID:`${v}-wait`});const F=x?64:T?28:w?36:44,V=M.total?Math.min(1,M.done/M.total):0,Y=(e,o,t,c)=>(0,f.jsxs)(s.default,{style:{flex:1,alignItems:'center',gap:T?2:w?4:6,minWidth:0},children:[(0,f.jsx)(l.SplitFlap,{value:o,height:F,colour:t,testID:`covers-${c}`,sound:$}),(0,f.jsx)(n.T,{size:T?11:x||C?14:12,weight:"semibold",colour:b.colours.muted,numberOfLines:1,center:C||T,style:{letterSpacing:.4},children:e})]});return(0,f.jsxs)(t.default,{testID:v,dataSet:{centreExempt:'dashboard-card'},accessibilityRole:"button",disabled:!p,onPress:p,accessibilityLabel:`Covers ${W}: ${M.done} done, ${M.seated} seated, ${M.toCome} to come, ${M.total} total.${p?` Opens ${_?'that day\u2019s':'today\u2019s'} bookings.`:''}`,style:({pressed:e})=>({backgroundColor:e?b.colours.tilePressed:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:T?6:16,...w&&!T?{paddingVertical:8,paddingHorizontal:10}:null,gap:T?4:w?8:12}),children:[T?null:(0,f.jsxs)(s.default,{style:{flexDirection:C?'column':'row',justifyContent:'space-between',alignItems:'center',gap:C?w?2:6:void 0},children:[(0,f.jsx)(n.T,{center:C,size:C?16:12,weight:"semibold",colour:b.colours.goldMuted,style:{letterSpacing:1.6},children:O}),p?(0,f.jsx)(n.T,{center:C,size:C?14:12,colour:b.colours.muted,children:P}):null]}),(0,f.jsxs)(s.default,{style:{flexDirection:'row',gap:8},children:[Y('Done',M.done,b.colours.text,'done'),Y('Seated',M.seated,b.colours.text,'seated'),Y('To come',M.toCome,b.colours.text,'tocome'),Y('Total',M.total,b.colours.goldLight,'total')]}),T?null:(0,f.jsx)(s.default,{style:{height:4,borderRadius:2,backgroundColor:'rgba(255,255,255,0.06)',overflow:'hidden'},children:(0,f.jsx)(s.default,{style:{width:`${Math.round(100*V)}%`,height:4,backgroundColor:b.colours.gold,borderRadius:2}})})]})},r(d[0]);var o=r(d[1]),t=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),b=r(d[10]),f=r(d[11])},944,[31,1388,264,128,1413,818,823,832,822,967,825,25]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTravelDay=_,_e.DayBar=function({app:e,today:t}){const a=_(e,t),o=j(e=>e.set),l=a??t,[n,u]=k[e],y=(0,D.useDateCalendar)();return(0,d.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,A.jsxs)(r.default,{testID:"day-bar",style:{gap:8},children:[(0,A.jsx)(s.DaySwitch,{day:l,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day",onPickDate:y.openCal}),a?(0,A.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null,(0,A.jsx)(D.AppDateCalendar,{visible:y.calOpen,today:t,day:l,onDay:t=>o(e,t),onClose:y.closeCal,back:-n,ahead:u,idPrefix:"day-cal"})]})},_e.DayView=function({rid:e,day:s,today:d,app:l}){const n=(0,u.useRestaurant)(e),D=(0,u.useBookings)(e),j=(0,u.useEvents)(e),k=(0,f.parseYmd)(s),_=se.date===s),w=(0,p.regularEventsOf)(n).filter(e=>(0,p.occursOn)(e,s)),T=D.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===l;return(0,A.jsxs)(r.default,{testID:"day-view",style:{gap:12},children:[(0,A.jsxs)(c.Card,{children:[(0,A.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,f.niceDate)(k),$?` \xb7 ${$.name} hours`:'']}),(0,A.jsx)(c.Badge,{kind:"gold",label:_?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,A.jsxs)(c.T,{size:E?18:15,children:[B?`Kitchen ${C(B[0])}\u2013${C(B[1])}`:'Kitchen closed',B&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${C(v.time)} (${v.reason})`:'']}),w.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${C(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),O.map(e=>(0,A.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,A.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,A.jsx)(a.CoversToday,{rid:e,day:s}),(0,A.jsx)(m.PlattersBooked,{rid:e,date:s,label:_?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,A.jsxs)(r.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,A.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," Covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,A.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,A.jsx)(m.BookingNeeds,{b:s}),'display'!==l&&!_&&['confirmed','pending'].includes(s.status)?(0,A.jsx)(r.default,{style:{flexDirection:'row'},children:(0,A.jsx)(x.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,A.jsx)(c.Muted,{children:_?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),D=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),A=_r(_d[17]);const j=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),k={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},C=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=j(t=>t.day[e]);return s&&s!==t?s:null}},945,[812,967,944,994,31,128,995,818,823,832,833,814,822,825,1409,993,1079,25]); +__d(function(_g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setDisplaySilent",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"soundAllowed",{enumerable:!0,get:function(){return u}}),e.chime=function(t="bright"){if(!u())return void l('__ccChimesBlocked');try{const n=o();if(!n)return;('bright'===t?[880,1318.5]:[659.3]).forEach((o,c)=>{const i=n.currentTime+.16*c,u=n.createOscillator(),l=n.createGain();u.type='sine',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime('bright'===t?.12:.07,i+.02),l.gain.exponentialRampToValueAtTime(1e-4,i+.9),u.connect(l).connect(n.destination),u.start(i),u.stop(i+.95)}),l('__ccChimes')}catch{}},Object.defineProperty(e,"LOW_CHIME_MIN",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"LOW_CHIME_MAX",{enumerable:!0,get:function(){return d}}),e.lowChime=function(t=0){if(!u())return void l('__ccChimesBlocked');const n=s+.095*Math.max(0,Math.min(1,t));'undefined'!=typeof window&&(window.__ccLowChimeLevels=[...window.__ccLowChimeLevels??[],Math.round(1e3*n)/1e3].slice(-40));try{const t=o();if(!t)return;[220,164.8].forEach((o,c)=>{const i=t.currentTime+.42*c,u=t.createOscillator(),l=t.createGain(),s=t.createBiquadFilter?.();u.type='triangle',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime(n,i+.12),l.gain.exponentialRampToValueAtTime(1e-4,i+1.6),s?(s.type='lowpass',s.frequency.value=900,u.connect(s).connect(l).connect(t.destination)):u.connect(l).connect(t.destination),u.start(i),u.stop(i+1.7)}),l('__ccLowChimes')}catch{}},Object.defineProperty(e,"flapSoundOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setFlapSound",{enumerable:!0,get:function(){return w}}),e.flapClick=function(){if('display'!==t.APP_VARIANT&&!c)return;if(!p())return;try{const t=o();if(!t)return;const n=t.currentTime,c=Math.floor(.03*t.sampleRate),i=t.createBuffer(1,c,t.sampleRate),u=i.getChannelData(0);for(let t=0;t{if('undefined'==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;return t?(n||(n=new t),'suspended'===n.state&&n.resume?.().catch?.(()=>{}),n):null};if('undefined'!=typeof window){const t=()=>{try{o()}catch{}window.removeEventListener('pointerdown',t)};window.addEventListener('pointerdown',t)}let c=!1;const i=t=>{c=t},u=()=>'display'!==t.APP_VARIANT&&!c,l=t=>{'undefined'!=typeof window&&(window[t]=(window[t]??0)+1)};const s=.015,d=.11;const f='cc-flap-sound',p=()=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(f)}catch{return!1}},w=t=>{try{localStorage.setItem(f,t?'1':'0')}catch{}}},946,[123,807]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},947,[812,31,980,823,832,822,946]); +__d(function(g,r,i,a,_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()})}},948,[805,31,288,128,995,807,953,1172,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyIcon=function({text:e,size:o=20,colour:n=c.colours.amber,ink:u=c.colours.bg,testID:x}){return(0,h.jsx)(t.default,{testID:x,accessible:!0,accessibilityRole:"image",accessibilityLabel:`Allergy noted: ${e}`,style:{width:o,height:o,flexShrink:0},children:(0,h.jsxs)(s.default,{width:o,height:o,viewBox:"0 0 24 24",children:[(0,h.jsx)(l.Path,{d:"M12 2.2 C12.7 2.2 13.3 2.6 13.7 3.2 L22.6 19.1 C23.4 20.5 22.4 22 20.9 22 L3.1 22 C1.6 22 0.6 20.5 1.4 19.1 L10.3 3.2 C10.7 2.6 11.3 2.2 12 2.2 Z",fill:n}),(0,h.jsx)(l.Rect,{x:10.7,y:8,width:2.6,height:7.6,rx:1.3,fill:u}),(0,h.jsx)(l.Rect,{x:10.7,y:17.2,width:2.6,height:2.6,rx:1.3,fill:u})]})})},r(d[0]);var t=e(r(d[1])),l=r(d[2]),s=e(l),c=r(d[3]),h=r(d[4])},949,[31,128,989,825,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReviewAlerts=function(s){(0,n.useEffect)(()=>(0,u.ensureReviewSync)(s,'owner'===t.APP_VARIANT?'manage':'read'),[s])};var n=r(d[0]),t=r(d[1]),u=r(d[2])},950,[31,807,1492]); +__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'},951,[825]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=A,_e.resetTableLive=W,_e.seatBookingNow=E,_e.finishBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'finished'),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=H,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=Y,_e.WalkInSheet=U,_e.WalkInMatchPrompt=Q,_e.AssignTableSheet=V,_e.undoNotice=G,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[i,n]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>n({b:e}),combineTables:e=>n({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(U,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:G}):null,l?(0,L.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,L.jsx)(V,{booking:i.b,combine:i.combine,onClose:()=>n(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=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),B=_r(_d[28]),z=_r(_d[29]),O=_r(_d[30]),N=_r(_d[31]),M=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function A(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function E(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)}function H(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=A(e),a=(0,v.useFloor)(t=>t.live[e])??{},i=(0,v.usePlan)(e),n=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(n,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(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,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function Y({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=i?6:8,f=i?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(n??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],n=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!n,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,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?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:n?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:n?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function U({onClose:e,onSeated:a,wide:i,initialTable:n}){const{rid:r,r:d,now:x}=(0,y.useCtx)(15e3),T=H(r,x),[I,$]=(0,c.useState)(2),[P,B]=(0,c.useState)(!1),[z,N]=(0,c.useState)(n??null),R=(0,v.usePlan)(r),A=(0,k.useBookings)(r),_=(0,D.useBlocks)(e=>e.blocks),U=(0,D.closedAreasAt)(_,r,(0,w.ymd)(x),(0,w.hm)(x)),V=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(T).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(R,A.filter(e=>e.date===(0,w.ymd)(x)),e,I,x,(0,j.turnFor)(I,d.settings.turnMins),90,void 0,{closed:U})?.table??null},[R,A,T,I,U.size,x.getTime()]);(0,c.useEffect)(()=>{z&&(0,v.tablesOf)(z).some(e=>'Closed'===T[e]?.label)&&N(null)},[z,U.size]);const[G,K]=(0,c.useState)(!1),[X,J]=(0,c.useState)(''),Z=(e,t=String(e),s=()=>{B(!1),$(e)})=>{const o='9+'===t?P:!P&&I===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},ee=(0,L.jsx)(s.PartySizeInput,{value:I,onChange:$,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),te=(0,L.jsxs)(m.default,{style:{gap:8,width:i?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>Z(e)),Z(9,'9+',()=>{B(!0),$(e=>e>=9?e:9)})]}),P?ee:null]}),[se,oe]=(0,c.useState)(!1),[le,ae]=(0,c.useState)(null),ie=async(t=z,s=!1)=>{if(!se&&(0,M.guardBookingChange)(F)){if(!s){const e=(0,O.bookingsNearWalkIn)(A,x,I);if(e.length)return void ae({at:t,list:e})}oe(!0);try{const s=await k.repo.bookings.seatWalkIn(r,I,t??void 0,X);W(r,t??void 0),a(s),e()}finally{oe(!1)}}},ne=async(t,s)=>{if(!se&&(0,M.guardBookingChange)(F)){oe(!0);try{const o=s??t.table??null;o&&o!==t.table&&await k.repo.bookings.assignTable(t.id,o),await E(r,{...t,table:o??void 0}),(0,u.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})`}),ae(null),e()}finally{oe(!1)}}},re=(0,L.jsxs)(m.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),z?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>N(null)}):null]}),(0,L.jsx)(Y,{use:T,value:z,onPick:e=>{T[e]&&!T[e].busy?ie(e):N(z===e?null:e)},big:i,dense:i,best:V,bestSet:(0,h.bestTables)(R)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",V&&!z?` (suggested for ${I}: ${(0,l.tableNumbers)(V)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(x)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${I} ${1===I?'person':'people'}${z?` \xb7 ${(0,l.tableNumbers)(z)}`:''}`,disabled:se,onPress:()=>{ie()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[te,re]}):(0,L.jsxs)(L.Fragment,{children:[te,re]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[G?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:X,onChangeText:J,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>K(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),le?(0,L.jsx)(Q,{list:le.list,busy:se,onYes:e=>{ne(e,le.at)},onNo:()=>{const e=le.at;ae(null),ie(e,!0)},onClose:()=>ae(null)}):null]})}function Q({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,L.jsx)(C.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,L.jsxs)(m.default,{style:{gap:14},children:[e.map((e,o)=>(0,L.jsxs)(m.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,L.jsx)(m.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:26,weight:"bold",colour:S.colours.goldLight,testID:"walkin-match-question",children:(0,O.walkInMatchQuestion)(e)})}),e.table?(0,L.jsxs)(C.T,{size:17,colour:S.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,L.jsx)(C.T,{size:17,colour:S.colours.text,children:e.ref}),(0,L.jsx)(C.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,L.jsx)(C.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,y.useCtx)(15e3),n=H(o,i),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(i)),t,e.partySize,i,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,i.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),$=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,P=D.reduce((e,t)=>e+$(t),0),B=D.length>0&&P{if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},O=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${P} seats for ${e.partySize} Covers`:'No tables picked yet'})}),B?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-P," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:O,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(Y,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function G(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:O}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[A,W]=(0,c.useState)(ee.blocks),[_,Y]=(0,c.useState)(!1),[q,U]=(0,c.useState)(''),[Q,V]=(0,c.useState)(2),[G,K]=(0,c.useState)(0),X=Math.min(G,Math.max(0,Q-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ie,ne]=(0,c.useState)('phone'),[re,de]=(0,c.useState)((0,$.emptyNeeds)()),ue=(0,$.needsMissing)(re),[ce,be]=(0,c.useState)(null),ge=(0,v.usePlan)(b),he=(0,z.dogSetUp)(ge),pe=!0===re.dog&&he,me=re.dog?re.dogs:0,fe=(0,w.parseYmd)(A),ye=(0,j.turnFor)(Q,h.settings.turnMins),ke=E.filter(e=>e.date===A),xe=e=>(0,j.freeTablesAt)(ge,ke,Q,new Date(`${A}${(0,l.tableNumbers)(e)}:00`),ye,h.settings.turnMins,{dog:!0,closed:(0,D.closedAreasAt)(H,b,A,e)}),je=pe&&J?xe(J):[];(0,c.useEffect)(()=>{be(null)},[pe,J,Q]);const we=(0,x.bookingSlots)(h,fe,e=>E.filter(t=>t.date===A&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Q,A===(0,w.ymd)(p)?p:(0,w.addMins)(fe,0),e=>E.filter(t=>t.date===A&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Se=(0,T.guestPhone)(se),[Te,Ce]=(0,c.useState)(!1),ve=J?we.find(e=>e.time===J):void 0,De=ve&&ve.left=2&&!!J&&(!$e||Te)&&(0,o.validParty)(Q)&&Se.ok&&(0,T.emailOk)(le)&&(!Pe||Be&&_)&&(!pe||je.length>0)&&!ze,Ne=re.wheelchair>0||re.stepFree;return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(fe)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)($.FirstQuestions,{rid:b,value:re,onChange:de,party:Q,audience:"staff"}),re.dog&&!he?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:A,onChange:e=>{e!==A&&(W(e),Z(null),Y(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===ie,onPress:()=>ne('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===ie,onPress:()=>ne('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:U,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Se.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Se.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,L.jsx)(n.AdultsChildren,{value:(0,r.peopleOf)(Q,X),onChange:e=>{V(e.partySize),K(e.children),Ce(!1)},depositsOn:(0,i.depositOf)(h.settings).on&&(0,i.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:we.map(e=>{const t=pe&&e.available&&!xe(e.time).length||!(0,$.dogTimeOk)(h,E,A,e.time,me);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,A,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),Y(!1),Ce(!1)}},e.time)})}),$e?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[De?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Q,De.left,De.time)}):null,Ie?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ie.time,Ie.cap)}):null,(0,L.jsx)(C.Chip,{label:Te?'Booking over the limit: on':'Book anyway (over the limit)',selected:Te,onPress:()=>Ce(e=>!e),testID:"nb-over-ok"})]}):null,pe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",ge.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),je.length?(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:je.slice(0,10).map((e,t)=>(0,L.jsx)(C.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${Ne&&(0,z.accessibleSetUp)(ge)&&!(0,z.isAccessible)(ge,e.table)?' \xb7 not step-free':''}`,selected:(ce??je[0].table)===e.table,onPress:()=>be(e.table)},e.table))}):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Q," at ",J,". Try another time."]})]}):null,Pe?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Pe.from,"\u2013",Pe.to,Pe.reason?` (${Pe.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:_?'Manager override on':'Override and book anyway',selected:_,onPress:()=>Y(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,we.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(fe)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)($.MoreQuestions,{rid:b,r:h,value:re,onChange:de,party:Q,date:A,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ne&&!(0,z.accessibleSetUp)(ge)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:P.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(h.settings),Q,X))," (",(0,a.gbp)((0,i.depositOf)(h.settings).perPersonPence)," per adult for ",(0,i.depositOf)(h.settings).fromParty,"+",X?`; ${X} ${1===X?'child':'children'} free`:'; children free',"). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsxs)(C.Muted,{children:["The guest gets a confirmation text",le.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ze?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:ue.length?ue[0]:'Save booking',testID:"nb-save",disabled:!Oe,onPress:()=>{if(A<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,$.needsPatch)(re),s=re.tableReq.find(e=>!pe||je.some(t=>t.table===e)),o=pe?null:(0,N.requestedFreeTable)(re.tableReq,{date:A,time:J,partySize:Q},ge.tables.map(e=>e.name),ke,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Q,date:A,time:J,notes:ee.trim(),security:(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?'deposit':'none',depositPaid:0,...X?{children:X}:{},...(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X)?{depositDue:(0,i.depositDue)((0,i.depositOf)(h.settings),Q,X),depositPolicy:(0,i.depositWords)((0,i.depositOf)(h.settings),Q,h.name,X).join(' '),depositRefundable:(0,i.depositOf)(h.settings).refundable,depositCutoffHours:(0,i.depositOf)(h.settings).cutoffHours}:{},phone:Se.pretty,email:le.trim()||void 0,source:ie,...e,...we.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...pe?{table:ce??s??je[0]?.table}:o?{table:o}:{}}).then(e=>(0,B.postNewBookingToKitchen)(e,O)).catch(()=>{}),u?.({date:A,time:J,name:q.trim()}),t()}})]})}},952,[874,813,1174,812,820,14,1422,1423,1424,943,31,1069,264,128,807,953,823,821,830,822,825,827,818,829,828,1425,831,817,993,832,1427,960,959,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtH",{enumerable:!0,get:function(){return d.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return d.fmtHDay}}),Object.defineProperty(_e,"authorityRole",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return b}}),_e.useShiftManager=h,_e.useSignedIn=S,_e.useCtx=function(e=1e4){const u=(0,t.useContext)(y),i=(0,r.useOwner)(e=>e.site),f=(0,r.useOwner)(e=>e.previewRole),c=(0,r.useOwner)(e=>e.staffAs),d=S(),l=u||'staff'===o.APP_VARIANT,D=(0,t.useContext)(b),O=h(),A=o.IS_CAR?'owner':l?D&&O?'manager':'staff':d?w(f,p(d)):f,I=(0,r.useOwner)(e=>e.staff),R=(0,n.useRestaurant)(i),M=(0,n.useNow)(e),C=o.IS_CAR?s.CAR_DEVICE_ID:d?d.id:l&&c?c:m[A],P=o.IS_CAR?s.CAR_ACTOR:I.find(e=>e.id===C)?.name??'Team member';return{rid:i,r:R,now:M,role:A,me:P,meId:C,today:(0,a.venueYmd)(M),signedIn:!o.IS_CAR&&!!d}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return A}}),_e.ensureAttendance=function(t,n){if(e.LIVE_VENUE_BUILD||(0,u.isLive)())return;const o=r.useOwner.getState(),s=[],i=o.staff.find(e=>e.active&&'manager'===e.role)??o.staff.find(e=>e.active&&'owner'===e.role),f=new Date(n);f.setDate(n.getDate()-O(n));const c=(0,a.ymd)(f),d=(0,a.ymd)(new Date(f.getFullYear(),f.getMonth(),f.getDate()+6)),m=(e,t,n)=>{const r=new Date(e);return r.setHours(0,0,0,0),r.setMinutes(Math.round(60*t)+n),r.toISOString()};for(let e=42;e>=1;e--){const t=new Date(n);t.setDate(t.getDate()-e);const r=(0,a.ymd)(t);if(o.attendance.some(e=>e.date===r))continue;const u=o.shifts.filter(e=>e.date===r&&!1!==e.published);(u.length?u:o.shifts.filter(e=>e.day===O(t)&&e.date>=c&&e.date<=d&&!1!==e.published)).forEach((n,a)=>{const o=e=>Math.round((7*r.charCodeAt(9)+13*a+e)%17-5),u=n.end-n.start,f=u>8?30:u>6?20:0,c=e>2&&i?{signOff:{by:i.name,byId:i.id,at:m(t,34,a)}}:{};s.push({id:`at-${r}-${n.staffId}`,staffId:n.staffId,date:r,in:m(t,n.start,o(1)),out:m(t,n.end,o(2)),inSite:!0,outSite:!0,breakMins:f,...c})})}s.length&&r.useOwner.setState({attendance:[...r.useOwner.getState().attendance,...s]})},_e.paidMins=function(e,t){if(!e.in)return{worked:0,brk:0,paid:0};const n=Math.max(0,Math.round(((e.out?new Date(e.out):t).getTime()-new Date(e.in).getTime())/6e4)),r=e.breakMins??0;return{worked:n,brk:r,paid:Math.max(0,n-r)}},Object.defineProperty(_e,"hmDur",{enumerable:!0,get:function(){return I}}),_e.payRange=function(e,t,n){const r=new Date(n);if(r.setHours(0,0,0,0),'monthly'===e){const e=new Date(r.getFullYear(),r.getMonth()+t,1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{s:e,e:n,key:`m-${(0,a.ymd)(e)}`}}const o='weekly'===e?7:14,s=new Date(r);s.setDate(r.getDate()-O(r));let u=new Date(s);if('fortnightly'===e){const e=new Date(2026,0,5);(Math.round((s.getTime()-e.getTime())/6048e5)%2+2)%2==1&&u.setDate(u.getDate()-7)}u.setDate(u.getDate()+t*o);const i=new Date(u);return i.setDate(u.getDate()+o-1),{s:u,e:i,key:`${e[0]}-${(0,a.ymd)(u)}`}},_e.useHourly=function(){const e=S(),t=(0,r.useOwner)(e=>e.hourly);return o.IS_CAR||e?t:R};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),r=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),s=_r(_d[6]),u=_r(_d[7]),i=_r(_d[8]),f=_r(_d[9]),c=_r(_d[10]),d=_r(_d[11]);const m={owner:c.ROSTER.find(e=>'owner'===e.role)?.id??'',manager:c.ROSTER.find(e=>'manager'===e.role)?.id??'',staff:c.ROSTER.find(e=>'staff'===e.app)?.id??''},l={staff:0,manager:1,owner:2},p=e=>e.ownerAccess?'owner':e.managerAccess&&'staff'===e.role?'manager':e.role,w=(e,t)=>l[e]>l[t]?t:e,y=(0,t.createContext)(!1),D=()=>(0,t.useContext)(y),b=(0,t.createContext)(!1);function h(){const e=(0,t.useContext)(y)||'staff'===o.APP_VARIANT,n=S(),r=(0,u.useSync)(e=>!!e.venueId&&'staff'===e.kind),a=(0,u.useSync)(e=>e.perms);return(0,i.shiftManagerOn)({inStaffApp:e,managerAccess:n?.managerAccess,role:n?.role,app:(0,f.rosterPerson)(n?.id)?.app,live:r,perms:a})}function S(){const e=(0,f.useSession)(e=>e.meId),t=(0,r.useOwner)(e=>e.staff);return e?t.find(t=>t.id===e&&t.active):void 0}const O=e=>(e.getDay()+6)%7,A=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const I=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const R={}},953,[842,31,823,863,822,807,977,824,1101,866,15,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,"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,'+')}},954,[876,812,985,31,119,123,128,829,830,825,818,993,1069,25]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"areaMarks",{enumerable:!0,get:function(){return n}}),_e.AreaTabs=function({plan:o,area:e,onPick:u,counts:a,closed:b}){return(0,c.jsx)(t.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:o.areas.map(o=>{const h=o.id===e,f=b?.has(o.id);return(0,c.jsx)(l.default,{testID:`area-${o.id}`,accessibilityRole:"tab",accessibilityLabel:`Area ${o.name}${o.dogs?', dogs allowed':''}${o.outdoor?', outdoor':''}${f?', closed for weather':''}`,accessibilityState:{selected:h},onPress:()=>u(o.id),style:{maxWidth:'100%',minWidth:0,flexShrink:1,minHeight:48,paddingHorizontal:16,borderRadius:24,borderWidth:1.5,borderColor:h?s.colours.gold:f?s.colours.blue:s.colours.border,backgroundColor:h?s.colours.gold:s.colours.surface,justifyContent:'center'},children:(0,c.jsxs)(t.T,{weight:"semibold",size:15,colour:h?s.colours.onGold:s.colours.text,children:[o.name,n(o),f?(0,c.jsx)(t.T,{size:12,colour:h?s.colours.onGold:s.colours.blue,children:" closed"}):null,a?.[o.id]?(0,c.jsxs)(t.T,{size:12,colour:h?s.colours.onGold:s.colours.muted,children:[" ",a[o.id]]}):null]})},o.id)})})},r(d[0]);var o,e=r(d[1]),l=(o=e)&&o.__esModule?o:{default:o},s=r(d[2]),t=r(d[3]),c=r(d[4]);const n=o=>`${o.dogs?' \ud83d\udc3e':''}${o.outdoor?' \ud83c\udf26':''}`},955,[31,264,825,818,25]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=R,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),N=a.now,F=e=>l({t:'set',p:e}),[H,O]=(0,i.useState)(e.startStep??'areas'),[U,G]=(0,i.useState)(e.initial.areas[0]?.id??''),[_,K]=(0,i.useState)(null),X=(0,w.useOwner)(e=>e.site),J=(0,y.useFloor)(e=>e.settings[X]),Y=!1!==J?.gridSnap,Z=(0,j.gridOf)(J?.gridSize),[q,V]=(0,i.useState)(null),[Q,ee]=(0,i.useState)(null),[se,te]=(0,i.useState)(null),ae=(0,T.useSync)(e=>e.venueId),le=e.role??'staff',[oe,ne]=(0,i.useState)(''),{width:re,height:ie}=(0,c.default)(),de=re>=900,ue=a.past.length>0||JSON.stringify(N)!==JSON.stringify(e.initial),ce=(0,b.planCounts)(N);(0,i.useEffect)(()=>{N.areas.some(e=>e.id===U)||G(N.areas[0]?.id??'')},[N.areas,U]),(0,i.useEffect)(()=>{oe&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:oe,timeoutMs:3500,testID:'plan-toast'}),ne(''))},[oe]);const he='table'===_?.kind?N.tables.find(e=>e.id===_.id):void 0,be='fixture'===_?.kind?(N.fixtures??[]).find(e=>e.id===_.id):void 0,ge=(e,s)=>{const t=N.tables.find(s=>s.id===e),a=t&&s.name&&s.name!==t.name?N.joins.map(e=>({...e,tables:e.tables.map(e=>e===t.name?s.name:e)})):N.joins,l=t&&s.name&&s.name!==t.name?N.areas.map(e=>e.best?.includes(t.name)?{...e,best:e.best.map(e=>e===t.name?s.name:e)}:e):N.areas;F({...N,areas:l,joins:a,tables:N.tables.map(t=>t.id===e?{...t,...s}:t)})},pe=e=>{const s=N.tables.find(s=>s.id===e);F({...N,tables:N.tables.filter(s=>s.id!==e),joins:N.joins.filter(e=>!s||!e.tables.includes(s.name))}),K(null)},me=e=>{const s=b.FIXTURES.find(s=>s.id===e),t={id:(0,b.fid)('fx'),areaId:U,kind:e,x:25*Math.round((b.PLAN_W-s.w)/50),y:25,w:s.w,h:s.h};F({...N,fixtures:[...N.fixtures??[],t]}),K({kind:'fixture',id:t.id})},xe=e=>{const s=(0,j.tidyArea)(N,e,Z),t=(0,j.movedCount)(N,s);t?(F(s),ne(`Tidied: ${t} table${1===t?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):ne('Already tidy: every table is on the grid and lined up.')},fe=e=>{const s=(0,b.autoArrange)(N.tables.filter(s=>s.areaId===e),$(N,e));F({...N,tables:[...N.tables.filter(s=>s.areaId!==e),...s]}),ne('Layout tidied. Undo if you preferred it before.')};(0,i.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const s=e.target?.tagName;if('INPUT'===s||'TEXTAREA'===s)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==H||!_)return;const t=e.altKey?1:Y?Z:5,a={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowUp:[0,-t],ArrowDown:[0,t]}[e.key];a&&(e.preventDefault(),je(_.kind,_.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===_.kind?pe(_.id):(F({...N,fixtures:(N.fixtures??[]).filter(e=>e.id!==_.id)}),K(null))),'r'===e.key.toLowerCase()&&ye(_.kind,_.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const je=(e,s,t,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(b.PLAN_W-e.w,l?e.x+t:t)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});F('table'===e?{...N,tables:N.tables.map(e=>e.id===s?{...e,...o(e)}:e)}:{...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?{...e,...o(e)}:e)})},ye=(e,s)=>{F('table'===e?{...N,tables:N.tables.map(e=>e.id===s?(0,b.rotate90)(e):e)}:{...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?(0,b.rotate90)(e):e)})},we='display'===e.mode;return(0,I.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[we?(0,I.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,I.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,I.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,I.jsx)(h.default,{style:{backgroundColor:(0,s.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,I.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,I.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,I.jsxs)(h.default,{style:{marginRight:6},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,I.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,I.jsx)(x.Row,{gap:6,children:k.map(e=>{const s=e.id===H;return(0,I.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{O(e.id),K(null),V(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:s?p.colours.gold:p.colours.border,backgroundColor:s?p.colours.goldTint:'transparent'},children:[(0,I.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:s?p.colours.gold:p.colours.surface2},children:(0,I.jsx)(x.T,{size:13,weight:"bold",colour:s?p.colours.onGold:p.colours.muted,children:e.n})}),(0,I.jsx)(x.T,{weight:"semibold",size:15,colour:s?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,I.jsx)(h.default,{style:{flex:1}}),(0,I.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,I.jsxs)(x.T,{weight:"bold",size:16,children:[ce.tables," tables \xb7 ",ce.seats," seats"]}),(0,I.jsxs)(x.Muted,{size:12,children:[N.areas.length," area",1===N.areas.length?'':'s',ue?' \xb7 unsaved changes':'']})]}),(0,I.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,I.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,I.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>ue?ee({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,I.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!ue,onPress:()=>ee({title:'Save changes to the table plan?',body:`${ce.tables} tables \xb7 ${ce.seats} seats across ${N.areas.length} area${1===N.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(R(N))}),style:{minHeight:44}}),ae?(0,I.jsx)(S.NamedPlanButtons,{onSaveAs:()=>te('save'),onList:()=>te('list')}):null]}),(0,I.jsxs)(h.default,{style:{flex:1},children:['areas'===H?(0,I.jsx)(M,{plan:N,set:F,confirm:ee,wide:de,next:()=>O('tables'),toast:ne}):null,'tables'===H?(0,I.jsx)(E,{plan:N,set:F,area:U,setArea:G,addTables:(e,s)=>{let t={...N,areas:[...N.areas],tables:[...N.tables]};const a=new Set(t.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const s of e){if(a.has(s.name)){l.push(s.name);continue}let e=U;if(s.area){const a=t.areas.find(e=>e.name.toLowerCase()===s.area.toLowerCase());a?e=a.id:(e=A(t,s.area),t.areas.push({id:e,name:s.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(s.name,e,s.seats,P(t,e)),[d]=(0,b.placeNew)(t.tables.filter(s=>s.areaId===e),[i],(t.fixtures??[]).filter(s=>s.areaId===e));t.tables.push(d),a.add(s.name),n.add(e),o++}if(s)for(const e of n){const s=t.tables.filter(s=>s.areaId===e),a=(0,b.autoArrange)(s,$(t,e));t={...t,tables:[...t.tables.filter(s=>s.areaId!==e),...a]}}return o&&F(t),ne(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:pe,patch:ge,wide:de,next:()=>O('arrange'),back:()=>O('areas')}):null,'arrange'===H?(0,I.jsxs)(h.default,{style:{flex:1,flexDirection:de?'row':'column'},children:[(0,I.jsxs)(h.default,{style:{flex:1,padding:10,gap:8,minHeight:de?void 0:Math.min(420,.5*ie)},children:[(0,I.jsx)(L,{plan:N,area:U,onPick:e=>{G(e),K(null),V(null)}}),q?(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,I.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(N.tables.find(e=>e.id===q)?.name),"."]}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>V(null)})]}):null,(0,I.jsx)(f.DesignerCanvas,{plan:N,areaId:U,sel:_,onSelect:e=>{if(q&&'table'===e?.kind&&e.id!==q){const s=N.tables.find(e=>e.id===q),t=N.tables.find(s=>s.id===e.id),a=N.joins.find(e=>e.tables.includes(s.name)),l=a?N.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,t.name])].sort((e,s)=>(0,b.numOf)(e)-(0,b.numOf)(s))}:e).filter(e=>e===a||!e.tables.includes(t.name)):[...N.joins.filter(e=>!e.tables.includes(t.name)),{id:(0,b.fid)('j'),tables:[s.name,t.name].sort((e,s)=>(0,b.numOf)(e)-(0,b.numOf)(s))}];return F({...N,joins:l}),V(null),ne(`Joined: book as ${l.find(e=>e.tables.includes(s.name)).tables.join('+')}`),void K(e)}V(null),K(e)},snapOn:Y,grid:Z,joinFrom:q,onMove:(e,s,t,a)=>je(e,s,t,a),onResize:(e,s,t,a)=>{if('table'===e){const e=N.tables.find(e=>e.id===s);if('round'===e.shape){const l=Math.max(t,a);ge(s,{w:l,h:l,x:e.x,y:e.y})}else ge(s,{w:t,h:a,shape:t===a?'square':'rect',x:e.x,y:e.y})}else F({...N,fixtures:(N.fixtures??[]).map(e=>e.id===s?{...e,w:t,h:a}:e)})}}),(0,I.jsxs)(x.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",Y?`tables snap to a ${Z} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,I.jsx)(u.default,{style:{width:de?330:void 0,flexGrow:de?0:1,flexShrink:0,flexBasis:de?330:void 0,borderLeftWidth:de?1:0,borderTopWidth:de?0:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:he?(0,I.jsx)(W,{t:he,plan:N,patch:e=>ge(he.id,e),rotate:()=>ye('table',he.id),remove:()=>pe(he.id),duplicate:()=>{const e=z(N),s={...he,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[t]=(0,b.placeNew)(N.tables.filter(e=>e.areaId===he.areaId),[s],(N.fixtures??[]).filter(e=>e.areaId===he.areaId));F({...N,tables:[...N.tables,t]}),K({kind:'table',id:t.id}),ne(`${(0,o.tableNumbers)(e)} added`)},join:()=>V(he.id),split:e=>F({...N,joins:N.joins.filter(s=>s.id!==e)}),moveArea:e=>{const[s]=(0,b.placeNew)(N.tables.filter(s=>s.areaId===e),[{...he,areaId:e,sectionId:P(N,e)}],(N.fixtures??[]).filter(s=>s.areaId===e));F({...N,tables:N.tables.map(e=>e.id===he.id?s:e)}),G(e)},onDone:()=>K(null),toast:ne}):be?(0,I.jsxs)(h.default,{style:{gap:10},children:[(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===be.kind)?.label}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>K(null)})]}),(0,I.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,I.jsx)(x.Chip,{label:e.label,selected:be.kind===e.id,onPress:()=>F({...N,fixtures:(N.fixtures??[]).map(s=>s.id===be.id?{...s,kind:e.id}:s)})},e.id))}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>ye('fixture',be.id)}),(0,I.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{F({...N,fixtures:(N.fixtures??[]).filter(e=>e.id!==be.id)}),K(null)}})]}):(0,I.jsxs)(h.default,{style:{gap:12},children:[(0,I.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",N.areas.find(e=>e.id===U)?.name??'']}),(0,I.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,I.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=z(N),s=(0,b.newTable)(e,U,4,P(N,U)),[t]=(0,b.placeNew)(N.tables.filter(e=>e.areaId===U),[s],(N.fixtures??[]).filter(e=>e.areaId===U));F({...N,tables:[...N.tables,t]}),K({kind:'table',id:t.id})}}),(0,I.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,I.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,I.jsx)(x.Chip,{label:e.label,onPress:()=>me(e.id)})},e.id))}),(0,I.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>xe(U)}),(0,I.jsx)(x.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>fe(U)}),(0,I.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:e=>y.useFloor.getState().setSettings(X,{...y.DEFAULT_SETTINGS,...J??{},gridSnap:e})}),(0,I.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:N.areas.map(e=>{const s=(0,b.planCounts)(N,e.id);return(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsxs)(x.T,{size:14,children:[e.name,(0,C.areaMarks)(e)]}),(0,I.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})})]})})]}):null]}),Q?(0,I.jsx)(h.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,I.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,I.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:Q.title}),(0,I.jsx)(t.GoldClose,{onPress:()=>ee(null),label:"Close",testID:"designer-confirm-close"})]}),(0,I.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:Q.body}),(0,I.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ee(null)}),(0,I.jsx)(x.Button,{kind:Q.danger?'danger':'primary',label:Q.ok,testID:"confirm-ok",onPress:()=>{const e=Q;ee(null),e.run()}})]})]})}):null,'save'===se&&ae?(0,I.jsx)(S.SaveAsPlanDialog,{venueId:ae,plan:R(N),onClose:()=>te(null),onSaved:()=>te(null),toast:ne}):null,'list'===se&&ae?(0,I.jsx)(S.SavedPlansDialog,{venueId:ae,mode:e.mode,role:le,isCar:v.IS_CAR,onClose:()=>te(null),onLive:s=>{l({t:'reset',p:s}),e.onLiveChange?.(s),te(null)},toast:ne}):null]})};var s=r(_d[0]),t=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(r(_d[11])),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),C=r(_d[19]),S=r(_d[20]),T=r(_d[21]),v=r(_d[22]),I=r(_d[23]);const k=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(e,s){return'set'===s.t?{past:[...e.past,e.now].slice(-80),now:s.p,future:[]}:'undo'===s.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===s.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:s.p,future:[]}}function R(e){const s=new Set(e.tables.map(e=>e.name)),t=[...e.sections];for(const s of e.areas)t.some(e=>e.id===`s-${s.id}`)||e.tables.some(e=>e.areaId===s.id&&e.sectionId)||t.push({id:`s-${s.id}`,name:s.name,colour:'#CFA45F',server:''});return{...e,sections:t,fixtures:(e.fixtures??[]).filter(s=>e.areas.some(e=>e.id===s.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>s.has(e)))}}const z=e=>{let s=1;const t=new Set(e.tables.map(e=>e.name));for(;t.has(String(s));)s++;return String(s)},P=(e,s)=>e.tables.find(e=>e.areaId===s)?.sectionId??`s-${s}`,$=(e,s)=>(e.fixtures??[]).some(e=>e.areaId===s&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,s)=>{let t=(0,b.slug)(s),a=2;for(;e.areas.some(e=>e.id===t);)t=`${(0,b.slug)(s)}-${a++}`;return t};function B({label:e,glyph:s,onPress:a,disabled:l}){return(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===s?(0,I.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,I.jsx)(t.GoldX,{size:14}),(0,I.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,I.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[s,(0,I.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:s,onPick:t}){return(0,I.jsx)(u.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===s,o=(0,b.planCounts)(e,a.id);return(0,I.jsx)(d.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>t(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,I.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,C.areaMarks)(a)," ",(0,I.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function M({plan:e,set:s,confirm:t,wide:l,next:n,toast:c}){const[f,j]=(0,i.useState)(''),y=(t,a)=>s({...e,areas:e.areas.map(e=>e.id===t?{...e,...a}:e)}),w=(t,a)=>{const l=[...e.areas],o=t+a;o<0||o>=l.length||([l[t],l[o]]=[l[o],l[t]],s({...e,areas:l}))},C=()=>{const t=f.trim();if(!t)return;if(e.areas.some(e=>e.name.toLowerCase()===t.toLowerCase()))return void c(`There's already an area called ${t}`);const a=A(e,t);s({...e,areas:[...e.areas,{id:a,name:t,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:t,colour:'#CFA45F',server:''}]}),j('')};return(0,I.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,I.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,I.jsx)(x.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,I.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(F,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,I.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,I.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,I.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,I.jsx)(x.Row,{gap:8,children:(0,I.jsx)(F,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,I.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),N.map(t=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===t;return(0,I.jsx)(d.default,{testID:`area-colour-${a.id}-${t.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${t}`,onPress:()=>s({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:t}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:t}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:t,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},t)})]}),(()=>{const s=e.tables.filter(e=>e.areaId===a.id).sort((e,s)=>e.name.localeCompare(s.name,void 0,{numeric:!0})),t=a.best??[];return s.length?(0,I.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:s.map(e=>(0,I.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:t.includes(e.name),onPress:()=>y(a.id,{best:t.includes(e.name)?t.filter(s=>s!==e.name):[...t,e.name]})},e.id))}),(0,I.jsx)(x.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,I.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,I.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,I.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,I.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,I.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>t({title:`Remove ${a.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>s({...e,areas:e.areas.filter(e=>e.id!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,I.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,I.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,I.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,I.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,I.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,I.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>t({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{s(e.make()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,I.jsx)(x.T,{weight:"semibold",children:e.name}),(0,I.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const N=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function F({value:e,onCommit:s,label:t="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,I.jsx)(a.TextInput,{accessibilityLabel:t,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>s(o.trim()),onSubmitEditing:()=>s(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function E({plan:e,set:s,area:t,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[S,T]=(0,i.useState)(4),[v,k]=(0,i.useState)(''),[D,R]=(0,i.useState)(!0),P=(0,i.useMemo)(()=>(0,b.parseTableList)(v),[v]),$=e.tables.filter(e=>e.areaId===t).sort(b.byNumber),A=z(e),M=e.areas.find(e=>e.id===t),N=(e,s)=>{const t=(0,b.sizeFor)(s),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(e.id,{maxSeats:s,minSeats:Math.min(e.minSeats,s),...l?{}:'round'===e.shape?{w:t.h,h:t.h}:{w:t.w,h:t.h,shape:t.shape}})};return(0,I.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,I.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,I.jsx)(L,{plan:e,area:t,onPick:l}),(0,I.jsxs)(x.Muted,{children:[M?`${M.name}${M.dogs?' \xb7 dogs allowed':''}${M.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,I.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:$.length?$.map((e,s)=>(0,I.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:s?1:0,borderColor:p.colours.border},children:[(0,I.jsxs)(h.default,{style:{width:92},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,I.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,I.jsx)(h.default,{style:{flex:1},children:(0,I.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:s=>N(e,s)})}),(0,I.jsx)(x.Muted,{children:"seats"}),(0,I.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,I.jsx)(h.default,{style:{padding:16},children:(0,I.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,I.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,I.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,I.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",M?.name]}),(0,I.jsxs)(x.Row,{gap:10,children:[(0,I.jsxs)(h.default,{style:{width:120},children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,I.jsx)(a.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:A,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,I.jsxs)(h.default,{children:[(0,I.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,I.jsx)(x.Stepper,{value:S,min:1,max:20,label:"seats",onChange:T})]})]}),(0,I.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||A)}`,testID:"add-table",onPress:()=>{n([{name:(w||A).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,I.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,I.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,I.jsx)(x.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,I.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:v,onChangeText:k,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),v.trim()?(0,I.jsxs)(x.T,{size:14,colour:P.items.length?p.colours.ok:p.colours.amber,children:["Found ",P.items.length," table",1===P.items.length?'':'s'," \xb7 ",P.items.reduce((e,s)=>e+s.seats,0)," seats",P.skipped.length?` \xb7 couldn't read: ${P.skipped.slice(0,2).join('; ')}`:'']}):null,(0,I.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:D,onChange:R}),(0,I.jsx)(x.Button,{label:P.items.length?`Add ${P.items.length} tables`:'Add tables',testID:"paste-add",disabled:!P.items.length,onPress:()=>{n(P.items,D)&&k('')}})]})]})]})}function W({t:e,plan:s,patch:t,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,i.useState)(e.name);(0,i.useEffect)(()=>S(e.name),[e.id,e.name]);const T=s.joins.find(s=>s.tables.includes(e.name)),v=()=>{const a=C.trim().toUpperCase();if(a&&a!==e.name)return s.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void S(e.name)):void t({name:a})};return(0,I.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,I.jsx)(l.TableNumberWarning,{plan:s}),(0,I.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,I.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:v,onSubmitEditing:v,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,I.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:s=>t({maxSeats:s,minSeats:Math.min(e.minSeats,s)})})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,I.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>t({minSeats:e})})]}),(0,I.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,I.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const s=Math.max(e.w,e.h);t({shape:'square',w:s,h:s})}}),(0,I.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const s=Math.max(e.w,e.h);t({shape:'round',w:s,h:s})}}),(0,I.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const s=(0,b.sizeFor)(Math.max(5,e.maxSeats));t({shape:'rect',w:e.h>e.w?e.w:s.w,h:e.h>e.w?s.w:s.h})}}),(0,I.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const s=(0,b.sizeFor)(e.maxSeats);t({shape:s.shape,w:s.w,h:s.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,I.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),T?(0,I.jsxs)(h.default,{style:{gap:6},children:[(0,I.jsxs)(x.T,{size:14,children:["Joined with ",T.tables.filter(s=>s!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,I.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(T.tables.join('+'))})]}),(0,I.jsxs)(x.Row,{gap:8,children:[(0,I.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,I.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(T.id),style:{flex:1}})]})]}):(0,I.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,I.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>t({online:e})}),s.areas.length>1?(0,I.jsxs)(h.default,{style:{gap:6},children:[(0,I.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,I.jsx)(x.Row,{gap:6,wrap:!0,children:s.areas.map(s=>(0,I.jsx)(x.Chip,{label:s.name,selected:s.id===e.areaId,onPress:()=>s.id!==e.areaId&&j(s.id)},s.id))})]}):null,(0,I.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},956,[876,835,874,935,812,943,31,123,264,152,288,128,1069,825,818,1532,1533,829,863,955,1535,824,807,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"saverConnected",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"SAVER_BUCKET",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useSaverCfg",{enumerable:!0,get:function(){return S}}),_e.loadSaver=v,_e.saveSaver=async function(e,t){const n=f();if(!n)return void S.getState().set(e);const{error:o}=await l().from('display_screensaver').upsert({venue_id:n,...(0,u.saverToRow)(e),updated_at:(new Date).toISOString(),updated_by:t.slice(0,80)});if(o)throw o;S.getState().set(e)},_e.watchSaver=y,_e.uploadSaverPhoto=async function(e,t){const n=f();if(!n)throw new Error('Photos need the venue connection.');if(t>=u.MAX_SAVER_PHOTOS)throw new Error(`Up to ${u.MAX_SAVER_PHOTOS} photos.`);if(!['image/jpeg','image/png','image/webp'].includes(e.type))throw new Error('Please pick a JPEG, PNG or WebP photo.');if(e.size>6291456)throw new Error('That photo is over 6 MB. Please pick a smaller one.');const o='image/png'===e.type?'png':'image/webp'===e.type?'webp':'jpg',s=`${n}/${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:c}=await l().storage.from(w).upload(s,e,{upsert:!1,contentType:e.type});if(c)throw c;return s},_e.uploadSaverLogo=async function(e){const t=f();if(!t)throw new Error('Uploading a logo needs the venue connection.');const n=(0,u.logoFileProblem)(e.type,e.size);if(n)throw new Error(n);let o=e;if('image/svg+xml'===e.type){if(!(0,u.svgSafe)(await e.text()))throw new Error('That SVG can\u2019t be used (it contains scripts or links). Please export a plain SVG or a PNG.');o=await P(e)}const s='image/png'===o.type?'png':u.LOGO_TYPES[o.type],c=`${t}/logo-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}.${s}`,{error:p}=await l().storage.from(w).upload(c,o,{upsert:!1,contentType:o.type});if(p)throw p;return c},_e.svgToPng=P,_e.saverPhotoUrl=async function(e){if(/^(https?:|data:|blob:)/.test(e))return e;const t=b.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await l().storage.from(w).createSignedUrl(e,3600);if(t?.signedUrl)return b.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.useSaverSync=function(){const e=(0,c.useSync)(e=>e.venueId)&&p()?c.useSync.getState().venueId:null,t=S(e=>e.cfg);return n.default.useEffect(()=>{if(!e)return;let t=!0;const n=()=>{v().catch(()=>{})};n();const o=y(()=>{t&&n()}),s=setInterval(n,3e5);return()=>{t=!1,o(),clearInterval(s)}},[e]),t};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),s=r(d[2]),c=r(d[3]),u=r(d[4]);const l=()=>(0,s.getSupabase)(),p=()=>{try{return(0,s.getSupabase)(),!0}catch{return!1}},f=()=>p()?c.useSync.getState().venueId??null:null,h=()=>!!f(),w='display-photos',S=(0,o.create)(e=>({cfg:null,set:t=>e({cfg:t})}));async function v(){const e=f();if(!e)return S.getState().cfg;const{data:t,error:n}=await l().from('display_screensaver').select('*').eq('venue_id',e).maybeSingle();if(n)throw n;const o=(0,u.saverFromRow)(t);return S.getState().set(o),o}function y(e){const t=f();if(!t)return()=>{};try{const n=l().channel(`saver-${t}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'display_screensaver',filter:`venue_id=eq.${t}`},()=>e()).subscribe();return()=>{try{l().removeChannel(n)}catch{}}}catch{return()=>{}}}async function P(e,t=1024){if('undefined'==typeof document)throw new Error('Please pick a PNG or JPG logo on this device.');const n=URL.createObjectURL(e);try{const e=new Image;await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error('That SVG couldn\u2019t be read. Please export it again, or use a PNG.')),e.src=n});const o=e.naturalWidth||t,s=e.naturalHeight||t,c=t/Math.max(o,s),u=document.createElement('canvas');u.width=Math.max(1,Math.round(o*c)),u.height=Math.max(1,Math.round(s*c)),u.getContext('2d').drawImage(e,0,0,u.width,u.height);const l=await new Promise(e=>u.toBlob(e,'image/png'));if(!l)throw new Error('That SVG couldn\u2019t be turned into a picture. Please use a PNG.');if(l.size>2097152)throw new Error('That logo is too detailed. Please use a smaller PNG or JPG.');return l}finally{URL.revokeObjectURL(n)}}const b=new Map},957,[31,995,872,824,987]); +__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})]})]})}},958,[991,31,128,823,829,960,825,818,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.guardBookingChange=w,_e.saveTablesReported=async function(e,t,n,o,s,u){if(!w(u,{b:t,tables:n}))return!1;const v=n.length?(0,h.notSavedWhat)({...t,name:o,table:n.join('+')}):`Taking the table off ${o}`;u(`Saving ${v}\u2026`);try{await(0,b.saveBookingTables)(e,t,n)}catch(e){const t=`${v} did not save: ${String(e?.message??e).slice(0,120)}`;return u(t),(0,l.announce)(t),!1}const y=await(0,c.waitForBookingSave)(t.id);if('saved'===y.state||'local'===y.state){const e=(0,r.savedWords)(o,t.partySize,n,s);return u(e),(0,l.announce)(e),!0}const k='waiting'===y.state?`${v}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${v} did not save. ${f("why"in y?y.why:"the shared system did not take it")}. Tap the red banner to try again.`;return u(k),(0,l.announce)(k),!1},_e.reportBookingSave=async function(e,t,n,o){const s=await(0,c.waitForBookingSave)(e);if('saved'===s.state||'local'===s.state)return o(t),(0,l.announce)(t),!0;const r='waiting'===s.state?`${n}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${n} did not save. ${f('why'in s?s.why:'the shared system did not take it')}. Tap the red banner to try again.`;return o(r),(0,l.announce)(r),!1},_e.BookingSaveBanner=function({rid:e,testID:r="booking-save-banner",margin:c}){const b=(0,h.useBookingSaves)(e=>e.notSaved),w=(0,s.useBookings)(e).filter(e=>b[e.id]).map(e=>void 0!==b[e.id].want?{...e,table:b[e.id].want||void 0}:e),{msg:S,retry:$}=k(),m=(0,t.useRef)(''),p=w.map(e=>(0,h.notSavedLine)(e)),B=w.map(e=>e.id).sort().join(',');if((0,t.useEffect)(()=>{B&&B!==m.current&&(0,l.announce)(1===w.length?p[0]:`${w.length} booking changes did not save. Tap the red banner to try again.`),m.current=B},[B]),!w.length)return null;const j=1===w.length?p[0]:`${w.length} booking changes did not save. Tap to try again.`;return(0,y.jsx)(n.default,{testID:r,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${j}${w.length>1?` ${w.map(e=>(0,h.notSavedWhat)(e)).join('. ')}.`:''} ${f(b[w[0].id].why)}.`,onPress:$,style:{...c??{},alignSelf:'stretch',gap:4,padding:12,borderRadius:12,borderWidth:2,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:(0,y.jsxs)(o.default,{accessibilityRole:"alert",style:{alignItems:'center',gap:4},children:[(0,y.jsx)(v.T,{testID:`${r}-title`,size:17,weight:"semibold",center:!0,colour:"#FFD2CC",children:j}),w.length>1?w.slice(0,6).map(e=>(0,y.jsx)(v.T,{testID:`${r}-line`,size:15,center:!0,colour:"#FFD2CC",children:(0,h.notSavedWhat)(e)},e.id)):null,(0,y.jsx)(v.T,{testID:`${r}-why`,size:14,center:!0,colour:"#FFB3AA",children:w.length>1?`${f(b[w[0].id].why)}${w.length>6?` \xb7 and ${w.length-6} more`:''}`:f(b[w[0].id].why)}),S?(0,y.jsx)(v.T,{testID:`${r}-msg`,size:14,center:!0,colour:u.colours.goldLight,children:S}):null]})})},_e.BookingNotSavedLine=function({b:e}){const t=(0,h.useBookingSaves)(t=>t.notSaved[e.id]),{msg:o,retry:s}=k();if(!t)return null;void 0!==t.want&&(e={...e,table:t.want||void 0});return(0,y.jsxs)(n.default,{testID:`booking-not-saved-${e.id}`,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${(0,h.notSavedLine)(e)} ${f(t.why)}.`,onPress:s,style:{alignSelf:'stretch',padding:8,borderRadius:10,borderWidth:1.5,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:[(0,y.jsx)(v.T,{size:15,weight:"semibold",center:!0,colour:"#FFD2CC",children:(0,h.notSavedLine)(e)}),o?(0,y.jsx)(v.T,{size:13,center:!0,colour:u.colours.goldLight,children:o}):null]})};var t=_r(d[0]),n=e(_r(d[1])),o=e(_r(d[2])),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),b=_r(d[9]),v=_r(d[10]),y=_r(d[11]);const f=e=>e.charAt(0).toUpperCase()+e.slice(1);function w(e,t){const n=(0,c.bookingSaveBlocker)();if(!n)return!0;t&&h.useBookingSaves.getState().mark({id:t.b.id,table:t.b.walkIn?'walk_ins':'bookings',why:n,...t.tables?{want:t.tables.join('+')}:{}});const o=`${t?(0,h.notSavedWhat)({...t.b,...t.tables?{table:t.tables.join('+')||void 0}:{}}):'This change'} did not save: ${n}.`;return e?.(o),(0,l.announce)(o),!1}function k(){const[e,n]=(0,t.useState)('');return{msg:e,retry:async()=>{n('Saving\u2026'),(0,l.announce)('Saving');const e=await(0,c.saveBookingsNow)(!0),t=e?`Not saved: ${e}.`:h.useBookingSaves.getState().count()?'Sent again. The banner clears when the shared system takes it.':'Nothing is left waiting. Check the plan and make the change again if it is not there.';n(t),(0,l.announce)(t)}}}},959,[31,264,128,823,960,1421,824,1285,825,990,818,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=u,e.requestedFreeTable=function(t,n,a,s,l=90){const o={id:n.id??'new',status:'confirmed',...n};for(const n of t)if(a.includes(n)&&!u(o,[n],s,l).length)return n;return null},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=c,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${c(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${c(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${c(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))}function c(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},960,[812,830]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},961,[812,1040,31,123,264,128,989,823,825,818,1484,943,963,25]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"unconfirmedTakeaways",{enumerable:!0,get:function(){return x}}),_e.useBuildingChime=function(e,s=4e3,i=6e4){const o=(0,a.useAlerts)(e=>e.prefs.muted);(0,t.useEffect)(()=>{if(!e||o)return;const t=Date.now(),l=()=>(0,c.lowChime)(Math.min(1,(Date.now()-t)/i));l();const n=setInterval(l,s);return()=>clearInterval(n)},[e,o,s,i])},_e.TakeawayFacts=b,_e.TakeawayTakeover=function({rid:e,me:i}){const o=(0,l.useOrders)(e),n=x(o),a=n[0],c=s.default.useRef(i);return c.current=i,(0,t.useEffect)(()=>{a?(0,f.notify)({id:'takeaway-takeover',tone:a.allergies.length?'urgent':'warn',modal:!0,big:!0,testID:'takeaway-takeover',icon:'\ud83e\udd61',kicker:'NEW TAKEAWAY ORDER',title:`Order ${a.ref}: read it, then tap Confirm`,body:"This stays on screen until someone confirms."+(n.length>1?` ${n.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,j.jsx)(y,{rid:e,id:a.id,me:c.current})}):(0,f.dismissNotice)('takeaway-takeover')},[a?.id,n.length,e]),(0,t.useEffect)(()=>()=>(0,f.dismissNotice)('takeaway-takeover'),[]),null};var t=r(d[0]),s=e(t),i=e(r(d[1])),o=e(r(d[2])),l=r(d[3]),n=r(d[4]),a=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),j=r(d[10]);const w=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'As soon as possible',x=e=>e.filter(e=>'takeaway'===e.type&&'new'===e.status&&!e.accepted).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function b({o:e,big:t,personal:s=!0}){const o=t?1:.8;return(0,j.jsxs)(i.default,{style:{gap:10},children:[(0,j.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:18},children:[(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Collection"}),(0,j.jsx)(h.T,{size:34*o,weight:"bold",colour:u.colours.goldLight,children:w(e.slotTime)})]}),s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Customer"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.customerName})]}):null,s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Phone"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.phone??'Not given'})]}):null,(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Order"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.ref})]})]}),e.allergies.length?(0,j.jsxs)(i.default,{testID:"takeover-allergy",style:{backgroundColor:'#7A140D',borderRadius:12,padding:12,borderWidth:2,borderColor:'#FFB3AB'},children:[(0,j.jsxs)(h.T,{size:22*o,weight:"bold",colour:"#FFFFFF",children:["\u26a0 ALLERGY: ",e.allergies.map(e=>`${(0,n.allergenLabel)(e.allergen)} (${(0,n.severityLabel)(e.severity)})`).join(', ')]}),e.lines.filter(e=>e.overridden).map((e,t)=>(0,j.jsxs)(h.T,{size:16*o,weight:"semibold",colour:"#FFE3DF",children:["Customer overrode a warning: ",e.name," contains ",e.contains.map(n.allergenLabel).join(', ')]},t))]}):(0,j.jsx)(h.T,{size:16*o,colour:u.colours.ok,children:"No allergies declared"}),(0,j.jsx)(i.default,{style:{gap:4},children:e.lines.map((e,t)=>(0,j.jsxs)(h.T,{size:22*o,weight:"semibold",children:[e.qty," \xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 \u201c${e.notes}\u201d`:'']},t))})]})}function y({rid:e,id:t,me:s}){const n=(0,l.useOrders)(e).find(e=>e.id===t),{width:a}=(0,o.default)();return n?(0,j.jsxs)(i.default,{style:{gap:12},children:[(0,j.jsx)(b,{o:n,big:a>=700}),(0,j.jsx)(h.Button,{label:`Confirm order ${n.ref}`,testID:"takeover-confirm",onPress:()=>{l.repo.orders.accept(n.id,s)},style:{minHeight:72,borderRadius:14}})]}):null}},962,[31,128,288,823,819,963,946,825,818,943,25]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},963,[1485,1486,1488,1487,1489,946,1490]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:k,tile:p,display:j,day:y}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),D=y??(0,c.ymd)(a),M=C.filter(o=>o.rid===e&&o.date===D&&!o.removedAt).length,P=M?`${M} block${1===M?'':'s'} that day`:'';return p?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:M||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>k?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[k?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:k?15:x?22:17,weight:"semibold",colour:k?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),M?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:M})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'Closed for weather':'For weather',accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),k=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function p({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),p=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return p.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[p.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',k(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${k(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[k,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),T=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),I=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:k,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(p,{testID:"block-today",title:"Today",sub:T?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!T,onPress:()=>m('today')}),(0,f.jsx)(p,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(p,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(p,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(B,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:k,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(p,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function M({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},964,[812,31,1460,973,264,128,828,829,833,822,825,818,1083,1540,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:w,now:b,turnBase:v,blocks:M=[],height:T=150,forecastNote:$,emptyText:D,past:A,closed:k,compact:C=!1,dense:I=!1,bare:z=!1,fill:F=!1,fit:L=!1,tight:S=!1,live:_=!1}){const[H,O]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),P=j.getTime()-18e5,E=w.getTime()+36e5,R=(0,t.useMemo)(()=>(0,p.coverCurve)(e,new Date(P),new Date(E),v),[e,P,E,v]),X=60*j.getHours()+j.getMinutes(),U=60*w.getHours()+w.getMinutes(),W=(0,t.useMemo)(()=>(0,f.chartBands)(M,X,U),[M,X,U]),G=new Date(j);G.setHours(0,0,0,0);const V=e=>G.getTime()+6e4*e,Y=Math.max(8,...R.map(e=>e.covers)),Z=R.reduce((e,t)=>!t.covers||(0,f.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),W)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),q=L&&N?Math.max(24,Math.floor(N)):Math.max(48,T-m.AXIS_BAND),J=I?8:16,K=Math.max(10,H-28-8),Q=Math.max(10,q-J-6),ee=e=>28+(e-P)/(E-P)*K,te=e=>J+Q-e/(1.15*Y)*Q,se=[];for(let e=new Date(P);e.getTime()<=E;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=P&&t.getTime()<=E&&se.push(t.getTime())}const ie=_?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,ne=Math.min(E,Math.max(P,b.getTime())),oe=k?null:_?{t:ne,covers:ie,text:(0,m.seatedNowText)(ie)}:Z,le=H?(0,m.layoutChart)({width:H,height:q,t0:P,t1:E,hours:se,busiest:oe}):{hours:[],busiest:null},re=R.map((e,t)=>`${t?'L':'M'}${ee(e.t).toFixed(1)},${te(e.covers).toFixed(1)}`).join(' '),ae=F&&re&&R.length>1?`${re} L${ee(R[R.length-1].t).toFixed(1)},${te(0).toFixed(1)} L${ee(R[0].t).toFixed(1)},${te(0).toFixed(1)} Z`:'',de=(0,i.coversFour)(e,e[0]?.date??''),he=`Total ${de.total} ${1===de.total?'Cover':'Covers'}`,ue=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,ce=le.busiest?.text??(k?'':_?(0,m.seatedNowText)(ie):Z?(0,m.busiestText)(Z.t,Z.covers):''),xe=W.map(e=>e.spoken).join('. '),ge=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(w)}.${ce?` ${ce}.`:''}${xe?` ${xe}.`:''}`,me=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(n.default,{testID:"day-graph",style:[h.look.panel,L?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:z?4:I?2:10,paddingBottom:z?2:6,backgroundColor:c.colours.bg}],children:[z?null:C?(0,y.jsxs)(n.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(d.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(d.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:he})]}):(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(d.T,{size:I?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(d.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:he})]}),z||S?null:k?$?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:$}):null:(0,y.jsxs)(d.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),$?(0,y.jsx)(d.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:$}):(0,y.jsx)(n.default,{style:{flex:1}}),(0,y.jsxs)(d.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(w)]})]}),(0,y.jsx)(n.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:ge,onLayout:e=>{O(e.nativeEvent.layout.width),L&&B(e.nativeEvent.layout.height)},style:L?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,T-m.AXIS_BAND),minHeight:24,overflow:'hidden'}:{height:q,minHeight:q},children:H?(0,y.jsxs)(l.default,{width:H,height:q,children:[(0,y.jsxs)(o.Defs,{children:[(0,y.jsxs)(o.Pattern,{id:`${me}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(o.Pattern,{id:`${me}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(o.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(o.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),W.map((e,t)=>(0,y.jsx)(o.Rect,{x:ee(V(e.fromMin)),y:J,width:Math.max(3,ee(V(e.toMin))-ee(V(e.fromMin))),height:Q,fill:`url(#${me}-${e.strength})`},`${e.fromMin}-${t}`)),ae?(0,y.jsx)(o.Path,{d:ae,fill:"#3A2F1E",stroke:"none"}):null,re?(0,y.jsx)(o.Path,{d:re,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,k?null:[j,w].map((e,t)=>(0,y.jsx)(o.Line,{x1:ee(e.getTime()),x2:ee(e.getTime()),y1:J,y2:J+Q,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),le.busiest?(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:le.busiest.x+le.busiest.w/2,y:le.busiest.y+le.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:le.busiest.text}):null,ue?null:(0,y.jsx)(o.Text,{fontFamily:"Poppins_500Medium",x:28+K/2,y:J+Q/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null}),(0,y.jsxs)(n.default,{testID:"day-graph-axis",style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(d.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),le.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,H)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,H-t),s));return(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':it.fromMin-n.fromMin||t.toMin-n.toMin||(t.strength===n.strength?0:'area'===t.strength?-1:1));const u=[];for(const t of c){const n=u[u.length-1];n&&n.strength===t.strength&&t.fromMin<=n.toMin?(n.toMin=Math.max(n.toMin,t.toMin),n.spoken.includes(t.spoken)||(n.spoken=`${n.spoken}. ${t.spoken}`)):u.push({...t})}return u},e.blockedHours=function(t){const n=new Set;for(const o of t)if('venue'===o.strength)for(let t=Math.floor(o.fromMin/60);60*t=30&&n.add(t)}return[...n].sort((t,n)=>t-n)},e.minuteInsideVenueBlock=function(t,n){return n.some(n=>'venue'===n.strength&&t>=n.fromMin&&t{const n=/^(\d{1,2}):(\d{2})/.exec(t);return n?60*Number(n[1])+Number(n[2]):null},n=t=>`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;function o(t,o,s){const a=`${n(o)} to ${n(s)}`,c=t.privateFunction?.title?.trim();if(!t.areaId&&!t.tables?.length){const t=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${t}, ${c}`:t}}const u=`${t.areaName?.trim()||(t.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}},966,[]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_BACK",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"DAY_AHEAD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"DAY_IDLE_MS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"dayOffset",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"shiftDay",{enumerable:!0,get:function(){return y}}),_e.dayWord=f,Object.defineProperty(_e,"dayLong",{enumerable:!0,get:function(){return p}}),_e.bookingsForDay=function(e,t,o){return e.filter(e=>e.date===t&&(0,n.ACTIVE)(e))},_e.dayCovers=function(e,t,o){return(0,n.coversFour)(e,t)},_e.DaySwitch=function({day:e,today:n,onDay:b,back:x=c,ahead:j=u,idPrefix:$="display-day",stacked:D=!1,header:w=!1,onPickDate:C}){const P=h(e,n),k=t=>{const o=y(e,t);b(o===n?null:o)},L=y(e,-1),I=y(e,1),v=0!==P,T=(e,o,n,s,c)=>(0,d.jsx)(t.default,{testID:c,accessibilityRole:"button",accessibilityLabel:o,accessibilityState:{disabled:s},disabled:s,onPress:n,style:({pressed:e})=>({minHeight:44,minWidth:w?44:D?140:92,flex:D?1:void 0,paddingHorizontal:w?8:D?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,opacity:s?.35:1,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:(0,d.jsx)(i.T,{center:D,size:D?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:D?void 0:1,children:e})}),O=f(e,n),W=C?(0,d.jsx)(t.default,{testID:`${$}-cal`,accessibilityRole:"button",accessibilityLabel:"Pick a date from the calendar",onPress:C,style:({pressed:e})=>({minHeight:44,minWidth:w?44:D?140:92,flex:D?1:void 0,paddingHorizontal:w?8:D?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:w?(0,d.jsxs)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{width:18,height:16,borderWidth:1.5,borderColor:l.colours.goldLight,borderRadius:3,overflow:'hidden'},children:[(0,d.jsx)(o.default,{style:{height:4,backgroundColor:l.colours.goldLight}}),(0,d.jsx)(o.default,{style:{flex:1,flexDirection:'row',flexWrap:'wrap',padding:1.5,gap:1.5,justifyContent:'center',alignContent:'center'},children:[0,1,2,3].map(e=>(0,d.jsx)(o.default,{style:{width:3,height:3,backgroundColor:l.colours.goldLight}},e))})]}):(0,d.jsx)(i.T,{center:D,size:D?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:1,children:"Calendar"})}):null;return D?(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1,borderColor:v?l.colours.gold:l.colours.hairline,backgroundColor:v?l.colours.goldTint:l.colours.surface},children:[(0,d.jsxs)(o.default,{testID:`${$}-label`,accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${O}, ${p(e)}`,style:{gap:2,alignItems:'center'},children:[(0,d.jsx)(i.T,{center:!0,size:20,weight:"semibold",colour:l.colours.goldLight,children:O}),(0,d.jsx)(i.T,{center:!0,size:16,children:p(e)})]}),(0,d.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),T('Today','Back to today',()=>b(null),!1,'back-to-today'),W,T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]})]}):w?(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,flexShrink:1,minWidth:0},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),(0,d.jsx)(t.default,{testID:`${$}-label`,accessibilityRole:v||C?'button':'text',disabled:!v&&!C,onPress:()=>v?b(null):C?.(),accessibilityLabel:v?`Showing ${O===(0,s.niceDate)((0,s.parseYmd)(e))?'':`${O}, `}${p(e)}. Back to today`:C?`Showing today, ${p(e)}. Open the calendar to pick a date`:`Showing today, ${p(e)}`,style:({pressed:e})=>({minWidth:72,maxWidth:220,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:8,borderWidth:v?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:v?l.colours.goldTint:'transparent'}),children:(0,d.jsx)(i.T,{size:14,weight:"semibold",colour:v?l.colours.gold:l.colours.text,numberOfLines:1,children:v&&O!==(0,s.niceDate)((0,s.parseYmd)(e))?`${O} \xb7 ${(0,s.niceDate)((0,s.parseYmd)(e))}`:O})}),W,T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]}):(0,d.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:8},children:[(0,d.jsxs)(o.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[T('\u2039 Previous',`Previous day, ${p(L)}`,()=>k(-1),P<=-x,`${$}-prev`),(0,d.jsxs)(t.default,{testID:`${$}-label`,accessibilityRole:v||C?'button':'text',disabled:!v&&!C,onPress:()=>v?b(null):C?.(),accessibilityLabel:v?`Showing ${O===(0,s.niceDate)((0,s.parseYmd)(e))?'':`${O}, `}${p(e)}. Back to today`:C?`Showing today, ${p(e)}. Open the calendar to pick a date`:`Showing today, ${p(e)}`,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:6,borderWidth:v?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:v?l.colours.goldTint:'transparent'}),children:[(0,d.jsx)(i.T,{size:15,weight:"semibold",colour:v?l.colours.gold:l.colours.text,numberOfLines:1,children:v&&O!==(0,s.niceDate)((0,s.parseYmd)(e))?`${O} \xb7 ${(0,s.niceDate)((0,s.parseYmd)(e))}`:O}),v?(0,d.jsx)(i.T,{size:11,colour:l.colours.muted,numberOfLines:1,children:"Tap for today"}):null]}),T('Next \u203a',`Next day, ${p(I)}`,()=>k(1),P>=j,`${$}-next`)]}),W?(0,d.jsx)(o.default,{style:{alignItems:'center'},children:W}):null]})},r(_d[0]);var t=e(r(_d[1])),o=e(r(_d[2])),i=r(_d[3]),n=r(_d[4]),s=r(_d[5]),l=r(_d[6]),d=r(_d[7]);const c=365,u=365,b=12e4,h=(e,t)=>Math.round(((0,s.parseYmd)(e).getTime()-(0,s.parseYmd)(t).getTime())/864e5),y=(e,t)=>(0,s.ymd)((0,s.addMins)((0,s.parseYmd)(e),1440*t+120));function f(e,t){const o=h(e,t);return 0===o?'Today':-1===o?'Yesterday':1===o?'Tomorrow':(0,s.niceDate)((0,s.parseYmd)(e))}const p=e=>(0,s.parseYmd)(e).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},967,[31,264,128,818,832,822,825,25]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CalendarGlyph=function({colour:e=o.colours.goldLight,size:t=18}){const s=Math.max(2,Math.round(.16*t));return(0,u.jsxs)(l.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{width:t,height:t-2,borderWidth:1.5,borderColor:e,borderRadius:3,overflow:'hidden',backgroundColor:'transparent'},children:[(0,u.jsx)(l.default,{style:{height:Math.max(3,Math.round(.22*t)),backgroundColor:e}}),(0,u.jsx)(l.default,{style:{flex:1,flexDirection:'row',flexWrap:'wrap',padding:2,gap:2,justifyContent:'center',alignContent:'center'},children:Array.from({length:4},(t,i)=>(0,u.jsx)(l.default,{style:{width:s,height:s,borderRadius:.5,backgroundColor:e,opacity:.9}},i))})]})},_e.DisplayCalendar=function({visible:e,today:b,day:f,bookings:x,restaurant:p,now:j,onDay:D,onClose:w,back:C=d.DAY_BACK,ahead:I=d.DAY_AHEAD,idPrefix:T="display-cal",showBusy:_=!0,sheetTestID:S}){const[$,v]=(0,t.useState)(f.slice(0,7)),[B,k]=(0,t.useState)(0);(0,t.useEffect)(()=>{e&&v(f.slice(0,7))},[e,f]);const R=(0,n.venueBusy)(p,x,j??new Date).busy,E=(0,c.monthCells)($),P=(0,c.shiftMonth)($,-1),L=(0,c.shiftMonth)($,1),O=(0,c.monthInRange)(P,b,C,I),Y=(0,c.monthInRange)(L,b,C,I),M=B/7,N=e=>M>=46?e.slice(0,3):e.slice(0,2),A=e=>{D(e===b?null:e),w()},U=(0,c.quickJumps)(b);return(0,u.jsx)(i.Sheet,{visible:e,onClose:w,title:"Pick a date",centerTitle:!0,maxWidth:560,testID:S??T,footer:(0,u.jsxs)(l.default,{style:{gap:10,alignItems:'center'},children:[(0,u.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:U.map(e=>{const t=(0,c.inDisplayRange)(e.date,b,C,I);return(0,u.jsx)(i.Chip,{label:e.label,selected:f===e.date,disabled:!t,testID:`${T}-jump-${e.id}`,accessibilityLabel:`${e.label}, ${(0,c.longDay)(e.date)}${t?'':', not available'}`,onPress:()=>{t&&(v(e.date.slice(0,7)),A(e.date))}},e.id)})}),(0,u.jsx)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:(0,u.jsx)(i.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close calendar",testID:`${T}-close`,onPress:w})})]}),children:(0,u.jsxs)(l.default,{style:{gap:10,alignItems:'stretch'},children:[(0,u.jsx)(i.T,{size:22,weight:"bold",colour:o.colours.goldLight,center:!0,accessibilityRole:"header",testID:`${T}-month`,children:(0,c.monthName)($)}),(0,u.jsxs)(i.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Previous month",accessibilityLabel:O?`Previous month, ${(0,c.monthName)(P)}`:`Previous month, ${(0,c.monthName)(P)}, not available`,disabled:!O,testID:`${T}-prev`,onPress:()=>v(P)}),(0,u.jsx)(i.Button,{small:!0,kind:"secondary",label:"Next month",accessibilityLabel:Y?`Next month, ${(0,c.monthName)(L)}`:`Next month, ${(0,c.monthName)(L)}, not available`,disabled:!Y,testID:`${T}-next`,onPress:()=>v(L)})]}),(0,u.jsxs)(l.default,{onLayout:e=>k(e.nativeEvent.layout.width),style:{width:'100%'},children:[(0,u.jsx)(l.default,{style:{flexDirection:'row'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:h.map(e=>(0,u.jsx)(l.default,{style:{width:'14.2857%',alignItems:'center'},children:(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,center:!0,children:N(e)})},e))}),(0,u.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},testID:`${T}-grid`,children:E.map((e,t)=>{if(!e)return(0,u.jsx)(l.default,{style:{width:'14.2857%',height:56}},`blank-${t}`);const n=(0,c.inDisplayRange)(e,b,C,I),d=e===f,h=(0,c.dayIsClosed)(p,e),j=_?(0,c.dayCoversTotal)(x,e):0,D=_?(0,c.dayBusyTier)(j,R,(0,c.serviceHoursOf)(p,e)):'none';return(0,u.jsxs)(s.default,{testID:`${T}-${e}`,accessibilityRole:"button",accessibilityLabel:(0,c.calendarDayLabel)(e,b,f,j,D,h,_),accessibilityState:{selected:d,disabled:!n},disabled:!n,onPress:()=>A(e),style:{width:'14.2857%',height:56,minHeight:56,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:d||e===b?1.5:0,borderColor:o.colours.gold,backgroundColor:d?o.colours.goldTint:'transparent',opacity:n?h?.45:1:.3},children:[(0,u.jsx)(i.T,{size:17,weight:d||e===b?'bold':'regular',colour:d?o.colours.goldLight:h?o.colours.muted:o.colours.text,center:!0,children:Number(e.slice(8))}),_?(0,u.jsx)(y,{tier:D}):null]},e)})})]}),(0,u.jsx)(l.default,{testID:`${T}-key`,children:(0,u.jsxs)(i.Row,{wrap:!0,gap:12,style:{justifyContent:'center',paddingTop:2},children:[_?[['silver','Quiet'],['bronze','Steady'],['gold','Busy']].map(([e,t])=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,u.jsx)(l.default,{style:{width:c.BUSY_DOT_SIZE[e],height:c.BUSY_DOT_SIZE[e],borderRadius:c.BUSY_DOT_SIZE[e]/2,backgroundColor:c.BUSY_DOT[e]}}),(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,children:t})]},e)):null,(0,u.jsx)(i.T,{size:13,colour:o.colours.muted,children:"Closed days are faded"})]})})]})})};var t=r(_d[0]),s=e(r(_d[1])),l=e(r(_d[2])),i=r(_d[3]),n=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]);const h=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];function y({tier:e}){const t=c.BUSY_DOT_SIZE[e];return'none'===e?(0,u.jsx)(l.default,{style:{width:c.BUSY_DOT_SIZE.gold,height:c.BUSY_DOT_SIZE.gold,marginTop:2}}):(0,u.jsx)(l.default,{testID:`busy-dot-${e}`,style:{width:t,height:t,borderRadius:t/2,marginTop:2,backgroundColor:c.BUSY_DOT[e]}})}},968,[31,264,128,818,933,825,967,1410,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))}},969,[]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},970,[812,988]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CancellationsSection=function({items:e,dayWord:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.CANCEL_MUTED,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[e.people," \xb7 ",e.table," \xb7 ",e.by,e.when?` \xb7 ${e.when}`:'']})]},e.id)):(0,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{k:"Was booked for",v:`${e.date?`${new Date(`${e.date}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})}, `:''}${e.time}`}),(0,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},971,[31,264,128,818,970,825,949,25]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){if(t&&t.length&&o)return t.find(t=>t.staffId===n&&'approved'===t.status&&t.from<=o&&o<=t.to)}Object.defineProperty(e,'__esModule',{value:!0}),e.leaveCovering=t,Object.defineProperty(e,"coveredByLeave",{enumerable:!0,get:function(){return n}}),e.workingShifts=function(t,o){return o&&o.length?t.filter(t=>!n(o,t)):t},e.leaveLabel=function(t){return/sick|ill/i.test(t?.reason??'')?'Off sick':'On holiday'},e.leaveNote=function(t){return['Approved time off',t.reason&&'Holiday'!==t.reason?t.reason:'',t.decidedBy?`approved by ${t.decidedBy.replace(' (example)','')}`:''].filter(Boolean).join(' \xb7 ')};const n=(n,o)=>!!t(n,o.staffId,o.date)},972,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},973,[5,1342,1193,876,123,1345]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isTextIcon",{enumerable:!0,get:function(){return v}}),_e.StockIcon=w,_e.useReservedToday=$,_e.useReservedTomorrow=L,_e.ShellfishTile=function({rid:e,by:t,app:s,big:n,onOrder:l,style:d}){const m=(0,h.useShellfish)(e,t,s),b=$(e),[f,p]=(0,o.useState)(!1),k=T(e,m.items.find(e=>e.supplierId)?.supplierId),x=(0,r.useLiveState)();if('ready'!==x)return(0,j.jsx)(r.LiveWait,{state:x,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!m.items.length)return null;const v=m.items.filter(e=>m.isLow(e.key)),w=m.items.length<=3?m.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,j.jsxs)(a.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:v.length?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface,padding:n?10:12,gap:6},d],children:[(0,j.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,m.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:{gap:4,flex:n?1:void 0},children:[(0,j.jsxs)(c.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:["LIVE \xb7 ",w]}),(0,j.jsx)(c.T,{size:12,colour:y.colours.muted,children:"Tap to update \u203a"})]}),(0,j.jsx)(c.Row,{gap:n?14:18,style:{flex:n?1:void 0,alignItems:'center'},children:m.items.map(t=>{const s=m.counts[t.key]??0,o=m.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,j.jsx)(c.T,{size:n?42:34,weight:"bold",colour:s<=0?y.colours.red:o?y.colours.amber:y.colours.text,style:{lineHeight:n?50:42},children:(0,u.fmtStockCount)(e,t,s)}),(0,j.jsxs)(c.T,{size:13,colour:o?y.colours.amber:y.colours.muted,children:[S(t),s<=0?' \xb7 out':o?' \xb7 low':'']}),b[t.key]?(0,j.jsxs)(c.T,{size:12,weight:"semibold",colour:y.colours.goldLight,children:["Reserved: ",(0,u.fmtStockCount)(e,t,b[t.key])," \xb7 free ",(0,u.fmtStockCount)(e,t,Math.max(0,s-b[t.key]))]}):null]},t.key)})})]}),!n&&v.length?(0,j.jsxs)(a.default,{testID:"shellfish-low",style:{backgroundColor:y.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,j.jsxs)(c.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",v.map(t=>`${(0,u.fmtStockCount)(e,t,m.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,u.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),l?(0,j.jsx)(c.Button,{small:!0,label:k?`Order from ${k} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:l}):null]}):null,n||v.length||!l?null:(0,j.jsx)(i.default,{accessibilityRole:"button",onPress:l,style:{minHeight:44,justifyContent:'center'},children:(0,j.jsx)(c.T,{size:13,colour:y.colours.gold,children:k?`${k} order sheet \u203a`:'Order sheets \u203a'})}),f?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>p(!1),onOrder:l?()=>{p(!1),l()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:s,height:r=76}){const l=(0,h.useShellfish)(e,t,s),d=$(e),[m,b]=(0,o.useState)(!1);if(!l.items.length)return null;const f=r>=80,p=Math.max(28,Math.min(52,Math.round(.6*r))),k=Math.max(22,Math.min(34,Math.round(.42*r)));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${l.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,l.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>b(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:r,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...n.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:l.items.map((t,s)=>{const o=l.counts[t.key]??0,i=d[t.key]??0,h=Math.max(0,o-i),m=h<=0,b=m||l.isLow(t.key);return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,h)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:f?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:b?'rgba(255,107,94,0.07)':'transparent',...n.look.web(b?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[v(t.icon)?null:(0,j.jsx)(w,{icon:t.icon,size:k}),(0,j.jsx)(c.T,{size:p,weight:"bold",colour:b?'#FF8E82':y.colours.text,style:{lineHeight:Math.round(1.15*p),letterSpacing:-.5,minWidth:Math.round(.85*p),textAlign:'center'},children:(0,u.fmtStockCount)(e,t,h)}),(0,j.jsxs)(a.default,{style:{gap:0},children:[(0,j.jsx)(c.T,{size:f?15:13,weight:"semibold",colour:b?'#FFB3AA':y.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),b&&r>=60?(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:m?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,u.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,j.jsxs)(c.T,{size:f?14:12,weight:"semibold",colour:i?y.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,u.fmtStockCount)(e,t,i)]})]})]},t.key)})}),m?(0,j.jsx)(D,{rid:e,by:t,app:s,onClose:()=>b(!1)}):null]})},_e.ShellfishPanel=D,Object.defineProperty(_e,"SHELLFISH_CHIP_N_SLOT",{enumerable:!0,get:function(){return M}}),_e.ShellfishChip=z,_e.SundayRoastChip=function(e){return(0,j.jsx)(z,{...e,group:"roast"})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),r=_r(_d[3]),n=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),m=_r(_d[12]),y=_r(_d[13]),b=_r(_d[14]),f=_r(_d[15]),p=_r(_d[16]),k=_r(_d[17]),x=_r(_d[18]),j=_r(_d[19]);const v=e=>!!e&&/[A-Za-z]{2,}/.test(e);function w({icon:e,size:t}){const s=e?d.STOCK_ICON_IMAGES[e.trim()]:void 0;if(!s)return(0,j.jsx)(c.T,{size:t,children:e});const o=Math.round(1.25*t),r=o/Math.max(s.w,s.h);return(0,j.jsx)(a.default,{testID:"stock-icon-img",style:{width:o,height:o,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,j.jsx)(l.default,{source:{uri:s.uri},accessible:!1,style:{width:Math.round(s.w*r),height:Math.round(s.h*r)},resizeMode:"contain"})})}const S=e=>v(e.icon)&&e.icon.trim().toLowerCase()===e.plural.trim().toLowerCase()?e.plural:`${e.icon??''} ${e.plural}`.trim(),C=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function $(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=(0,p.venueYmd)((0,b.useNow)(6e4));return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}const I=(e,t)=>{const[s,o,r]=e.split('-').map(Number),n=new Date(Date.UTC(s,o-1,r+t));return`${n.getUTCFullYear()}-${String(n.getUTCMonth()+1).padStart(2,'0')}-${String(n.getUTCDate()).padStart(2,'0')}`};function L(e){const t=(0,b.useBookings)(e),s=(0,b.useRestaurant)(e),o=I((0,p.venueYmd)((0,b.useNow)(6e4)),1);return(0,f.reservedOn)(t,o,(0,f.reservablesOf)(s))}function T(e,t){const s=(0,m.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function D({rid:e,by:s,app:r,onClose:n,onOrder:l,group:i}){const d=(0,h.useShellfish)(e,s,r,i),m='roast'===i,[b,f]=(0,o.useState)({}),p=m?Object.fromEntries(d.items.map(e=>[e.key,b[e.key]??Math.max(0,Math.round(d.counts[e.key]??0))])):b,[v,w]=(0,o.useState)(null),$=T(e,d.items.find(e=>e.supplierId)?.supplierId),I=(s,o)=>{const r=d.itemOf(s);r&&f(n=>{const l=n[s]??(m?Math.max(0,Math.round(d.counts[s]??0)):0);return{...n,[s]:(0,t.fishInStone)(e,r)?(0,t.stepQuantity)(e,r,l,o):Math.max(0,Math.min(99,l+o))}})},L=(e,t=!1)=>{const s=d.itemOf(e);d.sell(e,t)&&w(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},D=Object.values(p).reduce((e,t)=>e+t,0),M=m&&d.items.some(e=>null!=b[e.key]&&b[e.key]!==Math.round(d.counts[e.key]??0)),z=(0,o.useRef)(null);z.current||(z.current=new Set(d.events.map(e=>e.id)));const O=d.events.filter(e=>!z.current.has(e.id)),[R,E]=(0,o.useState)({state:'idle'}),[B,F]=(0,o.useState)(0),H=O.filter(e=>'saved'!==(0,x.stockEventStatus)(e.id).state),A=m?M:D>0,P=(e,t)=>{E({state:e,text:t}),(0,k.announce)(t)};(0,o.useEffect)(()=>{if('saving'!==R.state&&!H.length)return;const e=setInterval(()=>F(e=>e+1),600);return()=>clearInterval(e)},[R.state,H.length]);const W=(0,o.useRef)(0);(0,o.useEffect)(()=>{if('saving'!==R.state)return;const e=O.map(e=>e.id).map(e=>(0,x.stockEventStatus)(e)),t=e.find(e=>'refused'===e.state);if(t)return void P('error',`Not saved. ${t.why.charAt(0).toUpperCase()}${t.why.slice(1)}.`);const s=(0,x.stockSaveBlocker)();s&&e.some(e=>'saved'!==e.state)?P('error',`Not saved yet: ${s}.`):e.every(e=>'saved'===e.state)?P('saved',m?'Saved. Every screen now shows this roast count.':'Saved. Every screen now shows this count.'):Date.now()-W.current>2e4&&P('error','Not saved yet: the shared system has not answered. Check the connection, then press Save changes again.')},[R.state,B,O.length]);const N='saving'!==R.state&&(A||H.length>0),_='saving'===R.state?'Saving\u2026':'saved'!==R.state||A||H.length?'error'===R.state?R.text:N?A?'You have changes to save.':`${H.length} ${1===H.length?'change':'changes'} not confirmed yet.`:'Nothing to save: no changes since you opened this.':R.text,U=(0,j.jsxs)(a.default,{testID:m?'roast-save-box':'shellfish-save-box',style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,j.jsx)(c.Button,{testID:m?'roast-save':'shellfish-save',kind:"primary",label:'saving'===R.state?'Saving\u2026':'Save changes',disabled:!N,accessibilityLabel:'saving'===R.state?'Saving':N?'Save changes':'Save changes, nothing to save',onPress:()=>{m&&M&&(d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({})),!m&&D&&(d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),f({})),W.current=Date.now(),E({state:'saving',text:'Saving\u2026'}),(0,k.announce)('Saving'),setTimeout(()=>{(0,x.saveStockEventsNow)()},50)},style:{minHeight:56,alignSelf:'stretch'}}),(0,j.jsx)(a.default,{testID:m?'roast-save-status':'shellfish-save-status',accessibilityLiveRegion:"polite",style:{alignSelf:'stretch'},children:(0,j.jsx)(c.T,{center:!0,size:14,colour:'error'===R.state?'#FFB3AA':'saved'===R.state?y.colours.goldLight:y.colours.muted,children:_})})]});return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:n,title:m?`Sunday roast: ${d.items.map(e=>e.plural).join(' & ')}`:d.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:m?'roast-panel':'shellfish-panel',footer:U,children:[(0,j.jsx)(c.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:d.items.map(s=>{const o=d.counts[s.key]??0;return(0,j.jsxs)(a.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:d.isLow(s.key)?y.colours.amber:y.colours.border,backgroundColor:y.colours.surface2},children:[(0,j.jsx)(c.T,{center:!0,size:13,colour:y.colours.muted,children:S(s)}),(0,j.jsx)(c.T,{center:!0,size:48,weight:"bold",colour:d.isLow(s.key)?y.colours.amber:y.colours.text,style:{lineHeight:56},children:(0,u.fmtStockCount)(e,s,o)}),(0,j.jsx)(c.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>L(s.key),style:{minHeight:56}}),'half'===s.unit?(0,j.jsx)(c.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>L(s.key,!0),style:{minHeight:52}}):(0,j.jsx)(a.default,{style:{minHeight:52}})]},s.key)})}),(0,j.jsx)(c.Button,{kind:"ghost",label:d.undoable?`\u21b6 Undo: ${(0,u.describe)(d.undoable,d.itemOf(d.undoable.kind))}`:'\u21b6 Nothing to undo',testID:m?'roast-undo':'shellfish-undo',disabled:!d.undoable,onPress:()=>{const e=d.undoable;d.undoLast(),e&&w(`Undone: ${(0,u.describe)(e,d.itemOf(e.kind))}.`)}}),v?(0,j.jsx)(c.Banner,{kind:"success",title:v}):null,(0,j.jsxs)(a.default,{testID:m?'roast-load':'delivery-in',style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:y.colours.gold,backgroundColor:y.colours.goldTint},children:[(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.goldLight,children:m?'Count before service':'Delivery in'}),d.items.map(s=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(c.T,{style:{flex:1},children:S(s)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:m?`One less ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,testID:`in-minus-${s.key}`,onPress:()=>I(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,j.jsx)(c.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,u.fmtStockCount)(e,s,p[s.key]||0)}),(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:m?`One more ${s.name.toLowerCase()}, now ${p[s.key]||0}`:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>I(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>I(s.key,5)})]},s.key)),m?(0,j.jsx)(c.Button,{kind:"success",label:`Set today\u2019s count: ${d.items.map(e=>`${p[e.key]||0} ${e.name.toLowerCase()}`).join(' and ')}`,testID:"roast-set",disabled:!M,onPress:()=>{d.items.forEach(e=>{null!=b[e.key]&&d.recount(e.key,Math.max(0,Math.round(b[e.key])))}),f({}),w('Today\u2019s roast count is set.')},style:{minHeight:54}}):(0,j.jsx)(c.Button,{kind:"success",label:D?`Add to stock: ${d.items.filter(e=>p[e.key]).map(t=>`${(0,u.fmtStockCount)(e,t,p[t.key])} ${(1===p[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!D,onPress:()=>{d.items.forEach(e=>d.deliver(e.key,p[e.key]??0)),w('Delivery added to the count.'),f({})},style:{minHeight:54}})]}),l?(0,j.jsx)(c.Button,{kind:"secondary",label:$?`${$} order sheet \u203a`:'Order sheets \u203a',onPress:l}):null,(0,j.jsxs)(a.default,{style:{gap:2},children:[(0,j.jsx)(c.T,{size:12,weight:"semibold",colour:y.colours.gold,children:"RECENT"}),d.events.slice(0,6).map(e=>(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{size:13,style:{flex:1},children:(0,u.describe)(e,d.itemOf(e.kind))}),(0,j.jsxs)(c.Muted,{children:[C(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:d.synced?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"ok",label:"Shared live"}),(0,j.jsx)(c.Muted,{children:"Every paired device sees the same count."})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Badge,{kind:"neutral",label:"Saved on this device"}),(0,j.jsx)(c.Muted,{children:"Not connected to the shared venue yet."})]})})]})}const M=18;function z({rid:e,by:t,app:r,size:l="m",group:d}){const m=(0,h.useShellfish)(e,t,r,d),f=$(e),p=L(e),[k,x]=(0,o.useState)(!1),[S,C]=(0,o.useState)(null),I=(0,b.useNow)(3e4);if(!m.items.length)return null;if('roast'===d&&!(0,u.isSundayIn)(I))return null;const T='m'===l?20:17,z='roast'!==d,R=z&&m.items.some(e=>(p[e.key]??0)>0),E=R?Math.max(0,...m.items.map(e=>p[e.key]??0)):0,B='xs'!==l&&!R;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(i.default,{testID:'roast'===d?'roast-tile':'shellfish-tile',accessibilityRole:"button",accessibilityLabel:`${'roast'===d?'Sunday roast: ':''}${m.items.map(t=>`${t.plural} ${(0,u.fmtStockCount)(e,t,Math.max(0,(m.counts[t.key]??0)-(f[t.key]??0)))} available${z&&p[t.key]?`, ${p[t.key]} reserved tomorrow`:''}`).join(', ')}. Tap to update`,onPress:()=>x(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...n.look.web({cursor:'pointer'})}),children:m.items.map((t,o)=>{const r=m.counts[t.key]??0,n=f[t.key]??0,l=Math.max(0,r-n),d=l<=0,h=d||m.isLow(t.key),b=z?p[t.key]??0:0,k=d?y.colours.red:z?y.colours.shellfishFree:h?y.colours.amber:y.colours.text,x=`(${(0,u.fmtStockCount)(e,t,b>0?b:0)})`;return(0,j.jsxs)(a.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,u.speakStockCount)(e,t,l)}${b?`, ${b} reserved tomorrow`:''}`,style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:R?4:6,paddingHorizontal:R?5:9,paddingVertical:3,flexShrink:0,minWidth:R?62:void 0,borderLeftWidth:o?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:h?'rgba(255,107,94,0.10)':'transparent'},children:[v(t.icon)?(0,j.jsx)(c.T,{size:Math.max(11,T-7),weight:"semibold",colour:y.colours.goldLight,numberOfLines:1,center:!0,style:{flexShrink:0},children:t.icon}):(0,j.jsx)(w,{icon:t.icon,size:T-2}),(0,j.jsx)(c.T,{size:T,weight:"bold",colour:k,style:{lineHeight:T+4},children:(0,u.fmtStockCount)(e,t,l)}),b>0?(0,j.jsx)(i.default,{testID:`reserved-tomorrow-${t.key}`,accessibilityRole:"button",accessibilityLabel:`${b} ${t.plural} reserved tomorrow. Opens the list of bookings.`,onPress:e=>{e?.stopPropagation?.(),C(t.key)},hitSlop:12,style:{flexShrink:0,justifyContent:'center',alignItems:'center',width:M,minWidth:M,overflow:'hidden'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:y.colours.red,center:!0,children:x})}):R?(0,j.jsx)(a.default,{testID:`reserved-tomorrow-slot-${t.key}`,accessible:!1,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{minWidth:M,width:M,flexShrink:0,overflow:'hidden',justifyContent:'center',alignItems:'center'},children:(0,j.jsx)(c.T,{size:11,weight:"semibold",colour:"transparent",center:!0,children:`(${(0,u.fmtStockCount)(e,t,E)})`})}):null,!B||!(n||d||h)||d&&s.IS_CAR?null:(0,j.jsx)(c.T,{size:10,weight:"semibold",colour:d||h?'#FFB3AA':y.colours.goldLight,children:d?'none left':n?`${(0,u.fmtStockCount)(e,t,n)} res`:'low'})]},t.key)})}),k?(0,j.jsx)(D,{rid:e,by:t,app:r,group:d,onClose:()=>x(!1)}):null,S?(0,j.jsx)(O,{rid:e,stockKey:S,label:m.items.find(e=>e.key===S)?.plural??S,onClose:()=>C(null)}):null]})}function O({rid:e,stockKey:t,label:s,onClose:o}){const r=(0,b.useBookings)(e),n=(0,b.useRestaurant)(e),l=I((0,p.venueYmd)((0,b.useNow)(6e4)),1),i=(0,f.reservedBookingsOn)(r,l,(0,f.reservablesOf)(n),t),d=s.charAt(0).toUpperCase()+s.slice(1);return(0,j.jsxs)(c.Sheet,{visible:!0,onClose:o,title:`${d} reserved tomorrow`,testID:`reserved-tomorrow-sheet-${t}`,children:[(0,j.jsx)(c.T,{size:16,colour:y.colours.muted,children:(0,p.niceDateYear)((0,p.parseYmd)(l))}),i.map(({booking:e,qty:t})=>(0,j.jsxs)(a.default,{testID:`reserved-tomorrow-row-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:y.colours.hairline,gap:4},children:[(0,j.jsx)(c.T,{size:18,weight:"semibold",children:e.name}),(0,j.jsxs)(c.T,{size:15,colour:y.colours.muted,children:[(e.time||'').slice(0,5)," \xb7 ",e.partySize," ",1===e.partySize?'cover':'covers']}),(0,j.jsxs)(c.T,{size:15,weight:"semibold",colour:y.colours.red,children:[t," reserved"]})]},e.id))]})}},974,[1085,807,31,1388,973,197,264,128,1456,818,1088,1086,1087,825,823,832,822,1421,824,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyChain=j,_e.BookingAllergyChain=function({b:l,me:t,readOnly:k}){const p=(0,i.useOrders)(l.restaurantId),S=(0,o.useStore)(e=>e.ackBookingAllergy);if(!l.allergies.length)return null;const A=p.find(e=>e.allergies.length&&!['cancelled','closed'].includes(e.status)&&(e.bookingId===l.id||!e.bookingId&&(0,c.linkedBooking)(e,[l])?.id===l.id));if(A)return(0,h.jsx)(j,{o:A,me:t,readOnly:k,compact:!0});const I={booked:l.allergyAck,ordered:void 0,kitchen:void 0,pass:void 0,table:void 0};return(0,h.jsxs)(s.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:l.allergyAck?u.colours.border:u.colours.red,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(n.T,{size:13,weight:"semibold",colour:"#FFD9D4",children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(n.Badge,{kind:l.allergyAck?'amber':'red',label:(l.allergyAck?1:0)+" of 5"})]}),(0,h.jsx)(y,{chain:I,next:l.allergyAck?null:'booked',testID:`allergy-steps-${l.ref}`}),l.allergyAck?(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:l.allergyAck.by,size:20,ring:!1}),(0,h.jsxs)(n.Muted,{style:{flex:1},children:["1. Booked: ",b(l.allergyAck.by)," at ",x(l.allergyAck.at),". Steps 2 to 5 are signed on the table's order."]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(n.T,{size:13,children:"Next: 1. Booked. Allergy recorded (who took it)."}),k?null:(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(n.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off Booked on ${l.ref}`,disabled:!t.trim(),onPress:()=>S(l.id,t)}),(0,h.jsxs)(n.Muted,{children:["as ",b(t)]})]})]})]})};var e=r(d[0]);r(d[1]);var l,t=r(d[2]),s=(l=t)&&l.__esModule?l:{default:l},n=r(d[3]),i=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]),h=r(d[9]);const x=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),b=e=>e.replace(' (example)','');function y({chain:e,next:l,testID:t}){return(0,h.jsx)(s.default,{testID:t,accessibilityLabel:`Allergen sign-off ${c.CHAIN_STEPS.filter(l=>e[l.id]).length} of 5`,style:{flexDirection:'row',alignItems:'flex-start'},children:c.CHAIN_STEPS.map((t,i)=>{const o=!!e[t.id],f=l===t.id,y=o?u.colours.ok:f?u.colours.gold:u.colours.border,j=0===i?'flex-start':i===c.CHAIN_STEPS.length-1?'flex-end':'center',k=(0,h.jsxs)(s.default,{style:{width:'200%',alignSelf:j,alignItems:j},children:[(0,h.jsx)(n.T,{size:11,weight:f?'semibold':'regular',colour:o?u.colours.text:f?u.colours.gold:u.colours.muted,style:{textAlign:0===i?'left':i===c.CHAIN_STEPS.length-1?'right':'center'},children:t.label}),e[t.id]?(0,h.jsxs)(n.T,{size:10,colour:u.colours.muted,numberOfLines:1,style:{textAlign:0===i?'left':i===c.CHAIN_STEPS.length-1?'right':'center'},children:[b(e[t.id].by).split(' ')[0]," ",x(e[t.id].at)]}):null]}),p=i%2==1;return(0,h.jsxs)(s.default,{style:{flex:1,alignItems:'center'},children:[(0,h.jsx)(s.default,{style:{minHeight:30,justifyContent:'flex-end',alignSelf:'stretch',alignItems:j},children:p?k:null}),(0,h.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',width:'100%',marginVertical:2},children:[(0,h.jsx)(s.default,{style:{flex:1,height:2,backgroundColor:i?o||f?y:u.colours.border:'transparent'}}),(0,h.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,borderWidth:2,borderColor:y,backgroundColor:o?u.colours.ok:'transparent',alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(n.T,{size:12,weight:"bold",colour:o?'#0B0B0B':f?u.colours.gold:u.colours.muted,children:o?'\u2713':String(t.n)})}),(0,h.jsx)(s.default,{style:{flex:1,height:2,backgroundColor:i<4?o?u.colours.ok:u.colours.border:'transparent'}})]}),(0,h.jsx)(s.default,{style:{minHeight:30,alignSelf:'stretch',alignItems:j},children:p?null:k})]},t.id)})})}function j({o:l,me:t,readOnly:j,compact:k}){const p=(0,i.useBookings)(l.restaurantId),S=(0,o.useStore)(e=>e.signAllergyStep);if(!l.allergies.length)return null;const A=(0,c.linkedBooking)(l,p),I=(0,c.orderChain)(l,A),C=(0,c.nextStep)(l,A),w=c.CHAIN_STEPS.filter(e=>I[e.id]).length,T=C?(0,c.stepInfo)(C):null,B='table'===C&&!['ready','served','collected'].includes(l.status);return(0,h.jsxs)(s.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:C?u.colours.red:u.colours.ok,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(n.T,{size:13,weight:"semibold",colour:C?'#FFD9D4':'#E2C489',children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(n.Badge,{kind:C?'red':'ok',label:C?`${w} of 5`:'Complete'})]}),(0,h.jsx)(y,{chain:I,next:C,testID:`allergy-steps-${l.ref}`}),k?null:c.CHAIN_STEPS.filter(e=>I[e.id]).map(e=>(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:I[e.id].by,size:20,ring:!1}),(0,h.jsxs)(n.Muted,{style:{flex:1},children:[e.n,". ",e.label,": ",b(I[e.id].by)," at ",x(I[e.id].at)]})]},e.id)),T?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(n.T,{size:13,children:["Next: ",T.n,". ",T.label,". ",T.what,"."]}),j?null:(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(n.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off ${T.label} on ${l.ref}`,disabled:!t.trim()||B,onPress:()=>S(l.id,C,t)}),(0,h.jsxs)(n.Muted,{children:["as ",b(t)]})]}),B?(0,h.jsx)(n.Muted,{children:"Signed off at the pass. The table step is signed when the dish is served."}):(0,h.jsx)(n.Muted,{children:"The ticket can't move on until this step is signed off."})]}):(0,h.jsx)(n.Muted,{children:"All five steps signed off. The full chain is in the allergen audit log."})]})}},975,[876,31,128,818,1081,881,976,825,996,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CHAIN_STEPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"stepInfo",{enumerable:!0,get:function(){return t}}),e.linkedBooking=l,e.orderChain=o,e.nextStep=s,Object.defineProperty(e,"doneCount",{enumerable:!0,get:function(){return c}}),e.canSign=function(n,t,l){return s(n,l)===t},e.statusBlock=function(n,l,s){if(!n.allergies.length||'cancelled'===l)return null;const c=o(n,s),u=n=>c[n]?null:`${t(n).n}. ${t(n).label} needs signing off first`;return'acknowledged'===l||'preparing'===l||'ready'===l?u('booked')??u('ordered')??u('kitchen'):'served'===l?u('booked')??u('ordered')??u('kitchen')??u('pass'):'collected'===l||'closed'===l?u('booked')??u('ordered')??u('kitchen')??u('pass')??u('table'):null},e.chainNeedsAction=function(n,t){const o=s(n,l(n,t));return!(!o||'table'===o&&!['ready','served'].includes(n.status))},e.bookingNeedsAction=function(n,t){return n.allergies.length>0&&!n.allergyAck&&!t.some(t=>t.allergies.length&&l(t,[n])?.id===n.id)};const n=[{id:'booked',n:1,label:'Booked',what:'Allergy recorded (who took it)'},{id:'ordered',n:2,label:'Ordered',what:'Server confirms with the guest'},{id:'kitchen',n:3,label:'Kitchen',what:'Chef signs off before cooking'},{id:'pass',n:4,label:'Pass',what:'Checked before it leaves the pass'},{id:'table',n:5,label:'Table',what:'Server signs off when served'}],t=t=>n.find(n=>n.id===t);function l(n,t){return n.bookingId?t.find(t=>t.id===n.bookingId):'table'===n.type&&n.tableNo?t.find(t=>t.restaurantId===n.restaurantId&&'seated'===t.status&&!!t.table&&t.table.split('+').includes(String(n.tableNo))):void 0}function o(n,t){return{booked:n.allergyChain?.booked??(t?.allergies.length?t.allergyAck:void 0),ordered:n.allergyChain?.ordered,kitchen:n.allergyAck,pass:n.allergyChain?.pass,table:n.handoverCheck}}function s(t,l){if(!t.allergies.length)return null;const s=o(t,l);return n.find(n=>!s[n.id])?.id??null}const c=(t,l)=>{const s=o(t,l);return n.filter(n=>s[n.id]).length}},976,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CAR_ACTOR",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CAR_DEVICE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"CAR_DEFAULT_LABEL",{enumerable:!0,get:function(){return u}}),e.carDeviceIdentity=c,e.actorStamp=function(t){if(t.isCar)return r;if((0,n.isKitchenViaDisplay)())return(0,n.kitchenActor)();if('device'===t.kind)return'Display';return t.staffRef&&String(t.staffRef).trim()||t.fallback||'Staff'},e.migrateCarStaffIdentity=function(n){return n?.venueId?c({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,label:n.label}):null},e.carPairApproved=function(n){return'approved'===String(n?.status??'')&&!(!n?.venue_id&&!n?.venueId)};var n=_r(d[0]);const r='Car',t='car-device',u='Tesla';function c(n){return{kind:'device',venueId:String(n.venue_id??n.venueId??''),venueSlug:String(n.venue_slug??n.venueSlug??'anchorage'),venueName:String(n.venue_name??n.venueName??'The Anchorage'),canWrite:!0,role:'owner',displayName:r,label:n.label&&String(n.label).trim()||u}}},977,[979]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ROLE_BADGES",{enumerable:!0,get:function(){return n}}),e.cleanBadge=t,Object.defineProperty(e,"badgeSpoken",{enumerable:!0,get:function(){return o}}),e.assignShiftBadge=function(n,o,c){const s=t(c);return n.map(n=>n.id===o?{...n,badge:s,changed:!!n.published||n.changed}:n)};const n=['Bar','Floor','Upstairs KP','Downstairs KP','Sauce','Larder'];function t(t){const o=String(t??'').trim().toLowerCase();return n.find(n=>n.toLowerCase()===o)}const o=n=>t(n)?`, on ${t(n)}`:''},978,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KITCHEN_TICKET_RE",{enumerable:!0,get:function(){return t}}),e.kitchenTicketFromHash=function(n){const c=(n||'').match(/[#&]cckitchen=([A-Za-z0-9_-]{24,64})(?:&|$)/);return c&&t.test(c[1])?c[1]:null},e.chefKitchenUrl=function(t,n){const c=t.includes('?')?t.replace('?','?from=display&'):t.replace(/(#|$)/,'?from=display$1'),[s,o]=c.split('#'),u=(o||'').split('&').filter(t=>t&&!t.startsWith('cckitchen=')).join('&');return`${s}#cckitchen=${n}${u?`&${u}`:''}`},e.markKitchenViaDisplay=function(t,s){try{if('undefined'==typeof sessionStorage)return;t?(sessionStorage.setItem(n,'1'),s&&sessionStorage.setItem('cc-kitchen-actor',String(s).slice(0,60))):(sessionStorage.removeItem(n),sessionStorage.removeItem('cc-kitchen-actor'),sessionStorage.removeItem(c))}catch{}},e.isKitchenViaDisplay=function(){try{return'undefined'!=typeof sessionStorage&&'1'===sessionStorage.getItem(n)}catch{return!1}},e.kitchenActor=function(){try{return`${('undefined'!=typeof sessionStorage?sessionStorage.getItem('cc-kitchen-actor'):null)||'Head Chef'} via Display`.slice(0,80)}catch{return'Head Chef via Display'}},e.kitchenSessionStoreName=function(){return c};const t=/^[A-Za-z0-9_-]{24,64}$/,n='cc-kitchen-via-display',c='covercharge-kitchen-session-v1'},979,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSliders",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"notify",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"dismissNotice",{enumerable:!0,get:function(){return c}});var t=r(d[0]);let u=0;const s=t=>'urgent'===t.tone?0:'warn'===t.tone?1:2,n=(0,t.create)()((t,n)=>({queue:[],push:n=>t(t=>{const o=t.queue.find(t=>t.id===n.id),c=o?t.queue.map(t=>t.id===n.id?{...n,seq:o.seq}:t):[...t.queue,{...n,seq:++u}];return{queue:(f=c,[...f].sort((t,u)=>s(t)-s(u)||(t.seq??0)-(u.seq??0))).slice(0,40)};var f}),dismiss:u=>{const s=n().queue.find(t=>t.id===u);if(s){t(t=>({queue:t.queue.filter(t=>t.id!==u)}));try{s.onClose?.()}catch{}}},dismissWhere:t=>{for(const u of n().queue.filter(t))n().dismiss(u.id)}})),o=t=>n.getState().push(t),c=t=>n.getState().dismiss(t)},980,[995]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"pinProblem",{enumerable:!0,get:function(){return r.pinProblem}}),Object.defineProperty(_e,"ERROR_TEXT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"errorText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useDisplayTiles",{enumerable:!0,get:function(){return u}}),_e.refreshTiles=async function(){const e=await l('display_staff_list',{});Array.isArray(e)&&u.setState({tiles:e,at:Date.now()});const t=await l('display_pin_lengths',{});t&&'object'==typeof t&&!('ok'in t)&&u.setState({lens:t})},_e.refreshManagers=async function(){const e=await l('display_managers',{});Array.isArray(e)&&u.setState({managers:e})},Object.defineProperty(_e,"displayClock",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"displayChangePin",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"displayAddTemp",{enumerable:!0,get:function(){return y}}),_e.setStaffPin=async function(e,n,a=4){const o=_();if(!o)return{ok:!1,error:'Sign in to the venue to set PINs (they are kept on the server only).'};const s=(0,r.pinProblem)(n,a);if(s)return{ok:!1,error:s};try{const{error:r}=await(0,t.getSupabase)().rpc('set_staff_pin',{p_venue:o,p_staff_ref:e,p_pin:n});return r?{ok:!1,error:r.message.replace(/^.*?:\s*(?=The PIN|Pick a PIN)/,'')}:{ok:!0}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},_e.addTempStaff=async function(e){const n=_();if(!n)return{ok:!1,error:'Sign in to the venue to add temp staff (the code is made and kept on the server).'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc('add_temp_staff',{p_venue:n,p_name:e.name,p_dept:e.dept??null,p_rate:e.rate??null,p_until:e.until||null});return a?{ok:!1,error:a.message}:{ok:!0,...r}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},Object.defineProperty(_e,"usePinStatus",{enumerable:!0,get:function(){return k}}),_e.refreshPinStatus=async function(){const e=_();if(!e)return;try{const{data:n}=await(0,t.getSupabase)().rpc('staff_pin_status',{p_venue:e});Array.isArray(n)&&k.setState(Object.fromEntries(n.map(e=>[e.staff_ref,{hasPin:e.has_pin,locked:e.locked}])),!0)}catch{}},_e.localTiles=function(e,t){return e.filter(e=>e.active&&e.displayClock&&!(e.temp&&e.tempUntil&&e.tempUntil({ref:e.id,name:e.name,nickname:e.nickname,dept:e.dept,temp:!!e.temp})).sort((e,t)=>Number(!!e.temp)-Number(!!t.temp)||e.name.localeCompare(t.name))},Object.defineProperty(_e,"displayBlockChange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"displayBlockEdit",{enumerable:!0,get:function(){return h}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]),a=_r(d[4]),o=_r(d[5]);const s={wrong:'That PIN is not right. Try again.',locked:'Too many wrong tries. Locked for 15 minutes, or ask a manager to reset your PIN.',nopin:'No PIN set yet. Ask a manager to set one in Staff & roles.',notallowed:'This person can\u2019t clock in at the Display. A manager can turn it on in Staff & roles.',already:'Already clocked in.',notin:'Not clocked in yet.',onbreak:'Already on a break.',notmanager:'Only an owner or manager can add temp staff.',format:'The new PIN must be 4 to 8 digits (6 or more for managers and owners).',weak:'Pick a PIN that is harder to guess (not all the same digit or a run like 1234).',devicelocked:'Too many wrong PINs on this Display. Wait 15 minutes, then try again.',unpaired:'Pair this Display first (Settings \u203a Devices on the Managers app), then try again.',offline:'No connection. Try again in a moment.'},c=(e,t)=>'format'===e&&t?.min?`The new PIN must be ${t.min} to 8 digits.`:s[e??'']??(e||'Something went wrong. Try again.'),p=()=>'device'===n.useSync.getState().kind&&!!n.useSync.getState().venueId;async function l(e,n){if(a.PITCH)return(0,o.pitchClock)(e,n);if(!p())return{ok:!1,error:'unpaired'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc(e,n);return a?{ok:!1,error:/paired Display/.test(a.message)?'unpaired':a.message}:r}catch{return{ok:!1,error:'offline'}}}const u=(0,e.create)(()=>({tiles:null,managers:[],lens:{}}));const f=(e,t,n,r={})=>l('display_clock',{p_staff_ref:e,p_pin:t,p_action:n,p_break_mins:r.breakMins??null,p_off_rota:!!r.offRota}),m=(e,t,n)=>l('display_change_pin',{p_staff_ref:e,p_old:t,p_new:n}),y=(e,t,n)=>l('display_add_temp',{p_manager_ref:e,p_manager_pin:t,p_name:n.name,p_dept:n.dept??null,p_rate:n.rate??null,p_until:n.until||null}),_=()=>'staff'===n.useSync.getState().kind?n.useSync.getState().venueId:void 0;const k=(0,e.create)(()=>({}));const b=(e,t,n,r,a)=>l('display_block_change',{p_manager_ref:e,p_manager_pin:t,p_block_id:n,p_action:r,p_doc:a}),h=(e,t,n,r)=>l('display_block_edit',{p_block_id:e,p_action:t,p_doc:n,p_by:r})},981,[995,872,824,1530,2,1531]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOutLinks",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isAutoLink",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"autoSync",{enumerable:!0,get:function(){return v}}),_e.itemsFor=b,_e.dishUsesFor=p,_e.countsFor=O,_e.reasonFor=function(e,t,n){const s=n??p(e).find(e=>e.id===t)?.uses??[],r=O(e),i=c.useStore.getState().menu.find(e=>e.id===t)?.name??'';return(0,u.dishReason)(i,(0,u.shortOf)(s,r),r,b(e))},_e.runAutoSoldOut=y,_e.startAutoSoldOut=function(){if(w)return w;let e=null;const t=()=>{e||(e=setTimeout(()=>{e=null,y()},400))},n=[d.useShellStore.subscribe((e,n)=>{e.events===n.events&&e.server===n.server&&e.items===n.items||t()}),h.subscribe(t),S.useCardStore.subscribe((e,n)=>{e.cards!==n.cards&&t()}),c.useStore.subscribe((e,n)=>{e.menu===n.menu&&e.restaurants===n.restaurants||t()}),f.useSoldOut.subscribe((e,n)=>{e.entries!==n.entries&&t()})],s=setInterval(t,6e4);return t(),w=()=>{n.forEach(e=>e()),clearInterval(s),e&&clearTimeout(e),w=null},w},_e.useAutoSoldOutView=function(e){const t=(0,c.useStore)(e=>e.menu),n=h(e=>e.links),s=(0,S.useCardStore)(e=>e.cards),r=(0,d.useShellStore)(t=>t.items[e]);(0,d.useShellStore)(e=>e.events),(0,d.useShellStore)(t=>t.server[e]);const i=(r??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active})),o=p(e,t,n,s,i),l=O(e);return{dishes:o,counts:l,items:i,reason:e=>{const t=o.find(t=>t.id===e);return t?(0,u.dishReason)(t.name,(0,u.shortOf)(t.uses,l),l,i):''},links:n}};var e,t=_r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[1]),r=_r(_d[2]),u=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),S=_r(_d[9]),f=_r(_d[10]);const m=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},h=(0,s.create)()((0,r.persist)(e=>({links:[],setLink:(t,n,s,r)=>e(e=>{const u=e.links.filter(e=>!(e.rid===t&&e.itemId===n));return{links:[...u,{rid:t,itemId:n,uses:s?s.filter(e=>e.qty>0).slice(0,10):[],at:m().toISOString(),by:r.slice(0,80),...s?{}:{auto:!0}}]}})}),{name:'covercharge-soldout-links-v1',version:1,storage:(0,r.createJSONStorage)(()=>n.default)})),k=e=>!!e&&!0===e.auto,v={soldOutRead:new Set,linksRead:new Set};function b(e){return(d.useShellStore.getState().items[e]??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active}))}function p(e,t=c.useStore.getState().menu,n=h.getState().links,s=S.useCardStore.getState().cards,r=b(e)){const i=[];for(const o of t){if(o.restaurantId!==e||o.hidden)continue;const t=s.find(t=>t.restaurantId===e&&t.menuItemId===o.id),l=n.find(t=>t.rid===e&&t.itemId===o.id),c=(0,u.inferUses)(o,t,r),d=k(l)?c:(0,u.usesFor)(o,l,t,r);i.push({id:o.id,name:o.name,uses:d.uses,source:d.source,guess:c.uses})}return i}function O(e){return(0,d.venueCounts)(d.useShellStore.getState(),e)}function I(e){const t={};for(const n of d.useShellStore.getState().events)n.rid===e&&(!t[n.kind]||n.at>t[n.kind])&&(t[n.kind]=n.at);return t}function y(e=m()){const t=c.useStore.getState();let n=0;for(const s of t.restaurants){const t=s.id;if((0,o.liveData)()&&(!d.useShellStore.getState().server[t]||!v.soldOutRead.has(t)||!v.linksRead.has(t)))continue;const r=(0,i.soldOutSettingsOf)(s.settings?.soldOut).auto,l=p(t),c=(0,u.planAuto)({rid:t,enabled:r,dishes:l,counts:O(t),entries:f.useSoldOut.getState().entries,lastChange:I(t),now:e});if(!c.mark.length&&!c.clear.length)continue;const S=e.toISOString();f.useSoldOut.setState(e=>{const n=new Set(c.clear),s=new Map(c.mark.map(e=>[e.itemId,e.name])),r=e.entries.filter(e=>!(e.rid===t&&s.has(e.itemId))).map(e=>e.rid===t&&n.has(e.itemId)?{...e,on:!1,at:S,by:'Count back up',kept:!1,clearAfter:void 0}:e);return{entries:[...r,...c.mark.map(e=>({rid:t,itemId:e.itemId,name:e.name.slice(0,120),on:!0,at:S,by:'Live count',auto:!0,kept:!1}))]}}),n+=c.mark.length+c.clear.length}return n}let w=null;l.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchCounts=e=>{const t=c.useStore.getState().restaurants[0]?.id;if(!t)return;const n=O(t),s=m().toISOString(),r=Object.entries(e).filter(([e,t])=>(n[e]??0)!==t).map(([e,r],u)=>({id:`pitch-count-${Date.now()}-${u}`,rid:t,kind:e,delta:r-(n[e]??0),reason:'count',by:'Chef',app:'chef',at:s}));return r.length&&d.useShellStore.setState(e=>({events:[...e.events,...r]})),y()})},982,[1190,995,1191,983,984,1218,2,881,1086,1168,942]); +__d(function(_g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.parseQty=i,_e.inferUses=u,_e.usesFor=function(e,t,n,o){const s=new Set(o.filter(e=>!1!==e.active).map(e=>e.key));return t?{uses:t.uses.filter(e=>s.has(e.key)&&e.qty>0),source:t.uses.length?'link':'none'}:u(e,n,o)},_e.shortOf=c,_e.shortReason=f,_e.dishReason=function(e,t,n,o){if(!t.length)return'';const i=e.replace(/\([^)]*\)/g,'').trim(),a=e=>{const t=o.find(t=>t.key===e);return!!t&&new RegExp(`\\b(${s(t)})$`,'i').test(i)},l=t.filter(e=>!a(e.key));return l.length?f(l,n,o):t.some(e=>(n[e.key]??0)>0)?'not enough left':'none left'},Object.defineProperty(_e,"withReason",{enumerable:!0,get:function(){return h}}),_e.usesText=function(e,t){return e.length?e.map(e=>{const n=t.find(t=>t.key===e.key),o=(n?.name??e.key).toLowerCase(),s=(n?.plural??`${o}s`).toLowerCase();return`${.5===e.qty?'\xbd':Number.isInteger(e.qty)?String(e.qty):`${Math.floor(e.qty)}\xbd`} ${e.qty>1?s:o}`}).join(', '):'Not linked to the counts'},_e.planAuto=function(e){const{rid:t,enabled:n,dishes:o,counts:s,entries:i,lastChange:a,now:l}=e,u={mark:[],clear:[]},f=new Map(i.filter(e=>e.rid===t).map(e=>[e.itemId,e])),h=l.getTime(),m=e=>e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>h),d=new Set;for(const e of o){d.add(e.id);const t=f.get(e.id),o=n?c(e.uses,s):[];if(o.length){if(t&&m(t))continue;if(t&&t.kept){const e=o.map(e=>a[e.key]??'').sort().pop()??'';if(!e||e<=t.at)continue}u.mark.push({itemId:e.id,name:e.name})}else t&&t.auto&&m(t)&&u.clear.push(e.id)}for(const e of f.values())e.auto&&m(e)&&!d.has(e.itemId)&&u.clear.push(e.itemId);return u};const e='meat|bisque|stock|cakes?|claws?|sauce|butter|oil|paste|salad|mayo|mayonnaise|thermidor|tails?|bon|croquettes?|p\xe2t\xe9|pate|rolls?|soup|linguine|ravioli',t=/^(g|kg|gram|grams|ml|l|litre|litres|oz|lb|lbs|cl)$/i,n={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,half:.5,'\xbd':.5},o=e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&'),s=e=>{const t=new Set([e.name,e.plural].map(e=>e.trim().toLowerCase()).filter(Boolean));for(const e of[...t])e.endsWith('s')?t.add(e.slice(0,-1)):t.add(e+'s');return[...t].sort((e,t)=>t.length-e.length).map(o).join('|')};function i(e){const t=(e||'').trim().toLowerCase();if(!t)return 1;if(/^\xbd$|^half\b/.test(t))return.5;const o=t.match(/^(\d+(?:\.\d+)?)\s*(\xbd)?/);if(o)return Number(o[1])+(o[2]?.5:0);const s=t.split(/\s+/)[0];return n[s]??1}const a=(e,t)=>'half'===e.unit?Math.max(.5,Math.round(2*t)/2):Math.max(1,Math.round(t)),l=e=>(e.optionGroups??[]).some(e=>e.choices.some(e=>/\bhalf\b/i.test(e.label)));function u(n,o,u){const c=u.filter(e=>!1!==e.active&&'kg'!==e.unit),f=(e,t)=>({source:e,uses:t.map(t=>{const o=c.find(e=>e.key===t.key),s='half'===o.unit&&l(n)&&'description'!==e?.5:t.qty;return{key:t.key,qty:a(o,s)}})});if(o){const e=[];for(const n of c){const a=new RegExp(`\\b(${s(n)})\\b`,'i'),l=o.ingredients.find(e=>a.test(e.name)&&!t.test((e.unit||'').trim())&&!/\b(meat|stock|bisque|oil|butter|paste)\b/i.test(e.name));l&&e.push({key:n.key,qty:i(`${l.qty} ${l.unit}`)})}if(e.length)return f('card',e)}const h=n.description??'';{const t=[];for(const n of c){const o=new RegExp(`\\b(half an?|a|an|one|two|three|four|five|six|\\d+(?:\\.\\d+)?|\xbd)\\s+(?:(?:whole|fresh|live|dressed|local)\\s+)?(?:[A-Za-z'\u2019-]+\\s+){0,2}?(${s(n)})\\b(?!\\s+(?:${e}))`,'i'),a=h.match(o);a&&t.push({key:n.key,qty:i(a[1])})}if(t.length)return f('description',t)}{const e=n.name.replace(/\([^)]*\)/g,'').trim(),t=[];for(const n of c)new RegExp(`\\b(${s(n)})$`,'i').test(e)&&t.push({key:n.key,qty:1});if(t.length)return f('name',t)}return{uses:[],source:'none'}}function c(e,t){return e.filter(e=>(t[e.key]??0)(n.find(t=>t.key===e)?.name??e).toLowerCase(),s=e.filter(e=>(t[e.key]??0)<=0).map(e=>o(e.key)),i=e.filter(e=>(t[e.key]??0)>0).map(e=>o(e.key)),a=e=>e.length<=2?e.join(' or '):`${e.slice(0,-1).join(', ')} or ${e[e.length-1]}`;return[s.length?`no ${a(s)}`:'',i.length?`not enough ${a(i)}`:''].filter(Boolean).join(', ')}const h=(e,t)=>t?`${e.replace(/\s*\([^)]*\)\s*$/,'').trim()||e} (${t})`:e},983,[]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SOLD_OUT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOLD_OUT_CLEAR_LABEL",{enumerable:!0,get:function(){return t}}),_e.soldOutSettingsOf=function(t){const n='morning'===t?.clear||'manual'===t?.clear||'close'===t?.clear?t.clear:e.clear,o=/^([01]\d|2[0-3]):[0-5]\d$/.test(t?.morningAt??'')?t.morningAt:e.morningAt;return{clear:n,morningAt:o,auto:!1!==t?.auto}},_e.clearAfterFor=function(e,t,o){if('manual'===t.clear)return;const c=(()=>{const o=n(e,t.morningAt);return ee.getTime()?o:c},_e.activeSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>o)).sort((e,t)=>t.at.localeCompare(e.at)||e.name.localeCompare(t.name))},_e.expiredSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&!!e.clearAfter&&new Date(e.clearAfter).getTime()<=o)},_e.stripText=o,_e.stripNeedsTicker=function(e,t,n){return o(e).length*n*.56>Math.max(0,t-150)},_e.soldOutCount=function(e){return 1===e?'1 dish sold out':`${e} dishes sold out`};const e={clear:'close',morningAt:'05:00',auto:!0},t={close:'When the kitchen closes',morning:'Next morning',manual:'Only when someone taps Back on'};const n=(e,t,n=0)=>{const[o,c]=t.split(':').map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+n,o,c,0,0)};function o(e){return e.join(' \xb7 ')}},984,[]); +__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(0,n.sha256HexSync)(`cc-wake:${i}:${t}`),o={pinHash:a(t,i),pinSalt:i,pinLen:4,pinDefault:!0};function u(){const n=globalThis.crypto,t=new Uint8Array(12);if(n?.getRandomValues)n.getRandomValues(t);else for(let n=0;nn.toString(16).padStart(2,'0')).join('')}const l=(n,t)=>a(t,n.pinSalt)===n.pinHash},986,[1278]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAVER_DEFAULT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IDLE_OPTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SAVER_STYLES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_SAVER_PHOTOS",{enumerable:!0,get:function(){return r}}),e.saverFromRow=function(o){return o?{on:!1!==o.is_on,idleMins:l(o.idle_mins)?Number(o.idle_mins):2,style:s(o.style)?o.style:'logo',photos:Array.isArray(o.photos)?o.photos.filter(o=>'string'==typeof o).slice(0,r):[],dimOn:!!o.dim_on,dimFrom:a(o.dim_from)?String(o.dim_from).slice(0,5):'23:00',dimTo:a(o.dim_to)?String(o.dim_to).slice(0,5):'07:00',logo:'string'==typeof o.logo_path&&o.logo_path?o.logo_path:null}:null},Object.defineProperty(e,"saverToRow",{enumerable:!0,get:function(){return u}}),e.dimNow=function(o,n){if(!o.dimOn)return!1;const t=60*n.getHours()+n.getMinutes(),r=c(o.dimFrom),l=c(o.dimTo);return r!==l&&(r=r&&t=r||t_?'That logo is over 2 MB. Please pick a smaller file.':n<=0?'That file is empty. Please pick another.':null:'Please pick a PNG, JPG or SVG logo.'},Object.defineProperty(e,"svgSafe",{enumerable:!0,get:function(){return y}});const o={on:!0,idleMins:2,style:'logo',photos:[],dimOn:!1,dimFrom:'23:00',dimTo:'07:00',logo:null},n=[{mins:2,label:'2 min'},{mins:5,label:'5 min'},{mins:10,label:'10 min'},{mins:15,label:'15 min'},{mins:30,label:'30 min'},{mins:0,label:'Never'}],t=[{id:'logo',label:'Logo',sub:'Your logo drifting slowly round the screen'},{id:'clock',label:'Clock & date',sub:'The time and today\u2019s date, large'},{id:'covers',label:'Today\u2019s covers',sub:'Covers and bookings today, and the next arrivals (no names)'},{id:'photos',label:'Photo slideshow',sub:'Your own photos, one at a time'},{id:'black',label:'Black',sub:'A black screen, saves the screen and power'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],r=30,l=o=>[0,2,5,10,15,30].includes(Number(o)),s=o=>t.some(n=>n.id===o),a=o=>'string'==typeof o&&/^([01][0-9]|2[0-3]):[0-5][0-9]/.test(o);const u=o=>({is_on:o.on,idle_mins:o.idleMins,style:o.style,photos:o.photos.slice(0,r),dim_on:o.dimOn,dim_from:o.dimFrom,dim_to:o.dimTo,logo_path:o.logo??null}),c=o=>60*Number(o.slice(0,2))+Number(o.slice(3,5));const b=(o,n)=>n.startsWith(`${o}/`)&&/^[0-9a-f-]{36}\/[A-Za-z0-9._-]{1,80}$/.test(n)&&!n.includes('..'),f=o=>o.dimOn?`Dimmed ${o.dimFrom}\u2013${o.dimTo}`:'No night dim',p={'image/png':'png','image/jpeg':'jpg','image/svg+xml':'svg'},_=2097152;const y=o=>/]/i.test(o)&&!/(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])},988,[819]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n.default}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=(t=e)&&t.__esModule?t:{default:t}},989,[1319]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,s,t){const l=(0,p.tableKey)(t),o=(0,g.tablesOf)(s.table);await h.repo.bookings.update(s.id,(0,y.tablePatch)(l||null)),'seated'===s.status&&s.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(s=>g.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0})),l&&(0,j.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:j=90,onClose:$,onSaved:w,onPickOnPlan:T,canClear:L=!0}){const S=(0,g.usePlan)(e),P=(0,h.useBookings)(e),[W,z]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),D=(0,l.useMemo)(()=>(0,p.pickGroups)(S),[S]),I=P.filter(e=>e.date===y.date),B=(0,p.seatsOf)(S,W),R=(0,p.seatLine)(B.total,y.partySize),O=(0,p.pickClashes)(y,W,I,j),M=e=>(0,p.pickClashes)(y,[e],I,j)[0]?.with,N=(0,p.tableKey)(W)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,m.useBlocks)(e=>e.blocks),A=(0,m.blockAt)(_,e,y.date,y.time),[F,G]=(0,l.useState)(null),Y=e=>{G(null),z(s=>(0,p.toggleTable)(s,e))},[K]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{K&&(0,c.announce)(`Tables can't be saved: ${K}.`)},[K]);const[E,H]=(0,l.useState)(!1),U=async s=>{(0,o.guardBookingChange)(w,{b:y,tables:s})?(H(!0),$(),await(0,o.saveTablesReported)(e,y,s,f,(0,p.seatsOf)(S,s).total,e=>w?.(e))):$()},V=(0,v.jsxs)(u.default,{style:{gap:8},children:[(0,v.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(W)} picked. ${R.text}.`,children:[(0,v.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(W)}),(0,v.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:R.text})]}),A?(0,v.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,v.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,O.length?(0,v.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(O)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,v.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(O)," You can still save."]})}):null,F?(0,v.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:F,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,v.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:F}),(0,v.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,v.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(W)} for ${f}, ${y.partySize} people`,disabled:E,onPress:()=>{U(W)},style:[C,{flexGrow:1}]}),(0,v.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>G(null),style:C})]})]}):null,(0,v.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[F?null:(0,v.jsx)(x.Button,{testID:"table-pick-save",label:E?'Saving\u2026':O.length?'Save anyway':'Save tables',disabled:!N||!W.length||E,accessibilityLabel:`${O.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(W)} for ${f}. ${R.text}.${O.length?` ${(0,p.clashWords)(O)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(w,{b:y,tables:W}))return void $();const e=(0,p.overCapacityAsk)(W,B.total,y.partySize);!e||F?U(W):G(e)},style:[C,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&L?(0,v.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:E,onPress:()=>U([]),style:C}):null,(0,v.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:C})]})]});return(0,v.jsxs)(x.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:V,children:[(0,v.jsx)(s.TableNumberWarning,{plan:S}),K?(0,v.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${K}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,v.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${K}.`})}):null,(0,v.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),T?(0,v.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>T(W),style:C}):null,D.map(e=>(0,v.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,v.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,v.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const s=W.includes(e.name),l=M(e.name);return(0,v.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:s},'aria-checked':s,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,s,l),onPress:()=>Y(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?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!s?'dashed':'solid',backgroundColor:s?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,v.jsx)(x.T,{size:18,weight:"semibold",colour:s?k.colours.onGold:k.colours.text,children:(0,t.tableNumbers)(e.name)}),(0,v.jsxs)(x.T,{size:14,colour:s?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),D.length?null:(0,v.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var s=r(d[0]),t=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),m=r(d[16]),v=r(d[17]);const C={minHeight:56}},990,[935,812,31,959,824,1421,264,128,823,829,1420,960,825,822,818,952,828,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})]})]})}},991,[31,128,823,829,1420,969,960,825,866,863,807,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"BOOKING_VIEW_ONLY",{enumerable:!0,get:function(){return n}}),e.isKitchenPorter=o,e.canChangeBookings=function(n){return!n||(!('owner'!==n.role&&'manager'!==n.role&&!n.ownerAccess&&!n.managerAccess)||('boolean'==typeof n.bookingWrite?n.bookingWrite:!o(n)))},Object.defineProperty(e,"BOOKING_CHANGE_ACTIONS",{enumerable:!0,get:function(){return t}});const n='View only. Ask a manager to change bookings.';function o(n){return!(!n||'staff'!==n.role)&&/porter|KP/i.test(n.job??'')}const t=new Set(['add_walkin','seat_booking','finish_booking','no_show','cancel_booking','move_booking','change_booking','decide_booking','block_table','waitlist_seat'])},992,[]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenBar=p,_e.NeedsPills=k,_e.BookingNeeds=x,Object.defineProperty(_e,"needsIcons",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"confirmHolds",{enumerable:!0,get:function(){return S}}),_e.serveHolds=y,_e.postNewBookingToKitchen=function(e,t){if(!t||'system'===t)return;const s=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),l=[],r=`${e.name}, ${(0,c.niceDate)((0,c.parseYmd)(e.date)).slice(0,3)} ${e.time}${e.table?`, table ${e.table}`:''}`;if((e.holds??[]).filter(e=>e.qty>0).length){const t=I(e.restaurantId);l.push(`${(0,u.holdsText)(e,(0,u.reservablesOf)(s),t)} reserved: ${r}. Tap Platter OK in the Head Chef app.`)}(0,u.hasAllergens)(e)&&l.push(`\u26a0\ufe0f Allergens: ${(0,u.allergenText)(e)} \u2014 ${r}. Please sign \u2018Allergens seen\u2019.`);if(!l.length)return;a.useOwner.getState().chatSend({ch:'kitchen',from:t,text:l.join('\n'),at:(new Date).toISOString()})},_e.useKitchenTodo=D,_e.KitchenSignoffs=function({rid:t,today:s,by:a,app:f,canConfirm:p=!0,showAll:k}){const j=D(t,s),I=(0,o.useBookings)(t),T=(0,o.useRestaurant)(t),O=(0,n.useStockItems)(t),$=(0,u.reservablesOf)(T),A=I.filter(e=>e.date===s&&!['cancelled','noshow'].includes(e.status)&&(e.holds??[]).some(e=>e.qty>0)),C=k?[...j,...A.filter(e=>!j.includes(e))]:j;return C.length?(0,b.jsxs)(l.default,{testID:"kitchen-signoffs",style:{gap:10,padding:16,borderRadius:16,borderWidth:1.5,borderColor:j.length?h.colours.amber:h.colours.hairline,backgroundColor:h.colours.surface},children:[(0,b.jsx)(r.T,{size:12,weight:"semibold",colour:j.length?h.colours.amber:h.colours.goldMuted,style:{letterSpacing:1.6},children:j.length?`KITCHEN SIGN-OFF NEEDED (${j.length})`:'RESERVED TODAY'}),C.map(t=>(0,b.jsxs)(l.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:h.colours.hairline},testID:`signoff-${t.ref}`,children:[(0,b.jsxs)(r.T,{weight:"semibold",children:[t.name," \xb7 ",t.partySize," Covers \xb7 ",t.date===s?'Today':(0,c.niceDate)((0,c.parseYmd)(t.date))," ",t.time,t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:'']}),(0,b.jsx)(x,{b:t}),p?(0,b.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,u.needsAllergenSeen)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"danger",label:"Allergens seen",testID:`allergens-seen-${t.ref}`,onPress:()=>o.useStore.getState().ackBookingAllergy(t.id,a)}):null,(0,u.needsHoldOk)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"success",label:/platter/i.test((0,u.holdsText)(t,$,O))?'Platter OK':'Reservation OK',testID:`platter-ok-${t.ref}`,onPress:()=>S(t.id,a)}):null,t.date===s&&t.holdOk&&(t.holds??[]).some(e=>!e.served)&&['seated','confirmed'].includes(t.status)?(0,b.jsx)(r.Button,{small:!0,kind:"secondary",label:"Served",testID:`served-${t.ref}`,onPress:()=>y(t,a,f)}):null]}):(0,b.jsx)(r.Muted,{children:"The kitchen signs these off."})]},t.id))]}):null},_e.PlattersBooked=function({rid:e,date:t,label:s}){const a=(0,o.useBookings)(e),c=(0,o.useRestaurant)(e),f=(0,n.useStockItems)(e),p=(0,u.heldSummary)(a,t,(0,u.reservablesOf)(c)),k=Object.entries(p.stock).filter(([,e])=>e>0).map(([e,t])=>`${t} ${(f.find(t=>t.key===e)?.name??e).toLowerCase()}`);return p.platters||k.length?(0,b.jsx)(l.default,{testID:"platters-booked",children:(0,b.jsxs)(r.T,{weight:"semibold",colour:h.colours.goldLight,children:[s??'Platters booked',": ",p.platters,k.length?` (${k.join(', ')})`:'']})}):null};var e=_r(d[0]);_r(d[1]);var t,s=_r(d[2]),l=(t=s)&&t.__esModule?t:{default:t},r=_r(d[3]),o=_r(d[4]),n=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);const f=({label:e,bg:t,fg:s,border:o,testID:n})=>(0,b.jsx)(l.default,{testID:n,style:{backgroundColor:t,borderColor:o,borderWidth:1,borderRadius:999,paddingHorizontal:9,paddingVertical:2},children:(0,b.jsx)(r.T,{size:13,weight:"semibold",colour:s,children:e})});function p({b:e,big:t}){return(0,u.hasAllergens)(e)?(0,b.jsxs)(l.default,{testID:`allergen-bar-${e.ref}`,style:{backgroundColor:h.colours.redSolid,borderRadius:10,paddingHorizontal:10,paddingVertical:t?8:5,gap:2},children:[(0,b.jsxs)(r.T,{size:t?16:13,weight:"bold",colour:"#FFFFFF",children:["\u26a0\ufe0f ALLERGENS: ",(0,u.allergenText)(e)]}),e.allergyAck?(0,b.jsxs)(r.T,{size:12,colour:"#FFE3DF",children:["Seen by kitchen: ",e.allergyAck.by]}):(0,b.jsx)(r.T,{size:12,colour:"#FFE3DF",children:"Kitchen hasn\u2019t signed \u2018Allergens seen\u2019 yet"})]}):null}function k({b:t,r:s}){const l=(0,n.useStockItems)(t.restaurantId),o=(0,u.reservablesOf)(s),a=(t.holds??[]).some(e=>e.qty>0),c=[];return t.drinksOnly&&c.push((0,b.jsx)(f,{testID:"pill-drinks",label:"\ud83c\udf77 Drinks only (after last food orders)",bg:h.colours.surface2,fg:h.colours.goldLight,border:h.colours.accentBorder},"x")),(0,u.hasAccess)(t)&&c.push((0,b.jsx)(f,{testID:"pill-access",label:`\u267f ${(0,u.accessText)(t)}`,bg:h.colours.blueBg,fg:"#E2C489",border:h.colours.blue},"a")),(0,u.dogCount)(t)&&c.push((0,b.jsx)(f,{testID:"pill-dog",label:"\ud83d\udc15 "+((0,u.dogCount)(t)>1?`${(0,u.dogCount)(t)} dogs`:'Dog'),bg:h.colours.surface2,fg:h.colours.text,border:h.colours.hairline},"d")),(0,u.dietText)(t)&&c.push((0,b.jsx)(f,{testID:"pill-veg",label:`\u24cb ${(0,u.dietText)(t)}`,bg:"#2A2216",fg:"#E2C489",border:"#CFA45F"},"v")),a&&c.push(t.holdOk?(0,b.jsx)(f,{testID:"pill-platter",label:`\u2713 ${(0,u.holdsText)(t,o,l)} \xb7 confirmed`,bg:h.colours.okBg,fg:"#E2C489",border:h.colours.ok},"h"):(0,b.jsx)(f,{testID:"pill-platter",label:`\ud83e\udd9e ${(0,u.holdsText)(t,o,l)} \xb7 awaiting kitchen`,bg:h.colours.amberBg,fg:"#FFE2A8",border:h.colours.amber},"h")),t.tableReq?.length&&c.push((0,b.jsx)(f,{testID:"pill-request",label:`Requested: ${t.tableReq.map(t=>`${(0,e.tableNumbers)(t)}`).join(' or ')}`,bg:h.colours.goldTint,fg:h.colours.goldLight,border:h.colours.accentBorder},"t")),c.length?(0,b.jsx)(r.Row,{wrap:!0,gap:6,children:c}):null}function x({b:e,big:t}){const s=(0,o.useRestaurant)(e.restaurantId);return(0,b.jsxs)(l.default,{style:{gap:6},children:[(0,b.jsx)(p,{b:e,big:t}),(0,b.jsx)(k,{b:e,r:s})]})}const j=e=>[(0,u.hasAllergens)(e)?'\u26a0\ufe0f':'',(0,u.hasAccess)(e)?'\u267f':'',(0,u.dogCount)(e)?'\ud83d\udc15':'',(0,u.dietText)(e)?'\u24cb':'',(e.holds??[]).some(e=>e.qty>0)?e.holdOk?'\ud83e\udd9e\u2713':'\ud83e\udd9e':''].filter(Boolean).join(' '),S=(e,t)=>o.useStore.getState().updateBooking(e,{holdOk:{by:t,at:(new Date).toISOString()}});function y(e,t,s){const l=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),r=(0,u.stockNeed)(e,(0,u.reservablesOf)(l));for(const[l,o]of Object.entries(r))o>0&&n.shellfish.append({rid:e.restaurantId,kind:l,delta:-o,reason:'sold',by:t,app:s});const a=(new Date).toISOString();o.useStore.getState().updateBooking(e.id,{holds:(e.holds??[]).map(e=>e.served?e:{...e,served:{by:t,at:a}})})}const I=e=>n.useShellStore.getState().items[e]??[];function D(e,t){return(0,o.useBookings)(e).filter(e=>e.date>=t&&!e.walkIn&&((0,u.needsAllergenSeen)(e)||(0,u.needsHoldOk)(e))).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time))}},993,[812,31,128,818,823,1086,863,832,822,825,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},994,[31,128,14,825,818,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})},995,[1205,1206]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function i(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_AVATARS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"AVATAR_BGS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"AVATAR_RINGS",{enumerable:!0,get:function(){return j}}),_e.specFor=E,_e.AvatarArt=$,_e.AvatarLook=v,_e.useStaffMember=M,_e.StaffAvatar=function({id:i,name:t,size:s=34,ring:c=!0}){const f=M(i,t),h=f?.id??i,u=(0,n.useAvatars)(i=>h?i.photos[h]:void 0),F=(0,o.useSetup)(i=>h?i.looks[h]:void 0),j=`${(f?.name??t??'Team member').replace(' (example)','')}'s avatar`;return(0,y.jsx)(r.default,{testID:h?`avatar-${h}`:'avatar',accessibilityLabel:j,accessibilityRole:"image",style:{width:s,height:s,borderRadius:s/2,overflow:'hidden',borderWidth:c?Math.max(1,s/22):0,borderColor:x.colours.gold,backgroundColor:(0,e.soutersSurface)('#111')},children:u?(0,y.jsx)(l.default,{source:{uri:u.dataUrl},style:{width:'100%',height:'100%'},accessibilityIgnoresInvertColors:!0}):(0,y.jsx)(v,{look:F,id:h,name:f?.name??t,size:s-(c?2*Math.max(1,s/22):0)})})};var e=_r(d[0]);_r(d[1]);var l=i(_r(d[2])),r=i(_r(d[3])),t=_r(d[4]),s=i(t),c=_r(d[5]),n=_r(d[6]),o=_r(d[7]),x=_r(d[8]),f=_r(d[9]),h=_r(d[10]),y=_r(d[11]);const u=Object.fromEntries(h.ROSTER.map(i=>[i.id,i.avatar])),F=['#2A2520','#B89A72','#D9A441','#4A3F35','#3A3029','#8A6A3B'],j=['#E9B949','#CFA45F'],C=F,p=['#F1C7A5','#E8B48F','#C68B5E','#8D5B3E','#F4D2B8','#A86B45'],A=['#2B1B12','#7A4E2A','#151515','#C2462E','#D9B26A'],b=['quiff','flip','crop','beehive','bob','curls'],k=i=>{let e=7;for(const l of i)e=31*e+l.charCodeAt(0)>>>0;return e};function E(i,e){if(i&&u[i])return u[i];const l=k(i||e||'crew');return{bg:C[l%6],ring:j[l%2],skin:p[(l>>3)%6],hair:A[(l>>6)%5],hairStyle:b[(l>>9)%6],suit:'#F2EAD8',antenna:['ball','star','none'][(l>>12)%3]}}const O=(i,e,l)=>`M${i} ${e-l} Q${i+.18*l} ${e-.18*l} ${i+l} ${e} Q${i+.18*l} ${e+.18*l} ${i} ${e+l} Q${i-.18*l} ${e+.18*l} ${i-l} ${e} Q${i-.18*l} ${e-.18*l} ${i} ${e-l}Z`;function $({spec:i,size:e=40}){const l=i,r='#1B1B1B',c='flip'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M29 50 C26 30 40 22 50 22 C60 22 74 30 71 50 C75 56 79 60 76 65 C72 60 69 58 66 57 L34 57 C31 58 28 60 24 65 C21 60 25 56 29 50Z",fill:l.hair}):'bob'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M30 58 C27 32 40 24 50 24 C60 24 73 32 70 58 L66 60 L34 60Z",fill:l.hair}):'beehive'===l.hairStyle?(0,y.jsxs)(t.G,{children:[(0,y.jsx)(t.Ellipse,{cx:50,cy:25,rx:15,ry:14,fill:l.hair}),(0,y.jsx)(t.Path,{d:"M31 54 C28 34 40 27 50 27 C60 27 72 34 69 54 Z",fill:l.hair})]}):'curls'===l.hairStyle?(0,y.jsx)(t.G,{children:[[34,34],[40,27],[50,24],[60,27],[66,34],[69,43],[31,43]].map(([i,e],r)=>(0,y.jsx)(t.Circle,{cx:i,cy:e,r:7,fill:l.hair},r))}):null,n='quiff'===l.hairStyle?(0,y.jsxs)(t.G,{children:[(0,y.jsx)(t.Path,{d:"M32 42 C31 27 43 23 51 25 C61 22 70 30 68 42 C63 35 57 33 50 34 C43 34 37 37 32 42Z",fill:l.hair}),(0,y.jsx)(t.Path,{d:"M46 26 C51 14 66 14 66 23 C61 20 54 21 50 28Z",fill:l.hair})]}):'crop'===l.hairStyle?(0,y.jsx)(t.Path,{d:"M32 42 C31 28 42 25 50 25 C58 25 69 28 68 42 C64 36 58 33 50 33 C42 33 36 36 32 42Z",fill:l.hair}):'curls'===l.hairStyle?null:(0,y.jsx)(t.Path,{d:"M32 43 C33 30 42 27 50 27 C58 27 67 30 68 43 C61 38 57 33 51 33 C47 37 39 41 32 43Z",fill:l.hair});return(0,y.jsxs)(s.default,{width:e,height:e,viewBox:"0 0 100 100",children:[(0,y.jsx)(t.Circle,{cx:50,cy:50,r:50,fill:l.bg}),(0,y.jsx)(t.Ellipse,{cx:50,cy:50,rx:46,ry:13,fill:"none",stroke:"#FFF4E0",strokeOpacity:.28,strokeWidth:1.6,transform:"rotate(-28 50 50)"}),(0,y.jsx)(t.Path,{d:O(16,24,6),fill:"#FFF4E0",fillOpacity:.85}),(0,y.jsx)(t.Path,{d:O(84,34,4),fill:"#FFF4E0",fillOpacity:.7}),(0,y.jsx)(t.Circle,{cx:80,cy:16,r:1.6,fill:"#FFF4E0",fillOpacity:.8}),(0,y.jsx)(t.Circle,{cx:22,cy:70,r:1.3,fill:"#FFF4E0",fillOpacity:.6}),(0,y.jsx)(t.Path,{d:"M12 100 C14 82 31 74 50 74 C69 74 86 82 88 100 Z",fill:l.suit}),(0,y.jsx)(t.Path,{d:"M36 100 L40 84 L50 90 L60 84 L64 100Z",fill:l.ring,fillOpacity:.35}),(0,y.jsx)(t.Rect,{x:44,y:60,width:12,height:12,fill:l.skin}),c,(0,y.jsx)(t.Ellipse,{cx:50,cy:46,rx:17,ry:18.5,fill:l.skin}),n,l.specs?(0,y.jsxs)(t.G,{stroke:r,strokeWidth:1.6,fill:"#FFFFFF",fillOpacity:.25,children:[(0,y.jsx)(t.Rect,{x:37,y:42,width:11,height:8,rx:4}),(0,y.jsx)(t.Rect,{x:52,y:42,width:11,height:8,rx:4}),(0,y.jsx)(t.Line,{x1:48,y1:45,x2:52,y2:45})]}):null,(0,y.jsx)(t.Ellipse,{cx:42.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,y.jsx)(t.Ellipse,{cx:57.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,y.jsx)(t.Circle,{cx:43.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,y.jsx)(t.Circle,{cx:58.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,y.jsx)(t.Circle,{cx:38,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,y.jsx)(t.Circle,{cx:62,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,y.jsx)(t.Path,{d:"M44.5 55 Q50 60 55.5 55",stroke:r,strokeWidth:1.8,fill:"none",strokeLinecap:"round"}),(0,y.jsx)(t.Ellipse,{cx:50,cy:74,rx:21,ry:5.5,fill:l.ring}),(0,y.jsx)(t.Ellipse,{cx:50,cy:73,rx:16,ry:3,fill:"#000000",fillOpacity:.18}),(0,y.jsx)(t.Circle,{cx:50,cy:88,r:4,fill:l.ring}),(0,y.jsx)(t.Circle,{cx:50,cy:88,r:1.6,fill:l.bg}),(0,y.jsx)(t.Circle,{cx:50,cy:45,r:29,fill:"#FFF4E0",fillOpacity:.1,stroke:"#FFF4E0",strokeOpacity:.85,strokeWidth:2}),(0,y.jsx)(t.Path,{d:"M29 36 A23 23 0 0 1 41 22",stroke:"#FFFFFF",strokeOpacity:.85,strokeWidth:3.2,fill:"none",strokeLinecap:"round"}),(0,y.jsx)(t.Circle,{cx:28.5,cy:42,r:1.5,fill:"#FFFFFF",fillOpacity:.85}),'none'!==l.antenna?(0,y.jsx)(t.Line,{x1:50,y1:16,x2:50,y2:8,stroke:l.ring,strokeWidth:2}):null,'ball'===l.antenna?(0,y.jsx)(t.Circle,{cx:50,cy:6.5,r:3.3,fill:l.ring}):'star'===l.antenna?(0,y.jsx)(t.Path,{d:O(50,6.5,4.5),fill:l.ring}):null]})}function v({look:i,id:e,name:r,size:t=40}){const s=null!=i&&i>=1e3?f.AVATAR_OPTIONS.find(e=>e.look===i):void 0;return s?(0,y.jsx)(l.default,{source:{uri:s.dataUrl},style:{width:t,height:t},accessibilityLabel:s.name}):(0,y.jsx)($,{spec:null!=i?E(`${e??r}#look${i}`):E(e,r),size:t})}const P=i=>(i??'').replace(' (example)','').trim().toLowerCase();function M(i,e){const l=(0,c.useOwner)(i=>i.staff);return i?l.find(e=>e.id===i):e?l.find(i=>P(i.name)===P(e)):void 0}},996,[876,31,197,128,989,863,1225,1096,825,1384,15,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"notifSeedId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"headChefId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"gmId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"seedsFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useNotifs",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),p=r(d[5]),f=r(d[6]),c=r(d[7]);const l=(e,t)=>(0,o.uuidFrom)(`sched-notif:${t}:${e}`),S=()=>p.ROSTER.find(e=>'Head Chef'===e.level)?.id??p.ROSTER.find(e=>'chef'===e.app)?.id??'',b=()=>p.ROSTER.find(e=>'Manager'===e.level)?.id??'',h=e=>'anchorage'===e?(0,u.anchorageSeeds)(t=>l(e,t),S(),b()):[],O=()=>(new Date).toISOString(),v=(0,s.create)()((0,n.persist)((e,t)=>({items:[],snooze:{},ensure:i=>{const s=t().items,n=s.map(e=>(0,c.fixSupplierNames)(e.title)!==e.title||(0,c.fixSupplierNames)(e.message)!==e.message?{...e,title:(0,c.fixSupplierNames)(e.title),message:(0,c.fixSupplierNames)(e.message),updatedAt:O()}:e);n.some((e,t)=>e!==s[t])&&e({items:n});const o=new Set(t().items.map(e=>e.id)),u=h(i).filter(e=>!o.has(e.id)).map(e=>({...e,rid:i}));u.length&&e(e=>({items:[...e.items,...u]}))},add:(t,i)=>{const s=(0,f.uuid)();return e(e=>({items:[...e.items,{...i,id:s,rid:t,updatedAt:O()}]})),s},update:(t,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...i,updatedAt:O()}:e)})),remove:t=>e(e=>({items:e.items.flatMap(e=>e.id!==t?[e]:e.seed?[{...e,removed:!0,paused:!0,updatedAt:O()}]:[])})),resetSeeds:t=>{const i=new Map(h(t).map(e=>[e.id,e]));e(e=>{const s=e.items.map(e=>i.has(e.id)?{...i.get(e.id),rid:t,updatedAt:O()}:e),n=new Set(s.map(e=>e.id));return{items:[...s,...[...i.values()].filter(e=>!n.has(e.id)).map(e=>({...e,rid:t,updatedAt:O()}))]}})},setSnooze:(t,i)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[t,i]])}))}),{name:'covercharge-sched-notifs-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)}))},997,[1190,995,1191,1179,999,15,1099,1292]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"chairsId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rulesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useReminders",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"rulesOf",{enumerable:!0,get:function(){return A}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},n=_r(d[1]),s=_r(d[2]),u=_r(d[3]),o=_r(d[4]),l=_r(d[5]);const c=e=>(0,u.uuidFrom)(`reminder:chairs:${e}`),p=e=>(0,u.uuidFrom)(`break-rules:${e}`),f=()=>(new Date).toISOString(),b=(0,n.create)()((0,s.persist)((e,r)=>({reminders:[],rules:{},done:[],snooze:{},ensure:t=>{const n=r(),s={};n.reminders.some(e=>e.id===c(t))||(s.reminders=[...n.reminders,{...(0,o.defaultChairs)(c(t),t),rid:t}]),n.rules[t]||(s.rules={...n.rules,[t]:{...o.DEFAULT_BREAK_RULES,id:p(t)}}),Object.keys(s).length&&e(s)},add:(r,t)=>{const n=(0,l.uuid)();return e(e=>({reminders:[...e.reminders,{...t,id:n,rid:r,updatedAt:f()}]})),n},update:(r,t)=>e(e=>({reminders:e.reminders.map(e=>e.id===r?{...e,...t,updatedAt:f()}:e)})),remove:r=>e(e=>({reminders:e.reminders.flatMap(e=>e.id!==r?[e]:e.builtIn?[{...e,removed:!0,paused:!0,updatedAt:f()}]:[])})),resetReminder:r=>e(e=>({reminders:e.reminders.map(e=>e.id===r&&'chairs'===e.builtIn?{...(0,o.defaultChairs)(r,e.rid),rid:e.rid,updatedAt:f()}:e)})),setRules:(r,t)=>e(e=>({rules:{...e.rules,[r]:{...(0,o.clampRules)({...e.rules[r]??o.DEFAULT_BREAK_RULES,...t}),id:p(r),updatedAt:f()}}})),resetRules:r=>e(e=>({rules:{...e.rules,[r]:{...o.DEFAULT_BREAK_RULES,id:p(r),updatedAt:f()}}})),markDone:r=>e(e=>({done:[{...r,id:(0,l.uuid)(),at:r.at??f()},...e.done].slice(0,400)})),setSnooze:(r,t)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[r,t]])}))}),{name:'covercharge-reminders-v1',version:1,storage:(0,s.createJSONStorage)(()=>t.default)})),A=e=>(0,o.clampRules)(b.getState().rules[e]??o.DEFAULT_BREAK_RULES)},998,[1190,995,1191,1179,1183,1099]); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_FILTER_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOTIF_DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOTIF_GROUP_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"IN_APP_WINDOW_MINS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PUSH_WINDOW_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KITCHEN_OPEN_DAYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"TITLE_MAX",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MESSAGE_MAX",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validHm",{enumerable:!0,get:function(){return u}}),e.ukNow=p,Object.defineProperty(e,"timeOn",{enumerable:!0,get:function(){return m}}),e.notifDue=function(t,n,r=s){const o=p(n),d=m(t,o.dow);if(t.paused||t.removed||!u(d)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd,at:d};const f=l(d);return{due:o.mins>=f&&o.minst.days.includes(n));if(!r.length)return'No days ticked';const s=new Map;for(const n of r){const r=m(t,n);s.set(r,[...s.get(r)??[],n])}const o=t=>7===t.length?'Every day':t.map(t=>n[t]).join(', ');return[...s.entries()].map(([t,n])=>`${o(n)} at ${t}`).join('; ')+' (UK time)'},e.validateNotif=function(t){if(!t.title.trim())return'Give it a name.';if(t.title.length>f)return`Keep the name under ${f} letters.`;if(!t.message.trim())return'Type the message people will see.';if(t.message.length>c)return`Keep the message under ${c} letters.`;if(!u(t.time))return'Type the time as HH:MM, e.g. 21:00.';for(const n of Object.values(t.dayTimes??{}))if(!u(n))return'Type each day\u2019s time as HH:MM.';return t.days.length?t.recipients.staff.length||t.recipients.groups.length||(t.recipients.onShiftIn??[]).length?t.sendBy.inApp||t.sendBy.push?null:'Choose how to send it.':'Tick at least one person or group.':'Tick at least one day.'},e.anchorageSeeds=function(t,n,r){const s={staff:[n,r].filter(Boolean),groups:[]},o={inApp:!0,push:!0};return[{id:t('mills-milk'),seed:'mills-milk',title:'Mills milk order',message:'Make sure an order before 9:30',days:[...d],time:'21:00',dayTimes:{5:'20:55',0:'20:55'},recipients:s,sendBy:o},{id:t('peronis'),seed:'peronis',title:"Pieroni's order",message:"order Pieroni's by phone",days:[...d],time:'21:05',recipients:s,sendBy:o},{id:t('veg-second'),seed:'veg-second',title:'Veg order',message:'Order veg on the app before 11 PM',days:[...d],time:'21:15',recipients:s,sendBy:o},{id:t('reeds'),seed:'reeds',title:'Reids order',message:'Order Reids',days:[3,4],time:'21:25',recipients:s,sendBy:o},{id:t('spezbona'),seed:'spezbona',title:'Spes Bona order',message:'Do we need anything from Spes Bona for this week? Message Anna if we do for Friday delivery.',days:[3],time:'15:00',recipients:s,sendBy:o},{id:t('olsens'),seed:'olsens',title:"Olsen's order",message:"Place Olsen's order before 3:30 PM. By phone.",days:[2],time:'13:00',recipients:{staff:[r],groups:[]},sendBy:o},{id:t('allsons-list'),seed:'allsons-list',title:'Alsons drinks list',message:'Add anything extra to the Alsons drinks list.',days:[0],time:'20:00',recipients:{staff:['st-finn'],groups:[]},sendBy:o,open:{page:'orderlists',list:'allsons'}},{id:t('tea-towels'),seed:'tea-towels',title:'Tea towels',message:'Put a load of tea towels on to wash.',days:[...d],time:'15:00',recipients:{staff:[],groups:[],onShiftIn:['kp'],fallback:{staff:[],groups:['head_chef']}},sendBy:o},{id:t('rota-upload'),seed:'rota-upload',title:'Rota upload',message:"Make sure you have uploaded next week's rota.",days:[0],time:'20:50',recipients:s,sendBy:o}]};const t={kitchen:'On shift: Kitchen',foh:'On shift: Front of house',bar:'On shift: Bar',kp:'On shift: KPs',chefs:'On shift: Chefs'},n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],r={on_shift:'Everyone on shift',everyone:'Everyone',managers:'Owners and managers',head_chef:'Head Chef',kitchen:'Kitchen team',foh:'Front of house'},s=120,o=15,d=[3,4,5,6,0],f=60,c=160,u=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t),l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));function p(t){const r='number'==typeof t?new Date(t):t,s={};for(const t of new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(r))s[t.type]=t.value;return{dow:n.indexOf(String(s.weekday).slice(0,3)),mins:60*Number(s.hour)+Number(s.minute),ymd:`${s.year}-${s.month}-${s.day}`}}const m=(t,n)=>{const r=t.dayTimes?.[String(n)];return r&&u(r)?r:t.time};const h=t=>t.open?`./?open=${t.open.page}${t.open.list?`&list=${encodeURIComponent(t.open.list)}`:''}`:'./',y=(t,n)=>`${t.id}:${n}`,g=t=>(t??'').toLowerCase(),b=t=>t.level?['owner','manager'].includes(g(t.level)):['owner','manager'].includes(g(t.role)),O=t=>'head_chef'===g(t.role)||'head chef'===g(t.level)||'chef'===g(t.app)||/head chef/.test(g(t.job)),P=t=>'kitchen'===g(t.department)||/chef|kitchen|kp|porter/.test(g(t.job))||O(t),k=t=>/\bkp\b|kitchen porter/.test(g(t.job));function j(t,n){const r=g(n.department);return'kitchen'===t?P(n):'kp'===t?k(n):'chefs'===t?O(n)||/chef|commis/.test(g(n.job)):'bar'===t?'bar'===r||/\bbar/.test(g(n.job)):'front of house'===r||!r&&!P(n)&&!b(n)}function _(t,n,r=[]){const s=v(t.recipients,n,r),o=t.recipients.fallback;return s.length||!o?s:v({staff:o.staff,groups:o.groups},n,r)}const w=(t,n,r=[])=>!!t.recipients.fallback&&!v(t.recipients,n,r).length;function v(t,n,r){const s=t,o=n.filter(t=>!1!==t.active),d=new Set;for(const t of s.staff)o.some(n=>n.id===t)&&d.add(t);for(const t of s.groups)for(const n of o)('everyone'===t||'on_shift'===t&&r.includes(n.id)||'managers'===t&&b(n)||'head_chef'===t&&O(n)||'kitchen'===t&&P(n)||'foh'===t&&!P(n)&&!b(n))&&d.add(n.id);for(const t of s.onShiftIn??[])for(const n of o)r.includes(n.id)&&j(t,n)&&d.add(n.id);return[...d].sort()}const M=t=>({id:t.external_ref,role:t.roles?.key??void 0,job:t.job_title??'',department:t.department??'',active:!1!==t.active}),T=(t,n,r,s=[])=>_(t,r,s).includes(n)},999,[]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shiftNow=k,e.useShiftReminders=function({rid:c,staffId:u,name:h,kitchen:b,onStartBreak:S}){const D=(0,t.useRef)(S);D.current=S;const v=(0,t.useRef)(h);v.current=h;const I=(0,s.useReminders)(t=>`${t.reminders.length}:${t.done.length}:${JSON.stringify(t.rules[c]??{})}:${t.reminders.map(t=>t.updatedAt??'').join()}`),w=(0,r.useOwner)(t=>`${t.attendance.length}:${t.shifts.length}:${t.leave.length}`);(0,t.useEffect)(()=>{s.useReminders.getState().ensure(c);const t=()=>{const t=f(),{att:h,shift:S,on:I}=k(u,t),w=s.useReminders.getState();if(!I||!u)return w.reminders.forEach(t=>(0,a.dismissNotice)(`rem:${t.id}`)),void(0,a.dismissNotice)('break-reminder');const $=(0,s.rulesOf)(c),R=h?.in?new Date(h.in).getTime():void 0,p=!!h?.breaks?.length,y=`break:${h?.id??S?.id??''}`,M=(0,o.breakDue)({now:t,clockIn:R,shiftStart:S?l(S.date,S.start):void 0,shiftEnd:S?l(S.date,S.end):void 0,rotaBreak:void 0!==S?.breakAt?l(S.date,S.breakAt):void 0,hadBreak:p,rules:$},w.snooze[y]??0);if(M){const r=R??(S?l(S.date,S.start):t);(0,a.notify)({id:'break-reminder',tone:3===M.stage?'warn':'normal',icon:'\ud83e\uded6',kicker:'BREAK REMINDER',testID:'break-reminder',timeoutMs:null,title:M.label,body:`${R?'Clocked in':'Shift started'} at ${m(r)}. ${3===M.stage?'':'Over 6 hours needs a 20-minute break.'}`.trim(),actions:[{label:'Start break',testID:'break-reminder-start',onPress:()=>{if(!h)return D.current?.(),void(0,a.notify)({id:'break-clock-first',title:'Clock in first, then tap Start break.',body:'Your break is started from the clock screen.',timeoutMs:6e3});const t=new Date(f()).toISOString();(0,n.clockAction)('break_start',{rid:c,staffId:u,date:t.slice(0,10),at:t}).then(t=>{t.ok||(0,a.notify)({id:'break-blocked',tone:'warn',title:'Break not started',body:t.message,timeoutMs:1e4}),D.current?.()})}},{label:'Later',kind:'ghost',testID:'break-reminder-later',onPress:()=>{s.useReminders.getState().setSnooze(y,f()+6e4*$.snoozeMins),(0,a.dismissNotice)('break-reminder')}}]})}else(0,a.dismissNotice)('break-reminder');const N=r.useOwner.getState().staff.find(t=>t.id===u),O=b??(0,d.inKitchen)(N);for(const n of w.reminders){if(n.rid!==c)continue;const r=`rem:${n.id}`;if(n.removed||!(0,o.audienceMatch)(n.audience,O)){(0,a.dismissNotice)(r);continue}const{due:d,forDate:m}=(0,o.reminderDue)(n,t),l=w.done.find(t=>t.reminderId===n.id&&t.forDate===m),k=`rem:${n.id}:${m}`;!d||l||(w.snooze[k]??0)>t?(0,a.dismissNotice)(r):(0,a.notify)({id:r,icon:'\ud83e\ude91',kicker:'REMINDER',title:n.text,testID:'venue-reminder',timeoutMs:null,body:`For everyone on shift${'all'===n.audience?'':'kitchen'===n.audience?' in the kitchen':' front of house'}. Tap Done once it\u2019s done.`,actions:[{label:'Done',testID:'venue-reminder-done',onPress:()=>s.useReminders.getState().markDone({rid:c,reminderId:n.id,forDate:m,at:new Date(f()).toISOString(),staffRef:u,staffName:v.current.replace(' (example)','')})},{label:'Later',kind:'ghost',onPress:()=>s.useReminders.getState().setSnooze(k,f()+6e4*$.snoozeMins)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[c,u,I,w,b])};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]);const f=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock).getTime()}catch{return Date.now()}},m=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=(t,n)=>{const[r,s,o]=t.split('-').map(Number);return new Date(r,s-1,o,Math.floor(n),Math.round(n%1*60)).getTime()};function k(t,n){const s=r.useOwner.getState(),a=(0,r.openShiftOf)(s.attendance,t,new Date(n)),d=(0,o.ukClock)(n).ymd,c=(0,u.workingShifts)(s.shifts,s.leave),f=c.find(r=>r.staffId===t&&r.date===d&&!1!==r.published&&l(r.date,r.start)<=n&&nn.staffId===t&&n.date===d&&!1!==n.published):void 0),m=!a&&!!f&&s.attendance.some(n=>n.staffId===t&&n.date===d&&!!n.out&&new Date(n.out).getTime()>=l(f.date,f.start));return{att:a,shift:f,on:!!a||!!f&&!m}}},1000,[31,1178,863,998,1183,980,1192,881,972]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"START_PAIR",{enumerable:!0,get:function(){return t}});const t=(()=>{try{if('undefined'==typeof window||!window.location)return null;const t=new URL(window.location.href),n=new URLSearchParams(t.hash.replace(/^#/,'')),c=t.searchParams.get('pair')||n.get('pair');if(!c)return null;t.searchParams.delete('pair'),n.delete('pair');const o=n.toString();return window.history.replaceState(null,'',t.pathname+(t.search?t.search:'')+(o?`#${o}`:'')),c}catch{return null}})()},1001,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(t.default,{testID:"who-bar",dataSet:{centre:'heading'},accessible:!0,accessibilityLabel:l,style:{paddingVertical:4,alignItems:'center',alignSelf:'stretch',width:'100%'},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:s.colours.gold,center:!0,children:l})})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),c=r(d[4]),o=r(d[5])},1039,[31,128,953,825,818,25]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCKED_STEPS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"BLOCKED_INTRO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"BLOCKED_SPOKEN",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"STILL_OFF",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"ALERTS_PROMPT_ON",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"usePushPrompt",{enumerable:!0,get:function(){return O}}),_e.bannerFor=L,_e.titleFor=R,_e.chromeUrlFor=B,_e.AlertsBanner=function(){const e=O(e=>e.mode);if(!e)return null;const{line:n,action:o}=L(e);return(0,C.jsxs)(r.default,{testID:"alerts-banner",accessibilityRole:"button",accessibilityLabel:`${n} ${o}.`,accessibilityHint:"Opens the steps",onPress:()=>O.setState({open:!0}),style:{alignSelf:'center',maxWidth:420,width:'100%',minHeight:48,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1,borderColor:l.colours.accentBorder,backgroundColor:l.colours.surface2},children:[(0,C.jsx)(H,{size:18}),(0,C.jsxs)(t.Text,{testID:"alerts-banner-text",style:{color:'#F2E6C9',fontSize:15,textAlign:'center',flexShrink:1},children:[n," ",(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontWeight:'700',textDecorationLine:'underline'},children:o})]})]})},_e.PushPrompt=function(){const e=(0,s.useSync)(e=>e.kind),u=(0,s.useSync)(e=>e.staffRef),p=(0,s.useSync)(e=>e.venueId),b=O(e=>e.mode),m=O(e=>e.open),x=e=>O.setState(e?{mode:e}:{mode:null,open:!1}),[w,A]=(0,n.useState)(null),[L,_]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!k.includes(f.APP_VARIANT)||!P)return;if(h.PITCH)return globalThis.__pitchPushPrompt=e=>{A(null),O.setState({mode:e,open:!!e})},void(globalThis.__pitchPushBanner=e=>{A(null),O.setState({mode:e,open:!1})});if('staff'!==e||!u||!p)return;let t=!0;const n=async()=>{let e='unsupported';if(!(0,c.inApkWebView)()){try{e=await(0,c.pushState)()}catch{return}if(!t)return;if('on'===e)return x(null),void(0,c.resaveIfAllowed)().catch(()=>{});if('off'===e&&'undefined'!=typeof Notification&&'granted'===Notification.permission){let e=!1;try{e=await(0,c.resaveIfAllowed)()}catch{}if(!t)return;if(e)return void x(null)}}const n=z(e);t&&(n&&Date.now()-D()>I?O.setState({mode:n}):x(null))};n();const o=()=>{'undefined'!=typeof document&&'visible'===document.visibilityState&&n()};try{document.addEventListener('visibilitychange',o)}catch{}return()=>{t=!1;try{document.removeEventListener('visibilitychange',o)}catch{}}},[e,u,p]),!b||!m)return null;const F=R(b),N={minHeight:64,borderRadius:16,justifyContent:'center',alignItems:'center',paddingHorizontal:20,backgroundColor:l.colours.gold,alignSelf:'stretch'},W=(e,n)=>(0,C.jsxs)(i.default,{style:{flexDirection:'row',gap:12,alignItems:'center',alignSelf:'stretch'},children:[(0,C.jsx)(i.default,{style:{width:30,height:30,borderRadius:15,borderWidth:1.5,borderColor:l.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontSize:15,fontWeight:'700'},children:e})}),(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,flex:1,lineHeight:22},children:n})]},e);return(0,C.jsx)(i.default,{testID:"alerts-prompt-backdrop",style:{position:'fixed',left:0,right:0,top:0,bottom:0,zIndex:2147483100,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:18},children:(0,C.jsxs)(i.default,{testID:"alerts-prompt",accessibilityRole:'dialog',accessibilityLabel:F,style:{width:'100%',maxWidth:380,backgroundColor:l.colours.surface2,borderColor:l.colours.accentBorder,borderWidth:1,borderRadius:22,paddingHorizontal:22,paddingTop:22,paddingBottom:18,alignItems:'center',gap:14,shadowColor:'#000',shadowOpacity:.5,shadowRadius:24,shadowOffset:{width:0,height:10}},children:[(0,C.jsx)(i.default,{style:{position:'absolute',top:10,right:10},children:(0,C.jsx)(y.GoldClose,{testID:"alerts-prompt-close",label:"Close",onPress:()=>{A(null),O.setState({open:!1})}})}),(0,C.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1.5,borderColor:l.colours.gold,alignItems:'center',justifyContent:'center',marginTop:6},children:(0,C.jsx)(H,{})}),(0,C.jsx)(t.Text,{testID:"alerts-prompt-title",accessibilityRole:"header",style:{color:l.colours.goldLight,fontSize:22,fontWeight:'700',textAlign:'center',lineHeight:28,paddingHorizontal:8},children:F}),'off'===b?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(r.default,{testID:"alerts-prompt-turn-on",accessibilityRole:"button",disabled:L,accessibilityState:{disabled:L,busy:L},accessibilityLabel:"Turn on alerts. Your phone will then ask to allow notifications: tap Allow.",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{const e=await(0,c.turnOnPush)();if(e.ok)return void x(null);A(e.message);const t=z(await(0,c.pushState)());x(t||null)}catch{A('Could not turn on alerts. Please try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Turning on\u2026':'Turn on alerts'})}),(0,C.jsxs)(t.Text,{testID:"alerts-prompt-allow",style:{color:'#F2E6C9',fontSize:17,textAlign:'center'},children:["When your phone asks, tap ",(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontWeight:'700'},children:"Allow"}),"."]})]}):null,'blocked'===b?(0,C.jsxs)(i.default,{testID:"alerts-prompt-blocked",accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"assertive",accessibilityLabel:j,style:{alignSelf:'stretch',gap:8},children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:17,textAlign:'center'},children:T}),S.map((e,t)=>W(t+1,e))]}):null,'blocked'===b?(0,C.jsx)(r.default,{testID:"alerts-prompt-recheck",accessibilityRole:"button",disabled:L,accessibilityState:{disabled:L,busy:L},accessibilityLabel:"I\u2019ve allowed it. Check again.",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{if('blocked'===await(0,c.pushState)())return void A(v);const e=await(0,c.turnOnPush)();if(e.ok)return void x(null);A(e.message);const t=z(await(0,c.pushState)());x(t)}catch{A('Could not check alerts. Please try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Checking\u2026':'I\u2019ve allowed it, check again'})}):null,'ios'===b?(0,C.jsxs)(i.default,{testID:"alerts-prompt-ios",style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,textAlign:'center'},children:"iPhone only sends alerts to apps on the Home Screen. First:"}),W(1,'Tap the Share button (the square with the arrow) in Safari.'),W(2,'Tap Add to Home Screen, then Add.'),W(3,'Open CoverCharge from your Home Screen.'),W(4,'Tap Turn on alerts, then Allow.')]}):null,'apk'===b||'webview'===b?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(t.Text,{style:{color:'#F2E6C9',fontSize:16,textAlign:'center'},children:'apk'===b?'The phone app can\u2019t show alerts when it\u2019s closed. Chrome can. You\u2019ll stay signed in as you.':'This browser can\u2019t get alerts. Open CoverCharge in Chrome.'}),(0,C.jsx)(r.default,{testID:"alerts-prompt-open-chrome",accessibilityRole:"button",disabled:L,accessibilityLabel:"Open CoverCharge in Chrome to turn on alerts",style:[N,L?{opacity:.7}:null],onPress:async()=>{_(!0),A(null);try{let e=null;if('apk'===b){const t=await(0,s.makeChromeHandover)();if(!t.ok)return void A(t.message);e=t.code}const t=B(window.location.href,e,'apk'===b);if(h.PITCH)return A('Opening Chrome\u2026'),void(globalThis.__pitchLastChromeUrl=t);A('Opening Chrome\u2026 Then tap Turn on alerts there, and Allow.');try{window.location.href=t}catch{await o.default.openURL(t)}}catch{A('Could not open Chrome. Check your connection and try again.')}finally{_(!1)}},children:(0,C.jsx)(t.Text,{style:{color:'#0B0B0B',fontSize:20,fontWeight:'700'},children:L?'Opening\u2026':'Open in Chrome'})}),(0,C.jsx)(t.Text,{style:{color:'#CFC6B4',fontSize:14,textAlign:'center'},children:"In Chrome: tap Turn on alerts, then Allow."})]}):null,w?(0,C.jsx)(i.default,{accessibilityLiveRegion:"assertive",accessibilityRole:'alert',children:(0,C.jsx)(t.Text,{testID:"alerts-prompt-msg",style:{color:l.colours.goldLight,fontSize:15,textAlign:'center'},children:w})}):null,(0,C.jsx)(r.default,{testID:"alerts-prompt-later",accessibilityRole:"button",accessibilityLabel:"Not now. Hide this until tomorrow",onPress:()=>{E(),A(null),x(null)},style:{minHeight:48,justifyContent:'center',paddingHorizontal:24},children:(0,C.jsx)(t.Text,{style:{color:l.colours.goldLight,fontSize:17,textDecorationLine:'underline'},children:"Not now"})})]})})};var t=_r(d[0]),n=_r(d[1]),o=e(_r(d[2]));_r(d[3]);var r=e(_r(d[4])),i=e(_r(d[5])),l=_r(d[6]),s=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),f=_r(d[11]),p=_r(d[12]),b=_r(d[13]),y=_r(d[14]),m=_r(d[15]),x=e(m),C=_r(d[16]);const w='cc-alerts-prompt-v1',S=['In Chrome, tap the three dots at the top right, then Settings.','Tap Site settings, then Notifications.','Find CoverCharge (covercharge-apps) under Blocked, tap it, and choose Allow.','Come back here and tap \u201cI\u2019ve allowed it, check again\u201d.'],T='Chrome has alerts switched off for CoverCharge on this phone, so the app can\u2019t ask again. To switch them back on:',j=`${T} ${S.map((e,t)=>`${t+1}. ${e}`).join(' ')}`,v='Alerts are still off in Chrome. Follow the steps above, then tap check again.',I=864e5,k=['owner','staff','chef'],P=!(b.IS_ISOLATED_VENUE||b.IS_QUEUED_VENUE||b.IS_GREENSIDE||b.IS_ABBOTSFORD||b.IS_KIRKTON),A=k.includes(f.APP_VARIANT)&&P&&!h.PITCH,O=(0,u.create)(()=>({mode:null,open:!1}));function L(e){return{line:'Alerts are off on this phone.',action:'off'===e?'Tap to turn on':'ios'===e?'Tap to see how':'apk'===e||'webview'===e?'Tap to open in Chrome':'Tap to fix'}}function R(e){return'apk'===e||'webview'===e?'Open CoverCharge in Chrome to turn on alerts':'ios'===e?'Add CoverCharge to your Home Screen':'blocked'===e?'Turn alerts back on in Chrome':'Turn on alerts so you don\u2019t miss orders and reminders'}const _=()=>'undefined'!=typeof navigator&&/CoverChargePhone\//.test(navigator.userAgent);function D(){try{const e=JSON.parse(localStorage.getItem(w)||'{}');return Number(e.later||0)}catch{return 0}}function E(){try{localStorage.setItem(w,JSON.stringify({later:Date.now(),version:p.APP_VERSION}))}catch{}}function z(e){return _()?'apk':(0,c.inApkWebView)()?'webview':'off'===e?'off':'blocked'===e?'blocked':'ios-home-screen'===e?'ios':null}function B(e,t,n){const o=new URL(e),r=`${o.origin}${o.pathname.replace(/[^/]*$/,'')}index.html${t?`#ccchrome=${t}`:''}`;return n?`googlechrome://navigate?url=${encodeURIComponent(r)}`:`intent://${o.host}${o.pathname.replace(/[^/]*$/,'')}index.html#Intent;scheme=https;package=com.android.chrome;end`}function H({size:e=32}={}){return(0,C.jsxs)(x.default,{width:e,height:e,viewBox:"0 0 24 24",accessible:!1,pointerEvents:"none",children:[(0,C.jsx)(m.Path,{d:"M6 16 V11 a6 6 0 0 1 12 0 V16 l1.5 2 H4.5 Z",stroke:l.colours.gold,strokeWidth:1.7,strokeLinejoin:"round",fill:"none"}),(0,C.jsx)(m.Path,{d:"M10 20.5 a2 2 0 0 0 4 0",stroke:l.colours.gold,strokeWidth:1.7,strokeLinecap:"round",fill:"none"})]})}},1040,[874,31,240,123,264,128,825,824,1389,995,2,807,1043,5,835,989,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"currentScrollY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"screenGeneration",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"restoreScroll",{enumerable:!0,get:function(){return o}}),_e.useScrollMemory=function(u){const c=(0,e.useRef)(0),o=(0,e.useRef)(0),l=(0,e.useRef)(0),s=(0,e.useRef)(0),f=(0,e.useRef)(0),v=(0,e.useRef)(null),y=(0,e.useRef)([]),h=()=>{y.current.forEach(clearTimeout),y.current=[]},b=()=>{const e=v.current;null!=e&&(u.current?.scrollTo({y:e,animated:!1}),f.current-s.current>=e-2&&(c.current=e,o.current=e,v.current=null,h()))},p=(0,e.useCallback)(e=>{if(h(),v.current=Math.max(0,e),e<=0)return v.current=null,u.current?.scrollTo({y:0,animated:!1}),c.current=0,void(o.current=0);for(const e of[0,30,80,160,320,600,1e3,1600,2500])y.current.push(setTimeout(b,e));y.current.push(setTimeout(()=>{v.current=null},2600))},[]);t={y:()=>o.current,restore:p};const R=(0,e.useCallback)(()=>{n++;return o.current},[]);return{props:{scrollEventThrottle:32,onScroll:e=>{const t=e.nativeEvent.contentOffset.y;c.current=t,s.current=e.nativeEvent.layoutMeasurement.height,f.current=e.nativeEvent.contentSize.height,Date.now()-l.current>250&&null==v.current&&(o.current=t)},onScrollBeginDrag:()=>{v.current=null,h()},onContentSizeChange:(e,t)=>{f.current=t,l.current=Date.now(),b()},onLayout:e=>{s.current=e.nativeEvent.layout.height}},restore:p,leave:R}};var e=r(d[0]);let t=null,n=0;const u=()=>t?t.y():0,c=()=>n,o=e=>t?.restore(e)},1041,[31]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBackLayers",{enumerable:!0,get:function(){return f}}),_e.runBackLayer=function(){const e=f.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(e,n,o=!0){const s=(0,t.useRef)(n);s.current=n,(0,t.useEffect)(()=>{if(!e)return;const t=++y,n=(0,u.currentScrollY)(),l=(0,u.screenGeneration)();return f.setState(e=>({layers:[...e.layers,{id:t,fn:()=>s.current(),own:o}]})),()=>{f.setState(e=>({layers:e.layers.filter(e=>e.id!==t)})),(0,u.screenGeneration)()===l&&(0,u.restoreScroll)(n)}},[e,o])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"BACK_GUTTER",{enumerable:!0,get:function(){return w}}),_e.BackTitleRow=function({back:e,onBack:n,title:s}){const[l,u]=(0,t.useState)(0),[f,y]=(0,t.useState)({w:96,h:48}),[p,b]=(0,t.useState)(0),S=Array.from(new Set(String(s??'').split(/\s+/).filter(Boolean)));String(s??'').length>=20&&S.length>=3&&S.push('00000000');const v=Math.max(w,Math.ceil(f.w)+4),j=e&&l>0&&l-2*v0&&(0===l||0===p);return(0,h.jsxs)(o.default,{testID:"screen-title-row",onLayout:e=>u(Math.round(e.nativeEvent.layout.width)),style:{minHeight:44,justifyContent:'center',alignItems:'center',paddingHorizontal:e&&!j?v:0,paddingTop:j?f.h:0},children:[e?(0,h.jsx)(o.default,{style:{position:'absolute',left:0,top:0},onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width),n=Math.round(e.nativeEvent.layout.height);y(e=>e.w===t&&e.h===n?e:{w:t,h:n})},children:(0,h.jsx)(g,{onPress:n})}):null,(0,h.jsx)(c.T,{size:22,weight:"bold",center:!0,style:B?{opacity:0}:void 0,accessibilityRole:"header",children:s}),e&&S.length?(0,h.jsx)(o.default,{"aria-hidden":!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{position:'absolute',left:0,top:0,opacity:0,alignItems:'flex-start'},onLayout:e=>b(Math.ceil(e.nativeEvent.layout.width)),children:S.map(e=>(0,h.jsx)(c.T,{size:22,weight:"bold",numberOfLines:1,style:{alignSelf:'flex-start'},children:e},e))}):null]})},_e.BackButton=g,_e.useWebBack=function(e){const n=(0,t.useRef)(e);n.current=e,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.history?.pushState)return;const e=()=>{try{window.history.pushState({...window.history.state??{},ccBack:Date.now()},'',window.location.href)}catch{}};e();const t=t=>{n.current()&&(t.stopImmediatePropagation?.(),e())};return window.addEventListener('popstate',t,!0),()=>window.removeEventListener('popstate',t,!0)},[])};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]);const f=(0,s.create)(()=>({layers:[]}));let y=0;const p=()=>f(e=>e.layers.some(e=>e.own)),w=100;function g({onPress:e,testID:t="screen-back",label:o="Back"}){return(0,h.jsx)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:o,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,h.jsxs)(c.T,{size:18,weight:"semibold",colour:l.colours.gold,children:["\u2039 ",o]})})}},1042,[31,123,264,128,995,825,818,1041,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.184'},1043,[]); +__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()})},1044,[31,1074]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTasksProgress=function(e,s){const t=(0,r.useDailyTasks)(t=>t.people[(0,r.personKey)(e,s)]?.tasks)??[],i=(0,r.useDailyTasks)(e=>e.ticks),{ymd:l,dow:o}=T();return(0,c.progress)(t,i,s,l,o)},_e.DailyTasksEditor=j,_e.MyTasksToday=function({rid:e,staffId:s,name:t,onShift:i}){const u=(0,r.useDailyTasks)(t=>t.people[(0,r.personKey)(e,s)]?.tasks)??[],h=(0,r.useDailyTasks)(e=>e.ticks),{ymd:y,dow:x}=T(),p=(0,c.tasksFor)(u,x);if(!s||!p.length)return null;const f=(0,c.progress)(u,h,s,y,x);return(0,k.jsx)(o.default,{testID:"my-tasks-today",children:(0,k.jsxs)(n.Card,{children:[(0,k.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(n.T,{weight:"semibold",colour:d.colours.gold,children:"My tasks today"}),(0,k.jsx)(n.Badge,{kind:f.done===f.total?'gold':'neutral',label:`${f.done} of ${f.total}`})]}),i?null:(0,k.jsx)(n.Muted,{size:12,children:"You\u2019re not on shift right now. You can still tick these when you are."}),p.map(c=>{const u=h.find(t=>t.id===(0,r.tickId)(e,s,c.id,y));return(0,k.jsxs)(l.default,{testID:`my-task-${c.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:!!u},disabled:!i,onPress:()=>r.useDailyTasks.getState().toggleTick(e,s,c.id,y,{id:s,name:t.replace(' (example)','')}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:8,opacity:i?1:.6},children:[(0,k.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:1.5,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:u?'#2a2414':'transparent'},children:u?(0,k.jsx)(n.T,{colour:d.colours.gold,children:"\u2713"}):null}),(0,k.jsxs)(o.default,{style:{flex:1},children:[(0,k.jsx)(n.T,{style:{textDecorationLine:u?'line-through':'none'},children:c.text}),u?(0,k.jsxs)(n.Muted,{size:12,children:["Done at ",b(u.at)]}):null]})]},c.id)}),(0,k.jsx)(n.Muted,{size:12,children:"Tip: tick each one as you finish it. Your manager sees how you\u2019re getting on. They start fresh every day."})]})})},_e.TaskLibrarySettings=function({rid:e}){(0,i.useEffect)(()=>{r.useDailyTasks.getState().ensure(e)},[e]);const t=(0,r.useDailyTasks)(s=>s.library[e]?.items)??[],[l,u]=(0,i.useState)(''),[h,x]=(0,i.useState)({}),f=r.useDailyTasks.getState(),b=s=>f.setLibrary(e,s);return(0,k.jsxs)(o.default,{style:{gap:8},testID:"task-library",children:[(0,k.jsx)(n.Muted,{size:13,children:"Tip: these are quick picks when you add someone\u2019s daily tasks (Staff & roles \u203a a person \u203a Daily tasks). You can always type a new one there too."}),t.map((e,i)=>(0,k.jsxs)(n.Row,{gap:6,style:{opacity:e.archived?.5:1},children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:`Rename ${e.text}`,value:h[e.id]??e.text,onChangeText:s=>x(t=>({...t,[e.id]:s})),onBlur:()=>{const s=(0,c.cleanTaskText)(h[e.id]??'');s&&s!==e.text&&b(t.map(t=>t.id===e.id?{...t,text:s}:t))},style:{...p,flex:1,minWidth:0}}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2191",disabled:0===i,onPress:()=>b((0,c.move)(t,i,-1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2193",disabled:i===t.length-1,onPress:()=>b((0,c.move)(t,i,1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>b(t.map(s=>s.id===e.id?{...s,archived:!s.archived}:s))})]},e.id)),(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:"New library task",testID:"task-lib-new",value:l,onChangeText:u,placeholder:"e.g. Check the beer garden",placeholderTextColor:d.colours.muted,style:{...p,flex:1}}),(0,k.jsx)(n.Button,{small:!0,label:"Add",disabled:!(0,c.cleanTaskText)(l),onPress:()=>{b([...t,{id:(0,y.uuid)(),text:(0,c.cleanTaskText)(l)}]),u('')}})]})]})},_e.KitchenTeamTasks=function({rid:e,actor:s}){const t=(0,x.useOwner)(e=>e.staff).filter(e=>e.active&&s&&(0,c.canEditTasks)(s,e));return(0,k.jsxs)(o.default,{style:{gap:10},testID:"kitchen-team-tasks",children:[(0,k.jsx)(n.Muted,{size:13,children:"Tip: set the daily tasks for your kitchen team here. They see them as \u2018My tasks today\u2019 when they\u2019re on shift and tick them off. Your own list and front of house lists are set by a manager."}),s?null:(0,k.jsx)(n.Muted,{children:"Sign in to change your team\u2019s tasks."}),s&&!t.length?(0,k.jsx)(n.Muted,{children:"No kitchen staff found. A manager can set each person\u2019s department in Staff & roles."}):null,t.map(t=>(0,k.jsxs)(n.Card,{children:[(0,k.jsx)(n.T,{weight:"semibold",children:(0,x.staffLabel)(t).replace(' (example)','')}),(0,k.jsxs)(n.Muted,{size:12,children:[t.job,t.dept?` \xb7 ${t.dept}`:'']}),(0,k.jsx)(j,{rid:e,person:t,actor:s})]},t.id))]})};var s=_r(_d[0]),t=_r(_d[1]),i=_r(_d[2]),l=e(_r(_d[3])),o=e(_r(_d[4])),n=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]),k=_r(_d[13]);const p={minHeight:42,borderRadius:10,borderWidth:1,borderColor:d.colours.hairline,backgroundColor:d.colours.surface2,color:d.colours.text,paddingHorizontal:10,fontSize:15},f=[1,2,3,4,5,6,0],b=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),T=(e=Date.now())=>{const s=(0,u.ukClock)(e);return{ymd:s.ymd,dow:new Date(`${s.ymd}T12:00:00Z`).getUTCDay()}};function j({rid:e,person:u,actor:y}){(0,i.useEffect)(()=>{r.useDailyTasks.getState().ensure(e)},[e]);const x=(0,r.useDailyTasks)(s=>s.people[(0,r.personKey)(e,u.id)]?.tasks)??[],j=((0,r.useDailyTasks)(s=>s.library[e]?.items)??[]).filter(e=>!e.archived),w=(0,r.useDailyTasks)(e=>e.ticks),[D,v]=(0,i.useState)(!1),[C,S]=(0,i.useState)(''),[$,I]=(0,i.useState)(null),M=r.useDailyTasks.getState(),P=(0,c.canEditTasks)(y,u),{ymd:R,dow:L}=T(),z=(0,c.progress)(x,w,u.id,R,L),B=s=>M.setTasks(e,u.id,s),A=e=>{const s=x;B(x.filter(s=>s.id!==e.id)),(0,h.notify)({id:`task-undo-${e.id}`,title:`Removed \u201c${e.text}\u201d`,timeoutMs:8e3,actions:[{label:'Undo',testID:'task-undo',onPress:()=>B(s)}]})};return(0,k.jsxs)(o.default,{testID:`tasks-${u.id}`,style:{gap:6},children:[(0,k.jsx)(l.default,{accessibilityRole:"button",testID:`tasks-open-${u.id}`,onPress:()=>v(!D),children:(0,k.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(n.T,{weight:"semibold",colour:d.colours.gold,children:["Daily tasks ",D?'\u25b4':'\u25be']}),(0,k.jsx)(n.Muted,{size:12,children:x.length?`${z.done} of ${z.total} done today`:'None yet'})]})}),D?(0,k.jsxs)(o.default,{style:{gap:6},children:[x.map((s,i)=>{const l=w.find(t=>t.id===(0,r.tickId)(e,u.id,s.id,R));return(0,k.jsxs)(o.default,{testID:`task-row-${i}`,style:{borderTopWidth:1,borderColor:d.colours.hairline,paddingTop:6,gap:4},children:[(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsxs)(n.T,{style:{flex:1},colour:l?d.colours.gold:d.colours.text,children:[l?'\u2713 ':'',s.text]}),P?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2191",accessibilityLabel:`Move ${s.text} up`,disabled:0===i,onPress:()=>B((0,c.move)(x,i,-1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2193",accessibilityLabel:`Move ${s.text} down`,disabled:i===x.length-1,onPress:()=>B((0,c.move)(x,i,1))}),(0,k.jsx)(n.Button,{small:!0,kind:"ghost",label:"Days",onPress:()=>I($===s.id?null:s.id)}),(0,k.jsx)(t.GoldClose,{size:"sm",testID:`task-remove-${i}`,label:`Remove ${s.text}`,onPress:()=>A(s)})]}):null]}),(0,k.jsxs)(n.Muted,{size:12,children:[s.days?.length?s.days.map(e=>c.TASK_DAY_NAMES[e]).join(', '):'Every day',l?` \xb7 ticked by ${l.byName.split(' ')[0]} at ${b(l.at)}`:'']}),$===s.id?(0,k.jsx)(n.Row,{wrap:!0,gap:4,children:f.map(e=>{const t=!!s.days?.includes(e);return(0,k.jsx)(n.Chip,{label:c.TASK_DAY_NAMES[e],selected:t,onPress:()=>B(x.map(i=>i.id===s.id?{...i,days:t?(i.days??[]).filter(s=>s!==e):[...i.days??[],e].sort()}:i))},e)})}):null]},s.id)}),P?(0,k.jsxs)(o.default,{style:{gap:6},children:[(0,k.jsx)(n.Row,{wrap:!0,gap:4,children:j.filter(e=>!x.some(s=>s.text.toLowerCase()===e.text.toLowerCase())).slice(0,12).map(s=>(0,k.jsx)(n.Chip,{testID:"task-lib-chip",label:`${s.text}`,onPress:()=>M.addTask(e,u.id,s.text,s.id)},s.id))}),(0,k.jsxs)(n.Row,{gap:6,children:[(0,k.jsx)(s.TextInput,{accessibilityLabel:"New task",testID:`task-new-${u.id}`,value:C,onChangeText:S,placeholder:"Type a task, e.g. Restock the bar fridges",placeholderTextColor:d.colours.muted,style:{...p,flex:1},onSubmitEditing:()=>{(0,c.cleanTaskText)(C)&&(M.addTask(e,u.id,C),S(''))}}),(0,k.jsx)(n.Button,{small:!0,testID:`task-add-${u.id}`,label:"Add",disabled:!(0,c.cleanTaskText)(C),onPress:()=>{M.addTask(e,u.id,C),S('')}})]})]}):(0,k.jsx)(n.Muted,{size:12,children:'staff'===y?.role?'You can\u2019t change this list.':''})]}):null]})}},1045,[874,835,31,264,128,818,825,1181,1182,1183,980,1099,863,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.readBack=B,_e.ReviewSheet=L,_e.Bars=z,_e.CashCharts=A,_e.CashUpScreen=function(e){return e.closer?(0,$.jsx)(N,{rid:e.rid,tonight:e.today,who:e.who}):(0,$.jsx)(E,{...e})},_e.CloserCashUp=N,_e.PastDayCard=O,_e.TodaysTipsCard=function({rid:e,today:t,big:s}){const a=(0,f.useTipsShow)(e),o=(0,f.useCashUp)(e=>e.tips).filter(s=>s.rid===e&&(s.date===t||s.date===(0,x.addDaysYmd)(t,-1))).sort((e,t)=>t.date.localeCompare(e.date))[0],l=G(o?.total??0);return a.showToday&&o?(0,$.jsx)(p.Card,{highlight:y.colours.gold,children:(0,$.jsxs)(c.default,{testID:"todays-tips",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,$.jsx)(Y,{n:Math.ceil(o.total/25)}),(0,$.jsxs)(c.default,{style:{flex:1,gap:2},children:[(0,$.jsx)(p.T,{size:12,weight:"semibold",colour:y.colours.gold,style:{letterSpacing:1.5},children:o.date===t?'TODAY\u2019S TIPS':'LAST NIGHT\u2019S TIPS'}),(0,$.jsx)(p.T,{size:s?40:32,weight:"bold",colour:y.colours.goldLight,children:P(l)}),(0,$.jsxs)(p.Muted,{children:["Cash + card tips for the whole team \xb7 ",M(o.date),". Thank you, everyone."]})]})]})}):null},_e.TipsPotCard=V,_e.postTipsNotice=K,_e.latestDayTips=Z,_e.useTipsPosted=function(e,t,s=!0){const a=(0,f.useCashUp)(e=>e.tips),o=(0,f.useTipsShow)(e);(0,l.useEffect)(()=>{if(!s||!o.showToday)return;const l=Z(a,e,t);l&&K(e,l.date,l.total,t)},[e,t,a,o.showToday,s])},_e.CashUpSettings=function({rid:e}){const t=U(e),s=(t,s)=>f.useCashUp.getState().setFields(e,t,s),l=(e,l)=>(0,$.jsxs)(c.default,{style:{gap:6},children:[(0,$.jsx)(p.T,{weight:"semibold",children:l}),t[e].map((l,n)=>(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(o.TextInput,{testID:`cf-${e}-${l.key}`,value:l.label,onChangeText:a=>s(e,t[e].map((e,t)=>t===n?{...e,label:a.slice(0,40)}:e)),style:{flex:1,minHeight:38,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',color:y.colours.text,paddingHorizontal:8}}),(0,$.jsx)(p.Muted,{children:'money'===l.kind?'\xa3':'number'===l.kind?'#':'text'}),l.fixed?(0,$.jsx)(p.Muted,{children:"needed"}):(0,$.jsx)(a.GoldClose,{size:"sm",label:`Remove ${l.label}`,onPress:()=>s(e,t[e].filter((e,t)=>t!==n))})]},l.key)),(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"secondary",label:"Money figure",onPress:()=>s(e,[...t[e],{key:`f${Date.now().toString(36)}`,label:'New figure',kind:'money'}])}),(0,$.jsx)(p.Button,{small:!0,kind:"secondary",label:"Number",onPress:()=>s(e,[...t[e],{key:`n${Date.now().toString(36)}`,label:'New number',kind:'number'}])})]})]});return(0,$.jsxs)(c.default,{testID:"cashup-settings",style:{gap:12},children:[(0,$.jsx)(p.Muted,{children:"Tip: match these to the boxes on your paper cash up sheet and till printout. Cash tips total and Card tips total are needed for Today\u2019s tips and the Tips pot."}),l('cashFields','Cash up sheet'),l('salesFields','Weekly sales report')]})},_e.TipsSettings=function({rid:e}){const t=(0,f.useTipsShow)(e);return(0,$.jsxs)(c.default,{testID:"tips-settings",style:{gap:8},children:[(0,$.jsx)(p.Muted,{children:"Staff only ever see the team total: never anyone\u2019s share or pay. The Display never shows tips or money."}),(0,$.jsx)(p.Toggle,{testID:"tips-show-today",label:"Show Today\u2019s tips in the staff apps",value:t.showToday,onChange:t=>f.useCashUp.getState().setShow(e,{showToday:t})}),(0,$.jsx)(p.Toggle,{testID:"tips-show-pot",label:"Show the Tips pot in the staff apps",value:t.showPot,onChange:t=>f.useCashUp.getState().setShow(e,{showPot:t})})]})};var t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),n=e(_r(_d[5])),r=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),h=e(_r(_d[9])),c=e(_r(_d[10])),u=e(_r(_d[11])),p=_r(_d[12]),y=_r(_d[13]),f=_r(_d[14]),m=_r(_d[15]),x=_r(_d[16]),k=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]),T=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),I=_r(_d[26]),$=_r(_d[27]);const P=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,M=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function B(e){const t=t=>'number'==typeof e[t]?e[t]:null,s=(0,x.combinedTips)(e);return[['Gross',t('gross')],['card',t('card')],['cash',t('cash')],['tips',s],['food',t('food')],['drink',t('drink')]].filter(([,e])=>null!=e).map(([e,t])=>`${e} ${P(t)}`).join(', ')}function R({p:e,h:s}){const[a,o]=(0,l.useState)(e.startsWith('data:')?e:null),n=e.startsWith('data:')||(0,w.photosAllowed)();return(0,l.useEffect)(()=>{!a&&n&&(0,w.photoUrl)(e).then(o)},[e,n]),n?a?(0,$.jsx)(d.default,{source:{uri:a},style:{width:'100%',height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#111')},resizeMode:"contain"}):(0,$.jsx)(c.default,{style:{height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center'},children:(0,$.jsx)(p.Muted,{children:"Photo"})}):(0,$.jsx)(c.default,{testID:"photo-owners-only",accessible:!0,accessibilityLabel:"Taking-sheet photo. Only owners can view saved photos.",style:{height:Math.min(s,90),borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center',padding:10},children:(0,$.jsx)(p.Muted,{center:!0,children:"Photo saved. Only owners can view it."})})}function L({draft:e,fields:t,onClose:s,onConfirm:n,keyLabel:r,onKey:i,keyChoices:d}){const{width:h,height:f}=(0,u.default)(),m=h>=820;e.only&&(t=t.filter(t=>e.only.includes(t.key)));const[k,b]=(0,l.useState)(()=>Object.fromEntries(t.map(t=>[t.key,(0,x.isBlank)(e.vals[t.key])?'':String(e.vals[t.key])]))),[j,w]=(0,l.useState)(()=>e.categories.map(e=>({name:e.name,amount:String(e.amount)}))),[C,T]=(0,l.useState)(!1),v=Object.fromEntries(t.map(e=>[e.key,'text'===e.kind?k[e.key]?.trim()||null:(0,x.parseAmount)(k[e.key]??'',e.kind)])),S=t.filter(e=>'text'!==e.kind&&(k[e.key]??'').trim()&&null==v[e.key]).map(e=>e.key),D=(0,x.missing)(t,v),I=j.map(e=>({name:e.name.trim(),amount:(0,x.parseAmount)(e.amount)})).filter(e=>e.name),P=I.some(e=>null==e.amount),M=e=>({minHeight:42,borderRadius:10,borderWidth:e?2:1,borderColor:e?y.colours.amber:'rgba(255,255,255,0.15)',backgroundColor:e?'rgba(232,168,56,0.08)':'#141312',color:y.colours.text,paddingHorizontal:10,fontSize:17}),B=(0,$.jsx)(c.default,{testID:"review-photos",style:{gap:8,flex:m?1:void 0},children:e.photos.length?e.photos.map((t,s)=>(0,$.jsx)(R,{p:t,h:m?Math.max(300,.62*f/Math.min(2,e.photos.length)):260},s)):(0,$.jsx)(p.Muted,{children:"No photo: typed by hand."})}),L=(0,$.jsxs)(c.default,{testID:"review-fields",style:{gap:8,flex:m?1:void 0},children:[(0,$.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(p.Muted,{children:r}),d.map(t=>(0,$.jsx)(p.Chip,{label:t.label,selected:e.key===t.value,onPress:()=>i(t.value)},t.value))]}),t.map(e=>{const t='text'!==e.kind&&!(k[e.key]??'').trim()||S.includes(e.key);return(0,$.jsxs)(c.default,{style:{gap:3},children:[(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.T,{weight:"semibold",size:14,children:e.label}),t&&'text'!==e.kind?(0,$.jsx)(p.Badge,{kind:"amber",label:S.includes(e.key)?'Check this':'Not read: type it'}):null]}),(0,$.jsx)(o.TextInput,{testID:`review-${e.key}`,value:k[e.key]??'',onChangeText:t=>b(s=>({...s,[e.key]:t})),keyboardType:'text'===e.kind?'default':'decimal-pad',placeholder:'money'===e.kind?'\xa3':'number'===e.kind?'Number':'Optional',placeholderTextColor:"#777",style:M(t)})]},e.key)}),'sales'===e.kind?(0,$.jsxs)(c.default,{testID:"review-categories",style:{gap:6},children:[(0,$.jsx)(p.T,{weight:"semibold",size:14,children:"Sales by category (if the printout has them)"}),j.map((e,t)=>(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(o.TextInput,{value:e.name,onChangeText:e=>w(s=>s.map((s,a)=>a===t?{...s,name:e}:s)),placeholder:"e.g. Food",placeholderTextColor:"#777",style:[M(!1),{flex:2}]}),(0,$.jsx)(o.TextInput,{value:e.amount,onChangeText:e=>w(s=>s.map((s,a)=>a===t?{...s,amount:e}:s)),placeholder:"\xa3",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:[M(!e.amount.trim()||null==(0,x.parseAmount)(e.amount)),{flex:1}]}),(0,$.jsx)(a.GoldClose,{size:"sm",label:"Remove category",onPress:()=>w(e=>e.filter((e,s)=>s!==t))})]},t)),(0,$.jsx)(p.Button,{small:!0,kind:"secondary",testID:"review-add-cat",label:"Add a category",onPress:()=>w(e=>[...e,{name:'',amount:''}])})]}):null]});return(0,$.jsxs)(p.Sheet,{visible:!0,onClose:s,title:'cashup'===e.kind?'Check the cash up':'Check the weekly sales',maxWidth:1100,testID:"review-sheet",children:[(0,$.jsx)(p.Muted,{children:"Tip: check each figure against the photo. Nothing is saved until you tap Confirm. Amber boxes weren\u2019t read: type them, or leave them blank if the sheet doesn\u2019t have them."}),'edit'===e.reader||e.only?null:e.reader?(0,$.jsx)(p.Banner,{kind:"info",title:"Read from the photo",children:e.note}):e.photos.length?(0,$.jsx)(p.Banner,{kind:"info",title:"Type it from the photo",children:e.note}):null,m?(0,$.jsxs)(c.default,{style:{flexDirection:'row',gap:14},children:[B,L]}):(0,$.jsxs)($.Fragment,{children:[B,L]}),D.length?(0,$.jsxs)(p.Muted,{children:[D.length," figure",1===D.length?'':'s'," still blank. Blank means \u201cnot on the sheet\u201d, never zero."]}):null,(0,$.jsxs)(p.Row,{gap:8,children:[(0,$.jsx)(p.Button,{testID:"review-confirm",label:C?'Saving\u2026':'Confirm and save',disabled:C||!!S.length||P||!t.some(e=>'text'!==e.kind&&null!=v[e.key]),onPress:async()=>{T(!0),await n(v,I.map(e=>({name:e.name,amount:e.amount}))),T(!1)}}),(0,$.jsx)(p.Button,{kind:"secondary",label:"Cancel",onPress:s})]})]})}function z({data:e,height:t=140,testID:s,fmt:a=P}){const o=Math.max(1,...e.map(e=>e.value??0));return(0,$.jsxs)(c.default,{testID:s,style:{gap:4},children:[(0,$.jsx)(c.default,{style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:t},children:e.map((e,s)=>(0,$.jsxs)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'flex-end',height:t},children:[null!=e.value?(0,$.jsx)(p.T,{size:9,colour:y.colours.muted,children:a(e.value).replace('.00','')}):null,(0,$.jsx)(c.default,{style:{width:'80%',height:null==e.value?2:Math.max(3,e.value/o*(t-16)),borderRadius:4,backgroundColor:null==e.value?'#333':e.hi?y.colours.goldLight:y.colours.gold,opacity:null==e.value?.6:1}})]},s))}),(0,$.jsx)(c.default,{style:{flexDirection:'row',gap:4},children:e.map((e,t)=>(0,$.jsx)(p.T,{size:9,colour:y.colours.muted,style:{flex:1,textAlign:'center'},children:e.label},t))})]})}function A({rid:e,today:s}){const a=(0,f.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e),o=(0,f.useCashUp)(e=>e.sales).filter(t=>t.rid===e),l=(0,x.dailySeries)(a,s,14),n=(0,x.dailySeries)(a,s,14,x.combinedTips),r=(0,x.weekStartOf)(s),i=Array.from({length:8},(e,t)=>(0,x.addDaysYmd)(r,7*(t-7))).map(e=>{const t=o.find(t=>t.weekStart===e&&t.confirmedAt),s=t?.vals.net;return{label:M(e).split(' ').slice(1).join(' '),value:'number'==typeof s?s:null,hi:e===r}}),d=[...o].filter(e=>e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0],h=d?(0,x.weekCompare)(o,d.weekStart):null,u=d?.categories??[],m=Math.max(1,...u.map(e=>e.amount)),k=d?(0,x.weekCompare)(o,d.weekStart,'covers'):null;return(0,$.jsxs)(c.default,{testID:"cash-charts",style:{gap:12},children:[(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Takings, last 14 days"}),(0,$.jsx)(p.Muted,{children:"Card + cash from confirmed cash ups. A grey line means no cash up that day."}),(0,$.jsx)(z,{testID:"chart-daily",data:l.map(e=>({label:M(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Tips, last 14 days"}),(0,$.jsx)(p.Muted,{children:"Cash + card tips, team total."}),(0,$.jsx)(z,{testID:"chart-tips",height:100,data:n.map(e=>({label:M(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Weekly net sales"}),h&&null!=h.now?(0,$.jsx)(c.default,{testID:"week-compare",children:(0,$.jsxs)(p.T,{size:15,children:["Week of ",M(d.weekStart),": ",P(h.now),null!=h.prev?` \xb7 week before ${P(h.prev)}`:'',null!=h.change?` \xb7 ${h.change>=0?'\u25b2':'\u25bc'} ${Math.abs(h.change)}%`:'']})}):(0,$.jsx)(p.Muted,{children:"No weekly sales report yet."}),k&&null!=k.now?(0,$.jsxs)(p.Muted,{children:["Covers ",k.now,null!=k.prev?` (week before ${k.prev})`:'']}):null,(0,$.jsx)(z,{testID:"chart-weekly",data:i})]}),u.length?(0,$.jsxs)(p.Card,{children:[(0,$.jsxs)(p.T,{weight:"semibold",children:["By category, week of ",M(d.weekStart)]}),(0,$.jsx)(c.default,{testID:"chart-categories",style:{gap:6},children:u.map(e=>(0,$.jsxs)(c.default,{style:{gap:2},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(p.T,{size:14,children:e.name}),(0,$.jsx)(p.T,{size:14,colour:y.colours.goldLight,children:P(e.amount)})]}),(0,$.jsx)(c.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2826')},children:(0,$.jsx)(c.default,{style:{width:e.amount/m*100+"%",height:10,borderRadius:5,backgroundColor:y.colours.gold}})})]},e.name))})]}):null]})}function U(e){const t=(0,f.useCashSettings)(e),s=(0,m.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings.cashUpRecord);return(0,l.useMemo)(()=>({...t,record:s,cashFields:(0,x.cashFieldsForRecord)(t.cashFields,s)}),[t,s])}const F=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}):'',W=e=>`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`;function N({rid:e,tonight:t,who:s}){const a=U(e),o=(0,f.useCashUp)(e=>e.cashUps).find(s=>s.rid===e&&s.date===t),[r,i]=(0,l.useState)(null),[d,u]=(0,l.useState)(null),[m,k]=(0,l.useState)(!1),b=!!o?.confirmedAt,j=async e=>{if(b)return;const s=e?await(0,w.pickPhotos)({source:e}):[];if(e&&!s.length)return void u('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');let o,l={vals:{},reader:null,note:'Type the figures from the sheet.'};s.length&&(k(!0),u('Reading the photo\u2026'),o=await Promise.all(s.map((e,s)=>(0,w.uploadPhoto)('cashup',t,e,s))),l=await(0,C.readSheet)('cashup',o.filter(e=>!!e),a.cashFields),k(!1),u(null)),i({kind:'cashup',key:t,photos:s,vals:l.vals,categories:[],unread:(0,x.missing)(a.cashFields,l.vals),note:l.note,reader:l.reader,uploaded:o})},T=async a=>{if(!r||b)return void i(null);const o=r.uploaded&&r.uploaded.length===r.photos.length?r.uploaded:await Promise.all(r.photos.map((e,s)=>(0,w.uploadPhoto)('cashup',t,e,s))),l=r.photos.map((e,t)=>o[t]??e);f.useCashUp.getState().saveCashUp({rid:e,date:t,vals:a,photos:l,confirmedBy:s.name,confirmedAt:(new Date).toISOString(),readBy:r.reader});const d=B(a);u(`Tonight\u2019s cash up is saved and signed off${d?`: ${d}`:''}.${o.some(e=>null==e)&&r.photos.length?' The photo will be sent when this phone is back online.':''}`);try{n.default.announceForAccessibility?.(`Saved and signed off. ${d}`)}catch{}i(null)};return(0,$.jsxs)(c.default,{testID:"cashup-screen",style:{gap:12,alignItems:'center',width:'100%'},children:[d?(0,$.jsx)(p.Banner,{kind:"info",children:d}):null,(0,$.jsx)(p.Card,{highlight:y.colours.gold,children:(0,$.jsxs)(c.default,{testID:"closer-cashup",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:20,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Tonight\u2019s cash up"}),(0,$.jsxs)(p.T,{center:!0,size:15,colour:y.colours.muted,testID:"closer-day",children:[M(t)," \xb7 ",W(t)]}),b?(0,$.jsxs)(c.default,{testID:"closer-done",accessible:!0,accessibilityLabel:`Tonight's cash up is done. Submitted by ${o?.confirmedBy??'someone'} at ${F(o?.confirmedAt)}. ${B(o.vals)}. It is signed off. If something is wrong, ask an owner to unlock it.`,style:{alignItems:'center',gap:6,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:18,weight:"semibold",colour:y.colours.goldLight,children:"Done and signed off"}),(0,$.jsxs)(p.T,{center:!0,size:15,children:["Submitted by ",o?.confirmedBy??'\u2014'," at ",F(o?.confirmedAt)]}),(0,$.jsx)(p.T,{center:!0,size:15,children:B(o.vals)||'No figures'}),o.photos.length?(0,$.jsxs)(p.Muted,{center:!0,size:13,children:[o.photos.length," photo",o.photos.length>1?'s':''," of the taking sheet sent to the owners."]}):null,(0,$.jsx)(p.Muted,{center:!0,size:13,children:"If something is wrong, ask an owner to unlock it."})]}):(0,$.jsxs)($.Fragment,{children:[a.record?.length?(0,$.jsxs)(c.default,{testID:"cashup-record",accessibilityLabel:`What to record at nightly cash up. ${a.record.join(', ')}`,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"What to record"}),a.record.map(e=>(0,$.jsx)(p.T,{center:!0,children:e},e))]}):null,(0,$.jsx)(h.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:m,onPress:()=>{j('camera')},style:({pressed:e})=>({minHeight:64,width:'100%',borderRadius:16,backgroundColor:e?y.colours.goldLight:y.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:m?.5:1}),children:(0,$.jsx)(p.T,{center:!0,size:20,weight:"semibold",colour:y.colours.onGold,children:m?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,$.jsx)(p.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{j('gallery')}}),(0,$.jsx)(p.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{j(null)}})]}),(0,$.jsx)(p.Muted,{center:!0,size:13,children:"Check the figures, then Confirm. Once confirmed it\u2019s signed off, and the photo goes to the owners only."})]})]})}),(0,$.jsx)(p.Muted,{center:!0,size:12,testID:"closer-note",children:"You can do tonight\u2019s cash up only. Past takings, charts and sales reports are for owners and managers."}),r?(0,$.jsx)(L,{draft:r,fields:a.cashFields,onClose:()=>i(null),onConfirm:e=>T(e),keyLabel:"Day",keyChoices:[{label:'Tonight',value:t}],onKey:()=>{}},`closer-${r.photos.length}`):null]})}function E({rid:e,today:t,canEdit:s,who:a,chartsOnly:o,backdate:r}){const i=U(e),d=(0,f.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e).sort((e,t)=>t.date.localeCompare(e.date)),u=(0,f.useCashUp)(e=>e.sales).filter(t=>t.rid===e).sort((e,t)=>t.weekStart.localeCompare(e.weekStart)),[m,k]=(0,l.useState)(null),[b,j]=(0,l.useState)(null),D=(0,v.useLockedFor)(e),[I,R]=(0,l.useState)(!1),[z,F]=(0,l.useState)(null),W=async(e,s,a,o)=>{const l=a??('cashup'===e?t:(0,x.weekStartOf)((0,x.addDaysYmd)(t,-7)));if(D(e,l))return void j((0,v.lockedMessage)(e,l));const n=s?await(0,w.pickPhotos)({source:s}):[];if(s&&!n.length)return void j('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');const r='cashup'===e?i.cashFields:i.salesFields;let h,c={vals:{},reader:null,note:'Type the figures from the sheet.',categories:[]};n.length&&(R(!0),j('Reading the photo\u2026'),h=await Promise.all(n.map((t,s)=>(0,w.uploadPhoto)(e,l,t,s))),c=await(0,C.readSheet)(e,h.filter(e=>!!e),r),R(!1),j(null));const u=o&&'cashup'===e?d.find(e=>e.date===l)?.vals:void 0;k({kind:e,key:l,photos:n,vals:u?{...c.vals,...u}:c.vals,categories:c.categories??[],unread:(0,x.missing)(r,c.vals),note:c.note,reader:o?'edit':c.reader,uploaded:h,only:o})},N=[0,1,2].map(e=>({label:0===e?'Today':1===e?'Yesterday':M((0,x.addDaysYmd)(t,-e)),value:(0,x.addDaysYmd)(t,-e)}));'cashup'!==m?.kind||N.some(e=>e.value===m.key)||N.push({label:M(m.key),value:m.key});const E=[0,1,2].map(e=>{const s=(0,x.weekStartOf)((0,x.addDaysYmd)(t,-7*e));return{label:0===e?'This week':1===e?'Last week':`w/c ${M(s)}`,value:s}});return(0,$.jsxs)(c.default,{testID:"cashup-screen",style:{gap:12},children:[(0,$.jsx)(p.Muted,{children:"Tip: at the end of the night, tap Take a picture of the taking sheet: the figures are filled in from the photo for you to check beside it, then Confirm. Bigger venues can Upload a spreadsheet (CSV or Excel) for one night or several. Gross takings feed Spend per head. Head Chefs can see the graphs."}),b?(0,$.jsx)(p.Banner,{kind:"info",children:b}):null,(0,$.jsx)(V,{rid:e,today:t,manage:s,who:a}),s&&!o?(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"End of night cash up"}),i.record?.length?(0,$.jsxs)(c.default,{testID:"cashup-record",accessibilityLabel:`What to record at nightly cash up. ${i.record.join(', ')}`,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,weight:"bold",colour:y.colours.gold,children:"What to record at nightly cash up"}),i.record.map(e=>(0,$.jsx)(p.T,{center:!0,children:e},e))]}):null,(0,$.jsx)(h.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:I,onPress:()=>{W('cashup','camera')},style:({pressed:e})=>({minHeight:64,borderRadius:16,backgroundColor:e?y.colours.goldLight:y.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:I?.5:1}),children:(0,$.jsx)(p.T,{size:20,weight:"semibold",colour:y.colours.onGold,children:I?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(p.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{W('cashup','gallery')}}),(0,$.jsx)(p.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{W('cashup',null)}}),(0,$.jsx)(p.Button,{testID:"cashup-sheet",kind:"secondary",label:"Upload a spreadsheet",accessibilityLabel:"Upload a spreadsheet of takings, CSV or Excel, for one night or several",onPress:async()=>{const e=await(0,T.pickSpreadsheet)();e&&('error'in e?j(e.error):F(e))}}),(0,$.jsx)(p.Button,{testID:"cashup-takings",kind:"secondary",label:"Enter takings",accessibilityLabel:"Enter tonight's takings: gross, and food and drink if you have them",onPress:()=>{W('cashup',null,t,x.TAKINGS_KEYS)}})]}),(0,$.jsx)(p.T,{weight:"semibold",style:{marginTop:8},children:"Weekly sales report"}),(0,$.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,$.jsx)(p.Button,{testID:"upload-sales",label:"Upload weekly sales report",onPress:()=>{W('sales','camera')}}),(0,$.jsx)(p.Button,{testID:"sales-gallery",kind:"secondary",label:"Choose from gallery",onPress:()=>{W('sales','gallery')}}),(0,$.jsx)(p.Button,{testID:"sales-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{W('sales',null)}})]}),(0,$.jsx)(p.Muted,{children:"Several pages? Pick them all at once. Fields can be changed in Settings \u203a Advanced \u203a Cash up."})]}):null,s&&r&&!o?(0,$.jsx)(O,{today:t,has:e=>d.some(t=>t.date===e),paid:t=>(0,S.paidOutFor)(t,f.useCashUp.getState().pot,e),onOpen:e=>{if(D('cashup',e))return void j((0,v.lockedMessage)('cashup',e));const t=d.find(t=>t.date===e);k({kind:'cashup',key:e,photos:t?.photos??[],vals:t?.vals??{},categories:[],unread:[],note:t?'':'Type the figures for that day.',reader:'edit'})}}):null,(0,$.jsx)(A,{rid:e,today:t}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Recent cash ups"}),d.length?d.slice(0,10).map(e=>(0,$.jsxs)(c.default,{testID:`cashup-row-${e.date}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)',gap:2},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(p.T,{weight:"semibold",children:M(e.date)}),(0,$.jsx)(p.T,{colour:y.colours.goldLight,children:P((0,x.takings)(e.vals))})]}),(0,$.jsx)(p.Muted,{children:i.cashFields.filter(e=>'text'!==e.kind&&'card'!==e.key&&'cash'!==e.key).map(t=>`${t.label} ${(0,x.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?P(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),(0,$.jsxs)(p.Muted,{children:["Confirmed by ",e.confirmedBy??'\u2014',e.photos.length?` \xb7 ${e.photos.length} photo${e.photos.length>1?'s':''}`:'']}),(0,S.historyLines)(e.vals).slice(0,3).map(t=>(0,$.jsx)(p.Muted,{size:12,testID:`cashup-later-${e.date}`,children:t},t)),s&&!D('cashup',e.date)?(0,$.jsxs)(p.Row,{gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit",onPress:()=>k({kind:'cashup',key:e.date,photos:e.photos,vals:e.vals,categories:[],unread:[],note:'',reader:'edit'})}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:`takings-edit-${e.date}`,label:null==(0,x.grossOf)(e.vals)?'Add takings':'Edit takings',onPress:()=>k({kind:'cashup',key:e.date,photos:[],vals:e.vals,categories:[],unread:[],note:'',reader:'edit',only:x.TAKINGS_KEYS})})]}):null,s?(0,$.jsx)(v.CashLockControls,{kind:"cashup",item:e,label:M(e.date)}):null]},e.id)):(0,$.jsx)(p.Muted,{children:"None yet."})]}),(0,$.jsxs)(p.Card,{children:[(0,$.jsx)(p.T,{weight:"semibold",children:"Weekly sales reports"}),u.length?u.slice(0,8).map(e=>(0,$.jsxs)(c.default,{style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,$.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(p.T,{weight:"semibold",children:["w/c ",M(e.weekStart)]}),(0,$.jsx)(p.T,{colour:y.colours.goldLight,children:P('number'==typeof e.vals.net?e.vals.net:null)})]}),(0,$.jsx)(p.Muted,{children:i.salesFields.filter(e=>'net'!==e.key).map(t=>`${t.label} ${(0,x.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?P(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),s?(0,$.jsx)(v.CashLockControls,{kind:"sales",item:e,label:`w/c ${M(e.weekStart)}`}):null]},e.id)):(0,$.jsx)(p.Muted,{children:"None yet."})]}),z?(0,$.jsx)(T.SpreadsheetImport,{rid:e,file:z,who:a,locked:e=>D('cashup',e),onClose:()=>F(null),onSaved:e=>{j(e),F(null)}}):null,m?(0,$.jsx)(L,{draft:m,fields:'cashup'===m.kind?i.cashFields:i.salesFields,onClose:()=>k(null),onConfirm:async(s,o)=>{if(!m)return;if(D(m.kind,m.key))return j((0,v.lockedMessage)(m.kind,m.key)),void k(null);const l=m.uploaded&&m.uploaded.length===m.photos.length?m.uploaded:await Promise.all(m.photos.map((e,t)=>(0,w.uploadPhoto)(m.kind,m.key,e,t))),r=m.photos.map((e,t)=>l[t]??e),i=(new Date).toISOString();if('cashup'===m.kind){const o=d.find(e=>e.date===m.key),l=m.only&&o?{...o.vals,...s}:s,h=m.keynull==e)&&m.photos.length&&j(e=>`${e??''} The photo is kept on this device only (not signed in or offline).`),k(null)},keyLabel:'cashup'===m.kind?'Day':'Week starting',keyChoices:'cashup'===m.kind?N:E,onKey:e=>k({...m,key:e})},`${m.kind}-${m.photos.length}`):null]})}function O({today:e,has:t,paid:a,onOpen:o}){const[n,r]=(0,l.useState)((0,x.addDaysYmd)(e,-1)),[i,d]=(0,l.useState)((0,I.ukHistoryDate)((0,x.addDaysYmd)(e,-1))),[h,u]=(0,l.useState)(!1),f=(0,I.parseHistoryInput)(i)??'',m=(0,S.backdateProblem)(f,e),k=m?n:f,b=!m&&t(k),j=m?null:a(k),w=e=>{r(e),d((0,I.ukHistoryDate)(e))};return(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsxs)(c.default,{testID:"cashup-backdate",style:{gap:10,alignItems:'center',width:'100%'},children:[(0,$.jsx)(p.T,{center:!0,size:20,weight:"bold",colour:y.colours.gold,accessibilityRole:"header",children:"Cash up for another day"}),(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.text,children:"Missed a night? Enter or correct takings and tips for any past day. It counts on that day everywhere."}),(0,$.jsx)(c.default,{style:{width:'100%',maxWidth:360},children:(0,$.jsx)(p.Field,{label:"Day (DD/MM/YYYY)",value:i,onChangeText:e=>d((0,s.slashDate)(e,i)),placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"cashup-backdate-date",style:{textAlign:'center'},accessibilityLabel:"Day of the cash up, as day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1})}),m?(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.amber,testID:"cashup-backdate-problem",children:m}):(0,$.jsx)(c.default,{accessible:!0,accessibilityLiveRegion:"polite",testID:"cashup-backdate-status",children:(0,$.jsx)(p.T,{center:!0,size:15,colour:y.colours.goldLight,children:b?`There is already a cash up for ${M(k)}: it opens for editing.`:`No cash up yet for ${M(k)}.`})}),j?(0,$.jsx)(c.default,{testID:"cashup-backdate-paid",style:{borderWidth:1,borderColor:y.colours.amber,borderRadius:10,padding:10,maxWidth:520},children:(0,$.jsxs)(p.T,{center:!0,size:14,colour:y.colours.amber,children:["Tips up to ",M(j.throughDate)," were already paid out. Tips you add for this day won\u2019t be in the pot automatically: add a correction in the Tips pot if they should still be shared."]})}):null,(0,$.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center'},children:[(0,$.jsx)(p.Button,{kind:"secondary",label:"Pick a date",testID:"cashup-backdate-pick",accessibilityLabel:`Pick a day from a calendar. Now ${m?'no valid day':M(k)}`,onPress:()=>u(!0),style:{minHeight:56}}),(0,$.jsx)(p.Button,{label:m?'Open cash up':b?`Edit cash up for ${M(k)}`:`Add cash up for ${M(k)}`,testID:"cashup-backdate-open",disabled:!!m,accessibilityLabel:m?'Open cash up, enter a valid past day first':`${b?'Edit':'Add'} the cash up for ${M(k)}`,onPress:()=>{w(k),o(k)},style:{minHeight:56}})]}),(0,$.jsxs)(p.Muted,{center:!0,children:["Saved with your name and the time, e.g. \u201cAdded later by you, ",M(e),"\u201d. Nothing is sent to anyone."]})]}),(0,$.jsx)(D.LookBackCalendar,{visible:h,today:e,selected:m?n:k,purpose:"Cash up for another day",idPrefix:"cashup-backdate",onClose:()=>u(!1),onPick:e=>{w(e),u(!1)}})]})}function Y({n:e,testID:t}){const s=Math.max(1,Math.min(14,e));return(0,$.jsx)(c.default,{testID:t,style:{width:64,height:114,justifyContent:'flex-end'},children:Array.from({length:s}).map((e,t)=>(0,$.jsx)(H,{delay:50*t},t))})}function H({delay:e}){const t=(0,l.useRef)(new r.default.Value(1)).current;return(0,l.useEffect)(()=>{r.default.timing(t,{toValue:0,duration:420,delay:e,easing:i.default.out(i.default.back(1.6)),useNativeDriver:!1}).start()},[]),(0,$.jsx)(r.default.View,{style:{height:7,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[0,-120]})}],opacity:t.interpolate({inputRange:[0,1],outputRange:[1,0]})},children:(0,$.jsx)(c.default,{style:{width:60,height:12,borderRadius:30,backgroundColor:y.colours.gold,borderWidth:1,borderColor:y.colours.goldLight}})})}function G(e){const[t,s]=(0,l.useState)(e),a=(0,l.useRef)(e);return(0,l.useEffect)(()=>{const t=a.current,o=e;if(t===o)return;const l=Date.now(),n=setInterval(()=>{const e=Math.min(1,(Date.now()-l)/1200);s(Math.round(100*(t+(o-t)*(1-Math.pow(1-e,3))))/100),e>=1&&(clearInterval(n),a.current=o)},40);return()=>clearInterval(n)},[e]),t}function V({rid:e,today:t,manage:s,who:a,big:o}){const n=(0,f.useTipsShow)(e),r=(0,f.useCashUp)(e=>e.tips).filter(t=>t.rid===e),i=(0,f.useCashUp)(e=>e.pot).filter(t=>t.rid===e),d=(0,b.useVenuePay)(e).pay,h=(0,k.tipsPeriod)(d,t),u=(0,l.useMemo)(()=>(0,x.tipsPot)(r,i,h.start,t),[r,i,h.start,t]),m=G(u.total),[j,w]=(0,l.useState)(null);return n.showPot||s?(0,$.jsxs)(p.Card,{highlight:y.colours.gold,children:[(0,$.jsxs)(c.default,{testID:"tips-pot",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,$.jsx)(Y,{n:Math.ceil(u.total/100),testID:"tips-pot-coins"},u.total),(0,$.jsxs)(c.default,{style:{flex:1,gap:2},children:[(0,$.jsx)(p.T,{size:12,weight:"semibold",colour:y.colours.gold,style:{letterSpacing:1.5},children:"TIPS POT"}),(0,$.jsx)(p.T,{size:o?40:32,weight:"bold",colour:y.colours.goldLight,children:P(m)}),(0,$.jsxs)(p.Muted,{children:["Tips held for the team since ",M(u.from),h.payday?` \xb7 next tip payday ${M(h.payday)}`:'',". Confirmed cash ups only.",n.showPot?'':' (Hidden from staff.)']})]})]}),s?(0,$.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,$.jsx)(p.Button,{small:!0,kind:"secondary",testID:"pot-payout",label:"Mark payout done",onPress:()=>w('payout')}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:"pot-correct",label:"Correct an entry",onPress:()=>w('correct')}),(0,$.jsx)(p.Button,{small:!0,kind:"ghost",testID:"pot-history",label:"Past pots",onPress:()=>w('history')})]}):null,'payout'===j?(0,$.jsxs)(p.Sheet,{visible:!0,onClose:()=>w(null),title:"Mark payout done",maxWidth:520,testID:"pot-payout-sheet",children:[(0,$.jsxs)(p.T,{children:["Pay out ",P(u.total)," (tips from ",M(u.from)," to ",M(t),")?"]}),(0,$.jsx)(p.Muted,{children:"The pot goes back to \xa30.00 for the next period. This is logged and kept in Past pots. No money is moved by the app."}),(0,$.jsx)(p.Button,{testID:"pot-payout-confirm",label:"Yes, payout done",onPress:()=>{f.useCashUp.getState().addPotEvent({rid:e,kind:'payout',throughDate:t,amount:u.total,by:a?.name??'Manager'}),w(null)}})]}):null,'correct'===j?(0,$.jsx)(_,{rid:e,today:t,who:a,onClose:()=>w(null)}):null,'history'===j?(0,$.jsxs)(p.Sheet,{visible:!0,onClose:()=>w(null),title:"Past pots and corrections",maxWidth:560,testID:"pot-history-sheet",children:[u.history.length||i.some(e=>'correction'===e.kind)?null:(0,$.jsx)(p.Muted,{children:"No payouts or corrections yet."}),i.slice().sort((e,t)=>t.at.localeCompare(e.at)).map(e=>(0,$.jsxs)(c.default,{style:{paddingVertical:4},children:[(0,$.jsx)(p.T,{weight:"semibold",children:'payout'===e.kind?`Paid out ${P(e.amount)}`:`Correction ${e.amount>=0?'+':'\u2212'}${P(Math.abs(e.amount))} for ${M(e.forDate)}`}),(0,$.jsxs)(p.Muted,{children:['payout'===e.kind?`Tips to ${M(e.throughDate)}`:`\u201c${e.reason}\u201d`," \xb7 ",e.by," \xb7 ",new Date(e.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]})]},e.id))]}):null]}):null}function _({rid:e,today:s,who:a,onClose:n}){const[r,i]=(0,l.useState)(s),[d,h]=(0,l.useState)(''),[c,u]=(0,l.useState)(''),m=(0,x.parseAmount)(d),k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',backgroundColor:(0,t.soutersSurface)('#141312'),color:y.colours.text,paddingHorizontal:10,fontSize:16};return(0,$.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Correct an entry",maxWidth:520,testID:"pot-correct-sheet",children:[(0,$.jsx)(p.Muted,{children:"Tip: add or take off an amount for a day (use a minus for less, e.g. -5). Every correction is logged with your name and the reason."}),(0,$.jsx)(p.Row,{wrap:!0,gap:6,children:[0,1,2,3].map(e=>{const t=(0,x.addDaysYmd)(s,-e);return(0,$.jsx)(p.Chip,{label:0===e?'Today':M(t),selected:r===t,onPress:()=>i(t)},t)})}),(0,$.jsx)(o.TextInput,{testID:"pot-correct-amount",value:d,onChangeText:h,placeholder:"\xa3 e.g. -5.00",placeholderTextColor:"#777",keyboardType:"numbers-and-punctuation",style:k}),(0,$.jsx)(o.TextInput,{testID:"pot-correct-reason",value:c,onChangeText:u,placeholder:"Reason (required)",placeholderTextColor:"#777",maxLength:200,style:k}),(0,$.jsx)(p.Button,{testID:"pot-correct-save",label:"Save correction",disabled:null==m||0===m||!c.trim(),onPress:()=>{f.useCashUp.getState().addPotEvent({rid:e,kind:'correction',forDate:r,amount:m,reason:c.trim(),by:a?.name??'Manager'}),n()}})]})}function K(e,t,s,a){if(!Number.isFinite(s))return;const o=`${e}:${t}`;f.useCashUp.getState().seen[o]!==s&&(f.useCashUp.getState().markSeen(o,s),(0,j.notify)({id:`tips-${o}`,icon:'\ud83e\ude99',kicker:'TIPS',title:`${t===a?'Today\u2019s':'Last night\u2019s'} tips: ${P(s)}`,body:'Cash + card tips for the whole team. Added to the Tips pot. Thank you, everyone.',testID:'tips-notice',timeoutMs:12e3,actions:[{label:'Nice',testID:'tips-notice-ok',onPress:()=>{}}]}))}function Z(e,t,s){return e.filter(e=>e.rid===t&&e.date>=(0,x.addDaysYmd)(s,-1)&&e.date<=s).sort((e,t)=>t.date.localeCompare(e.date))[0]}},1046,[876,834,835,874,31,119,121,225,197,264,128,288,818,825,1048,881,13,1184,1185,980,1070,1402,1403,1406,1407,1408,1176,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useCashAccess",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"hasCashUpAccess",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({byRef:{},mine:null,loaded:!1,takings:null,tradingDate:null,photos:null})),n=()=>!0===t.getState().mine},1047,[995]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"cashUpId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"salesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"cashSettingsId",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"defaultCashSettings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useCashUp",{enumerable:!0,get:function(){return b}}),_e.forgetPastTakings=function(e,t){const s=b.getState(),n=s.cashUps.filter(s=>s.rid!==e||s.date===t),r=s.sales.filter(t=>t.rid!==e);n.length===s.cashUps.length&&r.length===s.sales.length||b.setState({cashUps:n,sales:r})},Object.defineProperty(_e,"useCashSettings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useTipsShow",{enumerable:!0,get:function(){return y}});var t=e(_r(d[0])),s=e(_r(d[1])),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]),u=_r(d[5]),l=_r(d[6]);const c=(e,t)=>(0,o.uuidFrom)(`cashup:${e}:${t}`),p=(e,t)=>(0,o.uuidFrom)(`sales:${e}:${t}`),h=e=>(0,o.uuidFrom)(`cashup-settings:${e}`),f=e=>({id:h(e),cashFields:u.DEFAULT_CASHUP_FIELDS.map(e=>({...e})),salesFields:u.DEFAULT_SALES_FIELDS.map(e=>({...e}))}),S=e=>{const t='number'==typeof e.vals.cashTips?e.vals.cashTips:null,s='number'==typeof e.vals.cardTips?e.vals.cardTips:null;return!e.confirmedAt||null==t&&null==s?null:{rid:e.rid,date:e.date,total:Math.round(100*((t??0)+(s??0)))/100,postedAt:e.confirmedAt,postedBy:e.confirmedBy}},b=(0,n.create)()((0,r.persist)((e,t)=>({cashUps:[],sales:[],tips:[],pot:[],settings:{},show:{},seen:{},saveCashUp:t=>{const s={...t,id:c(t.rid,t.date)},n=S(s);return e(e=>({cashUps:[s,...e.cashUps.filter(e=>e.id!==s.id)],tips:n?[n,...e.tips.filter(e=>!(e.rid===n.rid&&e.date===n.date))]:e.tips})),s},saveSales:t=>{const s={...t,id:p(t.rid,t.weekStart)};return e(e=>({sales:[s,...e.sales.filter(e=>e.id!==s.id)]})),s},setFields:(t,s,n)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??f(t),[s]:n,updatedAt:(new Date).toISOString()}}})),resetFields:t=>e(e=>({settings:{...e.settings,[t]:{...f(t),updatedAt:(new Date).toISOString()}}})),setShow:(t,s)=>e(e=>({show:{...e.show,[t]:{...e.show[t]??{showToday:!0,showPot:!0},...s}}})),addPotEvent:t=>e(e=>({pot:[{...t,id:(0,l.uuid)(),at:(new Date).toISOString()},...e.pot]})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:s}}))}),{name:'covercharge-cashup-v1',storage:(0,r.createJSONStorage)(()=>s.default),partialize:e=>({...e,cashUps:e.cashUps.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))})),sales:e.sales.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))}))})}));const w=e=>{const s=b(t=>t.settings[e])??f(e);return t.default.useMemo(()=>({...s,cashFields:(0,u.withTakingsFields)(s.cashFields)}),[s])},y=e=>b(t=>t.show[e])??{showToday:!0,showPot:!0}},1048,[31,1190,995,1191,1179,13,1099]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PERM_CATALOG",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PERM_KEYS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PERM_GROUPS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"permLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ROLE_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ROLE_LABEL",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ownerLevel",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"has",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ticks",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"toggle",{enumerable:!0,get:function(){return f}}),e.effectivePerms=function(t,n,a){const o=[...new Set([...t,...n])];return(o.includes('*')?o:o.filter(t=>!a.includes(t))).sort()},e.tickSource=function(t,n){return t.extra.includes(n)?'extra':t.removed.includes(n)&&!t.base.includes('*')?'removed':c(t.base,n)?'role':'off'},Object.defineProperty(e,"SOURCE_WORDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"isCloser",{enumerable:!0,get:function(){return p}}),e.tradingDay=function(t=new Date,n="Europe/London"){const a=new Date(t.getTime()-216e5),o=new Intl.DateTimeFormat('en-GB',{timeZone:n,year:'numeric',month:'2-digit',day:'2-digit'}).formatToParts(a),s=t=>o.find(n=>n.type===t)?.value??'';return`${s('year')}-${s('month')}-${s('day')}`},Object.defineProperty(e,"ukDay",{enumerable:!0,get:function(){return b}}),e.logWords=function(t){const n=t=>Array.isArray(t)?t:[],a=t=>t&&'object'==typeof t&&!Array.isArray(t)?t:{};let s=[],u=[];if('role'===t.target_kind){const a=n(t.before),o=n(t.after);s=o.filter(t=>!a.includes(t)),u=a.filter(t=>!o.includes(t))}else{const o=a(t.before),l=a(t.after),c=n(o.extra),g=n(l.extra),f=n(o.removed),d=n(l.removed);s=[...g.filter(t=>!c.includes(t)),...f.filter(t=>!d.includes(t))],u=[...d.filter(t=>!f.includes(t)),...c.filter(t=>!g.includes(t))]}const c='role'===t.target_kind?`${l[t.target_ref??'']??t.target_name??'Role'} role`:t.target_name??'Someone',g=[...s.map(t=>`+ ${o(t)}`),...u.map(t=>`\u2212 ${o(t)}`)];return`${t.changed_by_name??'Admin'}: ${c}${g.length?`, ${g.join(', ')}`:', back to their role'}`},e.logWhen=function(t){const n=new Date(t);return new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',year:'numeric',hour:'2-digit',minute:'2-digit',hour12:!1}).format(n).replace(',','')};const t=[{key:'bookings.manage',label:'Take and change bookings',group:'Bookings & floor'},{key:'bookings.settings',label:'Booking settings: times, tables and blocks',group:'Bookings & floor'},{key:'floor.manage',label:'Edit the table plan and seat tables',group:'Bookings & floor'},{key:'orders.manage',label:'Kitchen and table orders',group:'Bookings & floor'},{key:'stock.manage',label:'Stock and deliveries',group:'Kitchen & stock'},{key:'suppliers.manage',label:'Suppliers',group:'Kitchen & stock'},{key:'suppliers.order',label:'Order from suppliers',group:'Kitchen & stock'},{key:'recipes.edit',label:'Edit recipe cards and allergens',group:'Kitchen & stock'},{key:'recipes.signoff',label:'Sign off recipe cards',group:'Kitchen & stock'},{key:'attendance.view',label:'See everyone\u2019s hours',group:'Team'},{key:'rota.manage',label:'Make the rota and approve timesheets',group:'Team'},{key:'rota.kitchen',label:'Make the kitchen rota (kitchen team only)',group:'Team',note:'Add, change and publish shifts for the kitchen team in the Head Chef app. No hours, pay or takings.'},{key:'rota.swap',label:'Approve shift swaps',group:'Team'},{key:'shift.manager',label:'Shift manager features in the Staff app',group:'Team'},{key:'staff.manage',label:'Add staff and change their details',group:'Team'},{key:'takings.view',label:'See takings, past cash ups and sales reports',group:'Money',note:'Without this, \u201cCan use cash up\u201d is tonight\u2019s cash up only.'},{key:'wages.view',label:'See pay and wages',group:'Money'},{key:'wages.manage',label:'Change pay, cash-up settings and any day\u2019s cash up',group:'Money'},{key:'venue.settings',label:'Change venue settings',group:'Venue'},{key:'devices.manage',label:'Pair and remove screens',group:'Venue'},{key:'outbox.view',label:'See messages sent to guests',group:'Venue'}],n=t.map(t=>t.key),a=[...new Set(t.map(t=>t.group))],o=n=>t.find(t=>t.key===n)?.label??n,s=['owner','manager','supervisor','head_chef','staff'],l={owner:'Owner',manager:'Manager',supervisor:'Supervisor',head_chef:'Head Chef',staff:'Staff'},u=t=>t.includes('*'),c=(t,n)=>t.includes('*')||t.includes(n),g=t=>u(t)?[...n]:n.filter(n=>t.includes(n)),f=(t,n,a)=>(a?[...new Set([...t,n])]:t.filter(t=>t!==n)).sort();const d={role:'from their role',extra:'added just for them',removed:'taken off just for them',off:'off'},p=t=>t.cashUp&&!t.takings;const b=t=>/^\d{4}-\d{2}-\d{2}$/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t},1049,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtDate",{enumerable:!0,get:function(){return j}}),_e.SignOffLine=$,_e.CardView=P,_e.CardEditor=R,_e.RecipeCards=function({rid:e,actor:s,mode:l}){const h=(0,a.useRecipeCards)(e),u=(0,n.useMemo)(()=>h.filter(e=>!c.OFF_CARD_LIST.has(e.menuItemId)),[h]),[p,x]=(0,n.useState)(''),[b,j]=(0,n.useState)([]),[C,w]=(0,n.useState)('free-from'),[I,$]=(0,n.useState)('all'),[D,T]=(0,n.useState)(null),[k,S]=(0,n.useState)(null),v='edit'===l&&(0,m.canEditCards)(s.role),B=v?u:u.filter(e=>!!e.signOff),L=(0,n.useMemo)(()=>{const e='all'===I?B:B.filter(e=>(0,m.cardState)(e)===I);return(0,m.filterCards)(e,p,b,C).slice().sort((e,t)=>e.section.localeCompare(t.section)||M(e.dish).localeCompare(M(t.dish)))},[B,p,b,C,I]),O=u.filter(e=>!e.signOff).length,A=D?u.find(e=>e.id===D):void 0,N=k&&'new'!==k?u.find(e=>e.id===k)??null:null,z=e=>j(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,y.jsxs)(r.default,{testID:"recipe-cards",style:{gap:12},children:['read'===l?(0,y.jsx)(d.Banner,{kind:"info",title:"Read-only",children:"Signed-off recipe cards only. The head chef keeps these up to date."}):(0,y.jsx)(d.Muted,{center:!0,children:(0,m.maySignOff)(s,{createdBy:s.name,createdByRole:s.role})?'You can add, edit and sign off cards. A card goes live once it is signed off. Editing a card clears the sign-off.':'You can add and edit cards. The Head Chef, an owner or a manager signs it off before it goes live. Editing a card clears the sign-off.'}),u.some(e=>'example'===e.origin)?(0,y.jsx)(d.Banner,{kind:"example",title:"Example data",children:"Cards marked \u201cExample data\u201d are made-up examples to show how recipe cards work. Replace them with your own dishes."}):null,v?(0,y.jsx)(d.Button,{testID:"new-card",label:"New recipe card",onPress:()=>S('new')}):null,(0,y.jsx)(t.TextInput,{testID:"card-search",accessibilityLabel:"Search recipe cards",value:p,onChangeText:x,placeholder:"Search dishes or ingredients",placeholderTextColor:"#7D776C",style:d.styles.input}),(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.T,{size:o.font.small,colour:o.colours.muted,children:"Allergens:"}),(0,y.jsx)(d.Chip,{label:"Free from",selected:'free-from'===C,onPress:()=>w('free-from')}),(0,y.jsx)(d.Chip,{label:"Contains",selected:'contains'===C,onPress:()=>w('contains')}),b.length?(0,y.jsx)(d.Chip,{label:"Clear",onPress:()=>j([])}):null]}),(0,y.jsx)(d.Row,{gap:6,wrap:!0,children:f.ALLERGENS.map(e=>(0,y.jsx)(i.default,{testID:`filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:b.includes(e.id)},onPress:()=>z(e.id),style:{paddingVertical:5,paddingHorizontal:10,minHeight:44,minWidth:44,justifyContent:'center',borderRadius:14,borderWidth:1,borderColor:b.includes(e.id)?o.colours.gold:o.colours.border,backgroundColor:b.includes(e.id)?o.colours.gold:'transparent'},children:(0,y.jsx)(d.T,{size:13,colour:b.includes(e.id)?o.colours.onGold:o.colours.text,children:e.short})},e.id))}),v?(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.Chip,{label:`All (${u.length})`,selected:'all'===I,onPress:()=>$('all')}),(0,y.jsx)(d.Chip,{label:`Awaiting sign-off (${O})`,selected:'awaiting'===I,onPress:()=>$('awaiting')}),(0,y.jsx)(d.Chip,{label:`Signed off (${u.length-O})`,selected:'signed-off'===I,onPress:()=>$('signed-off')})]}):null,(0,y.jsx)(r.default,{testID:"card-count",children:(0,y.jsxs)(d.Muted,{center:!0,children:[L.length," ",1===L.length?'card':'cards',b.length?` ${'free-from'===C?'free from':'containing'} ${b.map(f.allergenLabel).join('free-from'===C?' and ':' or ')}`:'']})}),L.map(e=>(0,y.jsx)(E,{c:e,actor:s,mode:l,editable:v,onPress:()=>T(e.id)},e.id)),L.length?null:(0,y.jsx)(r.default,{testID:"cards-empty",style:{alignItems:'center',paddingVertical:16},children:(0,y.jsx)(d.T,{center:!0,colour:o.colours.muted,children:u.length?'No cards match.':'No recipe cards yet.'})}),(0,y.jsx)(d.Sheet,{visible:!!A&&!k,onClose:()=>T(null),title:A?.dish??'',maxWidth:640,testID:"card-sheet",children:A?(0,y.jsx)(P,{card:A,mode:l,actor:'read'===l?{...s,role:'staff'}:s,onEdit:v?()=>S(A.id):void 0}):null}),(0,y.jsx)(d.Sheet,{visible:!!k,onClose:()=>S(null),title:'new'===k?'New recipe card':`Edit: ${N?.dish??''}`,maxWidth:680,testID:"editor-sheet",children:k?(0,y.jsx)(R,{rid:e,card:N,actor:s,onDone:e=>{S(null),T(e)}},k):null})]})},Object.defineProperty(_e,"addedLabel",{enumerable:!0,get:function(){return m.addedLabel}}),Object.defineProperty(_e,"allergenSentence",{enumerable:!0,get:function(){return m.allergenSentence}}),Object.defineProperty(_e,"unsignedOldestFirst",{enumerable:!0,get:function(){return m.unsignedOldestFirst}}),_e.useUnsignedDishes=O,_e.UnsignedDishList=function({rid:e,actor:t,onClose:s,onOpenCards:l}){const i=O(e),c=(0,a.useRecipeCards)(e),[f,p]=(0,n.useState)(null),[x,b]=(0,n.useState)(null),[j,C]=(0,n.useState)(null);(0,h.useBackLayer)(!0,s);const w=x?c.find(e=>e.id===x):void 0,I=j?c.find(e=>e.id===j)??null:null,$=async e=>{try{await(0,u.recipeCards)().signOff(e.id,t),p(null)}catch(t){p({id:e.id,text:t?.message??'Could not sign off.'})}};return(0,y.jsxs)(r.default,{testID:"unsigned-list",style:{gap:12,alignItems:'stretch'},children:[(0,y.jsx)(h.BackButton,{onPress:s,testID:"unsigned-back"}),(0,y.jsx)(d.T,{center:!0,size:22,weight:"bold",colour:o.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Dishes not signed off"}),(0,y.jsx)(d.Muted,{center:!0,testID:"unsigned-status",children:i.length?`${i.length} ${1===i.length?'dish':'dishes'} waiting, oldest first.`:'Every dish is signed off.'}),i.map(({item:e,card:s,at:n})=>{const i=(0,m.allergenSentence)(s?s.allergens:e.allergens),a=!!s&&(0,m.maySignOff)(t,s),c=s?(0,m.signOffBlock)(s):null;return(0,y.jsxs)(d.Card,{highlight:o.colours.amber,style:{alignItems:'center',gap:8},children:[(0,y.jsxs)(r.default,{testID:`unsigned-row-${e.id}`,accessible:!0,accessibilityLabel:`${e.name}, ${(0,m.addedLabel)(n)}, ${i}`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,y.jsx)(d.T,{center:!0,weight:"bold",size:18,children:e.name}),(0,y.jsx)(d.T,{center:!0,children:(0,m.addedLabel)(n)}),(0,y.jsx)(d.Muted,{center:!0,children:i})]}),s&&a&&!c?(0,y.jsx)(d.Button,{testID:`unsigned-sign-${e.id}`,kind:"success",label:"Sign off",accessibilityLabel:`Sign off ${e.name} as ${t.name}`,onPress:()=>$(s),style:{alignSelf:'stretch'}}):null,s&&a&&c?(0,y.jsx)(d.Muted,{center:!0,children:c}):null,s&&!a?(0,y.jsx)(d.Muted,{center:!0,children:"Only the Head Chef, an owner or a manager can sign it off."}):null,s?(0,y.jsx)(d.Button,{small:!0,kind:"secondary",testID:`unsigned-open-${e.id}`,label:a&&c?'Check the recipe card':'Open recipe card',accessibilityLabel:`Open the recipe card for ${e.name}`,onPress:()=>b(s.id),style:{alignSelf:'stretch'}}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d.Muted,{center:!0,children:"No recipe card yet."}),l?(0,y.jsx)(d.Button,{small:!0,kind:"secondary",label:"Open recipe cards",onPress:l,style:{alignSelf:'stretch'}}):null]}),f&&s&&f.id===s.id?(0,y.jsx)(d.Banner,{kind:"danger",children:f.text}):null]},e.id)}),(0,y.jsx)(d.Sheet,{visible:!!w&&!j,onClose:()=>b(null),title:w?.dish??'',maxWidth:640,testID:"unsigned-card-sheet",children:w?(0,y.jsx)(P,{card:w,actor:t,onEdit:(0,m.canEditCards)(t.role)?()=>C(w.id):void 0}):null}),(0,y.jsx)(d.Sheet,{visible:!!j,onClose:()=>C(null),title:`Edit: ${I?.dish??''}`,maxWidth:680,testID:"unsigned-editor-sheet",children:j&&I?(0,y.jsx)(R,{rid:e,card:I,actor:t,onDone:e=>{C(null),b(e)}},j):null})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),l=e(_r(_d[3])),i=e(_r(_d[4])),r=e(_r(_d[5])),o=_r(_d[6]),d=_r(_d[7]),a=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),y=_r(_d[17]);const j=e=>{const t=new Date(e.length<=10?`${e}T12:00:00`:e);return isNaN(+t)?e:t.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})},C=e=>`\xa3${(Math.round(e)/100).toFixed(2)}`,w=e=>null==e?'Price on the board':C(e),I={example:p.EXAMPLE_TAG,imported:'Imported from the menu',new:null};function $({card:e,testID:t}){return e.signOff?(0,y.jsx)(r.default,{testID:t??'card-signed-off',accessibilityLabel:`Signed off by ${e.signOff.by}, ${j(e.signOff.at)}`,style:{alignItems:'center',gap:4,width:'100%'},children:(0,y.jsxs)(d.T,{center:!0,weight:"bold",colour:o.colours.gold,children:["Signed off by ",e.signOff.by,", ",j(e.signOff.at)]})}):(0,y.jsxs)(r.default,{testID:t??'card-signed-off',accessibilityLabel:"Not signed off yet",style:{alignItems:'center',gap:4,width:'100%'},children:[(0,y.jsx)(d.T,{center:!0,weight:"semibold",colour:o.colours.gold,children:m.STATE_LABEL.awaiting}),(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,children:c.portionCardItemIds.includes(e.menuItemId)?'A portion card for the kitchen. The dish on the menu is not changed by this card.':e.wasLive?'Edited since the last sign-off. Guests see it as awaiting sign-off until a chef signs it again.':'This dish stays off the menu until a chef signs it off.'})]})}function D({dish:e,photo:t,height:s=180,pending:n,index:i,total:a,radius:c=12}){const h=n?{uri:n}:t?(0,u.recipeCards)().photoSource(t):null,f=i&&a?`Photo ${i} of ${a}`:'Plating photo';return h?(0,y.jsx)(l.default,{testID:i?`card-photo-${i}`:'card-photo',accessibilityLabel:`${f}${e?`: ${e}`:''}`,source:h,style:{width:'100%',height:s,borderRadius:c,backgroundColor:o.colours.surface2},resizeMode:"cover"}):(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:"No plating photo yet"+(e?`, ${e}`:''),style:{width:'100%',height:s,borderRadius:c,backgroundColor:o.colours.goldTint,alignItems:'center',justifyContent:'center',borderWidth:1.5,borderColor:o.colours.gold,gap:2},children:[(0,y.jsx)(d.T,{center:!0,size:Math.min(64,Math.max(30,Math.round(.38*s))),weight:"bold",colour:o.colours.gold,children:(e.trim()[0]??'?').toUpperCase()}),s>=120?(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:o.colours.goldLight,children:"No plating photo yet"}):null]})}function T({map:e}){const t=f.ALLERGENS.filter(t=>e[t.id]).map(e=>e.id);return t.length?(0,y.jsx)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:t.map(t=>{const s='may'===e[t],n=s?`May contain ${(0,f.allergenLabel)(t).toLowerCase()}`:(0,f.allergenLabel)(t);return(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:s?n:`Contains ${(0,f.allergenLabel)(t).toLowerCase()}`,style:{paddingHorizontal:12,paddingVertical:6,borderRadius:999,borderWidth:1.5,borderColor:s?o.colours.amber:o.colours.gold,backgroundColor:s?'transparent':o.colours.gold,maxWidth:'100%'},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"semibold",center:!0,colour:s?o.colours.amber:o.colours.onGold,children:n})},t)})}):(0,y.jsx)(d.Muted,{center:!0,children:"None of the UK 14 allergens."})}const k=({label:e,gold:t,testID:s})=>(0,y.jsx)(r.default,{testID:s,style:{paddingHorizontal:12,paddingVertical:5,borderRadius:999,borderWidth:1,borderColor:t?o.colours.gold:o.colours.accentBorder,backgroundColor:t?o.colours.goldTint:o.colours.surface,maxWidth:'100%'},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"medium",center:!0,colour:t?o.colours.goldLight:o.colours.text,children:e})}),S=({title:e})=>(0,y.jsxs)(r.default,{style:{width:'100%',alignItems:'center',gap:4,paddingTop:4},children:[(0,y.jsx)(d.T,{size:13,weight:"semibold",center:!0,colour:o.colours.goldMuted,accessibilityRole:"header",children:e.toUpperCase()}),(0,y.jsx)(r.default,{style:{width:36,height:2,borderRadius:1,backgroundColor:o.colours.gold}})]});function P({card:e,actor:t,onEdit:s,mode:l="edit"}){const[i,a]=(0,n.useState)(null),c=(0,m.signOffBlock)(e),h=I[e.origin],f=(0,m.cardPhotos)(e),p=(0,m.maySignOff)(t,e),x=(0,b.useCardCosting)(e,t.role,l);return(0,y.jsxs)(r.default,{testID:"card-view",style:{gap:12,alignItems:'center',width:'100%'},children:[f.length?(0,y.jsx)(D,{dish:e.dish,photo:f[0],height:220,index:1,total:f.length,radius:18}):(0,y.jsx)(D,{dish:e.dish,height:180,radius:18}),f.length>1?(0,y.jsx)(d.Row,{gap:8,style:{width:'100%'},children:f.slice(1).map((t,s)=>(0,y.jsx)(r.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(D,{dish:e.dish,photo:t,height:72,index:s+2,total:f.length})},t))}):null,(0,y.jsx)(d.T,{center:!0,size:26,weight:"bold",colour:o.colours.gold,accessibilityRole:"header",children:e.dish}),(0,y.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[h?(0,y.jsx)(d.Badge,{label:h,kind:'example'===e.origin?'blue':'neutral'}):null,(0,y.jsx)(k,{label:e.section,gold:!0}),(0,y.jsx)(k,{label:w(e.price)}),x&&x.summary.lines.length?(0,y.jsx)(k,{testID:"card-yield",label:x.summary.batch/Math.max(1,x.summary.perPortion||1)>1.5?`Makes ${Math.round(x.summary.batch/x.summary.perPortion)} portions`:'1 portion'}):null]}),(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:`Created by ${e.createdBy||'not recorded'}`,style:{width:'100%',alignItems:'center'},children:(0,y.jsxs)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,testID:"card-created-by",children:["Created by ",e.createdBy||'Not recorded']})}),(0,y.jsx)(r.default,{style:{width:'100%',paddingVertical:8,paddingHorizontal:10,borderRadius:14,borderWidth:1,borderColor:e.signOff?o.colours.accentBorder:o.colours.amber,backgroundColor:e.signOff?o.colours.accentBg:o.colours.amberBg},children:(0,y.jsx)($,{card:e,testID:"card-status"})}),(0,y.jsx)(S,{title:"Allergens"}),(0,y.jsx)(r.default,{testID:"card-allergens",style:{width:'100%'},children:(0,y.jsx)(T,{map:e.allergens})}),e.allergenNotes?(0,y.jsx)(d.Muted,{center:!0,children:e.allergenNotes}):null,e.allergensConfirmed?(0,y.jsxs)(d.Muted,{center:!0,children:["Allergen list confirmed by ",e.allergensConfirmed.by," on ",j(e.allergensConfirmed.at),"."]}):null,(0,y.jsx)(S,{title:"Ingredients"}),e.ingredients.length?(0,y.jsx)(r.default,{testID:"card-ingredients",style:{width:'100%',borderRadius:14,borderWidth:1,borderColor:o.colours.border,backgroundColor:o.colours.surface,overflow:'hidden'},children:e.ingredients.map((e,t)=>{const s=[e.qty,e.unit].filter(Boolean).join(' '),n=x?.byRecipeIng[e.id];return(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${e.name}${s?`, ${s}`:''}${n?`, ${C(n.cost)}`:''}`,style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:10,paddingHorizontal:12,borderTopWidth:t?1:0,borderColor:o.colours.border,minHeight:48},children:[(0,y.jsx)(d.T,{style:{flex:1,minWidth:0},children:e.name}),(0,y.jsxs)(r.default,{style:{alignItems:'flex-end',flexShrink:0,maxWidth:'40%'},children:[(0,y.jsx)(d.T,{weight:"semibold",colour:o.colours.goldLight,style:{textAlign:'right'},children:s||'\u2013'}),n?(0,y.jsx)(d.T,{size:o.font.small,colour:o.colours.muted,style:{textAlign:'right'},children:C(n.cost)}):null]})]},e.id)})}):(0,y.jsx)(d.Muted,{center:!0,children:"No ingredients on this card yet."}),(0,y.jsx)(S,{title:"Method"}),e.steps.length?(0,y.jsx)(r.default,{testID:"card-method",style:{width:'100%',gap:10},children:e.steps.map((e,t)=>(0,y.jsxs)(r.default,{accessible:!0,accessibilityLabel:`Step ${t+1}. ${e}`,style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,y.jsx)(r.default,{style:{width:32,height:32,borderRadius:16,borderWidth:1.5,borderColor:o.colours.gold,backgroundColor:o.colours.goldTint,alignItems:'center',justifyContent:'center',flexShrink:0},children:(0,y.jsx)(d.T,{size:o.font.small,weight:"bold",colour:o.colours.gold,children:t+1})}),(0,y.jsx)(d.T,{style:{flex:1,minWidth:0,paddingTop:4},children:e})]},t))}):(0,y.jsxs)(d.Muted,{center:!0,children:["No method yet.",(0,m.canEditCards)(t.role)?' Tap Edit to add the steps.':'']}),(0,y.jsx)(b.CardGpPanel,{card:e,actor:t,mode:l}),(0,y.jsxs)(d.Muted,{center:!0,children:["Version ",e.version," \xb7 last changed ",j(e.updatedAt)," by ",e.updatedBy]}),(0,m.canEditCards)(t.role)&&s?(0,y.jsx)(d.Button,{testID:"edit-card",kind:"secondary",label:"Edit card",accessibilityLabel:`Edit ${e.dish}`,onPress:s,style:{alignSelf:'stretch'}}):null,p&&!e.signOff?(0,y.jsxs)(r.default,{style:{gap:6,width:'100%'},children:[c?(0,y.jsx)(d.Banner,{kind:"warn",title:"Not ready to sign off",children:c}):null,(0,y.jsx)(d.Button,{testID:"sign-off",kind:"success",label:`Sign off as ${t.name}`,accessibilityLabel:`Sign off ${e.dish} as ${t.name}`,disabled:!!c,onPress:async()=>{try{await(0,u.recipeCards)().signOff(e.id,t),a(null)}catch(e){a(e?.message??'Could not sign off.')}}})]}):null,!(0,m.canEditCards)(t.role)||p||e.signOff?null:(0,y.jsx)(d.Banner,{kind:"info",title:"Sign-off",children:"Only the Head Chef, an owner or a manager can sign it off."}),i?(0,y.jsx)(d.Banner,{kind:"danger",children:i}):null]})}const v=()=>`i-${Math.random().toString(36).slice(2,9)}`,B=(e,t,s)=>e?{id:e.id,dish:e.dish,section:e.section,price:null==e.price?'':(e.price/100).toFixed(2),description:'',createdBy:e.createdBy??'',ingredients:e.ingredients.map(e=>({...e})),steps:[...e.steps],allergens:{...e.allergens},dismissed:[...e.dismissed],allergenNotes:e.allergenNotes??'',photos:(0,m.cardPhotos)(e),pending:[],confirm:!!e.allergensConfirmed}:{id:(0,m.uuid)(),dish:'',section:t,price:'',description:'',createdBy:s,ingredients:[{id:v(),name:'',qty:'',unit:''}],steps:[''],allergens:{},dismissed:[],allergenNotes:'',photos:[],pending:[],confirm:!1},L=e=>{const t=e.replace(/[\xa3\s]/g,'');if(!t)return null;const s=Number(t);return isFinite(s)&&s>=0?Math.round(100*s):'bad'};function R({rid:e,card:l,actor:c,onDone:h}){const p=(0,a.useRestaurant)(e),b=p?.sections??['Mains'],[j,C]=(0,n.useState)(()=>B(l,b[0]??'Mains',c.name)),[w,I]=(0,n.useState)(null),[$,T]=(0,n.useState)(null),[k,S]=(0,n.useState)(!1),P=e=>C(t=>({...t,...e})),R=j.ingredients.filter(e=>e.name.trim()),M={ingredients:R,allergens:j.allergens,dismissed:j.dismissed},O=(0,m.suggestAllergens)(R),E=(0,m.unresolved)(M),A=e=>{const t=j.allergens[e],s={...j.allergens};t?'contains'===t?s[e]='may':delete s[e]:s[e]='contains',P({allergens:s,dismissed:j.dismissed.filter(t=>t!==e),confirm:!1})},N=e=>{const t={...j.allergens};delete t[e],P({allergens:t,dismissed:[...new Set([...j.dismissed,e])],confirm:!1})},z=(e,t)=>P({ingredients:j.ingredients.map((s,n)=>n===e?{...s,...t}:s),confirm:!1}),W=(e,t)=>P({steps:j.steps.map((s,n)=>n===e?t:s)}),H=(e,t)=>{const s=[...j.steps],n=e+t;n<0||n>=s.length||([s[e],s[n]]=[s[n],s[e]],P({steps:s}))},_=j.photos.length+j.pending.length,F=async e=>{if(T(null),_>=m.MAX_RECIPE_PHOTOS)T('A card can hold 5 photos.');else try{const t=await(0,x.capturePlatingPhoto)(e);t&&(P({pending:[...j.pending,t]}),T(`Photo ${_+1} of ${m.MAX_RECIPE_PHOTOS}. Compressed on this device: ${t.width}\xd7${t.height}, ${(0,x.kb)(t.bytes)}${t.originalBytes?` (was ${(0,x.kb)(t.originalBytes)})`:''}.`))}catch(e){T(e?.message??'Could not read that photo.')}},[G,V]=(0,n.useState)(!1),U=j.dish||l?.dish||'this dish';return(0,y.jsxs)(r.default,{testID:"card-editor",style:{gap:12},children:[l?.signOff?(0,y.jsx)(d.Banner,{kind:"warn",title:"Saving a change clears the sign-off",children:"This card is signed off. Any change you save clears it until the Head Chef, an owner or a manager signs it off again."}):null,(0,y.jsx)(d.Field,{testID:"dish-name",label:"Dish name",value:j.dish,onChangeText:e=>P({dish:e}),placeholder:"e.g. Cullen skink"}),(0,y.jsx)(d.Field,{testID:"card-created-by-field",label:"Created by",value:j.createdBy,onChangeText:e=>P({createdBy:e}),placeholder:"Chef's name"}),l?null:(0,y.jsx)(d.Field,{testID:"dish-description",label:"Menu description (optional)",value:j.description,onChangeText:e=>P({description:e}),placeholder:"What guests read on the menu"}),(0,y.jsx)(d.T,{size:o.font.small,weight:"medium",colour:o.colours.muted,children:"Menu section"}),(0,y.jsx)(d.Row,{wrap:!0,gap:6,children:b.map(e=>(0,y.jsx)(d.Chip,{label:e,selected:j.section===e,onPress:()=>P({section:e})},e))}),(0,y.jsx)(d.Field,{testID:"dish-price",label:"Price (\xa3)",value:j.price,onChangeText:e=>P({price:e}),placeholder:"Blank = price on the board",keyboardType:"decimal-pad"}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Photos"}),(0,y.jsx)(d.T,{center:!0,colour:o.colours.muted,children:"Up to 5 photos."}),(0,y.jsxs)(r.default,{testID:"card-photos",style:{gap:10,width:'100%',alignItems:'center'},children:[j.photos.map((e,t)=>(0,y.jsxs)(r.default,{style:{width:'100%',gap:6,alignItems:'center'},children:[(0,y.jsx)(D,{dish:U,photo:e,height:160,index:t+1,total:_||j.photos.length}),(0,y.jsx)(d.Button,{testID:`photo-remove-${t+1}`,kind:"ghost",label:`Remove photo ${t+1}`,accessibilityLabel:`Remove photo ${t+1} of ${U}`,onPress:()=>P({photos:j.photos.filter((e,s)=>s!==t)})})]},e)),j.pending.map((e,t)=>(0,y.jsxs)(r.default,{style:{width:'100%',gap:6,alignItems:'center'},children:[(0,y.jsx)(D,{dish:U,pending:e.dataUrl,height:160,index:j.photos.length+t+1,total:_}),(0,y.jsx)(d.Button,{testID:`photo-remove-new-${t+1}`,kind:"ghost",label:`Remove photo ${j.photos.length+t+1}`,accessibilityLabel:`Remove new photo ${j.photos.length+t+1}`,onPress:()=>P({pending:j.pending.filter((e,s)=>s!==t)})})]},`new-${t}`)),_?null:(0,y.jsx)(D,{dish:U,height:160})]}),(0,y.jsx)(d.Button,{testID:"photo-camera",kind:"secondary",label:"Take photo",accessibilityLabel:"Take a photo for this recipe card",disabled:_>=m.MAX_RECIPE_PHOTOS,onPress:()=>F('camera')}),(0,y.jsx)(d.Button,{testID:"photo-library",kind:"secondary",label:"Choose photo",accessibilityLabel:"Choose a photo for this recipe card",disabled:_>=m.MAX_RECIPE_PHOTOS,onPress:()=>F('library')}),$?(0,y.jsx)(r.default,{testID:"photo-info",children:(0,y.jsx)(d.Muted,{center:!0,children:$})}):(0,y.jsx)(d.Muted,{center:!0,children:'shared'===(0,u.recipeCards)().mode?'Photos are shrunk on this device, then shared with the team. Staff and guests only see them once the card is signed off.':'Photos are shrunk on this device before they are saved.'}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Ingredients"}),(0,y.jsx)(d.Muted,{children:"Quantity, unit and ingredient. We suggest allergens from the ingredient names."}),j.ingredients.map((e,n)=>{const l=e.name.trim()?(0,m.suggestAllergens)([e]):[];return(0,y.jsxs)(r.default,{style:{gap:4},children:[(0,y.jsxs)(d.Row,{gap:6,children:[(0,y.jsx)(t.TextInput,{testID:`ing-qty-${n}`,accessibilityLabel:`Quantity ${n+1}`,value:e.qty,onChangeText:e=>z(n,{qty:e}),placeholder:"Qty",placeholderTextColor:"#7D776C",style:[d.styles.input,{width:64}]}),(0,y.jsx)(t.TextInput,{testID:`ing-unit-${n}`,accessibilityLabel:`Unit ${n+1}`,value:e.unit,onChangeText:e=>z(n,{unit:e}),placeholder:"g / ml / each",placeholderTextColor:"#7D776C",style:[d.styles.input,{width:92}]}),(0,y.jsx)(t.TextInput,{testID:`ing-name-${n}`,accessibilityLabel:`Ingredient ${n+1}`,value:e.name,onChangeText:e=>z(n,{name:e}),placeholder:"Ingredient",placeholderTextColor:"#7D776C",style:[d.styles.input,{flex:1}]}),(0,y.jsx)(s.GoldClose,{size:"sm",label:`Remove ingredient ${n+1}`,onPress:()=>P({ingredients:j.ingredients.filter((e,t)=>t!==n)})})]}),l.length?(0,y.jsxs)(d.Muted,{children:["Suggests: ",l.map(f.allergenLabel).join(', ')]}):null]},e.id)}),(0,y.jsx)(d.Button,{testID:"ing-add",small:!0,kind:"ghost",label:"Add ingredient",onPress:()=>P({ingredients:[...j.ingredients,{id:v(),name:'',qty:'',unit:''}]})}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Method"}),j.steps.map((e,n)=>(0,y.jsxs)(d.Row,{gap:6,style:{alignItems:'flex-start'},children:[(0,y.jsx)(d.T,{colour:o.colours.gold,style:{width:20,paddingTop:10},children:n+1}),(0,y.jsx)(t.TextInput,{testID:`step-${n}`,accessibilityLabel:`Step ${n+1}`,value:e,onChangeText:e=>W(n,e),multiline:!0,placeholder:"Describe this step",placeholderTextColor:"#7D776C",style:[d.styles.input,{flex:1,minHeight:56,textAlignVertical:'top'}]}),(0,y.jsxs)(r.default,{style:{gap:4},children:[(0,y.jsx)(i.default,{accessibilityLabel:`Move step ${n+1} up`,onPress:()=>H(n,-1),hitSlop:6,children:(0,y.jsx)(d.T,{colour:o.colours.muted,children:"\u25b2"})}),(0,y.jsx)(i.default,{accessibilityLabel:`Move step ${n+1} down`,onPress:()=>H(n,1),hitSlop:6,children:(0,y.jsx)(d.T,{colour:o.colours.muted,children:"\u25bc"})}),(0,y.jsx)(s.GoldClose,{size:"sm",label:`Remove step ${n+1}`,onPress:()=>P({steps:j.steps.filter((e,t)=>t!==n)})})]})]},n)),(0,y.jsx)(d.Button,{testID:"step-add",small:!0,kind:"ghost",label:"Add step",onPress:()=>P({steps:[...j.steps,'']})}),(0,y.jsx)(d.Divider,{}),(0,y.jsx)(d.H2,{children:"Allergens (UK 14)"}),(0,y.jsx)(d.Muted,{children:"Tap to cycle: contains \u2192 may contain \u2192 none. Suggested allergens are marked \u201c?\u201d until you add or rule them out."}),E.length?(0,y.jsxs)(r.default,{testID:"allergen-suggestions",style:{gap:6},children:[(0,y.jsx)(d.Banner,{kind:"warn",title:`Check ${E.length} suggested allergen${1===E.length?'':'s'}`,children:E.map(e=>`${(0,f.allergenLabel)(e)} (from ${(0,m.suggestedBy)(R,e).join(', ')})`).join('; ')}),E.map(e=>(0,y.jsxs)(d.Row,{gap:6,wrap:!0,children:[(0,y.jsx)(d.T,{style:{flex:1},children:(0,f.allergenLabel)(e)}),(0,y.jsx)(d.Button,{testID:`suggest-add-${e}`,small:!0,label:"Contains",onPress:()=>P({allergens:{...j.allergens,[e]:'contains'},confirm:!1})}),(0,y.jsx)(d.Button,{testID:`suggest-may-${e}`,small:!0,kind:"secondary",label:"May contain",onPress:()=>P({allergens:{...j.allergens,[e]:'may'},confirm:!1})}),(0,y.jsx)(d.Button,{testID:`suggest-dismiss-${e}`,small:!0,kind:"ghost",label:"Not in this dish",onPress:()=>N(e)})]},e)),(0,y.jsx)(d.Button,{testID:"apply-suggestions",small:!0,kind:"secondary",label:"Add all suggestions as \u2018contains\u2019",onPress:()=>{const e={...j.allergens};E.forEach(t=>{e[t]='contains'}),P({allergens:e,confirm:!1})}})]}):null,(0,y.jsx)(d.Row,{wrap:!0,gap:6,children:f.ALLERGENS.map(e=>{const t=j.allergens[e.id],s=O.includes(e.id)&&!t&&!j.dismissed.includes(e.id),n='contains'===t?o.colours.redBg:'may'===t?o.colours.amberBg:o.colours.surface2,l='contains'===t?o.colours.red:'may'===t?o.colours.amber:s?o.colours.gold:o.colours.border;return(0,y.jsx)(i.default,{testID:`allergen-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.short}: ${'contains'===t?'contains':'may'===t?'may contain':'not marked'}`,onPress:()=>A(e.id),style:{paddingVertical:6,paddingHorizontal:10,borderRadius:16,borderWidth:s?2:1,borderStyle:s?'dashed':'solid',borderColor:l,backgroundColor:n},children:(0,y.jsxs)(d.T,{size:o.font.small,colour:'contains'===t?'#FFD9D4':'may'===t?'#FFE2A8':o.colours.text,children:[e.short,'may'===t?' (may)':'',s?' ?':'']})},e.id)})}),j.dismissed.length?(0,y.jsxs)(d.Muted,{children:["Ruled out: ",j.dismissed.map(f.allergenLabel).join(', ')]}):null,(0,y.jsx)(d.Field,{testID:"allergen-notes",label:"Allergen notes (optional)",value:j.allergenNotes,onChangeText:e=>P({allergenNotes:e}),placeholder:"e.g. Cooked in the shared fryer"}),(0,y.jsxs)(i.default,{testID:"confirm-allergens",accessibilityRole:"checkbox",accessibilityState:{checked:j.confirm,disabled:E.length>0},disabled:E.length>0,onPress:()=>P({confirm:!j.confirm}),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:j.confirm?o.colours.ok:o.colours.border,opacity:E.length?.5:1},children:[(0,y.jsx)(r.default,{style:{width:22,height:22,borderRadius:4,borderWidth:2,borderColor:j.confirm?o.colours.ok:o.colours.muted,alignItems:'center',justifyContent:'center',backgroundColor:j.confirm?o.colours.okBg:'transparent'},children:j.confirm?(0,y.jsx)(d.T,{colour:o.colours.ok,children:"\u2713"}):null}),(0,y.jsx)(d.T,{style:{flex:1},children:E.length?'Check the suggested allergens above first':`I have checked the allergen list against the ingredients (${c.name})`})]}),w?(0,y.jsx)(d.Banner,{kind:"danger",children:w}):null,(0,y.jsx)(d.Button,{testID:"card-save",label:G?'Saving\u2026':l?'Save changes':'Save card',disabled:G,onPress:async()=>{I(null);const t=L(j.price);if(!j.dish.trim())return I('Give the dish a name.');if('bad'===t)return I('Price should be in pounds, e.g. 14.50 (or leave it blank for "price on the board").');const s=(0,u.recipeCards)();V(!0);try{const n=[...j.photos];for(const t of j.pending){if(n.length>=m.MAX_RECIPE_PHOTOS)break;n.push(await s.savePhoto(e,j.id,t))}const i=j.steps.map(e=>e.trim()).filter(Boolean),r=j.createdBy.trim(),o={dish:j.dish.trim(),section:j.section,price:t,ingredients:R.map(e=>({...e,name:e.name.trim(),qty:e.qty.trim(),unit:e.unit.trim()})),steps:i,allergens:j.allergens,dismissed:j.dismissed,allergenNotes:j.allergenNotes.trim()||void 0,photo:n[0],photos:n,createdBy:r||void 0};if(l)await s.update(l.id,{...o,confirmAllergens:j.confirm},c),h(l.id);else{const t=await s.create(e,{...o,id:j.id,description:j.description.trim()||void 0},c);j.confirm&&await s.update(t.id,{confirmAllergens:!0},c),h(t.id)}}catch(e){I(e?.message??'Could not save the card.')}finally{V(!1)}}}),(0,y.jsx)(d.Muted,{center:!0,children:(0,m.maySignOff)(c,{createdBy:j.createdBy||c.name,createdByRole:c.role})?'After saving, sign the card off so it goes live.':'After saving, the Head Chef, an owner or a manager signs it off before it goes live.'}),l?k?(0,y.jsxs)(d.Row,{gap:8,children:[(0,y.jsx)(d.Button,{testID:"card-delete-yes",small:!0,kind:"danger",label:"Yes, remove this dish",onPress:async()=>{if(l)try{await(0,u.recipeCards)().remove(l.id,c),h(null)}catch(e){I(e?.message??'Could not remove the card.')}}}),(0,y.jsx)(d.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>S(!1)})]}):(0,y.jsx)(d.Button,{testID:"card-delete",small:!0,kind:"ghost",label:"Remove card and dish from the menu",onPress:()=>S(!0)}):null]})}const M=e=>e.replace(/ \xb7 Starter$/,' \xb7 1').replace(/ \xb7 Main$/,' \xb7 2');function O(e){const t=(0,a.useAllMenu)(e),s=(0,a.useRecipeCards)(e);return(0,n.useMemo)(()=>{const e=new Map(s.map(e=>[e.menuItemId,e]));return(0,m.unsignedOldestFirst)(t,t=>e.get(t.id)??(t.recipeCardId?s.find(e=>e.id===t.recipeCardId):void 0))},[t,s])}function E({c:e,actor:t,mode:s,editable:n,onPress:l}){const a=(0,m.cardPhotos)(e),c=(0,b.useCardCosting)(e,'read'===s?'staff':t.role,s),h=f.ALLERGENS.filter(t=>e.allergens[t.id]).length,u=c?.summary.gp,x=c?.summary.tone,C='ok'===x?o.colours.ok:'amber'===x?o.colours.amber:'red'===x?o.colours.red:o.colours.muted,I=`${e.dish}, ${e.section}, ${w(e.price)}, ${h?`${h} allergen${1===h?'':'s'}`:'no allergens marked'}${null!=u?`, GP ${u.toFixed(1)} percent`:''}, created by ${e.createdBy||'not recorded'}, ${e.signOff?`signed off by ${e.signOff.by}`:'awaiting sign-off'}`;return(0,y.jsxs)(i.default,{testID:`card-${e.menuItemId}`,accessibilityRole:"button",accessibilityLabel:I,onPress:l,style:({pressed:t})=>({width:'100%',minHeight:48,flexDirection:'row',gap:12,alignItems:'center',padding:10,borderRadius:18,borderWidth:1,borderColor:!e.signOff&&n?o.colours.amber:o.colours.accentBorder,backgroundColor:t?o.colours.tilePressed:o.colours.tile}),children:[(0,y.jsx)(r.default,{style:{width:84,flexShrink:0},children:(0,y.jsx)(D,{dish:e.dish,photo:a[0],height:84,radius:14})}),(0,y.jsxs)(r.default,{style:{flex:1,minWidth:0,gap:4,alignItems:'center'},children:[(0,y.jsx)(d.T,{center:!0,weight:"bold",size:18,colour:o.colours.gold,children:e.dish}),(0,y.jsxs)(d.T,{center:!0,size:o.font.small,colour:o.colours.muted,children:[e.section," \xb7 ",w(e.price),'example'===e.origin?` \xb7 ${p.EXAMPLE_TAG}`:'']}),(0,y.jsxs)(d.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,y.jsx)(k,{label:h?`${h} allergen${1===h?'':'s'}`:'No allergens marked'}),null!=u?(0,y.jsx)(r.default,{testID:`card-gp-${e.menuItemId}`,style:{paddingHorizontal:10,paddingVertical:4,borderRadius:999,borderWidth:1.5,borderColor:C},children:(0,y.jsxs)(d.T,{size:o.font.small,weight:"bold",colour:C,children:["GP ",u.toFixed(1),"%"]})}):null]}),(0,y.jsxs)(d.T,{center:!0,size:o.font.small,testID:`card-created-${e.menuItemId}`,children:["Created by ",e.createdBy||'Not recorded']}),(0,y.jsx)(d.T,{center:!0,size:o.font.small,colour:e.signOff?o.colours.goldLight:o.colours.amber,children:e.signOff?`Signed off by ${e.signOff.by}, ${j(e.signOff.at)}`:m.STATE_LABEL.awaiting})]})]})}},1050,[874,835,31,197,264,128,825,818,823,1448,1042,839,819,1179,1219,1416,1449,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>(0,i.liveAttendance)(e.attendance)),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(l.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(n.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(l.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(l.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l.Muted,{size:13,children:S.intro}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(l.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(l.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(l.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(l.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(l.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(l.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:o,manager:i,by:a}){const d=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,o),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,o]);const p=(0,u.useHr)(e=>e.questions),y=(0,u.useHr)(e=>e.voted),b=(0,u.useHr)(e=>e.log),[j,S]=(0,s.useState)(''),[k,C]=(0,s.useState)('up'),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)(null),[z,P]=(0,s.useState)(''),[W,A]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{i&&W&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>B(e))},[i,W,e,b.length]);const N=(0,h.boardOrder)(p.filter(t=>t.venue===e),i),E=(q??b.filter(t=>t.venue===e)).slice(0,30);if(!d.board)return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(l.Muted,{children:["The question board is switched off for this venue.",i?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(l.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:j,onChangeText:e=>{S(e),T(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(l.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(l.Chip,{label:"Vote up",selected:'up'===k,onPress:()=>C('up')}),(0,c.jsx)(l.Chip,{label:"Yes / No",selected:'yesno'===k,onPress:()=>C('yesno')})]}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(j),onPress:()=>{u.useHr.getState().post(e,j,k,o)?(S(''),T('Posted anonymously.')):T('Write a few more words first.')}})]}),v?(0,c.jsx)(l.Muted,{size:13,children:v}):null]}),N.length?N.map(e=>(0,c.jsx)(w,{q:e,mine:y[e.id],manager:i,onHide:()=>{M(e),D('')},onReply:()=>{L(e),P(e.reply??'')},by:a},e.id)):(0,c.jsx)(l.Muted,{center:!0,children:"No questions yet. Be the first."}),i?(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",center:!0,children:"Moderation log"}),(0,c.jsx)(l.Button,{small:!0,kind:"secondary",testID:"hr-log-toggle",label:W?'Hide moderation log':'Show moderation log',onPress:()=>A(!W)}),(0,c.jsx)(l.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),W?E.length?E.map(e=>(0,c.jsxs)(n.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(l.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(l.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(l.Sheet,{visible:!!R,onClose:()=>M(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(l.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:I,onChangeText:D,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:I.trim().length<3,onPress:()=>{R&&u.useHr.getState().moderate(R.id,'hide',I,a),M(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>M(null)})]})]}),(0,c.jsxs)(l.Sheet,{visible:!!H,onClose:()=>L(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[H?(0,c.jsxs)(l.Muted,{children:["\u201c",H.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:z,onChangeText:P,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(l.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!z.trim(),onPress:()=>{H&&u.useHr.getState().reply(H.id,z,a),L(null)}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:()=>L(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(n.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(l.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(l.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(l.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(l.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(l.Card,{children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(l.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(n.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(n.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(n.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(n.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(l.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Staffing vs Covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(n.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(l.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(l.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} Covers`:'No bookings'})]}),(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(n.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(n.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(n.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(l.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(l.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(l.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(l.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(l.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(l.Card,{children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(n.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(l.T,{size:14,children:[(0,c.jsx)(l.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(l.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(l.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(n.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(l.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(l.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(l.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(l.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(l.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(l.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(l.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),n=e(_r(_d[3])),l=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(n.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(n=>{const i=e===n;return(0,c.jsx)(o.default,{testID:`hr-morale-${n}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${n} of 5: ${(0,h.moraleWord)(n,s)}`,onPress:()=>t(n),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:n})},n)})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(l.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(n.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(n.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(n.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(l.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],n)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(l.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===n?'left':1===n?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(l.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(l.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(n.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(l.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(l.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(l.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(l.Row,{gap:8,wrap:!0,children:(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(l.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(n.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(l.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(l.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(n.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(l.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(l.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},1051,[874,31,264,128,818,825,863,881,1081,1276,1277,25]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ChatAsCtx",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return w.dmId}}),Object.defineProperty(_e,"inChannel",{enumerable:!0,get:function(){return w.inChannel}}),_e.autoPost=function(e,t){const n=new Date(globalThis.__ccNow??Date.now()).toISOString();(Array.isArray(e)?e:[e]).forEach(e=>f.useOwner.getState().sys(e,t,n))},_e.ensureChat=D,_e.useChatUnread=A,Object.defineProperty(_e,"DISPLAY_DEVICE_ID",{enumerable:!0,get:function(){return B}}),_e.chatSender=L,_e.Chat=function({go:e}){return(0,O.jsx)(z,{children:(0,O.jsx)(K,{go:e})})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),a=r(d[3]),o=r(d[4]),i=r(d[5]),l=r(d[6]),c=e(r(d[7])),h=e(r(d[8])),u=e(r(d[9])),m=r(d[10]),f=r(d[11]),p=r(d[12]),b=r(d[13]),x=r(d[14]),j=r(d[15]),y=r(d[16]),w=r(d[17]),C=r(d[18]),v=r(d[19]),S=r(d[20]),k=r(d[21]),O=r(d[22]);const R=(0,i.createContext)(null);function I(e){const t=(0,x.useCtx)(e),n=(0,i.useContext)(R);return n?{...t,meId:n.meId,role:n.role}:t}const T=[{id:'all',name:'Team',icon:'\ud83d\udce2'},{id:'kitchen',name:'Kitchen',icon:'\ud83c\udf73',pinned:!0},{id:'foh',name:'Front of house',icon:'\ud83c\udf7d\ufe0f'},{id:'managers',name:'Managers',icon:'\ud83d\udd11'}],M=[],P=e=>(e??'').replace(' (example)','');function D(e){if(a.LIVE_VENUE_BUILD)return;if(o.IS_WILDINGS)return;const t=f.useOwner.getState();if(t.chat.some(e=>'m-seed-all'===e.id&&/this phone only/.test(e.text??''))&&f.useOwner.getState().chatPatch('m-seed-all',{text:'Welcome to the team chat on CoverCharge.'}),t.chat.length)return;const n=(t,n,s,a={})=>{return{id:`m-seed-${t}`,ch:t,from:'system',text:s,at:(o=n,new Date(e.getTime()-6e4*o).toISOString()),reactions:{},seenBy:[],...a};var o};f.useOwner.setState({chat:[n('all',5,'Welcome to the team chat on CoverCharge.',{pinned:!0}),n('kitchen',4,'Kitchen channel: Head Chef, kitchen team and managers.'),n('foh',3,'Front of house channel: front of house, bar and managers.'),n('managers',2,'Managers channel: owners, managers and the supervisor only.')]})}function A(){const{meId:e}=I(3e4),{role:t}=I(3e4),n=(0,f.useOwner)(e=>e.chat),s=(0,f.useOwner)(e=>e.staff),a=(0,f.useOwner)(t=>t.chatMuted[e]??M),o=(0,i.useMemo)(()=>E(s,e,t),[s,e,t]);return(0,i.useMemo)(()=>{const t={};return n.forEach(n=>{n.removed||n.from===e||n.seenBy.includes(e)||!(0,w.inChannel)(n.ch,o)||(t[n.ch]=(t[n.ch]??0)+1)}),{by:t,total:Object.entries(t).filter(([e])=>!a.includes(e)).reduce((e,[,t])=>e+t,0)}},[n,e,a,o])}function E(e,t,n){if(t===j.CAR_DEVICE_ID)return{id:t,name:j.CAR_ACTOR,role:'owner',job:'',active:!0,level:'Owner',dept:''};if('display-device'===t)return{id:t,name:'Display',role:'owner',job:'',active:!0,level:'Owner',dept:''};const s=e.find(e=>e.id===t);return s||!t?s:{id:t,name:'You',role:n,job:'',active:!0,level:'owner'===n?'Owner':'manager'===n?'Manager':'Staff',dept:''}}const B='display-device';function L(e,t){return e===j.CAR_DEVICE_ID?{id:e,name:j.CAR_ACTOR,role:'owner',job:'',active:!0,level:'Owner',dept:''}:e===B?{id:e,name:'Display',role:'owner',job:'',active:!0,level:'Owner',dept:''}:t.find(t=>t.id===e)}class z extends i.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message??e)}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.err&&this.setState({err:null})}render(){return this.state.err?(0,O.jsxs)(u.default,{style:{gap:10},testID:"chat-error",children:[(0,O.jsx)(m.Banner,{kind:"warn",title:"Chat couldn\u2019t open",children:"Something went wrong showing this chat. Your messages are still saved on this phone. Go back and try again; if it keeps happening, close and reopen the app."}),(0,O.jsx)(m.Button,{kind:"secondary",label:"Back to chats",onPress:()=>{this.setState({err:null}),this.props.onBack?.()}})]}):this.props.children}}const $={owner:b.colours.gold,manager:b.colours.blue,staff:'#7a6f5c'};function _({s:e,size:t=34}){return e?(0,O.jsx)(y.StaffAvatar,{id:e.id,size:t}):(0,O.jsx)(u.default,{style:{width:t,height:t,borderRadius:t/2,backgroundColor:(0,n.soutersSurface)('#333'),alignItems:'center',justifyContent:'center'},children:(0,O.jsx)(m.T,{size:.38*t,weight:"bold",colour:"#111",children:"CC"})})}const N=[{caption:'Specials board',tone:'#4A3A22'},{caption:'Plating: Cullen skink',tone:'#3E2A2A'},{caption:'Delivery arrived',tone:'#40362A'},{caption:'Spillage by the bar',tone:'#2E2E40'}],W=['\ud83d\udc4d','\u2764\ufe0f','\ud83d\ude04','\ud83d\udc4f','\ud83d\udd25'];function H({ch:e,go:a,back:o}){const{now:j,meId:S,role:R,today:M}=I(1e4),D=(0,f.useOwner)(e=>e.staff),A=(0,f.useOwner)(e=>e.chat),E=(0,f.useOwner)(e=>e.shifts),B=(0,f.useOwner)(e=>e.leave),z=A.filter(t=>t.ch===e).sort((e,t)=>e.at.localeCompare(t.at)),[H,K]=(D.find(e=>e.id===S),(0,i.useState)('')),[V,U]=(0,i.useState)(null),[Y,q]=(0,i.useState)(!1),[F,G]=(0,i.useState)(!1),J=e.startsWith('dm:')?e.split(':').slice(1).length:D.filter(t=>t.active&&(0,w.inChannel)(e,t)).length;(0,i.useEffect)(()=>{const t=f.useOwner.getState().chat.some(t=>t.ch===e&&t.from!==S&&!t.seenBy.includes(S));f.useOwner.getState().chatSeen(e,S),t&&(0,v.markChatRead)(S,e)},[e,S,z.length]);const Q=t=>f.useOwner.getState().chatSend({ch:e,from:S,at:j.toISOString(),...t});(0,l.useBackLayer)(!0,o);const X=z.filter(e=>e.pinned&&!e.removed),Z=e.startsWith('dm:')?D.find(t=>t.id===e.split(':').slice(1).find(e=>e!==S)):void 0,ee=Z?.name.replace(' (example)','')??T.find(t=>t.id===e)?.name??'Private message',te=t.AVATAR_OPTIONS.find(t=>t.id===('kitchen'===e?'spatula':'bar'===e?'espresso-martini':'waves')),ne=(0,C.useChatSync)(e=>e.synced),se=(0,k.workingShifts)(E,B).filter(e=>e.staffId===S&&e.published&&e.date>=M).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,10);return(0,O.jsxs)(u.default,{style:{gap:8},children:[(0,O.jsxs)(u.default,{testID:"chat-thread-header",style:{gap:6,alignItems:'center'},children:[(0,O.jsx)(u.default,{style:{alignSelf:'flex-start'},children:(0,O.jsx)(l.BackButton,{onPress:o,testID:"chat-thread-back"})}),Z?(0,O.jsx)(y.StaffAvatar,{id:Z.id,size:88}):(0,O.jsx)(c.default,{testID:"chat-group-avatar",source:{uri:te.dataUrl},style:{width:88,height:88},accessibilityLabel:`${ee} group avatar`}),(0,O.jsx)(m.T,{center:!0,weight:"semibold",size:22,children:ee}),(0,O.jsxs)(m.Muted,{center:!0,children:[J," ",1===J?'member':'members']})]}),X.map(e=>(0,O.jsxs)(m.Card,{highlight:b.colours.gold,children:[(0,O.jsxs)(m.T,{size:12,colour:b.colours.gold,children:["\ud83d\udccc ",'system'===e.from?'Pinned note':`Pinned by ${P(D.find(t=>t.id===e.from)?.name)}`]}),(0,O.jsx)(m.T,{size:14,children:e.text})]},e.id)),z.map((t,s)=>{const o=L(t.from,D),i=t.from===S,l=t.seenBy.filter(e=>e!==t.from).length,c=0===s||t.at.slice(0,10)!==z[s-1].at.slice(0,10);return'system'===t.from?(0,O.jsxs)(u.default,{style:{alignItems:'center',gap:2},children:[c?(0,O.jsx)(m.Muted,{children:(0,p.niceDate)(new Date(t.at))}):null,(0,O.jsx)(u.default,{style:{backgroundColor:(0,n.soutersSurface)('#1c1a14'),borderRadius:10,paddingHorizontal:10,paddingVertical:5,borderWidth:1,borderColor:b.colours.border},children:(0,O.jsxs)(m.T,{size:13,colour:/Allergy|86|Sold out/.test(t.text??'')?b.colours.amber:b.colours.muted,children:["CoverCharge \xb7 ",t.text," \xb7 ",(0,p.hm)(new Date(t.at))]})})]},t.id):(0,O.jsxs)(u.default,{style:{gap:2},children:[c?(0,O.jsx)(m.Muted,{center:!0,children:(0,p.niceDate)(new Date(t.at))}):null,(0,O.jsxs)(m.Row,{style:{alignItems:'flex-start',flexDirection:i?'row-reverse':'row'},children:[(0,O.jsx)(_,{s:o}),(0,O.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:`Message from ${o?.name}`,onPress:()=>U(V===t.id?null:t.id),style:{maxWidth:'78%',backgroundColor:i?'#3a2f12':b.colours.surface,borderRadius:14,padding:9,borderWidth:1,borderColor:t.pinned?b.colours.gold:b.colours.border,gap:3},children:[(0,O.jsxs)(m.Row,{gap:6,children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:o?$[o.role]:b.colours.muted,children:P(o?.name)}),(0,O.jsxs)(m.T,{size:11,colour:b.colours.muted,children:[o?f.ROLE_LABEL[o.role]:''," \xb7 ",(0,p.hm)(new Date(t.at))]})]}),t.removed?(0,O.jsx)(m.T,{size:14,colour:b.colours.muted,children:"Message removed by the owner"}):(0,O.jsxs)(O.Fragment,{children:[t.photo?(0,O.jsx)(u.default,{style:{width:200,height:120,borderRadius:10,backgroundColor:t.photo.tone,justifyContent:'flex-end',padding:6},children:(0,O.jsxs)(m.T,{size:12,children:[t.photo.caption," (example image)"]})}):null,t.text?(0,O.jsx)(m.T,{size:15,children:t.text}):null,'cover'===t.action?(0,O.jsx)(m.Button,{small:!0,kind:"secondary",label:"Open cover requests on the rota",onPress:()=>a('more','rota')}):null]}),Object.entries(t.reactions).filter(([,e])=>e.length).length?(0,O.jsx)(m.Row,{wrap:!0,gap:4,children:Object.entries(t.reactions).filter(([,e])=>e.length).map(([e,t])=>(0,O.jsx)(u.default,{style:{borderRadius:10,paddingHorizontal:6,backgroundColor:t.includes(S)?'#4a3c16':'#222'},children:(0,O.jsxs)(m.T,{size:12,children:[e," ",t.length]})},e))}):null,i?(0,O.jsx)(m.T,{size:11,colour:b.colours.muted,children:l?`Seen by ${l}`:'Sent'}):null]})]}),V!==t.id||t.removed?null:(0,O.jsxs)(m.Row,{wrap:!0,gap:6,style:{justifyContent:i?'flex-end':'flex-start',paddingLeft:i?0:40},children:[W.map(e=>(0,O.jsx)(h.default,{accessibilityLabel:`React ${e}`,onPress:()=>{f.useOwner.getState().chatReact(t.id,e,S),U(null)},style:{padding:4},children:(0,O.jsx)(m.T,{size:20,children:e})},e)),'staff'===R||e.startsWith('dm:')?null:(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:t.pinned?'Unpin':'Pin',onPress:()=>{f.useOwner.getState().chatPatch(t.id,{pinned:!t.pinned}),U(null)}}),'owner'!==R||i?null:(0,O.jsx)(m.Button,{small:!0,kind:"danger",label:"Remove",onPress:()=>{f.useOwner.getState().chatPatch(t.id,{removed:!0,pinned:!1}),U(null)}})]})]},t.id)}),(0,O.jsxs)(m.Row,{gap:6,children:[(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:"Send a photo",onPress:()=>q(!0),style:{padding:8},children:(0,O.jsx)(m.T,{size:20,children:"\ud83c\udf9e\ufe0f"})}),(0,O.jsx)(s.TextInput,{accessibilityLabel:"Message",placeholder:`Message ${ee}`,placeholderTextColor:"#7D776C",value:H,onChangeText:K,style:[m.styles.input,{flex:1,minWidth:0,width:0}]}),(0,O.jsx)(m.Button,{small:!0,label:"Send",disabled:!H.trim(),onPress:()=>{Q({text:H.trim()}),K('')}})]}),(0,O.jsx)(m.Row,{wrap:!0,gap:6,children:(0,O.jsx)(m.Button,{small:!0,kind:"secondary",label:"Ask for shift cover",onPress:()=>G(!0)})}),ne?null:(0,O.jsx)(m.Muted,{center:!0,children:"Not shared yet: this message stays on this phone only. Nobody else will see it."}),(0,O.jsx)(m.Sheet,{visible:Y,onClose:()=>q(!1),title:"Send a photo",children:(0,O.jsx)(m.Row,{wrap:!0,gap:8,children:N.map(e=>(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.caption,onPress:()=>{Q({photo:e}),q(!1)},style:{width:'47%',height:100,borderRadius:10,backgroundColor:e.tone,justifyContent:'flex-end',padding:6},children:(0,O.jsx)(m.T,{size:12,children:e.caption})},e.caption))})}),(0,O.jsxs)(m.Sheet,{visible:F,onClose:()=>G(!1),title:"Ask for shift cover",children:[se.length?null:(0,O.jsx)(m.Muted,{children:"You have no shifts on the rota this week."}),se.map(e=>(0,O.jsx)(m.Button,{kind:"secondary",label:`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`,onPress:()=>{const t=`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`;f.useOwner.getState().addSwap({shiftId:e.id,fromId:S,kind:'cover',note:`Cover asked in chat for ${t}`}),Q({text:`Can anyone cover my ${t} shift? I\u2019ve added a cover request on the rota.`,action:'cover'}),G(!1)}},e.id)),(0,O.jsx)(m.Muted,{children:"Creates a cover request in Rota \u203a Swaps & leave for a manager to approve."})]})]})}function K({go:e}){const{now:t,meId:s,role:a}=I(3e4),o=(0,f.useOwner)(e=>e.staff),l=(0,f.useOwner)(e=>e.chat),c=(0,f.useOwner)(e=>e.chatMuted[s]??M),{by:x,total:j}=A(),y=(0,C.useChatSync)(e=>e.synced),k=(0,C.useChatSync)(e=>e.error),R=(0,w.useKitchenExtra)(e=>e.extra),[B,$]=(0,i.useState)(null),[N,W]=(0,i.useState)(!1),[K,V]=(0,i.useState)(!1);(0,i.useEffect)(()=>{D(t)},[]),(0,i.useEffect)(()=>{$(null)},[s]);const U=(0,S.useChatOpen)(e=>e.ch);(0,i.useEffect)(()=>{if(!U)return;const e=U.startsWith('dm:')||T.some(e=>e.id===U)?U:null;e&&(0,w.inChannel)(e,E(o,s,a))&&$(e),S.useChatOpen.getState().request(void 0)},[U,s,a,o]);const Y=E(o,s,a);if(B)return(0,O.jsx)(z,{resetKey:B,onBack:()=>$(null),children:(0,O.jsx)(H,{ch:B,go:e,back:()=>$(null)})});const q=e=>l.filter(t=>t.ch===e).sort((e,t)=>t.at.localeCompare(e.at))[0],F=o.filter(e=>e.active&&e.id!==s).map(e=>{const t=(0,w.dmId)(s,e.id);return{x:e,id:t,u:x[t]??0,l:q(t)?.at??''}}).sort((e,t)=>t.u-e.u||t.l.localeCompare(e.l)||P(e.x.name).localeCompare(P(t.x.name))),G='owner'===a||'manager'===a,J=({id:e,name:t,icon:s,avatar:a})=>{const i=q(e),l=x[e]??0,f=c.includes(e);return(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:`Open ${t}`,onPress:()=>$(e),style:{padding:12,borderTopWidth:1,borderColor:b.colours.border},children:(0,O.jsxs)(m.Row,{children:[a?(0,O.jsx)(_,{s:a}):(0,O.jsx)(u.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:(0,n.soutersSurface)('#222'),alignItems:'center',justifyContent:'center'},children:(0,O.jsx)(m.T,{size:16,children:s})}),(0,O.jsxs)(u.default,{style:{flex:1},children:[(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{weight:l?'bold':'medium',children:[t,f?' \ud83d\udd15':'']}),i?(0,O.jsx)(m.Muted,{children:(0,p.hm)(new Date(i.at))}):null]}),(0,O.jsx)(m.Muted,{numberOfLines:1,children:i?i.removed?'Message removed':`${'system'===i.from?'CoverCharge':P(L(i.from,o)?.name)}: ${i.text??'Photo'}`:'No messages yet'})]}),l?(0,O.jsx)(u.default,{style:{backgroundColor:f?'#555':b.colours.red,borderRadius:10,minWidth:20,height:20,alignItems:'center',justifyContent:'center',paddingHorizontal:5},children:(0,O.jsx)(m.T,{size:11,weight:"bold",children:l})}):null]})})};return(0,O.jsxs)(u.default,{style:{gap:10},children:[y?(0,O.jsx)(u.default,{testID:"chat-synced",children:(0,O.jsx)(m.Muted,{children:"\u2713 Shared with the team: messages reach everyone in the chat on their own phone."})}):(0,O.jsx)(m.Banner,{kind:"warn",title:"On this device only for now",children:"You\u2019re not connected with your personal link (or chat sharing isn\u2019t switched on yet), so anything you send stays on this device and nobody else will see it. Open your personal invite link to share chat with the team. Use your usual group chat for anything urgent."}),y&&k?(0,O.jsx)(u.default,{testID:"chat-sync-error",children:(0,O.jsx)(m.Banner,{kind:"warn",title:"Can\u2019t reach the server right now",children:"Showing the messages on this phone. New messages will be sent and others\u2019 messages will appear when the connection is back; it retries automatically."})}):null,(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.Muted,{children:["Signed in as ",P(Y?.name)," (",'Head Chef'===Y?.level?'Head Chef':f.ROLE_LABEL[a],")"]}),(0,O.jsxs)(m.Row,{gap:6,children:[j||Object.keys(x).length?(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"chat-mark-all",accessibilityLabel:"Mark all chats as read",onPress:()=>(0,v.markChatRead)(s,'*')}):null,(0,O.jsx)(m.Button,{small:!0,kind:"ghost",label:"Chat settings",onPress:()=>V(!0)})]})]}),(0,O.jsxs)(u.default,{style:{borderRadius:14,borderWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface,overflow:'hidden'},children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{padding:10},children:"TEAM CHATS"}),T.filter(e=>'all'===e.id||(0,w.inChannel)(e.id,Y)).map(e=>(0,O.jsx)(J,{id:e.id,name:e.pinned?`${e.name} \ud83d\udccc`:e.name,icon:e.icon},e.id))]}),(0,O.jsxs)(u.default,{style:{borderRadius:14,borderWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface,overflow:'hidden'},children:[(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between',padding:10},children:[(0,O.jsx)(m.T,{size:12,weight:"semibold",colour:b.colours.gold,children:"PRIVATE MESSAGES"}),(0,O.jsx)(m.Button,{small:!0,kind:"success",label:"New message",testID:"chat-new-pm",onPress:()=>W(!0)})]}),F.map(e=>(0,O.jsx)(J,{id:e.id,name:P(e.x.name),avatar:e.x},e.id)),F.length?null:(0,O.jsx)(m.Muted,{style:{padding:10},children:"Nobody else on the team yet."})]}),(0,O.jsx)(m.Muted,{children:"Private messages can only be read by the two people in them; owners and managers can\u2019t read other people\u2019s private messages. The Kitchen chat is for owners, managers, head chefs and kitchen staff, and can\u2019t be left."}),(0,O.jsx)(m.Sheet,{visible:N,onClose:()=>W(!1),title:"New private message",children:o.filter(e=>e.active&&e.id!==s).map(e=>(0,O.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:`Message ${e.name}`,onPress:()=>{W(!1),$((0,w.dmId)(s,e.id))},style:{paddingVertical:8},children:(0,O.jsxs)(m.Row,{children:[(0,O.jsx)(_,{s:e}),(0,O.jsxs)(u.default,{children:[(0,O.jsx)(m.T,{children:P(e.name)}),(0,O.jsxs)(m.Muted,{children:[f.ROLE_LABEL[e.role]," \xb7 ",e.job]})]})]})},e.id))}),(0,O.jsxs)(m.Sheet,{visible:K,onClose:()=>V(!1),title:"Chat settings",children:[(0,O.jsx)(m.Banner,{kind:"info",title:"Privacy",children:"Chat is for work. Managers and the owner see messages in the channels they belong to and the owner can remove messages in group chats. Private messages can only be read by the two people in them: the server enforces this, so nobody else (not even the owner) can read them. Don\u2019t share customer card or health details beyond what\u2019s needed for service."}),(0,O.jsx)(m.T,{weight:"semibold",children:"Mute channels"}),T.filter(e=>(0,w.inChannel)(e.id,Y)).map(e=>(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{children:[e.icon," ",e.name]}),(0,O.jsx)(m.Toggle,{label:`Mute ${e.name}`,value:c.includes(e.id),onChange:()=>f.useOwner.getState().chatMute(s,e.id)})]},e.id)),(0,O.jsx)(m.Muted,{children:"Muted channels don\u2019t count towards the tab badge. The Kitchen chat can be muted but not left."}),G?(0,O.jsxs)(u.default,{style:{gap:6},testID:"kitchen-members",children:[(0,O.jsx)(m.T,{weight:"semibold",children:"Kitchen chat members"}),(0,O.jsxs)(m.Muted,{children:["Automatic: owners, managers, head chefs and kitchen staff (chefs, kitchen porters). Change who else is in it here",y?'':'; saved on this device for now',"."]}),o.filter(e=>e.active).map(e=>{const t=R[e.id]??(0,w.kitchenByRule)(e);return(0,O.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(m.T,{children:[P(e.name),null!=R[e.id]?' (changed)':'']}),(0,O.jsx)(m.Toggle,{label:`Kitchen chat: ${P(e.name)}`,value:t,onChange:t=>w.useKitchenExtra.getState().set(e.id,t===(0,w.kitchenByRule)(e)?null:t)})]},e.id)})]}):null]})]})}},1052,[1384,876,874,842,5,31,1042,197,264,128,818,863,822,825,953,977,996,1192,1296,824,1418,972,25]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SNOOZE_MINS",{enumerable:!0,get:function(){return S}}),e.useScheduledNotices=function({rid:u,staffId:S,name:w,onOpen:D}){const I=(0,t.useRef)(w);I.current=w;const N=(0,t.useRef)(D);N.current=D,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.location?.search)return;const t=new URLSearchParams(window.location.search);if('orderlists'===t.get('open'))o.useListOpen.getState().request(t.get('list')??void 0),setTimeout(()=>N.current?.('orderlists'),0);else if('chat'===t.get('open'))c.useChatOpen.getState().request(t.get('ch')??void 0),setTimeout(()=>N.current?.('chat'),0);else{const s=t.get('open');s&&v.includes(s)&&setTimeout(()=>N.current?.(s),0)}},[]);const O=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),b=(0,d.useReminders)(t=>t.done.length);(0,t.useEffect)(()=>{s.useNotifs.getState().ensure(u);const t=()=>{const t=h(),c=s.useNotifs.getState(),v=n.useOwner.getState().staff.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),w=v.filter(s=>!1!==s.active&&(0,p.shiftNow)(s.id,t).on).map(t=>t.id);for(const n of c.items){if(n.rid!==u)continue;const p=`sched:${n.id}`;if(!S||n.removed||n.paused||!n.sendBy.inApp||!(0,f.isRecipient)(n,S,v,w)){(0,l.dismissNotice)(p);continue}const{due:D,forDate:O}=(0,f.notifDue)(n,t),b=d.useReminders.getState().done.find(t=>t.reminderId===n.id&&t.forDate===O),R=`sched:${n.id}:${O}`;!D||b||(c.snooze[R]??0)>t?(0,l.dismissNotice)(p):(0,l.notify)({id:p,icon:'\ud83d\udd14',kicker:'NOTICE',title:n.title,body:n.message,testID:'sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'sched-notice-done',onPress:()=>d.useReminders.getState().markDone({rid:u,reminderId:n.id,forDate:O,at:new Date(h()).toISOString(),staffRef:S,staffName:I.current.replace(' (example)','')})},...'orderlists'===n.open?.page&&N.current?[{label:'Open list',testID:'sched-notice-open',onPress:()=>{o.useListOpen.getState().request(n.open?.list),N.current?.('orderlists')}}]:[],{label:'Later',kind:'ghost',testID:'sched-notice-later',onPress:()=>s.useNotifs.getState().setSnooze(R,h()+9e5)}]})}};t();const c=setInterval(t,2e4);return()=>clearInterval(c)},[u,S,O,b])};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),u=r(_d[6]),f=r(_d[7]),l=r(_d[8]),p=r(_d[9]);const h=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock).getTime()}catch{return Date.now()}},S=15,v=['bookings','rota','notifications','chat']},1053,[31,997,863,1057,1418,998,881,999,980,1000]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1054,[869,31,1294,863,881,870,1183,871,980,1178]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ListBadge=C,_e.OrderListsScreen=function({rid:e,who:t,editor:s,today:i}){(0,o.useEffect)(()=>{x.useOrderLists.getState().ensure(e)},[e]);const d=(0,x.useOrderLists)(e=>e.lists).filter(t=>t.rid===e&&!t.archived),n=(0,x.useOrderLists)(e=>e.items);(0,x.useOrderLists)(t=>t.settings[e]);const l=(0,x.orderSettingsOf)(e).allowStaff,h=(0,x.useListOpen)(e=>e.seed),[y,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(!h)return;const e=d.find(e=>e.seed===h);e&&(j(e.id),x.useListOpen.getState().request(void 0))},[h,d.length]);const f=s||l;if(!s&&!l)return(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{children:"Order lists are for managers and the Head Chef here."}),(0,w.jsx)(c.Muted,{children:"Ask a manager to switch on \u201cLet all staff add items\u201d."})]});const b=d.find(e=>e.id===y);if(b)return(0,w.jsx)($,{rid:e,list:b,editor:s,canAdd:f,who:t,today:i,onBack:()=>j(null)});const I=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"order-lists",children:[(0,w.jsxs)(c.Muted,{size:13,children:["Tip: add what\u2019s running low as you notice it. ",s?'On the day, tick what you got, then Finish order.':'A manager or the Head Chef places the order.']}),d.map(t=>{const s=(0,p.liveItems)(n.filter(t=>t.rid===e),t.id).filter(e=>'open'===e.status).length;return(0,w.jsx)(c.Card,{onPress:()=>j(t.id),children:(0,w.jsx)(u.default,{testID:`order-list-card-${t.seed??t.id}`,children:(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,i,I)})]}),(0,w.jsx)(c.Badge,{kind:s?'gold':'neutral',label:`${s} to get`})]})})},t.id)}),d.length?null:(0,w.jsx)(c.Muted,{children:"No order lists yet. Add one in Settings \u203a Advanced \u203a Order lists."})]})};var t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),o=r(_d[3]),d=e(r(_d[4])),n=e(r(_d[5]));r(_d[6]);var l=e(r(_d[7])),u=e(r(_d[8])),c=r(_d[9]),h=r(_d[10]),x=r(_d[11]),p=r(_d[12]),y=r(_d[13]),j=r(_d[14]),f=r(_d[15]),b=r(_d[16]),w=r(_d[17]);const I={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},L=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',v=e=>e.replace(' (example)','').split(' ')[0];function C({list:e,size:s=40}){const i=(0,f.useLogoCache)(t=>t.byList[e.id]),[n,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let t=!0;return!i&&e.logo&&(0,b.orderLogoUrl)(e.logo).then(e=>{t&&l(e)}),()=>{t=!1}},[e.logo,i]);const x=i??n;return x?(0,w.jsx)(d.default,{testID:`list-logo-${e.seed??e.id}`,source:{uri:x},accessibilityLabel:`${e.name} logo`,style:{width:s,height:s,borderRadius:s/2,borderWidth:1,borderColor:h.colours.gold}}):(0,w.jsx)(u.default,{testID:`list-initials-${e.seed??e.id}`,accessibilityLabel:`${e.name}`,style:{width:s,height:s,borderRadius:s/2,backgroundColor:(0,t.soutersSurface)('#1c1a16'),borderWidth:1,borderColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(c.T,{size:.38*s,weight:"bold",colour:h.colours.gold,children:(0,p.initials)(e.name)})})}function D({phone:e}){const t=(0,p.telHref)(e);if(!e||!t)return null;return'undefined'!=typeof navigator&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?(0,w.jsx)(l.default,{testID:"list-phone",accessibilityRole:"link",onPress:()=>{n.default.openURL(t)},children:(0,w.jsxs)(c.T,{colour:h.colours.gold,children:["\ud83d\udcde Call ",e]})}):(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(u.default,{testID:"list-phone",children:(0,w.jsxs)(c.T,{children:["\ud83d\udcde ",e]})}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"list-phone-copy",label:"Copy",onPress:()=>{navigator.clipboard?.writeText(e).then(()=>(0,y.notify)({id:'copied',title:'Number copied',timeoutMs:3e3}))}})]})}function T({list:e}){const t=x.useOrderLists.getState(),s=(0,f.useLogoCache)(t=>!!t.byList[e.id])||!!e.logo,i=async s=>{try{const i=await(0,j.capturePlatingPhoto)(s);if(!i)return;const o=await(0,f.squareLogo)(i.dataUrl,256);f.useLogoCache.getState().put(e.id,o);const d=await(0,b.uploadOrderLogo)(e.id,o);if(d.ok){const s=e.logo;t.updateList(e.id,{logo:d.path}),s&&(0,b.removeOrderLogo)(s)}else'offline'!==d.message&&(0,y.notify)({id:'logo',tone:'warn',title:'Logo saved on this device only',body:d.message,timeoutMs:7e3})}catch(e){(0,y.notify)({id:'logo',tone:'warn',title:'Couldn\u2019t use that picture',body:String(e.message),timeoutMs:7e3})}};return(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-camera",label:s?'Replace: take photo':'Logo: take photo',onPress:()=>{i('camera')}}),(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-library",label:s?'Replace: choose':'Logo: choose image',onPress:()=>{i('library')}}),s?(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"logo-remove",label:"Remove logo",onPress:()=>{f.useLogoCache.getState().drop(e.id),e.logo&&(0,b.removeOrderLogo)(e.logo),t.updateList(e.id,{logo:void 0})}}):null]})}function S({rid:e,list:t,who:i}){const[d,n]=(0,o.useState)(''),[l,y]=(0,o.useState)('1'),[j,f]=(0,o.useState)(''),[b,L]=(0,o.useState)(''),[C,D]=(0,o.useState)(null),T=x.useOrderLists.getState(),S=Number(l.replace(',','.')),B=d.trim().length>0&&(0,p.validQty)(S),$=()=>{n(''),y('1'),L(''),D(null)};return(0,w.jsxs)(u.default,{testID:"order-add",style:{gap:6},children:[(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Item",testID:"order-add-name",value:d,onChangeText:n,placeholder:"Item, e.g. Tennent\u2019s",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Quantity",testID:"order-add-qty",value:l,onChangeText:y,keyboardType:"decimal-pad",style:{...I,width:64,borderColor:(0,p.validQty)(S)?h.colours.hairline:h.colours.red}})]}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:p.UNITS.map(e=>(0,w.jsx)(c.Chip,{label:e||'no unit',selected:j===e,onPress:()=>f(e)},e||'none'))}),(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Note",testID:"order-add-note",value:b,onChangeText:L,placeholder:"Note (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(c.Button,{testID:"order-add-save",label:"Add",disabled:!B,onPress:()=>{const s=(0,p.findDuplicate)(T.items.filter(t=>t.rid===e),t.id,d,j);s?D(s):(T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$())}})]}),(0,w.jsxs)(c.Sheet,{visible:!!C,onClose:()=>D(null),title:"Already on the list",testID:"order-dup",children:[(0,w.jsx)(c.T,{children:C?`${C.name}: ${(0,p.qtyText)(C)} (added by ${v(C.addedByName)})`:''}),(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(c.Button,{testID:"order-dup-bump",label:`Add ${l} more`,onPress:()=>{C&&T.bump(C.id,S,i),$()}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Add as separate item",onPress:()=>{T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$()}})]})]})]})}function B({item:e,editor:t,who:s}){const i=x.useOrderLists.getState(),o='got'===e.status?h.colours.gold:'missing'===e.status?h.colours.amber:h.colours.text;return(0,w.jsxs)(u.default,{testID:`order-item-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.hairline,paddingVertical:8,gap:4},children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",colour:o,style:{flex:1,textDecorationLine:'got'===e.status?'line-through':'none'},children:e.name}),(0,w.jsx)(c.T,{weight:"semibold",children:(0,p.qtyText)(e)})]}),e.note?(0,w.jsxs)(c.Muted,{size:12,children:["Note: ",e.note]}):null,(0,w.jsxs)(c.Muted,{size:12,children:["Added by ",v(e.addedByName)," \xb7 ",L(e.addedAt),e.bumps?.length?` \xb7 +${e.bumps.map(e=>`${e.qty} ${v(e.name)}`).join(', ')}`:'',e.carried?' \xb7 carried over':'']}),'open'!==e.status?(0,w.jsxs)(c.Muted,{size:12,children:['got'===e.status?'Got / ordered':'Missing / not in stock'," \xb7 ",e.statusBy," ",L(e.statusAt)]}):null,t?(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Chip,{testID:`order-got-${e.id}`,label:"\u2713 Got / ordered",selected:'got'===e.status,onPress:()=>i.setStatus(e.id,'got'===e.status?'open':'got',s)}),(0,w.jsx)(c.Chip,{testID:`order-missing-${e.id}`,label:"Missing / not in stock",selected:'missing'===e.status,onPress:()=>i.setStatus(e.id,'missing'===e.status?'open':'missing',s)}),(0,w.jsx)(c.Chip,{testID:`order-remove-${e.id}`,label:"Remove",onPress:()=>{i.removeItem(e.id),(0,y.notify)({id:`undo-${e.id}`,title:`Removed ${e.name}`,timeoutMs:8e3,actions:[{label:'Undo',testID:'order-undo',onPress:()=>i.undoRemove(e.id)}]})}})]}):null]})}function $({rid:e,list:t,editor:d,canAdd:n,who:l,today:j,onBack:f}){(0,i.useBackLayer)(!0,f);const b=(0,x.useOrderLists)(e=>e.items),$=(0,x.useOrderLists)(e=>e.history).filter(e=>e.listId===t.id),P=(0,p.liveItems)(b.filter(t=>t.rid===e),t.id),[k,R]=(0,o.useState)(!1),[O,M]=(0,o.useState)(!1),[A,z]=(0,o.useState)(t.phone??''),N=x.useOrderLists.getState(),q=P.filter(e=>'got'!==e.status).length,H=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:`order-list-${t.seed??t.id}`,children:[(0,w.jsx)(i.BackButton,{onPress:f,testID:"order-list-back"}),(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t,size:48}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{size:18,weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,j,H)})]})]}),(0,w.jsx)(D,{phone:t.phone}),'trip'===t.kind&&d?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(c.Muted,{size:12,children:"Trip day for this trip"}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:[1,2,3,4,5,6,0].map(e=>(0,w.jsx)(c.Chip,{testID:`trip-day-${e}`,label:p.DAY_FULL[e].slice(0,3),selected:(t.tripDay??H)===e,onPress:()=>N.updateList(t.id,{tripDay:e})},e))})]}):null,d?(0,w.jsxs)(u.default,{style:{gap:6},children:[(0,w.jsx)(c.Row,{gap:6,children:(0,w.jsx)(s.TextInput,{accessibilityLabel:"Phone number",testID:"list-phone-edit",value:A,onChangeText:z,onBlur:()=>N.updateList(t.id,{phone:A.trim()||void 0}),placeholder:"Phone (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}})}),(0,w.jsx)(T,{list:t})]}):null]}),n?(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{weight:"semibold",children:"Add to this list"}),(0,w.jsx)(S,{rid:e,list:t,who:l})]}):null,(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",children:"On the list"}),(0,w.jsx)(c.Badge,{kind:"neutral",label:`${P.length}`})]}),P.length?P.map(e=>(0,w.jsx)(B,{item:e,editor:d,who:l},e.id)):(0,w.jsx)(c.Muted,{children:"Nothing on this list yet."}),d&&P.length?(0,w.jsx)(c.Button,{testID:"order-finish",label:"Finish order",onPress:()=>R(!0)}):null]}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"order-history",label:O?'Hide history \u25b4':`History (${$.length}) \u25be`,onPress:()=>M(!O)}),O?$.map(e=>(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.T,{weight:"semibold",children:[L(e.finishedAt)," \xb7 ",v(e.finishedByName)]}),(0,w.jsx)(c.Muted,{size:12,children:e.items.map(e=>`${e.name} ${(0,p.qtyText)(e)}${'missing'===e.status?' (missing)':'open'===e.status?' (not got)':''}`).join(' \xb7 ')}),e.carried?(0,w.jsxs)(c.Muted,{size:12,children:[e.carried," carried over"]}):null]},e.id)):null,(0,w.jsxs)(c.Sheet,{visible:k,onClose:()=>R(!1),title:"Finish this order?",testID:"order-finish-sheet",children:[(0,w.jsxs)(c.T,{children:[P.length-q," got or ordered",q?`, ${q} not got (missing or still open)`:'',"."]}),(0,w.jsx)(c.Muted,{children:"It goes into History with today\u2019s date and your name."}),q?(0,w.jsxs)(c.T,{weight:"semibold",children:["Carry over the ",q," not got to the next order?"]}):null,(0,w.jsxs)(c.Row,{wrap:!0,gap:8,children:[q?(0,w.jsx)(c.Button,{testID:"order-finish-carry",label:"Finish and carry over",onPress:()=>{N.finish(e,t.id,!0,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,body:`${q} carried over`,timeoutMs:6e3})}}):null,(0,w.jsx)(c.Button,{testID:"order-finish-clear",kind:q?'secondary':'primary',label:q?'Finish, don\u2019t carry over':'Finish order',onPress:()=>{N.finish(e,t.id,!1,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,timeoutMs:6e3})}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>R(!1)})]})]})]})}},1055,[876,874,1042,31,197,240,123,264,128,818,825,1057,1293,980,1416,1417,824,25]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PhoneAlerts=function({what:e="reminders and alerts set for you"}){const[s,h]=(0,t.useState)(null),[u,p]=(0,t.useState)(null),[y,f]=(0,t.useState)(null);(0,t.useEffect)(()=>{let e=!0;return(0,r.inApkWebView)()?h('apk'):(0,r.pushState)().then(t=>{e&&h(t)}).catch(()=>{e&&p('Could not check alerts. Try again.')}),()=>{e=!1}},[]);const b='on'===s?'Alerts are on for this phone.':'blocked'===s?i.BLOCKED_INTRO:'ios-home-screen'===s?'iPhone: add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.':'unsupported'===s?'This browser can\u2019t get alerts when the phone is locked. Open CoverCharge in Chrome.':null;return(0,c.jsxs)(n.default,{testID:"phone-alerts",style:{gap:10,alignItems:'center'},children:[(0,c.jsxs)(l.T,{center:!0,size:16,children:["Get the ",e," on this phone, even when the app is closed."]}),'apk'===s?(0,c.jsx)(l.T,{size:18,weight:"bold",colour:o.colours.gold,center:!0,testID:"alerts-open-chrome",children:"Open CoverCharge in Chrome to turn on alerts"}):null,b?(0,c.jsx)(l.T,{center:!0,size:15,testID:"alerts-status",children:b}):null,'off'===s?(0,c.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,c.jsx)(l.Button,{label:"Turn on alerts",testID:"turn-on-alerts",accessibilityLabel:"Turn on alerts. Your phone will then ask to allow notifications: tap Allow.",style:{minHeight:64,minWidth:260},onPress:async()=>{p(null);try{const e=await(0,r.turnOnPush)();p(e.message),e.ok?h('on'):h(await(0,r.pushState)())}catch{p('Could not turn on alerts. Please try again.')}}}),(0,c.jsx)(l.T,{size:16,center:!0,testID:"alerts-allow-line",children:"When your phone asks, tap Allow."})]}):null,'blocked'===s?(0,c.jsx)(n.default,{style:{gap:6,alignItems:'center',alignSelf:'stretch'},testID:"alerts-blocked-steps",accessible:!0,accessibilityLabel:i.BLOCKED_SPOKEN,children:i.BLOCKED_STEPS.map((e,t)=>(0,c.jsx)(l.T,{size:15,center:!0,children:`${t+1}. ${e}`},t))}):null,'blocked'===s?(0,c.jsx)(l.Button,{label:"I\u2019ve allowed it, check again",testID:"alerts-recheck",accessibilityLabel:"I\u2019ve allowed it. Check again.",style:{minHeight:64,minWidth:260},onPress:async()=>{p(null);try{if('blocked'===await(0,r.pushState)())return void p(i.STILL_OFF);const e=await(0,r.turnOnPush)();p(e.message),h(e.ok?'on':await(0,r.pushState)())}catch{p('Could not check alerts. Please try again.')}}}):null,'on'===s?(0,c.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,c.jsx)(l.Button,{label:"Send me a test notification",testID:"push-test",accessibilityLabel:"Send me a test notification. It goes only to your own phone.",style:{minHeight:56,minWidth:260},onPress:async()=>{f('Sending\u2026'),f((await(0,r.sendTestPush)()).message)}}),y?(0,c.jsx)(n.default,{accessibilityLiveRegion:"polite",children:(0,c.jsx)(l.T,{size:15,center:!0,testID:"push-test-msg",children:y})}):null,(0,c.jsx)(l.Button,{small:!0,kind:"ghost",label:"Turn off alerts on this phone",testID:"turn-off-alerts",onPress:async()=>{const e=await(0,r.turnOffPush)();p(e.message),h(await(0,r.pushState)())}})]}):null,u?(0,c.jsx)(n.default,{accessibilityLiveRegion:"assertive",accessibilityRole:'alert',children:(0,c.jsx)(l.T,{size:15,center:!0,testID:"push-msg",children:u})}):null,(0,c.jsx)(l.Muted,{center:!0,size:13,children:"For this phone only. Each person turns it on on their own phone."})]})};var e,t=_r(d[0]),s=_r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(d[2]),i=_r(d[3]),o=_r(d[4]),r=_r(d[5]),c=_r(d[6])},1056,[31,128,818,1040,825,1389,25]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"orderListSeedId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"orderListSettingsId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"orderListSeeds",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useOrderLists",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"orderSettingsOf",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"useListOpen",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),p=r(d[5]),l=r(d[6]);const c=(e,t)=>(0,u.uuidFrom)(`order-list:${t}:${e}`),S=e=>(0,u.uuidFrom)(`order-list-settings:${e}`),f=e=>'anchorage'===e?[{id:c(e,'allsons'),seed:'allsons',name:'Alsons (drinks)',kind:'running'},{id:c(e,'cash-carry'),seed:'cash-carry',name:'Cash and carry',kind:'trip',tripDay:5}]:[],A=()=>(new Date).toISOString(),O=(0,i.create)()((0,n.persist)((e,t)=>({lists:[],items:[],history:[],settings:{},ensure:s=>{const i=t(),n=new Set(i.lists.map(e=>e.id)),u=f(s).filter(e=>!n.has(e.id)).map(e=>({...e,rid:s})),p={},c=i.lists.map(e=>(0,l.fixSupplierNames)(e.name)!==e.name?{...e,name:(0,l.fixSupplierNames)(e.name),updatedAt:A()}:e);c.some((e,t)=>e!==i.lists[t])&&(p.lists=c),u.length&&(p.lists=[...p.lists??i.lists,...u]),i.settings[s]||(p.settings={...i.settings,[s]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(s)}}),Object.keys(p).length&&e(p)},addList:(t,s)=>{const i=(0,p.uuid)();return e(e=>({lists:[...e.lists,{...s,id:i,rid:t,updatedAt:A()}]})),i},updateList:(t,s)=>e(e=>({lists:e.lists.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),addItem:(t,s)=>{const i=(0,p.uuid)(),n=s.addedAt??A();return e(e=>({items:[...e.items,{...s,id:i,rid:t,status:'open',addedAt:n,updatedAt:n}]})),i},bump:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...(0,o.bumpQty)(e,s,i.id,i.name,A()),rid:e.rid}:e)})),updateItem:(t,s)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),setStatus:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,status:s,statusBy:'open'===s?void 0:i.name,statusAt:'open'===s?void 0:A(),updatedAt:A()}:e)})),removeItem:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!0,updatedAt:A()}:e)})),undoRemove:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!1,updatedAt:A()}:e)})),finish:(s,i,n,u)=>{const l=t().lists.find(e=>e.id===i);if(!l)return null;const c=A(),{round:S,drop:f,carriedOver:O}=(0,o.finishOrder)(l,t().items,n,u,c,p.uuid),_=new Set(f),y=new Map(O.map(e=>[e.id,e])),T={...S,rid:s};return e(e=>({items:e.items.filter(e=>!_.has(e.id)).map(e=>y.has(e.id)?{...y.get(e.id),rid:e.rid}:e),history:[T,...e.history].slice(0,300),lists:e.lists.map(e=>e.id===i?{...e,nextTrip:void 0,updatedAt:c}:e)})),T},setSettings:(t,s)=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,...e.settings[t],...s,id:S(t),updatedAt:A()}}})),resetSettings:t=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(t),updatedAt:A()}}}))}),{name:'covercharge-order-lists-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)})),_=e=>({...o.DEFAULT_ORDER_LIST_SETTINGS,...O.getState().settings[e]}),y=(0,i.create)()(e=>({request:t=>e({seed:t})}))},1057,[1190,995,1191,1179,1293,1099,1292]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return E}}),_e.personFromStaff=H,_e.signInWithText=V,_e.SignInWithLink=z,_e.signInWithHandover=F,_e.useSignedOutGate=function(){const e=(0,k.useSession)(e=>e.meId),n=(0,b.useSync)(e=>'device'===e.kind&&!!e.venueId);return h.IS_CAR?!S.PITCH&&!n:C.includes(h.APP_VARIANT)&&!S.PITCH&&!e&&!K()},_e.InviteGate=function(){const[e,N]=(0,u.useState)(k.useSession.persist.hasHydrated()),[H,V]=(0,u.useState)(k.START_INVITE||k.START_HANDOVER||k.START_KITCHEN?'checking':'done'),[L,U]=(0,u.useState)(null),[G,B]=(0,u.useState)(null),[Y,$]=(0,u.useState)(0),[X,Q]=(0,u.useState)(!1),[q,J]=(0,u.useState)(null),Z=(0,k.useSession)(e=>e.meId),ee=(0,k.useSession)(e=>!Z||!!e.welcomed[Z]);if((0,u.useEffect)(()=>{const e=k.useSession.persist.onFinishHydration(()=>N(!0));return k.useSession.persist.hasHydrated()&&N(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!C.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=k.useSession.getState().meId;if(k.START_KITCHEN&&'chef'===h.APP_VARIANT&&!e){const e=await(0,b.claimDisplayKitchen)(k.START_KITCHEN);if(!t)return;if('ok'===e.status&&e.id.staffRef){(0,y.markKitchenViaDisplay)(!0,e.id.displayName),M(e.id);try{k.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void V('done')}return U('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void V('done')}if(k.START_HANDOVER&&!k.START_INVITE&&!W){W=!0;const n=await(0,b.claimChromeHandover)(k.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef)M(n.id);else if('refused'===n.status&&!e)return B(n.message),void V('done')}if(k.START_INVITE&&!(e&&await(0,b.signedInHereAs)(e)&&await(0,b.rememberedInviteHere)(k.START_INVITE))){const e=await D(k.START_INVITE,e=>{t&&B(e)});if(!t)return;if('refused'===e.kind)return B(e.message),void V('done');if('offline'===e.kind)return Q(!0),void(n=setTimeout(()=>{t&&$(e=>e+1)},1e4));if(Q(!1),'bad'===e.kind)return void V('bad')}const s=O(k.useSession.getState().meId),o=s&&!1!==w.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)k.useSession.getState().signOut();else if(s&&!R(s)&&!k.START_INVITE&&await(0,b.signedInHereAs)(s.id)){if(await(0,b.forgetSignInHere)(),!t)return;k.useSession.getState().signOut(),J(E(s.app))}else if(s&&!R(s)){const e=(0,k.appUrl)(s.app,k.START_INVITE);if(e)return void window.location.replace(e)}V('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,Y]),!C.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(t.QueuedVenueWelcome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?'This link cannot be used here. Ask your authorised manager.':X?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(o.GreensideStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(r.AbbotsfordStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?'This link cannot be used here. Ask your authorised manager.':X?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!Z)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(l.KirktonStaffHome,{app:k.APP_NAME[h.APP_VARIANT]??'Team',message:G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(s.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!Z){const t=s.IsolatedStaffHome,o=k.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=G?`This link can\u2019t be used here. ${G}`:X?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==H?'bad'===H?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(t,{app:o,message:l})})}if(X)return _('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===H)return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if(h.IS_OWNER_DESKTOP&&!Z&&!S.PITCH&&!K())return(0,j.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,j.jsx)(p.DesktopSignIn,{onCode:F,refused:G})});if((0,A.inPhoneApp)()&&!Z&&!S.PITCH)return G&&/already been used/i.test(G)?_(P,'invite-app-used'):G&&(0,x.isPhoneLinked)(G)?_(x.PHONE_LINKED_TEXT,'invite-phone-linked'):G?_(G,'invite-app-refused'):_(v,'invite-app-notsetup');if('bad'===H)return(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,j.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,j.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>V('done')}),(0,j.jsx)(I.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(G&&!Z&&(0,x.isPhoneLinked)(G))return(0,j.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${x.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,j.jsx)(I.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,j.jsx)(I.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,j.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(G&&!Z)return(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,j.jsx)(I.Muted,{center:!0,children:G}),(0,j.jsx)(I.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,j.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>B(null)})]});if(q&&!Z)return(0,j.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,j.jsx)(I.Muted,{center:!0,children:q}),(0,j.jsx)(z,{})]});if(L&&!Z){const e=/expired/i.test(L);return(0,j.jsxs)(f.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,j.jsx)(I.Muted,{center:!0,children:L}),(0,j.jsx)(I.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!Z&&!S.PITCH&&!K())return(0,j.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:G?'This link can\u2019t be used here':'Sign in to CoverCharge'}),G?(0,j.jsx)(I.Muted,{center:!0,children:G}):null,(0,j.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,j.jsx)(z,{})]});const ne=(0,k.rosterPerson)(Z);return ne&&!ee&&R(ne)&&!(0,y.isKitchenViaDisplay)()?(0,j.jsx)(T.LaunchWelcome,{p:ne,onDone:()=>k.useSession.getState().markWelcomed(ne.id)}):null};var n=_r(d[0]),t=_r(d[1]),s=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),I=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),x=_r(d[20]),w=_r(d[21]),j=_r(d[22]);const P='This app copy has already been set up on another phone. Ask your manager for a new link.',v='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',_=(e,n)=>(0,j.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,j.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e})}),C=['owner','staff','chef'],R=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,E=e=>`You now use ${k.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function N(e){k.useSession.getState().signIn(e.id);const n=w.useOwner.getState();w.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function H(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const O=e=>{const n=(0,k.rosterPerson)(e);if(n)return n;const t=e?w.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?H(t):void 0};async function D(e,n){const t=await(0,k.personForInvite)(e);if(t)return N(t),R(t)?((0,b.claimInvite)(e).then(e=>{if('refused'===e.status&&k.useSession.getState().meId===t.id&&(k.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==k.useSession.getState().meId){const n=O(e.id.staffRef);n&&N(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const s=await(0,b.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=O(s.id.staffRef)??H({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return N(o),{kind:'ok',p:o}}async function V(e,n=()=>{}){const t=(0,k.inviteFromText)(e);if(!t)return'bad';const s=await D(t,n);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!R(o)){const e=(0,k.appUrl)(o.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function z(){const[e,n]=(0,u.useState)(''),[t,s]=(0,u.useState)('');return(0,j.jsxs)(f.default,{style:{gap:6},children:[(0,j.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,j.jsx)(I.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await V(e,s);s('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,j.jsx)(I.T,{size:13,colour:m.colours.red,children:t}):null]})}function M(e){if(!e.staffRef)return;N(O(e.staffRef)??H({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function F(e){const n=await(0,b.claimChromeHandover)(e);return'ok'===n.status?n.id.staffRef?(M(n.id),'ok'):'bad':'refused'===n.status?{refused:n.message}:'offline'===n.status?'offline':'bad'}let W=!1;const K=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1058,[5,1542,1543,1544,1545,1546,31,123,47,128,807,1547,866,825,1549,818,824,979,2,1412,1274,863,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BOTTOM_TABS_HEIGHT",{enumerable:!0,get:function(){return h}}),_e.BottomTabs=function({tabs:e,active:b,onPress:y,background:x,tablist:p}){const{width:j}=(0,s.default)(),v=j/Math.max(1,e.length),w=v>=60?11:10,I=v<56?20:22,[F,S]=(0,t.useState)({}),[H,_]=(0,t.useState)(0),M=H>0&&e.some(e=>(F[e.id]??0)>H-6),z={flexDirection:'row',flexWrap:'nowrap',alignItems:'stretch',borderTopWidth:1,borderColor:c.colours.border,backgroundColor:x};return(0,f.jsx)(l.default,{testID:"app-bottom-tabs",accessibilityRole:p?'tablist':void 0,style:z,children:e.map(t=>{const s=b===t.id,x=s?c.colours.gold:c.colours.muted;return(0,f.jsxs)(n.default,{onLayout:t===e[0]?e=>_(e.nativeEvent.layout.width):void 0,testID:`tab-${t.id}`,accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:t.a11y??t.label,onPress:()=>y(t.id),style:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:44,minHeight:h,alignItems:'center',justifyContent:'center',paddingVertical:4,paddingHorizontal:1,gap:2},children:[(0,f.jsxs)(l.default,{style:{width:I,height:I,alignItems:'center',justifyContent:'center'},children:[(0,f.jsx)(u.Icon,{name:t.icon,size:I,colour:x}),t.badge?(0,f.jsx)(l.default,{testID:t.badge.testID,style:{position:'absolute',right:-10,top:-5,backgroundColor:t.badge.bg,borderRadius:8,minWidth:16,height:16,paddingHorizontal:3,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(o.default,{style:{fontFamily:c.fonts.bold,fontSize:10,lineHeight:12,color:t.badge.fg??'#FFFFFF'},children:t.badge.text})}):null]}),(0,f.jsx)(l.default,{pointerEvents:"none","aria-hidden":!0,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{position:'absolute',left:0,top:0,width:0,height:0,overflow:'hidden',opacity:0},children:(0,f.jsx)(l.default,{style:{width:400,flexDirection:'row',alignItems:'flex-start'},children:(0,f.jsx)(o.default,{onLayout:e=>{const n=Math.ceil(e.nativeEvent.layout.width);S(e=>e[t.id]===n?e:{...e,[t.id]:n})},style:{fontFamily:c.fonts.semibold,fontSize:w,lineHeight:Math.round(1.3*w),flexShrink:0},children:t.short??t.label})})}),M?null:(0,f.jsx)(o.default,{numberOfLines:1,style:{fontFamily:s?c.fonts.semibold:c.fonts.regular,fontSize:w,lineHeight:Math.round(1.3*w),color:x,textAlign:'center',alignSelf:'center',maxWidth:'100%'},children:t.short??t.label})]},t.id)})})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),l=e(r(d[3])),s=e(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]);const h=56},1059,[31,264,207,128,288,825,1461,25]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=j,_e.periodPay=T,_e.MyHoursPay=C,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),j=(0,a.useOwner)(e=>e.staff),k=(0,i.useMemo)(()=>j.filter(e=>e.active),[j]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),z=(0,a.useOwner)(e=>e.troncHistory),{now:M,rid:v}=(0,y.useCtx)(6e4),N=(0,b.useVenuePay)(v).pay,[B,O]=(0,i.useState)(-1),[L,$]=(0,i.useState)(null),[S,H]=(0,i.useState)(''),[I,W]=(0,i.useState)(null),E=(0,i.useMemo)(()=>k.map(e=>({...T(e.id,B,M,R,D[e.id]??0,N,z),person:e})),[k,B,R,D,N,z]),_=E.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),V=E[0]?.label??'',F=k.find(e=>e.id===L),G=Math.round(100*Number(S));return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,f.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,f.jsx)(P,{label:V,offset:B,setOffset:O,badge:0===B?'Current period':void 0}),(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),E.map(e=>(0,f.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>W(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,f.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:x(e.person.name)}),c&&e.person.noTax?(0,f.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),H(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,f.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]$(null),title:`Hourly rate: ${x(F?.name)}`,children:[(0,f.jsx)(l.Muted,{children:F?`${F.level??a.ROLE_LABEL[F.role]} \xb7 ${F.job}${F.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(F,D[F.id],u.gbp)}`:''}),(0,f.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",value:S,onChangeText:H,style:l.styles.input}),Number.isFinite(G)&&G>0&&G{a.useOwner.getState().setRate(L,G),$(null)}}),L&&null!=D[L]?(0,f.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(L),$(null)}}):null]}),(0,f.jsx)(l.Sheet,{visible:!!I,onClose:()=>W(null),title:`What ${x(k.find(e=>e.id===I)?.name)} sees`,children:I?(0,f.jsx)(C,{staffId:I}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const x=e=>(e??'').replace(' (example)',''),w='Before tax and deductions, estimate';function j(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>T(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function T(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function P({label:e,offset:s,setOffset:t,badge:i}){return(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,f.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e}),i?(0,f.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function C({staffId:e}){const{meId:s,now:C,rid:k}=(0,y.useCtx)(6e4),D=e??s,R=(0,b.useVenuePay)(k).pay,z=(0,a.useOwner)(e=>e.staff).find(e=>e.id===D),M=(0,a.useOwner)(e=>(0,a.liveAttendance)(e.attendance)),v=(0,a.useOwner)(e=>e.troncHistory),N=(0,y.useHourly)(),B=N[D]??0,O=null!=N[D],[L,$]=(0,i.useState)(0),S=j(D,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...T(D,e,C,M,B,R,v)})),[D,M,B,R,v]);return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Banner,{kind:"info",title:w,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,f.jsxs)(l.Muted,{children:[x(z?.name)," \xb7 ",z?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",R.wagePayDay,[1,21,31].includes(R.wagePayDay)?'st':[2,22].includes(R.wagePayDay)?'nd':[3,23].includes(R.wagePayDay)?'rd':'th',", cut-off the ",R.wageCutoffDay,[1,21].includes(R.wageCutoffDay)?'st':[2,22].includes(R.wageCutoffDay)?'nd':[3,23].includes(R.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,f.jsx)(P,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Confirmed paid hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,f.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Gross pay from hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Tips allocated"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,f.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,f.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,f.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,f.jsxs)(l.Muted,{children:[w,". Tips are shown separately and only once a tip period is approved."]})]}),(0,f.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,f.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,f.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,f.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,f.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,100][s]},children:e},e))}),S.shifts.map(e=>(0,f.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,f.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,f.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,f.jsx)(l.T,{size:13,weight:"semibold",style:{width:100},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,f.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,f.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,f.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.label}),(0,f.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,f.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",w.toLowerCase()]})]})},e.o))]})}},1060,[874,1459,31,264,128,288,818,863,820,822,825,1077,953,1185,25]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return k.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return k.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:o}=(0,P.useCtx)(6e4),{pay:r,source:d}=(0,k.useVenuePay)(s),[a,l]=(0,n.useState)(r),[u,c]=(0,n.useState)((0,f.ukDate)(r.tipsAnchorPayday)),[y,x]=(0,n.useState)(null),j=(0,f.parseUk)(u),w=(0,f.cleanPay)({...a,tipsAnchorPayday:j??a.tipsAnchorPayday}),C=JSON.stringify(w)!==JSON.stringify(r)||'settings'!==d,S=(0,f.nextToPay)(w,'tips',o).period,D=(0,f.nextToPay)(w,'wage',o).period,v=(0,f.tipsPeriod)(w,S.start,1),z=(0,f.wagePeriod)(w,D.start,1),H=e=>{l({...a,...e}),x(null)};return(0,M.jsxs)(i.default,{style:{gap:12},testID:"pay-settings",children:['none'===d?(0,M.jsx)(h.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===d?(0,M.jsx)(h.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,M.jsx)(T.SectionHead,{title:"Tips",sub:"How often tips are paid out, and which days each payout covers."}),(0,M.jsxs)(h.Card,{children:[(0,M.jsx)(h.T,{weight:"semibold",children:"How often"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,M.jsx)(h.Chip,{label:$[e],selected:a.tipsFrequency===e,onPress:()=>H({tipsFrequency:e})},e))}),(0,M.jsx)(h.Field,{label:"Next tips payday (DD/MM/YYYY)",value:u,onChangeText:e=>{c((0,t.slashDate)(e,u)),x(null)},maxLength:10,placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),j?(0,M.jsxs)(h.Muted,{children:[(0,f.dayMonth)(j)," ",j.slice(0,4)]}):(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter a date like 02/11/2026"}),(0,M.jsx)(h.T,{weight:"semibold",children:"Each tips period ends"}),(0,M.jsxs)(h.Row,{children:[(0,M.jsx)(h.Stepper,{label:"days before payday",value:a.tipsEndsDaysBefore,min:0,max:13,onChange:e=>H({tipsEndsDaysBefore:e})}),(0,M.jsx)(h.Muted,{style:{flex:1},children:0===a.tipsEndsDaysBefore?'on payday':1===a.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,M.jsx)(T.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,M.jsxs)(h.Card,{children:[(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,M.jsx)(h.Stepper,{label:"pay day",value:a.wagePayDay,min:1,max:31,onChange:e=>H({wagePayDay:e})})]}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,M.jsx)(h.Stepper,{label:"cut-off day",value:a.wageCutoffDay,min:1,max:28,onChange:e=>H({wageCutoffDay:e})})]}),(0,M.jsxs)(h.Muted,{children:["Period runs the ",R(a.wageCutoffDay)," to the ",R(1===a.wageCutoffDay?31:a.wageCutoffDay-1),1===a.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,M.jsx)(h.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,M.jsx)(h.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,M.jsx)(h.Chip,{label:B[e],selected:(a.weekendRule??'none')===e,onPress:()=>H({weekendRule:e})},e))})]}),(0,M.jsx)(T.SectionHead,{title:"Preview"}),(0,M.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,M.jsx)(I,{label:"Next tips payday",day:S.payday,period:S}),(0,M.jsx)(I,{label:"Then",day:v.payday,period:v}),(0,M.jsx)(i.default,{style:{height:1,backgroundColor:b.colours.border}}),(0,M.jsx)(I,{label:"Next payday",day:D.payday,period:D}),(0,M.jsx)(I,{label:"Then",day:z.payday,period:z})]}),(0,M.jsx)(h.Button,{kind:"success",label:'settings'===d?'Save pay dates':'Save as our pay dates',disabled:!j||!C,testID:"save-pay",onPress:()=>{p.useStore.getState().updateSettings(s,{pay:w}),x('Saved. Everyone in the venue sees these dates.')}}),y?(0,M.jsx)(h.Banner,{kind:"success",title:y}):null,(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=H,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return V}}),_e.summaryTable=E,_e.detailTable=Y,_e.copyText=G,_e.periodOptions=U,_e.PayrollHours=function({go:e}){const{rid:s,today:t,now:r,r:p,me:w,meId:T,role:$}=(0,P.useCtx)(6e4),B=(0,C.canSeeHoursEdit)({role:$,isCar:S.IS_CAR}),[R,I]=(0,n.useState)(!1),{pay:z,source:W}=(0,k.useVenuePay)(s),L=(0,y.useOwner)(e=>e.staff),N=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),J=(0,P.useHourly)(),K=(0,a.default)().width<700,[Q,X]=(0,n.useState)(null),[Z,ee]=(0,n.useState)(null),se=e=>{const s=y.useOwner.getState().confirmEntries([e.id],w,T,(new Date).toISOString());Te(s?'Approved. It now counts in the hours and pay.':'Nothing to approve.')},te=e=>(0,M.jsxs)(i.default,{style:{gap:8,marginBottom:8},testID:`daily-${e.person.id}`,children:[e.days.map(e=>(0,M.jsx)(u.ShiftCard,{d:e,manager:!0,onApprove:()=>se(e.a),onEdit:()=>X(e.a),onRemove:()=>ee(e.a)},e.a.id)),e.days.length?null:(0,M.jsx)(h.Muted,{center:!0,children:"No clocked shifts in this period."})]}),oe=(0,n.useMemo)(()=>U(z,t),[z,t]),[ne,re]=(0,n.useState)('wage'),[de,ae]=(0,n.useState)(null),[ie,le]=(0,n.useState)(!1),[ue,ce]=(0,n.useState)({}),[he,pe]=(0,n.useState)(null),ye='custom'===ne&&de?de:(oe.find(e=>e.id===ne)??oe[0]).period,ge=(0,n.useMemo)(()=>H(ye,L,N,r,J),[ye.key,L,N,J,Math.floor(r.getTime()/6e4)]),xe=ge.some(e=>null!=e.rate),fe='tips'===ye.kind,me=ge.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),be=ge.filter(e=>e.pending>0).length,je=`${p.name}: hours ${(0,f.rangeText)(ye.start,ye.end)}`,we=`hours-${ye.start}-to-${ye.end}`,Te=e=>{pe(e),setTimeout(()=>pe(null),6e3)};return y.CAN.manage($)?(0,M.jsxs)(i.default,{style:{gap:10},testID:"payroll-hours",children:['none'===W?(0,M.jsxs)(h.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,M.jsx)(h.Muted,{children:"Using calendar months for now."}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[oe.map(e=>(0,M.jsx)(h.Chip,{label:e.label,sub:e.sub,selected:ne===e.id,onPress:()=>{re(e.id),le(!1)}},e.id)),(0,M.jsx)(h.Chip,{label:"Custom dates",sub:de&&'custom'===ne?(0,f.rangeText)(de.start,de.end):'Pick any range',selected:'custom'===ne,onPress:()=>le(!ie)})]}),ie?(0,M.jsx)(_,{onSet:e=>{ae(e),re('custom'),le(!1)}}):null,(0,M.jsx)(h.Card,{highlight:b.colours.gold,children:(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(i.default,{style:{flexShrink:1,minWidth:0},children:[(0,M.jsxs)(h.T,{weight:"bold",size:18,children:[(0,f.rangeText)(ye.start,ye.end)," ",ye.end.slice(0,4)]}),(0,M.jsxs)(h.Muted,{children:[(0,f.ukDate)(ye.start)," to ",(0,f.ukDate)(ye.end),ye.payday?` \xb7 ${ye.payday>=t?'pays':'paid'} ${(0,f.dayMonth)(ye.payday)}`:'',fe?' \xb7 tips period':'wage'===ye.kind?' \xb7 wage period':'']})]}),(0,M.jsxs)(i.default,{style:{alignItems:'flex-end'},children:[(0,M.jsx)(h.T,{size:22,weight:"bold",colour:b.colours.gold,children:(0,l.durText)(me.c)}),(0,M.jsxs)(h.Muted,{children:["approved",me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]})]})}),(0,M.jsx)(v.HoursExport,{}),B?(0,M.jsx)(i.default,{style:{alignItems:'center'},children:(0,M.jsx)(h.Button,{testID:"add-past-shift",label:"Add past shift",accessibilityLabel:"Add past shift",onPress:()=>I(!0),style:{minHeight:48,minWidth:180}})}):null,be?(0,M.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,M.jsxs)(i.default,{style:{backgroundColor:b.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.amber,gap:4},children:[(0,M.jsxs)(h.T,{weight:"bold",colour:b.colours.amber,children:["\u26a0 ",(0,l.durText)(me.p)," still waiting for approval (",be," ",1===be?'person':'people',")"]}),(0,M.jsx)(h.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):(0,M.jsx)(h.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await G(F(E(ge,ye,xe,fe)));Te(e?`Copied ${ge.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,j.downloadText)(`${we}.csv`,V(E(ge,ye,xe,fe))),Te('CSV downloaded (summary).')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,j.downloadText)(`${we}-daily.csv`,V(Y(ge))),Te('CSV downloaded (one line per shift).')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=E(ge,ye,xe,fe);(0,j.printTable)(je,`${(0,f.ukDate)(ye.start)} to ${(0,f.ukDate)(ye.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,f.ukDate)(t)}`,e[0],e.slice(1))}})]}),he?(0,M.jsx)(h.Banner,{kind:"success",title:he}):null,K?(0,M.jsxs)(i.default,{testID:"hours-table",style:{gap:10},children:[ge.map(e=>{const s=!!ue[e.person.id];return(0,M.jsxs)(i.default,{style:{borderRadius:16,borderWidth:1,borderColor:'rgba(212,175,106,0.45)',backgroundColor:b.colours.surface,padding:12,gap:10},children:[(0,M.jsx)(u.HoursSummaryCard,{name:A(e.person),role:O(e.person),approved:e.confirmed,pending:e.pending,rate:e.rate}),(0,M.jsx)(h.Button,{kind:"secondary",testID:`hours-open-${e.person.id}`,label:s?'Hide shifts':`Show ${e.days.length} ${1===e.days.length?'shift':'shifts'}`,accessibilityLabel:`${s?'Hide':'Show'} ${A(e.person)}'s shifts`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{minHeight:48}}),s?te(e):null]},e.person.id)}),(0,M.jsxs)(h.Muted,{center:!0,children:["Total: ",(0,l.durText)(me.c)," approved",xe?` \xb7 ${(0,x.gbp)(me.g)} gross`:'',me.p?` \xb7 ${(0,l.durText)(me.p)} pending`:'']})]}):(0,M.jsx)(o.WideTable,{children:(0,M.jsxs)(i.default,{testID:"hours-table",children:[(0,M.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''].map((e,s)=>(0,M.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:q[s]},children:e},s))}),ge.map(e=>{const s=!!ue[e.person.id];return(0,M.jsxs)(i.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,M.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:`${A(e.person)} daily hours`,onPress:()=>ce({...ue,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,M.jsxs)(o.TRow,{heads:['Name','Shifts','Approved','Pending',fe?'Tips h':'Hours',xe?'Rate':'',xe?'Gross':''],children:[(0,M.jsxs)(i.default,{style:{width:q[0]},children:[(0,M.jsxs)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",A(e.person)]}),(0,M.jsx)(h.Muted,{children:O(e.person)})]}),(0,M.jsx)(h.T,{size:14,style:{width:q[1]},children:e.shifts}),(0,M.jsx)(h.T,{size:14,weight:"semibold",style:{width:q[2]},children:(0,l.durText)(e.confirmed)}),(0,M.jsx)(h.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?b.colours.amber:b.colours.muted,style:{width:q[3]},children:e.pending?`\u26a0 ${(0,l.durText)(e.pending)}`:'0m'}),(0,M.jsx)(h.T,{size:14,style:{width:q[4]},children:fe?(0,f.decH)(e.confirmed):(0,l.durText)(e.confirmed)}),(0,M.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:q[5]},children:xe?null!=e.rate?(0,x.gbp)(e.rate):'\u2013':''}),(0,M.jsxs)(h.T,{size:14,weight:"semibold",style:{width:q[6]},children:[xe?null!=e.gross?(0,x.gbp)(e.gross):'\u2013':'',xe&&null!=e.rate&&e.pending?(0,M.jsx)(h.T,{size:12,colour:b.colours.amber,children:`\n+ ${(0,x.gbp)(Math.round(e.pending/60*e.rate))} pending`}):null]})]})}),s?te(e):null]},e.person.id)}),(0,M.jsxs)(o.TRow,{heads:['','Shifts','Approved','Pending',fe?'Tips h':'Hours','',xe?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:q[0]},children:["Total (",ge.length,")"]}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[1]},children:me.s}),(0,M.jsx)(h.T,{size:14,weight:"bold",colour:b.colours.gold,style:{width:q[2]},children:(0,l.durText)(me.c)}),(0,M.jsx)(h.T,{size:14,weight:"bold",colour:me.p?b.colours.amber:b.colours.muted,style:{width:q[3]},children:(0,l.durText)(me.p)}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[4]},children:fe?(0,f.decH)(me.c):(0,l.durText)(me.c)}),(0,M.jsx)(h.T,{size:14,style:{width:q[5]},children:" "}),(0,M.jsx)(h.T,{size:14,weight:"bold",style:{width:q[6]},children:xe?(0,x.gbp)(me.g):''})]})]})}),Q?(0,M.jsx)(c.OverrideSheet,{a:Q,staffId:Q.staffId,date:Q.date,onClose:()=>X(null)}):null,Z?(0,M.jsx)(u.RemoveShiftSheet,{a:Z,who:{name:w,id:T},onClose:()=>{ee(null),Te('Removed from hours. It is kept in the history.')}}):null,R?(0,M.jsx)(D.AddPastShiftSheet,{onClose:()=>I(!1),onSaved:()=>{I(!1),Te('Saved. It counts in the hours and pay.')}}):null,(0,M.jsxs)(h.Muted,{children:["Tap a name for each day. Hours read 37h 30m. The export also has decimal hours (37.50) and h:mm for your spreadsheet. Paid hours = clock out \u2212 clock in \u2212 break. ",xe?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),fe?(0,M.jsx)(h.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]}):(0,M.jsx)(h.Muted,{center:!0,testID:"hours-managers-only",children:"Payroll hours are for managers and owners."})},_e.TipsDay=function({go:e}){const{rid:t,today:r,now:a}=(0,P.useCtx)(6e4),{pay:u,source:c}=(0,k.useVenuePay)(t),p=(0,y.useOwner)(e=>e.staff),T=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),C=(0,y.useOwner)(e=>e.tronc),S=(0,f.nextToPay)(u,'tips',r),[D,v]=(0,n.useState)(0),$=(0,f.tipsPeriod)(u,S.period.start,D),[B,R]=(0,n.useState)(''),[I,z]=(0,n.useState)({}),[L,N]=(0,n.useState)(null),E=(0,n.useMemo)(()=>H($,p,T,a,{}),[$.key,p,T]),Y=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,U=e=>I[e.id]??Y(e),_=E.filter(e=>e.confirmed>0||e.pending>0),q=Math.round(100*Number(B.replace(/[\xa3,\s]/g,''))),J=Number.isFinite(q)&&q>0&&q<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(B),K=_.filter(e=>!U(e.person)&&e.confirmed>0),{amounts:Q}=(0,w.allocate)(J?q:0,K.map(e=>e.confirmed)),X={};K.forEach((e,s)=>{X[e.person.id]=Q[s]});const Z=K.reduce((e,s)=>e+s.confirmed,0),ee=Object.values(X).reduce((e,s)=>e+s,0),se=_.filter(e=>e.pending>0&&!U(e.person)),te=se.reduce((e,s)=>e+s.pending,0),oe=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],..._.map(e=>{const s=!U(e.person)&&e.confirmed>0;return[A(e.person),O(e.person),(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),s&&Z?(e.confirmed/Z*100).toFixed(2):'0.00',s?W(X[e.person.id]??0):U(e.person)?'excluded':'0.00']}),['TOTAL','',(0,f.ukDate)($.start),(0,f.ukDate)($.end),$.payday?(0,f.ukDate)($.payday):'',(0,f.decH)(Z),(0,f.hMm)(Z),Z?'100.00':'0.00',W(ee)]],ne=e=>{N(e),setTimeout(()=>N(null),6e3)};return(0,M.jsxs)(i.default,{style:{gap:10},testID:"tips-day",children:[(0,M.jsx)(h.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===c?(0,M.jsxs)(h.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,M.jsx)(h.Muted,{children:"Using weekly tips for now."}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:D<=-6,onPress:()=>v(D-1)}),(0,M.jsxs)(i.default,{style:{alignItems:'center',flex:1},children:[(0,M.jsx)(h.T,{weight:"bold",size:18,children:(0,f.rangeText)($.start,$.end)}),(0,M.jsxs)(h.Muted,{children:[(0,f.ukDate)($.start)," to ",(0,f.ukDate)($.end)," \xb7 ",$.payday>=r?'paid':'was paid'," ",(0,f.dayMonth)($.payday)]}),0===D?(0,M.jsx)(h.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:D>=1,onPress:()=>v(D+1)})]}),(0,M.jsxs)(h.Card,{highlight:b.colours.gold,children:[(0,M.jsx)(h.T,{weight:"semibold",children:"Total tips to share"}),(0,M.jsxs)(h.Row,{style:{alignItems:'center'},children:[(0,M.jsx)(h.T,{size:28,weight:"bold",colour:b.colours.gold,children:"\xa3"}),(0,M.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:B,onChangeText:R,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[h.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),B&&!J?(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Enter an amount like 1250.00"}):(0,M.jsx)(h.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),se.length?(0,M.jsx)(d.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,M.jsxs)(i.default,{style:{backgroundColor:b.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:b.colours.red,gap:4},children:[(0,M.jsxs)(h.T,{weight:"bold",colour:b.colours.red,children:["\u26a0 Don't pay out yet: ",(0,l.durText)(te)," not approved yet"]}),(0,M.jsxs)(h.T,{size:14,children:[se.map(e=>`${A(e.person)} (${(0,l.durText)(e.pending)})`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.gold,children:"Sign off hours \u203a"})]})}):_.length?(0,M.jsx)(h.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,M.jsx)(o.WideTable,{children:(0,M.jsxs)(i.default,{testID:"tips-table",children:[(0,M.jsx)(o.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:b.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,M.jsx)(h.T,{size:12,weight:"semibold",colour:b.colours.gold,style:{width:[64,150,100,64,84][s]},children:e},e))}),_.map(e=>{const s=U(e.person),t=X[e.person.id]??0;return(0,M.jsxs)(o.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,M.jsx)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${A(e.person)}`,onPress:()=>z({...I,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,M.jsx)(i.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?b.colours.muted:b.colours.ok,backgroundColor:s?'transparent':b.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,M.jsx)(h.T,{size:14,colour:b.colours.ok,children:s?'':'\u2713'})})}),(0,M.jsxs)(i.default,{style:{width:150},children:[(0,M.jsx)(h.T,{size:14,weight:"semibold",numberOfLines:1,children:A(e.person)}),(0,M.jsxs)(h.Muted,{numberOfLines:1,children:[s?'Excluded':O(e.person),e.pending?` \xb7 \u26a0 ${(0,f.decH)(e.pending)} h pending`:'']})]}),(0,M.jsxs)(h.T,{size:14,style:{width:80},children:[(0,f.decH)(e.confirmed)," h"]}),(0,M.jsx)(h.T,{size:14,colour:b.colours.muted,style:{width:64},children:!s&&Z?`${(e.confirmed/Z*100).toFixed(1)}%`:'\u2013'}),(0,M.jsx)(h.T,{size:15,weight:"bold",colour:s?b.colours.muted:b.colours.gold,style:{width:84},children:s?'\u2013':(0,x.gbp)(t)})]},e.person.id)}),(0,M.jsxs)(o.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:b.colours.gold},children:[(0,M.jsx)(h.T,{size:14,style:{width:64},children:" "}),(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:150},children:["Total (",K.length," people)"]}),(0,M.jsxs)(h.T,{size:14,weight:"bold",style:{width:80},children:[(0,f.decH)(Z)," h"]}),(0,M.jsx)(h.T,{size:14,style:{width:64},children:Z?'100%':'\u2013'}),(0,M.jsx)(h.T,{size:15,weight:"bold",colour:J&&ee===q?b.colours.ok:b.colours.text,style:{width:84},children:(0,x.gbp)(ee)})]})]})}),_.length?null:(0,M.jsx)(h.Muted,{children:"No clocked hours in this fortnight yet."}),J&&Z?(0,M.jsxs)(h.Muted,{children:["Check: ",K.length," shares add up to ",(0,x.gbp)(ee)," of ",(0,x.gbp)(q)," ",ee===q?'\u2713':'',". \xa3",(q/100/(Z/60)).toFixed(4)," per confirmed hour."]}):null,(0,M.jsxs)(h.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips). Tick or untick anyone for this split."]}),(0,M.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!J,onPress:async()=>{const e=await G(F(oe()));ne(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!J,onPress:()=>{(0,j.downloadText)(`tips-${$.start}-to-${$.end}.csv`,V(oe())),ne('CSV downloaded.')}}),(0,M.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!J,onPress:()=>{const e=oe();(0,j.printTable)(`Tips ${(0,f.rangeText)($.start,$.end)} (paid ${(0,f.dayMonth)($.payday)})`,`Total ${(0,x.gbp)(q)} shared by confirmed hours${se.length?` \xb7 WARNING ${(0,f.decH)(te)} h not signed off`:''}`,e[0],e.slice(1))}})]}),L?(0,M.jsx)(h.Banner,{kind:"success",title:L}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,P.useCtx)(6e4),{pay:o,source:n}=(0,k.useVenuePay)(s),d=(0,f.nextToPay)(o,'tips',t).period,a=(0,f.nextToPay)(o,'wage',t).period;return(0,M.jsxs)(i.default,{testID:"paydays-card",style:{backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:8},children:[(0,M.jsx)(r.CardHeading,{right:'none'===n?(0,M.jsx)(h.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:["Next tips payday: ",(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:d.payday===t?'today':(0,f.dayMonth)(d.payday)})]}),(0,M.jsx)(h.Muted,{children:(0,f.rangeText)(d.start,d.end)})]}),(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:["Next payday: ",(0,M.jsx)(h.T,{weight:"semibold",colour:b.colours.goldLight,children:a.payday===t?'today':(0,f.dayMonth)(a.payday)})]}),(0,M.jsxs)(h.Muted,{children:["period ",(0,f.rangeText)(a.start,a.end)]})]}),(0,M.jsxs)(r.ActionGrid,{testID:"paydays-actions",children:[(0,M.jsx)(r.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,M.jsx)(r.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==n?(0,M.jsx)(h.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,P.useCtx)(6e4),r=e??n,{pay:d}=(0,k.useVenuePay)(s),a=(0,y.useOwner)(e=>(0,y.liveAttendance)(e.attendance)),u=(0,y.useOwner)(e=>e.staff.find(e=>e.id===r)),c=(0,f.wagePeriod)(d,t,0),p=(0,f.tipsPeriod)(d,t,0),x=e=>u?H(e,[u],a,o,{})[0]??null:null,j=(e,s,o)=>(0,M.jsxs)(i.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:2},children:[(0,M.jsx)(h.T,{size:13,weight:"semibold",colour:b.colours.gold,children:e.toUpperCase()}),(0,M.jsxs)(h.Muted,{children:[(0,f.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,f.dayMonth)(s.payday)]}),(0,M.jsx)(h.T,{size:24,weight:"bold",children:(0,l.durText)(o?.confirmed??0)}),(0,M.jsxs)(h.Muted,{children:["approved \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,M.jsxs)(h.T,{size:13,colour:b.colours.amber,children:["+ ",(0,l.durText)(o.pending)," waiting for approval"]}):null]},e);return(0,M.jsx)(h.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[j('This pay period',c,x(c)),j('This tips fortnight',p,x(p))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]);_r(_d[5]);var d=e(_r(_d[6])),a=e(_r(_d[7])),i=e(_r(_d[8])),l=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),f=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),P=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),S=_r(_d[24]),D=_r(_d[25]),v=_r(_d[26]),M=_r(_d[27]);const $={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},B={none:'Keep the date',before:'Friday before',after:'Monday after'};const R=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function I({label:e,day:s,period:t}){return(0,M.jsxs)(h.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,M.jsxs)(h.T,{children:[e,": ",(0,M.jsx)(h.T,{weight:"bold",colour:b.colours.gold,children:(0,f.dayMonth)(s)})]}),(0,M.jsx)(h.Muted,{children:(0,f.rangeText)(t.start,t.end)})]})}const z=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function H(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,P.paidMins)(e,o),t=(0,y.attStatus)(e);return{a:e,date:e.date,inT:z(e.in),outT:z(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),a=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:a,gross:null!=a?Math.round(d/60*a):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const O=e=>`${y.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,A=e=>e.name.replace(' (example)',''),W=e=>null==e?'':(e/100).toFixed(2),L=e=>e.replace(/[\t\r\n]+/g,' '),N=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,F=e=>e.map(e=>e.map(L).join('\t')).join('\n'),V=e=>e.map(e=>e.map(N).join(',')).join('\r\n');function E(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[A(e.person),O(e.person),(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(e.confirmed),(0,f.hMm)(e.confirmed),(0,f.decH)(e.pending),(0,f.hMm)(e.pending),String(e.shifts),...o?[(0,f.decH)(e.confirmed)]:[],...t?[W(e.rate),W(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,f.ukDate)(s.start),(0,f.ukDate)(s.end),(0,f.decH)(d.c),(0,f.hMm)(d.c),(0,f.decH)(d.p),(0,f.hMm)(d.p),String(d.s),...o?[(0,f.decH)(d.c)]:[],...t?['',W(d.g)]:[]]]}function Y(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[A(e.person),O(e.person),(0,f.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,f.decH)(s.paid),'On now'===s.status?'':(0,f.hMm)(s.paid),s.status]))]}async function G(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function U(e,s){const t=(0,f.nextToPay)(e,'wage',s),o=(0,f.nextToPay)(e,'tips',s),n=(0,f.wagePeriod)(e,t.period.start,-1),r=(0,f.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,f.dayMonth)(e.payday)}`:`Paid ${(0,f.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,f.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,f.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,f.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,f.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function _({onSet:e}){const[s,o]=(0,n.useState)(''),[r,d]=(0,n.useState)(''),a=(0,f.parseUk)(s),l=(0,f.parseUk)(r),u=!!a&&!!l&&l>=a&&(0,f.plusDays)(a,92)>=l;return(0,M.jsxs)(h.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,M.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,M.jsx)(h.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:e=>o((0,t.slashDate)(e,s)),placeholder:"23/10/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,M.jsx)(i.default,{style:{flexBasis:130,flexGrow:1},children:(0,M.jsx)(h.Field,{label:"To (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,t.slashDate)(e,r)),placeholder:"22/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,M.jsx)(h.Button,{small:!0,kind:"success",label:"Show",disabled:!u,onPress:()=>u&&e((0,f.customPeriod)(a,l))}),s&&r&&!u?(0,M.jsx)(h.T,{size:13,colour:b.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const q=[150,54,100,90,48,62,70]},1061,[874,834,1459,31,1460,123,264,288,128,1462,1463,1464,818,881,863,820,1184,825,1386,1063,1077,953,1185,1465,807,1466,1470,25]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=ee,Object.defineProperty(_e,"ROTA_GAP",{enumerable:!0,get:function(){return se}}),_e.rotaGrid=ne,_e.Rota=function({go:e}={}){const{now:t,role:n,meId:o}=(0,$.useCtx)(6e4),i=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),r=(0,s.useOwner)(e=>e.shifts),d=(0,$.useHourly)(),u=(0,s.useOwner)(e=>e.availability),m=(0,s.useOwner)(e=>e.leave),x=(0,s.useOwner)(e=>e.swaps),b=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),[I,M]=(0,l.useState)(0),B=(0,Y.useDateCalendar)(),[P,R]=(0,l.useState)(null),[A,z]=(0,l.useState)(null),[H,W]=(0,l.useState)(null),[F,G]=(0,l.useState)('week'),[Q,ie]=(0,l.useState)(!1),le=(0,$.useSignedIn)()?.name??'',re='staff'!==n,de=(0,C.addMins)(Z(t),7*I*1440);de.setHours(0,0,0,0);const ce=ee(de),ue=ce.sales,he='none'===ce.mode,fe=Array.from({length:7},(e,t)=>{const s=new Date(de);return s.setDate(de.getDate()+t),(0,C.ymd)(s)}),me=(0,s.visibleShifts)(r,re).filter(e=>e.date>=fe[0]&&e.date<=fe[6]),ge=(()=>{const e=new Date(de);return e.setDate(e.getDate()-7),(0,C.ymd)(e)})(),pe=me.filter(e=>!e.published||e.changed).length,xe=r.filter(e=>e.date>=ge&&e.date!!(0,s.leaveOn)(m,e,t),je=fe.map(e=>(0,g.workingShifts)(me,m).filter(t=>t.date===e).reduce((e,t)=>{return e+(X(s=t)-J(X(s)))*(d[s.staffId]??0);var s},0)),we=je.reduce((e,t)=>e+t,0),ye=ue.reduce((e,t)=>e+t,0),ke=(e,t)=>t?Math.round(e/t*100):0,Ie=re?i:i.filter(e=>e.id===o),Se=(0,a.useNarrow)(),Ce=Math.max(0,fe.indexOf((0,C.ymd)(t))),[De,ve]=(0,l.useState)(null),Te=De??Ce,$e=(e,t)=>!Se||t===Te,[Oe,Me]=(0,l.useState)(0),Be=ne(Oe,Se?1:7),Pe=Be.cell,Re=Be.name;return(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Week",selected:'week'===F,onPress:()=>G('week')}),(0,V.jsx)(f.Chip,{label:`Swaps & time off (${x.filter(e=>'open'===e.status).length+m.filter(e=>'pending'===e.status).length})`,selected:'requests'===F,onPress:()=>G('requests')}),(0,V.jsx)(f.Chip,{label:"Availability",selected:'availability'===F,onPress:()=>G('availability')})]}),'week'===F?(0,V.jsxs)(V.Fragment,{children:[!re&&o?(0,V.jsx)(k.RequestTimeOff,{meId:o,me:le,testID:"rota-time-off"}):null,e&&s.CAN.manage(n)?(0,V.jsx)(h.default,{testID:"rota-timesheet-row",style:{alignItems:'center',alignSelf:'stretch'},children:(0,V.jsx)(f.Button,{testID:"rota-timesheet",label:"Time sheet",accessibilityLabel:(0,N.timeSheetLabel)(fe[0],fe[6]),onPress:()=>{(0,N.setHoursPreset)(fe[0],fe[6]),e('more','hours')},style:{minWidth:220,maxWidth:"100%",minHeight:48}})}):null,(0,V.jsxs)(h.default,{testID:"rota-week-nav",style:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',alignSelf:'center',width:Oe?Math.min(Oe,Be.width):'100%',maxWidth:'100%',gap:8,justifyContent:'center'},children:[(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-prev",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{M(I-1),R(null)},style:{minWidth:96}}),(0,V.jsxs)(h.default,{style:{alignItems:'center',flex:1,minWidth:0},children:[(0,V.jsxs)(f.T,{weight:"semibold",center:!0,children:["Week of ",(0,C.niceDate)(de)]}),(0,V.jsxs)(f.Muted,{center:!0,children:[0===I?'This week':1===I?'Next week':-1===I?'Last week':I>0?`In ${I} weeks`:-I+" weeks ago",re?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-next",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{M(I+1),R(null)},style:{minWidth:96}})]}),(0,V.jsx)(h.default,{style:{alignItems:'center',alignSelf:'center'},children:(0,V.jsx)(f.Button,{small:!0,kind:"ghost",testID:"rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:B.openCal,style:{minWidth:96}})}),(0,V.jsx)(Y.AppDateCalendar,{visible:B.calOpen,today:(0,C.ymd)(t),day:(0,C.ymd)(de),idPrefix:"rota-cal",onClose:B.closeCal,onDay:e=>{M((0,Y.weekOffsetOf)(e??(0,C.ymd)(t),(0,C.ymd)(t))),R(null)}}),re?(0,V.jsxs)(f.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,V.jsx)(f.Button,{small:!0,kind:"secondary",label:"Copy last week"+(xe?` (${xe})`:''),disabled:!xe,testID:"rota-copy",onPress:()=>{const e=s.useOwner.getState().copyWeek(ge,fe[0]);R(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,V.jsx)(f.Button,{small:!0,kind:"success",label:pe?`Publish ${pe} ${1===pe?'change':'changes'}`:'Week published',disabled:!pe,testID:"rota-publish",onPress:()=>{const e=s.useOwner.getState().publishWeek(fe[0]);R(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),pe?(0,V.jsx)(f.Badge,{kind:"amber",label:`${pe} unpublished`}):me.length?(0,V.jsx)(f.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,P?(0,V.jsx)(f.Banner,{kind:"success",title:P}):null,Se?(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:$.DAY3.map((e,t)=>q.IS_CAR?(0,V.jsx)(f.Button,{kind:t===Te?'primary':'secondary',label:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}`,accessibilityLabel:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}${t===Te?', chosen':''}`,testID:`rota-day-${e.toLowerCase()}`,onPress:()=>ve(t),style:{minHeight:64,minWidth:96}},e):(0,V.jsx)(f.Chip,{label:`${e} ${(0,C.parseYmd)(fe[t]).getDate()}`,selected:t===Te,onPress:()=>ve(t)},e))}):null,(0,V.jsx)(h.default,{testID:"rota-grid-wrap",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.width);Math.abs(t-Oe)>1&&Me(t)},style:{alignSelf:'stretch'},children:(0,V.jsx)(oe,{fits:Se||Be.fits,children:(0,V.jsxs)(h.default,{testID:"rota-grid",style:{gap:se,width:Be.width,alignSelf:'center'},children:[(0,V.jsxs)(h.default,{testID:"rota-dates",style:[{flexDirection:'row',gap:se,backgroundColor:D.colours.bg,paddingVertical:8,borderBottomWidth:1,borderColor:D.colours.hairline,zIndex:5},Se||Be.fits?ae:null],children:[(0,V.jsx)(h.default,{style:{width:Re,justifyContent:'center'},children:(0,V.jsx)(f.T,{size:11,weight:"semibold",colour:D.colours.goldMuted,style:{letterSpacing:1.2},children:"TEAM"})}),$.DAY3.map((e,s)=>(0,V.jsx)(h.default,{testID:"rota-date",style:{width:Pe,alignItems:'center'},children:(0,V.jsxs)(f.T,{size:Be.big?13:12,weight:"semibold",center:!0,colour:fe[s]===(0,C.ymd)(t)?D.colours.gold:D.colours.text,children:[e," ",(0,C.parseYmd)(fe[s]).getDate()]})},e)).filter($e)]}),Ie.map(e=>(0,V.jsxs)(h.default,{testID:"rota-row",style:{flexDirection:'row',gap:se,alignItems:'center'},children:[(0,V.jsxs)(h.default,{testID:"rota-name",style:{width:Re,flexDirection:'row',alignItems:'center',gap:8,overflow:'hidden'},children:[(0,V.jsx)(O.StaffAvatar,{id:e.id,size:28}),(0,V.jsxs)(h.default,{style:{flex:1,minWidth:0},children:[(0,V.jsx)(f.T,{size:13,weight:"semibold",numberOfLines:1,style:{textAlign:'left'},children:e.name.replace(' (example)','')}),e.job?(0,V.jsx)(f.T,{size:11,colour:D.colours.muted,numberOfLines:1,style:{textAlign:'left'},children:e.job}):null]})]}),$.DAY3.map((t,n)=>{const a=(0,s.shiftOf)(me,e.id,fe[n]),o=(u[e.id]??[]).includes(n),i=be(e.id,fe[n]),l=(0,p.rotaCellWorked)(a,b,e.id,fe[n],re),r=!(!re||!l.workedLine&&!l.onShiftNow);return(0,V.jsxs)(c.default,{testID:"rota-cell",accessibilityRole:"button",accessibilityLabel:`${e.name.replace(' (example)','')} ${$.DAY3[n]}, ${l.speech}${(0,E.badgeSpoken)(a?.badge)}${i?', on time off':''}${o?', unavailable':''}`,disabled:!re,onPress:()=>{a?W({staffId:e.id,date:fe[n],shift:a}):z({staffId:e.id,date:fe[n]})},style:({pressed:e})=>({width:Pe,minHeight:q.IS_CAR?64:r?80:52,height:r||(0,E.cleanBadge)(a?.badge)||q.IS_CAR?void 0:52,borderRadius:12,borderWidth:1,borderStyle:a&&!a.published?'dashed':'solid',borderColor:l.differs?D.colours.amber:a?a.published?D.colours.gold:D.colours.amber:D.colours.border,backgroundColor:e?D.colours.goldTint:a?a.published?'#2b2414':'#241f14':i?'#1d2a3a':o?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center',paddingHorizontal:4,paddingVertical:r||(0,E.cleanBadge)(a?.badge)?6:0}),children:[a?(0,V.jsxs)(f.T,{size:Be.big?13:12,weight:"semibold",center:!0,numberOfLines:1,children:[(0,$.fmtH)(a.start),"\u2013",(0,$.fmtH)(a.end)]}):l.workedLine?null:(0,V.jsx)(f.T,{size:12,center:!0,colour:D.colours.muted,children:i?'Off':o?'Unavail.':re?'Add':'\u2013'}),(0,E.cleanBadge)(a?.badge)?(0,V.jsx)(h.default,{testID:"rota-badge",style:{marginTop:2,borderRadius:8,borderWidth:1,borderColor:D.colours.gold,paddingHorizontal:5,maxWidth:'100%'},children:(0,V.jsx)(f.T,{size:10,weight:"semibold",colour:D.colours.gold,center:!0,numberOfLines:1,children:(0,E.cleanBadge)(a?.badge)})}):null,l.workedLine?(0,V.jsx)(f.T,{testID:"rota-worked",size:10,colour:l.differs?D.colours.amber:D.colours.goldLight,center:!0,children:l.workedLine}):null,l.onShiftNow?(0,V.jsx)(f.T,{testID:"rota-on-shift-now",size:10,colour:D.colours.goldLight,center:!0,children:"On shift now"}):null,l.diffLabel?(0,V.jsx)(f.T,{size:10,colour:D.colours.amber,center:!0,children:l.diffLabel}):null,a&&i?(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.blue,children:(0,g.leaveLabel)((0,s.leaveOn)(m,e.id,fe[n])).toLowerCase()}):a&&o?(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.red,children:"unavailable"}):!a||!re||a.published&&!a.changed||l.workedLine||l.onShiftNow?null:(0,V.jsx)(f.T,{size:10,center:!0,colour:D.colours.amber,children:a.published?'changed':'draft'})]},n)}).filter($e)]},e.id)),re?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se,marginTop:4},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:"Labour"})}),je.map((e,t)=>(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,children:(0,S.gbp)(e).replace('.00','')})},t)).filter($e)]}),he?null:(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:'example'===ce.mode?'Fcst sales (ex.)':'Fcst sales'})}),ue.map((e,t)=>(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,colour:D.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter($e)]}),he?null:(0,V.jsxs)(h.default,{style:{flexDirection:'row',gap:se},children:[(0,V.jsx)(h.default,{style:{width:Re},children:(0,V.jsx)(f.Muted,{children:"Labour %"})}),je.map((e,t)=>{const s=ke(e,ue[t]);return(0,V.jsx)(h.default,{style:{width:Pe,alignItems:'center'},children:(0,V.jsx)(f.T,{size:12,center:!0,weight:"semibold",colour:ue[t]?s>32?D.colours.red:s>26?D.colours.amber:D.colours.ok:D.colours.muted,children:ue[t]?`${s}%`:'\u2013'})},t)}).filter($e)]})]}):null]})})}),!re&&o?(0,V.jsx)(h.default,{testID:"rota-team-on",children:(0,V.jsx)(f.Card,{children:fe.map((e,t)=>(0,V.jsx)(j.TeamOnDay,{date:e,meId:o,label:(0,C.niceDate)((0,C.parseYmd)(e))},e)).filter($e)})}):null,re&&he?(0,V.jsx)(f.Card,{children:(0,V.jsxs)(h.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Labour this week"}),(0,V.jsx)(h.default,{testID:"labour-week-cost",children:(0,V.jsx)(f.T,{weight:"semibold",children:(0,S.gbp)(we)})})]}),(0,V.jsxs)(f.Muted,{children:[(0,S.gbp)(we)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,V.jsx)(f.T,{weight:"semibold",colour:D.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,V.jsx)(f.Muted,{children:`Forecasts start once CoverCharge has ${1===ce.weeks?'1 week':`${ce.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),ce.booked?(0,V.jsx)(h.default,{testID:"labour-booked",children:(0,V.jsxs)(f.T,{children:["Booked so far: ",ce.booked," Covers this week"]})}):null]})}):null,re&&!he?(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,V.jsxs)(f.Row,{gap:6,children:['example'===ce.mode?(0,V.jsx)(L.ExampleBadge,{}):null,(0,V.jsx)(f.Badge,{kind:ke(we,ye)>30?'red':'ok',label:`${ke(we,ye)}% this week`})]})]}),(0,V.jsxs)(f.Muted,{children:[(0,S.gbp)(we)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,S.gbp)(ye)," forecast sales. Target 25\u201330%. ",'example'===ce.mode?'Example figures: forecast sales use an example spend per cover.':'Forecast sales are your average takings for each weekday from your cash-ups.']}),(()=>{const e=ke(je[5],ue[5]);return e&&e<24?(0,V.jsxs)(f.T,{size:14,colour:D.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,re?(0,V.jsx)(f.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===F?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v.SectionHead,{title:"Shift swaps & cover"}),x.filter(e=>re||e.fromId===o||e.toId===o).map(e=>{const t=r.find(t=>t.id===e.shiftId),n=i.find(t=>t.id===e.fromId),a=i.find(t=>t.id===e.toId);return(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",n?.name]}),(0,V.jsx)(f.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,V.jsxs)(f.Muted,{children:[t?`${$.DAY3[t.day]} ${(0,$.fmtH)(t.start)}\u2013${(0,$.fmtH)(t.end)}`:'Shift',a?` \u2192 ${a.name}`:''," \xb7 ",e.note]}),'open'===e.status&&re?(0,V.jsxs)(f.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:i.filter(e=>U(n,e)).map(t=>(0,V.jsx)(f.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{s.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,V.jsx)(f.Button,{small:!0,label:"Approve",disabled:!e.toId||!U(n,a),onPress:()=>{s.useOwner.getState().setSwap(e.id,'approved');const n=e=>(i.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,T.autoPost)('all','swap'===e.kind?`Shift swap: ${n(e.fromId)} \u2194 ${n(e.toId)} approved`:`Cover approved: ${n(e.toId)} covers ${n(e.fromId)}${t?` (${$.DAY3[t.day]} ${(0,$.fmtH)(t.start)}\u2013${(0,$.fmtH)(t.end)})`:''}`)}}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),re?null:(0,V.jsxs)(f.Card,{children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,V.jsx)(f.Muted,{children:"Your shifts this week. Your manager approves every swap."}),(0,V.jsx)(f.Muted,{testID:"swap-dept-note",children:(0,w.isAnchorageVenue)(y.VENUE_RID)?w.ANCHORAGE_SWAP_NOTE:K(i.find(e=>e.id===o))?w.SWAP_DEPT_NOTE:'Your department isn\u2019t set yet, so swaps are off. Ask a manager to set it in Staff & roles.'}),me.filter(e=>e.staffId===o).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=x.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,V.jsxs)(h.default,{style:{gap:4,paddingVertical:4},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:14,weight:"medium",children:[$.DAY3[e.day]," ",(0,$.fmtH)(e.start),"\u2013",(0,$.fmtH)(e.end),(0,E.cleanBadge)(e.badge)?` \xb7 ${(0,E.cleanBadge)(e.badge)}`:'']}),t?(0,V.jsx)(f.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Ask for cover",onPress:()=>{s.useOwner.getState().addSwap({shiftId:e.id,fromId:o,kind:'cover',note:'Can anyone cover?'}),(0,T.autoPost)('all',`Cover needed: ${$.DAY3[e.day]} ${(0,$.fmtH)(e.start)}\u2013${(0,$.fmtH)(e.end)} (${(i.find(e=>e.id===o)?.name??'').replace(' (example)','')})`)}}),i.filter(e=>U(i.find(e=>e.id===o),e)).map(t=>(0,V.jsx)(f.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>s.useOwner.getState().addSwap({shiftId:e.id,fromId:o,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),me.some(e=>e.staffId===o)?null:(0,V.jsx)(f.Muted,{children:"No shifts on the rota this week."})]}),(0,V.jsx)(v.SectionHead,{title:"Holiday & time off"}),re?(0,V.jsx)(f.Button,{label:"Add time off for someone",testID:"rota-add-time-off",onPress:()=>ie(!0)}):o?(0,V.jsx)(k.RequestTimeOff,{meId:o,me:le,testID:"rota-requests-time-off"}):null,m.filter(e=>re||e.staffId===o).sort((e,t)=>e.from.localeCompare(t.from)).map(e=>(0,V.jsx)(f.Card,{children:(0,V.jsxs)(h.default,{testID:`leave-${e.id}`,style:{gap:4},children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",children:(i.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')}),(0,V.jsx)(f.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:'pending'===e.status?'waiting':e.status})]}),(0,V.jsxs)(f.Muted,{children:[(0,k.rangeLabel)(e.from,e.to)," \xb7 ",e.reason,e.decidedBy?` \xb7 ${'declined'===e.status?'declined':'approved'} by ${e.decidedBy}`:e.by?` \xb7 asked by ${e.by}`:'']}),'pending'===e.status&&re?(0,V.jsxs)(f.Row,{gap:6,style:{justifyContent:'center'},children:[(0,V.jsx)(f.Button,{small:!0,label:"Approve",onPress:()=>s.useOwner.getState().setLeave(e.id,'approved')}),(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s.useOwner.getState().setLeave(e.id,'declined')})]}):null]})},e.id)),re&&o?(0,V.jsx)(k.TimeOffSheet,{visible:Q,onClose:()=>ie(!1),meId:o,me:le,manager:!0}):null]}):null,'availability'===F?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(f.Muted,{children:["Days each person can\u2019t work. ",re?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),Ie.filter(e=>'owner'!==e.role||!re).map(e=>(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{gap:8,children:[(0,V.jsx)(O.StaffAvatar,{id:e.id,size:30}),(0,V.jsx)(f.T,{weight:"semibold",children:e.name})]}),(0,V.jsx)(f.Row,{wrap:!0,gap:4,children:$.DAY3.map((t,n)=>{const a=(u[e.id]??[]).includes(n);return(0,V.jsx)(f.Chip,{label:`${t} ${a?'\u2715':'\u2713'}`,selected:!a,onPress:()=>s.useOwner.getState().toggleAvail(e.id,n)},t)})})]},e.id))]}):null,H?(0,V.jsx)(_.AssignRoleSheet,{name:(i.find(e=>e.id===H.staffId)?.name??'Team member').replace(' (example)',''),when:`${(0,C.niceDate)((0,C.parseYmd)(H.date))} \xb7 ${(0,$.fmtH)(H.shift.start)}\u2013${(0,$.fmtH)(H.shift.end)}`,current:H.shift.badge,onSave:e=>{s.useOwner.getState().setShifts((0,E.assignShiftBadge)(s.useOwner.getState().shifts,H.shift.id,e)),W(null)},onEditTimes:()=>{z(H),W(null)},onClose:()=>W(null)}):null,A?(0,V.jsx)(te,{init:A,onClose:()=>z(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:a,meId:u,me:m,r:g,rid:p}=(0,$.useCtx)(5e3),x=((0,M.useClockArea)(e=>e.areas[p]),(0,M.areaOf)(p));const j=(0,B.privateClockVenue)(p),[w,y]=(0,l.useState)(!1),k=(0,s.useOwner)(e=>e.consent[u]),I=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),S=(0,s.useOwner)(e=>e.shifts),[v,T]=(0,l.useState)(!1),[L,H]=(0,l.useState)(null),[N,W]=(0,l.useState)(null),[Y,F]=(0,l.useState)(void 0),[E,_]=(0,l.useState)(null),[q,K]=(0,l.useState)(!1),[U,G]=(0,l.useState)(null),Q=I.filter(t=>t.staffId===u&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],X=Q&&(0,s.isOnBreak)(Q)?Q.breaks[Q.breaks.length-1]:void 0,J=(0,s.visibleShifts)(S,'staff'!==a).find(e=>e.staffId===u&&e.date===t),Z='staff'!==a,ee=Q?(0,$.paidMins)({in:Q.in},e).worked:0,te=x.on&&(0,P.areaSet)(x),se=Q?.geo?.[Q.geo.length-1],ne=I.filter(e=>e.staffId===u&&e.date===t).sort((e,t)=>(t.in??'').localeCompare(e.in??''))[0],ae=(0,r.useClockNotSent)(Q?.id??E?.id??ne?.id),[oe,re]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if(ae)re(!0);else if(oe){const e=setTimeout(()=>re(!1),6e3);return()=>clearTimeout(e)}},[ae]);const de=!ae&&oe,ce=async(s,n={})=>{H(s),W(null),F(void 0);const a=await(0,R.clockAction)(s,{rid:p,staffId:u,date:t,at:new Date(e.getTime()).toISOString(),...n});return H(null),a.ok?('out'===s&&a.att&&(_(a.att),(0,i.hrSettingsOf)(g.settings?.hr).on&&!o.useHr.getState().hasAnswered(p,a.att.id)&&G(a.att)),'in'===s&&_(null),a.att&&(0,r.markClockUnsent)(a.att.id),!0):(W(a.message),F(a.fix),(0,A.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:a.message.split('. ')[0]+'.',body:a.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return k?(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.Row,{gap:10,style:{flex:1},children:[(0,V.jsx)(O.StaffAvatar,{id:u,size:48}),(0,V.jsx)(f.T,{weight:"semibold",style:{flex:1},children:m})]}),(0,V.jsx)(f.Badge,{kind:Q?'ok':'neutral',label:Q?`On shift since ${(0,C.hm)(new Date(Q.in))}`:'Not clocked in'})]}),(0,V.jsx)(f.Muted,{children:J?`Today's shift: ${(0,$.fmtH)(J.start)}\u2013${(0,$.fmtH)(J.end)}`:'No shift on the rota today'}),(0,V.jsx)(h.default,{testID:"clock-area-line",children:(0,V.jsx)(f.T,{size:14,colour:D.colours.muted,children:te?j?`Location is checked only when you choose Clock in, at ${g.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${g.name}.`:x.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),se&&!0===se.inside&&null!=se.dist?(0,V.jsxs)(f.Muted,{children:["Last check: at the venue (about ",se.dist," m from the centre)."]}):null,Q?(0,V.jsx)(f.T,{size:30,weight:"bold",center:!0,children:(0,$.hmDur)(ee)}):null,Q&&X?(0,V.jsx)(h.default,{testID:"on-break",children:(0,V.jsxs)(f.T,{size:15,weight:"semibold",colour:D.colours.gold,center:!0,children:["On a break since ",(0,C.hm)(new Date(X.start))," \xb7 ",(0,s.loggedBreakMins)(Q,e)," min so far"]})}):null,Q?(0,V.jsxs)(V.Fragment,{children:[X?(0,V.jsx)(f.Button,{testID:"break-end",kind:"success",label:'break_end'===L?'Checking your location\u2026':'End break',disabled:!!L,onPress:()=>{ce('break_end')}}):(0,V.jsx)(f.Button,{testID:"break-start",kind:"secondary",label:'break_start'===L?'Checking your location\u2026':'Start break',disabled:!!L,onPress:()=>{ce('break_start')}}),(0,V.jsx)(f.Button,{testID:"clock-out",kind:"danger",label:'out'===L?'Checking your location\u2026':'Clock out',disabled:!!L,onPress:()=>{Q.breaks?.length?ce('out'):(W(null),T(!0))}})]}):(0,V.jsx)(f.Button,{testID:"clock-in",kind:"success",label:'in'===L?'Checking your location\u2026':'Clock in',disabled:!!L,onPress:()=>{j?y(!0):ce('in')}}),ae?(0,V.jsxs)(h.default,{testID:"clock-not-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:"Not sent yet. Your clock time is saved on this phone and will send as soon as it can. Keep the app open for a moment.",style:{alignSelf:'center',alignItems:'center',gap:4,borderRadius:14,borderWidth:1.5,borderColor:D.colours.gold,backgroundColor:'rgba(212,175,106,0.12)',paddingVertical:10,paddingHorizontal:16,maxWidth:460,width:'100%'},children:[(0,V.jsx)(f.T,{size:18,weight:"bold",colour:D.colours.gold,center:!0,children:"Not sent yet"}),(0,V.jsx)(f.T,{size:14,center:!0,children:"Saved on this phone. It sends as soon as it can. Keep the app open for a moment."}),(0,V.jsx)(f.Button,{small:!0,kind:"secondary",testID:"clock-send-now",label:"Send now",accessibilityLabel:"Send my clock time now",onPress:()=>{d.mutationQueue.retryNow()}})]}):de?(0,V.jsx)(h.default,{testID:"clock-sent",accessible:!0,accessibilityLabel:"Sent to your manager",children:(0,V.jsx)(f.T,{size:14,colour:D.colours.ok,center:!0,children:"\u2713 Sent"})}):null,Q?.breaks?.length?(0,V.jsxs)(f.Muted,{center:!0,children:["Breaks today: ",Q.breaks.map(e=>`${(0,C.hm)(new Date(e.start))}\u2013${e.end?(0,C.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,s.loggedBreakMins)(Q,e)," min)"]}):null,N?(0,V.jsx)(h.default,{testID:"clock-message",children:(0,V.jsx)(f.Banner,{kind:"warn",title:"Not recorded",children:N})}):null,N&&'settings'===Y?(0,V.jsx)(f.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:z.openAppSettings}):null,N&&'location'===Y?(0,V.jsx)(f.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:z.openLocationSettings}):null,N&&'update'===Y?(0,V.jsx)(f.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:z.checkAppUpdate}):null]}),Z&&!(0,P.areaSet)(x)?(0,V.jsx)(h.default,{testID:"clock-area-warning",children:(0,V.jsx)(f.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,V.jsx)(c.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>K(!0),style:{alignSelf:'center',padding:6},children:(0,V.jsx)(f.T,{size:14,colour:D.colours.gold,children:"Forgot to clock in or out?"})}),q?(0,V.jsx)(le,{onClose:()=>K(!1)}):null,(0,V.jsx)(b.BreakRoomCard,{staffId:u,name:m,now:e}),E?(()=>{const t=(0,$.paidMins)(E,e);return(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsxs)(f.T,{weight:"semibold",colour:D.colours.gold,children:["Clocked out at ",(0,C.hm)(new Date(E.out))]}),(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["Clocked ",(0,$.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,$.hmDur)(t.paid)]}),(0,V.jsxs)(f.Muted,{children:["In ",(0,C.hm)(new Date(E.in))," \xb7 out ",(0,C.hm)(new Date(E.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",E.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,V.jsx)(f.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,V.jsx)(f.Sheet,{visible:w,onClose:()=>y(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,V.jsxs)(h.default,{style:{gap:12},children:[(0,V.jsxs)(f.T,{children:["We check once that you are at ",g.name,", within about ",x.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,V.jsx)(f.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,V.jsx)(f.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{y(!1),ce('in')}}),(0,V.jsx)(f.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>y(!1)})]})}),Z?(0,V.jsx)(ie,{rid:p,today:t,now:e}):null,U?(0,V.jsx)(n.ShiftCheckout,{rid:p,shiftKey:U.id,day:U.date,meId:u,onClose:()=>G(null)}):null,(0,V.jsx)(f.Sheet,{visible:v,onClose:()=>T(!1),title:"Did you take a break? If so, how long?",children:(0,V.jsxs)(h.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,V.jsx)(f.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,V.jsx)(f.Chip,{testID:`forgot-break-${e}`,label:(0,P.breakLabel)(e),disabled:e>=ee,onPress:()=>{T(!1),ce('out',{addedBreak:e})}},e))}),(0,V.jsx)(f.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{T(!1),ce('out',{breakMins:0})}}),ee>360?(0,V.jsx)(f.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,V.jsx)(f.Muted,{children:j?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,V.jsx)(h.default,{style:{gap:10},children:(0,V.jsxs)(f.Card,{highlight:D.colours.gold,children:[(0,V.jsx)(f.T,{weight:"semibold",colour:D.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(f.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",g.name,", within about ",x.radius," m."]}),(0,V.jsx)(f.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,V.jsxs)(V.Fragment,{children:[" ",(0,V.jsxs)(f.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,V.jsx)(f.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",g.name," (within about ",x.radius," m)."]}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,V.jsx)(f.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,V.jsx)(f.Button,{label:"I understand \u2014 continue",onPress:()=>s.useOwner.getState().giveConsent(u,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,$.useCtx)(3e4);return s!=='staff'?(0,V.jsx)(de,{now:e,today:t,meId:n}):(0,V.jsx)(re,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]);_r(_d[9]);var c=e(_r(_d[10])),u=e(_r(_d[11])),h=e(_r(_d[12])),f=_r(_d[13]),m=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),y=_r(_d[21]),k=_r(_d[22]),I=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),D=_r(_d[26]),v=_r(_d[27]),T=_r(_d[28]),$=_r(_d[29]),O=_r(_d[30]),M=_r(_d[31]),B=_r(_d[32]),P=_r(_d[33]),R=_r(_d[34]),A=_r(_d[35]),z=_r(_d[36]),L=_r(_d[37]),H=_r(_d[38]),N=_r(_d[39]),W=_r(_d[40]),Y=_r(_d[41]),F=_r(_d[42]),E=_r(_d[43]),_=_r(_d[44]),q=_r(_d[45]),V=_r(_d[46]);const K=e=>(0,w.deptKey)(e?.dept),U=(e,t)=>(0,w.canSwapWith)(e,t,y.VENUE_RID),G=2650,Q=1900,X=e=>e.end-e.start,J=e=>e>8?.5:e>6?.3333333333333333:0,Z=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,$.weekday)(e)),t};function ee(e){const{rid:t,r:s,now:n}=(0,$.useCtx)(6e4),a=(0,m.useBookings)(t),o=(0,m.useOrders)(t),i=(0,m.useEvents)(t),r=(0,L.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,C.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),n=a.filter(e=>!e.walkIn&&'confirmed'===e.status&&t.some(t=>(0,C.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,H.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:l,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:l,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:l,booked:n,sales:t.map(e=>{const t=(0,I.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*G+t.restOfDay.takeaway*Q:0})}},[s,a,o,i,r,(0,C.ymd)(e)])}function te({init:e,onClose:t}){const n=(0,s.useOwner)(e=>e.staff),[a,o]=(0,l.useState)(e.shift?.start??12),[i,r]=(0,l.useState)(e.shift?.end??20),[d,c]=(0,l.useState)(e.shift?.breakAt),[u,m]=(0,l.useState)((0,E.cleanBadge)(e.shift?.badge)),g=void 0===d||d>a&&dt.id===e.staffId),x=(0,s.leaveOn)((0,s.useOwner)(e=>e.leave),e.staffId,e.date);return(0,V.jsxs)(f.Sheet,{visible:!0,onClose:t,title:(0,F.shiftTitle)(p?.name??'',e.date),testID:"shift-sheet",children:[x?(0,V.jsx)(f.Banner,{kind:"warn",title:`${(p?.name??'').replace(' (example)','')} has time off: ${(0,k.rangeLabel)(x.from,x.to)}`,children:"Only add a shift if they\u2019ve agreed to work."}):null,(0,V.jsx)(f.T,{center:!0,weight:"semibold",children:"Role badge for this shift"}),(0,V.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,V.jsx)(f.Chip,{label:"None",selected:!u,onPress:()=>m(void 0),testID:"shift-badge-none"}),E.ROLE_BADGES.map(e=>(0,V.jsx)(f.Chip,{label:e,selected:u===e,onPress:()=>m(u===e?void 0:e),testID:`shift-badge-${e.replace(/\s+/g,'-').toLowerCase()}`,accessibilityLabel:`${e} badge${u===e?', chosen, tap to remove':''}`},e))]}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,V.jsx)(f.Chip,{label:`${e} ${(0,$.fmtH)(t)}\u2013${(0,$.fmtH)(s)}`,selected:a===t&&i===s,onPress:()=>{o(t),r(s)}},e))}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{children:"Start"}),(0,V.jsx)(f.Stepper,{testID:"shift-start",value:a,step:.5,min:F.SHIFT_MIN_START,max:i-1,onChange:o,format:$.fmtH,label:"Start time"})]}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,V.jsx)(f.T,{children:"End"}),(0,V.jsxs)(h.default,{style:{alignItems:'flex-end'},children:[(0,V.jsx)(f.Stepper,{testID:"shift-end",value:i,step:.5,min:a+1,max:F.SHIFT_MAX_END,onChange:r,format:$.fmtH,label:"End time"}),i>=24?(0,V.jsx)(f.Muted,{children:"next day"}):null]})]}),(0,V.jsxs)(f.Muted,{children:[(i-a).toFixed(1),"h scheduled",J(i-a)?`, ${Math.round(60*J(i-a))}m planned break`:'']}),(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,V.jsx)(f.T,{children:void 0===d?'Break: not set':'Break at'}),void 0===d?(0,V.jsx)(f.Chip,{label:"Set a break time",onPress:()=>c(Math.min(i-.5,Math.max(a+.5,Math.round(4*(a+Math.min(4,(i-a)/2)))/4)))}):(0,V.jsxs)(f.Row,{gap:6,children:[(0,V.jsx)(f.Stepper,{testID:"shift-break",value:d,step:.25,min:a+.25,max:i-.25,onChange:c,format:$.fmtH,label:"Break time"}),(0,V.jsx)(f.Chip,{label:"No set time",onPress:()=>c(void 0)})]})]}),(0,V.jsx)(f.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,V.jsx)(f.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const n=s.useOwner.getState();e.shift?n.setShifts(n.shifts.map(t=>t.id===e.shift.id?{...t,start:a,end:i,breakAt:g?d:void 0,badge:(0,E.cleanBadge)(u),changed:!!t.published||t.changed}:t)):n.addShift({staffId:e.staffId,date:e.date,start:a,end:i,...void 0!==d&&g?{breakAt:d}:{},...(0,E.cleanBadge)(u)?{badge:(0,E.cleanBadge)(u)}:{}}),t()}}),(0,V.jsx)(f.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,V.jsx)(f.Button,{kind:"danger",label:"Remove shift",onPress:()=>{s.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}const se=6;function ne(e,t){const s=1===t?150:e>=1100?190:e>=860?170:140,n=e?e-s-t*se:0,a=n>0?Math.floor(n/t):0,o=1===t?Math.max(150,Math.min(320,a||150)):Math.max(76,Math.min(196,a||92));return{name:s,cell:o,width:s+t*(o+se),big:o>=104,fits:!e||s+t*(o+se)<=e}}const ae={position:'sticky',top:0};function oe({fits:e,children:t}){return e?(0,V.jsx)(h.default,{style:{alignItems:'center'},children:t}):(0,V.jsx)(u.default,{horizontal:!0,showsHorizontalScrollIndicator:!0,contentContainerStyle:{flexGrow:1,justifyContent:'center'},children:t})}function ie({rid:e,today:t,now:n}){const a=(0,s.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),i=(0,$.useSignedIn)(),{me:r,meId:d}=(0,$.useCtx)(3e4),[c,u]=(0,l.useState)(null),[h,m]=(0,l.useState)(''),[g,p]=(0,l.useState)(null),x=c?o.filter(e=>e.staffId===c&&e.in&&!e.out&&n.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!x&&(0,s.isOnBreak)(x),j=s=>{if(!c)return;const n=(0,R.managerClockAction)(s,{rid:e,staffId:c,date:t,at:(new Date).toISOString()},{id:i?.id??d,name:i?.name??r},h);if(!n.ok)return void p(n.message);const o=a.find(e=>e.id===c)?.name??'them';(0,A.notify)({id:'mgr-clock',title:`Recorded for ${o}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),p(null)};return(0,V.jsxs)(f.Card,{children:[(0,V.jsx)(f.T,{weight:"semibold",children:"Record it for someone"}),(0,V.jsx)(f.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:a.map(e=>(0,V.jsx)(f.Chip,{label:e.name,selected:c===e.id,onPress:()=>u(e.id)},e.id))}),c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:x?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>j(b?'break_end':'break_start')}),(0,V.jsx)(f.Button,{kind:"secondary",label:"Clock them out",onPress:()=>j('out')})]}):(0,V.jsx)(f.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>j('in')})}),g?(0,V.jsx)(f.T,{size:13,colour:D.colours.red,children:g}):null]}):null]})}function le({onClose:e}){const{now:t,today:n,meId:a}=(0,$.useCtx)(3e4),o=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),i=(0,s.useOwner)(e=>e.shifts),r=Array.from({length:7},(e,t)=>(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(n),1440*-t))),[d,c]=(0,l.useState)(n),u=o.filter(e=>e.staffId===a&&e.date===d&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,s.visibleShifts)(i,!1).find(e=>e.staffId===a&&e.date===d),[m,g]=(0,l.useState)(u&&!u.out?'out':'in'),[p,b]=(0,l.useState)(h?Math.round(60*h.start):720),[j,w]=(0,l.useState)(h?Math.round(60*h.end):1200),[y,k]=(0,l.useState)(''),[I,S]=(0,l.useState)(!1),v=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,T='out'!==m,O='in'!==m,M=T&&O&&j<=p,B=(e,t)=>(0,V.jsx)(f.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,V.jsx)(f.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return I?(0,V.jsxs)(f.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,V.jsx)(f.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,V.jsx)(f.Button,{label:"Done",onPress:e})]}):(0,V.jsxs)(f.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,V.jsx)(f.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,children:r.map(e=>(0,V.jsx)(f.Chip,{label:e===n?'Today':(0,C.niceDate)((0,C.parseYmd)(e)).slice(0,10),selected:d===e,onPress:()=>c(e)},e))}),(0,V.jsxs)(f.Muted,{children:[h?`Your rota that day: ${(0,$.fmtH)(h.start)}\u2013${(0,$.fmtH)(h.end)}`:'Not on the rota that day',u?` \xb7 clocked ${(0,C.hm)(new Date(u.in))}\u2013${u.out?(0,C.hm)(new Date(u.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,V.jsxs)(f.Row,{wrap:!0,gap:6,children:[(0,V.jsx)(f.Chip,{label:"Forgot to clock in",selected:'in'===m,onPress:()=>g('in')}),(0,V.jsx)(f.Chip,{label:"Forgot to clock out",selected:'out'===m,onPress:()=>g('out')}),(0,V.jsx)(f.Chip,{label:"Forgot both",selected:'both'===m,onPress:()=>g('both')})]}),T?(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["In ",v(p)]}),B(b,p)]}):null,O?(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(f.T,{size:18,weight:"bold",children:["Out ",v(j),j>=1440?' (next day)':'']}),B(w,j)]}):null,M?(0,V.jsx)(f.T,{size:13,colour:D.colours.red,children:"Clock-out must be after clock-in."}):null,(0,V.jsx)(f.Field,{label:"Note for your manager (optional)",value:y,onChangeText:k,placeholder:"e.g. phone died",maxLength:200}),(0,V.jsx)(f.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:M,onPress:()=>{s.useOwner.getState().addTimeRequest({staffId:a,date:d,attendanceId:u?.id,kind:m,suggestedIn:T?(0,x.isoAt)(d,p):void 0,suggestedOut:O?(0,x.isoAt)(d,j):void 0,note:y.trim(),at:t.toISOString()}),S(!0)}})]})}function re(){const{now:e,today:t,meId:n}=(0,$.useCtx)(3e4),a=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),o=(0,s.useOwner)(e=>e.shifts),i=(0,s.useOwner)(e=>e.timeRequests),[r,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),m=(0,C.ymd)(Z(e)),g=a.filter(e=>e.staffId===n&&e.in&&e.date>=(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),p=g.filter(e=>e.date>=m),b=p.filter(s.isConfirmed).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),j=p.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),w=i.filter(e=>e.staffId===n).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,V.jsxs)(h.default,{style:{gap:10},testID:"my-timesheet",children:[(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,V.jsxs)(h.default,{children:[(0,V.jsx)(f.T,{size:12,colour:D.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,V.jsx)(f.T,{size:28,weight:"bold",colour:D.colours.ok,children:(0,$.hmDur)(b)})]}),(0,V.jsxs)(h.default,{style:{alignItems:'flex-end'},children:[(0,V.jsx)(f.T,{size:12,colour:D.colours.muted,children:"PENDING SIGN-OFF"}),(0,V.jsx)(f.T,{size:18,weight:"semibold",colour:j?D.colours.amber:D.colours.muted,children:(0,$.hmDur)(j)})]})]}),(0,V.jsx)(f.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,V.jsx)(f.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>d(!0)}),w.length?(0,V.jsx)(v.SectionHead,{title:"My correction requests"}):null,w.map(e=>(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,V.jsxs)(h.default,{style:{flex:1},children:[(0,V.jsxs)(f.T,{size:14,children:[(0,C.niceDate)((0,C.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,V.jsxs)(f.Muted,{children:[e.suggestedIn?`in ${(0,C.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,C.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,V.jsx)(f.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,V.jsx)(v.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),g.map(t=>{const n=(0,s.shiftOf)((0,s.visibleShifts)(o,!1),t.staffId,t.date),a=(0,$.paidMins)(t,e),i=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,V.jsxs)(f.Card,{onPress:()=>u(c===t.id?null:t.id),children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsxs)(h.default,{style:{flex:1},children:[(0,V.jsx)(f.T,{weight:"semibold",children:(0,C.niceDate)((0,C.parseYmd)(t.date))}),(0,V.jsxs)(f.Muted,{children:[(0,C.hm)(new Date(t.in)),"\u2013",t.out?(0,C.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${a.brk}m break \xb7 ${(0,$.hmDur)(a.paid)} paid`:'',n?` \xb7 rota ${(0,$.fmtH)(n.start)}\u2013${(0,$.fmtH)(n.end)}`:'']})]}),(0,V.jsx)(f.Badge,{kind:(0,x.statusKind)(t),label:'awaiting'===(0,s.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,x.statusLabel)(t)})]}),i?(0,V.jsxs)(f.T,{size:13,colour:D.colours.gold,children:["Adjusted by ",i.by.replace(' (example)',''),i.reason?`: ${i.reason}`:'']}):null,t.signOff?(0,V.jsxs)(f.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,c===t.id?(0,V.jsx)(x.AuditTrail,{a:t}):null]},t.id)}),g.length?null:(0,V.jsx)(f.Muted,{children:"No clocked shifts yet."}),r?(0,V.jsx)(le,{onClose:()=>d(!1)}):null]})}function de({now:e,today:n}){const o=(0,s.useOwner)(e=>e.staff),i=(0,s.useOwner)(e=>e.shifts),r=(0,$.useHourly)(),d=(0,s.useOwner)(e=>(0,s.liveAttendance)(e.attendance)),u=(0,s.useOwner)(e=>e.timeRequests),m=(0,s.useOwner)(e=>e.leave),p=(0,s.useOwner)(e=>e.attLog),[b,j]=(0,l.useState)(n),[w,y]=(0,l.useState)(null),[k,I]=(0,l.useState)(!1),[T,M]=(0,l.useState)(!1),B=!!(0,$.useSignedIn)(),P=T?(0,N.pastWeekDays)(b,n):Array.from({length:7},(e,t)=>(0,C.ymd)((0,C.addMins)((0,C.parseYmd)(n),1440*-t))),R=d.filter(e=>e.date===b&&e.in),A=i.filter(e=>e.date===b&&!1!==e.published).filter(e=>!R.some(t=>t.staffId===e.staffId)),z=d.filter(e=>P.includes(e.date)&&e.out),L=z.filter(s.isConfirmed),H=L.reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),Y=z.filter(e=>!(0,s.isConfirmed)(e)).reduce((t,s)=>t+(0,$.paidMins)(s,e).paid,0),F=L.reduce((t,s)=>t+(0,$.paidMins)(s,e).paid/60*(r[s.staffId]??0),0),E=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(L.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const n=o.find(e=>e.id===t.staffId),a=(0,s.shiftOf)(i,t.staffId,t.date),l=(0,$.paidMins)(t,e),d=r[t.staffId]??0;return`${n?.name},${t.date},${a?`${(0,$.fmtH)(a.start)}-${(0,$.fmtH)(a.end)}`:'-'},${(0,C.hm)(new Date(t.in))},${(0,C.hm)(new Date(t.out))},${l.brk},${(l.paid/60).toFixed(2)},${(d/100).toFixed(2)},${(l.paid/60*d/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${n?.salaried?'Owner, no hourly wage':null==r[t.staffId]?'Rate not set':n?.noTax&&B?'No tax deducted':''}`}));return(0,V.jsxs)(h.default,{style:{gap:10},children:[(0,V.jsx)(W.HoursDayPicker,{testID:"ts-pick",date:b,today:n,custom:T,onDate:e=>{j(e),M(!0)},resetLabel:"Back to the last 7 days",onReset:()=>{j(n),M(!1)}}),(0,V.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:P.map(e=>(0,V.jsx)(f.Chip,{testID:`ts-day-${e}`,accessibilityLabel:`${(0,N.longDay)(e)}${e===n?', today':''}`,label:e===n?'Today':T?(0,N.chipDay)(e):(0,C.niceDate)((0,C.parseYmd)(e)).slice(0,6).trim(),selected:b===e,onPress:()=>j(e)},e))}),(0,V.jsxs)(f.Card,{children:[(0,V.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,V.jsx)(f.T,{weight:"semibold",testID:"ts-week-title",children:T?(0,N.weekTitle)(b,n):'Last 7 days'}),(0,V.jsx)(f.Badge,{kind:"ok",label:`${(0,$.hmDur)(H)} confirmed`})]}),Y?(0,V.jsxs)(f.T,{size:13,colour:D.colours.amber,children:[(0,$.hmDur)(Y)," pending sign-off (not counted yet)"]}):null,(0,V.jsxs)(f.Muted,{children:["Labour cost ",(0,S.gbp)(Math.round(F))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,V.jsx)(a.WideTable,{children:(0,V.jsxs)(h.default,{style:{gap:2},children:[(0,V.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:D.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,V.jsx)(f.T,{size:12,weight:"semibold",colour:D.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),R.map(t=>{const l=o.find(e=>e.id===t.staffId),r=(0,s.shiftOf)(i,t.staffId,b),d=(0,$.paidMins)(t,e),h=(0,x.flagsFor)(t,r,e,n,u).map(e=>e.label);return(0,V.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,V.jsxs)(f.Row,{gap:4,style:{width:110},children:[(0,V.jsx)(O.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,V.jsx)(f.T,{size:12,style:{flex:1},numberOfLines:1,testID:`ts-name-${t.staffId}`,children:l?.name.replace(' (example)','')})]}),(0,V.jsx)(f.T,{size:12,style:{width:86},colour:D.colours.muted,children:r?`${(0,$.fmtH)(r.start)}\u2013${(0,$.fmtH)(r.end)}`:'\u2013'}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:(0,C.hm)(new Date(t.in))}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:t.out?(0,C.hm)(new Date(t.out)):'on'}),(0,V.jsx)(f.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,V.jsx)(f.T,{size:12,weight:"semibold",style:{width:74},testID:`ts-paid-${t.staffId}`,children:t.out?(0,$.hmDur)(d.paid):`${(0,$.hmDur)(d.worked)}\u2026`}),(0,V.jsx)(f.T,{size:11,style:{width:120},colour:'confirmed'===(0,s.attStatus)(t)?D.colours.ok:'open'===(0,s.attStatus)(t)?D.colours.blue:D.colours.amber,children:(0,x.statusLabel)(t)}),(0,V.jsx)(f.T,{size:11,style:{width:140},colour:h.length?D.colours.amber:D.colours.ok,children:h.join(', ')||'OK'}),(0,V.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${l?.name}`,onPress:()=>y(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,V.jsx)(f.T,{size:12,colour:D.colours.gold,children:"Edit"})})]},t.id)}),A.map(t=>(0,V.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,V.jsx)(f.T,{size:12,style:{width:110},children:o.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,V.jsxs)(f.T,{size:12,style:{width:86},colour:D.colours.muted,children:[(0,$.fmtH)(t.start),"\u2013",(0,$.fmtH)(t.end)]}),(()=>{const s=(0,g.leaveCovering)(m,t.staffId,t.date);return s?(0,V.jsxs)(f.T,{size:12,colour:D.colours.blue,testID:`ts-leave-${t.staffId}`,children:[(0,g.leaveLabel)(s)," (rota covered)"]}):(0,V.jsx)(f.T,{size:12,colour:b===n&&60*t.start>60*e.getHours()+e.getMinutes()?D.colours.muted:D.colours.red,children:b===n&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})})()]},t.id))]})}),R.length||A.length?null:(0,V.jsx)(f.Muted,{children:"No shifts or clock records for this day."}),(0,V.jsx)(f.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,V.jsx)(f.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>I(!0)}),(0,V.jsx)(v.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,V.jsxs)(f.Muted,{children:[(0,C.niceDate)(new Date(e.at))," ",(0,C.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,V.jsx)(f.Muted,{children:"No manual changes yet."}),w?(0,V.jsx)(x.OverrideSheet,{a:w,staffId:w.staffId,date:w.date,onClose:()=>y(null)}):null,(0,V.jsxs)(f.Sheet,{visible:k,onClose:()=>I(!1),title:"Payroll export",children:[(0,V.jsxs)(f.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",Y?`${(0,$.hmDur)(Y)} still pending sign-off is left out.`:'']}),(0,V.jsxs)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[E.slice(0,14).map((e,t)=>(0,V.jsx)(f.T,{size:10,colour:t?D.colours.text:D.colours.gold,children:e},t)),E.length>14?(0,V.jsxs)(f.Muted,{children:["\u2026 ",E.length-14," more rows"]}):null]}),(0,V.jsxs)(f.Muted,{children:[E.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1062,[876,863,1051,1459,1276,1277,31,1044,1074,123,264,152,128,818,823,972,1472,1464,1089,1473,1102,5,1103,879,820,822,825,1077,1052,953,996,1294,869,870,1178,980,1412,1092,1093,1467,1469,1409,1100,978,1474,807,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return O}}),_e.allocate=D,_e.Tips=function({go:e}={}){const n=(0,a.default)().width<600,{rid:C,now:S,today:v,role:P,meId:B,me:F}=(0,x.useCtx)(6e4),R=(0,u.useOwner)(e=>e.staff),N=(0,u.useOwner)(e=>(0,u.liveAttendance)(e.attendance)),A=(0,u.useOwner)(e=>e.shifts),L=(0,u.useOwner)(e=>e.tronc),z=(0,u.useOwner)(e=>e.troncCash),_=(0,u.useOwner)(e=>e.troncHistory),V=(0,u.useOwner)(e=>e.troncLog),U=(0,c.useOrders)(C),q=(0,j.useVenuePay)(C).pay,[H,W]=(0,i.useState)(-1),[Y,K]=(0,i.useState)(''),[G,Q]=(0,i.useState)(!1),[J,X]=(0,i.useState)(!1),[Z,ee]=(0,i.useState)(L.text),[te,se]=(0,i.useState)(null),oe='staff'!==P,ie='owner'===P,{s:ne,e:re,key:le}=(0,j.venueRange)(q,'tips',H,S),ae=`${(0,h.niceDate)(ne)} \u2013 ${(0,h.niceDate)(re)} ${re.getFullYear()}`,de=_.find(e=>e.key===le),ce=e=>u.useOwner.getState().setOwner({tronc:{...L,...e}}),ue=(0,w.useSync)(e=>!!e.venueId&&'guest'!==e.kind),pe=Math.round((re.getTime()-ne.getTime())/864e5)+1,he=(0,i.useMemo)(()=>{let e=U.filter(e=>e.createdAt.slice(0,10)>=(0,h.ymd)(ne)&&e.createdAt.slice(0,10)<=(0,h.ymd)(re)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!ue)for(let t=0;tS)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,b.hash)((0,h.ymd)(s)+'tip')))}return e},[le,U.length,ue]),me=(0,T.useCashUp)(e=>e.cashUps),fe=Math.round(100*(0,k.cashUpTipsBetween)(me,C,(0,h.ymd)(ne),(0,h.ymd)(re))),ye=z[le]??0,ge=de?de.pot:he+fe+ye,xe=(0,i.useMemo)(()=>{const e={};for(let t=0;tv)break;const o=(0,h.ymd)(s);R.forEach(t=>{const s=N.filter(e=>e.staffId===t.id&&e.date===o&&e.out),i=s.filter(u.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0),n=s.filter(e=>!(0,u.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,S).paid,0);(i||n)&&(e[t.id]={paid:(e[t.id]?.paid??0)+i,est:(e[t.id]?.est??!1)||n>0})})}return e},[le,N.length,A.length,R.length]),je=R.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&L.includeManagers||'owner'===e.role&&L.includeOwner)),be=(0,i.useMemo)(()=>{if(de)return de.rows;const e=je.map(e=>{const t=(xe[e.id]?.paid??0)/60,s=L.points[O(e)]??1;return'hours'===L.method?t:'points'===L.method?t*s:'equal'===L.method?t>0?1:0:L.custom[e.id]??0}),{amounts:t}=D(ge,e),s=e.reduce((e,t)=>e+t,0);return je.map((o,i)=>({staffId:o.id,hours:(xe[o.id]?.paid??0)/60,points:L.points[O(o)]??1,pct:s?e[i]/s*100:0,amount:t[i]}))},[de,je.map(e=>e.id).join(),xe,L,ge]),we=be.reduce((e,t)=>e+t.amount,0),Te=de?0:(()=>{const e=be.map(e=>e.pct);return D(ge,e).remainder})(),Ce=Object.entries(L.custom).filter(([e])=>je.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),Se='custom'===L.method&&Math.abs(Ce-100)>.01,ke=new Date(re.getFullYear(),re.getMonth()+2,0),ve=[..._].sort((e,t)=>t.end.localeCompare(e.end))[0],Pe=0!==_.length&&(0,h.parseYmd)(ve.end)<(0,h.addMins)(S,-89280),Me=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(be.map(e=>{const t=R.find(t=>t.id===e.staffId);return`${I(t.name)},${O(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(we/100).toFixed(2)}`]);return oe?(0,M.jsxs)(l.default,{style:{gap:10},children:[(0,M.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,M.jsx)(d.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,M.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(d.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>W(H-1)}),(0,M.jsxs)(l.default,{style:{alignItems:'center',flex:1},children:[(0,M.jsx)(d.T,{weight:"semibold",children:ae}),de?(0,M.jsx)(d.Badge,{kind:"ok",label:`Approved & locked ${de.lockedAt}`}):H>=0?(0,M.jsx)(d.Badge,{kind:"amber",label:"Period in progress"}):(0,M.jsx)(d.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:H>=0,onPress:()=>W(H+1)})]}),(0,M.jsxs)(d.Card,{children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Tip pot"}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Card tips on orders"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.card:he)})]}),(0,M.jsx)(l.default,{testID:"tronc-cashup-tips",children:(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Tips from cash ups (cash + card)"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.cashUps??0:fe)})]})}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:"Other cash tips"}),(0,M.jsx)(d.T,{children:(0,p.gbp)(de?de.cash:ye)})]}),de?null:(0,M.jsxs)(d.Row,{gap:6,children:[(0,M.jsx)(s.TextInput,{accessibilityLabel:"Other cash tips not in a cash up, pounds",placeholder:"Other cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:Y,onChangeText:K,style:[d.styles.input,{flex:1}]}),(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(Y)>=0)||''===Y.trim(),onPress:()=>{u.useOwner.getState().setOwner({troncCash:{...z,[le]:Math.round(100*Number(Y))}}),K('')}})]}),(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{weight:"bold",children:"Total pot"}),(0,M.jsx)(d.T,{size:20,weight:"bold",colour:m.colours.gold,children:(0,p.gbp)(ge)})]}),(0,M.jsx)(d.Muted,{children:ue?'Card tips on orders are taken in CoverCharge. Tips from cash ups come from each day\u2019s cash up, including days added later. Only add other cash tips that are not in a cash up.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),de?(0,M.jsxs)(d.Muted,{children:["Locked with method: ",$[de.method],"."]}):(0,M.jsxs)(d.Card,{children:[(0,M.jsx)(d.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,M.jsx)(d.Row,{wrap:!0,gap:6,children:Object.keys($).map(e=>(0,M.jsx)(d.Chip,{label:$[e],selected:L.method===e,onPress:()=>ie&&ce({method:e})},e))}),ie?null:(0,M.jsx)(d.Muted,{children:"Only the owner can change the policy."}),'points'===L.method?Object.entries(L.points).map(([e,t])=>(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{children:e}),(0,M.jsx)(d.Row,{gap:6,children:(0,M.jsx)(d.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ie&&ce({points:{...L.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===L.method?(0,M.jsxs)(M.Fragment,{children:[je.map(e=>(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{style:{flex:1},children:I(e.name)}),(0,M.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(L.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>ce({custom:{...L.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&ce({custom:{...u.useOwner.getState().tronc.custom,[e.id]:s}})},style:[d.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,M.jsxs)(d.T,{size:13,colour:Se?m.colours.red:m.colours.ok,children:["Total ",Ce.toFixed(1),"%",Se?' (must be 100%)':' \u2713']})]}):null,(0,M.jsx)(d.Toggle,{label:"Include managers",value:L.includeManagers,onChange:e=>ie&&ce({includeManagers:e})}),(0,M.jsx)(d.Toggle,{label:"Include owner",value:L.includeOwner,onChange:e=>ie&&ce({includeOwner:e})}),L.includeOwner?(0,M.jsx)(d.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),n?(0,M.jsxs)(l.default,{testID:"tips-responsive-list",style:{gap:10,width:'100%',minWidth:0},children:[be.map(e=>{const t=R.find(t=>t.id===e.staffId);return(0,M.jsxs)(d.Card,{children:[(0,M.jsxs)(d.T,{center:!0,weight:"semibold",children:[I(t?.name),xe[e.staffId]?.est&&!de?'*':'']}),(0,M.jsxs)(d.T,{center:!0,children:["Paid hours: ",e.hours.toFixed(2)]}),(0,M.jsxs)(d.T,{center:!0,children:["Points: ",'points'===L.method||'points'===de?.method?e.points.toFixed(1):'\u2013']}),(0,M.jsxs)(d.T,{center:!0,children:["Share: ",e.pct.toFixed(1),"%"]}),(0,M.jsxs)(d.T,{center:!0,weight:"semibold",colour:m.colours.gold,children:["Amount: ",(0,p.gbp)(e.amount)]})]},e.staffId)}),(0,M.jsxs)(d.T,{center:!0,weight:"bold",children:["Total: ",(0,p.gbp)(we)]})]}):(0,M.jsx)(r.default,{horizontal:!0,children:(0,M.jsxs)(l.default,{children:[(0,M.jsx)(d.Row,{gap:0,style:{borderBottomWidth:1,borderColor:m.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,M.jsx)(d.T,{size:12,weight:"semibold",colour:m.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),be.map(e=>{const t=R.find(t=>t.id===e.staffId);return(0,M.jsxs)(d.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,M.jsxs)(d.T,{size:13,style:{width:130},numberOfLines:1,children:[I(t?.name),xe[e.staffId]?.est&&!de?'*':'']}),(0,M.jsx)(d.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,M.jsx)(d.T,{size:13,style:{width:54},children:'points'===L.method||'points'===de?.method?e.points.toFixed(1):'\u2013'}),(0,M.jsxs)(d.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,M.jsx)(d.T,{size:13,weight:"semibold",style:{width:80},children:(0,p.gbp)(e.amount)})]},e.staffId)}),(0,M.jsxs)(d.Row,{gap:0,style:{paddingVertical:6},children:[(0,M.jsx)(d.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,M.jsx)(d.T,{size:13,weight:"bold",colour:we===ge?m.colours.ok:m.colours.red,style:{width:80},children:(0,p.gbp)(we)})]})]})}),(0,M.jsxs)(d.Muted,{children:[we===ge?`\u2713 Total equals the pot (${(0,p.gbp)(ge)}).`:'\u2717 Total does not equal the pot.',Te?` Rounding: ${Te}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),de?null:(0,M.jsx)(d.Button,{label:"Approve & lock period",disabled:!ie||H>=0||Se||we!==ge||ge<=0,onPress:()=>{const e=`${(0,h.niceDate)(S)} ${S.toTimeString().slice(0,5)}`,t={id:`tp-${le}`,key:le,label:ae,end:(0,h.ymd)(re),pot:ge,card:he,cash:ye,cashUps:fe,method:L.method,rows:be,lockedAt:e,by:F};u.useOwner.getState().setOwner({troncHistory:[t,..._],troncLog:[{id:`tl-${Date.now()}`,at:S.toISOString(),text:`${F} approved & locked tips for ${ae}: ${(0,p.gbp)(ge)} split ${$[L.method].toLowerCase()} between ${be.filter(e=>e.amount>0).length} staff`},...V]})}}),!de&&H>=0?(0,M.jsx)(d.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ie||de?null:(0,M.jsx)(d.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,M.jsxs)(d.Row,{wrap:!0,gap:6,children:[(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>Q(!0)}),de?(0,M.jsx)(d.Button,{small:!0,kind:"secondary",label:de.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!de.shared,onPress:()=>{(0,f.autoPost)('all',`Tips for ${ae} approved: ${(0,p.gbp)(de.pot)} is in the tip pot.`),u.useOwner.getState().setOwner({troncHistory:_.map(e=>e.id===de.id?{...e,shared:(0,h.niceDate)(S)}:e)}),se('Posted to All staff chat.')}}):null]}),te?(0,M.jsx)(d.Banner,{kind:"info",title:te}):null,(0,M.jsx)(y.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,M.jsxs)(d.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,p.gbp)(ge)} = allocated ${(0,p.gbp)(we)}`],[L.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!Pe,'Tips allocated by the end of the following month',`This period: by ${(0,h.niceDate)(ke)} ${ke.getFullYear()}`],[!0,'Tip records kept for 3 years',`${_.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${V.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,M.jsxs)(d.Row,{style:{alignItems:'flex-start'},children:[(0,M.jsx)(d.T,{colour:e?m.colours.ok:m.colours.red,children:e?'\u2713':'\u2717'}),(0,M.jsxs)(l.default,{style:{flex:1},children:[(0,M.jsx)(d.T,{size:14,children:t}),(0,M.jsx)(d.Muted,{children:s})]})]},String(t))),(0,M.jsx)(d.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{ee(L.text),X(!0)}})]}),(0,M.jsx)(y.SectionHead,{title:"Tip history & audit log"}),_.map(e=>(0,M.jsxs)(d.Card,{children:[(0,M.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,M.jsx)(d.T,{weight:"semibold",children:e.label}),(0,M.jsx)(d.T,{weight:"bold",children:(0,p.gbp)(e.pot)})]}),(0,M.jsxs)(d.Muted,{children:[$[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),V.map(e=>(0,M.jsxs)(d.Muted,{children:[(0,h.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),_.length||V.length?null:(0,M.jsx)(d.Muted,{children:"No approved periods yet."}),(0,M.jsxs)(d.Sheet,{visible:G,onClose:()=>Q(!1),title:"Tips summary export",children:[(0,M.jsx)(d.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,M.jsx)(l.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Me.map((e,t)=>(0,M.jsx)(d.T,{size:11,colour:t?m.colours.text:m.colours.gold,children:e},t))}),(0,M.jsxs)(d.Muted,{children:[ae," \xb7 ",$[de?.method??L.method]]})]}),(0,M.jsxs)(d.Sheet,{visible:J,onClose:()=>X(!1),title:"Tipping policy",children:[(0,M.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ie,value:Z,onChangeText:ee,style:[d.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ie?(0,M.jsx)(d.Button,{label:"Save policy",onPress:()=>{ce({text:Z}),X(!1)}}):null,(0,M.jsx)(d.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,M.jsx)(E,{})},_e.useStaffTips=N,_e.useStaffTipsNotice=function(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useTipsShow)(e),{today:n}=N(e,t);(0,i.useEffect)(()=>{if(!o.showToday||F()||P.PITCH)return;const i=(0,C.latestDayTips)(s,e,t);i?(0,C.postTipsNotice)(e,i.date,i.total,t):null!=n&&(0,C.postTipsNotice)(e,t,n,t)},[e,t,s,n,o.showToday])},_e.StaffTipsTile=function({rid:e,today:t,onPress:s}){const{pot:o,today:i}=N(e,t),r=`Tip pot this period, ${B(o)}`,l=null==i?'No tips confirmed for today yet.':`Today's tips, ${B(i)}`;return(0,M.jsx)(n.default,{testID:"staff-tips-tile",accessibilityRole:"button",accessibilityLabel:`${r}. ${l}`,onPress:s,children:(0,M.jsxs)(d.Card,{highlight:m.colours.gold,children:[(0,M.jsx)(A,{testID:"staff-tips-pot",label:"Tip pot this period",amount:o,empty:"No tip pot for this period yet."}),(0,M.jsx)(A,{testID:"staff-tips-today",label:"Today's tips",amount:i,empty:"No tips confirmed for today yet."})]})})},_e.MyTips=E;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),l=e(_r(_d[6])),a=e(_r(_d[7])),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),T=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),k=_r(_d[23]),v=_r(_d[24]),P=_r(_d[25]),M=_r(_d[26]);const $={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},O=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',I=e=>(e??'').replace(' (example)','');function D(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),i=o.map(Math.floor);let n=e-i.reduce((e,t)=>e+t,0);const r=n;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{n>0&&(i[e]+=1,n-=1)}),{amounts:i,remainder:r}}const B=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`;function F(){if('undefined'==typeof window)return!1;const e=window.location.hostname;return('localhost'===e||'127.0.0.1'===e)&&'tips'===new URLSearchParams(window.location.search).get('demo')}const R={pot:186.4,today:48.5};function N(e,t){const s=(0,T.useCashUp)(e=>e.tips),o=(0,T.useCashUp)(e=>e.pot),n=(0,j.useVenuePay)(e).pay,r=(0,w.useSync)(e=>e.venueId),l=(0,v.tipsPeriod)(n,t),a=(0,i.useMemo)(()=>(0,S.tipsPot)(s.filter(t=>t.rid===e),o.filter(t=>t.rid===e),l.start,t),[s,o,e,l.start,t]),d=s.find(s=>s.rid===e&&s.date===t),[c,u]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!r||P.PITCH)return;let e=!1;const s=async()=>{try{const s=await(0,w.rpc)('staff_tip_summary',{p_venue:r,p_today:t,p_from:l.start}),o=Number(s?.pot);if(e||!s||Array.isArray(s)||s.error||!Number.isFinite(o))return;const i=null==s.today||''===s.today?null:Number(s.today);u({pot:o,today:null!=i&&Number.isFinite(i)?i:null})}catch{}};s();const o=setInterval(()=>{s()},3e4);return()=>{e=!0,clearInterval(o)}},[r,t,l.start]),F()?{pot:R.pot,today:R.today}:{pot:c?c.pot:a.total,today:c?c.today:d?d.total:null}}function A({testID:e,label:t,amount:s,empty:o}){const i=null==s?o:`${t}, ${B(s)}`;return(0,M.jsxs)(l.default,{testID:e,accessible:!0,accessibilityLabel:i,style:{alignItems:'center',gap:2,width:'100%'},children:[(0,M.jsx)(d.T,{center:!0,size:14,weight:"semibold",colour:m.colours.gold,children:t}),null==s?(0,M.jsx)(d.Muted,{center:!0,children:o}):(0,M.jsx)(d.T,{center:!0,size:36,weight:"bold",colour:m.colours.goldLight,children:B(s)})]})}function E(e={}){const t=(0,x.useCtx)(6e4),s=N(t.rid,t.today);return(0,M.jsx)(l.default,{testID:"staff-tips",style:{gap:12,alignItems:'center'},children:(0,M.jsxs)(d.Card,{highlight:m.colours.gold,style:{alignSelf:'stretch'},children:[(0,M.jsx)(A,{testID:"staff-tips-page-pot",label:"Tip pot this period",amount:s.pot,empty:"No tip pot for this period yet."}),(0,M.jsx)(d.Muted,{center:!0,children:"The venue total so far. Confirmed cash ups only."}),(0,M.jsx)(A,{testID:"staff-tips-page-today",label:"Today's tips",amount:s.today,empty:"No tips confirmed for today yet."})]})})}},1063,[876,874,842,31,264,152,128,288,818,823,863,820,822,825,1052,1077,953,1185,1090,824,1048,1046,13,1407,1184,2,25]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AccidentBook=function({me:e,meId:t,now:s,app:a,seeAll:c}){const p=(0,d.useSafety)(e=>e.accidents),[y,x]=(0,n.useState)(c?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,h.jsxs)(o.default,{style:{gap:12},testID:"accident-book",children:[(0,h.jsx)(u.Tabs,{value:y,onChange:x,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:c?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,h.jsx)(j,{me:e,meId:t,now:s,app:a,onSaved:()=>x('list')}):null,'list'===y?(0,h.jsxs)(u.Box,{testID:"accident-list",children:[(c?p:w).length?(c?p:w).map(e=>(0,h.jsx)(b,{a:e,manager:c},e.id)):(0,h.jsx)(l.Muted,{children:"No entries yet."}),!c&&f>0?(0,h.jsx)(o.default,{testID:"accident-others",children:(0,h.jsxs)(l.Muted,{children:[f," other entr",1===f?'y is':'ies are'," in the book. Only managers can see other people\u2019s entries and personal details."]})}):null]}):null,(0,h.jsx)(l.Muted,{children:"In an emergency call 999 first. The accident book is kept on this device for now; nothing is sent or reported to anyone."})]})};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),a=e(r(_d[3])),o=e(r(_d[4])),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]),h=r(_d[9]);const p=e=>String(e).padStart(2,'0'),y=e=>`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}T${p(e.getHours())}:${p(e.getMinutes())}`,x=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${p(t.getHours())}:${p(t.getMinutes())}`};function j({me:e,meId:a,now:p,app:x,onSaved:j}){const[b,w]=(0,n.useState)({date:y(p).slice(0,10),time:y(p).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[f,T]=(0,n.useState)(''),[D,I]=(0,n.useState)(''),S=e=>w({...b,...e}),C='Near miss'===b.category,v=(e,s,n,a=!1)=>(0,h.jsxs)(o.default,{style:{gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:e}),(0,h.jsx)(t.TextInput,{accessibilityLabel:e,value:String(b[s]),onChangeText:e=>S({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:a,style:[l.styles.input,a&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,h.jsxs)(u.Box,{testID:"accident-form",children:[(0,h.jsx)(l.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,h.jsxs)(l.Row,{gap:8,children:[(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Date (DD/MM/YYYY)"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Date (DD/MM/YYYY)",...(0,s.slashBox)(b.date,e=>S({date:e})),placeholder:"DD/MM/YYYY",keyboardType:"numbers-and-punctuation",maxLength:10,placeholderTextColor:"#7D776C",style:[l.styles.input,{minWidth:0,width:40}]})]}),(0,h.jsxs)(o.default,{style:{width:110,gap:4},children:[(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"Time"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Time",value:b.time,onChangeText:e=>S({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:l.styles.input})]})]}),(0,h.jsx)(l.T,{size:14,weight:"medium",colour:c.colours.muted,children:"What kind?"}),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:d.ACCIDENT_CATEGORIES.map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.category===e,onPress:()=>S({category:e})},e))}),v('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),v('Person involved','person','Name'),(0,h.jsx)(l.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,h.jsx)(l.Chip,{label:e,selected:b.personType===e,onPress:()=>S({personType:e})},e))}),v('What happened','what','Describe what happened, in order',!0),v('Injury','injury',C?'None (near miss)':'e.g. small cut to left thumb'),v('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),v('Witnesses','witnesses','Names, or none'),v('Reported by','reportedBy','Your name'),f?(0,h.jsx)(l.Banner,{kind:"warn",children:f}):null,(0,h.jsx)(l.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(b.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(b.time)?b.category?b.location.trim()&&b.person.trim()&&b.what.trim()?(d.useSafety.getState().addAccident({when:`${b.date}T${b.time}`,location:b.location.trim(),person:b.person.trim(),personType:b.personType,category:b.category,what:b.what.trim(),injury:b.injury.trim()||(C?'None (near miss)':'Not recorded'),firstAid:b.firstAid.trim()||'None recorded',witnesses:b.witnesses.trim()||'None',reportedBy:b.reportedBy.trim()||e,reportedById:a,app:x}),I(`Saved to the accident book: ${b.category}, ${b.location.trim()}.`),T(''),w({...b,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void j()):T('Fill in where it happened, who was involved and what happened.'):T('Pick what kind of accident or near miss it was.'):T('Enter the date as DD/MM/YYYY and the time as HH:MM.')}),D?(0,h.jsx)(o.default,{testID:"accident-saved",children:(0,h.jsx)(l.T,{size:14,colour:c.colours.ok,children:D})}):null,(0,h.jsx)(l.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function b({a:e,manager:s}){const u=d.RIDDOR_CATEGORIES.includes(e.category),[p,y]=(0,n.useState)(e.riddorNote??''),[j,b]=(0,n.useState)(!1);return(0,h.jsxs)(o.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,gap:4},children:[(0,h.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,h.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(l.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,h.jsx)(l.Badge,{kind:'Near miss'===e.category?'blue':u?'red':'amber',label:'Near miss'===e.category?'Near miss':u?'Serious':'Accident'})]}),(0,h.jsxs)(l.Muted,{children:[x(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||s?(0,h.jsxs)(o.default,{style:{gap:2},children:[(0,h.jsxs)(l.T,{size:14,children:["What happened: ",e.what]}),(0,h.jsxs)(l.T,{size:14,children:["Injury: ",e.injury]}),(0,h.jsxs)(l.T,{size:14,children:["First aid: ",e.firstAid]}),(0,h.jsxs)(l.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,s&&u?(0,h.jsxs)(o.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,h.jsx)(l.Banner,{kind:"danger",title:"Consider RIDDOR",children:"This may need reporting to the HSE under RIDDOR (for example a specified injury, over-7-day incapacitation, or a member of the public taken to hospital). Check the HSE\u2019s RIDDOR guidance and decide. CoverCharge never reports anything for you."}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:y,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:l.styles.input}),(0,h.jsx)(l.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>d.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,h.jsxs)(l.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1064,[874,834,31,264,128,818,1180,825,1386,25]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MissedBanner=T,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s,rid:i}){const[l,d]=(0,r.useState)('today'),c=(e,t)=>({id:e,label:t}),p='chef'===s?[c('today','Today'),c('units','Fridges & units'),c('record','Quick entry'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:'managers'===s?[c('today','Today'),c('units','Fridges & units'),c('diary','Diary'),c('weekly','Weekly sign-off'),c('report','EHO report'),c('history','History'),c('limits','Safe limits'),c('probes','Wireless probes')]:[c('today','Today'),c('record','Quick entry'),c('diary','Diary'),c('history','My entries')],m={me:e,meId:t,now:n,mode:s},x=(0,j.useMaySendInspectorLog)(m);x&&p.splice(p.findIndex(e=>'report'===e.id)+1,0,c('inspector','Inspector'));return p.splice(1,0,c('cooksafe','CookSafe records')),(0,v.jsxs)(u.default,{style:{gap:12},testID:"haccp-log",children:[(0,v.jsx)(o.TempSaveBanner,{}),'today'!==l?(0,v.jsx)(T,{mode:s,now:n,onPress:()=>d('today')}):null,(0,v.jsx)(b.Tabs,{value:l,onChange:d,options:p}),'today'===l?(0,v.jsx)(f.TodayView,{who:m}):null,'cooksafe'===l?(0,v.jsx)(w.CookSafeRecords,{who:m,rid:i}):null,'units'===l?(0,v.jsx)(f.UnitsView,{who:m}):null,'record'===l?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(D,{who:m}),(0,v.jsx)(P,{who:m})]}):null,'diary'===l?(0,v.jsx)(f.DiaryView,{who:m}):null,'weekly'===l?(0,v.jsx)(f.WeeklyView,{who:m}):null,'report'===l?(0,v.jsx)(f.ReportView,{who:m}):null,'inspector'===l&&x?(0,v.jsx)(j.InspectorView,{who:m}):null,'history'===l?(0,v.jsx)(R,{who:m}):null,'limits'===l?(0,v.jsx)(L,{mode:s,editable:'chef'===s}):null,'probes'===l?(0,v.jsx)(A,{mode:s,me:e,now:n}):null,(0,v.jsx)(h.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. This is your CookSafe log (Food Standards Scotland): cross-contamination and allergens, cleaning, chilled storage and cooling, cooking, reheating and hot holding, management and records. Shared with every device at the venue: a reading taken offline sends by itself when the connection is back."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=e(_r(_d[7])),c=e(_r(_d[8])),u=e(_r(_d[9])),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]),b=_r(_d[15]),f=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),v=_r(_d[19]);const k=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),C=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),S=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function T({now:e,onPress:t,mode:n="managers"}){const o=(0,s.useSafetyView)(n).points,i=(0,s.useSafetyView)(n).entries,l=(0,m.missedChecks)(o,i,e);if(!l.length)return(0,v.jsx)(u.default,{testID:"haccp-uptodate",children:(0,v.jsx)(h.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const r=(0,v.jsx)(u.default,{testID:"haccp-missed",children:(0,v.jsx)(h.Banner,{kind:"warn",title:`${l.length} food safety check${1===l.length?'':'s'} overdue`,children:l.map(e=>`${e.point.name} (due ${e.due})`).join(' \xb7 ')})});return t?(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:r}):r}function I(e,t){p.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,i.chefCanSee)(l.useOwner.getState().site,t.point)).map(t=>{const n=(0,m.isTempKind)(t.point.kind)?(0,m.inRange)(t.point,t.value):!!t.done;return{pointId:t.point.id,name:t.point.name,kind:t.point.kind,at:e.now.toISOString(),by:e.me.replace(' (example)',''),byId:e.meId,app:e.mode,value:t.value,done:t.done,ok:n,corrective:t.corrective?.trim()||void 0,note:t.note?.trim()||void 0,source:t.source,initials:(0,m.initialsOf)(e.me)}}))}function D({who:e}){const o=(0,s.useSafetyView)(e.mode).points,[d,p]=(0,r.useState)(''),[y,f]=(0,r.useState)(null),[j,w]=(0,r.useState)(''),[k,C]=(0,r.useState)(!1),[T,D]=(0,r.useState)(!1),P=(0,r.useRef)(null),R=(t,n)=>{if('chef'===e.mode&&!(0,i.chefCanSee)(l.useOwner.getState().site,t))return f(null),void w('That check is managed in the Managers app.');const s=(0,m.parseQuick)(t,o);D(n),w(''),f(s.map((e,t)=>({key:`${t}-${e.text}`,text:e.text,pointId:e.point?.id,value:null==e.value?'':String(e.value),done:!(!e.point||(0,m.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},B=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),L=(y??[]).map(e=>{const t=o.find(t=>t.id===e.pointId),n=S(e.value),s=!!t&&(0,m.isTempKind)(t.kind),i=!!t&&(s?null!=n:void 0!==e.done),l=t?s?null!=n?(0,m.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:i,ok:l,needsAction:!1===l&&!e.corrective.trim()}}),$=L.length>0&&L.every(e=>e.ready&&!e.needsAction);return(0,v.jsxs)(b.Box,{testID:"haccp-quick",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,v.jsx)(h.Muted,{children:"For example \u201cprep fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:d,onChangeText:p,placeholder:"prep fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>R(d,!1),style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),(0,v.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,b.speechRecognition)();if(!e)return void w("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(k)return void P.current?.stop();const t=new e;P.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';p(t),t&&R(t,!0)},t.onerror=()=>w("Didn't catch that. Try again or type the readings."),t.onend=()=>C(!1);try{t.start(),C(!0)}catch{w("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:k?x.colours.gold:'transparent'},children:(0,v.jsx)(h.T,{size:20,children:k?'\u25a0':'\ud83c\udfa4'})})]}),(0,v.jsx)(h.Button,{label:"Check readings",disabled:!d.trim(),onPress:()=>R(d,!1)}),j?(0,v.jsx)(u.default,{testID:"haccp-quick-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:j})}):null,y?(0,v.jsxs)(u.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,v.jsxs)(h.T,{weight:"semibold",children:["Check these ",y.length," reading",1===y.length?'':'s']}),L.map(({d:e,point:s,temp:i,ok:l,needsAction:r})=>(0,v.jsxs)(u.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===l?x.colours.red:x.colours.border,backgroundColor:x.colours.surface2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(h.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,v.jsx)(n.GoldClose,{size:"sm",label:`Remove ${s?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key))})]}),s?(0,v.jsxs)(h.T,{weight:"semibold",children:[s.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 safe: ",(0,m.limitText)(s)]})]}):(0,v.jsxs)(u.default,{style:{gap:6},children:[(0,v.jsx)(h.T,{colour:x.colours.amber,children:e.problem}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(t=>(0,v.jsx)(h.Chip,{label:t.name,onPress:()=>B(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),s&&i?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${s.name}`,value:e.value,onChangeText:t=>B(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:96,fontSize:20}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===l?(0,v.jsx)(h.Badge,{kind:"amber",label:"Type the reading"}):(0,v.jsx)(h.Badge,{kind:l?'ok':'red',label:l?'OK':'OUT OF RANGE'})]}):null,s&&!i?(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===e.done,onPress:()=>B(e.key,{done:!0})}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>B(e.key,{done:!1})})]}):null,!1===l?(0,v.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${s.name}`,value:e.corrective,onChangeText:t=>B(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[h.styles.input,r&&{borderColor:x.colours.red}]}):null,r?(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:`Save ${L.length} reading${1===L.length?'':'s'}`,testID:"haccp-save-quick",disabled:!$,onPress:()=>{I(e,L.map(e=>({point:e.point,value:e.temp?e.v:void 0,done:e.temp?void 0:e.d.done,corrective:e.d.corrective,source:T?'voice':'typed'}))),w(`Saved ${L.length} reading${1===L.length?'':'s'}.`),f(null),p('')},style:{flex:1}}),(0,v.jsx)(h.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),w('Nothing saved.')}})]}),(0,v.jsx)(h.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function P({who:e}){const n=(0,s.useSafetyView)(e.mode).points,[o,i]=(0,r.useState)(n[0]?.id),[l,d]=(0,r.useState)(''),[c,u]=(0,r.useState)(),[p,y]=(0,r.useState)(''),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),C=n.find(e=>e.id===o),T=!!C&&(0,m.isTempKind)(C.kind),D=S(l),P=C?T?null==D?null:(0,m.inRange)(C,D):void 0===c?null:c:null,R=null!==P&&(P||p.trim());return(0,v.jsxs)(b.Box,{testID:"haccp-manual",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Record one check"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:n.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:e.id===o,onPress:()=>{i(e.id),d(''),u(void 0),y(''),k('')}},e.id))}),C?(0,v.jsxs)(h.Muted,{children:[m.KIND_LABEL[C.kind]," \xb7 safe: ",(0,m.limitText)(C)]}):null,T?(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:l,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[h.styles.input,{width:110,fontSize:22}]}),(0,v.jsx)(h.T,{size:18,children:"\xb0C"}),null===P?null:(0,v.jsx)(h.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(h.Chip,{label:"Done",selected:!0===c,onPress:()=>u(!0)}),(0,v.jsx)(h.Chip,{label:"Not done",selected:!1===c,onPress:()=>u(!1)})]}),!1===P?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(h.Banner,{kind:"danger",title:T?'Out of range':'Check not done',children:"Write what you did about it before saving (e.g. moved food, discarded, called the engineer, re-checked in 30 minutes)."}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:p,onChangeText:y,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:h.styles.input})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:f,onChangeText:j,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{I(e,[{point:C,value:T?D:void 0,done:T?void 0:c,corrective:p,note:f,source:'typed'}]),d(''),u(void 0),y(''),j(''),k(`Saved: ${C.name}.`)}}),w?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:w}):null]})}function R({who:e}){const t=(0,s.useSafetyView)(e.mode).entries,n=(0,s.useSafetyView)(e.mode).allPoints,[o,i]=(0,r.useState)('7'),[l,d]=(0,r.useState)('all'),[c,p]=(0,r.useState)(!1),[y,f]=(0,r.useState)(''),j='staff'===e.mode,w=(0,r.useMemo)(()=>{const n=new Date(e.now);n.setHours(0,0,0,0);const s='today'===o?n.getTime():'all'===o?0:e.now.getTime()-864e5*Number(o);return t.filter(t=>!(j&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==l&&t.kind!==l||c&&t.ok))},[t,o,l,c,j,e.meId,e.now.getTime()]),k=Array.from(new Set(n.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,v.jsxs)(b.Box,{testID:"haccp-history",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:j?'My entries':'Food safety log'}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,v.jsx)(h.Chip,{label:t,selected:o===e,onPress:()=>i(e)},e))}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"All checks",selected:'all'===l,onPress:()=>d('all')}),k.map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:l===e,onPress:()=>d(e)},e))]}),(0,v.jsx)(h.Toggle,{label:"Out of range only",value:c,onChange:p}),(0,v.jsx)(u.default,{testID:"haccp-count",children:(0,v.jsxs)(h.Muted,{children:[w.length," entr",1===w.length?'y':'ies',w.filter(e=>!e.ok).length?` \xb7 ${w.filter(e=>!e.ok).length} out of range`:'']})}),w.length?w.slice(0,200).map(e=>(0,v.jsx)(B,{e:e},e.id)):(0,v.jsx)(h.Muted,{children:"No entries for these filters yet."}),j?null:(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,v.jsx)(h.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!w.length,onPress:()=>f((0,b.downloadText)(`food-safety-log-${C}.csv`,(0,m.toCsv)(w,n))?`CSV downloaded: ${w.length} entries.`:'Downloads work in the web app.')}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!w.length,onPress:()=>f((0,b.printTable)('Food safety log (HACCP)',`${w.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,m.LOG_HEAD,(0,m.logRows)(w,n))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),y?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:y}):null]})}function B({e:e}){return(0,v.jsxs)(u.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border,gap:2},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,v.jsx)(h.T,{size:17,weight:"bold",colour:e.ok?x.colours.ok:x.colours.red,children:(0,m.fmtEntryValue)(e)})]}),(0,v.jsxs)(h.Row,{gap:6,children:[(0,v.jsx)(y.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,v.jsxs)(h.Muted,{style:{flex:1},children:[C(e.at)," ",k(e.at)," \xb7 ",e.initials??(0,m.initialsOf)(e.by)," ",e.by,'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 probe':'',e.ok?'':' \xb7 OUT OF RANGE']})]}),e.corrective?(0,v.jsxs)(h.T,{size:13,colour:x.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,v.jsxs)(h.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,v.jsx)(d.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function L({editable:e,mode:t}){const n=(0,s.useSafetyView)(t).points,[o,i]=(0,r.useState)('');return(0,v.jsxs)(b.Box,{testID:"haccp-limits",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,v.jsx)(h.Muted,{children:e?'Set the limits from your own HACCP plan. Leave min or max empty if it doesn\u2019t apply. Due times are daily reminders (24 h, comma separated).':'Set by the Head Chef in CoverCharge for Head Chef.'}),n.map(t=>(0,v.jsx)($,{p:t,editable:e,onSaved:()=>i(`Saved limits for ${t.name}.`)},t.id)),e?(0,v.jsx)(z,{onAdded:e=>i(`Added ${e}.`)}):null,o?(0,v.jsx)(h.T,{size:14,colour:x.colours.ok,children:o}):null]})}function $({p:e,editable:n,onSaved:s}){const[o,i]=(0,r.useState)(null==e.min?'':String(e.min)),[l,d]=(0,r.useState)(null==e.max?'':String(e.max)),[c,y]=(0,r.useState)(e.due.join(', ')),b=(0,m.isTempKind)(e.kind),f=''===c.trim()||c.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),j=o!==(null==e.min?'':String(e.min))||l!==(null==e.max?'':String(e.max))||c!==e.due.join(', '),w=f&&(''===o||null!=S(o))&&(''===l||null!=S(l));return n?(0,v.jsxs)(u.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:x.colours.border},testID:`limit-${e.id}`,children:[(0,v.jsxs)(h.T,{weight:"medium",children:[e.name," ",(0,v.jsxs)(h.Muted,{children:["\xb7 ",m.KIND_LABEL[e.kind]]})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,children:[b?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:i,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]}),(0,v.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:l,onChangeText:d,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[h.styles.input,{width:90}]})]}):null,(0,v.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:c,onChangeText:y,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1,minWidth:140,width:40}]}),j?(0,v.jsx)(h.Button,{small:!0,label:"Save",disabled:!w,onPress:()=>{p.useSafety.getState().setPoint(e.id,{min:''===o?void 0:S(o),max:''===l?void 0:S(l),due:c.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),f?null:(0,v.jsx)(h.T,{size:13,colour:x.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,v.jsx)(h.T,{size:14,style:{flex:1},children:e.name}),(0,v.jsxs)(h.Muted,{children:[(0,m.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function z({onAdded:e}){const[n,s]=(0,r.useState)(''),[o,d]=(0,r.useState)('fridge');return(0,v.jsxs)(u.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsx)(h.T,{weight:"medium",children:"Add a check point"}),(0,v.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:s,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:h.styles.input}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(m.KIND_LABEL).map(e=>(0,v.jsx)(h.Chip,{label:m.KIND_LABEL[e],selected:e===o,onPress:()=>d(e)},e))}),(0,v.jsx)(h.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,i.chefCanSee)(l.useOwner.getState().site,n),onPress:()=>{if(!(0,i.chefCanSee)(l.useOwner.getState().site,n))return;const t='fridge'===o?{max:5}:'freezer'===o?{max:-18}:'cook'===o?{min:75}:'hothold'===o?{min:63}:'cool'===o||'delivery'===o?{max:8}:{};p.useSafety.getState().addPoint({name:n.trim(),kind:o,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),s('')}})]})}function A({me:e,now:n,mode:o}){const d=(0,s.useSafetyView)(o).probes??[],c=(0,s.useSafetyView)(o).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[m,y]=(0,r.useState)(!1),[f,j]=(0,r.useState)(''),[w,k]=(0,r.useState)(''),[C,S]=(0,r.useState)(null),[T,I]=(0,r.useState)(''),D=c.find(e=>e.id===w);return(0,v.jsxs)(b.Box,{testID:"haccp-probes",children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,v.jsx)(h.Muted,{children:"Wireless fridge and freezer probes. Once a probe is connected, its readings go into the food safety log tagged \u201cprobe\u201d with the time they were taken. Out-of-range probe readings still need a corrective action from a person."}),d.length?d.map(e=>(0,v.jsxs)(u.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:x.colours.border},children:[(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsxs)(u.default,{style:{flex:1,gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",children:e.name}),(0,v.jsx)(h.Muted,{children:e.location})]}),(0,v.jsx)(h.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>S(C===e.id?null:e.id)}),(0,v.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>p.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,v.jsxs)(u.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(h.T,{weight:"semibold",children:"Connect your probe"}),(0,v.jsxs)(h.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,v.jsx)(h.T,{size:14,children:"2. Keep this device near the probe."}),(0,v.jsx)(h.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,v.jsx)(h.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>I(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,v.jsx)(u.default,{testID:"probes-empty",children:(0,v.jsx)(h.Muted,{children:"No probes yet."})}),T?(0,v.jsx)(u.default,{testID:"probe-msg",children:(0,v.jsx)(h.Banner,{kind:"info",children:T})}):null,m?(0,v.jsxs)(u.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,v.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:f,onChangeText:j,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[h.styles.input,{minWidth:0}]}),(0,v.jsx)(h.Muted,{children:"Where is it?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:c.map(e=>(0,v.jsx)(h.Chip,{label:e.name,selected:w===e.id,onPress:()=>k(e.id)},e.id))}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(h.Button,{label:"Save probe",disabled:!f.trim()||!D,onPress:()=>{f.trim()&&D&&('chef'!==o||(0,i.chefCanSee)(l.useOwner.getState().site,D))&&(p.useSafety.getState().addProbe({name:f.trim(),pointId:D.id,location:D.name,addedBy:e.replace(' (example)',''),addedAt:n.toISOString()}),I(`Added \u201c${f.trim()}\u201d for ${D.name}. Next: connect your probe.`),j(''),k(''),y(!1))}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Cancel",onPress:()=>y(!1)})]})]}):(0,v.jsx)(h.Button,{kind:"secondary",label:"Add probe",onPress:()=>{y(!0),I('')}}),(0,v.jsx)(h.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1065,[874,835,1477,1432,1084,863,31,197,264,128,818,1180,1187,825,996,1386,1478,1480,1482,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=b,_e.pickPhoto=p,_e.AvatarMaker=function({meId:e,me:u}){const g=(0,i.useAvatars)(t=>t.photos[e]),[f,v]=(0,t.useState)(null),[y,x]=(0,t.useState)(null),[j,w]=(0,t.useState)(!1),[I,P]=(0,t.useState)(!1),[k,M]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{f&&URL.revokeObjectURL(f)},[f]);const R='undefined'!=typeof document,S=async e=>{M('');const t=await p(e);if(t){P(!0),w(!1);try{const e=await b(t);f&&URL.revokeObjectURL(f),v(URL.createObjectURL(t)),x(e)}catch{M("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{P(!1)}}},U=()=>{f&&URL.revokeObjectURL(f),v(null),x(null),w(!1)},B=u.replace(' (example)','');return(0,h.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,h.jsxs)(d.Box,{children:[(0,h.jsxs)(s.Row,{gap:14,children:[(0,h.jsx)(l.StaffAvatar,{id:e,size:88}),(0,h.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,h.jsxs)(s.Muted,{children:[g?`Your chosen avatar (saved ${new Date(g.at).toLocaleDateString('en-GB')}).`:'Your original crew avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),g?(0,h.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{i.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),M('Back to your default avatar.')}}):null]}),(0,h.jsx)(d.Box,{children:(0,h.jsx)(n.AvatarOptions,{value:g?.dataUrl,onSelect:t=>{const a=i.useAvatars.getState().setOwn(e,e,t.dataUrl,B);M(a?`${t.name} is your avatar now.`:'Could not save your avatar.')}})}),(0,h.jsxs)(d.Box,{testID:"avatar-create",children:[(0,h.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,h.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),R?y?(0,h.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,h.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[f?(0,h.jsx)(a.default,{source:{uri:f},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,h.jsx)(s.Muted,{children:"Your photo"})]}),(0,h.jsx)(s.T,{size:22,colour:c.colours.gold,children:"\u2192"}),(0,h.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,h.jsx)(a.default,{source:{uri:y},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:c.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,h.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,h.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:j},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>w(!j),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:j?c.colours.gold:c.colours.border},children:[(0,h.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:c.colours.gold,backgroundColor:j?c.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:j?(0,h.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,h.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!j,onPress:()=>{const t=i.useAvatars.getState().setOwn(e,e,y,B);M(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&U()}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:U})]})]}):(0,h.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(s.Button,{label:I?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:I,onPress:()=>S(!1)}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:I,onPress:()=>S(!0)})]}):(0,h.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,h.jsx)(o.default,{testID:"avatar-msg",children:(0,h.jsx)(s.T,{size:14,colour:c.colours.ok,children:k})}):null]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]);const u=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),g=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function f(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function v(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function b(e){const{img:t,url:a}=await f(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),d=c[Math.floor(.04*c.length)],h=c[Math.floor(.96*c.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},1066,[31,197,123,264,128,818,996,1385,1225,825,1386,25]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1067,[874,31,264,128,818,825,829,5,986,807,824,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RELEASE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"nightlyEmailAllowed",{enumerable:!0,get:function(){return t}});const n={specialsSync:!0,nightlyEmail:!1,nightlyPush:!1,supportSync:!0,planPhoto:!0},t=(t,l)=>'anchorage'!==t&&l&&n.nightlyEmail},1068,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},1069,[812,18]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photosAllowed=function(){const t=a.useSync.getState();return'staff'!==t.kind||!t.venueId||'off'===t.mode||'local'===t.mode||t.perms.includes('*')},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600,n=.78){return new Promise((r,o)=>{const c=URL.createObjectURL(t),i=new Image;i.onload=()=>{const t=Math.min(1,a/Math.max(i.width,i.height)),o=document.createElement('canvas');o.width=Math.round(i.width*t),o.height=Math.round(i.height*t),o.getContext('2d').drawImage(i,0,0,o.width,o.height),URL.revokeObjectURL(c),r(o.toDataURL('image/jpeg',n))},i.onerror=()=>{URL.revokeObjectURL(c),o(new Error('not an image'))},i.src=c})}},1070,[123,872,824,1097]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_LOYALTY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"consentText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"prettyCardNo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"cleanCode",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"cardQr",{enumerable:!0,get:function(){return s}}),_e.readCardQr=function(e){const r=/^covercharge:card:[^:]+:([A-Za-z0-9-]{8,9})$/.exec(e.trim());return r?n(r[1]):null},Object.defineProperty(_e,"codeQr",{enumerable:!0,get:function(){return o}}),_e.checkSettings=function(e){return!Number.isInteger(e.stampsNeeded)||e.stampsNeeded<2||e.stampsNeeded>30?'Stamps needed must be between 2 and 30.':e.reward.trim()?e.reward.length>80?'Keep the reward under 80 letters.':e.gapMinutes<0||e.gapMinutes>1440?'Time between stamps must be 0 to 24 hours.':e.maxPerDay<1||e.maxPerDay>10?'Stamps a day must be 1 to 10.':!Number.isInteger(e.stampExpiryDays)||e.stampExpiryDays<0||e.stampExpiryDays>1095?'Stamps last 0 (never run out) to 1095 days.':!Number.isInteger(e.rewardExpiryDays)||e.rewardExpiryDays<0||e.rewardExpiryDays>1095?'Rewards last 0 (never run out) to 1095 days.':!e.referralOn||e.referralGiver.trim()&&e.referralFriend.trim()?e.referralMonthlyCap<0||e.referralMonthlyCap>50?'Friend rewards a month must be 0 to 50.':null:'Say what both people get before you switch Bring a friend on.':'Say what the reward is, for example Free dessert.'},_e.checkOffer=function(e){if(!e.title.trim())return'Give the offer a title.';if(e.title.length>80)return'Keep the title under 80 letters.';if(e.details.length>500)return'Keep the details under 500 letters.';const r=/^\d{4}-\d{2}-\d{2}$/;return e.startsOn&&!r.test(e.startsOn)?'Start date should look like 2026-11-30.':e.endsOn&&!r.test(e.endsOn)?'End date should look like 2026-11-30.':e.startsOn&&e.endsOn&&e.endsOn`I agree to ${e} keeping my name and the phone or email I give, only to run my stamp card and offers here. I can leave at any time and my details are removed.`,t=e=>e&&8===e.length?`${e.slice(0,4)}-${e.slice(4)}`:e,n=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,''),s=(e,r)=>`covercharge:card:${e}:${r}`;const o=(e,r,t)=>`${e.replace(/\/$/,'')}/customer/${r}/loyalty?code=${t}`;const l=(e,r)=>e.isOn&&(!e.startsOn||e.startsOn<=r)&&(!e.endsOn||e.endsOn>=r),p=r=>r?{saved:!!r.updated_by,cardOn:!!r.card_on,stampsNeeded:r.stamps_needed??8,reward:r.reward??'',stampExpiryDays:r.stamp_expiry_days??0,rewardExpiryDays:r.reward_expiry_days??0,gapMinutes:r.gap_minutes??60,maxPerDay:r.max_per_day??1,referralOn:!!r.referral_on,referralGiver:r.referral_giver??'',referralFriend:r.referral_friend??'',referralMonthlyCap:r.referral_monthly_cap??5}:{...e},u=e=>({card_on:e.cardOn,stamps_needed:e.stampsNeeded,reward:e.reward.trim(),stamp_expiry_days:e.stampExpiryDays,reward_expiry_days:e.rewardExpiryDays,gap_minutes:e.gapMinutes,max_per_day:e.maxPerDay,referral_on:e.referralOn,referral_giver:e.referralGiver.trim(),referral_friend:e.referralFriend.trim(),referral_monthly_cap:e.referralMonthlyCap}),y=e=>({id:String(e.id),title:e.title??'',details:e.details??'',startsOn:e.starts_on??null,endsOn:e.ends_on??null,isOn:!1!==e.is_on})},1071,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOP_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PAY_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"cleanGiftCode",{enumerable:!0,get:function(){return o}}),e.prettyGiftCode=function(t){const n=o(t);return 16===n.length?n.match(/.{4}/g).join('-'):n},e.poundsToPence=i,e.redeemKey=function(t=Math.random){const n='abcdefghijkmnpqrstuvwxyz23456789';let r='r-';for(let o=0;o<20;o++)r+=n[Math.floor(32*t())%32];return r},Object.defineProperty(e,"expiryWords",{enumerable:!0,get:function(){return c}}),e.amountsFromText=function(t){const n=t.split(/[,\s]+/).filter(Boolean).map(i);return!n.length||n.length>6||n.some(t=>null===t||t<100)?null:[...new Set(n)].sort((t,n)=>t-n)},e.basketTotal=function(t,n){return t.reduce((t,r)=>t+(n.find(t=>t.id===r.id)?.pricePence??0)*r.qty,0)},Object.defineProperty(e,"settingsFromRow",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"settingsToRow",{enumerable:!0,get:function(){return a}});const t={giftsOn:!1,shopOn:!1,expiryMonths:24,amounts:[2500,5e3,1e4],minPence:500,maxPence:25e3,terms:''},n='Gift cards are sold through your website. You can also pay at the bar or till.',r={'waiting-payment':'Waiting for payment at the till',active:'Ready to use',used:'Used up',expired:'Expired',void:'Cancelled',paid:'Paid',ready:'Ready to collect',collected:'Collected',cancelled:'Cancelled'},o=t=>(t??'').toUpperCase().replace(/[^A-Z0-9]/g,'');function i(t){const n=(t??'').trim().replace(/^\xa3/,'');return/^\d{1,4}(\.\d{1,2})?$/.test(n)?Math.round(100*Number(n)):null}const c=t=>t%12==0?`${t/12} year${12===t?'':'s'}`:`${t} months`;const s=n=>n?{giftsOn:!!n.gifts_on,shopOn:!!n.shop_on,expiryMonths:n.expiry_months??24,amounts:n.amounts??t.amounts,minPence:n.min_pence??500,maxPence:n.max_pence??25e3,terms:n.terms??''}:{...t},a=t=>({gifts_on:t.giftsOn,shop_on:t.shopOn,expiry_months:t.expiryMonths,amounts:t.amounts,min_pence:t.minPence,max_pence:t.maxPence,terms:t.terms})},1072,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shopPublic",{enumerable:!0,get:function(){return p}}),e.myShop=async function(t){return await(0,n.guestSession)()?(0,n.rpc)('guest_my_shop',{p_slug:t}):{cards:[],orders:[]}},e.buyGift=async function(t,o){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_gift_buy',{p_slug:t,p_amount:o.amount,p_recipient:o.recipient,p_from:o.from,p_message:o.message})},e.shopOrder=async function(t,o,c){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_shop_order',{p_slug:t,p_lines:o,p_name:c})},Object.defineProperty(e,"giftCheck",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"giftRedeem",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"giftActivate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"giftIssue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"giftHonourWix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"giftVoid",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"giftSummary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"shopStatus",{enumerable:!0,get:function(){return v}}),e.waitingCards=async function(){const{data:t,error:n}=await c().from('gift_cards').select('id,last4,ref,initial_pence,balance_pence,status,source,recipient_name,issued_at,expires_at').eq('venue_id',s()).order('issued_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.shopOrders=async function(){const{data:t,error:n}=await c().from('shop_orders').select('*').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.readShopSettings=async function(){const{data:t,error:n}=await c().from('shop_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return(0,o.settingsFromRow)(t)},e.saveShopSettings=async function(t){const{error:n}=await c().from('shop_settings').upsert({venue_id:s(),...(0,o.settingsToRow)(t),updated_by:u(),updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readProducts=async function(){const{data:t,error:n}=await c().from('shop_products').select('*').eq('venue_id',s()).order('sort').order('name');if(n)throw n;return t??[]},e.saveProduct=async function(t){const n={venue_id:s(),name:t.name.trim(),details:t.details.trim(),price_pence:t.pricePence,stock:t.stock,is_live:t.live,updated_by:u(),updated_at:(new Date).toISOString()},{error:o}=t.id?await c().from('shop_products').update(n).eq('id',t.id):await c().from('shop_products').insert(n);if(o)throw o},Object.defineProperty(e,"payPublic",{enumerable:!0,get:function(){return S}}),e.payStart=async function(t,o,s){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const u='undefined'!=typeof window?window.location.href.split('?')[0]:'',{data:p,error:_}=await c().functions.invoke('pay-checkout',{body:{slug:t,kind:o,target:s,successUrl:u,cancelUrl:u}});if(_||!p?.url)throw new Error(p?.error??'Card payment isn\u2019t available yet. Pay at the bar or till.');if(!/^https:\/\/checkout\.stripe\.com\//.test(p.url))throw new Error('Card payment isn\u2019t available yet. Pay at the bar or till.');return p},Object.defineProperty(e,"payStatus",{enumerable:!0,get:function(){return P}}),e.readPaySettings=async function(){const{data:t,error:n}=await c().from('payment_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return{provider:t?.provider??'none',cardOn:!!t?.card_on,account:t?.stripe_account_id??''}},Object.defineProperty(e,"savePaySettings",{enumerable:!0,get:function(){return O}}),e.recentPayments=async function(){const{data:t,error:n}=await c().from('payments').select('id,kind,amount_pence,status,provider,created_at,paid_at').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(20);if(n)throw n;return t??[]};var t=r(d[0]),n=r(d[1]),o=r(d[2]);const c=()=>(0,t.getSupabase)(),s=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},u=()=>(n.useSync.getState().staffRef??'').slice(0,80)||null,p=t=>(0,n.rpc)('shop_public',{p_slug:t});const _=t=>(0,n.rpc)('staff_gift_check',{p_venue:s(),p_code:t}),f=(t,o,c,u)=>(0,n.rpc)('staff_gift_redeem',{p_venue:s(),p_code:t,p_amount:o,p_key:c,p_by:u}),y=(t,o)=>(0,n.rpc)('staff_gift_activate',{p_card:t,p_by:o}),l=(t,o,c)=>(0,n.rpc)('staff_gift_issue',{p_venue:s(),p_amount:t,p_recipient:o,p_by:c}),b=(t,o,c)=>(0,n.rpc)('staff_gift_honour_wix',{p_venue:s(),p_code:t,p_balance:o,p_by:c}),w=(t,o,c)=>(0,n.rpc)('staff_gift_void',{p_card:t,p_reason:o,p_by:c}),h=()=>(0,n.rpc)('staff_gift_summary',{p_venue:s()}),v=(t,o,c,s)=>(0,n.rpc)('staff_shop_status',{p_order:t,p_status:o,p_reason:c,p_by:s});const S=async t=>{try{return await(0,n.rpc)('pay_public',{p_slug:t})}catch{return{provider:'none',cardOn:!1,testMode:!0}}};const P=t=>(0,n.rpc)('guest_pay_status',{p_payment:t});const O=t=>(0,n.rpc)('staff_payment_settings_save',{p_venue:s(),p_provider:t.provider,p_card_on:t.cardOn,p_account:t.account,p_by:u()})},1073,[872,824,1072]); +__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},1074,[1279,1268,1280]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.refreshCashAccess=r,e.setStaffCashUp=async function(o,c){const u=s.useSync.getState().venueId;if(!u)return{ok:!1,error:'Not connected. Try again when the app is online.'};const f=(0,t.getSupabase)();try{const{data:t}=await f.from('staff').select('id').eq('venue_id',u).eq('external_ref',o).maybeSingle();if(!t?.id)return{ok:!1,error:'This person isn\u2019t on the shared team list yet.'};const{error:s}=await f.rpc('set_staff_cash_up',{p_staff:t.id,p_on:c});return s?{ok:!1,error:/owner or manager/i.test(s.message)?'Only an owner or manager can change this.':'Could not save. Try again.'}:(n.useCashAccess.setState(t=>({byRef:{...t.byRef,[o]:c}})),r(),{ok:!0})}catch{return{ok:!1,error:'Could not save. Try again when the app is online.'}}};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]);async function r(){const r=s.useSync.getState().venueId;if(!r||'staff'!==s.useSync.getState().kind)return;const o=(0,t.getSupabase)();try{const[{data:t},{data:s},c]=await Promise.all([o.rpc('my_cash_up_access',{p_venue:r}),o.from('staff').select('external_ref, can_cash_up').eq('venue_id',r),o.rpc('my_cash_up_scope',{p_venue:r}).then(t=>t,()=>({data:null}))]),u=c?.data??null;u&&'boolean'==typeof u.takings&&n.useCashAccess.setState({takings:u.takings,tradingDate:'string'==typeof u.tradingDate?u.tradingDate:null,photos:!0===u.photos});const f={};if(Array.isArray(s))for(const t of s)t.external_ref&&(f[t.external_ref]=!!t.can_cash_up);n.useCashAccess.setState({mine:'boolean'==typeof t?t:n.useCashAccess.getState().mine,byRef:Array.isArray(s)?f:n.useCashAccess.getState().byRef,loaded:!0})}catch{}}},1075,[872,824,1047]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1076,[31,128,823,807,817,14,1421,825,818,25]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RID",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return d}}),_e.nextStatus=function(e){return'new'===e.status||'acknowledged'===e.status?{to:'preparing',label:'Start preparing'}:'preparing'===e.status?{to:'ready',label:'takeaway'===e.type?'Mark ready (notify customer)':'Mark ready'}:'ready'===e.status?'takeaway'===e.type?{to:'collected',label:'Collected'}:{to:'served',label:'Served'}:null},Object.defineProperty(_e,"LIVE",{enumerable:!0,get:function(){return u}}),_e.busyLevel=b,_e.restOfDayLevel=function(e,t){const r=e.hours.filter(t=>!e.nextHour||t.hour>=e.nextHour.hour).reduce((e,t)=>!e||t.coversHigh>e.coversHigh?t:e,void 0);return{level:b(r?.coversHigh??0,e.busy.busy),peak:r}},_e.Tile=function({label:e,value:n,sub:c,onPress:a,accent:d,children:u,accessibilityLabel:b,testID:h}){const f=(0,s.jsxs)(r.default,{testID:a?void 0:h,style:{flexGrow:1,flexBasis:150,minHeight:48,alignItems:'center',justifyContent:'center',backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{center:!0,size:13,weight:"medium",colour:o.colours.muted,children:e}),n?(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}):null,c?(0,s.jsx)(l.T,{center:!0,size:13,colour:o.colours.muted,children:c}):null,u]});return a?(0,s.jsx)(t.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,onPress:a,style:{flexGrow:1,flexBasis:150,minHeight:48},children:f}):f},_e.SectionHead=function({title:e,right:t,sub:n}){return(0,s.jsxs)(r.default,{dataSet:{centre:'heading'},style:{gap:4,marginTop:6,alignItems:'center',alignSelf:'stretch',width:'100%'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,center:!0,accessibilityRole:"header",children:e}),n?(0,s.jsx)(l.Muted,{center:!0,children:n}):null,t?(0,s.jsx)(r.default,{style:{alignItems:'center'},children:t}):null]})},_e.AlertBox=function({colour:e,title:t,children:n}){return(0,s.jsxs)(r.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:t}),n]})},_e.Bars=function({data:e,max:t,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const a=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(r.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(r.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(r.default,{style:{height:Math.max(0,e.b/t*c),backgroundColor:a?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(r.default,{style:{height:Math.max(d?2:0,e.a/t*c),backgroundColor:a?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:a?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var t=e(_r(_d[1])),r=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,a=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({awaiting_payment:'Waiting for card payment',new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const u=e=>!['awaiting_payment','collected','served','closed','cancelled'].includes(e.status);function b(e,t){const r=t?e/t:0;return r<.5?{label:'Quiet',colour:o.colours.muted,pct:r}:r<1?{label:'Steady',colour:o.colours.goldLight,pct:r}:{label:'Busy',colour:o.colours.amber,pct:r}}const h=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1077,[31,264,128,818,825,5,25]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return m}}),_e.BookingsDayNav=function({today:e,date:s,onDate:u,sub:c,count:y}){const[p,D]=(0,t.useState)(sb(e,6)?s:e),[w,h]=(0,t.useState)(!1),f=Array.from({length:7},(e,t)=>b(p,t)),j=e=>{u(e),f.includes(e)||D(e)},$=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':k(t);return(0,d.jsxs)(o.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,d.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${m(b(p,-7))}`,onPress:()=>{D(b(p,-7)),u(b(p,-7))}}),(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${m(b(p,7))}`,onPress:()=>{D(b(p,7)),u(b(p,7))}}),s!==e?(0,d.jsx)(n.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${m(e)}`,onPress:()=>{D(e),u(e),h(!1)}}):null,(0,d.jsx)(n.Button,{small:!0,kind:"ghost",label:w?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>h(!0)})]}),(0,d.jsx)(l.AppDateCalendar,{visible:w,today:e,day:s,showBusy:!0,onDay:t=>{const s=t??e;j(s),D(s)},onClose:()=>h(!1),idPrefix:"bookings-cal"}),(0,d.jsx)(n.Row,{wrap:!0,gap:6,children:f.map(e=>(0,d.jsx)(n.Chip,{label:$(e),sub:c(e),selected:s===e,onPress:()=>u(e)},e))}),(0,d.jsx)(o.default,{testID:"bookings-day-title",children:(0,d.jsxs)(n.T,{size:17,weight:"semibold",colour:i.colours.goldLight,children:[m(s),sString(e).padStart(2,'0');function b(e,t){const[s,o,n]=e.split('-').map(Number),l=new Date(Date.UTC(s,o-1,n+t,12));return`${l.getUTCFullYear()}-${y(l.getUTCMonth()+1)}-${y(l.getUTCDate())}`}const p=e=>{const[t,s,o]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,o,12)).getUTCDay()+6)%7},m=e=>{const[t,s,o]=e.split('-').map(Number);return`${c[p(e)]} ${o} ${u[s-1]} ${t}`},k=e=>{const[,t,s]=e.split('-').map(Number);return`${c[p(e)].slice(0,3)} ${s} ${u[t-1].slice(0,3)}`}},1078,[31,128,818,1409,825,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1079,[31,818,823,826,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1080,[]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return n.useStore}}),_e.useNow=function(e=1e4){const r=(0,n.useStore)(e=>e.clock),[,u]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=setInterval(()=>u(e=>e+1),e);return()=>clearInterval(t)},[e]),(0,n.nowFrom)(r)},Object.defineProperty(_e,"useRestaurant",{enumerable:!0,get:function(){return a}}),_e.useRecipeCards=c,_e.useAllMenu=f,_e.useMenu=function(e){const r=f(e);return(0,t.useMemo)(()=>r.filter(e=>!e.hidden),[r])},Object.defineProperty(_e,"useCustomer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBasket",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useOrders",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"useOrderAtTable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useOrder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useBookings",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useWaitlist",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useEvents",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"useStampCard",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useGiftCards",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useRatings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"useAudit",{enumerable:!0,get:function(){return v}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),u=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]);_r(_d[7]);const a=e=>(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)),l=e=>(0,o.recipeCards)().subscribe(e),d=[];function c(e){return(0,t.useSyncExternalStore)(l,()=>e?(0,o.recipeCards)().list(e):d,()=>e?(0,o.recipeCards)().list(e):d)}function f(e){const u=(0,n.useStore)((0,r.useShallow)(t=>t.menu.filter(t=>t.restaurantId===e))),o=c(e);return(0,t.useMemo)(()=>(0,s.resolveMenu)(u),[u,o])}const b=()=>(0,n.useStore)(e=>e.customer),S=()=>(0,n.useStore)(e=>e.basket),g=(e,t)=>'table'!==t.type||(0,u.orderAtTableOn)(e.restaurants.find(e=>e.id===t.restaurantId)),m=e=>(0,n.useStore)((0,r.useShallow)(t=>t.orders.filter(r=>(!e||r.restaurantId===e)&&g(t,r)))),p=e=>(0,n.useStore)(t=>(0,u.orderAtTableOn)(t.restaurants.find(t=>t.id===e))),O=e=>(0,n.useStore)(t=>t.orders.find(t=>t.id===e)),y=e=>(0,n.useStore)((0,r.useShallow)(t=>e?t.bookings.filter(t=>t.restaurantId===e):t.bookings)),w=e=>(0,n.useStore)((0,r.useShallow)(t=>t.waitlist.filter(t=>t.restaurantId===e))),I=[],j=u=>{const s=(0,n.useStore)((0,r.useShallow)(e=>e.events.filter(e=>null===e.restaurantId||e.restaurantId===u))),o=(0,n.useStore)(e=>e.restaurants.find(e=>e.id===u)),a=o?(0,e.regularEventsOf)(o):I,l=(new Date).toISOString().slice(0,7);return(0,t.useMemo)(()=>{if(!u||!a.length)return s;const t=new Date,r=new Date(t.getFullYear(),t.getMonth()-2,1),n=new Date(t.getFullYear()+1,t.getMonth()+1,0),o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`;return[...s,...(0,e.expandEvents)(u,a,o(r),o(n))]},[s,a,u,l])},P=e=>(0,n.useStore)(t=>t.stampCards.find(r=>r.restaurantId===e&&r.customerId===t.customer.id)),h=e=>(0,n.useStore)((0,r.useShallow)(t=>t.giftCards.filter(r=>(!e||r.restaurantId===e)&&r.ownerId===t.customer.id))),M=e=>(0,n.useStore)((0,r.useShallow)(t=>t.ratings.filter(t=>t.restaurantId===e))),v=e=>(0,n.useStore)((0,r.useShallow)(t=>t.audit.filter(t=>t.restaurantId===e)))},1081,[814,31,884,881,1350,1188,839,1168]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"METHOD_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY3",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAYS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"wd",{enumerable:!0,get:function(){return i}}),e.dayRange=function(t){const n=[...new Set(t)].sort((t,n)=>t-n);if(!n.length)return'';if(7===n.length)return'every day';return n.every((t,o)=>o===0||t===n[o-1]+1)&&n.length>=3?`${o[n[0]]} to ${o[n[n.length-1]]}`:n.map(t=>o[t]).join(', ')},e.nextDelivery=a,Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return d}}),e.remindersFor=function(t,n,o={}){const d=i(n);return t.filter(t=>t.orderDays.includes(d)).flatMap(t=>{if(o[t.id]&&new Date(o[t.id]).toDateString()===n.toDateString())return[];let d=!1;if(/^\d\d:\d\d$/.test(t.cutoff)){const[o,s]=t.cutoff.split(':').map(Number),i=new Date(n);i.setHours(o,s,0,0),d=n>i}const l=a(t,n),c=t.reminder||`Order ${t.name} today${l?` for ${s[i(l)]}`:''}`;return[{supplierId:t.id,name:t.name,text:`${c}${t.cutoff?d?` (cut-off ${t.cutoff} passed)`:` by ${t.cutoff}`:''}`,tone:d?'red':'amber',cutoffPassed:d}]})},e.orderLines=function(n,o,s,i=""){const a=n.items.filter(t=>(o[t.id]??0)>0).map(n=>`${(0,t.fishInStone)(i,n)?(0,t.fishQtyText)(i,n,o[n.id]):`${l(o[n.id])} ${n.unit}`} ${n.name}`.replace(/\s+/g,' ').trim());return s.split('\n').map(t=>t.trim()).filter(Boolean).forEach(t=>a.push(t)),a},e.orderMessage=function(t,n,o,s,i,l){const c=a(t,l);return[`Hi ${t.contact||t.name.split(' (')[0]}, order from ${n}${o?`, ${o}`:''}${c?` for ${d(c)}`:''}:`,...s.map(t=>`- ${t}`),'',`Thanks, ${i}`].join('\n')},e.intlDigits=c,Object.defineProperty(e,"smsLink",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"waLink",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"telLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"sid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_SHEETS",{enumerable:!0,get:function(){return k}});var t=r(_d[0]);const n={online:'Online',phone:'Phone',text:'Text message',whatsapp:'WhatsApp',tbc:'To be decided'},o=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],s=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],i=t=>(t.getDay()+6)%7;function a(t,n){const o=null!=t.deliversOn?[t.deliversOn]:t.deliveryDays;if(!o.length)return null;for(let t=1;t<=7;t++){const s=new Date(n);if(s.setDate(s.getDate()+t),o.includes(i(s)))return s}return null}const d=t=>t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});const l=t=>Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,'');function c(t){const n=t.replace(/[^\d+]/g,'').replace(/^\+/,'');return n.startsWith('00')?n.slice(2):n.startsWith('0')?`44${n.slice(1)}`:n}const u=(t,n)=>`sms:${t.replace(/[^\d+]/g,'')}?&body=${encodeURIComponent(n)}`,m=(t,n)=>`https://wa.me/${c(t)}?text=${encodeURIComponent(n)}`,f=t=>`tel:${t.replace(/[^\d+]/g,'')}`;let p=0;const h=(t="os")=>`${t}-${Date.now().toString(36)}${(p++).toString(36)}`,y=(t,n,o)=>({id:t,name:n,unit:o}),b=t=>({number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:'',...t}),k=[b({id:'os-reids',name:'Reids',goods:'Dry goods and frozen',method:'online',urlLabel:'Open Coldweb',deliveryDays:[0,1,2,3,4],frequency:'Order on Coldweb',items:[y('rd-chips','Frozen chips','boxes'),y('rd-oil','Fryer oil','tubs'),y('rd-flour','Flour','bags'),y('rd-rice','Rice','bags'),y('rd-peas','Frozen peas','bags')],notes:'Order on their Coldweb ordering site. Add the Coldweb link in Managers \u203a Settings \u203a Supplier order sheets, or here.'}),b({id:'os-veg',name:'Veg',goods:'Fruit and veg (supplier to be added)',method:'tbc',placeholder:!0,frequency:'To be added by Gordon',notes:'Placeholder: Gordon will add the veg supplier, how to order and delivery days.'}),b({id:'os-peroni',name:'J. Pieroni & Sons',goods:'Seafood (fish merchant, Ayr)',method:'phone',url:'https://pieronis.com',urlLabel:'Open pieronis.com',deliveryDays:[0,1,2,3,4,5],frequency:'Phone order',items:[y('pa-haddock','Haddock fillets','kg'),y('pa-mussels','Mussels','kg'),y('pa-scallops','Scallops','kg'),y('pa-salmon','Salmon','kg')],notes:'Phone order. Press Call, then read the order from the screen.'}),b({id:'os-spesbona',name:'Spes Bona',goods:'Langoustines and smoked haddock',method:'text',orderDays:[2],deliversOn:4,deliveryDays:[4],frequency:'Text on Wednesday for Friday',reminder:'Text Spes Bona today for Friday\u2019s langoustines and smoked haddock',items:[y('sb-langs','Langoustines','kg'),y('sb-smoked','Smoked haddock','kg')]}),b({id:'os-tarelgin',name:'Tarelgin',goods:'Butcher',method:'text',frequency:'Text order',items:[y('tg-steak','Ribeye steaks',''),y('tg-mince','Steak mince','kg'),y('tg-chicken','Chicken breasts',''),y('tg-sausage','Sausages','kg')]}),b({id:'os-mills',name:'Mills',goods:'Milk',method:'whatsapp',frequency:'WhatsApp message',items:[y('ml-milk','Milk','litres'),y('ml-cream','Double cream','litres'),y('ml-butter','Butter','kg')]}),b({id:'os-kittyfisher',name:'Kittyfisher boat (Big Sean)',goods:'Lobsters and crabs',method:'text',contact:'Sean',frequency:'Whenever stock is low',shellfish:!0,items:[y('kf-lobster','Lobsters',''),y('kf-crab','Crabs','')],notes:'Text Big Sean whenever the lobster or crab count runs low.'}),b({id:'os-lionsmane',name:'Lion\u2019s mane mushroom',goods:'Lion\u2019s mane mushrooms',method:'online',urlLabel:'Open seller',frequency:'Weekly or fortnightly',priceCapPerKg:2500,seller:'Cheapest UK seller (to be chosen)',items:[y('lm-kg','Lion\u2019s mane mushroom','kg')],notes:'Order online from the cheapest UK seller under the price cap. Check the price per kg before you buy.'})]},1082,[1085]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1083,[1538,1099,812,31,119,257,264,152,128,823,828,829,1539,822,825,1042,818,1540,981,824,936,25]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isAnchorage",{enumerable:!0,get:function(){return r}}),e.isBarFridge=n,Object.defineProperty(e,"chefCanSee",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"demoActor",{enumerable:!0,get:function(){return s}}),e.hasRealSignature=c,Object.defineProperty(e,"PLACEHOLDER_AUTHOR",{enumerable:!0,get:function(){return f}}),e.isPlaceholderCard=u,e.isDemoCard=function(t){return!c(t)&&(['example','sample','demo'].includes(t.origin||'')||s(t.updatedBy)||u(t))},Object.defineProperty(e,"isSeedChefChat",{enumerable:!0,get:function(){return m}});const t='6349aa07-3fec-46e9-8c69-7b1b08494793',r=r=>'anchorage'===r||r===t;function n(t){if('string'==typeof t)return/\bbar[\s_-]*(?:fridge|refrigerat)|\b(?:fridge|refrigerator)[\s_-]*(?:in[\s_-]*the[\s_-]*)?bar\b|^cp-bar$/i.test(t);if(!t||'object'!=typeof t)return!1;const r=t;if(n(['name','label','kind','unit','location','storage','storageLocation'].map(t=>r[t]).filter(t=>'string'==typeof t).join(' ')))return!0;return(['name','label'].some(t=>'string'==typeof r[t]&&''!==r[t].trim())?[]:['id','key','pointId']).concat(['name','label','unit','location','storage','storageLocation','aliases']).some(t=>Array.isArray(r[t])?r[t].some(n):'string'==typeof r[t]&&n(r[t]))}const o=(t,o)=>!r(t)||!n(o),s=t=>'string'==typeof t&&/(?:\b(?:example|sample|demo)\b)/i.test(t);function c(t){return[t.signOff?.by,t.allergensConfirmed?.by].some(t=>!!t&&!s(t))}const f='CoverCharge, for Head Chef sign-off';function u(t){return!c(t)&&(t.updatedBy||'').startsWith('CoverCharge')&&(!t.createdBy||t.createdBy.startsWith('CoverCharge'))}const l={'m-seed-all':'Welcome to the team chat on CoverCharge.','m-seed-kitchen':'Kitchen channel: Head Chef, kitchen team and managers.','m-seed-foh':'Front of house channel: front of house, bar and managers.','m-seed-managers':'Managers channel: owners, managers and the supervisor only.'},m=t=>'system'===t.from&&(!!l[t.id]&&l[t.id]===t.text||'m-seed-all'===t.id&&/this phone only/.test(t.text||''))},1084,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KG_PER_STONE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"HALF_STONE_KG",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isFishName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fishInStone",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"halfStone",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toStone",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"fromStone",{enumerable:!0,get:function(){return c}}),e.stoneText=b,e.stoneSpeech=h,Object.defineProperty(e,"fishQtyText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"fishQtySpeech",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantityStep",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"stepQuantity",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"inputQuantity",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"quantityUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"displayedCost",{enumerable:!0,get:function(){return k}}),e.parseStoneAmount=function(t){if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.toLowerCase().trim();if(/\b(?:kg|kilos?|kilograms?|grams?)\b/.test(n))return;const i=n.match(/(?:^|\s)(\d+(?:[.,]\d+)?)(\xbd)?(?:\s*(?:stone|st)\b|$)/);if(i)return Number(i[1].replace(',','.'))+(i[2]?.5:0);const o=n.match(/\b(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)(?: and a half)?(?: stone| st|$)/);return o?l.indexOf(o[1])+(/and a half/.test(o[0])?.5:0):/(?:^|\s)(?:\xbd|(?:a )?half(?: a)?)(?: stone| st|$)/.test(n)?.5:void 0};var t=r(d[0]);const n=6.35029318,i=3.17514659,o=(t="")=>!/\b(?:vegan|vegetarian|banana|blossom|mushroom|sauce|stock|oil)\b|\(vg\)/i.test(t)&&/\b(?:fish|haddock|salmon|cod|hake|halibut|plaice|sole|turbot|trout|mackerel|monkfish|seabass|sea bass|seabream|sea bream|tuna|pollock|coley|whiting|sardines?|anchov(?:y|ies)|herring)\b/i.test(t),u=(n,i)=>(0,t.isAnchorage)(n)&&/^(kg|kilos?|kilograms?|st|stone)$/i.test(i.unit||'')&&o(i.name),s=t=>Math.round(2*(t+Number.EPSILON))/2,f=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t/n,c=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t*n;function b(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'\u2212':''}${n%1?`${i||''}\xbd`:i} stone`}const l=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'];function h(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'minus ':''}${n%1?i?`${l[i]||i} and a half`:'half a':l[i]||i} stone`}const y=(t,n,i)=>u(t,n)?b(f(i,n.unit)):`${i} ${n.unit||''}`.trim(),p=(t,n,i)=>u(t,n)?h(f(i,n.unit)):y(t,n,i),O=(t,n)=>u(t,n)?c(.5,n.unit):'kg'===n.unit?.5:1,v=(t,n,i,o)=>u(t,n)?c(Math.max(0,s(f(i,n.unit))+.5*o),n.unit):Math.max(0,i+o*O(t,n)),P=(t,n,i)=>u(t,n)?c(s(i),n.unit):i,j=(t,n)=>u(t,n)?'stone':n.unit||'',k=(t,n,i)=>u(t,n)?i*c(1,n.unit):i},1085,[1084]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShellStore",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"localShellfish",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"shellfish",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"useStockItems",{enumerable:!0,get:function(){return O}}),_e.venueCounts=w,_e.useShellfish=function(e,t,s,o){const a=O(e,!1,o).filter(t=>'chef'!==s||(0,n.chefCanSee)(e,t)),d=_(t=>!!t.server[e]),u=_((0,l.useShallow)(t=>{const s=t.items[e]??[],n=new Set(s.filter(e=>o?e.group!==o:!!e.group).map(e=>e.key));return t.events.filter(s=>s.rid===e&&(!t.server[e]||I(s))&&!n.has(s.kind))})),c=_((0,l.useShallow)(t=>w(t,e))),p=(0,f.lastUndoable)(u),v=e=>a.find(t=>t.key===e);return{items:a,events:u,counts:c,undoable:p,synced:d,itemOf:v,isLow:e=>(0,f.isLowItem)(v(e),c[e]??0),sell:(n,o=!1)=>{const a=v(n),d=a&&(0,i.fishInStone)(e,a)?i.HALF_STONE_KG:o?.5:1;return!((c[n]??0){i>0&&E.append({rid:e,kind:n,delta:i,reason:'delivery',by:t,app:s})},recount:(n,i)=>{const o=i-(c[n]??0);o&&E.append({rid:e,kind:n,delta:o,reason:'count',by:t,app:s})},undoLast:()=>{p&&E.append({rid:e,kind:p.kind,delta:-p.delta,reason:'undo',by:t,app:s,undoes:p.id})}}};var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),i=r(_d[3]),o=r(_d[4]),a=r(_d[5]),d=(e=a)&&e.__esModule?e:{default:e};r(_d[6]);var u=r(_d[7]),c=r(_d[8]),l=r(_d[9]),f=r(_d[10]),p=r(_d[11]),v=r(_d[12]);const S=()=>{try{return(0,v.nowFrom)(v.useStore.getState().clock)}catch{return new Date}},h='covercharge-shellfish-v1',y='anchorage',_=(0,u.create)()((0,c.persist)(e=>({events:[],items:o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))},server:{},saveItem:(t,s)=>e(e=>{const n=e.items[t]??[];return{items:{...e.items,[t]:n.some(e=>e.key===s.key)?n.map(e=>e.key===s.key?s:e):[...n,s]}}}),removeItem:(t,s)=>e(e=>({items:{...e.items,[t]:(e.items[t]??[]).filter(e=>e.key!==s)}}))}),{name:h,storage:(0,c.createJSONStorage)(()=>d.default),version:4,partialize:e=>({events:e.events,items:e.items,server:e.server}),migrate:async e=>{t.LIVE_VENUE_BUILD&&e&&await(0,s.archiveChefCache)('tracked-stock',e);const n=e??{};return{events:(i=n.events,(i??[]).filter(e=>!e.id.startsWith('sf-seed-'))),items:n.items??(o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))}),server:n.server??{}};var i}})),b={list:e=>_.getState().events.filter(t=>t.rid===e),append:e=>{const t={...e,id:(0,p.uuid)(),at:e.at??S().toISOString()};return _.setState(e=>({events:[t,...e.events].slice(0,500)})),t},subscribe:e=>_.subscribe(e)},E=b;'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===h&&_.persist.rehydrate()});const k=[],O=(e,t=!1,s)=>{const n=_(t=>t.items[e])??k;return t?n:n.filter(e=>e.active&&(s?e.group===s:!e.group)).sort((e,t)=>e.sort-t.sort)},I=e=>!e.id.startsWith('sf-');function w(e,t){const s=e.items[t]??[],n=e.server[t],i=e.events.filter(e=>e.rid===t);if(!n)return(0,f.countsOf)(i,s);const o=new Set(n.seen),a=new Date(Date.now()-2592e5).toISOString();return(0,f.countsOf)(i.filter(e=>I(e)&&!o.has(e.id)&&e.at>=a),s,n.counts)}},1086,[842,1198,1084,1085,5,1190,123,995,1191,884,1088,1099,881]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOrderSheets",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useSheets",{enumerable:!0,get:function(){return f}});var e,s=r(d[0]),t=r(d[1]),h=r(d[2]),n=r(d[3]),o=(e=n)&&e.__esModule?e:{default:e},c=r(d[4]),i=r(d[5]),u=r(d[6]);const p=()=>h.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{}:{anchorage:u.ANCHORAGE_SHEETS.filter(e=>!e.placeholder).map(e=>({...e,items:e.items.map(e=>({...e}))}))},l=(0,c.create)()((0,i.persist)(e=>({sheets:p(),opened:{},upsert:(s,t)=>e(e=>{const h=e.sheets[s]??[];return{sheets:{...e.sheets,[s]:h.some(e=>e.id===t.id)?h.map(e=>e.id===t.id?t:e):[...h,t]}}}),patch:(s,t,h)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).map(e=>e.id===t?{...e,...h}:e)}})),remove:(s,t)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).filter(e=>e.id!==t)}})),markOpened:(s,t)=>e(e=>({opened:{...e.opened,[s]:t}})),reset:s=>e(e=>({sheets:{...e.sheets,[s]:'anchorage'===s&&p().anchorage||[]}}))}),{name:'covercharge-ordersheets-v1',storage:(0,i.createJSONStorage)(()=>o.default),version:3,migrate:async e=>{const h=e;return s.LIVE_VENUE_BUILD?(await(0,t.archiveChefCache)('order-sheets',h),{...h,sheets:{...h.sheets,anchorage:(h.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}}):h}})),_=[],f=e=>l(s=>s.sheets[e])??_},1087,[842,1198,5,1190,995,1191,1082]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANCHORAGE_STOCK",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"stockKey",{enumerable:!0,get:function(){return n}}),_e.countsOf=function(e,t=[],n={}){const u={...n};for(const e of t)u[e.key]=u[e.key]??0;for(const t of e)u[t.kind]=(u[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(u).map(([e,t])=>[e,o(i.get(e),t)]))},_e.lastUndoable=function(e){const t=new Set(e.filter(e=>e.undoes).map(e=>e.undoes));return e.find(e=>'undo'!==e.reason&&'count'!==e.reason&&!t.has(e.id))},Object.defineProperty(_e,"fmtCount",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isLowItem",{enumerable:!0,get:function(){return c}}),_e.describe=function(e,t){const n=(t?.name??e.kind).toLowerCase(),o=(t?.plural??`${e.kind}s`).toLowerCase(),s=t?i(e.rid,t,Math.abs(e.delta)):u(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${s} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${s} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${s} ${n})`:`Count: ${s} ${o}`},Object.defineProperty(_e,"isRoastItem",{enumerable:!0,get:function(){return l}}),_e.isSundayIn=function(e,t="Europe/London"){try{return'Sun'===new Intl.DateTimeFormat('en-GB',{weekday:'short',timeZone:t}).format(e)}catch{return 0===e.getDay()}};var e=r(_d[0]);const t=[{key:'lobster',name:'Lobster',plural:'Lobsters',unit:'half',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd9e',sort:1,active:!0},{key:'crab',name:'Crab',plural:'Crabs',unit:'whole',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd80',sort:2,active:!0}],n=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,40)||'item',o=(e,t)=>Math.max(0,'kg'===e?.unit?t:'half'===e?.unit?Math.round(2*t)/2:Math.round(t));const u=e=>{const t=Math.floor(e);return e-t>=.5?t?`${t}\xbd`:'\xbd':String(t)},i=(t,n,o)=>'kg'===n.unit?(0,e.fishQtyText)(t,n,o):u(o),s=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):u(o),c=(e,t)=>t<=(e?.lowAt??4);const l=e=>'roast'===e.group},1088,[1085]); +__d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.useGameClock=I,_e.usePlayable=function(e,t){return(0,y.gamePlayable)(I(e,t))},Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return C}}),_e.gameBase=function(){const e=b.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return C(e?.settings?.gameUrl)??v},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,b.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=I(e,s),u=(0,y.gamePlayable)(c);return n?(0,w.jsxs)(d.Card,{children:[(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(d.T,{size:13,colour:u?x.colours.ok:x.colours.muted,children:u?'Open':'Locked'})]}),(0,w.jsx)(d.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),u?null:(0,w.jsx)(d.Muted,{testID:"break-room-locked-text",children:y.GAME_LOCKED_TEXT}),(0,w.jsx)(d.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,w.jsx)(R,{staffId:e,name:t,playable:u,clock:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return T}}),_e.BreakRoom=R;var t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),n=e(r),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),c=e(_r(_d[6])),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),m=_r(_d[10]),y=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),p=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]),x=_r(_d[17]),w=_r(_d[18]);function I(e,t){const s=(0,m.useOwner)(e=>e.attendance);return(0,y.gameClock)(s,e,t)}const v='https://lennys-kitchen-chaos-13e285.deed.page/',C=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function S(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const T=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:I,playable:R,clock:P,onClose:L,car:M}){const D=(0,m.useOwner)(e=>e.staff),O=(0,f.useAvatars)(e=>e.photos),_=(0,h.useSetup)(e=>e.looks),z=(0,r.useRef)(null),[N,U]=(0,r.useState)({}),[A,B]=(0,r.useState)(!1),[G,q]=(0,r.useState)(null),H=(0,b.useStore)(e=>C(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??v),V=(0,r.useMemo)(()=>S(H),[H]),W=V?.origin??'',$=(0,j.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),K=!(!$||!e||$===e),X=K?null:$??e??null,Y=T(I),[F,J]=(0,r.useState)(''),[Q,Z]=(0,r.useState)(null),ee=(0,r.useRef)(null),te=(0,r.useRef)(0),se=(0,r.useRef)(null),re=(0,r.useRef)(R);re.current=R;const ne=(0,r.useMemo)(()=>D.filter(e=>e.active&&!e.name.includes('(example)')),[D]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const s of ne){const r=null!=_[s.id]&&_[s.id]>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===_[s.id]):void 0;if(r){e[s.id]=r.dataUrl;continue}const n=document.getElementById(`cc-av-${s.id}`)?.querySelector('svg');n&&(e[s.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n.outerHTML.includes('xmlns')?n.outerHTML:n.outerHTML.replace('clearTimeout(e)},[ne,_]);const oe=(0,r.useMemo)(()=>ne.map(e=>{const t=O[e.id]?.dataUrl??N[e.id],s={id:e.id,name:T(e.name),role:e.job||e.level||e.role};return t&&(s.avatarUrl=t),s}),[ne,O,N]),le=(0,r.useCallback)(e=>{try{W&&z.current?.contentWindow?.postMessage(e,W)}catch{}},[W]);return(0,r.useEffect)(()=>{const e=async e=>{if(!W||e.origin!==W||e.source!==z.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return q('string'==typeof t.version?String(t.version).slice(0,12):null),void B(!0);const s=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.listScores)(s,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!X||'string'==typeof e.staffId&&e.staffId!==X)return void le({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,k.listScores)(s,10),id:null}});const r='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;le({type:'lenny:scores:result',reqId:t.reqId,result:await(0,k.submitScore)(s,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:r,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:X,name:Y})})}'lenny:roundAbandoned'===t.type&&J('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&J(''),'lenny:progress'===t.type&&X&&t.staffId===X&&(0,k.saveProgress)(X,t.progress),'lenny:gameComplete'===t.type&&X&&t.staffId===X&&J(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[le,X,Y,W]),(0,r.useEffect)(()=>{B(!1),ee.current=null,se.current=null},[V?.src]),(0,r.useEffect)(()=>{if(!A)return;const e=e=>{se.current!==e&&(se.current=e,le({type:'lenny:setPlayable',playable:e}))},t=K?null:`${X??''}|${Y}`;if(t&&ee.current===t)return void e(R);const s=++te.current;ee.current=null,se.current&&e(!1),t&&(0,k.loadProgress)(X).catch(()=>null).then(r=>{s===te.current&&(le({type:'lenny:setPlayer',name:Y,staffId:X,...r?{progress:r}:{}}),ee.current=t,e(re.current))})},[A,K,X,Y,R,le]),(0,r.useEffect)(()=>{A&&le({type:'lenny:setRoster',staff:oe})},[A,oe,le]),(0,r.useEffect)(()=>{A&&null!==Q&&le({type:'lenny:setMuted',muted:Q})},[A,Q,le]),(0,w.jsx)(o.default,{visible:!0,animationType:"slide",onRequestClose:L,children:(0,w.jsxs)(c.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,s.soutersSurface)('#000')},children:[M?(0,w.jsx)(E,{status:K?'Switching player\u2026':R?'Parked only \xb7 enjoy!':'Game locked',muted:!!Q,onPause:()=>le({type:'lenny:pause'}),onMute:()=>Z(!Q),onClose:L}):(0,w.jsxs)(d.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:x.colours.bg},children:[(0,w.jsx)(d.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,w.jsx)(c.default,{testID:R&&!K?'break-playable':'break-locked',accessibilityLabel:G?`Game version ${G}`:void 0,children:(0,w.jsx)(d.T,{size:13,colour:R?x.colours.ok:x.colours.gold,children:K?'Switching player\u2026':R?'off'===P?'Off shift: enjoy!':'On your break: enjoy!':'Game locked'})}),(0,w.jsxs)(d.Row,{gap:4,children:[(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:Q?'Turn sound and voice on':'Mute sound and voice',onPress:()=>Z(!Q),style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:Q?'Sound on':'Mute'})}),(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",onPress:L,style:{padding:6},children:(0,w.jsx)(d.T,{weight:"semibold",colour:x.colours.gold,children:"Close"})})]})]}),R||K?null:(0,w.jsx)(c.default,{testID:"break-locked-text",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.text,children:y.GAME_LOCKED_TEXT})}),F?(0,w.jsx)(c.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:x.colours.surface},children:(0,w.jsx)(d.T,{size:13,colour:x.colours.muted,children:F})}):null,V?n.default.createElement('iframe',{ref:z,src:V.src,key:V.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,w.jsx)(c.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(d.Muted,{children:"The Break room opens in the web app."})}),(0,w.jsx)(c.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:ne.map(e=>(0,w.jsx)(c.default,{nativeID:`cc-av-${e.id}`,children:(0,w.jsx)(u.AvatarLook,{look:_[e.id],id:e.id,name:e.name,size:96})},e.id))})]})})}function E({status:e,muted:t,onPause:s,onMute:r,onClose:n}){const o={minHeight:72,minWidth:150,paddingHorizontal:22,borderRadius:18,borderWidth:1.5,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'};return(0,w.jsxs)(c.default,{testID:"car-game-bar",style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:16,paddingVertical:10,backgroundColor:x.colours.bg,borderBottomWidth:1,borderColor:x.colours.border},children:[(0,w.jsx)(l.default,{testID:"break-room-close",accessibilityRole:"button",accessibilityLabel:"Close the game",onPress:n,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Close"})}),(0,w.jsx)(l.default,{testID:"car-game-pause",accessibilityRole:"button",accessibilityLabel:"Pause the game",onPress:s,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:"Pause"})}),(0,w.jsxs)(c.default,{style:{flex:1,alignItems:'center',minWidth:0},children:[(0,w.jsx)(d.T,{size:22,weight:"semibold",center:!0,numberOfLines:1,children:"Lenny\u2019s Kitchen Chaos"}),(0,w.jsx)(d.T,{size:15,colour:x.colours.goldLight,center:!0,numberOfLines:1,children:`${e} \xb7 touch the big buttons on the game`})]}),(0,w.jsx)(l.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:t?'Turn sound and voice on':'Mute sound and voice',onPress:r,style:o,children:(0,w.jsx)(d.T,{size:20,weight:"semibold",colour:x.colours.gold,children:t?'Sound on':'Mute'})}),(0,w.jsx)(c.default,{testID:"car-game-parked",style:{...o,minWidth:0,borderColor:x.colours.goldMuted,backgroundColor:'rgba(201,162,74,0.12)'},children:(0,w.jsx)(d.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:"PARKED ONLY"})})]})}},1089,[1384,876,31,257,123,264,128,996,818,1225,863,1451,1096,881,5,1452,824,825,25]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hash",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return r}}),_e.revenueHistory=function(e,t,r=28){const s=[];if(!(0,a.examplesAllowed)())return s;for(let a=r;a>=1;a--){const r=(0,o.addMins)(t,1440*-a),i=!!e.kitchenHours[r.getDay()],d=[1.05,0,0,.6,.7,1,1.2][r.getDay()]*('anchorage'===e.id?1:.6),l=t=>.85+.3*n((0,o.ymd)(r)+t+e.id),u=i?Math.round(24e4*d*l('d')):0,c=i?Math.round(95e3*d*l('t')):0,p=i?Math.round(52e3*d*l('q')):0;s.push({date:r,label:(0,o.niceDate)(r).slice(0,6),byChannel:{'Dine-in':u,Takeaway:c,'Table QR':p},total:u+c+p,covers:i?Math.round(150*d*l('c')):0})}return s},_e.dishStats=function(e){return(0,a.examplesAllowed)()?e.filter(e=>null!=e.price).map(e=>{const t=Math.round(20+260*n(e.id+'s')),o=.24+.22*n(e.id+'c'),a=e.price??0,r=Math.round(a*(1-o));return{item:e,sold:t,revenue:t*a,costPct:o,margin:r,gp:r*t}}):[]},_e.quadrant=function(e,t,o,a){return e>=o?t>=a?'Star':'Plough horse':t>=a?'Puzzle':'Dog'},Object.defineProperty(_e,"QUADRANT_TIP",{enumerable:!0,get:function(){return s}}),_e.crmCustomers=function(){return(0,a.examplesAllowed)()?i.map((e,t)=>{const o=n(e+t);return{id:0===t?'cust-demo':`cr-${t}`,name:`${e} ${d[t]}${0===t?'':' (example)'}`,phone:`07700 900${String(100+7*t).slice(-3)}`,visits:1+Math.round(18*o),lastVisit:`${1+Math.round(27*o)} days ago`,spend:Math.round(3e3+6e4*o),allergies:0===t?['Crustaceans (anaphylaxis)','Mustard']:o>.8?['Gluten (coeliac)']:o<.1?['Peanuts']:[],stamps:0===t?5:Math.round(7*o),optIn:o>.25,channel:r[Math.floor(3*o)%3],birthday:o>.6?`${1+Math.round(27*o)} Nov`:void 0}}):[]},Object.defineProperty(_e,"STOCK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"stockList",{enumerable:!0,get:function(){return u}}),_e.insights=function(e,n,r,s,i,d,u){const p=[];if(!(0,a.examplesAllowed)())return c(e,n,r,s,i,d,u);const h=new Date(d);h.setDate(h.getDate()+((6-h.getDay()+7)%7||7)),h.setHours(0,0,0,0);const b=(0,t.forecastToday)(e,n,r,s,h),m=Math.round(b.restOfDay.covers/Math.max(1,b.multiplier)),y=Math.max(35,Math.round(100*(b.multiplier-1))+35);p.push({id:'sat',icon:'\ud83d\udcc8',tone:'gold',title:`${(0,o.niceDate)(h)} forecast +${y}%: add 1 server 6\u20139pm`,body:`Example: about ${Math.round(m*(1+y/100))} covers expected vs about ${m} on a usual Saturday (bookings pace + Halloween weekend flag).`,action:{label:'Open rota',tab:'more',sub:'rota'}});const f=(0,t.forecastToday)(e,n,r,s,d),v=l[0],w=Math.ceil((f.restOfDay.covers+2*f.restOfDay.takeaway)*v.perCover);p.push({id:'haddock',icon:'\ud83d\udc1f',tone:'red',title:`Haddock low: ${v.onHand} portions left`,body:`Tonight\u2019s forecast needs about ${w}. Call the supplier before 18:00 or mark the fish supper sold out at ${v.onHand} sold.`,action:{label:'Prep list',tab:'more',sub:'prep'}});const k=s.find(e=>/Burns/.test(e.title));if(k){const e=Math.max(1,Math.round((new Date(k.date).getTime()-d.getTime())/6048e5));p.push({id:'burns',icon:'\ud83e\udd43',tone:'blue',title:`Burns Night in ${e} weeks: open bookings?`,body:'Last year\u2019s equivalent nights sold out about 3 weeks ahead (example). Publish the set menu and push to opted-in regulars.',action:{label:'Plan campaign',tab:'more',sub:'marketing'}})}const M=n.filter(e=>e.date===(0,o.venueYmd)(d)&&'noshow'===e.status).length;p.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:M?`${M} no-show today: deposits for 6+?`:'Deposits for bigger tables (example)',body:'Deposits are set per venue in Settings \u203a Advanced \u203a Deposits. Consider them on Fri/Sat after 19:00.',action:{label:'Bookings',tab:'bookings'}});const C=i.filter(e=>e.stars<=2).length;C&&p.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${C} low rating this week: cold chips at collection`,body:'Readiness alerts now time bagging 5 min before pickup. Reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});return p.push({id:'commission',icon:'\ud83d\udcb7',tone:'ok',title:'You kept about \xa31,240 in commission this month',body:'Example: \xa34,140 of direct takeaway orders that would have cost about 30% on delivery apps.',action:{label:'Analytics',tab:'more',sub:'analytics'}}),p.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${u} covers so far today`,body:'Lobster special is the top add-on tonight. Suggest it with the scallops (example).'}),p};var e=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]);const n=e=>{let t=2166136261;for(let o=0;o>>0)/4294967295},r=['Dine-in','Takeaway','Table QR'];const s={Star:'Keep: high margin and popular. Feature it.','Plough horse':'Popular, low margin: nudge the price or trim the cost.',Puzzle:'High margin, few sales: promote it or rename it.',Dog:'Low margin, few sales: consider removing it.'},i=['Alex','Fiona','Iain','Morag','Callum','Eilidh','Ross','Kirsty','Euan','Shona','Hamish','Isla','Craig','Ailsa','Neil','Catriona'],d=['Morgan','Campbell','Fraser','McLeod','Kerr','Wallace','Boyd','Hamilton','Stewart','Murray','Paterson','Duncan','Gilmour','Reid','Ross','Grant'];const l=[{cat:'Fish & seafood',id:'haddock',name:'Haddock fillets',unit:'portions',onHand:8,perCover:.22,par:40},{cat:'Fruit & veg',id:'chips',name:'Chipping potatoes',unit:'kg',onHand:25,perCover:.18,par:40},{cat:'Fish & seafood',id:'langoustine',name:'Langoustines',unit:'kg',onHand:4,perCover:.03,par:6},{cat:'Fish & seafood',id:'mussels',name:'Mussels',unit:'kg',onHand:10,perCover:.05,par:12},{cat:'Fish & seafood',id:'scallops',name:'Scallops',unit:'portions',onHand:14,perCover:.06,par:20},{cat:'Meat',id:'beef',name:'Burger patties',unit:'each',onHand:30,perCover:.1,par:40},{cat:'Fruit & veg',id:'peas',name:'Garden peas',unit:'kg',onHand:6,perCover:.04,par:8},{cat:'Dairy',id:'tartare',name:'House tartare sauce',unit:'tubs',onHand:5,perCover:.05,par:10}],u=()=>(0,a.examplesAllowed)()?l:[];function c(a,n,r,s,i,d,l){const u=[],c=(0,t.forecastToday)(a,n,r,s,d);c.enough||u.push({id:'history',icon:'\ud83d\udcc5',tone:'gold',title:'Not enough history yet',body:c.suggestions[0]?.replace(/^Not enough history yet\. /,'')??'',action:{label:'Settings \u203a Advanced',tab:'more',sub:'advanced'}});const p=(0,o.ymd)(d),h=n.filter(e=>e.date===p&&'noshow'===e.status).length;h&&u.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:`${h} no-show${1===h?'':'s'} today`,body:'Think about a deposit for larger parties (Settings \u203a Advanced \u203a Deposits).',action:{label:'Bookings',tab:'bookings'}});const b=i.filter(e=>e.stars<=2).length;b&&u.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${b} low rating${1===b?'':'s'} to read`,body:'Read what they said, reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});const m=s.filter(e=>e.date>=p).sort((e,t)=>e.date.localeCompare(t.date))[0];return m&&u.push({id:'event',icon:'\ud83d\udcc5',tone:'blue',title:`Coming up: ${m.title}`,body:`${(0,o.niceDate)(new Date(m.date+'T12:00:00'))}. Check your rota and think about a promo.`,action:{label:'Forecast',tab:'forecast'}}),u.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${l} covers so far today`,body:`Seated bookings and walk-ins recorded in CoverCharge today. ${(0,e.laterTodayLine)((0,e.laterTodayCovers)(n,p))}`}),u}},1090,[832,879,822,1218]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useExamples",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const l=()=>(0,t.useSyncExternalStore)(n.onDataModeChange,n.examplesAllowed,n.examplesAllowed)},1091,[31,1218]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useRealHistory=function(e,t){const o=(0,c.useExamples)(),n=(0,r.useBookings)(e),l=(0,r.useOrders)(e),f=(0,u.useCashUp)(e=>e.cashUps),y=(0,k.clampWeeks)((0,h.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings.forecastMinWeeks)),b=t.toDateString();return(0,s.useMemo)(()=>o?null:(0,k.buildHistory)(e,n,l,f.map(e=>({rid:e.rid,date:e.date,takings:(0,p.takings)(e.vals)})),t,y),[o,e,n,l,f,y,b])},Object.defineProperty(_e,"ExampleBadge",{enumerable:!0,get:function(){return b}}),_e.NotEnoughHistory=function({weeks:e,booked:s,what:t="Forecasts",testID:r="not-enough-history"}){return(0,y.jsx)(n.Card,{children:(0,y.jsxs)(o.default,{testID:r,style:{gap:6},children:[(0,y.jsx)(n.T,{weight:"semibold",colour:f.colours.gold,children:"Not enough history yet"}),(0,y.jsx)(n.Muted,{children:'Forecasts'===t?(0,l.notEnoughTip)(e):`${t} start once CoverCharge has ${1===e?'1 week':`${e} weeks`} of your bookings and cash-ups.`}),s?(0,y.jsx)(o.default,{testID:`${r}-booked`,children:(0,y.jsxs)(n.T,{children:["Booked so far: ",s," Covers"]})}):null,(0,y.jsx)(n.Muted,{children:"Tip: upload or add your bookings and do the cash up each night. Managers can change how much history is needed in Settings \u203a Advanced."})]})})};var e,s=_r(d[0]),t=_r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=_r(d[2]),r=_r(d[3]),u=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),p=_r(d[8]),k=_r(d[9]),f=_r(d[10]),y=_r(d[11]);const b=()=>(0,y.jsx)(n.Badge,{kind:"amber",label:l.EXAMPLE_LABEL.toUpperCase()})},1092,[31,128,818,823,1048,1218,1091,881,13,1093,825,25]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_MIN_WEEKS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"clampWeeks",{enumerable:!0,get:function(){return o}}),e.buildHistory=function(o,a,c,u,d,f=n){const l=(0,t.ymd)(d),y=(0,t.ymd)(new Date(d.getTime()-48384e5)),h=t=>t>=y&&tt.rid===o&&h(t.date));for(const t of k)D.add(t.date);const T=[...D].sort(),w=T.length?s(T[0],l):0,j=w>=7*f&&T.length>=2*f,O=t=>{const n={},o={};for(const t of T){const n=new Date(t+'T12:00:00').getDay();o[n]=(o[n]??0)+1}for(const[o,s]of Object.entries(t)){const t=new Date(o+'T12:00:00').getDay();n[t]??={};for(const[o,a]of Object.entries(s))n[t][Number(o)]=(n[t][Number(o)]??0)+a}for(const t of Object.keys(n))for(const s of Object.keys(n[+t]))n[+t][+s]=n[+t][+s]/(o[+t]||1);return n},M=Array.from({length:7},()=>[]);for(const t of k)'number'==typeof t.takings&&t.takings>0&&M[new Date(t.date+'T12:00:00').getDay()].push(Math.round(100*t.takings));const N=M.map(t=>t.length?Math.round(t.reduce((t,n)=>t+n,0)/t.length):null),_=k.filter(t=>'number'==typeof t.takings&&t.takings>0),E=(_.length?s(_.map(t=>t.date).sort()[0],l):0)>=7*f&&_.length>=2*f;return{covers:O(b),takeaway:O(p),days:T.length,spanDays:w,enough:j,minWeeks:f,takingsByDay:N,cashUps:_.length,salesEnough:E}};var t=r(_d[0]);const n=2,o=t=>{const o=Math.round(Number(t));return Number.isFinite(o)&&o>=1&&o<=8?o:n},s=(t,n)=>Math.round((new Date(n+'T12:00:00').getTime()-new Date(t+'T12:00:00').getTime())/864e5)},1093,[822]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:i=26,colour:r=d.colours.text}){const n=(0,l.useRef)(new o.default.Value(0)).current,[a,c]=(0,l.useState)(0);return(0,l.useEffect)(()=>{const t=n.addListener(({value:e})=>c(e));return o.default.timing(n,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>n.removeListener(t)},[e]),(0,x.jsx)(u.T,{size:i,weight:"bold",colour:r,children:t(a)})},_e.FadeIn=function({children:e,delay:t=0,style:i}){const r=(0,l.useRef)(new o.default.Value(0)).current;return(0,l.useEffect)(()=>{o.default.timing(r,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,x.jsx)(o.default.View,{style:[{opacity:r,transform:[{translateY:r.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},i],children:e})},_e.Gauge=function({pct:e,label:t,sub:r,size:c=220}){const h=(0,l.useRef)(new o.default.Value(0)).current,[f,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{const t=h.addListener(({value:e})=>y(e));return o.default.timing(h,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>h.removeListener(t)},[e]);const p=c,v=.62*c,j=p/2,b=v-8,k=p/2-16,M=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),S=(e,t=k)=>[j+t*Math.cos(M(e)),b-t*Math.sin(M(e))],w=(e,t)=>{const[l,o]=S(e),[s,i]=S(t);return`M ${l} ${o} A ${k} ${k} 0 0 1 ${s} ${i}`},$=[[0,.5,d.colours.muted],[.5,1,d.colours.gold],[1,1.2,d.colours.amber]],[A,L]=S(f,k-18);return(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:`${t}. ${r??''}`,style:{alignItems:'center'},children:[(0,x.jsxs)(a.default,{accessible:!1,width:p,height:v,children:[(0,x.jsx)(n.Path,{d:w(0,1.2),stroke:d.colours.surface2,strokeWidth:18,fill:"none"}),$.map(([e,t,l])=>(0,x.jsx)(n.Path,{d:w(e+.005,t-.005),stroke:l,strokeOpacity:.85,strokeWidth:14,fill:"none"},l)),(0,x.jsx)(n.Line,{x1:j,y1:b,x2:A,y2:L,stroke:d.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,x.jsx)(n.Circle,{cx:j,cy:b,r:8,fill:d.colours.gold})]}),(0,x.jsx)(u.T,{size:22,weight:"bold",colour:d.colours.gold,style:{marginTop:-4},children:t}),r?(0,x.jsx)(u.T,{size:13,colour:d.colours.muted,center:!0,children:r}):null]})},_e.LineChart=function({series:e,labels:l,width:o,height:s=140,colours:i=[d.colours.gold,d.colours.blue]}){const r=Math.max(1,...e.flat()),u=Math.max(1,l.length-1),c=e=>8+e/u*(o-16),h=e=>s-18-e/r*(s-30);return(0,x.jsxs)(a.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,x.jsx)(n.Line,{x1:8,x2:o-8,y1:h(r*e),y2:h(r*e),stroke:d.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,x.jsx)(n.Polyline,{points:e.map((e,t)=>`${c(t)},${h(e)}`).join(' '),fill:"none",stroke:i[t],strokeWidth:2.5},t)),l.map((e,o)=>o%Math.ceil(l.length/7)===0?(0,x.jsx)(n.Text,{x:c(o),y:s-8,fill:d.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:l=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),i=l/2-12,r=2*Math.PI*i;let u=0;return(0,x.jsxs)(a.default,{width:l,height:l,children:[(0,x.jsx)(n.G,{rotation:-90,origin:`${l/2}, ${l/2}`,children:e.map((e,t)=>{const o=e.value/s*r,a=(0,x.jsx)(n.Circle,{cx:l/2,cy:l/2,r:i,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${r-o}`,strokeDashoffset:-u},t);return u+=o,a})}),o?(0,x.jsx)(n.Text,{x:l/2,y:l/2+5,fill:d.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:l,height:o=240,xMid:s,yMid:i}){const r=1.08*Math.max(1,...e.map(e=>e.x)),u=1.08*Math.max(1,...e.map(e=>e.y)),c=e=>10+e/r*(l-20),h=e=>o-10-e/u*(o-20);return(0,x.jsxs)(a.default,{width:l,height:o,children:[(0,x.jsx)(n.Rect,{x:0,y:0,width:l,height:o,fill:d.colours.surface2,rx:10}),(0,x.jsx)(n.Line,{x1:c(s),x2:c(s),y1:6,y2:o-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Line,{y1:h(i),y2:h(i),x1:6,x2:l-6,stroke:d.colours.border,strokeDasharray:"4 4"}),(0,x.jsx)(n.Text,{x:l-12,y:18,fill:d.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,x.jsx)(n.Text,{x:14,y:18,fill:d.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,x.jsx)(n.Text,{x:l-12,y:o-14,fill:d.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,x.jsx)(n.Text,{x:14,y:o-14,fill:d.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:c(e.x),cy:h(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})},_e.DaysLineGraph=function({days:e,height:o=150,titleSpoken:s}){const[f,y]=(0,l.useState)(0),p=Math.max(48,o-h.AXIS_BAND),v=Math.max(10,f-28-8),j=Math.max(10,p-16-6),b=Math.max(1,...e.map(e=>e.value)),k=t=>28+(e.length<=1?v/2:t/Math.max(1,e.length-1)*v),M=e=>16+j-e/(1.15*b)*j,S=e.map((e,t)=>`${t?'L':'M'}${k(t).toFixed(1)},${M(e.value).toFixed(1)}`).join(' '),{fontScale:w}=(0,r.default)(),[$,A]=(0,l.useState)(0),L=$>0?$/Math.max(1,(0,h.dayLabelWidth)('Wed')-4):0,D=Math.max((w||1)*((0,t.soutersFont)(h.AXIS_FONT)/h.AXIS_FONT),L,1),T=f?(0,h.daysAxis)(f,e.map(e=>e.label),D):[],F=`${s}. ${e.map(e=>e.open?`${e.spoken} ${e.value}`:`${e.spoken} closed`).join('. ')}.`,z=e.reduce((e,t,l)=>!t.open||t.value<=0?e:!e||t.value>e.value?{i:l,value:t.value,spoken:t.spoken}:e,null);let I=null;if(f&&z){const e=`Busiest ${z.spoken}, ${z.value} ${1===z.value?'Cover':'Covers'}`,t=(0,h.labelWidth)(e,13);if(t<=f){const l=k(z.i)-t/2,o={x:Math.max(0,Math.min(f-t,l)),y:1,w:t,h:16,text:e};l>=-2&&l+t<=f+2&&M(z.value)>=o.y+o.h+6&&(I=o)}}return(0,x.jsxs)(i.default,{testID:"forecast-days-graph",style:{overflow:'visible'},children:[(0,x.jsxs)(i.default,{accessible:!0,accessibilityLabel:F,onLayout:e=>y(e.nativeEvent.layout.width),style:{height:p,minHeight:p,overflow:'visible'},children:[f?(0,x.jsxs)(a.default,{width:f,height:p,children:[S?(0,x.jsx)(n.Path,{d:S,stroke:d.colours.gold,strokeWidth:2.5,fill:"none"}):null,e.map((e,t)=>(0,x.jsx)(n.Circle,{cx:k(t),cy:M(e.value),r:3,fill:d.colours.gold},e.key))]}):null,I?(0,x.jsx)(u.T,{size:13,colour:d.colours.gold,numberOfLines:1,style:{position:'absolute',left:I.x,width:I.w,top:I.y,lineHeight:I.h,textAlign:'center'},children:I.text}):null]}),(0,x.jsxs)(i.default,{testID:"forecast-days-axis",style:{height:h.AXIS_BAND,minHeight:h.AXIS_BAND,position:'relative',overflow:'visible'},children:[(0,x.jsx)(i.default,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{position:'absolute',left:0,top:0,opacity:0,flexDirection:'row'},children:(0,x.jsx)(c.Text,{onLayout:e=>A(Math.round(10*e.nativeEvent.layout.width)/10),style:[{fontFamily:d.fonts.regular,fontSize:h.AXIS_FONT},{whiteSpace:'nowrap'}],children:"Wed"})}),T.map((e,t)=>(0,x.jsx)(u.T,{testID:"forecast-day-label",size:h.AXIS_FONT,colour:d.colours.muted,style:[{position:'absolute',left:e.x,width:e.w,top:0,lineHeight:h.AXIS_BAND,textAlign:e.align??'center'},{whiteSpace:'nowrap'}],children:e.text},`${e.text}-${t}-${e.x}`))]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=e(_r(_d[2])),s=e(_r(_d[3]));_r(_d[4]);var i=e(_r(_d[5])),r=e(_r(_d[6])),n=_r(_d[7]),a=e(n),u=_r(_d[8]),c=_r(_d[9]),d=_r(_d[10]),h=_r(_d[11]),x=_r(_d[12])},1094,[876,31,121,225,123,128,288,989,818,874,825,1445,25]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1095,[881,863,5]); +__d(function(_g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SETUP_STEPS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ACCESS_LEVELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ACCESS_ROLE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"ACCESS_APP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"accessOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PERMS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"DEFAULT_PERMS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"DEFAULT_GRADES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useSetup",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useSiteSetup",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"HOME_SETUP_NAGS_OFF",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"homeSetupNagsHidden",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"setupProgress",{enumerable:!0,get:function(){return v}});var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e},i=_r(d[2]),s=_r(d[3]);const o=[{id:'venue',title:'Venue details & logo',sub:'Name, address, phone, your logo and order at table'},{id:'hours',title:'Opening hours',sub:'When the kitchen is open each day'},{id:'plan',title:'Areas & table plan',sub:'Your areas, tables and seats'},{id:'paygrades',title:'Staff pay rates',sub:'Name, age, role and hourly rate; tap to edit'},{id:'staff',title:'Add staff',sub:'Name, role, access, pay and avatar'},{id:'permissions',title:'Permissions',sub:'What each access level can do'},{id:'email',title:'Link email',sub:'Your work email address'},{id:'website',title:'Link website',sub:'Your website and booking link'},{id:'invites',title:'Staff invite links',sub:'Personal links for each person'}],l=['Owner','Manager','Supervisor','Head Chef','Staff'],u={Owner:'owner',Manager:'manager',Supervisor:'manager','Head Chef':'staff',Staff:'staff'},c={Owner:'Managers',Manager:'Managers',Supervisor:'Managers','Head Chef':'Head Chef',Staff:'Staff'},f=(e,t)=>l.includes(e??'')?e:'owner'===t?'Owner':'manager'===t?'Manager':'Staff',b=[{id:'bookings',label:'Take and change bookings'},{id:'walkins',label:'Seat walk-ins'},{id:'block',label:'Block bookings and close the garden'},{id:'tableplan',label:'Edit the table plan'},{id:'kitchen',label:'Kitchen tickets and allergy ticks'},{id:'menu',label:'Edit the menu and allergens'},{id:'rota',label:'Make the rota'},{id:'timesheets',label:'Approve timesheets'},{id:'pay',label:'See pay and wages'},{id:'takings',label:'See takings and reports'},{id:'staff',label:'Add staff and change access'},{id:'settings',label:'Change venue settings'},{id:'billing',label:'Plan and billing'}],p=e=>Object.fromEntries(b.map(t=>[t.id,e])),g=e=>({...p(!1),...Object.fromEntries(e.map(e=>[e,!0]))}),S={Owner:p(!0),Manager:{...p(!0),staff:!1,billing:!1},Supervisor:g(['bookings','walkins','block','tableplan','kitchen','rota']),'Head Chef':g(['kitchen','menu','rota']),Staff:g(['bookings','walkins'])},h=[{id:'pg-foh',name:'Front of house',pence:1271},{id:'pg-bar',name:'Bar team',pence:1271},{id:'pg-kp',name:'Kitchen porter',pence:1271},{id:'pg-cdp',name:'Chef de partie',pence:1450},{id:'pg-sup',name:'Supervisor',pence:1400}],k=()=>({done:{},grades:h.map(e=>({...e})),staffGrade:{},perms:JSON.parse(JSON.stringify(S)),email:'',website:'',bookingUrl:'',invites:{}}),O=(0,i.create)()((0,s.persist)((e,t)=>({sites:{},looks:{},patch:(t,n)=>e(e=>({sites:{...e.sites,[t]:{...e.sites[t]??k(),...n}}})),markDone:(e,n,r=!0)=>{const i={...(t().sites[e]??k()).done};r?i[n]=(new Date).toISOString():delete i[n],t().patch(e,{done:i})},setPerm:(e,n,r,i)=>{const s=t().sites[e]??k();'Owner'!==n&&t().patch(e,{perms:{...s.perms,[n]:{...s.perms[n],[r]:i}}})},resetPerms:e=>t().patch(e,{perms:JSON.parse(JSON.stringify(S))}),setLook:(t,n)=>e(e=>{const r={...e.looks};return null==n?delete r[t]:r[t]=n,{looks:r}})}),{name:'covercharge-setup-v1',storage:(0,s.createJSONStorage)(()=>r.default),version:1})),P=e=>{const n=O(t=>t.sites[e])??y,r=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===e)?.contactEmail);return{...n,email:r??n.email}},y=k(),E=['anchorage'],w=e=>E.includes(e),v=e=>{const t=o.filter(t=>e.done[t.id]).length;return{done:t,total:o.length,pct:t/o.length}}},1096,[881,1190,995,1191]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1097,[571,1399,1401,1400]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1098,[2,824]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"uuid",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isUuid",{enumerable:!0,get:function(){return t}});const x=()=>globalThis.crypto&&'randomUUID'in globalThis.crypto?globalThis.crypto.randomUUID():'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,x=>{const t=16*Math.random()|0;return('x'===x?t:3&t|8).toString(16)}),t=x=>'string'==typeof x&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)},1099,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"fmtH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fmtHDay",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SHIFT_MIN_START",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MAX_END",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shiftTitle",{enumerable:!0,get:function(){return f}});var t=r(d[0]);const n=t=>{const n=(Math.round(60*t)%1440+1440)%1440;return`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`},u=t=>`${n(t)}${t>=24?' (next day)':''}`,o=7,c=28,f=(n,u)=>`${n.replace(' (example)','')} \xb7 ${(0,t.niceDate)((0,t.parseYmd)(u))}`},1100,[822]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return c}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(t,s,o){const c=t.find(n=>n.id===s);return t.filter(t=>(0,n.canSwapWith)(c,t,o))};var n=r(d[0]);const t=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],s=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],o=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],c='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1101,[1102]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"deptKey",{enumerable:!0,get:function(){return n}}),e.sameDept=function(t,a){const o=n(t?.dept),s=n(a?.dept);return!!o&&o===s},Object.defineProperty(e,"teamKey",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ANCHORAGE_VENUE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_SWAP_EDGES",{enumerable:!0,get:function(){return s}}),e.isAnchorageVenue=d,e.canSwapWith=function(t,n,o){if(!t||!n||!1===t.active||!1===n.active||'owner'===t.role||'owner'===n.role)return!1;const c=l(t),f=l(n);if(!c.length||!f.length||c.some(t=>f.includes(t)))return!1;if(d(o))return s.some(([t,n])=>c.includes(t)&&f.includes(n)||c.includes(n)&&f.includes(t));const b=a(t.dept),u=a(n.dept);return!!b&&b===u},Object.defineProperty(e,"SWAP_DEPT_NOTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"ANCHORAGE_SWAP_NOTE",{enumerable:!0,get:function(){return u}}),e.teamOnDay=function(a,o,s,c){const f=o.find(t=>t.id===c),d=new Map;for(const f of a){if(f.date!==s||!0!==f.published||f.staffId===c)continue;const a=o.find(t=>t.id===f.staffId);if(!a||!1===a.active)continue;const l=String(a.dept??'').trim()||'Department not set',b=n(a.dept)||p,u=d.get(b)??{dept:l,people:[]};u.people.push({id:a.id,name:g(a.name),job:String(a.job??'').trim(),start:f.start,end:f.end,times:`${(0,t.fmtH)(f.start)}\u2013${(0,t.fmtH)(f.end)}`}),d.set(b,u)}const l=n(f?.dept);return[...d.entries()].sort(([t],[n])=>t===l?-1:n===l||t===p?1:n===p?-1:t.localeCompare(n)).map(([,t])=>({...t,people:t.people.sort((t,n)=>t.start-n.start||t.name.localeCompare(n.name))}))},e.teamOnDaySpoken=function(n,a){return a.length?`${n}, also on. `+a.map(n=>`${n.dept}: `+n.people.map(n=>`${n.name}${n.job?`, ${n.job}`:''}, ${(0,t.fmtH)(n.start)} to ${(0,t.fmtH)(n.end)}`).join('; ')).join('. ')+'.':`${n}: nobody else is on the rota.`};var t=r(_d[0]);const n=t=>String(t??'').trim().toLowerCase().replace(/\s+/g,' ');const a=t=>{const a=n(t);return'bar'===a||'foh'===a?'front of house':a},o='6349aa07-3fec-46e9-8c69-7b1b08494793',s=[['st-finn','st-agate'],['st-finn','st-eilidh'],['st-agate','st-eilidh'],['st-gabrielle','st-emily'],['st-gabrielle','st-agate'],['st-emily','st-agate'],['st-gordon','st-lenny'],['st-gordon','st-bisto'],['st-mia','st-lillie']],c={'st-finn':'0db9c5d4-f989-4ce8-838a-54c7735f83f0','st-agate':'fce268d0-63ab-42cd-a298-68e3ec5bcae4','st-eilidh':'88f41ae2-dd2f-41c2-b75d-fa735a77e703','st-gabrielle':'71174004-40de-4477-a157-04858a009baa','st-emily':'6b6f09b4-a65e-4390-b86e-b8c57eabe178','st-gordon':'456e0738-dea5-47a8-813e-7b13a0e6c10e','st-lenny':'4dfc8938-7c90-4667-92d2-410807f791f8','st-bisto':'ea2e4b54-ce06-465a-b796-4fa7cde99004','st-mia':'260f4c7b-e78a-45ba-9f8e-f6e33921762b','st-lillie':'636735ff-0d19-4c47-9bfa-3e13c261acc2','st-jack':'ce6f4391-ec69-4782-aac6-8500eb899cc2','st-cameron':'683888b9-2b3d-4225-b028-12cf577decbb','st-harvey':'3ad10d28-78c0-457d-9238-f4a27fb30170','st-james':'6ffe4ae0-2bc1-4355-b3b5-f6e79884d0dc','st-tracy':'79fbfe9e-1d64-412c-a191-42e94b35c1c7'},f=Object.fromEntries(Object.entries(c).map(([t,n])=>[n,t]));function d(t){const n=String(t??'').trim().toLowerCase();return'anchorage'===n||n===o}function l(t){if(!t)return[];const n=[t.id,t.ref,t.externalRef].map(t=>String(t??'').trim().toLowerCase()).filter(Boolean),a=new Set(n);for(const t of n){const n=c[t]?t:f[t];n&&(a.add(n),a.add(c[n]))}return[...a]}const b='Swaps and cover stay in your department. Bar counts as front of house. A manager can still move a shift on the rota.',u='You can only swap with the people named for you. A manager can still move a shift on the rota.',p='\0unset',g=t=>t.replace(/\s*\(example\)$/,'').trim()},1102,[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,"daysBetween",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rangeLabel",{enumerable:!0,get:function(){return h}}),_e.TimeOffSheet=b,_e.RequestTimeOff=function({meId:e,me:s,testID:l="request-time-off"}){const[d,f]=(0,t.useState)(!1),m=(0,o.ymd)(new Date),u=(0,r.useOwner)(e=>e.leave).filter(t=>t.staffId===e&&t.to>=m).sort((e,t)=>e.from.localeCompare(t.from));return(0,i.jsxs)(n.Card,{children:[(0,i.jsxs)(a.default,{testID:l,style:{gap:8,alignItems:'stretch'},children:[(0,i.jsx)(n.Button,{label:"Request time off",sub:"Holiday, appointments, days you can\u2019t work",testID:`${l}-open`,onPress:()=>f(!0)}),u.map(e=>(0,i.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:8,children:[(0,i.jsxs)(n.T,{size:14,style:{flex:1},children:[h(e.from,e.to)," \xb7 ",e.reason]}),(0,i.jsx)(n.Badge,{kind:'approved'===e.status?'ok':'declined'===e.status?'red':'amber',label:y(e.status)})]},e.id))]}),(0,i.jsx)(b,{visible:d,onClose:()=>f(!1),meId:e,me:s})]})};var t=_r(_d[0]),s=e(_r(_d[1])),a=e(_r(_d[2])),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),i=_r(_d[7]);const d=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],f=['January','February','March','April','May','June','July','August','September','October','November','December'],m=['Holiday','Appointment','Family','Other'],u=e=>(e??'').replace(' (example)',''),c=(e,t)=>Math.round(((0,o.parseYmd)(t).getTime()-(0,o.parseYmd)(e).getTime())/864e5)+1,h=(e,t)=>e===t?(0,o.niceDateYear)((0,o.parseYmd)(e)):`${(0,o.niceDateYear)((0,o.parseYmd)(e))} to ${(0,o.niceDateYear)((0,o.parseYmd)(t))}`,y=e=>'approved'===e?'Approved':'declined'===e?'Declined':'Waiting for a manager';function p({from:e,to:r,onChange:m,today:u}){const c=(0,o.parseYmd)(e||u),[h,y]=(0,t.useState)({y:c.getFullYear(),m:c.getMonth()}),p=(new Date(h.y,h.m,1).getDay()+6)%7,b=new Date(h.y,h.m+1,0).getDate(),x=[...Array(p).fill(null),...Array.from({length:b},(e,t)=>(0,o.ymd)(new Date(h.y,h.m,t+1)))],j=(0,o.parseYmd)(u),w=h.y>j.getFullYear()||h.y===j.getFullYear()&&h.m>j.getMonth(),D=e=>y(({y:t,m:s})=>{const a=new Date(t,s+e,1);return{y:a.getFullYear(),m:a.getMonth()}}),I=t=>{!e||e&&r||tD(-1)}),(0,i.jsxs)(n.T,{weight:"semibold",testID:"time-off-month",children:[f[h.m]," ",h.y]}),(0,i.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u203a",accessibilityLabel:"Next month",testID:"time-off-next-month",onPress:()=>D(1)})]}),(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:d.map(e=>(0,i.jsx)(a.default,{style:{flex:1,alignItems:'center'},children:(0,i.jsx)(n.Muted,{children:e})},e))}),Array.from({length:Math.ceil(x.length/7)},(t,d)=>(0,i.jsx)(a.default,{style:{flexDirection:'row'},children:Array.from({length:7},(t,f)=>{const m=x[7*d+f];if(!m)return(0,i.jsx)(a.default,{style:{flex:1,height:40}},f);const c=me&&mI(m),style:{flex:1,height:40,margin:1,borderRadius:8,alignItems:'center',justifyContent:'center',backgroundColor:h?l.colours.gold:y?'#3a3020':'transparent',opacity:c?.35:1},children:(0,i.jsx)(n.T,{size:14,weight:h?'semibold':'regular',colour:h?'#1a1407':l.colours.text,children:Number(m.slice(8))})},f)})},d))]})}function b({visible:e,onClose:s,meId:l,me:d,manager:f}){const y=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),b=(0,o.ymd)(new Date),[x,j]=(0,t.useState)(f?'':l),[w,D]=(0,t.useState)(''),[I,v]=(0,t.useState)(''),[S,Y]=(0,t.useState)('Holiday'),[C,T]=(0,t.useState)(null),M=I||w,A=!!x&&!!w&&M>=w,P=()=>{T(null),s()};return(0,i.jsx)(n.Sheet,{visible:e,onClose:P,title:f?'Add time off':'Request time off',testID:"time-off-sheet",children:C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Banner,{kind:"success",title:C}),(0,i.jsx)(n.Button,{label:"Done",testID:"time-off-done",onPress:P})]}):(0,i.jsxs)(i.Fragment,{children:[f?(0,i.jsxs)(a.default,{style:{gap:6},children:[(0,i.jsx)(n.T,{weight:"semibold",children:"Who\u2019s off?"}),(0,i.jsx)(n.Row,{wrap:!0,gap:6,children:y.filter(e=>'owner'!==e.role).map(e=>(0,i.jsx)(n.Chip,{testID:`time-off-who-${e.id}`,label:u(e.name),selected:x===e.id,onPress:()=>j(e.id)},e.id))})]}):null,(0,i.jsx)(n.Muted,{center:!0,children:w?I?'Tap a day to start again.':'Now tap your last day off (or tap Send for just that day).':'Tap your first day off.'}),(0,i.jsx)(p,{from:w,to:I,today:b,onChange:(e,t)=>{D(e),v(t)}}),w?(0,i.jsxs)(n.T,{center:!0,weight:"semibold",testID:"time-off-summary",children:[h(w,M)," \xb7 ",c(w,M)," ",1===c(w,M)?'day':'days']}):null,(0,i.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:m.map(e=>(0,i.jsx)(n.Chip,{label:e,selected:S===e,onPress:()=>Y(e)},e))}),(0,i.jsx)(n.Button,{label:f?'Add time off':'Send request',testID:"time-off-send",disabled:!A,onPress:()=>{const e=r.useOwner.getState().addLeave({staffId:x,from:w,to:M,reason:S,by:u(d),...f?{status:'approved',decidedBy:u(d)}:{}}),t=u(y.find(e=>e.id===x)?.name);T(f?`${t} is off ${h(e.from,e.to)}. It shows on the rota now.`:`Sent: ${h(e.from,e.to)}. A manager will approve it, and you\u2019ll see it here.`),D(''),v('')}}),(0,i.jsx)(n.Muted,{center:!0,children:f?'Approved straight away. The rota shows them off and Copy last week won\u2019t give them shifts on those days.':'Your manager sees it in Rota \u203a Swaps & time off and approves it. Nothing is sent by text or email.'})]})})}},1103,[31,264,128,818,863,822,825,25]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RESPONSIVE_CSS",{enumerable:!0,get:function(){return t}});const t="\n*,*::before,*::after { box-sizing:border-box !important; }\nhtml,body { max-width:100%; overflow-x:hidden; }\ninput,select,textarea { box-sizing:border-box !important; min-width:0; max-width:100%; }\n[dir=\"auto\"] { overflow-wrap:break-word; }\n[data-testid^=\"area-summary-\"] [dir=\"auto\"] { overflow-wrap:normal; word-break:keep-all; text-align:center; }\n[data-testid=\"venue-header-name\"],\n[data-testid^=\"avatar-option-\"] [dir=\"auto\"] { overflow-wrap:normal !important; word-break:keep-all !important; }\n[data-testid=\"cc-card\"] { min-width:0; max-width:100%; overflow-x:hidden; }\n[data-testid=\"cc-card\"] > [dir=\"auto\"] { text-align:center; }\n[data-testid=\"cc-card\"] > * { min-width:0; max-width:100%; }\n";if('undefined'!=typeof document&&!document.getElementById('cc-responsive-sizing')){const n=document.createElement('style');n.id='cc-responsive-sizing',n.textContent=t,document.head.appendChild(n)}},1164,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.fromDisplayFlag=y,_e.displayUrlFrom=m,_e.openedFromDisplay=function(){return b},_e.BackToDisplayButton=I,_e.BackToDisplay=function(){const e=(0,p.useSession)(e=>e.meId),[n,s]=(0,t.useState)(!1),c=(0,t.useRef)(Date.now());return(0,t.useEffect)(()=>{if(!b||!(0,f.isKitchenViaDisplay)()||'undefined'==typeof window)return;const e=()=>{c.current=Date.now()};for(const t of['pointerdown','keydown','touchstart'])window.addEventListener(t,e,!0);const t=window.setInterval(()=>{Date.now()-c.current>D&&!n&&(s(!0),v())},5e3);return()=>{for(const t of['pointerdown','keydown','touchstart'])window.removeEventListener(t,e,!0);window.clearInterval(t)}},[n]),b?e?null:(0,h.jsx)(o.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,top:12,alignItems:'center',zIndex:9999},children:(0,h.jsx)(I,{})}):null};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),c=r(d[5]),l=r(d[6]),u=r(d[7]),f=r(d[8]),p=r(d[9]),h=r(d[10]);const w='cc-from-display';function y(e,t){try{const n=new URL(e),o=new URLSearchParams(n.hash.replace(/^#/,''));return'display'===n.searchParams.get('from')||'display'===o.get('from')||'1'===t}catch{return'1'===t}}function m(e){const t=new URL(e),n=t.pathname.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/);return`${t.origin}${n?n[1]:'/'}display-app/index.html`}const b=(()=>{if('undefined'==typeof window||'chef'!==s.APP_VARIANT)return!1;let e=null;try{e=window.sessionStorage.getItem(w)}catch{}const t=y(window.location.href,e);if(t)try{window.sessionStorage.setItem(w,'1')}catch{}return t})(),D=12e4;async function v(){if((0,f.isKitchenViaDisplay)()){try{await(0,u.endDisplayKitchen)()}catch{}try{p.useSession.getState().signOut()}catch{}(0,f.markKitchenViaDisplay)(!1)}try{window.sessionStorage.removeItem(w)}catch{}window.location.assign(m(window.location.href))}function I({compact:e}={}){const[o,s]=(0,t.useState)(!1);if(!b)return null;const u=e?48:56;return(0,h.jsx)(n.default,{testID:"back-to-display",accessibilityRole:"button",accessibilityLabel:"Back to Display",accessibilityHint:"Leaves the Head Chef app and opens the Display again",onPress:()=>{s(!0),v()},style:({pressed:t})=>({minHeight:u,minWidth:e?180:220,paddingHorizontal:e?16:22,borderRadius:u/2,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:t?c.colours.goldLight:c.colours.gold,borderWidth:2,borderColor:c.colours.bg}),children:(0,h.jsx)(l.T,{size:e?15:18,weight:"bold",colour:c.colours.bg,center:!0,children:o?'Opening the Display\u2026':'Back to Display'})})}},1165,[31,123,264,128,807,825,818,824,979,866,25]); +__d(function(g,r,_i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return l}}),_e.quietly=async function(e){u++;try{await e()}finally{u--;for(const e of p)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return w}}),_e.venueChannel=function(e,t,n,s){let i=o().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:o}of t)i=i.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${o??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return i.subscribe(e=>s(e)),i},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return n.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]),i=r(d[4]);const o=()=>(0,t.getSupabase)(),h=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(h).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${h(t[e])}`).join(',')}}`},c=e=>{const t=h(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},l=5;let u=0;const p=new Set;const f=()=>u>0;class w{known={};last=new Map;lastRev=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}unsubDone=null;async start(){this.known=await s.kv.get(this.kvKey,{}),this.snapshotLocal(),p.add(this),this.spec.writeBeforeRead&&this.pushUrgent(),this.unsub=this.spec.subscribe(()=>{u>0?this.snapshotLocal():this.applying||!this.reconciled&&!this.spec.writeBeforeRead||this.pushLocalChanges()}),this.unsubDone=i.mutationQueue.onDone(e=>{if(e.table!==this.spec.table||e.venueId!==this.venueId)return;const t=this.spec.list().find(t=>this.spec.key(t)===e.rowKey);t&&(this.known[this.spec.key(t)]=this.kh(t),this.saveKnown())})}pushUrgent(){const e=this.spec;if(e.writable())for(const t of e.list()){const n=e.key(t);!e.syncable(t)||e.urgent&&!e.urgent(t)||this.pending(n)||this.known[n]===this.kh(t)||this.write(t)}}unsavedKeys(){const e=this.spec;return e.list().filter(t=>e.syncable(t)&&(!e.inWindow||e.inWindow(t))&&this.known[e.key(t)]!==this.kh(t)&&!this.pending(e.key(t))).map(t=>e.key(t))}resendUnsaved(e=()=>!1){const t=this.spec;if(!t.writable())return 0;const n=new Set(this.unsavedKeys().filter(t=>!e(t)));let s=0;for(const e of t.list())n.has(t.key(e))&&(this.write(e),s++);return s}stop(){this.unsub?.(),this.unsub=null,this.unsubDone?.(),this.unsubDone=null,p.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}rev(e){return this.spec.revision?this.spec.revision(e):c(e)}kh(e){return this.spec.knownByRevision?this.rev(e):c(e)}snapshotLocal(){const e=this.spec.list();this.last=new Map(e.map(e=>[this.spec.key(e),c(e)])),this.lastRev=new Map(e.map(e=>[this.spec.key(e),this.rev(e)]))}saveKnown(){s.kv.set(this.kvKey,this.known)}pending(e){return i.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){const t=()=>{let e=o().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);return this.spec.filter&&(e=this.spec.filter(e)),e},n=['bookings','walk_ins','temp_readings','temp_units'].includes(this.spec.table)?await(0,e.readPages)(async(e,n)=>{const{data:s,error:i}=await t().order('id').range(e,n);if(i)throw i;return s??[]}):await(async()=>{const{data:e,error:n}=await t().limit(2e3);if(n)throw n;return e??[]})();this.merge(n,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(n)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],h=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),h=n.fromRow(t);if(!h)continue;i.add(e),p.push(h);const l=c(h),f=this.kh(h),w=s.get(e);if(!this.pending(e)){if(w){const t=this.kh(w);if(this.rev(w)===this.rev(h)){this.known[e]=f,c(w)!==l&&o.push(h);continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(w)){u.push(w);continue}}o.push(h),this.known[e]=f}}const f=n.authoritative?.(e)??null,w=[];for(const[e,t]of s)i.has(e)||this.pending(e)||(!f||!f(t)||n.writable()&&n.syncable(t)||n.inWindow&&!n.inWindow(t)?n.syncable(t)&&(n.inWindow&&!n.inWindow(t)||(this.known[e]?h.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t))):w.push(e));!e.length&&n.keepOnEmpty?.()&&(h.length=0,w.length=0);const v=this.massOk;if(this.massOk=!1,h.length>l&&!v)this.ev.onSuspect?.(n.name,`read would remove ${h.length} of ${s.size}`),h.length=0,u.length=0;else for(const e of h)delete this.known[e];for(const e of w)delete this.known[e],h.push(e);this.applyRemote(o,h);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=c(i);this.known[s]=this.kh(i),this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=c(s),i=this.rev(s);if(this.last.get(n)===t)continue;const o=this.lastRev.get(n);this.last.set(n,t),this.lastRev.set(n,i),void 0!==o&&o===i||(e.syncable(s)&&e.writable()&&this.known[n]!==this.kh(s)&&(!this.pending(n)||e.writeBeforeRead)?this.write(s):e.syncable(s)&&!e.writable()&&this.known[n]!==this.kh(s)&&this.ev.onSkipped?.(e.name,n))}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e),this.lastRev.delete(e);const s=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&s.length>l)return this.ev.onSuspect?.(e.name,`${s.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of s)delete this.known[t],i.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let s;try{s=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if('update'===t.mode){const e=t.venueColumn??'venue_id';i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:s,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else i.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:s,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1166,[1282,872,1279,1268,1074]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"SEED_CARD_COSTS",{enumerable:!0,get:function(){return A}}),_e.stripGpSamples=b,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return P}}),_e.useGpCalcView=function(){const e=P();return(0,i.useMemo)(()=>t.LIVE_VENUE_BUILD?{...e,...b(e)}:e,[e])},Object.defineProperty(_e,"GP_TABLES",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"GP_EPOCH",{enumerable:!0,get:function(){return E}}),_e.gpSyncItems=D,_e.gpSyncFromRow=L,_e.mergeGpItems=N,_e.gpSyncSpec=function(e,t){const i=C[e];return{name:i,table:i,deletes:!1,list:()=>D(P.getState(),e),key:e=>e.id,rowKey:t=>String('ing'===e?t.local_id:t.id),syncable:t=>'ing'===e?t.id.length>0&&t.id.length<=80:(0,u.isUuid)(t.id),writable:t,toRow:(t,i)=>({id:'ing'===e?(0,u.isUuid)(t.id)?t.id:(0,p.uuidFrom)(`gi:${i}:${t.id}`):t.id,venue_id:i,...'ing'===e?{local_id:t.id,name:String(t.doc?.name??'').slice(0,120)}:{},doc:_(t),updated_at:t.updatedAt,deleted_at:t.deletedAt??null}),fromRow:t=>L(e,t),apply:(t,i)=>P.setState(n=>N(n,e,t,i)),subscribe:t=>P.subscribe((i,n)=>{i.gone===n.gone&&('ing'===e?i.ingredients===n.ingredients:i[w[e]]===n[w[e]])||t()})}};var e,t=_r(_d[0]),i=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),d=(e=r)&&e.__esModule?e:{default:e},a=_r(_d[5]),c=_r(_d[6]),o=_r(_d[7]),p=_r(_d[8]),u=_r(_d[9]),l=_r(_d[10]),f=_r(_d[11]);let h=0;const m=e=>`${e}-${Date.now().toString(36)}${(h++).toString(36)}`,S=(e,t,i,n,s,r=0,d=[])=>({id:e,name:t,packSize:i,packUnit:n,packPrice:s,wastePct:r,allergens:d}),k=e=>new Date(Date.now()-864e5*e).toISOString(),y={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},v=[S('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),S('gi-potato','Potatoes (chipping)',25,'kg',1600,20),S('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),S('gi-oil','Rapeseed oil',20,'L',3200),S('gi-peas','Garden peas (frozen)',2.5,'kg',450),S('gi-lemon','Lemons',80,'each',1600),S('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),S('gi-capers','Capers',1,'kg',900,0,['sulphites']),S('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),S('gi-steak','Braising steak',5,'kg',6e3,10),S('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),S('gi-onion','Onions',10,'kg',1e3,10),S('gi-stock','Beef stock',1,'L',350,0,['celery']),S('gi-chicken','Chicken breast',5,'kg',4750),S('gi-leaves','Cos lettuce',12,'each',960,15),S('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),S('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),S('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),S('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),S('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),S('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs']),{...S('gi-haddock-stone','Haddock (by the stone)',1,'stone',11e3,0,['fish']),servings:30,servingName:'serving',supplier:'Local fish merchant',updatedAt:'2026-11-02T09:00:00.000Z'},{...S('gi-chicken-case','Chicken breast (5 kg case)',5,'kg',4e3),servings:25,servingName:'breast',supplier:'Butcher',updatedAt:'2026-11-02T09:00:00.000Z'}].map(e=>({...e,prices:(y[e.id]??[e.packPrice]).map((e,t,i)=>({p:e,at:k(7*(i.length-t))}))})),I=(e,t,i,n,s,r,d,a="")=>({id:e,name:t,category:i,lines:n.map(([e,t,i])=>({ingId:e,qty:t,unit:i})),portions:s,target:70,menuPrice:r,status:d,description:a,allergens:[]}),O=[I('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),I('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),I('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),I('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),I('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),I('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')],A={[(0,p.uuidFrom)('card:anchorage:a-fishsupper')]:{portions:1,lines:[{ingId:'gi-haddock-stone',qty:1,unit:'serving',recipeIngId:'a-fishsupper-i0'},{ingId:'gi-batter',qty:80,unit:'g',recipeIngId:'a-fishsupper-i1'},{ingId:'gi-potato',qty:250,unit:'g',recipeIngId:'a-fishsupper-i3'},{ingId:'gi-peas',qty:80,unit:'g',recipeIngId:'a-fishsupper-i4'},{ingId:'gi-mayo',qty:40,unit:'ml',recipeIngId:'a-fishsupper-i6'},{ingId:'gi-lemon',qty:.25,unit:'each',recipeIngId:'a-fishsupper-i7'}]}};function b(e){const t=e=>O.some(t=>t.id===e.id&&JSON.stringify(t)===JSON.stringify(e))||/\(example\)/i.test(e.name),i=new Set(e.dishes.filter(e=>!t(e)).map(e=>e.id));let n=!0;for(;n;){n=!1;for(const t of e.dishes.filter(e=>i.has(e.id)))for(const e of t.lines)e.ingId.startsWith('dish:')&&!i.has(e.ingId.slice(5))&&(i.add(e.ingId.slice(5)),n=!0)}const s=e.dishes.filter(e=>i.has(e.id)),r=new Set(s.flatMap(e=>e.lines.map(e=>e.ingId))),d=e=>{const t=v.find(t=>t.id===e.id);if(!t)return!1;const i=({prices:e,...t})=>JSON.stringify(t);return i(t)===i(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(t.prices?.map(e=>e.p)))},a=Object.fromEntries(Object.entries(e.cardCosts??{}).filter(([e,t])=>!(A[e]&&JSON.stringify(A[e])===JSON.stringify(t))));return Object.values(a).forEach(e=>e.lines.forEach(e=>r.add(e.ingId))),{dishes:s,ingredients:e.ingredients.filter(e=>r.has(e.id)||!d(e)),cardCosts:a}}const P=(0,a.create)()((0,c.persist)((e,i)=>({ingredients:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:v,dishes:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:O,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],cardCosts:s.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:A,gone:{},saveCardCost:(t,i)=>e(e=>{const n={...e.gone};return delete n[`card:${t}`],{cardCosts:{...e.cardCosts,[t]:{...i,updatedAt:(new Date).toISOString()}},gone:n}}),removeCardCost:t=>e(e=>{if(!e.cardCosts[t])return{};const{[t]:i,...n}=e.cardCosts;return{cardCosts:n,gone:{...e.gone,[`card:${t}`]:(new Date).toISOString()}}}),removeIngredient:t=>e(e=>({ingredients:e.ingredients.filter(e=>e.id!==t),gone:{...e.gone,[`ing:${t}`]:(new Date).toISOString()}})),saveIngredient:t=>{const n=i(),s=n.ingredients.find(e=>e.id===t.id),r=n.ingredients.map(e=>e.id===t.id?t:e);let d=n.alerts;if(s&&(s.packPrice!==t.packPrice||s.packSize!==t.packSize||s.wastePct!==t.wastePct)){const e=n.settings.vatPct,i=n.dishes.filter(e=>e.menuPrice).map(t=>{const i=(0,o.gpOf)((0,o.portionCost)(t,n.ingredients,n.dishes),t.menuPrice,e).gpPct,s=(0,o.gpOf)((0,o.portionCost)(t,r,n.dishes),t.menuPrice,e).gpPct;return{id:t.id,name:t.name,before:i,after:s,belowTarget:se.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),c=(a(t)-a(s))/a(s)*100;i.length&&(d=[{id:m('ma'),at:(new Date).toISOString(),ingredient:t.name,change:`${c>=0?'+':''}${c.toFixed(0)}%`,dishes:i},...d].slice(0,20))}const a=s&&JSON.stringify({...s,updatedAt:void 0})!==JSON.stringify({...t,updatedAt:void 0});e({ingredients:a?r.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):r,alerts:d})},addPricePaid:(e,t,n)=>{const s=i(),r=s.ingredients.find(t=>t.id===e);if(!(r&&t>0))return;const d=[...r.prices?.length?r.prices:[{p:r.packPrice,at:''}],{p:Math.round(t),at:n??(new Date).toISOString()}].slice(-20),a={...r,prices:d};i().saveIngredient({...a,packPrice:(0,o.costingPrice)(a,s.settings.priceBasis,s.settings.avgOf??5)})},addIngredient:t=>{const i=m('gi');return e(e=>({ingredients:[...e.ingredients,{updatedAt:(new Date).toISOString(),...t,id:i}]})),i},saveDish:t=>e(e=>({dishes:e.dishes.some(e=>e.id===t.id)?e.dishes.map(e=>e.id===t.id?{...t,updatedAt:(new Date).toISOString()}:e):[{...t,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:t=>e(e=>({dishes:e.dishes.filter(e=>e.id!==t)})),setSettings:t=>{const n={...i().settings,...t};if(e({settings:n}),void 0!==t.priceBasis||void 0!==t.avgOf)for(const e of i().ingredients){const t=(0,o.costingPrice)(e,n.priceBasis,n.avgOf??5);t!==e.packPrice&&i().saveIngredient({...e,packPrice:t})}},dismissAlert:t=>e(e=>({alerts:e.alerts.filter(e=>e.id!==t)})),deliveries:{},counts:{},saveDelivery:(t,n)=>{const s=i(),r=(new Date).toISOString(),d=s.deliveries[t.id],a=n?(0,f.gpImpact)(s.ingredients,s.cardCosts??{},n,s.settings,t,d).snap:t.gp??d?.gp,{ingredients:c,lines:o}=(0,l.applyDelivery)(s.ingredients,t,s.settings,()=>m('gi'),r,d),p={...t,lines:o,updatedAt:r,...a?{gp:{...a,at:r}}:{}},u={...s.gone};return delete u[`del:${t.id}`],e({ingredients:c,deliveries:{...s.deliveries,[t.id]:p},gone:u}),p},removeDelivery:t=>e(e=>{if(!e.deliveries[t])return{};const{[t]:i,...n}=e.deliveries;return{deliveries:n,ingredients:(0,l.removeDeliveryPrices)(e.ingredients,t,e.settings,void 0,e.deliveries[t]),gone:{...e.gone,[`del:${t}`]:(new Date).toISOString()}}}),saveCount:t=>e(e=>{const i={...e.gone};return delete i[`count:${t.id}`],{counts:{...e.counts,[t.id]:{...t,updatedAt:(new Date).toISOString()}},gone:i}}),removeCount:t=>e(e=>{if(!e.counts[t])return{};const{[t]:i,...n}=e.counts;return{counts:n,gone:{...e.gone,[`count:${t}`]:(new Date).toISOString()}}})}),{name:'covercharge-gpcalc-v1',storage:(0,c.createJSONStorage)(()=>d.default),version:4,migrate:async(e,i)=>(t.LIVE_VENUE_BUILD&&e&&(await(0,n.archiveChefCache)('gpcalc',e),e={...e,...b({...e,dishes:e.dishes||[],ingredients:e.ingredients||[],cardCosts:e.cardCosts||{}})}),i<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e&&!e.cardCosts&&(e.cardCosts={}),e&&!e.gone&&(e.gone={}),e&&!e.deliveries&&(e.deliveries={}),e&&!e.counts&&(e.counts={}),e)}));'undefined'!=typeof window&&'undefined'!=typeof document&&'function'==typeof window.addEventListener&&window.addEventListener('storage',e=>{e.key===(0,s.venueKey)('covercharge-gpcalc-v1')&&P.persist.rehydrate()});const w={card:'cardCosts',del:'deliveries',count:'counts'},C={ing:'ingredient_prices',card:'card_costs',del:'kitchen_deliveries',count:'kitchen_stock_counts'},E='1970-01-01T00:00:00.000Z',_=e=>JSON.parse(JSON.stringify(e));function D(e,t){const i=b(e),n='ing'===t?i.ingredients.map(e=>({id:e.id,updatedAt:e.updatedAt??E,doc:_({...e,updatedAt:e.updatedAt??E})})):Object.entries('card'===t?i.cardCosts:e[w[t]]??{}).map(([e,t])=>({id:e,updatedAt:t.updatedAt??E,doc:_({...t,updatedAt:t.updatedAt??E})})),s=new Set(n.map(e=>e.id)),r=Object.entries(e.gone??{}).filter(([e])=>e.startsWith(`${t}:`)).map(([e,i])=>({id:e.slice(t.length+1),updatedAt:i,deletedAt:i})).filter(e=>!s.has(e.id));return[...n,...r]}function L(e,t){const i=t?.doc,n=String('ing'===e?t?.local_id??'':t?.id??'');if(!i||'object'!=typeof i||i.id!==n||'string'!=typeof i.updatedAt||!n)return null;if(i.deletedAt)return'string'==typeof i.deletedAt?{id:n,updatedAt:i.updatedAt,deletedAt:i.deletedAt}:null;const s=i.doc;return s&&'object'==typeof s&&('ing'!==e||'string'==typeof s.name&&s.id===n&&Number(s.packSize)>0&&'string'==typeof s.packUnit&&Number.isFinite(Number(s.packPrice)))&&('ing'===e||Array.isArray(s.lines))&&('del'!==e&&'count'!==e||'string'==typeof s.date&&s.id===n)?{id:n,updatedAt:i.updatedAt,doc:i.doc}:null}function N(e,t,i,n){const s={...e.gone??{}},r=new Map('ing'===t?e.ingredients.map(e=>[e.id,e]):Object.entries(e[w[t]]??{})),d=[];for(const e of i){const i=`${t}:${e.id}`,n=r.get(e.id),a=n?n.updatedAt??E:void 0,c=s[i];if(e.deletedAt){if(n&&a>e.deletedAt)continue;r.delete(e.id),(!c||ce.updatedAt)continue;if(n&&a>e.updatedAt)continue;const o='ing'===t?{...e.doc,id:e.id,updatedAt:e.updatedAt}:{...e.doc,updatedAt:e.updatedAt};n?r.set(e.id,o):d.push([e.id,o]),delete s[i]}for(const e of n)r.delete(e),delete s[`${t}:${e}`];if('ing'===t){return{ingredients:[...r.values(),...d.map(([,e])=>e)],gone:s}}return{[w[t]]:Object.fromEntries([...r.entries(),...d]),gone:s}}},1167,[842,31,1198,5,1190,995,1191,1271,1179,1099,1272,1273]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCardStore",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"photoStorageFull",{enumerable:!0,get:function(){return C}}),_e.setStoragePhotoResolver=function(e){V=e},_e.cachePhotoAs=function(e,t){if(E.getState().photos[e]===t)return;E.setState(r=>({photos:{...r.photos,[e]:t}}))},Object.defineProperty(_e,"readLocalPhoto",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"localRecipeCards",{enumerable:!0,get:function(){return M}}),_e.ensureCards=F;var e,t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),s=_r(d[3]),a=_r(d[4]),o=_r(d[5]),c=(e=o)&&e.__esModule?e:{default:e};_r(d[6]);var u=_r(d[7]),l=_r(d[8]),f=_r(d[9]),m=_r(d[10]),h=_r(d[11]),p=_r(d[12]),S=_r(d[13]);const I='covercharge-recipecards-v1',y='covercharge-recipephotos-v1',O=()=>{try{return(0,S.nowFrom)(S.useStore.getState().clock)}catch{return new Date}},w=(0,u.create)()((0,l.persist)(()=>({cards:[],removed:[],log:[]}),{name:I,storage:(0,l.createJSONStorage)(()=>c.default),version:3,migrate:async e=>{const n=e;return t.LIVE_VENUE_BUILD?(await(0,r.archiveChefCache)('recipe-cards',n),{...n,cards:n.cards.filter(e=>!(0,s.isDemoCard)(e)),log:n.log.filter(e=>!(0,s.demoActor)(e.by))}):n}}));let b=!1;const v={getItem:e=>c.default.getItem(e),setItem:async(e,t)=>{try{await c.default.setItem(e,t),b=!1}catch{b=!0}},removeItem:e=>c.default.removeItem(e)},C=()=>b,E=(0,u.create)()((0,l.persist)(()=>({photos:{}}),{name:y,storage:(0,l.createJSONStorage)(()=>v),version:1})),_={lobster:_r(d[14]),skink:_r(d[15]),fishsupper:_r(d[16]),moules:_r(d[17]),stp:_r(d[18])};let A=0;const B=(e,t,r,n=t)=>{const s={id:`cl-${Date.now().toString(36)}${(A++).toString(36)}`,cardId:e.id,rid:e.restaurantId,at:O().toISOString(),by:t,text:n===t?r:`${r} (${n})`};w.setState(e=>({log:[s,...e.log].slice(0,300)}));try{S.useStore.getState().addAudit(e.restaurantId,'menu',`Recipe card: ${e.dish}: ${r} (${n})`)}catch{}},L=e=>w.setState(t=>({cards:t.cards.some(t=>t.id===e.id)?t.cards.map(t=>t.id===e.id?e:t):[...t.cards,e]}));let P=null,D=null;function U(){const e=w.getState().cards,r=t.LIVE_VENUE_BUILD?e.filter(e=>!(0,s.isDemoCard)(e)).map(e=>({...e,signOff:(0,s.demoActor)(e.signOff?.by)?null:e.signOff,allergensConfirmed:(0,s.demoActor)(e.allergensConfirmed?.by)?void 0:e.allergensConfirmed})):e;if(!D||P!==e){P=e;const t=new Map,n=new Map;for(const e of r)t.set(e.restaurantId,[...t.get(e.restaurantId)??[],e]),n.set(e.menuItemId,e);D={cards:r,byRid:t,byItem:n}}return D}const N=[];function R(e){if(!(0,f.canEditCards)(e.role))throw new Error('Only the head chef and managers can edit recipe cards.')}let V=null;const $=e=>E.getState().photos[e],M={mode:'local',list:e=>U().byRid.get(e)??N,get:e=>U().cards.find(t=>t.id===e),byMenuItem:e=>U().byItem.get(e),subscribe:e=>{const t=w.subscribe(e),r=E.subscribe(e);return()=>{t(),r()}},async create(e,t,r){R(r);const n=O().toISOString();k=!0;let s=t.menuItemId;try{s||(s=S.useStore.getState().addMenuItem({restaurantId:e,section:t.section,name:t.dish,description:t.description??'',price:t.price,dietary:[],allergens:t.allergens??{},prepMins:12,soldOut:!1,signOff:null}));const a=(0,f.cardPhotos)(t),o=t.createdBy?.trim()||r.name,c={id:t.id??(0,f.uuid)(),restaurantId:e,menuItemId:s,dish:t.dish,section:t.section,price:t.price,photo:a[0],photos:a,createdBy:o,createdByRole:t.createdByRole??(o===r.name?r.role:void 0),ingredients:t.ingredients??[],steps:t.steps??[],allergens:t.allergens??{},dismissed:t.dismissed??[],allergenNotes:t.allergenNotes,signOff:null,wasLive:!1,origin:'new',version:1,createdAt:n,updatedAt:n,updatedBy:r.name};return w.setState(e=>({cards:[...e.cards.filter(e=>e.menuItemId!==c.menuItemId),c]})),B(c,r.name,'card created, awaiting sign-off'),c}finally{k=!1}},async update(e,t,r){R(r);const n=M.get(e);if(!n)throw new Error('Card not found');const s=(0,f.editCard)(n,t,r.name,O().toISOString());return s.changed&&(L(s.card),B(s.card,r.name,s.resetSignOff?'edited, sign-off reset to Awaiting sign-off':t.confirmAllergens&&1===Object.keys(t).length?'allergens confirmed':'edited')),s.card},async signOff(e,t){const r=M.get(e);if(!r)throw new Error('Card not found');if(!(0,f.maySignOff)(t,r))throw new Error('Only the Head Chef, an owner or a manager can sign it off.');const n=(0,f.signOffBlock)(r);if(n)throw new Error(n);const s=(0,f.signOffCard)(r,t.name,O().toISOString());return L(s),B(s,t.name,'signed off',(0,f.signerLabel)(t)),s},async remove(e,t){R(t);const r=M.get(e);r&&(w.setState(t=>({cards:t.cards.filter(t=>t.id!==e),removed:[...t.removed,r.menuItemId]})),S.useStore.setState(e=>({menu:e.menu.map(e=>e.id===r.menuItemId?{...e,hidden:!0}:e)})),B(r,t.name,'card removed (dish hidden from the menu)'))},async savePhoto(e,t,r){const n=`local:${t}:${Date.now().toString(36)}`;return E.setState(e=>({photos:{...e.photos,[n]:r.dataUrl}})),n},photoSource(e){if(!e)return null;if(e.startsWith('asset:'))return _[e.slice(6)]??null;if(e.startsWith('local:')){const t=E.getState().photos[e];return t?{uri:t}:null}if(/^(https?:|data:)/.test(e))return{uri:e};const t=E.getState().photos[e];if(t)return{uri:t};const r=V?.(e);return r?{uri:r}:null}};let k=!1,j=!1;function F(){if(k)return;const e=S.useStore.getState().menu,{cards:r,removed:o}=w.getState(),c=new Set(r.map(e=>e.menuItemId)),u=e.filter(e=>!c.has(e.id)&&!o.includes(e.id)),l=O().toISOString();if(r.some(e=>(0,s.isPlaceholderCard)(e))&&w.setState(e=>({cards:e.cards.filter(e=>!(0,s.isPlaceholderCard)(e))})),!u.length)return;const f=a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD||!(0,n.examplesAllowed)()?[]:(0,p.exampleCards)(u),m=new Set(f.map(e=>e.menuItemId)),h=[...f,...u.filter(e=>!m.has(e.id)).map(e=>(0,p.importedCard)(t.LIVE_VENUE_BUILD&&(0,s.demoActor)(e.signOff?.by)?{...e,signOff:null}:e,l))];w.setState(e=>({cards:[...e.cards,...h]}))}(0,h.setMenuCardBridge)({cardFor:e=>U().byItem.get(e),menuItemAdded:e=>{if(k||!j)return;const t=O().toISOString(),r={...(0,p.importedCard)(e,t),id:(0,f.uuid)(),signOff:null,allergensConfirmed:void 0,wasLive:!1,origin:'new',updatedBy:'Added to the menu'};L(r),B(r,r.updatedBy,'card created from the menu, awaiting sign-off')},menuEdited:(e,t,r,n)=>{const s=U().byItem.get(e);if(!s)return;let a=(0,f.editCard)(s,t,r,O().toISOString()).card;n&&a.signOff&&(a={...a,signOff:null,version:a.version+1,updatedAt:O().toISOString(),updatedBy:r}),a!==s&&(L(a),B(a,r,s.signOff&&!a.signOff?'edited from the menu, sign-off reset':'edited from the menu'))},signOff:(e,t)=>{const r=U().byItem.get(e);r&&M.signOff(r.id,{name:t,role:'head-chef'}).catch(()=>{})}}),(0,m.setRecipeCardRepository)(M);const x=e=>new Promise(t=>{e.hasHydrated()?t():e.onFinishHydration(()=>t())});Promise.all([x(S.useStore.persist),x(w.persist)]).then(()=>{j=!0,F(),S.useStore.subscribe((e,t)=>{e.menu!==t.menu&&F()})}),'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===(0,a.venueKey)(I)&&w.persist.rehydrate(),e.key===(0,a.venueKey)(y)&&E.persist.rehydrate()})},1168,[842,1198,1218,1084,5,1190,123,995,1191,1179,839,1188,1219,881,1220,1221,1222,1223,1224]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SYNC_STALE_MS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"READ_GIVE_UP_MS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"FAST_GIVE_UP_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"RETRY_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"LIVE_DOWN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"SILENT_MS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REBUILD_GAP_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"HEARTBEAT_MS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"TICK_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"SLEEP_GAP_MS",{enumerable:!0,get:function(){return b}}),_e.syncStale=function(t,n,s=e){const o='string'==typeof t?Date.parse(t):t??0;return!o||!Number.isFinite(o)||n-o>s},_e.superviseSync=function(e){const t=e.now??(()=>Date.now()),d=e.setInterval??((e,t)=>setInterval(e,t)),h=e.clearInterval??(e=>clearInterval(e)),S=e.setTimeout??((e,t)=>setTimeout(e,t));let _=!1,v=!1;const y={fastReads:0,fullReads:0,rebuilds:0,wakes:0,authRefreshes:0,heartbeats:0,givenUp:0};let p=0,E=0,P=0,w=0,A=t(),M=0;const O=async t=>{try{await t()}catch(n){if(!e.isAuthError(n))throw n;y.authRefreshes++,await e.refreshAuth(),await t()}},R=()=>{if(_)return;if(p&&t()-p{e.markServer(),e.flush()},()=>{v||_||(v=!0,S(()=>{v=!1,R()},s))}).finally(()=>{p===o&&(p=0)})},j=()=>{if(E&&t()-E<6e4)return;E&&y.givenUp++;const n=E=t();y.fullReads++,O(e.readAll).then(()=>{e.flush()},()=>{}).finally(()=>{E===n&&(E=0)})},I=t=>{e.wake?.(),R(),j(),e.flush()},L=[d(R,e.fastMs),d(j,6e4),d(()=>{const n=t();n-A>b&&(y.wakes++,I()),A=n,'SUBSCRIBED'===e.realtime()?w=0:w||(w=n);const s=e.lastServerAt()?n-e.lastServerAt():0;(w&&n-w>o||s>u)&&(t()-P=f&&e.heartbeat&&(M=t(),y.heartbeats++,e.heartbeat().catch(()=>{}))},l)],T=()=>{e.doc&&'hidden'===e.doc.visibilityState||I()},U=()=>I();e.doc?.addEventListener?.('visibilitychange',T);for(const t of['online','focus','pageshow'])e.win?.addEventListener?.(t,U);return{kick:I,stats:()=>({...y}),stop:()=>{_=!0;for(const e of L)h(e);e.doc?.removeEventListener?.('visibilitychange',T);for(const t of['online','focus','pageshow'])e.win?.removeEventListener?.(t,U)}}};const e=6e4,t=3e4,n=1e4,s=2e3,o=45e3,u=9e4,c=12e4,f=6e4,l=5e3,b=2e4},1169,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPABASE_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SUPABASE_ANON_KEY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isSupabaseConfigured",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"REALTIME_TABLES",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n="https://rowdoidkftriylijobuy.supabase.co",o="sb_publishable_rPm723MQz6FwmFVHy6e1SA_ko-_-6GR",u=()=>!t.PITCH&&n.startsWith('https://')&&o.length>20,s=['bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_counts']},1170,[2]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOON_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"setVenueWords",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"getVenueWords",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"setSessionMender",{enumerable:!0,get:function(){return l}}),e.askServer=async function o(c,u,p,l,f=!0){try{const b=(0,t.getSupabase)().functions.invoke(n,{body:{app:c,text:u,tools:p,...l?{receipt:l,spoken:!0,vocab:s}:{}}}),k=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),1e4)),{data:w,error:v}=await Promise.race([b,k]);return f&&'identity'===w?.reason&&await y()?o(c,u,p,l,!1):v||!w||!0!==w.ready||w.busy?{kind:'soon'}:w.call?.name?{kind:'call',name:String(w.call.name),args:w.call.args??{}}:'string'==typeof w.text&&w.text.trim()?{kind:'text',text:w.text.trim()}:{kind:'soon'}}catch{return{kind:'soon'}}},e.transcribe=async function n(o,c,u=8e3,p=!0){try{const l=/mp4|m4a|aac/.test(c.type)?'m4a':/ogg/.test(c.type)?'ogg':/wav/.test(c.type)?'wav':'webm',b=new FormData;b.append('app',o),s.length&&b.append('keyterms',JSON.stringify(s)),b.append('file',c,`speech.${l}`);const k=(0,t.getSupabase)().functions.invoke(f,{body:b}),w=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),u)),{data:v,error:x}=await Promise.race([k,w]);return x?{ok:!1,reason:'timeout'===String(x?.message)?'timeout':'offline'}:!0===v?.ok?{ok:!0,text:String(v.text??''),receipt:'string'==typeof v.receipt?v.receipt:void 0}:p&&'identity'===v?.reason&&await y()?n(o,c,u,!1):{ok:!1,reason:String(v?.reason??'busy'),text:'string'==typeof v?.text?v.text:void 0}}catch{return{ok:!1,reason:'offline'}}};var t=r(d[0]);const n='voice-assistant',o='Voice assistant is switching on soon. Until then I can do the everyday things, for example';let s=[];const c=t=>{s=t.slice(0,100)},u=()=>s;let p=null;const l=t=>{p=t};async function y(){try{return!!p&&await p()}catch{return!1}}const f='voice-transcribe'},1171,[872]); +__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}}},1172,[1190,995,1191]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"desktopStt",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"desktopSttState",{enumerable:!0,get:function(){return u}}),_e.warmDesktopStt=function(){o()&&l()},Object.defineProperty(_e,"cleanHeard",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"tabletWithoutMic",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canRecord",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"canListen",{enumerable:!0,get:function(){return w}}),_e.micPermission=b,Object.defineProperty(_e,"RATE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PRE_ROLL_MS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"HANG_MS",{enumerable:!0,get:function(){return A}}),_e.releaseMic=O,Object.defineProperty(_e,"echoWanted",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"micConstraints",{enumerable:!0,get:function(){return j}}),_e.warmMic=async function(){try{if(o()||!y())return;if(!S&&'granted'!==await b())return;if(await D(),C){C.armedUntil=Date.now()+1500;try{C.ctx.resume?.()}catch{}}x()}catch{}},_e.disarmMic=function(){C&&!C.rec&&(C.armedUntil=0,C.ring=[],C.ringLen=0)},_e.askMic=async function(){try{return await D(),x(),!0}catch{return!1}},_e.wavOf=L,Object.defineProperty(_e,"MAX_CLIP_MS",{enumerable:!0,get:function(){return _}}),_e.listen=B,Object.defineProperty(_e,"CloudRecognition",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"speechRecognizer",{enumerable:!0,get:function(){return N}}),_e.levelMeter=async function(e){const t=n()?.navigator?.mediaDevices,r=n()?.AudioContext||n()?.webkitAudioContext;if(!t?.getUserMedia||!r)return()=>{};let o,i,a=0,c=!1;try{if(o=await t.getUserMedia({audio:!0}),c)return o.getTracks().forEach(e=>e.stop()),()=>{};i=new r;const s=i.createMediaStreamSource(o),u=i.createAnalyser();u.fftSize=512,s.connect(u);const l=new Uint8Array(u.fftSize),d=()=>{u.getByteTimeDomainData(l);let t=0;for(let e=0;e{}}return()=>{c=!0;try{n().cancelAnimationFrame(a)}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}}},_e.yesNo=function(e){const t=e.toLowerCase().trim().replace(/[.!,]/g,'');return/^(yes|yeah|yep|yup|aye|confirm|confirmed|do it|go ahead|correct|that's right|ok|okay|yes please)\b/.test(t)?'yes':/^(no|nope|cancel|stop|don't|do not|wrong|never mind)\b/.test(t)?'no':null},Object.defineProperty(_e,"buzz",{enumerable:!0,get:function(){return W}});var e=_r(_d[0]),t=_r(_d[1]);const n=()=>'undefined'==typeof window?void 0:window,r=()=>n()?.ccDesktop,o=()=>!!r()?.stt&&!!r()?.sttWorker;let i=null,a=0;const c=new Map;let s='cold';const u=()=>s;function l(){if(i)return i;const e=n()?.Worker,t=r()?.sttWorker;return e&&t?(i=new e(t,{type:'module'}),s='loading',i.onmessage=e=>{const t=e.data??{};if(t.ready)return void(s='ready');t.failed&&(s='failed');const n=c.get(t.id);n&&(c.delete(t.id),n(t))},i.onerror=()=>{s='failed',c.forEach(e=>e({error:'stt-failed'})),c.clear()},i.postMessage({warm:!0}),i):null}const d=e=>e.replace(/\[[^\]]*\]|\([^)]*\)/g,' ').replace(/\s+/g,' ').trim();function f(e,t){let o,i,s,u,f=!1,p=!1;const y=[];let w=16e3;const b=()=>{try{s?.disconnect(),u?.disconnect()}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}if(p)return;const n=y.reduce((e,t)=>e+t.length,0);if(n<.35*w)return void t('');const r=new Float32Array(n);let f=0;for(const e of y)r.set(e,f),f+=e.length;const b=16e3===w?r:h(r,w,16e3),v=l();if(!v)return void t('','stt-failed');e('Turning speech into text on this Mac\u2026');const M=++a;c.set(M,e=>t(d(e.text??''),e.error)),v.postMessage({id:M,audio:b},[b.buffer])};return(async()=>{try{if(r()?.askMic){if(!await r().askMic())return void t('','not-allowed')}if(o=await n().navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),f)return void b();const e=n().AudioContext||n().webkitAudioContext;try{i=new e({sampleRate:16e3})}catch{i=new e}w=i.sampleRate,u=i.createMediaStreamSource(o),s=i.createScriptProcessor(4096,1,1),s.onaudioprocess=e=>{f||y.push(new Float32Array(e.inputBuffer.getChannelData(0)))},u.connect(s),s.connect(i.destination),l()}catch(e){t('','NotAllowedError'===e?.name?'not-allowed':'audio-capture')}})(),{stop:()=>{f||(f=!0,b())},abort:()=>{p=!0,f=!0,b()}}}function h(e,t,n){const r=Math.round(e.length*n/t),o=new Float32Array(r),i=t/n;for(let t=0;t{const e=String(n()?.navigator?.userAgent??'');return/CoverChargeTablet\//.test(e)&&!/CoverChargeTablet\/[\d.]+ mic/.test(e)},y=()=>!p()&&!(!n()?.MediaRecorder||!n()?.navigator?.mediaDevices?.getUserMedia),w=()=>o()||y();async function b(){try{const e=n()?.navigator?.permissions?.query;if(!e)return'unknown';const t=await Promise.race([n().navigator.permissions.query({name:'microphone'}),new Promise(e=>setTimeout(()=>e(null),1500))]);return'granted'===t?.state||'denied'===t?.state||'prompt'===t?.state?t.state:'unknown'}catch{return'unknown'}}const v=16e3,M=500,A=450;let P,S=null,T=!1,k=!1,C=null;function U(){const e=C;if(C=null,e){try{e.node.disconnect(),e.src.disconnect()}catch{}try{e.ctx.close()}catch{}e.ring=[],e.rec=null}}function O(){clearTimeout(P),U();try{S?.getTracks().forEach(e=>e.stop())}catch{}S=null}const x=()=>{clearTimeout(P),P=setTimeout(O,/iPhone|iPad|iPod|Macintosh/.test(String(n()?.navigator?.userAgent??''))&&!r()?.mac?6e5:6e4)},R=()=>!1,j=(e=R())=>({audio:{channelCount:{ideal:1},sampleRate:{ideal:v},sampleSize:{ideal:16},echoCancellation:e,noiseSuppression:!0,autoGainControl:!0}});async function D(){clearTimeout(P);const e=R();if(S&&T===e&&S.getAudioTracks().some(e=>'live'===e.readyState))return S;if(S&&O(),S=await n().navigator.mediaDevices.getUserMedia(j(e)),T=e,!k){k=!0;try{n().document.addEventListener('visibilitychange',()=>{'hidden'===n().document.visibilityState&&O()})}catch{}}return E(S),S}function E(e){U();try{const t=n().AudioContext||n().webkitAudioContext;if(!t)return;let r;try{r=new t({sampleRate:v})}catch{r=new t}const o=r.createMediaStreamSource(e),i=r.createScriptProcessor(2048,1,1),a={ctx:r,node:i,src:o,rate:r.sampleRate,ring:[],ringLen:0,rec:null,frames:0,armedUntil:0,level:()=>{}},c=Math.round(.5*a.rate);i.onaudioprocess=e=>{const t=new Float32Array(e.inputBuffer.getChannelData(0));if(a.frames+=t.length,a.rec&&a.rec.push(t),!a.rec&&Date.now()>a.armedUntil)return a.ring=[],void(a.ringLen=0);for(a.ring.push(t),a.ringLen+=t.length;a.ring.length>1&&a.ringLen-a.ring[0].length>=c;)a.ringLen-=a.ring[0].length,a.ring.shift();let n=0;for(let e=0;ee+t.length,0),r=new Float32Array(n);let o=0;for(const t of e)r.set(t,o),o+=t.length;const i=t===v?r:h(r,t,v),a=new ArrayBuffer(44+2*i.length),c=new DataView(a),s=(e,t)=>{for(let n=0;n{clearTimeout(c),clearTimeout(s),S&&(S.rec=null,S.level=()=>{}),x()},k=(e,t,n)=>{h||f||(h=!0,o(e,t,n))};let U=!1;const O=async()=>{if(U)return;U=!0;const n=b,o=S?S.frames-P:0;if(T(),f)return;const i=Date.now()-y,a=!!n&&n.length>0&&o/M*1e3>.6*i?L(n,M):new Blob(w,{type:(p?.mimeType||w[0]?.type||'audio/webm').split(';')[0]});if(i<350||a.size<500)return void k('');r('Turning speech into text\u2026');const c=await(0,e.transcribe)(t,a);c.ok?k(c.text.trim(),void 0,{receipt:c.receipt}):k('',c.reason,{message:c.text})};(async()=>{try{const e=await D();if(d)return T(),void k('');if(S=C,S){try{S.ctx.resume?.()}catch{}b=[...S.ring],M=S.rate,P=S.frames-S.ringLen,S.rec=b,S.level=e=>{i?.(e),a&&!d&&(e>.12?(u=!0,l=0):u&&e<.05&&(l=l||Date.now(),Date.now()-l>1500&&j()))}}const t=F();p=new(n().MediaRecorder)(e,t?{mimeType:t,audioBitsPerSecond:48e3}:void 0),p.ondataavailable=e=>{e.data?.size&&w.push(e.data)},p.onstop=()=>{O()},p.onerror=()=>{b?.length?O():(T(),k('','audio-capture'))},p.start(),y=Date.now(),c=setTimeout(()=>{r('That\u2019s the 30-second limit. Sending now\u2026'),R()},_)}catch(e){T(),k('','NotAllowedError'===e?.name||'SecurityError'===e?.name?'not-allowed':'audio-capture')}})();const R=()=>{try{p&&'inactive'!==p.state?p.stop():O()}catch{O()}},j=()=>{d||(d=!0,p&&(s=setTimeout(R,a?0:A)))};return{stop:j,abort:()=>{f=!0,d=!0,clearTimeout(s);try{p&&'inactive'!==p.state&&p.stop()}catch{}T()}}}function B(e,t,n="owner",r,i=!1){return o()?f(e,t):y()?z(n,e,t,r,i):null}class I{lang='en-GB';interimResults=!1;continuous=!1;maxAlternatives=1;onresult=null;onerror=null;onend=null;l=null;start(){const e='customer'===t.APP_VARIANT?'owner':t.APP_VARIANT;if(this.l=B(()=>{},(e,t)=>{if(this.l=null,t)this.onerror?.({error:t});else if(e){const t=Object.assign([{transcript:e,confidence:1}],{isFinal:!0});this.onresult?.({resultIndex:0,results:[t]})}this.onend?.()},e,void 0,!0),!this.l)throw new Error('not-supported')}stop(){this.l?.stop()}abort(){const e=this.l;this.l=null,e?.abort(),e&&this.onend?.()}}const N=()=>w()?I:null;const W=(e=30)=>{try{n()?.navigator?.vibrate?.(e)}catch{}}},1173,[1171,807]); +__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.`},1174,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.currentCanChangeBookings=function(){const o=t.useSession.getState().meId;if(!o)return!0;const u=n.useOwner.getState().staff.find(n=>n.id===o&&n.active);return(0,s.canChangeBookings)(u)};var n=r(d[0]),t=r(d[1]),s=r(d[2])},1175,[863,866,992]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return o}}),e.validPastDate=n,Object.defineProperty(e,"ukHistoryDate",{enumerable:!0,get:function(){return s}}),e.parseHistoryInput=function(t){const o=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(o))return o;const n=/^(\d{1,2})[\s/.-]+(\d{1,2})[\s/.-]+(\d{4})$/.exec(o);if(!n)return;const s=`${n[3]}-${n[2].padStart(2,'0')}-${n[1].padStart(2,'0')}`,d=new Date(s+'T12:00:00Z');return Number.isNaN(d.getTime())||d.toISOString().slice(0,10)!==s?void 0:s},e.exactHistoryDate=function(t,o){if(1!==(t.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const s=t.match(/\b(\d{4}-\d{2}-\d{2})\b/);let d=s?.[1];if(!d){const o=t.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);o&&(d=`${o[3]}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`)}if(!d){const o=t.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];o&&(d=`${o[3]}-${String(n.indexOf(o[2].slice(0,3))+1).padStart(2,'0')}-${o[1].padStart(2,'0')}`)}return d&&n(d,o)?d:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(t){const n=`Booked covers on ${d(t.date)}: ${null===t.booked_covers?'not recorded':t.booked_covers}.`,s=t.bookings.map(t=>`${t.time??'Time not recorded'}: party size ${null===t.covers?'not recorded':`${t.covers} Covers`}; ${t.table?`table ${t.table}`:'table not recorded'}; ${t.status??'status not recorded'}${t.counted?'':', excluded from Booked covers'}.`);return[n,...s,t.historical_records?"Includes previous booking system history (incomplete).":'',o,t.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',t.missing_covers?`${t.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const t='Includes previous booking system history (incomplete)',o='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(t,o){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return!1;const n=new Date(t+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t&&t{const[o,n,s]=t.split('-');return`${s}/${n}/${o}`};const d=t=>new Date(t+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1176,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const f=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),k=c(t),h=k&&(0,n.validPastDate)(o,u)?`${f}:${o}:${y}`:'',[p,v]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void v({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&v({key:h,data:t,error:''})}).catch(t=>{e&&v({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:k,data:h&&p.key===h?p.data:null,error:h&&p.key===h?p.error:''}},_e.kitchenHistoryAccess=y,_e.lookupKitchenHistory=f,_e.useKitchenHistory=function(t,o,u,c,l=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),h=y(t),p=h&&(0,n.validPastDate)(o,c)&&(0,n.validPastDate)(u,c)&&o<=u?`${k}:${o}:${u}:${l}`:'',[v,w]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!p)return void w({key:'',data:null,error:''});let e=!0;return f(t,o,u).then(t=>{e&&w({key:p,data:t,error:''})}).catch(t=>{e&&w({key:p,data:null,error:t.message})}),()=>{e=!1}},[p,t,o,u]),{allowed:h,data:p&&v.key===p?v.data:null,error:p&&v.key===p?v.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:f}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(f||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}function y(e){const t=s.useSync.getState();return'staff'===t.kind&&t.venueSlug===e&&!!t.venueId&&['*','staff.manage','recipes.signoff','recipes.edit'].some(e=>t.perms.includes(e))}async function f(e,t,n){if(!y(e))throw new Error('Booking history needs the Head Chef app signed in to the venue.');const o=(0,u.getSupabase)(),{data:c,error:l}=await o.rpc('kitchen_booking_history',{p_venue:s.useSync.getState().venueId,p_from:t,p_to:n});if(l||!c||!Array.isArray(c.days))throw new Error('Booking history could not be loaded. Check the connection and try again.');return c}},1177,[31,807,1176,822,824,872]); +__d(function(_g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.clockAction=async function(n,u){if((0,t.privateClockVenue)(u.rid)&&'in'!==n)return c(n,u,{action:n,at:u.at,inside:null,unchecked:!0});const f=(0,a.areaOf)(u.rid),k=f.on&&null!=f.lat&&null!=f.lng,l=k?await(u.fixFn??r.getFix)():'unavailable';if((0,t.privateClockVenue)(u.rid)&&'object'==typeof l&&(!Number.isFinite(l.acc)||l.acc>150))return{ok:!1,message:'Your phone\u2019s location is not accurate enough to confirm you are at the pub. Enable precise location, step near a window and try again, or ask a manager to record your clock-in with a reason.'};const g=k&&'object'!=typeof l?(0,s.locWhere)():'browser',p=(0,o.gate)(f,n,k?l:'unavailable',u.at,g);if(!p.allowed){const a='object'==typeof l?void 0:'app'===g&&'denied'===l?'settings':'app-phone-off'===g?'location':'app-old'===g&&'denied'===l?'update':void 0;return'update'===a&&(0,s.checkAppUpdate)(),{ok:!1,message:(p.message??'You need to be at the venue.')+((0,t.privateClockVenue)(u.rid)?' Ask a manager to record your clock-in with a reason using Record it for someone.':''),fix:a}}const w=c(n,u,p.geo);return w.ok&&p.warn?{...w,warn:p.warn}:w},e.managerClockAction=function(t,a,r,s){const u=(0,o.overrideGeo)(t,a.at,r,s);if(!u)return{ok:!1,message:'Type a short reason (at least 3 letters).'};const f=n.useOwner.getState().staff.find(t=>t.id===a.staffId)?.name??'staff',k=c(t,a,u,{adjusted:{by:r.name,at:a.at,reason:u.override.reason}});if(k.ok){const o={in:'clocked in',out:'clocked out',break_start:'started a break for',break_end:'ended a break for'}[t],s=`${r.name} ${o} ${f} (manager, no location check): ${u.override.reason}`;n.useOwner.setState(t=>({attLog:[{id:`al-${Date.now().toString(36)}`,at:a.at,text:s},...t.attLog]}))}return k};var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),o=_r(d[3]),r=_r(d[4]),s=_r(d[5]);function c(a,o,r,s={}){const c=(0,t.venueClockGeo)(o.rid,r),u=c?!1!==c.inside:void 0,f=n.useOwner.getState(),k=(0,n.openShiftOf)(f.attendance,o.staffId,o.at);if('in'===a){if(k)return{ok:!1,message:'You\u2019re already clocked in.'};f.clock(o.staffId,o.date,'in',o.at,u);const t=(0,n.openShiftOf)(n.useOwner.getState().attendance,o.staffId,o.at);return t&&n.useOwner.getState().patchAttendance(t.id,{...o.offRota?{offRota:!0}:{},...s},c),{ok:!0,att:t&&n.useOwner.getState().attendance.find(a=>a.id===t.id)}}if(!k)return{ok:!1,message:'You\u2019re not clocked in.'};if('out'===a){let t=o.breakMins;if(o.addedBreak&&o.addedBreak>0&&!k.breaks?.length){const a=new Date(o.at).getTime(),r=new Date(Math.max(new Date(k.in).getTime(),a-6e4*o.addedBreak)).toISOString();n.useOwner.getState().patchAttendance(k.id,{breaks:[{start:r,end:o.at}],breakAddedAtClockOut:o.addedBreak}),t=Math.round((a-new Date(r).getTime())/6e4)}return n.useOwner.getState().clock(o.staffId,o.date,'out',o.at,u,t),n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}}return n.useOwner.getState().breakToggle(o.staffId,'break_start'===a?'start':'end',o.at)?(n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}):{ok:!1,message:'break_start'===a?'You\u2019re already on a break.':'You\u2019re not on a break.'}}},1178,[869,1294,863,870,871,1412]); +__d(function(_g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canEditCards",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canSignOffCards",{enumerable:!0,get:function(){return r}}),e.maySignOff=function(t,n){return'staff'!==t.role&&('head-chef'===t.role||('head-chef'===t.actual||!('owner'!==t.role&&'manager'!==t.role||'owner'!==t.actual&&'manager'!==t.actual)||!!n.createdBy&&t.name.trim()===n.createdBy.trim()&&'head-chef'===n.createdByRole))},Object.defineProperty(e,"SIGNER_ROLE_LABEL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"signerLabel",{enumerable:!0,get:function(){return o}}),e.cardActorFor=function(t,n,r){const i=r?'Head Chef'===r.level&&'staff'===r.role?'head-chef':r.role:n;return{name:t,role:n,actual:i}},Object.defineProperty(e,"MAX_RECIPE_PHOTOS",{enumerable:!0,get:function(){return a}}),e.cardPhotos=s,e.suggestForIngredient=d,e.suggestAllergens=u,Object.defineProperty(e,"suggestedBy",{enumerable:!0,get:function(){return f}}),e.unresolved=g,e.applySuggestions=function(t){const n={...t.allergens};for(const r of g(t))n[r]='contains';return n},Object.defineProperty(e,"cardState",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"STATE_LABEL",{enumerable:!0,get:function(){return h}}),e.signOffBlock=function(t){if(!t.dish.trim())return'Give the dish a name first.';const n=g(t);return n.length?`Check the suggested allergens first: ${n.map(p).join(', ')}.`:t.allergensConfirmed?null:'Confirm the allergen list first.'},Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"CONTENT_FIELDS",{enumerable:!0,get:function(){return y}}),e.editCard=function(t,n,r,i){const{confirmAllergens:o,...a}=n,l={...a};l.photos&&_(s({photo:l.photo??t.photo,photos:l.photos}),s(t))&&(delete l.photos,void 0!==l.photo&&l.photo!==(t.photo??s(t)[0])||delete l.photo);const c=Object.keys(l).filter(n=>!_(l[n],t[n]));let d={...t};for(const t of c)d[t]=l[t];const f=c.some(t=>'allergens'===t||'dismissed'===t||'ingredients'===t);f&&!_(u(d.ingredients),u(t.ingredients))&&(d.allergensConfirmed=void 0);f&&(c.includes('allergens')||c.includes('dismissed'))&&(d.allergensConfirmed=void 0);let m=!1;!o||d.allergensConfirmed||g(d).length||(d.allergensConfirmed={by:r,at:i},m=!0);const h=c.length>0||m,p=c.length>0&&!!t.signOff;if(!h)return{card:t,changed:!1,resetSignOff:!1};c.length&&(d={...d,signOff:null,version:t.version+1});return{card:{...d,updatedAt:i,updatedBy:r},changed:h,resetSignOff:p}},e.signOffCard=function(t,n,r){return{...t,signOff:{by:n,at:r},wasLive:!0,updatedAt:r,updatedBy:n}},e.unsignedOldestFirst=function(t,n){return t.filter(t=>!t.signOff).map((t,r)=>{const i=n(t);return{item:t,card:i,at:i?.createdAt||null,order:r}}).sort((t,n)=>(t.at&&n.at?t.at.localeCompare(n.at):t.at?-1:n.at?1:0)||t.order-n.order)},e.addedLabel=function(t){const n=t?new Date(t.length<=10?`${t}T12:00:00`:t):null;return n&&!isNaN(+n)?`Added ${n.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})}`:'Date not recorded'},e.allergenSentence=function(n){const r=t.ALLERGENS.filter(t=>'contains'===n[t.id]).map(t=>t.short.toLowerCase()),i=t.ALLERGENS.filter(t=>'may'===n[t.id]).map(t=>t.short.toLowerCase());return r.length||i.length?[r.length?`Contains ${r.join(', ')}.`:'',i.length?`May contain ${i.join(', ')}.`:''].filter(Boolean).join(' '):'No allergens listed yet.'},Object.defineProperty(e,"isRetiredMiniAnchors",{enumerable:!0,get:function(){return O}}),e.overlayItem=function(t,n){return n?{...t,name:n.dish,section:n.section,price:n.price,allergens:n.allergens,allergenNotes:n.allergenNotes,signOff:n.signOff?{by:n.signOff.by,at:n.signOff.at.slice(0,10)}:null,hidden:t.hidden||!n.signOff&&!n.wasLive||O(t.id)||O(n.menuItemId),recipeCardId:n.id}:O(t.id)?{...t,hidden:!0}:t},e.dishesFor=function(t,n){const r=t.filter(t=>!t.hidden),i=r.filter(t=>n.some(n=>'contains'===t.allergens[n])),o=r.filter(t=>!i.includes(t)&&n.some(n=>'may'===t.allergens[n])),a=r.filter(t=>!i.includes(t)&&!o.includes(t));return{contains:i,may:o,free:a}},e.filterCards=function(t,n,r,i="free-from"){const o=n.toLowerCase().split(/\s+/).filter(Boolean);return t.filter(t=>{const n=[t.dish,t.section,...t.ingredients.map(t=>t.name)].join(' ').toLowerCase();return!!o.every(t=>n.includes(t))&&(!r.length||('free-from'===i?r.every(n=>!t.allergens[n]):r.some(n=>!!t.allergens[n])))})},e.uuid=function(){const t=globalThis.crypto;if(t?.randomUUID)return t.randomUUID();const n=Array.from({length:16},()=>Math.floor(256*Math.random()));n[6]=15&n[6]|64,n[8]=63&n[8]|128;const r=n.map(t=>t.toString(16).padStart(2,'0')).join('');return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`},e.uuidFrom=function(t){let n='';for(let r=0;r<4;r++){let i=2166136261^2654435761*r;for(let n=0;n>>0;n+=i.toString(16).padStart(8,'0')}const r=n.slice(0,12)+'4'+n.slice(13,16)+(3&parseInt(n[16],16)|8).toString(16)+n.slice(17,32);return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`},Object.defineProperty(e,"RECIPE_CARD_EXTRA_COLUMNS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STEP_SEP",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"photoPath",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"RECIPE_PHOTO_BUCKET",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"RECIPE_CARD_TABLE",{enumerable:!0,get:function(){return S}}),e.cardToRow=function(t,n){return{row:{id:t.id,venue_id:n,dish:t.dish,ingredients:t.ingredients.map(({name:t,qty:n,unit:r,allergens:i})=>({name:t,qty:n,unit:r,...i?.length?{allergens:i}:{}})),method:t.steps.join(w),allergens:b(t.allergens,'contains'),may_contain:b(t.allergens,'may'),photo_url:!t.photo||t.photo.startsWith('local:')||t.photo.startsWith('asset:')?null:t.photo,signed_off_by:t.signOff?.by??null,signed_off_at:t.signOff?.at??null,updated_at:t.updatedAt},extra:{menu_item_id:t.menuItemId,section:t.section,price_pence:t.price,dismissed:t.dismissed,allergen_notes:t.allergenNotes??null,allergens_confirmed_by:t.allergensConfirmed?.by??null,allergens_confirmed_at:t.allergensConfirmed?.at??null,was_live:t.wasLive,origin:t.origin,version:t.version,updated_by:t.updatedBy}}},e.rowToCard=function(t,n,r={}){const i={};t.may_contain.forEach(t=>{i[t]='may'}),t.allergens.forEach(t=>{i[t]='contains'});const o=t.updated_at??(new Date).toISOString();return{id:t.id,restaurantId:n,menuItemId:r.menu_item_id??t.id,dish:t.dish,section:r.section??'Mains',price:r.price_pence??null,photo:t.photo_url??void 0,ingredients:t.ingredients.map((n,r)=>({id:`${t.id}-i${r}`,...n})),steps:t.method?t.method.split(w).filter(t=>t.trim()):[],allergens:i,dismissed:r.dismissed??[],allergenNotes:r.allergen_notes??void 0,allergensConfirmed:r.allergens_confirmed_by?{by:r.allergens_confirmed_by,at:r.allergens_confirmed_at}:void 0,signOff:t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:t.signed_off_at}:null,wasLive:r.was_live??!!t.signed_off_by,origin:r.origin??'new',version:r.version??1,createdAt:o,updatedAt:o,updatedBy:r.updated_by??''}};var t=_r(_d[0]);const n=t=>'head-chef'===t||'manager'===t||'owner'===t,r=t=>'head-chef'===t||'manager'===t||'owner'===t;const i={'head-chef':'Head Chef',manager:'Manager',owner:'Owner',staff:'Staff'},o=t=>`${t.name}, ${i[t.actual??t.role]}`;const a=5;function s(t){const n=(t.photos??[]).filter(t=>!!t);return[...t.photo&&!n.includes(t.photo)?[t.photo]:[],...n].slice(0,a)}const l=[[/\b(flour(?!y)|wheat|bread|crumb|panko|pastry|brioche|buns?\b|crouton|crostini|batter|beer|ale\b|lager|stout|barley|malt|rye|spelt|oat|couscous|semolina|pasta|penne|macaroni|spaghetti|noodle|biscuit|sponge|crumble|roux|tempura|digestive|self.raising)/i,['gluten']],[/\b(prawn|langoustine|lobster|crab|shrimp|crayfish|scampi|shellfish)/i,['crustaceans']],[/\b(mussel|scallop|clam|cockle|squid|calamari|octopus|whelk|winkle|oyster(?! mushroom)|oyster sauce)/i,['molluscs']],[/\b(egg|mayonnaise|mayo|aioli|tartare|hollandaise|meringue|custard|brioche|bearnaise)/i,['eggs']],[/\b(fish(?!er)|haddock|cod|salmon|hake|anchov|tuna|mackerel|trout|sea bass|monkfish|pollock|halibut|kipper|worcester|fish sauce|caesar)/i,['fish']],[/\b(peanut|groundnut|satay)/i,['peanuts']],[/\b(almond|hazelnut|walnut|cashew|pecan|pistachio|macadamia|brazil nut|praline|frangipane|marzipan|pesto)/i,['treenuts']],[/\b(soy|soya|tofu|edamame|miso|tamari|tempeh)/i,['soya']],[/\b(milk|butter(?!nut)|cream|cheese|cheddar|parmesan|mozzarella|brie|yoghurt|yogurt|cr[e\xe8]me|ghee|ice cream|custard|butterscotch|toffee|fudge|buttermilk|mascarpone|ricotta|whey)/i,['milk']],[/\b(celery|celeriac|stock cube|beef stock|chicken stock|veg(etable)? stock)/i,['celery']],[/\b(mustard|dijon|vinaigrette|piccalilli)/i,['mustard']],[/\b(sesame|tahini|hummus|houmous)/i,['sesame']],[/\b(wine|vinegar|dried apricot|dried fruit|sulphite|sulfite|prosecco|cider|port\b|sherry|dates?\b|raisin|sultana)/i,['sulphites']],[/\blupin/i,['lupin']]],c=[[/gluten.free|\bgf\b/i,'gluten'],[/dairy.free|vegan (butter|cheese|cream)|oat milk|plant.based/i,'milk'],[/egg.free|vegan mayo/i,'eggs']];function d(n){const r=new Set(n.allergens??[]);for(const[t,i]of l)t.test(n.name)&&i.forEach(t=>r.add(t));for(const[t,i]of c)t.test(n.name)&&!(n.allergens??[]).includes(i)&&r.delete(i);return t.ALLERGENS.map(t=>t.id).filter(t=>r.has(t))}function u(n){const r=new Set(n.flatMap(d));return t.ALLERGENS.map(t=>t.id).filter(t=>r.has(t))}const f=(t,n)=>t.filter(t=>d(t).includes(n)).map(t=>t.name);function g(t){return u(t.ingredients).filter(n=>!t.allergens[n]&&!t.dismissed.includes(n))}const m=t=>t.signOff?'signed-off':'awaiting',h={'signed-off':'Signed off',awaiting:'Awaiting sign-off'};const p=n=>t.ALLERGENS.find(t=>t.id===n)?.short??n,b=(n,r)=>t.ALLERGENS.filter(t=>r?n[t.id]===r:!!n[t.id]).map(t=>t.id),y=['dish','section','price','photo','photos','createdBy','ingredients','steps','allergens','dismissed','allergenNotes'],_=(t,n)=>JSON.stringify(t??null)===JSON.stringify(n??null);const O=t=>'a-mini'===t;const v={menu_item_id:'text',section:'text',price_pence:'integer null',dismissed:'text[]',allergen_notes:'text',allergens_confirmed_by:'text',allergens_confirmed_at:'timestamptz',was_live:'boolean',origin:'text',version:'integer',updated_by:'text'},w='\n',E=(t,n)=>`${t}/${n.id}-v${n.version}.jpg`,C='recipe-photos',S='recipe_cards'},1179,[819]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ACCIDENT_CATEGORIES",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"RIDDOR_CATEGORIES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"sid",{enumerable:!0,get:function(){return u}}),_e.isSeedAccident=S,_e.upgradeTempUnits=k,Object.defineProperty(_e,"useSafety",{enumerable:!0,get:function(){return w}});var e,t=r(_d[0]),i=r(_d[1]),n=r(_d[2]),a=r(_d[3]),s=(e=a)&&e.__esModule?e:{default:e},o=r(_d[4]),d=r(_d[5]),c=r(_d[6]);const l=['Near miss','Slip, trip or fall','Cut','Burn or scald','Manual handling','Struck by an object','Allergic reaction','Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days','Other'],p=['Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days'];let f=0;const u=e=>`${e}-${Date.now().toString(36)}${(f++).toString(36)}`,h=(e,t,i)=>({id:e,when:t,location:'',person:'',personType:'Staff',category:'Near miss',what:'',injury:'None',firstAid:'None needed',witnesses:'',reportedBy:'',reportedById:'',app:'staff',createdAt:`${t}:00`,...i});function y(){const e=new Date,t=(t,i)=>{const n=new Date(e);return n.setDate(n.getDate()-t),`${n.toISOString().slice(0,10)}T${i}`};return[h('acc-ex1',t(3,'19:40'),{location:'Kitchen pass',person:'Server (example)',category:'Near miss',what:'Example: water on the floor by the pass after the glass washer leaked. Nobody slipped.',firstAid:'None needed',witnesses:'Bar (example)',reportedBy:'Server (example)',reportedById:'st-4',app:'staff'}),h('acc-ex2',t(6,'12:15'),{location:'Kitchen: fryer section',person:'Head Chef (example)',category:'Burn or scald',what:'Example: splash of hot oil on the back of the hand while changing the basket.',injury:'Small burn, back of left hand',firstAid:'Cooled under running water for 20 minutes, sterile dressing',witnesses:'None',reportedBy:'Head Chef (example)',reportedById:'st-3',app:'chef'})]}function S(e){const t=({when:e,createdAt:t,...i})=>JSON.stringify(i);return y().some(i=>i.id===e.id&&t(i)===t(e))}function k(e){const t=Object.fromEntries(c.DEFAULT_POINTS.map(e=>[e.id,e])),i=new Set(['cp-prep','cp-bar','cp-freezer']);let n=e.map(e=>'cp-walkin'===e.id?{...e,archived:!0,due:[],aliases:[]}:i.has(e.id)?{...e,name:t[e.id].name,location:t[e.id].location,kind:t[e.id].kind,max:t[e.id].max,due:t[e.id].due,aliases:t[e.id].aliases,archived:!1}:e);const a=new Set(n.map(e=>e.id)),s=c.DEFAULT_POINTS.filter(e=>!a.has(e.id)),o=c.DEFAULT_POINTS.filter(e=>s.includes(e)&&('fridge'===e.kind||'freezer'===e.kind)),d=s.filter(e=>!o.includes(e));let l=-1;n.forEach((e,t)=>{'fridge'!==e.kind&&'freezer'!==e.kind||(l=t)}),n=[...n.slice(0,l+1),...o,...n.slice(l+1),...d];const p=n.filter(e=>'fridge'===e.kind||'freezer'===e.kind),f=[...p.filter(e=>'fridge'===e.kind),...p.filter(e=>'freezer'===e.kind)];let u=0;return n.map(e=>'fridge'===e.kind||'freezer'===e.kind?f[u++]:e)}const w=(0,o.create)()((0,d.persist)(e=>({points:c.DEFAULT_POINTS,entries:[],accidents:n.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:y(),probes:[],diary:[],daySigns:[],weekly:[],inspectorSends:[],logInspectorSend:t=>e(e=>({inspectorSends:[{...t,id:u('ins')},...e.inspectorSends??[]]})),addNote:t=>e(e=>({diary:[{...t,id:u('dn')},...e.diary??[]]})),signDay:t=>e(e=>({daySigns:[...(e.daySigns??[]).filter(e=>e.date!==t.date),t]})),signWeek:t=>e(e=>({weekly:[{...t,id:u('wk')},...(e.weekly??[]).filter(e=>e.week!==t.week)]})),addProbe:t=>e(e=>({probes:[...e.probes??[],{...t,id:u('pr'),status:'not-connected'}]})),removeProbe:t=>e(e=>({probes:(e.probes??[]).filter(e=>e.id!==t)})),addEntries:t=>e(e=>({entries:[...t.map(e=>({...e,id:`${u('hc')}${Math.random().toString(36).slice(2,7)}`})),...e.entries]})),setPoint:(t,i)=>e(e=>({points:e.points.map(e=>e.id===t?{...e,...i}:e)})),addPoint:t=>e(e=>({points:[...e.points,{...t,id:`${u('cp')}${Math.random().toString(36).slice(2,6)}`}]})),resetPoints:()=>e({points:c.DEFAULT_POINTS}),addAccident:t=>e(e=>({accidents:[{...t,id:u('acc'),createdAt:(new Date).toISOString()},...e.accidents]})),setRiddorNote:(t,i)=>e(e=>({accidents:e.accidents.map(e=>e.id===t?{...e,riddorNote:i}:e)}))}),{name:'covercharge-safety-v1',storage:(0,d.createJSONStorage)(()=>s.default),version:5,migrate:async(e,n)=>{if(t.LIVE_VENUE_BUILD&&e&&await(0,i.archiveChefCache)('safety',e),e&&n<2){const t=new Set((e.points??[]).map(e=>e.id));e.points=[...e.points??[],...c.DEFAULT_POINTS.filter(e=>!t.has(e.id))],e.diary=e.diary??[],e.daySigns=e.daySigns??[],e.weekly=e.weekly??[]}return e&&n<5&&(e.points=k(e.points??[])),t.LIVE_VENUE_BUILD&&e&&(e.accidents=(e.accidents||[]).filter(e=>!S(e))),e}}))},1180,[842,1198,5,1190,995,1191,1187]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"libraryRowId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"personRowId",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"tickId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"personKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"useDailyTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"tasksOf",{enumerable:!0,get:function(){return O}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]);const l=e=>(0,o.uuidFrom)(`daily-task-library:${e}`),y=(e,t)=>(0,o.uuidFrom)(`daily-tasks:${e}:${t}`),b=(e,t,i,s)=>(0,o.uuidFrom)(`daily-task-tick:${e}:${(0,u.tickKey)(t,i,s)}`),f=()=>(new Date).toISOString(),k=(e,t)=>`${e}|${t}`,p=e=>u.DEFAULT_LIBRARY.map((t,i)=>({id:(0,o.uuidFrom)(`daily-task-lib:${e}:${i}`),text:t})),L=(0,s.create)()((0,n.persist)((e,t)=>({library:{},people:{},ticks:[],ensure:i=>{t().library[i]||e(e=>({library:{...e.library,[i]:{items:p(i)}}}))},setLibrary:(t,i)=>e(e=>({library:{...e.library,[t]:{items:i,updatedAt:f()}}})),addLibrary:(e,i)=>{const s=(0,u.cleanTaskText)(i);if(!s)return;const n=t().library[e]?.items??p(e);n.some(e=>e.text.toLowerCase()===s.toLowerCase()&&!e.archived)||t().setLibrary(e,[...n,{id:(0,c.uuid)(),text:s}])},setTasks:(t,i,s)=>e(e=>({people:{...e.people,[k(t,i)]:{tasks:s,updatedAt:f()}}})),addTask:(e,i,s,n)=>{const o=(0,u.cleanTaskText)(s);if(!o)return;const l=t().people[k(e,i)]?.tasks??[];l.some(e=>e.text.toLowerCase()===o.toLowerCase())||t().setTasks(e,i,[...l,{id:(0,c.uuid)(),text:o,...n?{libraryId:n}:{}}])},toggleTick:(t,i,s,n,o)=>e(e=>{const u=b(t,i,s,n);if(e.ticks.some(e=>e.id===u))return{ticks:e.ticks.filter(e=>e.id!==u)};const c=new Date(Date.now()-12096e5).toISOString().slice(0,10);return{ticks:[...e.ticks.filter(e=>e.forDate>=c),{id:u,rid:t,staffRef:i,taskId:s,forDate:n,byRef:o.id,byName:o.name,at:f()}]}}),resetLibrary:e=>t().setLibrary(e,p(e))}),{name:'covercharge-daily-tasks-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)})),O=(e,t)=>L.getState().people[k(e,t)]?.tasks??[]},1181,[1190,995,1191,1179,1182,1099]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TASK_MAX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanTaskText",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"appliesOn",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tasksFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"tickKey",{enumerable:!0,get:function(){return u}}),e.progress=function(t,n,o,u,c){const s=i(t,c),f=new Set(n.filter(t=>t.staffRef===o&&t.forDate===u).map(t=>t.taskId));return{done:s.filter(t=>f.has(t.id)).length,total:s.length}},e.move=function(t,n,o){const i=n+o;if(n<0||i<0||n>=t.length||i>=t.length)return t;const u=[...t];return[u[n],u[i]]=[u[i],u[n]],u},Object.defineProperty(e,"hasTask",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_LIBRARY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TASK_DAY_NAMES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isHeadChefP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isKitchenP",{enumerable:!0,get:function(){return d}}),e.canEditTasks=function(t,n){return!!t&&('owner'===t.role||'manager'===t.role||!!l(t)&&(t.id!==n.id&&'staff'===n.role&&!l(n)&&d(n)))};const t=80,n=n=>n.replace(/\s+/g,' ').trim().slice(0,t),o=(t,n)=>!t.days||0===t.days.length||t.days.includes(n),i=(t,n)=>t.filter(t=>o(t,n)),u=(t,n,o)=>`${t}|${n}|${o}`;const c=(t,o)=>t.some(t=>t.text.toLowerCase()===n(o).toLowerCase()),s=['Restock the bar fridges','Wipe down the menus','Check the toilets','Set the tables','Polish glasses','Empty the bins','Clean the coffee machine','Take out the recycling'],f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=t=>'staff'===t.role&&('Head Chef'===t.level||/^head chef/i.test(t.job??'')),d=t=>'kitchen'===(t.dept??'').trim().toLowerCase()},1182,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LEGAL_LIMIT_MINS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_BREAK_RULES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"REMINDER_WINDOW_MINS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CHAIRS_TEXT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ANCHORAGE_CHAIRS_DAYS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultChairs",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AUDIENCE_LABEL",{enumerable:!0,get:function(){return s}}),e.clampRules=c,Object.defineProperty(e,"validTime",{enumerable:!0,get:function(){return d}}),e.ukClock=l,e.reminderDue=function(t,n){const i=l(n);if(t.paused||!d(t.time)||!t.days.includes(i.dow))return{due:!1,forDate:i.ymd};const o=f(t.time);return{due:i.mins>=o&&i.mins=t.shiftEnd))return null;const r=b(t).filter(n=>n.at<=t.now),i=r.length?r[r.length-1]:null;if(!i)return null;if(t.nowr?i:null}return i};const t=360,n={on:!0,afterMins:240,repeatMins:30,snoozeMins:15},r=180,i='Time to put the chairs up on the tables',o=[4,0],a=(t,n)=>'anchorage'===n?{id:t,text:i,days:[...o],time:'21:00',audience:'all',builtIn:'chairs',push:!0}:{id:t,text:i,days:[5,0],time:'21:00',audience:'all',builtIn:'chairs'},u=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],s={all:'Everyone on shift',foh:'Front of house',kitchen:'Kitchen'};function c(r){const i=(t,n,r,i)=>{const o=Math.round(Number(t));return Number.isFinite(o)?Math.min(i,Math.max(r,o)):n};return{on:!1!==r.on,afterMins:i(r.afterMins,n.afterMins,30,t),repeatMins:i(r.repeatMins,n.repeatMins,5,120),snoozeMins:i(r.snoozeMins,n.snoozeMins,5,60)}}const d=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t);function l(t){const n='number'==typeof t?new Date(t):t,r=Object.fromEntries(new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(n).map(t=>[t.type,t.value]));return{dow:u.indexOf(String(r.weekday).slice(0,3)),mins:60*Number(r.hour)+Number(r.minute),ymd:`${r.year}-${r.month}-${r.day}`}}const f=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));const m=(t,n)=>'all'===t||('kitchen'===t?n:!n);function b(t){const n=c(t.rules),r=t.clockIn??t.shiftStart;if(!n.on||void 0===r||t.hadBreak)return[];const i=r+216e5,o=Math.min(void 0!==t.rotaBreak&&t.rotaBreak>r?t.rotaBreak:r+6e4*n.afterMins,i),a=[{stage:1,at:o,label:void 0!==t.rotaBreak&&t.rotaBreak>r&&t.rotaBreak<=i?'Your break on the rota is now.':'Time for your break.'}],u=o+6e4*n.repeatMins;return a.push({stage:2,at:u,label:'Reminder: you haven\u2019t had your break yet.'}),i>u&&a.push({stage:3,at:i,label:'You\u2019ve worked 6 hours without a break. You need a 20-minute break (UK law).'}),a}},1183,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1184,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1185,[31,1081,1186,1391,1184]); +__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1186,[1190,995,1191]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"KIND_LABEL",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TEMP_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"isTempKind",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"SECTIONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"SECTION_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"sectionOf",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"initialsOf",{enumerable:!0,get:function(){return l}}),_e.unitAliases=u,Object.defineProperty(_e,"DEFAULT_POINTS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"limitText",{enumerable:!0,get:function(){return f}}),_e.inRange=p,_e.spokenNumber=y,_e.parseQuick=function(e,n){const r=n.filter(e=>!e.archived);return e.split(/[,;\n]+|\s+and\s+|\.\s+/i).map(e=>e.trim()).filter(Boolean).map(e=>{const n=e.toLowerCase().replace(/[\u2010\u2013]/g,'-').replace(/-(?!\d)/g,' '),o=` ${n.replace(/[^a-z0-9.\- ]/g,' ').replace(/\s+/g,' ')} `;let a,s=0,l='';for(const e of r)for(const n of[e.name.toLowerCase(),...e.aliases]){const t=n.replace(/-/g,' ').replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim();t&&o.includes(` ${t} `)&&t.length>s&&(a=e,s=t.length,l=t)}const c=y(l?n.replace(new RegExp(`(^|[^a-z0-9])${l.split(' ').map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&')).join('[^a-z0-9]+')}(?=$|[^a-z0-9])`),'$1 '):n);return/ (walk ?in|cold room) /.test(o)&&!/(walk|cold room)/.test(l)?{text:e,value:null,problem:'The walk-in is a dry store, not on the temperature log. Pick a fridge or freezer below.'}:a?t(a.kind)?null==c?{text:e,point:a,value:null,problem:'No temperature heard \u2014 type it in.'}:{text:e,point:a,value:c}:{text:e,point:a,value:null}:{text:e,value:c,problem:'Not sure which check this is \u2014 pick it below or type it.'}})},_e.missedChecks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const s of e){if(s.archived)continue;const e=s.due.filter(e=>k(e)<=o);if(!e.length)continue;const l=e[e.length-1],c=r.getTime()+6e4*k(e[0])-108e5,d=n.filter(e=>e.pointId===s.id&&new Date(e.at).getTime()>=c&&new Date(e.at).getTime()<=t.getTime()),u=e.length;d.lengthe.map(w).join(',')).join('\r\n')+'\r\n'},Object.defineProperty(_e,"SLOTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"SLOT_LABEL",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"SLOT_HINT",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"slotOf",{enumerable:!0,get:function(){return $}}),_e.todayTasks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const s of e){const e=s.archived?[]:[...s.due].sort();if(!e.length)continue;const l=r.getTime()+6e4*k(e[0])-108e5,c=n.filter(e=>e.pointId===s.id&&new Date(e.at).getTime()>=l&&new Date(e.at).getTime()<=t.getTime()).reverse().sort((e,n)=>e.at.localeCompare(n.at));e.forEach((e,n)=>{const t=c[n],r=k(e),l=t?'done':o>=r?'overdue':o>=r-60?'due':'upcoming';a.push({key:`${s.id}@${e}`,point:s,due:e,slot:$(e),status:l,entry:t})})}return a.sort((e,n)=>e.due.localeCompare(n.due)||e.point.name.localeCompare(n.point.name))},_e.unitStatus=function(e,n,t){const r=n.filter(n=>n.pointId===e.id&&null!=n.value).reverse().sort((e,n)=>e.at.localeCompare(n.at)),o=r[r.length-1];if(!o)return{rag:'none',history:r,why:'No readings yet'};const a=o.value;if(!p(e,a))return{rag:'red',latest:o,history:r,why:'Out of range'};const s=new Date(t);if(s.setHours(0,0,0,0),new Date(o.at).getTime()e.max-1||null!=e.min&&an.includes(e),r=['cross','cleaning','chilling','cooking','management'],o={cross:'Cross-contamination & allergens',cleaning:'Cleaning',chilling:'Chilled storage & cooling',cooking:'Cooking, reheating & hot holding',management:'Management & records'},a={fridge:'chilling',freezer:'chilling',cool:'chilling',delivery:'chilling',cook:'cooking',hothold:'cooking',cleaning:'cleaning',allergen:'cross',check:'management'},s=e=>e.section??a[e.kind],l=e=>e.replace(' (example)','').split(/\s+/).filter(Boolean).map(e=>e[0]).join('').slice(0,3).toUpperCase(),c={1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten'},d={1:'first',2:'second',3:'third',4:'fourth',5:'fifth',6:'sixth',7:'seventh',8:'eighth',9:'ninth',10:'tenth'};function u(e,n){const t=e.trim().toLowerCase().replace(/\s+/g,' ');if(!t)return[];const r=(n??'').trim().toLowerCase(),o=t.replace(/^(downstairs|upstairs|kitchen|cellar|basement|back|front|bar)\s+/,'').replace(r&&t.startsWith(r+' ')?new RegExp('^'+r.replace(/[.*+?^${}()|[\]\\]/g,'\\$&')+'\\s+'):/^$/,''),a=new Set([t,o]);for(const e of[t,o]){const n=e.match(/^(.*\S)\s+(\d{1,2})$/);n&&c[n[2]]&&(a.add(`${n[1]} ${c[n[2]]}`),a.add(`${n[1]} number ${n[2]}`),e!==o||/\s/.test(n[1])||a.add(`${d[n[2]]} ${n[1]}`))}return[...a].filter(Boolean)}const m=[{id:'cp-walkin',name:'Walk-in fridge',kind:'fridge',max:5,due:[],aliases:[],archived:!0},{id:'cp-prep',name:'Downstairs fridge 1',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 1')},{id:'cp-bar',name:'Downstairs fridge 2',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 2')},{id:'cp-fridge3',name:'Downstairs fridge 3',location:'Downstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Downstairs fridge 3')},{id:'cp-fridge4',name:'Upstairs fridge 4',location:'Upstairs',kind:'fridge',max:5,due:['09:00','16:00'],aliases:u('Upstairs fridge 4')},{id:'cp-freezer',name:'Downstairs freezer 1',location:'Downstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Downstairs freezer 1')},{id:'cp-freezer2',name:'Upstairs freezer 2',location:'Upstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Upstairs freezer 2')},{id:'cp-freezer3',name:'Upstairs freezer 3',location:'Upstairs',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:u('Upstairs freezer 3')},{id:'cp-cook',name:'Cooking: core temperature',kind:'cook',min:75,due:[],aliases:['core','cook','cooking','probe']},{id:'cp-cool',name:'Cooling: within 90 minutes',kind:'cool',max:8,due:[],aliases:['cooling','cool']},{id:'cp-hothold',name:'Hot hold: bain-marie',kind:'hothold',min:63,due:['18:00'],aliases:['hot hold','bain marie','bain-marie','hothold']},{id:'cp-del-chill',name:'Delivery: chilled',kind:'delivery',max:8,due:[],aliases:['chilled delivery','delivery chilled','delivery']},{id:'cp-del-frozen',name:'Delivery: frozen',kind:'delivery',max:-15,due:[],aliases:['frozen delivery','delivery frozen']},{id:'cp-clean',name:'Close-down clean signed off',kind:'cleaning',due:['23:00'],aliases:['cleaning','clean down','close down']},{id:'cp-allergen',name:'Allergen matrix checked against today\u2019s specials',kind:'allergen',due:['11:00'],aliases:['allergen','allergens']},{id:'cp-open-equip',name:'Fridges, freezers and other equipment working',kind:'check',section:'management',due:['09:00'],aliases:['equipment']},{id:'cp-open-staff',name:'Staff fit for work, in clean work clothes',kind:'check',section:'management',due:['09:00'],aliases:['staff fit']},{id:'cp-open-surfaces',name:'Prep areas, surfaces and utensils clean and disinfected',kind:'cleaning',due:['09:00'],aliases:['surfaces','prep areas']},{id:'cp-open-pests',name:'No signs of pests',kind:'check',section:'cleaning',due:['09:00'],aliases:['pests','pest']},{id:'cp-open-hands',name:'Hand-wash basins: hot water, soap and paper towels',kind:'check',section:'cross',due:['09:00'],aliases:['hand wash','handwash','soap']},{id:'cp-open-probe',name:'Probe thermometer working, probe wipes available',kind:'check',section:'management',due:['09:00'],aliases:['probe wipes','thermometer']},{id:'cp-mid-boards',name:'Raw and ready-to-eat kept apart; colour-coded boards in use',kind:'check',section:'cross',due:['12:00'],aliases:['boards','raw and ready to eat']},{id:'cp-close-stored',name:'Food covered, labelled, dated and put away',kind:'check',section:'chilling',due:['22:00'],aliases:['labelled','covered']},{id:'cp-close-useby',name:'Food past its use-by date thrown away',kind:'check',section:'chilling',due:['22:00'],aliases:['use by','use-by']},{id:'cp-close-waste',name:'Waste removed and bins relined',kind:'check',section:'cleaning',due:['22:00'],aliases:['waste','bins']}],f=e=>null!=e.min&&null!=e.max?`${e.min}\xb0C to ${e.max}\xb0C`:null!=e.max?`${e.max}\xb0C or colder`:null!=e.min?`${e.min}\xb0C or hotter`:'Done / not done';function p(e,n){return(null==e.min||n>=e.min)&&(null==e.max||n<=e.max)}const h={zero:0,nought:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90};function y(e){const n=e.toLowerCase().replace(/\u2212/g,'-').replace(/degrees?|\xb0c?|celsius|centigrade/g,' '),t=/\b(minus|negative)\b/.test(n),r=n.match(/-?\d+(?:[.,]\d+)?/);if(r){const e=Number(r[0].replace(',','.'));return t&&e>0?-e:e}const o=n.split(/[^a-z]+/).filter(Boolean);let a=null,s=null,l=!1;for(const e of o)if('point'!==e){if(e in h){if(l){s=h[e];break}a=(a??0)+h[e]}}else l=!0;if(null==a)return null;const c=null!=s?Number(`${a}.${s}`):a;return t?-c:c}const k=e=>{const[n,t]=e.split(':').map(Number);return 60*n+t};const b=e=>null!=e.value?`${e.value}\xb0C`:e.done?'Done':'Not done',w=e=>{const n=null==e?'':String(e);return/[",\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n},v=['Date','Time','Check','Type','Reading','Safe limit','Result','Corrective action','Note','Recorded by','Entry'];function D(n,t){return n.map(n=>{const r=new Date(n.at),o=t.find(e=>e.id===n.pointId);return[r.toLocaleDateString('en-GB'),r.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),n.name,e[n.kind],b(n),o?f(o):'',n.ok?'OK':'OUT OF RANGE',n.corrective??'',n.note??'',n.by,'probe'===n.source?'Wireless probe':'voice'===n.source?'Voice (confirmed)':'Typed']})}const O=['opening','midday','closing'],x={opening:'Opening',midday:'Midday',closing:'Closing'},C={opening:'until 11:00',midday:'11:00 to 16:00',closing:'from 16:00'},$=e=>{const n=k(e);return n<660?'opening':n<960?'midday':'closing'};const z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,T=['Opening and closing checks were done every day (or the reason is in the diary)','Every out-of-range reading has a corrective action','Probe thermometers checked (iced water / boiling water) this week','Allergen information is up to date for menu and special changes','Cleaning schedule followed; no signs of pests','Staff trained on any changed safe methods']},1187,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setMenuCardBridge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"menuCardBridge",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveItem",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveMenu",{enumerable:!0,get:function(){return m}}),e.sortMenu=c;var t=r(d[0]);let n=null;const o=t=>{n=t},u=()=>n,i=o=>(0,t.overlayItem)(o,n?.cardFor(o.id)),m=t=>c(t.map(i));function c(t){return t.some(t=>'number'==typeof t.sort)?t.map((t,n)=>({m:t,i:n,k:'number'==typeof t.sort?t.sort:10*n})).sort((t,n)=>t.k-n.k||t.i-n.i).map(t=>t.m):t}},1188,[1179]); +__d(function(_g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nextTablesFree=function(t,r,o,l,u=[]){const m=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,f=(0,a.lastFoodOn)(t,m),d=f?new Date(`${m}T${f.time}:00`):null,b=t=>o.filter(a=>a.date===m&&'confirmed'===a.status&&(a.table??'').split('+').map(t=>t.trim()).includes(t)).map(t=>new Date(`${t.date}T${t.time}:00`)).filter(t=>t>=s(l,-20)).sort((t,a)=>t.getTime()-a.getTime())[0],c=[],g=[];for(const o of Object.values(r)){const r=o.table.name,m=b(r);if('free'===o.status){(!m||m>s(l,60))&&c.push(r);continue}if(!n.includes(o.status)||!o.booking)continue;const f=o.booking,h=f.seatedAt?new Date(f.seatedAt):new Date(`${f.date}T${f.time}:00`),$=(0,a.dwellFor)(t,f.partySize,u);let w=s(h,$.mins),T='maybe',p=`seated ${Math.max(0,Math.round((l.getTime()-h.getTime())/6e4))} min, usual ${$.mins} min`;'bill'===o.status?(w=s(l,10),T='likely',p='bill requested'):'dessert'===o.status?(w=new Date(Math.min(w.getTime(),s(l,25).getTime())),T='likely',p='on dessert'):'mains'===o.status&&(w=new Date(Math.min(Math.max(w.getTime(),s(l,35).getTime()),s(l,60).getTime())),p='mains out'),w=d?{drinksOnly:!0}:{}})}g.sort((t,a)=>t.at.getTime()-a.at.getTime());const h=Object.values(r).filter(t=>'blocked'!==t.status).length,$=h>0&&c.length<=Math.max(1,Math.round(.1*h));return{full:$,freeNow:c,list:g,waitFor:t=>g.find(a=>a.seats>=t)??null}},Object.defineProperty(e,"hhmm",{enumerable:!0,get:function(){return r}}),e.nextFreeSentence=function(a,n){if(a.freeNow.length&&!a.full)return`There are ${a.freeNow.length} tables free now: ${a.freeNow.slice(0,4).map(t=>`table ${t}`).join(', ')}.`;const s=a.list[0];if(!s)return a.freeNow.length?`${(0,t.tableNumbers)(a.freeNow[0])} is free now.`:'No table is due to free up before the bookings that follow; check the bookings list.';const o=Math.max(5,Math.round((s.at.getTime()-n.getTime())/6e4)),l=a.waitFor(2),u=a.waitFor(4);return`Next table free about ${r(s.at)} (table ${s.table}, ${s.seats} seats), ${s.confidence}, in about ${o} minutes.${l?` A table for 2: about ${r(l.at)}.`:''}${u?` A table for 4: about ${r(u.at)}.`:''}${s.drinksOnly?' That\u2019s after last food orders, so drinks only.':''}`};var t=_r(_d[0]),a=_r(_d[1]);const n=['seated','mains','dessert','bill'],s=(t,a)=>new Date(t.getTime()+6e4*a);const r=t=>`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},1189,[812,814]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),f={getItem:e=>u.default.getItem((0,n.venueKey)(e)),setItem:(e,t)=>u.default.setItem((0,n.venueKey)(e),t),removeItem:e=>u.default.removeItem((0,n.venueKey)(e))}},1190,[1199,5]); +__d(function(g,_r,i,_a3,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"combine",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"createJSONStorage",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"devtools",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"persist",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"redux",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"subscribeWithSelector",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"unstable_ssrSafe",{enumerable:!0,get:function(){return S}});const e=(e,t)=>(n,r,o)=>(o.dispatch=t=>(n(n=>e(n,t),!1,t),t),o.dispatchFromDevtools=!0,{dispatch:(...e)=>o.dispatch(...e),...t}),t=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,n=new Map,r=e=>{const t=n.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},o=(e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const o=n.get(r.name);if(o)return{type:"tracked",store:e,...o};const s={connection:t.connect(r),stores:{}};return n.set(r.name,s),{type:"tracked",store:e,...s}},s=(e,t,r)=>{if(void 0===t)return;const o=n.get(e);(null==o?void 0:o.stores[t])===r&&(delete o.stores[t],0===Object.keys(o.stores).length&&n.delete(e))},a=/^at (?:new |async )?(.+?) \(/,l=/^([^@]+)@/;function c(e){var t,n,r;if(!e)return;const o=e.split("\n"),s=o.findIndex(e=>e.includes("api.setState"));if(s<0)return;const c=(null==(t=o[s+1])?void 0:t.trim())||"";return(null==(n=a.exec(c))?void 0:n[1])||(null==(r=l.exec(c))?void 0:r[1])}const u=(e,a={})=>(l,u,p)=>{const{enabled:f,anonymousActionType:y,store:h,...b}=a;let S;try{S=(null!=f?f:"production"!==(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0))&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!S)return e(l,u,p);const{connection:O,..._}=o(h,S,b);let w,E=!0;p.setState=(e,t,n)=>{const o=l(e,t);if(!E)return o;const s=void 0===n?{type:y||c((new Error).stack)||"anonymous"}:"string"==typeof n?{type:n}:n;return void 0===h?(null==O||O.send(s,u()),o):(null==O||O.send({...s,type:`${h}/${s.type}`},{...r(b.name),[h]:p.getState()}),o)},p.devtools={cleanup:()=>{null==w||w(),w=void 0,s(b.name,h,p),void 0!==h&&n.has(b.name)||!O||"function"!=typeof O.unsubscribe||O.unsubscribe()}};const I=(...e)=>{const t=E;E=!1,l(...e),E=t},j=e(p.setState,u,p);if("untracked"===_.type?null==O||O.init(j):(_.stores[_.store]=p,null==O||O.init(Object.fromEntries(Object.entries(_.stores).map(([e,t])=>[e,e===_.store?j:t.getState()])))),t(p)){let e=!1;const t=p.dispatch;p.dispatch=(...n)=>{"production"===(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0)||"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return w=O.subscribe(e=>{var n;const o="object"==typeof b.serialize?b.serialize.reviver:void 0;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):v(e.payload,o,e=>{if("__setState"===e.type){if(void 0===h)return void I(e.state);1!==Object.keys(e.state).length&&console.error("\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");const t=e.state[h];if(null==t)return;return void(JSON.stringify(p.getState())!==JSON.stringify(t)&&I(t))}t(p)&&p.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return I(j),void 0===h?null==O?void 0:O.init(p.getState()):null==O?void 0:O.init(r(b.name));case"COMMIT":return void 0===h?void(null==O||O.init(p.getState())):null==O?void 0:O.init(r(b.name));case"ROLLBACK":return v(e.state,o,e=>{if(void 0===h)return I(e),void(null==O||O.init(p.getState()));I(e[h]),null==O||O.init(r(b.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return v(e.state,o,e=>{void 0!==h?JSON.stringify(p.getState())!==JSON.stringify(e[h])&&I(e[h]):I(e)});case"IMPORT_STATE":{const{nextLiftedState:t}=e.payload,r=null==(n=t.computedStates.slice(-1)[0])?void 0:n.state;if(!r)return;return I(void 0===h?r:r[h]),void(null==O||O.send(null,t))}case"PAUSE_RECORDING":return E=!E}return}}),j},v=(e,t,n)=>{let r;try{r=JSON.parse(e,t)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&n(r)},p=e=>(t,n,r)=>{const o=r.subscribe;r.subscribe=(e,t,n)=>{let s=e;if(t){const o=(null==n?void 0:n.equalityFn)||Object.is;let a=e(r.getState());s=n=>{const r=e(n);if(!o(a,r)){const e=a;t(a=r,e)}},(null==n?void 0:n.fireImmediately)&&t(a,a)}return o(s)};return e(t,n,r)};function f(e,t){return(...n)=>Object.assign({},e,t(...n))}function y(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var r;const o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),s=null!=(r=n.getItem(e))?r:null;return s instanceof Promise?s.then(o):o(s)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const h=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>h(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>h(t)(e)}}},b=(e,t)=>(n,r,o)=>{let s={storage:y(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},a=!1,l=0;const c=new Set,u=new Set;let v=s.storage;if(!v)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...e)},r,o);const p=()=>{const e=s.partialize({...r()});return v.setItem(s.name,{state:e,version:s.version})},f=o.setState;o.setState=(...e)=>(f(...e),p());const b=e((...e)=>(n(...e),p()),r,o);let S;o.getInitialState=()=>b;const O=()=>{var e,t;if(!v)return;const o=++l;a=!1,c.forEach(e=>{var t;return e(null!=(t=r())?t:b)});const f=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=r())?e:b))||void 0;return h(v.getItem.bind(v))(s.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];if(s.migrate){const t=s.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(o!==l)return;const[a,c]=e;return S=s.merge(c,null!=(t=r())?t:b),n(S,!0),a?p():void 0}).then(()=>{o===l&&(null==f||f(r(),void 0),S=r(),a=!0,u.forEach(e=>e(S)))}).catch(e=>{o===l&&(null==f||f(void 0,e))})};return o.persist={setOptions:e=>{s={...s,...e},e.storage&&(v=e.storage)},clearStorage:()=>{++l,null==v||v.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>O(),hasHydrated:()=>a,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},s.skipHydration||O(),S||b};function S(e,t="undefined"==typeof window){return(n,r,o)=>{if(!t)return e(n,r,o);const s=()=>{throw new Error("Cannot set state of Zustand store in SSR")};return o.setState=s,e(s,r,o)}}},1191,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useKitchenExtra",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isManagerish",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isKitchenStaff",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"kitchenByRule",{enumerable:!0,get:function(){return l}}),_e.inKitchen=b,_e.inChannel=function(e,t){return!!t&&(e.startsWith('dm:')?e.split(':').slice(1).includes(t.id):'all'===e||('kitchen'===e?b(t):'managers'===e?o(t):'foh'===e&&(o(t)||/front|bar|server|waiting/i.test(t.job))))},Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return h}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},c=r(d[1]),a=r(d[2]);const u=(0,c.create)()((0,a.persist)(e=>({extra:{},set:(t,n)=>e(e=>{const c={...e.extra};return null==n?delete c[t]:c[t]=n,{extra:c}})}),{name:'covercharge-kitchen-chat-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default)})),o=e=>!!e&&'staff'!==e.role,s=e=>!!e&&/head chef/i.test((e.level??'')+' '+e.job),f=e=>!!e&&(/^kitchen$/i.test(e.dept??'')||/chef|kitchen|\bkp\b|porter/i.test(e.job)),l=e=>!!e&&(o(e)||s(e)||f(e));function b(e){if(!e||!e.active)return!1;return u.getState().extra[e.id]??l(e)}const h=(e,t)=>`dm:${[e,t].sort().join(':')}`},1192,[1190,995,1191]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_PALETTE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_DISPLAY",{enumerable:!0,get:function(){return o}});const t={bg:'#1A1A1A',surface:'#222222',surface2:'#292929',border:'#62675E',gold:'#7DB754',goldLight:'#AED28E',goldTint:'#25321E',goldMuted:'#A1C783',tile:'#222222',tilePressed:'#2D3428',accentBg:'rgba(125,183,84,0.13)',accentBorder:'rgba(125,183,84,0.55)',onGold:'#1A1A1A',ok:'#AED28E',okBg:'#25321E',blue:'#AED28E',blueBg:'#25321E'},o={quietBorder:'rgba(125,183,84,0.55)',quietPressed:'rgba(125,183,84,0.16)',primaryPressed:'#6D9F49'}},1193,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_LOCATION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WILDINGS_ADDRESS",{enumerable:!0,get:function(){return t}}),e.withWildingsAddress=function(r){return'wildings'===r.id?{...r,location:n,address:t}:r},e.withWildingsQuestionnaireAddress=function(n,r){return'wildings'===n&&r?{...r,venue:{...r.venue,address:t}}:r};const n='Maidens, KA26 9NR',t='Maidens Road, Maidens, KA26 9NR'},1194,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.sampleFingerprint=i,e.stripOwnerLiveSamples=function(n){const a={};for(const[s,o]of Object.entries(t.OWNER_SAMPLE_HASHES)){const t=n[s]||[];a[s]=t.filter(t=>!o.includes(i(t)))}a.chat=(n.chat||[]).filter(t=>!(0,s.isSeedChefChat)(t));const o=(n.changeRequests||[]).length-a.changeRequests.length;o&&(a.changesUsed=Math.max(0,(n.changesUsed||0)-o));return a},e.stripCoreLiveSamples=function(a){const c={...(0,n.stripCoreChefSamples)(a)};c.giftCards=(a.giftCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.giftCards.includes(i(s))),c.stampCards=(a.stampCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.stampCards.includes(i(s))),c.ratings=(a.ratings||[]).filter(t=>!(/^rt-[123]$/.test(t.id)&&(0,s.demoActor)(t.customerName))),i(a.customer)===t.LEGACY_CUSTOMER_HASH&&(c.customer={...a.customer,id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}});return c.restaurants=(a.restaurants||[]).filter(t=>!('saltmarsh'===t.id&&['The Venue','Saltmarsh Bistro'].includes(t.name))),c.menu=(c.menu||a.menu||[]).filter(t=>'saltmarsh'!==t.restaurantId).map(t=>t.signOff?t:o(t)),c};var t=r(d[0]),s=r(d[1]),n=r(d[2]);const a=t=>Array.isArray(t)?t.map(a):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([,t])=>void 0!==t&&'function'!=typeof t).sort(([t],[s])=>ts?1:0).map(([t,s])=>[t,a(s)])):t;function i(t){const s=JSON.stringify(a(t))??"null";let n=2166136261;for(let t=0;t>>0).toString(16)}const o=t=>Array.isArray(t)?t.map(o):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).map(([t,s])=>[t,'allergenNotes'===t&&'string'==typeof s&&/\(example\)/i.test(s)?'':o(s)])):t},1195,[1196,1084,1197]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"OWNER_SAMPLE_HASHES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CORE_SAMPLE_HASHES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"LEGACY_CUSTOMER_HASH",{enumerable:!0,get:function(){return b}});const c={referrals:["43f09bc0","c438fbad","96bf8c62","3399d421"],coats:["f51097ad","2f7efa3a"],merch:["ef6e14e","dbbc0999","dc233c1d"],merchOrders:["13b15512","bc27f242"],offers:["ad0fcde0","59e6c0cf"],photos:["53a60fd9","ab778a74","95de43cd"],changeRequests:["81c5be12","6819542c"],lost:["5bbf0d77","7d3aa9ed","850c049e"],campaigns:["9cdf8346","82150e7"],suppliers:["41df06e7","466e32ac","fa3d8eea","dfafa674","1e26fbd0","c195b120","5fc49e74","6aa8b0af","602fc2e4"],supplierOrders:["22636226","464d6a6a"]},f={giftCards:["b1bba36d","f029bc0e"],stampCards:["e7bedf6f","a3c8404d"]},b="4b1e9971"},1196,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.stripCoreChefSamples=function(n){return{bookings:(n.bookings||[]).filter(n=>!((0,e.isAnchorage)(n.restaurantId)&&t[n.id]===n.name)),orders:(n.orders||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('ord-seed-1'===t.id&&'R. Gilmour'===t.customerName||'ord-seed-2'===t.id&&'Table 3 guest'===t.customerName))),waitlist:(n.waitlist||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('wl-1'===t.id&&'Paterson'===t.name||'wl-2'===t.id&&'Duncan'===t.name))),menu:(n.menu||[]).map(t=>(0,e.isAnchorage)(t.restaurantId)&&(0,e.demoActor)(t.signOff?.by)?{...t,signOff:null}:t),events:(n.events||[]).filter(e=>!(e.example&&('anchorage'===e.restaurantId||null===e.restaurantId))),audit:(n.audit||[]).filter(e=>!('anchorage'===e.restaurantId&&/Example sign-off \(demo\)/i.test(e.text)))}};var e=r(d[0]);const t={'bk-101':'Campbell','bk-102':'Fraser','bk-103':'McLeod','bk-104':'Kerr','bk-105':'Wallace','bk-106':'Boyd','bk-107':'Hamilton','bk-108':'Stewart','bk-109':'Murray'}},1197,[1084]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.archiveChefCache=async function(e,t){const n=JSON.stringify(t);let o=2166136261;for(let e=0;e>>0).toString(16)}`;const c=await i.default.getItem(s);if(c){if(JSON.stringify(JSON.parse(c).rows)===n)return;s+=`:${Date.now()}`}await i.default.setItem(s,JSON.stringify({at:(new Date).toISOString(),store:e,rows:t}))};var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e}},1198,[1190]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAsyncStorage",{enumerable:!0,get:function(){return n.useAsyncStorage}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=u.default},1199,[1200,1204]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return i}});var e,t=r(d[0]);const o=((e=t)&&e.__esModule?e:{default:e}).default.bind({concatArrays:!0,ignoreUndefined:!0});function n(e,t){const n=window.localStorage.getItem(e);if(n){const l=JSON.parse(n),c=JSON.parse(t),s=JSON.stringify(o(l,c));window.localStorage.setItem(e,s)}else window.localStorage.setItem(e,t)}function l(e,t){return new Promise((o,n)=>{try{const n=e();t?.(null,n),o(n)}catch(e){t?.(e),n(e)}})}function c(e,t,o){return Promise.all(e).then(e=>{const n=o?.(e)??null;return t?.(null,n),Promise.resolve(n)},e=>(t?.(e),Promise.reject(e)))}const s={getItem:(e,t)=>l(()=>window.localStorage.getItem(e),t),setItem:(e,t,o)=>l(()=>window.localStorage.setItem(e,t),o),removeItem:(e,t)=>l(()=>window.localStorage.removeItem(e),t),mergeItem:(e,t,o)=>l(()=>n(e,t),o),clear:e=>l(()=>window.localStorage.clear(),e),getAllKeys:e=>l(()=>{const e=window.localStorage.length,t=[];for(let o=0;o{},multiGet:(e,t)=>c(e.map(e=>s.getItem(e)),t,t=>t.map((t,o)=>[e[o],t])),multiSet:(e,t)=>c(e.map(e=>s.setItem(e[0],e[1])),t),multiRemove:(e,t)=>c(e.map(e=>s.removeItem(e)),t),multiMerge:(e,t)=>c(e.map(e=>s.mergeItem(e[0],e[1])),t)};var i=s},1200,[1201]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},1201,[1202]); +__d(function(g,r,i,a,m,e,d){'use strict';const t=r(d[0]),{hasOwnProperty:n}=Object.prototype,{propertyIsEnumerable:o}=Object,c=(t,n,o)=>Object.defineProperty(t,n,{value:o,writable:!0,enumerable:!0,configurable:!0}),s=this,f={concatArrays:!1,ignoreUndefined:!1},l=t=>{const c=[];for(const o in t)n.call(t,o)&&c.push(o);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(t);for(const s of n)o.call(t,s)&&c.push(s)}return c};function u(n){return Array.isArray(n)?y(n):t(n)?p(n):n}function y(t){const n=t.slice(0,0);return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}function p(t){const n=null===Object.getPrototypeOf(t)?Object.create(null):{};return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}const b=(t,n,o,s)=>(o.forEach(o=>{void 0===n[o]&&s.ignoreUndefined||(o in t&&t[o]!==Object.getPrototypeOf(t)?c(t,o,h(t[o],n[o],s)):c(t,o,u(n[o])))}),t),O=(t,o,s)=>{let f=t.slice(0,0),y=0;return[t,o].forEach(o=>{const p=[];for(let s=0;s!p.includes(t)),s)}),f};function h(n,o,c){return c.concatArrays&&Array.isArray(n)&&Array.isArray(o)?O(n,o,c):t(o)&&t(n)?b(n,o,l(o),c):u(o)}m.exports=function(...n){const o=h(u(f),this!==s&&this||{},f);let c={_:{}};for(const s of n)if(void 0!==s){if(!t(s))throw new TypeError('`'+s+'` is not an Option Object');c=h(c,{_:s},o)}return c._}},1202,[1203]); +__d(function(g,r,i,a,m,e,d){'use strict';m.exports=t=>{if('[object Object]'!==Object.prototype.toString.call(t))return!1;const o=Object.getPrototypeOf(t);return null===o||o===Object.prototype}},1203,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAsyncStorage=function(e){return{getItem:(...t)=>u.default.getItem(e,...t),setItem:(...t)=>u.default.setItem(e,...t),mergeItem:(...t)=>u.default.mergeItem(e,...t),removeItem:(...t)=>u.default.removeItem(e,...t)}};var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1204,[1200]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"createStore",{enumerable:!0,get:function(){return n}});const t=t=>{let n;const c=new Set,o=(t,o)=>{const s="function"==typeof t?t(n):t;if(!Object.is(s,n)){const t=n;n=(null!=o?o:"object"!=typeof s||null===s)?s:Object.assign({},n,s),c.forEach(c=>c(n,t))}},s=()=>n,u={setState:o,getState:s,getInitialState:()=>l,subscribe:t=>(c.add(t),()=>c.delete(t))},l=n=t(o,s,u);return u},n=n=>n?t(n):t},1205,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"create",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=r(d[1]);const c=e=>e;function o(e,t=c){const u=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return n.default.useDebugValue(u),u}const s=e=>{const t=(0,u.createStore)(e),n=e=>o(t,e);return Object.assign(n,t),n},l=e=>e?s(e):s},1206,[31,1205]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return p}}),_e.defaultSimStart=function(e=new Date){const t=new Date(e),r=(5-t.getDay()+7)%7;return t.setDate(t.getDate()+r),t.setHours(17,30,0,0),t},_e.buildSeed=function(u){if(r.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE){const e=I(u);return{...e,restaurants:e.restaurants.filter(e=>'anchorage'===e.id),menu:c.anchorageMenu.map(e=>({...e,signOff:null})),bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:e.events.filter(e=>!e.example),ratings:[],walkIns:{},counters:{order:0,table:0,booking:0},customer:{...e.customer,id:'',referralCode:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}}}}return t.IS_ISOLATED_VENUE?{restaurants:[t.IS_QUEUED_VENUE?(0,e.queuedRestaurant)(t.VENUE_RID):t.IS_ABBOTSFORD?n.ABBOTSFORD_RESTAURANT:t.IS_KIRKTON?n.KIRKTON_RESTAURANT:t.IS_GREENSIDE?n.GREENSIDE_RESTAURANT:t.IS_WILDINGS?n.WILDINGS_RESTAURANT:t.IS_KIRKMICHAEL?n.KIRKMICHAEL_RESTAURANT:s.SOUTERS_RESTAURANT],menu:t.IS_WILDINGS?l.WILDINGS_MENU:t.IS_KIRKMICHAEL?d.KIRKMICHAEL_MENU:t.IS_SOUTERS?i.SOUTERS_MENU:[],customer:{id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}},bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:t.IS_WILDINGS?(0,o.guideCalendarEvents)(o.WILDINGS_GUIDE,'wildings'):t.IS_KIRKMICHAEL?(0,o.guideCalendarEvents)(o.KIRKMICHAEL_GUIDE,'kirkmichael'):t.IS_SOUTERS?(0,o.guideCalendarEvents)(o.SOUTERS_GUIDE,'souters'):[],ratings:[],audit:[],alertAcks:{},walkIns:{},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:0,table:0,booking:0}}:I(u)};var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),s=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),m=_r(_d[11]);const p='cust-demo';function I(e){const t=(0,m.ymd)(e),r=e=>e.toISOString(),s=n.restaurants.map(e=>'anchorage'===e.id?{...e,sections:c.ANCHORAGE_SECTIONS}:e),i={id:p,name:'Alex Morgan',email:'alex.demo@example.com',phone:'07700 900123',allergies:[{allergen:'crustaceans',severity:'anaphylaxis'},{allergen:'mustard',severity:'allergy'}],allergyConsent:!0,referralCode:'ALEX-7K2Q',marketingOptIn:{anchorage:!0}},o=(n,s,i,o,d={})=>({id:n,ref:`BK-${n.slice(-3).toUpperCase()}`,restaurantId:'anchorage',customerId:null,name:s,partySize:i,date:t,time:o,allergies:[],notes:'',status:'confirmed',security:i>=6?'deposit':'none',depositPaid:0,...i>=6?{depositDue:1e3*i}:{},createdAt:r((0,m.addMins)(e,-4320)),...d}),d=[o('bk-101','Campbell',2,'17:00',{table:'12',status:'seated',seatedAt:r((0,m.addMins)(e,-28)),tags:['Regular']}),o('bk-102','Fraser',4,'17:30',{table:'10',tags:['VIP']}),o('bk-103','McLeod',2,'18:00',{table:'11',allergies:[{allergen:'gluten',severity:'coeliac'}],notes:'Anniversary',occasion:'anniversary'}),o('bk-104','Kerr',6,'18:00',{table:'18'}),o('bk-105','Wallace',3,'18:30',{table:'13'}),o('bk-106','Boyd',8,'19:00',{table:'1+2',dog:!0,allergies:[{allergen:'peanuts',severity:'anaphylaxis'}],notes:'Birthday \u2014 bringing a dog',occasion:'birthday'}),o('bk-107','Hamilton',2,'19:00',{table:'5'}),o('bk-108','Stewart',4,'19:30',{table:'19',tags:['Regular']}),o('bk-109','Murray',2,'20:00',{table:'16'})],l=[{id:'wl-1',restaurantId:'anchorage',number:1,name:'Paterson',partySize:2,joinedAt:r((0,m.addMins)(e,-12)),status:'waiting'},{id:'wl-2',restaurantId:'anchorage',number:2,name:'Duncan',partySize:4,joinedAt:r((0,m.addMins)(e,-4)),status:'waiting'}],I=(0,m.atTime)(e,'17:45'),h=[{id:'ord-seed-1',ref:'T-1041',restaurantId:'anchorage',customerId:'cust-other',customerName:'R. Gilmour',type:'takeaway',slotTime:r(I),lines:[{itemId:'a-fishsupper',name:'Fish Supper',qty:2,unitPrice:1800,choices:['Beer-battered'],notes:'',contains:[],may:[],overridden:!1,prepMins:12},{itemId:'a-chips',name:'Triple-Cooked Chips (V)',qty:1,unitPrice:450,choices:[],notes:'Extra salt',contains:[],may:[],overridden:!1,prepMins:6}],subtotal:4050,tip:0,giftCardApplied:0,total:4050,paid:4050,status:'acknowledged',createdAt:r((0,m.addMins)(e,-50)),allergies:[],readiness:{}},{id:'ord-seed-2',ref:'Q-2017',restaurantId:'anchorage',customerId:'cust-other2',customerName:'Table 3 guest',type:'table',tableNo:'3',lines:[{itemId:'a-moules',name:'Moules Marini\xe8re',qty:1,unitPrice:2200,choices:['Main 500g with triple-cooked chips (\xa322.00)'],notes:'',contains:[],may:[],overridden:!1,prepMins:10},{itemId:'a-claymore',name:'The Claymore Burger',qty:1,unitPrice:1800,choices:[],notes:'No gherkins',contains:[],may:[],overridden:!1,prepMins:14}],subtotal:4e3,tip:0,giftCardApplied:0,total:4e3,paid:0,status:'preparing',createdAt:r((0,m.addMins)(e,-18)),allergies:[],readiness:{}}],y=[{restaurantId:'anchorage',customerId:p,stamps:5,rewardsAvailable:0,history:[{at:'2026-08-15',source:'Dine-in (staff scan)'},{at:'2026-08-29',source:'Takeaway'},{at:'2026-09-12',source:'Table QR bill'},{at:'2026-10-02',source:'Takeaway'},{at:'2026-10-16',source:'Referral \u2014 friend\u2019s first visit'}]},{restaurantId:'saltmarsh',customerId:p,stamps:2,rewardsAvailable:0,history:[{at:'2026-09-01',source:'Dine-in'},{at:'2026-10-01',source:'Dine-in'}]}],b=[{id:'gc-1',code:'ANC-G7QX-4M2P-9TRE',restaurantId:'anchorage',initial:5e3,balance:2500,ownerId:p,recipientName:'Alex',message:'Happy birthday! (example)',createdAt:'2026-09-20'},{id:'gc-2',code:'WEB-OLD-10-EXAMPLE',restaurantId:'anchorage',initial:1e3,balance:1e3,ownerId:'legacy',recipientName:'Legacy website bookings voucher (example)',message:'',createdAt:'2026-06-01',legacy:!0}],E=[...u.SCOTTISH_BANK_HOLIDAYS.map((e,t)=>({id:`bh-${t}`,restaurantId:null,date:e.date,title:e.title+(e.notes&&!/substitute/i.test(e.notes)?` (${e.notes.toLowerCase()})`:''),kind:'bank-holiday',description:'Scottish bank holiday',example:!1,source:u.BANK_HOLIDAY_SOURCE})),{id:'ev-halloween',restaurantId:'anchorage',date:(0,m.ymd)(new Date(e.getFullYear(),9,31)),title:'Halloween weekend (example)',kind:'event',description:'Example event \u2014 busy weekend flag for the forecast.',example:!0},{id:'ev-xmas-party',restaurantId:'anchorage',date:'2026-12-04',title:'Christmas party nights begin (example)',kind:'event',description:'Example: festive set menu, deposit required for parties of 8+.',example:!0},{id:'ev-hogmanay',restaurantId:null,date:'2026-12-31',title:'Hogmanay',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-burns',restaurantId:'anchorage',date:'2027-01-25',title:'Burns Night Supper (example)',kind:'event',description:'EXAMPLE event: haggis, neeps & tatties, address to the haggis, set menu \xa348pp. Booking opens via the app.',example:!0},{id:'ev-valentines',restaurantId:null,date:'2027-02-14',title:"Valentine's Day",kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-mothering',restaurantId:null,date:'2027-03-07',title:'Mothering Sunday (UK)',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-live',restaurantId:'anchorage',date:'2026-11-14',title:'Live acoustic music (example)',kind:'event',description:'EXAMPLE: local folk duo from 7pm.',example:!0},{id:'ev-school-xmas',restaurantId:null,date:'2026-12-23',title:'South Ayrshire schools close for Christmas',kind:'school-holiday',description:'23 Dec 2026 \u2013 4 Jan 2027',example:!1},{id:'ev-salt-quiz',restaurantId:'saltmarsh',date:'2026-11-05',title:'Quiz night (fictional)',kind:'event',description:'Fictional demo restaurant event.',example:!0}];return{restaurants:s,menu:[...c.anchorageMenu,...n.demoMenus],customer:i,bookings:d,waitlist:l,orders:h,stampCards:y,giftCards:b,events:E,ratings:[{id:'rt-1',restaurantId:'anchorage',customerId:'cust-x1',customerName:'Fiona (example)',stars:5,comment:'Best fish supper on the coast, and the staff were brilliant with my son\u2019s nut allergy.',createdAt:r((0,m.addMins)(e,-1560)),context:'Takeaway T-1032'},{id:'rt-2',restaurantId:'anchorage',customerId:'cust-x2',customerName:'Iain (example)',stars:4,comment:'Lovely langoustines. Bit of a wait for a table at 7.',createdAt:r((0,m.addMins)(e,-3e3)),context:'Dine-in, Table 6'},{id:'rt-3',restaurantId:'anchorage',customerId:'cust-x3',customerName:'Morag (example)',stars:2,comment:'Chips were cold by the time we collected.',createdAt:r((0,m.addMins)(e,-4320)),context:'Takeaway T-1019'}],audit:[],alertAcks:{},walkIns:{anchorage:6},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:1042,table:2018,booking:110}}}},1207,[6,5,842,3,1208,1209,934,1210,1211,1212,1213,822]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_RESTAURANT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SOUTERS_BOOKING_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SOUTERS_CONTACTS",{enumerable:!0,get:function(){return o}});const t={id:'souters',name:"Souter's Inn",tagline:'Culinary excellence meets country hospitality in Kirkoswald',location:'Kirkoswald, South Ayrshire',address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',phone:'01655 760653',website:'https://www.soutersinn.com/',fictional:!1,kitchenHours:{0:['09:00','21:00'],1:['09:00','21:00'],2:['09:00','21:00'],3:['09:00','21:00'],4:['09:00','21:00'],5:['09:00','21:00'],6:['09:00','21:00']},hoursNote:'Official menus (10 Nov 2026): breakfast daily 9\u201311.45am; \xe0 la carte, children\u2019s, vegetarian and takeaway 12 noon\u20139pm; desserts 9am\u20139pm. Official homepage: open daily from 9am. Destination South Ayrshire lists 9am\u20139pm, seven days, food all day. Christmas hours not published.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:16,stampTarget:8,stampReward:'',stampMinSpend:1e3,capacityPerHour:0,walkInShare:.35,turnMins:75,orderAtTable:!1,showTakeaway:!1,tableRequests:!0,shortName:"Souter's",deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'A general table deposit policy was not published on the official website (10 November 2026). No deposit is taken in this app.'}}},n='',o={email:'souters@southernayr.com',phone:'01655 760653'}},1208,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_MENU",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SOUTERS_MENU_COUNT",{enumerable:!0,get:function(){return t}});const s=[{id:"su-breakfast-full-breakfast",section:"Breakfast",name:"Full Breakfast",description:"Ayrshire Bacon, Link Sausage, Black Pudding, Potato Scone, Beans, Tomato, Mushrooms & Two Eggs (Poached, Scrambled or Fried) with White or Wholemeal Toast",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-benedict",section:"Breakfast",name:"Eggs Benedict",description:"Two Poached Eggs along with Ayrshire Bacon served on Toasted Muffin topped with Hollandaise Sauce",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-french-toast",section:"Breakfast",name:"French Toast",description:"Two Slices of Bloomer Eggy Bread with Ayrshire Bacon and a side of Maple Syrup",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-light-breakfast",section:"Breakfast",name:"Light Breakfast",description:"Ayrshire Bacon, Link Sausage, Beans, Tomato and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-royale",section:"Breakfast",name:"Eggs Royale",description:"Two Poached Eggs with Flaked Smoked Salmon served on Toasted Muffin topped with Hollandaise Sauce",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-fried-scottish-pancakes",section:"Breakfast",name:"Fried Scottish Pancakes",description:"Scottish Pancakes with Ayrshire Bacon and a side of Maple Syrup",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-to-fried-scottish-pancakes",section:"Breakfast add-ons",name:"Add Banana (to Fried Scottish Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-two-eggs-poached-fried-or-scrambled-",section:"Breakfast add-ons",name:"Add Two Eggs \u2013 Poached, Fried or Scrambled (to Fried Scottish Pancakes)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-vegetarian-breakfast",section:"Breakfast",name:"Vegetarian Breakfast",description:"Potato Scone, Tomato, Mushrooms, Beans and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:925,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-benedict",section:"Breakfast",name:"Smashed Avocado Benedict",description:"Smashed Avocado Guacamole, 2 Poached Eggs served on Toasted Muffin topped with Hollandaise Sauce",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-granola-bowl",section:"Breakfast",name:"Granola Bowl",description:"Almond and Raisin Granola topped with Berries, Natural Yoghurt and Honey",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-burrito",section:"Breakfast",name:"Breakfast Burrito",description:"Crispy Bacon, Two Fried Eggs, Jalape\xf1o Salsa, Guacamole, Cheddar Cheese, Salad & Sour Cream",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pancake-stack",section:"Breakfast",name:"Pancake Stack",description:"American style pancakes with Biscoff, Nutella, Chocolate Sauce & Fresh Strawberries",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-roll",section:"Breakfast",name:"Breakfast Roll",description:"with a choice of Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg; 2 Items \xa34.75 | 3 Items \xa35.50",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-breakfast",section:"Junior / Kids",name:"Kids Breakfast",description:"Pork Link Sausage, Beans, Potato Scone, served with a Slice of Toast",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-pancakes",section:"Junior / Kids",name:"Kids Pancakes",description:"American Style Pancakes served with Syrup, Nutella or Butter & Jam",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-or-strawberries-to-kids-panca",section:"Junior / Kids add-ons",name:"Add Banana or Strawberries (to Kids Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-black-pudding-add-on",section:"Add-ons",name:"Black Pudding (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-beans-add-on",section:"Add-ons",name:"Beans (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-add-on",section:"Add-ons",name:"Smashed Avocado (add-on)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pork-link-sausage-add-on",section:"Add-ons",name:"Pork Link Sausage (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-mushrooms-add-on",section:"Add-ons",name:"Mushrooms (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-tomato-add-on",section:"Add-ons",name:"Tomato (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-ayrshire-bacon-2-add-on",section:"Add-ons",name:"Ayrshire Bacon (2) (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-haggis-add-on",section:"Add-ons",name:"Haggis (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-egg-add-on",section:"Add-ons",name:"Egg (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-potato-scone-add-on",section:"Add-ons",name:"Potato Scone (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-bucket-of-chips",section:"Add-ons",name:"Bucket of Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-toasted-white-or-wholemeal-bread",section:"Add-ons",name:"Toasted White or Wholemeal Bread",description:"served with Butter and Preserve",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-freshly-baked-basket-of-bread-with-butte",section:"Starters / bread",name:"Freshly Baked Basket Of Bread With Butter",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-olive-oil-balsamic-vinegar",section:"Starters / bread",name:"Add Olive Oil & Balsamic Vinegar",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-soup-of-the-day",section:"Starters",name:"Soup of The Day",description:"served with Crusty Bread & Butter",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-a-la-carte-salad-of-poached-pear-blue-cheese",section:"Starters",name:"Salad Of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fresh-water-prawns",section:"Starters",name:"Fresh Water Prawns",description:"coated in Spicy Bang Bang Sauce, topped with Chopped Chilli, Peanuts & Coriander",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sliced-melon-fresh-fruits",section:"Starters",name:"Sliced Melon & Fresh Fruits",description:"with Coulis & Raspberry Sorbet",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-liver-p-t",section:"Starters",name:"Chicken Liver P\xe2t\xe9",description:"with Oatcakes, Plum & Apple Chutney",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-crispy-salt-pepper-calamari",section:"Starters",name:"Crispy Salt & Pepper Calamari",description:"served with Garlic Mayo & Oriental Dressing",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-mussels",section:"Starters",name:"Steamed Mussels",description:"with White Wine, Garlic, Shallots & Cream, served with Garlic Bread",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamy-baked-garlic-mushrooms",section:"Starters",name:"Creamy Baked Garlic Mushrooms",description:"with a Cheddar Cheese Gratin",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-boiled-egg-crispy-bacon-caesar-salad",section:"Starters",name:"Boiled Egg & Crispy Bacon Caesar Salad",description:"with Parmesan & Croutons",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-grilled-honey-glazed-goat-s-cheese-salad",section:"Starters",name:"Grilled Honey Glazed Goat\u2019s Cheese Salad",description:"with Roquito Peppers & Chilli Jam",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sticky-bbq-ribs-in-a-korean-gochujang-sa",section:"Starters",name:"Sticky BBQ Ribs in a Korean Gochujang Sauce",description:"with Onions, Peppers & Sesame Seeds",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cioppino-fish-soup",section:"Starters",name:"Cioppino Fish Soup",description:"fired up with Fresh Chillies & Smoked Paprika, topped with Croutons & Parmesan",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-fillet-steak",section:"From the grill",name:"8oz Fillet Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-10oz-sirloin-steak",section:"From the grill",name:"10oz Sirloin Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-rosemary-garlic-lamb-chops",section:"From the grill",name:"Rosemary & Garlic Lamb Chops",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:2750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-breaded-haggis-grill",section:"From the grill add-ons",name:"Top with Breaded Haggis (grill)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-6-garlic-buttered-prawns-grill",section:"From the grill add-ons",name:"Top with 6 Garlic Buttered Prawns (grill)",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-fillet-of-salmon-with-cheese-gla",section:"Main courses",name:"Steamed Fillet of Salmon with Cheese Glaze",description:"served with Buttered Greens & Creamed Potatoes",price:2150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breaded-haddock-chips",section:"Main courses",name:"Breaded Haddock & Chips",description:"with Homemade Tartare Sauce & Side Salad",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fish-of-the-day",section:"Main courses",name:"Fish of the Day",description:"Check Chef\u2019s Daily Specials",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,priceNote:"Ask staff",special:!0},{id:"su-a-la-carte-locally-caught-haggis-with-neeps-tatties",section:"Main courses",name:"Locally Caught Haggis with Neeps & Tatties",description:"served with Whisky Peppercorn Sauce & Greentails",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breast-of-cajun-spiced-chicken",section:"Main courses",name:"Breast Of Cajun Spiced Chicken",description:"with Capsicums, Rice Pilaf & a Curried Coconut & Mango Chutney Sauce",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-schnitzel",section:"Main courses",name:"Chicken Schnitzel",description:"Pan-Fried in Breadcrumbs, served with Crispy Bacon, Grilled Pineapple & Chips",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-beef-steak-butcher-s-sausage-pie",section:"Main courses",name:"Beef Steak & Butcher\u2019s Sausage Pie",description:"with Creamed Potatoes & Buttered Carrots",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-madras-spiced-lamb-curry",section:"Main courses",name:"Madras Spiced Lamb Curry",description:"with Chillies, Pineapple & Coriander, served with Aromatic Rice, Spiced Onions & a Poppadom",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-pan-fried-lambs-liver",section:"Main courses",name:"Pan-Fried Lambs Liver",description:"with Saut\xe9ed Onions, Smoked Bacon, Grilled Tomato, Creamed Potatoes & Red Wine Gravy",price:1750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-cheeseburger",section:"Main courses",name:"8oz Cheeseburger",description:"with Bacon, Peppered Mayo, Pickles & Tomato, served with Coleslaw & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-haggis-to-cheeseburger",section:"Main courses add-ons",name:"Add Haggis (to Cheeseburger)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-panko-breaded-chicken-burger",section:"Main courses",name:"Panko Breaded Chicken Burger",description:"in a Toasted Brioche Bun, with Curried Slaw, Katsu Sauce & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Leeks, English Mustard & Matured Cheddar, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-bacon-to-macaroni-cheese",section:"Main courses add-ons",name:"Add Bacon (to Macaroni Cheese)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-penne-pasta-arrabbiata",section:"Main courses",name:"Penne Pasta Arrabbiata",description:"with Peppers, Vine Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-melon-prawn-salad",section:"Salads",name:"Melon & Prawn Salad",description:"with Marie Rose Cocktail Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-ploughman-s-salad",section:"Salads",name:"Ploughman\u2019s Salad",description:"Souter\u2019s Sausage Roll, Matured Cheddar, Pickle, Gammon, Boiled Egg & Crusty Bread; served with a choice of Chips or Boiled Potatoes",price:1695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-spiced-fillet-of-salmon",section:"Salads",name:"Cajun Spiced Fillet Of Salmon",description:"with Curried Coleslaw, Cashew Nuts & a Chilli, Ginger & Citrus Dressing; served with a choice of Chips or Boiled Potatoes",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-chicken-caesar-salad",section:"Salads",name:"Garlic Chicken Caesar Salad",description:"with Croutons, Parmesan, Baby Gem Lettuce, Boiled Egg & Caesar Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-prawn-smoked-salmon-sandwich",section:"Sandwiches",name:"Prawn & Smoked Salmon Sandwich",description:"with Rocket & Marie Rose Sauce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-tuna-mayonnaise-sandwich",section:"Sandwiches",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-spicy-bang-bang-chicken-sandwich",section:"Sandwiches",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-basil-pesto-chicken-sandwich",section:"Sandwiches",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-egg-mayonnaise-sandwich",section:"Sandwiches",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-a-cup-of-soup-with-any-sandwich",section:"Sandwiches add-ons",name:"Add a Cup of Soup (with any Sandwich)",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chips",section:"Sides",name:"Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-chips",section:"Sides",name:"Cajun Chips",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamed-potatoes",section:"Sides",name:"Creamed Potatoes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-onion-rings",section:"Sides",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-mac-cheese-side",section:"Sides",name:"Mac & Cheese (side)",description:"",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-seasonal-mixed-vegetables",section:"Sides",name:"Seasonal Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-coleslaw",section:"Sides",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-curried-coleslaw",section:"Sides",name:"Curried Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-side-salad",section:"Sides",name:"Souter\u2019s Side Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread",section:"Sides",name:"Garlic Bread",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread-with-cheese",section:"Sides",name:"Garlic Bread with Cheese",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-fresh-fruit-salad-sorbet",section:"Starters",name:"Fresh Fruit Salad & Sorbet",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-soup-of-the-day",section:"Starters",name:"Soup of the Day",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-garlic-bread-with-or-without-cheese",section:"Starters",name:"Garlic Bread (with or without Cheese)",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-breaded-goujons-of-chicken",section:"Main courses",name:"Breaded Goujons of Chicken",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-mini-breaded-fish",section:"Main courses",name:"Mini Breaded Fish",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-roast-chicken-salad",section:"Main courses",name:"Roast Chicken Salad",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-grilled-sausages-or-chicken-with-gravy",section:"Main courses",name:"Grilled Sausages or Chicken with Gravy",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-sticky-toffee-pudding",section:"Sweet treats",name:"Sticky Toffee Pudding",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-cone-from-the-counter",section:"Sweet treats",name:"Cone from the Counter",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-ice-cream-sundae",section:"Sweet treats",name:"Kids Ice Cream Sundae",description:"Two scoops, Sprinkles, Flakes, along with a choice of Sauce \u2013 Chocolate / Strawberry",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-juice-apple-orange-pineapple",section:"Drinks",name:"Juice \u2013 Apple / Orange / Pineapple",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-simply-fruit-shoot-orange-blackcurrant",section:"Drinks",name:"Simply Fruit Shoot \u2013 Orange / Blackcurrant",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-diluting-juice-orange-blackcurrant",section:"Drinks",name:"Diluting Juice \u2013 Orange / Blackcurrant",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-milk",section:"Drinks",name:"Milk",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-coke-diet-coke-lemonade",section:"Drinks",name:"Coke / Diet Coke / Lemonade",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-milk-shake-chocolate-strawberry",section:"Drinks",name:"Kids Milk Shake \u2013 Chocolate / Strawberry",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-sticky-toffee-pudding",section:"Dessert",name:"Souter\u2019s Sticky Toffee Pudding",description:"with Butterscotch Sauce & Vanilla Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cherry-almond-tart",section:"Dessert",name:"Cherry & Almond Tart",description:"with Cr\xe8me Anglaise & Wild Cherry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-individual-banoffee-pie",section:"Dessert",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-cheesecake-of-the-day",section:"Dessert",name:"Souter\u2019s Cheesecake of the Day",description:"Please ask your Server for Today\u2019s Choice",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-warm-chocolate-fudge-cake",section:"Dessert",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-meringue-pie",section:"Dessert",name:"Lemon Meringue Pie",description:"with Raspberries & Raspberry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-fresh-fruit-salad",section:"Dessert",name:"Fresh Fruit Salad",description:"with Citrus Syrup served with Pouring Cream, Ice Cream or Sorbet",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cheeseboard",section:"Dessert",name:"Cheeseboard",description:"A Selection of British & Continental Cheeses with Grapes, Fruit Chutney & Biscuits",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-affogato",section:"Dessert",name:"Affogato",description:"Vanilla Ice Cream with a Shot of Espresso",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-ice-cream-one-scoop",section:"Ice cream",name:"Ice Cream \u2013 One Scoop",description:"Please ask your Server for Today\u2019s Flavours",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-two-scoops",section:"Ice cream",name:"Ice Cream \u2013 Two Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-three-scoops",section:"Ice cream",name:"Ice Cream \u2013 Three Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-strawberry-snowball-delight",section:"Sundaes",name:"Strawberry Snowball Delight",description:"Vanilla & Strawberry Ice cream, Crushed Meringue, Fresh Strawberries, Strawberry Sauce, topped with a Snowball & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-biscoff-sundae",section:"Sundaes",name:"Biscoff Sundae",description:"Biscoff & Toffee Fudge Ice Cream, Whipped Cream, Crushed Lotus Biscoff Biscuits, Biscoff Topping Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-kinder-bueno-sundae",section:"Sundaes",name:"Kinder Bueno Sundae",description:"Kinder Bueno & Chocolate Ice Cream, Whipped Cream, Kinder Bueno Pieces, Chocolate Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-chilled-melon-seasonal-fruits",section:"Starters",name:"Chilled Melon & Seasonal Fruits",description:"with Fruit Coulis & Sorbet",price:850,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-garlic-mushrooms",section:"Starters",name:"Creamy Garlic Mushrooms",description:"with Cheddar Cheese & Crusty Bread",price:895,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-mediterranean-tomato-chunky-vegetable-so",section:"Starters",name:"Mediterranean Tomato & Chunky Vegetable Soup",description:"with Crusty Bread",price:650,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-honey-glazed-goats-cheese",section:"Starters",name:"Honey Glazed Goats Cheese",description:"with Tomato & Rocket Salad, Basil Pesto & Balsamic Dressing",price:850,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-freshly-baked-basket-of-bread",section:"Starters",name:"Freshly Baked Basket of Bread",description:"with Butter",price:450,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-vegetarian-vegan-add-olive-oil-balsamic",section:"Starters",name:"Add Olive Oil & Balsamic",description:"",price:100,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-boiled-egg-caesar-salad",section:"Starters",name:"Boiled Egg Caesar Salad",description:"with Croutons, Garlic Dressing & Vegetarian Cheese Shavings",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-salad-of-poached-pear-candied-walnuts",section:"Starters",name:"Salad of Poached Pear & Candied Walnuts",description:"with French Vinaigrette",price:795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-stuffed-peppers",section:"Main courses",name:"Stuffed Peppers",description:"with Braised Rice, Tomatoes, Basil & Brie, served with a Side Salad & a Bucket of Chips; without Brie is vegan",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-vegetable-cashew-nut-stir-fry",section:"Main courses",name:"Vegetable & Cashew Nut Stir Fry",description:"with Hoisin, Ginger & Garlic, served with Aromatic Rice",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Coleman\u2019s Mustard, Leeks & Matured Cheddar, served with Garlic Bread",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-pasta-arrabbiata",section:"Main courses",name:"Pasta Arrabbiata",description:"with Peppers, Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-coconut-vegetable-curry",section:"Main courses",name:"Creamy Coconut Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-katsu-vegetable-curry",section:"Main courses",name:"Katsu Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-fresh-fruit-salad",section:"Desserts",name:"Fresh Fruit Salad",description:"with Sorbet",price:700,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-sticky-toffee-pudding",section:"Desserts",name:"Sticky Toffee Pudding",description:"with Hot Caramel Sauce & Vanilla Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cherry-almond-tart",section:"Desserts",name:"Cherry & Almond Tart",description:"with Wild Cherry Ripple Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-trillionaire-tart",section:"Desserts",name:"Trillionaire Tart",description:"with Chocolate Pastry, Caramel Toffee & Chocolate Style Ganache, served with Vegan Vanilla Ice Cream",price:795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-individual-banoffee-pie",section:"Desserts",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-warm-chocolate-fudge-cake",section:"Desserts",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cheeseboard",section:"Desserts",name:"Cheeseboard",description:"served with Oatcakes & Seasonal Chutney",price:995,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-affogato",section:"Desserts",name:"Affogato",description:"1 Scoop of Plain Ice Cream with a shot of Espresso Coffee",price:650,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-ayrshire-bacon",section:"Morning (9am\u201312pm)",name:"Floured Bap with Ayrshire Bacon",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-pork-link-sausage",section:"Morning (9am\u201312pm)",name:"Floured Bap with Pork Link Sausage",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-poached-scrambled-fried",section:"Morning (9am\u201312pm)",name:"Floured Bap with Poached / Scrambled / Fried Egg",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-extra-item-on-floured-bap",section:"Morning (9am\u201312pm)",name:"Extra Item (on Floured Bap)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-traybakes",section:"Sweet treats",name:"Traybakes",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-freshly-baked-cakes",section:"Sweet treats",name:"Freshly Baked Cakes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-freshly-baked-plain-fruit-scone",section:"Sweet treats",name:"Freshly Baked Plain / Fruit Scone",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-soup-of-the-day",section:"Hot food (12pm\u20139pm)",name:"Soup of the Day",description:"with Crusty Bread; available 12pm\u20139pm",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-breaded-haddock-chips",section:"Hot food (12pm\u20139pm)",name:"Breaded Haddock & Chips",description:"with Tartare Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-steak-sausage-pie",section:"Hot food (12pm\u20139pm)",name:"Steak & Sausage Pie",description:"with Chips & Gravy",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-macaroni-cheese",section:"Hot food (12pm\u20139pm)",name:"Macaroni Cheese",description:"with Leeks, Mustard & Matured Cheddar, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-8oz-burger",section:"Hot food (12pm\u20139pm)",name:"8oz Burger",description:"with Bacon & Cheese, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-katsu-chicken-burger",section:"Hot food (12pm\u20139pm)",name:"Breaded Katsu Chicken Burger",description:"with Curried Slaw, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-cajun-chicken",section:"Hot food (12pm\u20139pm)",name:"Cajun Chicken",description:"with Rice & Coconut Curry Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-goat-s-cheese",section:"Hot food (12pm\u20139pm)",name:"Breaded Goat\u2019s Cheese",description:"with Tomato Salad, Pesto & Chutney, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-basil-pesto-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-spicy-bang-bang-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches (12pm\u20135pm)",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-tuna-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-egg-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-pork-fillet-escalopes",section:"Choose your cut",name:"Pork Fillet Escalopes",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-beef-fillet",section:"Choose your cut",name:"8oz Scotch Beef Fillet",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-sirloin",section:"Choose your cut",name:"8oz Scotch Sirloin",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-10oz-scotch-ribeye",section:"Choose your cut",name:"10oz Scotch Ribeye",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-scotch-lamb-chops",section:"Choose your cut",name:"Scotch Lamb Chops",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-600gm-scotch-t-bone-steak",section:"Choose your cut",name:"600gm Scotch T-Bone Steak",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:4500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-mixed-grill",section:"Choose your cut",name:"Souter\u2019s Mixed Grill",description:"4oz Sirloin / Chicken Breast / Lamb Chop / Pork Escalope; served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-chunky-chips-included-side-choice",section:"Side (included)",name:"Chunky Chips (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-baby-boiled-potatoes-included-side-choic",section:"Side (included)",name:"Baby Boiled Potatoes (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mashed-potato-included-side-choice",section:"Side (included)",name:"Mashed Potato (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-red-wine-jus-included-sauce-choice",section:"Sauce (included)",name:"Red Wine Jus (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-peppercorn-included-sauce-choice",section:"Sauce (included)",name:"Peppercorn (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mustard-included-sauce-choice",section:"Sauce (included)",name:"Mustard (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-onion-rings",section:"Upgrade extras",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garden-salad",section:"Upgrade extras",name:"Garden Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mixed-vegetables",section:"Upgrade extras",name:"Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-haggis-cake",section:"Upgrade extras",name:"Haggis Cake",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mac-cheese",section:"Upgrade extras",name:"Mac & Cheese",description:"",price:525,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garlic-prawns",section:"Upgrade extras",name:"Garlic Prawns",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-coleslaw",section:"Upgrade extras",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-2-course-set",section:"Festive set menu",name:"2 Course Festive Menu",description:"From 1 December, Monday\u2013Sunday 12\u20139pm, only available for tables of 10 or more. Christmas crackers included.",price:2995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-3-course-set",section:"Festive set menu",name:"3 Course Festive Menu",description:"From 1 December, Monday\u2013Sunday 12\u20139pm, only available for tables of 10 or more. Christmas crackers included.",price:3595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-festive-chilled-melon-fruits",section:"Festive \xb7 Starters",name:"Chilled Melon & Fruits",description:"with Lemon Sorbet",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-salad-of-poached-pear-blue-cheese",section:"Festive \xb7 Starters",name:"Salad of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-souters-prawn-home-smoked-salmon-cocktail",section:"Festive \xb7 Starters",name:"Souter\u2019s Prawn & Home Smoked Salmon Cocktail",description:"with Baby Gem & Marie Rose Sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-smooth-chicken-liver-parfait",section:"Festive \xb7 Starters",name:"Smooth Chicken Liver Parfait",description:"with Spiced Plum Chutney & Oatcakes",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-soup-of-the-day",section:"Festive \xb7 Starters",name:"Soup of the Day",description:"served with Freshly Baked Crusty Bread",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-salad-of-warm-breaded-goats-cheese",section:"Festive \xb7 Starters",name:"Salad of Warm Breaded Goats Cheese",description:"with Red Onion Marmalade",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-traditional-roast-turkey",section:"Festive \xb7 Main courses",name:"Traditional Roast Turkey",description:"with Stuffing, Chipolatas, Roast Potatoes, Brussel Sprouts, Fresh Cranberry Sauce & Light Turkey Jus",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-individual-vegetable-chestnut-brie-cranberry-pie",section:"Festive \xb7 Main courses",name:"Individual Vegetable, Chestnut, Brie & Cranberry Pie",description:"served with a Creamy White Wine & Leek Sauce",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-pan-fried-fish-of-the-day-with-garlic-tiger-praw",section:"Festive \xb7 Main courses",name:"Pan Fried Fish of the Day with Garlic Tiger Prawns",description:"with Buttered Greens, Baby Potatoes, Capers & Citrus Beurre Blanc",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cajun-fillet-of-salmon-salad",section:"Festive \xb7 Main courses",name:"Cajun Fillet of Salmon Salad",description:"with Curried Coleslaw, Cashew Nuts & a Ginger & Lemongrass Dressing",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-individual-beef-steak-sausage-onion-pie",section:"Festive \xb7 Main courses",name:"Individual Beef Steak, Sausage & Onion Pie",description:"served with Creamed Potatoes & Glazed Carrots",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-lightly-peppered-breast-of-chicken",section:"Festive \xb7 Main courses",name:"Lightly Peppered Breast of Chicken",description:"served with Crispy Breaded Haggis, Champ Mashed Potatoes, Root Vegetables & Whisky Cream Sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-christmas-pudding",section:"Festive \xb7 Desserts",name:"Christmas Pudding",description:"with Brandy Sauce & Scottish Tablet Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cherry-almond-tart",section:"Festive \xb7 Desserts",name:"Cherry & Almond Tart",description:"with Chilled Cr\xe8me Anglaise & Wild Cherry Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-warm-chocolate-orange-fudge-cake",section:"Festive \xb7 Desserts",name:"Warm Chocolate & Orange Fudge Cake",description:"with Girvan Gelateria Vanilla Ice Cream",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-cheesecake-of-the-day",section:"Festive \xb7 Desserts",name:"Cheesecake of the Day",description:"with Ice Cream",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-selection-of-scottish-farmhouse-cheese",section:"Festive \xb7 Desserts",name:"Selection of Scottish Farmhouse Cheese",description:"with Chutney, Grapes & Oatcakes",price:null,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"2 courses \xa329.95 / 3 courses \xa335.95 \xb7 from 1 December, tables of 10+"},{id:"su-festive-coffee-or-tea-with-a-mince-pie",section:"Festive \xb7 To finish",name:"Freshly Ground Coffee or Tea with a Mince Pie",description:"From 1 December, tables of 10 or more",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"souters",soldOut:!1,signOff:null})),t=235},1209,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIRKMICHAEL_MENU_COUNT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"KIRKMICHAEL_MENU",{enumerable:!0,get:function(){return n}});const s=133,n=[{id:"km-main-menu-khun-mais-canteen-grilled-aubergine",section:"Menu \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-langoustine-prawn-toast",section:"Menu \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-loch-ryan-venison-empinadas",section:"Menu \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-bbq-scotch-pork-neck-moo-ping",section:"Menu \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-scallop-slow-roasted-pork-belly",section:"Menu \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Menu \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-main-menu-slow-roasted-apple-orchard-tamworth-pork-belly",section:"Menu \xb7 Main Courses on the specials board",name:"Slow Roasted Apple Orchard Tamworth Pork Belly",description:"Truffle Mash-Roasted Carrot-Spring Cabbage-Apple Puree",price:2800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-char-roasted-lamb-neck-fillet",section:"Menu \xb7 Main Courses on the specials board",name:"Char Roasted Lamb Neck Fillet",description:"Autumn Cabbage, Boiled Potatoes, Roast Carrot, Red Wine Jus",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-fire-roasted-lochryan-venison-loin",section:"Menu \xb7 Main Courses on the specials board",name:"Fire Roasted Lochryan Venison Loin",description:"Celeriac Parsley Puree-Wild Leeks-Potato Terrine-Juniper Jus",price:3900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-butter-poached-lemon-sole-fillet",section:"Menu \xb7 Main Courses on the specials board",name:"Butter Poached Lemon Sole Fillet",description:"Langoustines Tails-Pernod Chive Nage-Paris Mash-Truffle",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-main-menu-grilled-tranche-of-turbot",section:"Menu \xb7 Main Courses on the specials board",name:"Grilled Tranche of Turbot",description:"Lemon Scented Monk's Beard-Pink Fir Apple Potatoes-Bearnaise",price:4400,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-lunch-khun-mais-canteen-grilled-aubergine",section:"Lunch \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-langoustine-prawn-toast",section:"Lunch \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-loch-ryan-venison-empinadas",section:"Lunch \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-bbq-scotch-pork-neck-moo-ping",section:"Lunch \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-scallop-slow-roasted-pork-belly",section:"Lunch \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Lunch \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-lunch-triple-cooked-hand-cut-chips",section:"Lunch \xb7 Sides",name:"Triple Cooked Hand Cut Chips",description:"",price:600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-khun-mais-canteen-grilled-aubergine",section:"Sunday lunch \xb7 Starters and sharing",name:"Khun Mai's Canteen Grilled Aubergine",description:"",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-langoustine-prawn-toast",section:"Sunday lunch \xb7 Starters and sharing",name:"Langoustine \"Prawn Toast\"",description:"",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-loch-ryan-venison-empinadas",section:"Sunday lunch \xb7 Starters and sharing",name:"Loch Ryan Venison Empinadas",description:"",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-bbq-scotch-pork-neck-moo-ping",section:"Sunday lunch \xb7 Starters and sharing",name:"BBQ Scotch Pork Neck-Moo Ping",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-scallop-slow-roasted-pork-belly",section:"Sunday lunch \xb7 Starters and sharing",name:"Scallop-Slow Roasted Pork Belly",description:"",price:1600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-gnocchi-confit-sweetbread-ragu-truffle-mushrooms",section:"Sunday lunch \xb7 Starters and sharing",name:"Gnocchi-Confit Sweetbread Ragu-Truffle-Mushrooms",description:"",price:1495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-bar-food-maple-glazed-bacon-loin",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Maple Glazed Bacon Loin",description:"",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-roasted-sirloin-of-scotch-beef",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Roasted Sirloin of Scotch Beef",description:"Beef Fat Roast Potatoes-Yorkshire Pudding-Spring Cabbage-Carrot-Peppercorn Sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-lemon-and-thyme-corn-fed-chicken",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Lemon and Thyme Corn Fed Chicken",description:"",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-carvery-plate",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Carvery Plate",description:"Beef, Bacon Loin, Corn Fed Chicken",price:3100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-fire-roasted-lochryan-venison-loin",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Fire Roasted Lochryan Venison Loin",description:"Celeriac Parsley Puree-Wild Leeks-Potato Terrine-Juniper Jus",price:3900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-butter-poached-lemon-sole-fillet",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Butter Poached Lemon Sole Fillet",description:"Langoustines Tails-Pernod Chive Nage-Paris Mash-Truffle",price:3800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-bar-food-grilled-tranche-of-turbot",section:"Sunday lunch \xb7 Main Courses from the specials board",name:"Grilled Tranche of Turbot",description:"Lemon Scented Monk's Beard-Pink Fir Apple Potatoes-Bearnaise",price:4400,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,special:!0},{id:"km-menu-kids-garlic-bread",section:"Kids \xb7 Starters",name:"Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-cheesy-garlic-bread",section:"Kids \xb7 Starters",name:"Cheesy Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-soup",section:"Kids \xb7 Starters",name:"Soup",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-hamburger",section:"Kids \xb7 Mains",name:"Hamburger",description:"Scotch beef burger with brioche bun, lettuce, tomato & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-cheese-burger",section:"Kids \xb7 Mains",name:"Cheese Burger",description:"Scotch beef burger with cheddar cheese, brioche bun, lettuce, tomato & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-chicken-goujons",section:"Kids \xb7 Mains",name:"Chicken Goujons",description:"Crisp fried chicken strips with tortilla wraps, grated cheddar & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-fish-n-chips",section:"Kids \xb7 Mains",name:"Fish 'n Chips",description:"Battered haddock, lemon, tartare sauce & french fries or steamed vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-mac-n-cheese",section:"Kids \xb7 Mains",name:"Mac 'n Cheese",description:"Creamy Macaroni with cheddar cheese sauce",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-strawberry-ice-cream",section:"Kids \xb7 Desserts",name:"Strawberry Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-chocolate-ice-cream",section:"Kids \xb7 Desserts",name:"Chocolate Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-vanilla-ice-cream",section:"Kids \xb7 Desserts",name:"Vanilla Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-kids-sticky-toffee-pudding",section:"Kids \xb7 Desserts",name:"Sticky Toffee Pudding",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"3 courses \u2014 \xa314.95"},{id:"km-menu-whisky-whyte-macay",section:"Whisky \xb7 Blended Whisky",name:"Whyte & Macay",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-johnnie-walker-black-label",section:"Whisky \xb7 Blended Whisky",name:"Johnnie Walker Black Label",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-canadian-club",section:"Whisky \xb7 Blended Whisky",name:"Canadian Club",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jack-daniels-tennessee",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Jack Daniel's Tennessee",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-southern-comfort",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Southern Comfort",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-makers-mark-classic",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Maker's Mark Classic",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bulleit",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Bulleit",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bulleit-rye",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Bulleit Rye",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jim-beam-white-label",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Jim Beam White Label",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-woodford-reserve",section:"Whisky \xb7 Bourbon & Whiskey Liqueurs",name:"Woodford Reserve",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-jameson",section:"Whisky \xb7 Irish Whiskey",name:"Jameson",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-hibiki-harmony-masters-masters-select",section:"Whisky \xb7 Japanese Whisky",name:"Hibiki Harmony Masters Masters Select",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenfiddich-12-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Glenfiddich 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenrothes-12-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Glenrothes 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-macallan-12-year-old-double-cask",section:"Whisky \xb7 Single Malt - Speyside",name:"Macallan 12 Year Old Double Cask",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-benrinnes-flora-fauna-15",section:"Whisky \xb7 Single Malt - Speyside",name:"Benrinnes Flora & Fauna 15",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-benrinnes-1997-maltman-18-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Benrinnes 1997 Maltman 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-balvenie-18-year-old-pedro-ximenez",section:"Whisky \xb7 Single Malt - Speyside",name:"Balvenie 18 Year Old Pedro Ximenez",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-macallan-18-year-old",section:"Whisky \xb7 Single Malt - Speyside",name:"Macallan 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-aberlour-abunadh-cask-strength",section:"Whisky \xb7 Single Malt - Speyside",name:"Aberlour Abunadh Cask Strength",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-mortlach-16yo",section:"Whisky \xb7 Single Malt - Speyside",name:"Mortlach 16yo",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-dalmore-12-year-old",section:"Whisky \xb7 Single Malt - Highland",name:"Dalmore 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-oban-14-year-old",section:"Whisky \xb7 Single Malt - Highland",name:"Oban 14 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glencadam-10",section:"Whisky \xb7 Single Malt - Highland",name:"Glencadam 10",description:"",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-tomatin-legacy",section:"Whisky \xb7 Single Malt - Highland",name:"Tomatin Legacy",description:"",price:675,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-tomatin-14",section:"Whisky \xb7 Single Malt - Highland",name:"Tomatin 14",description:"",price:800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glendronach-15",section:"Whisky \xb7 Single Malt - Highland",name:"Glendronach 15",description:"",price:900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glenfarclas-21",section:"Whisky \xb7 Single Malt - Highland",name:"Glenfarclas 21",description:"",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-glendronach-sherry-cask-18",section:"Whisky \xb7 Single Malt - Highland",name:"Glendronach Sherry Cask 18",description:"",price:2250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-bowmore-15-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Bowmore 15 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lagavulin-16-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Lagavulin 16 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-caol-ila-12-year-old",section:"Whisky \xb7 Single Malt - Islay",name:"Caol Ila 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-caol-ila-moch",section:"Whisky \xb7 Single Malt - Islay",name:"Caol Ila Moch",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-ardbeg-10",section:"Whisky \xb7 Single Malt - Islay",name:"Ardbeg 10",description:"",price:575,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-highland-park-12-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Highland Park 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-talisker-10-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Talisker 10 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-10-year-old",section:"Whisky \xb7 Single Malt - Islands",name:"Arran 10 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-port-cask-finish",section:"Whisky \xb7 Single Malt - Islands",name:"Arran Port Cask Finish",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-machrie-moor-cask-strength",section:"Whisky \xb7 Single Malt - Islands",name:"Machrie Moor Cask Strength",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-arran-amarone-cask",section:"Whisky \xb7 Single Malt - Islands",name:"Arran Amarone Cask",description:"",price:725,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-hearach-oloroso-harris",section:"Whisky \xb7 Single Malt - Islands",name:"Hearach Oloroso, Harris",description:"",price:900,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-ledaig-1974-mull",section:"Whisky \xb7 Single Malt - Islands",name:"Ledaig 1974, Mull",description:"",price:2250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-whisky-auchentoshan-three-wood",section:"Whisky \xb7 Single Malt - Lowlands",name:"Auchentoshan Three Wood",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-ailsa-bay",section:"Whisky \xb7 Single Malt - Lowlands",name:"Ailsa Bay",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-glenkinchie-12-year-old",section:"Whisky \xb7 Single Malt - Lowlands",name:"Glenkinchie 12 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-our-barley",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Our Barley\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-fallow-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Fallow Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-ploughing-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Ploughing Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-5",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"5\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-lochlea-cask-strength-2nd-edition",section:"Whisky \xb7 Single Malt - Lowlands",name:"Lochlea \"Cask Strength 2nd Edition\"",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-spirit-drink",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch Spirit Drink",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-vinaya",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch Vinaya",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-bladnoch-22-year-old-vintage-release",section:"Whisky \xb7 Single Malt - Lowlands",name:"Bladnoch 22 Year Old Vintage Release",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-springbank-15-year-old",section:"Whisky \xb7 Single Malt - Campbeltown",name:"Springbank 15 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-whisky-springbank-18-year-old",section:"Whisky \xb7 Single Malt - Campbeltown",name:"Springbank 18 Year Old",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-greyfriars-cuvee-brut",section:"Wine \xb7 Champagne/Sparkling",name:"Greyfriars Cuvee Brut",description:"England",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-greyfriars-rose-reserve",section:"Wine \xb7 Champagne/Sparkling",name:"Greyfriars Rose Reserve",description:"England",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ruinart-blank-de-blank",section:"Wine \xb7 Champagne/Sparkling",name:"Ruinart Blank De Blank",description:"",price:19e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-sanziana-pinot-noir-rose",section:"Wine \xb7 Rose",name:"Sanziana, Pinot Noir, Rose",description:"Romania",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-rose-organic",section:"Wine \xb7 Rose",name:"Art de Vivre Rose Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-orange-gold-white-organic",section:"Wine \xb7 Orange",name:"Orange Gold White Organic",description:"Gerard Bertrand Organic, France",price:6800,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-les-lys-de-leon-sauvignon-blanc",section:"Wine \xb7 White",name:"Les Lys De Leon - Sauvignon Blanc",description:"Loir, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-fetele-feteasca-regala-recas-cramele",section:"Wine \xb7 White",name:"Fetele Feteasca Regala Recas Cramele",description:"Bannat, Romania",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-adam-who-riesling",section:"Wine \xb7 White",name:"Adam Who, Riesling",description:"Eden Valley, Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-rare-vineyards-marsanne-viognier",section:"Wine \xb7 White",name:"Rare Vineyards Marsanne-Viognier",description:"Languedoc France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-la-bergerie-chardonnay-francois-carillon",section:"Wine \xb7 White",name:"La Bergerie Chardonnay, Francois Carillon",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-blanc-organic",section:"Wine \xb7 White",name:"Art de Vivre Blanc Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-acrobat-pinot-gris",section:"Wine \xb7 White",name:"Acrobat Pinot Gris",description:"Oregon, U.S.A",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-dashwood-sauvignon-blanc",section:"Wine \xb7 White",name:"Dashwood Sauvignon Blanc",description:"Marlborough New Zealand",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-sancerre-la-graveli-re",section:"Wine \xb7 White",name:"Sancerre La Graveli\xe8re",description:"Joseph Mellot, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-petaluma-hanlin-hill-riesling",section:"Wine \xb7 White",name:"Petaluma Hanlin Hill Riesling",description:"Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-louis-jadot-puligny-montrachet",section:"Wine \xb7 White",name:"Louis Jadot Puligny Montrachet",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-vinvua-organic-nero-davola-doc",section:"Wine \xb7 Red",name:"Vinvua Organic Nero d'Avola DOC",description:"Sicilia Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-les-lys-de-leon-pinot-grigio",section:"Wine \xb7 Red",name:"Les Lys De Leon, Pinot Grigio",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-tres-priors-trepat-merlot",section:"Wine \xb7 Red",name:"Tres Priors Trepat Merlot",description:"Catalonia, Spain",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-alma-mora-malbec",section:"Wine \xb7 Red",name:"Alma Mora Malbec",description:"San Juan, Argentina",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-drifting-old-vine-zinfandel-lodi",section:"Wine \xb7 Red",name:"Drifting Old Vine Zinfandel Lodi",description:"California, U.S.A",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ch-teau-caz-au-maret-organic",section:"Wine \xb7 Red",name:"Ch\xe2teau Caz\xe9au Maret Organic",description:"Bordeaux, France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-inzuzo-red-blend",section:"Wine \xb7 Red",name:"Inzuzo Red Blend",description:"Western Cape South Africa",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-art-de-vivre-languedoc-organic",section:"Wine \xb7 Red",name:"Art de Vivre LangueDOC Organic",description:"Clay 'Amphora', France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-journeys-end-v4-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Journeys End V4 Cabernet Sauvignon",description:"South Africa",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-mucchietto-primitivo",section:"Wine \xb7 Red",name:"Mucchietto Primitivo",description:"Puglia, Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-yalumba-the-cigar-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Yalumba The Cigar Cabernet Sauvignon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-black-angus-cabernet-sauvignon",section:"Wine \xb7 Red",name:"Black Angus Cabernet Sauvignon",description:"Australia",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-ch-teauneuf-du-pape-le-mioc-ne",section:"Wine \xb7 Red",name:"Ch\xe2teauneuf du Pape 'Le Mioc\xe8ne'",description:"France",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-catena-zapata-malbec-argentino",section:"Wine \xb7 Red",name:"Catena Zapata Malbec Argentino",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-amarone-della-valpolicella-classico-reserva",section:"Wine \xb7 Red",name:"Amarone della Valpolicella Classico Reserva",description:"Italy",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0,priceNote:"Ask staff"},{id:"km-menu-wine-psi-bodegas-ribera-del-duero",section:"Wine \xb7 Red",name:"Psi Bodegas Ribera Del Duero",description:"Spain",price:10600,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-brunelo-di-mortlachino-ridolfi",section:"Wine \xb7 Red",name:"Brunelo Di Mortlachino Ridolfi",description:"Italy",price:16e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"km-menu-wine-flor-de-pingus-domain-de-pingus",section:"Wine \xb7 Red",name:"Flor De Pingus, Domain De Pingus",description:"Spain",price:29500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"kirkmichael",soldOut:!1,signOff:null}))},1210,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_MENU_COUNT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"WILDINGS_MENU",{enumerable:!0,get:function(){return n}});const s=83,n=[{id:"wi-lunch-smoked-haddock-gratin-with-creamed-potatoes",section:"Lunch \xb7 Starters",name:"Smoked Haddock Gratin with Creamed Potatoes",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-pear-poached-in-grenadine-with-prawns-marie-rose",section:"Lunch \xb7 Starters",name:"Pear Poached in Grenadine with Prawns Marie Rose",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chefs-pate-with-grape-chutney-toast",section:"Lunch \xb7 Starters",name:"Chefs Pate with Grape Chutney & Toast",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Lunch \xb7 Starters",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-melon-fan-with-sorbet-fruit-coulis",section:"Lunch \xb7 Starters",name:"Melon Fan with Sorbet & Fruit Coulis",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-spiced-chicken-salad-with-caesar-dressing-parmes",section:"Lunch \xb7 Starters",name:"Spiced Chicken Salad with Caesar Dressing & Parmesan",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-mushrooms-baked-in-a-cream-cheese-sauce-with-toa",section:"Lunch \xb7 Starters",name:"Mushrooms Baked in a Cream & Cheese Sauce with Toasted Ciabatta",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-smoked-haddock-salmon-chowder",section:"Lunch \xb7 Starters",name:"Smoked Haddock & Salmon Chowder",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Lunch \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-blackened-salmon-warm-potato-salad-a-pepper-must",section:"Lunch \xb7 Mains",name:"Blackened Salmon, Warm Potato Salad & a Pepper & Mustard Seed Dressing",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chicken-breast-coated-in-panko-crumb-with-a-ligh",section:"Lunch \xb7 Mains",name:"Chicken Breast Coated in Panko Crumb with a Lightly Spiced Sweet & Sour Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-fillet-of-pork-topped-with-banana-finished-with",section:"Lunch \xb7 Mains",name:"Fillet of Pork Topped with Banana Finished with a Creamy Coconut & Mango Curry Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-haddock-mornay-or-a-lemon-butter",section:"Lunch \xb7 Mains",name:"Haddock \u201cMornay\u201d or a Lemon Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-chicken-piri-piri-szechuan-peppers-spices-served",section:"Lunch \xb7 Mains",name:"Chicken \u2018Piri-Piri\u2019 Szechuan Peppers & Spices served with a Yoghurt & Spring Onion Mayonnaise",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-lamb-fillet-with-a-cracked-black-pepper-cream-br",section:"Lunch \xb7 Mains",name:"Lamb Fillet with a Cracked Black Pepper Cream & Brandy Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00 \xb7 \xa32.00 supplement"},{id:"wi-lunch-pan-fried-fillet-of-hake-with-a-lobster-glaze",section:"Lunch \xb7 Mains",name:"Pan Fried Fillet of Hake with a Lobster Glaze",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-supreme-of-chicken-suedoise-white-wine-swiss-che",section:"Lunch \xb7 Mains",name:"Supreme of Chicken \u2018Suedoise\u2019 White Wine, Swiss Cheese, Cream & Mushrooms",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-spicy-chilli-with-rice-topped-with-onions-cheese",section:"Lunch \xb7 Mains",name:"Spicy Chilli with Rice Topped with Onions & Cheese",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-haddock-in-breadcrumbs-or-tempura-served-with-ta",section:"Lunch \xb7 Mains",name:"Haddock in Breadcrumbs or Tempura served with Tartar Sauce & Lemon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-lambs-liver-bacon",section:"Lunch \xb7 Mains",name:"Lambs Liver & Bacon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa324.00 / 3 courses \xa331.00"},{id:"wi-lunch-any-extra-servings",section:"Lunch \xb7 Mains",name:"Any Extra Servings",description:"Each extra serving",price:395,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-dinner-tiger-prawns-tempura-with-a-sweet-chilli-dip",section:"Dinner \xb7 Starters",name:"Tiger Prawns Tempura with a Sweet Chilli Dip",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-smoked-haddock-bacon-gratin-with-braised-rice",section:"Dinner \xb7 Starters",name:"Smoked Haddock & Bacon Gratin with Braised Rice",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Dinner \xb7 Starters",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-spiced-chicken-salad-with-caesar-dressing-parmes",section:"Dinner \xb7 Starters",name:"Spiced Chicken Salad with Caesar Dressing & Parmesan",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-chefs-pate-with-grape-chutney-toast",section:"Dinner \xb7 Starters",name:"Chefs Pate with Grape Chutney & Toast",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-melon-fan-with-fresh-fruits-sorbet-mango-coulis",section:"Dinner \xb7 Starters",name:"Melon Fan with Fresh Fruits, Sorbet & Mango Coulis",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-smoked-haddock-salmon-chowder",section:"Dinner \xb7 Starters",name:"Smoked Haddock & Salmon Chowder",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Dinner \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-pear-poached-in-grenadine-with-prawns-marie-rose",section:"Dinner \xb7 Starters",name:"Pear Poached in Grenadine with Prawns Marie Rose",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-crayfish-avocado-melon-cocktail",section:"Dinner \xb7 Starters",name:"Crayfish, Avocado & Melon Cocktail",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-blackened-sea-bass-served-with-mixed-salad-a-swe",section:"Dinner \xb7 Mains",name:"Blackened Sea Bass served with Mixed Salad & a Sweet Pepper Vinaigrette",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-roast-rack-of-lamb-minted-peas-pan-juices",section:"Dinner \xb7 Mains",name:"Roast Rack of Lamb, Minted Peas & Pan Juices",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa32.50 supplement"},{id:"wi-dinner-roast-breast-of-duck-with-a-pink-peppercorn-bran",section:"Dinner \xb7 Mains",name:"Roast Breast of Duck with a Pink Peppercorn & Brandy Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-supreme-of-chicken-suedoise-white-wine-swiss-che",section:"Dinner \xb7 Mains",name:"Supreme of Chicken \u2018Suedoise\u2019 White Wine, Swiss Cheese, Cream & Mushrooms",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-lambs-liver-bacon-with-a-red-wine-jus",section:"Dinner \xb7 Mains",name:"Lambs Liver & Bacon with a Red Wine Jus",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-haddock-mornay-or-a-lemon-butter",section:"Dinner \xb7 Mains",name:"Haddock \u201cMornay\u201d or a Lemon Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-entrecote-steak-with-large-onion-rings-a-choice",section:"Dinner \xb7 Mains",name:"Entrecote Steak with Large Onion Rings & a Choice of Sauces",description:"Diane, Pepper or Caf\xe9 de Paris",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa38.00 supplement"},{id:"wi-dinner-haddock-in-breadcrumbs-or-tempura-served-with-ta",section:"Dinner \xb7 Mains",name:"Haddock in Breadcrumbs or Tempura served with Tartar Sauce & Lemon",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-fillet-of-salmon-chicken-with-two-sauces-lobster",section:"Dinner \xb7 Mains",name:"Fillet of Salmon & Chicken with Two Sauces - \u2018Lobster\u2019 & White Wine Cream & Mushroom",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-fillet-steak-with-a-cracked-black-pepper-cream-s",section:"Dinner \xb7 Mains",name:"Fillet Steak with a Cracked Black Pepper & Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50 \xb7 \xa312.00 supplement"},{id:"wi-dinner-fillet-of-pork-on-a-haggis-cake-with-a-mustard-g",section:"Dinner \xb7 Mains",name:"Fillet of Pork on a Haggis Cake with a Mustard Grain Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-wildings-chicken-schnitzel-topped-with-garlic-he",section:"Dinner \xb7 Mains",name:"Wildings Chicken Schnitzel Topped with Garlic & Herb Butter",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-spicy-chilli-with-rice-topped-with-onions-cheese",section:"Dinner \xb7 Mains",name:"Spicy Chilli with Rice Topped with Onions & Cheese",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"2 courses \xa327.50 / 3 courses \xa334.50"},{id:"wi-dinner-any-extra-servings",section:"Dinner \xb7 Mains",name:"Any Extra Servings",description:"Each extra serving",price:395,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-vegetarian-roast-red-pepper-tomato-soup",section:"Vegetarian \xb7 Starters",name:"Roast Red Pepper & Tomato Soup",description:"",price:null,dietary:["GF option"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-breaded-goats-cheese-served-on-a-sun-dried-tomat",section:"Vegetarian \xb7 Starters",name:"Breaded Goats Cheese Served on a Sun-Dried Tomato & Balsamic Salad",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-melon-fan-with-sorbet-fruit-coulis",section:"Vegetarian \xb7 Starters",name:"Melon Fan with Sorbet & Fruit Coulis",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-mushrooms-baked-in-a-cream-cheese-sauce-with-toa",section:"Vegetarian \xb7 Starters",name:"Mushrooms Baked in a Cream & Cheese Sauce with Toasted Ciabatta",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-leek-potato-gnocchi-topped-with-goats-cheese-a-w",section:"Vegetarian \xb7 Mains",name:"Leek & Potato Gnocchi Topped with Goats Cheese, a White Wine Cream Sauce & Tomato Concasse",description:"Starter or Main",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-cajun-vegetables-crepe-glazed-in-a-cream-sauce",section:"Vegetarian \xb7 Mains",name:"Cajun Vegetables Crepe Glazed in a Cream Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-vegan-curried-chickpea-with-cherry-tomatoes-wilt",section:"Vegetarian \xb7 Mains",name:"Vegan Curried Chickpea with Cherry Tomatoes & Wilted Spinach",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-vegetable-tempura",section:"Vegetarian \xb7 Mains",name:"Vegetable Tempura",description:"",price:null,dietary:["GF option","VG"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-mushroom-stroganoff-with-rice",section:"Vegetarian \xb7 Mains",name:"Mushroom Stroganoff with Rice",description:"",price:null,dietary:["GF option"],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-vegetarian-sundried-tomato-feta-olive-tartlet-finished-with",section:"Vegetarian \xb7 Mains",name:"Sundried Tomato, Feta & Olive Tartlet, Finished with a Tomato Concasse & a Basil Dressing",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Ask staff"},{id:"wi-sweets-trio-of-homemade-ice-creams",section:"Sweets \xb7 Desserts",name:"Trio of Homemade Ice Creams",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-cr-me-caramel-with-passion-fruit-ice-cream",section:"Sweets \xb7 Desserts",name:"Cr\xe8me Caramel with Passion Fruit Ice Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-vanilla-cheesecake-with-strawberry-coulis-fresh",section:"Sweets \xb7 Desserts",name:"Vanilla Cheesecake with Strawberry Coulis & Fresh Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-sticky-toffee-pudding",section:"Sweets \xb7 Desserts",name:"Sticky Toffee Pudding",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-affogato",section:"Sweets \xb7 Desserts",name:"\u2018Affogato\u2019",description:"Wildings Ice Cream with a Shot of Espresso",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-chocolate-and-orange-liqueur-pot",section:"Sweets \xb7 Desserts",name:"Chocolate and Orange Liqueur Pot",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-rice-pudding-with-an-apple-compote",section:"Sweets \xb7 Desserts",name:"Rice Pudding with an Apple Compote",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-crepes-filled-with-bananas-and-maple-syrup",section:"Sweets \xb7 Desserts",name:"Crepes filled with Bananas and Maple Syrup",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-meringue-vacherin-with-a-berry-liqueur-compote",section:"Sweets \xb7 Desserts",name:"Meringue Vacherin with a Berry Liqueur Compote",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-bread-butter-pudding-with-pouring-cream",section:"Sweets \xb7 Desserts",name:"Bread & Butter Pudding with Pouring Cream",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"Third course of the set menu"},{id:"wi-sweets-selection-of-cheese-with-biscuits-grapes-chutney",section:"Sweets \xb7 Desserts",name:"Selection of Cheese with Biscuits, Grapes & Chutney",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"\xa33.00 supplement"},{id:"wi-sweets-tea",section:"Sweets \xb7 Hot drinks",name:"Tea",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-decaf-tea",section:"Sweets \xb7 Hot drinks",name:"Decaf Tea",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-espresso",section:"Sweets \xb7 Hot drinks",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-americano",section:"Sweets \xb7 Hot drinks",name:"Americano",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-latte",section:"Sweets \xb7 Hot drinks",name:"Latte",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-flat-white",section:"Sweets \xb7 Hot drinks",name:"Flat White",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-cappuccino",section:"Sweets \xb7 Hot drinks",name:"Cappuccino",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-mocha",section:"Sweets \xb7 Hot drinks",name:"Mocha",description:"",price:365,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-sweets-irish-coffee",section:"Sweets \xb7 Hot drinks",name:"Irish Coffee",description:"",price:775,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0},{id:"wi-kids-cheesy-garlic-bread",section:"Kids \xb7 Starters",name:"Cheesy Garlic Bread",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-melon-sorbet",section:"Kids \xb7 Starters",name:"Melon & Sorbet",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-soup-of-the-day",section:"Kids \xb7 Starters",name:"Soup of the Day",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-breaded-haddock",section:"Kids \xb7 Mains",name:"Breaded Haddock",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-pasta-with-a-cheese-sauce-or-tomato-sauce",section:"Kids \xb7 Mains",name:"Pasta with a Cheese Sauce or Tomato Sauce",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-fish-pie",section:"Kids \xb7 Mains",name:"Fish Pie",description:"",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-tempura-chicken-goujons",section:"Kids \xb7 Mains",name:"Tempura Chicken Goujons",description:"All can be served with Fries and a choice of Beans or Vegetables",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"},{id:"wi-kids-homemade-ice-cream",section:"Kids \xb7 Dessert",name:"Homemade Ice Cream",description:"Please ask Staff for Our Ice Cream Selection",price:null,dietary:[],allergens:{},allergenNotes:"Please inform staff of any allergies. The venue cannot guarantee items are 100% safe for coeliac disease or severe gluten allergies.",prepMins:0,priceNote:"1 course \xa39.00 / 2 courses \xa310.00 / 3 courses \xa311.00"}].map(s=>({...s,restaurantId:"wildings",soldOut:!1,signOff:null}))},1211,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SECTIONS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anchorageMenu",{enumerable:!0,get:function(){return o}});const i=i=>({id:i,name:'Served with',required:!0,multi:!1,choices:[{id:`${i}-custard`,label:'Custard',priceDelta:0,allergens:{}},{id:`${i}-icecream`,label:'Ice cream',priceDelta:0,allergens:{}},{id:`${i}-cream`,label:'Cream',priceDelta:0,allergens:{}},{id:`${i}-vegan`,label:'Vegan ice cream (ask server)',priceDelta:0,allergens:{}}]}),s=(i,s,n)=>({id:i,name:'Portion',required:!0,multi:!1,choices:[{id:`${i}-starter`,label:'Starter',priceDelta:0},{id:`${i}-main`,label:n,priceDelta:s}]}),n=[{id:'a-soup',section:'Starters',name:"Chef's Soup of the Day",description:'A heartwarming bowl of seasonal homemade soup, served with warm crusty bread and butter.',price:600,dietary:[],allergens:{},allergenNotes:'Recipe changes daily \u2014 check the day\u2019s soup.',prepMins:0},{id:'a-skink',section:'Starters',name:'Cullen Skink',description:'Traditional creamy soup made with locally smoked haddock, potatoes and leeks, served with warm crusty bread and butter.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-salmon',section:'Starters',name:'Scottish Smoked Salmon Roulade',description:'Delicate Scottish smoked salmon rolled with herb-infused cream cheese, served with garlic & herb crostini and dressed salad.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-haggis',section:'Starters',name:'Haggis Bon Bons',description:'Crisp golden panko-fried haggis balls, finished with a velvety Scotch whisky sauce and caramelised apple gel.',price:800,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-crabcakes',section:'Starters',name:'Spiced Crab Cakes',description:'Golden crab cakes, delicately seasoned with herbs and spices, served with crisp seasonal salad and house-made Marie Rose sauce.',price:900,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-tempura',section:'Starters',name:'Deluxe Mixed Tempura',description:"King prawns, chicken and lion's mane mushrooms in a light, crispy tempura batter, served with a dressed seasonal salad and house dipping sauce.",price:1e3,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[s('tempura',900,'Main with triple-cooked chips (\xa319.00)')]},{id:'a-kingoyster',section:'Starters',name:"Pan-Seared King Oyster Mushroom 'Scallops' (VG)",description:"King oyster mushroom 'scallops' prepared with the chef's special recipe of the day. Ask your server or see our specials board for today's garnish and accompaniments.",price:1e3,dietary:['VG'],allergens:{},allergenNotes:'Garnish changes daily \u2014 sign-off needed for each version.',prepMins:0,special:!0,unsigned:!0,optionGroups:[s('kingoyster',800,'Main (\xa318.00)')]},{id:'a-fishsupper',section:'Mains',name:'Fish Supper',description:'Locally landed haddock, available beer-battered or breaded, served with buttered peas, triple-cooked chips and homemade tartare sauce.',price:1800,dietary:['GF option'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'fs-coat',name:'Coating',required:!0,multi:!1,choices:[{id:'fs-batter',label:'Beer-battered',priceDelta:0},{id:'fs-bread',label:'Breaded',priceDelta:0}]}]},{id:'a-lionsmane',section:'Mains',name:"Southern Fried Lion's Mane Burger (VG)",description:"Crispy southern fried lion's mane mushroom, layered with vegan cheese and garlic aioli, served with triple-cooked chips and golden onion rings.",price:1800,dietary:['VG'],allergens:{},prepMins:0},{id:'a-pie',section:'Mains',name:'Steak & Ale Pie',description:'Slow-braised beef in a rich ale jus beneath golden all-butter puff pastry, served with buttered seasonal vegetables.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'pie-side',name:'Served with',required:!0,multi:!1,choices:[{id:'chips',label:'Triple-cooked chips',priceDelta:0},{id:'creamed',label:'Creamed potatoes',priceDelta:0,allergens:{}}]}]},{id:'a-bananablossom',section:'Mains',name:"Beer-Battered Banana Blossom 'Fish' Goujons (VG)",description:'Crisp beer-battered banana blossom goujons, dusted with locally foraged truffle seaweed seasoning, served with triple-cooked chips, garden peas and vegan tartare sauce.',price:1700,dietary:['VG'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-chicken',section:'Mains',name:'Roasted Breast of Chicken',description:'Golden pan-roasted chicken breast, served with creamed potatoes, buttered seasonal primaryBtns, and a fragrant lemon & thyme bouillon.',price:1900,dietary:[],allergens:{},prepMins:0},{id:'a-maccheese',section:'Mains',name:'Macaroni Cheese (V)',description:'Rich mature Cheddar macaroni finished with a golden cheese glaze, served with two slices of garlic bread.',price:1700,dietary:['V'],allergens:{},prepMins:0},{id:'a-penne',section:'Mains',name:'Cajun Chicken & Chorizo Penne Pasta',description:'Tender Cajun-spiced chicken strips, mixed peppers, red onion and smoky chorizo, tossed in a bold, creamy Cajun sauce, served with two slices of garlic bread.',price:1700,dietary:[],allergens:{},prepMins:0},{id:'a-caesar',section:'Mains',name:'Chicken Caesar Salad',description:'Tender pan-roasted chicken breast served on a bed of baby gem lettuce with golden garlic croutons, Parmesan and a classic Caesar dressing.',price:1800,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'caesar-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'caesar-bacon',label:'Add smoked Ayrshire bacon',priceDelta:150}]}]},{id:'a-moules',section:'Mains',name:'Moules Marini\xe8re',description:'Fresh Scottish mussels, steamed to perfection in a rich, creamy white wine and garlic sauce.',price:1200,dietary:[],allergens:{},prepMins:0,optionGroups:[s('moules',1e3,'Main 500g with triple-cooked chips (\xa322.00)')]},{id:'a-fillet',section:'From the Grill',name:'8oz Fillet Steak',description:'Prime 8oz fillet steak served with truffled woodland mushrooms, seasonal primaryBtns, golden onion rings and triple-cooked chips.',price:3800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'steak-sauce',name:'Sauce',required:!1,multi:!1,choices:[{id:'sauce-pepper',label:'Peppercorn sauce',priceDelta:0,allergens:{}},{id:'sauce-garlic',label:'Garlic butter',priceDelta:0,allergens:{}}]},{id:'steak-surf',name:'Surf & turf add-on',required:!1,multi:!1,choices:[{id:'surf-prawns',label:'Garlic prawns',priceDelta:800,allergens:{}},{id:'surf-scallops',label:'Scottish West Coast scallops',priceDelta:1e3,allergens:{}}]}]},{id:'a-claymore',section:'From the Grill',name:'The Claymore Burger',description:'One juicy 6oz homemade Scottish beef burger in a brioche bun with baby gem lettuce, tomato and gherkins, topped with cheese, smoked Ayrshire bacon and onion rings. Served with triple-cooked chips.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'claymore-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'claymore-haggis',label:'Add haggis and whisky sauce',priceDelta:150,allergens:{}}]}]},{id:'a-langoustines',section:"Captain's Table",name:'Whole Scottish Grilled Langoustines',description:'Locally caught whole Scottish langoustines grilled in garlic butter, served with a vibrant side salad and burnt lemon.',price:1700,dietary:[],allergens:{},prepMins:0,optionGroups:[s('lang',1200,'Main 500g with triple-cooked chips (\xa329.00)')]},{id:'a-scallops',section:"Captain's Table",name:'Pan-Seared West Coast Scallops',description:"Scottish West Coast scallops prepared to the chef's recipe of the day. Starter and main portions \u2014 see price on Specials Board.",price:null,priceNote:'See specials board',dietary:[],allergens:{},prepMins:0,special:!0,unsigned:!0},{id:'a-lobster',section:"Captain's Table",name:'Grilled Dunure Lobster',description:'Fresh Dunure lobster, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:3500,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'lobster-size',name:'Size',required:!0,multi:!1,choices:[{id:'lob-half',label:'Half',priceDelta:0},{id:'lob-whole',label:'Whole (\xa365.00)',priceDelta:3e3}]}]},{id:'a-crab',section:"Captain's Table",name:'Grilled Dunure Crab',description:'Freshly landed Dunure brown crab, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:4e3,dietary:[],allergens:{},prepMins:0},{id:'a-smorgasbord',section:'Platters',name:'Seafood Smorgasbord (serves one)',description:"250g langoustines, 3 pan-seared West Coast scallops, 250g fresh mussels, 6 garlic prawns and a roll of Scottish smoked salmon, with dressed side salad and warm crusty bread.",price:5e3,dietary:[],allergens:{},prepMins:0},{id:'a-deluxe',section:'Platters',name:'Deluxe Seafood Platter (serves two)',description:'One whole Dunure lobster, one whole Dunure crab, 500g whole langoustines, 500g moules marini\xe8re, pan-seared scallops, Scottish smoked salmon and 6 garlic prawns, with two portions of chips, side salad and warm crusty bread.',price:16500,dietary:[],allergens:{},prepMins:0},{id:'a-onionrings',section:'Sides',name:'House Beer-Battered Onion Rings (V)',description:'Crisp house beer-battered onion rings, served golden and crunchy.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-garlicbread',section:'Sides',name:'Garlic Bread (V)',description:'Warm toasted garlic bread, finished with garlic & parsley butter.',price:450,dietary:['V'],allergens:{},prepMins:0,optionGroups:[{id:'gb-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'gb-cheese',label:'Add cheese',priceDelta:100}]}]},{id:'a-chips',section:'Sides',name:'Triple-Cooked Chips (V)',description:'Golden triple-cooked chips, lightly tossed in Maldon sea salt.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'chips-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'chips-cajun',label:'Add Cajun seasoning',priceDelta:0,allergens:{}}]}]},{id:'a-truffle',section:'Sides',name:'Parmesan & Truffle Fries (V)',description:'Crispy fries topped with finely grated parmesan and tossed in a winter truffle infused oil.',price:500,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-salad',section:'Sides',name:'Side Salad (VG)',description:'Seasonal mixed leaves with cucumber, red onion and mixed peppers, finished with a light vinaigrette.',price:450,dietary:['VG'],allergens:{},prepMins:0},{id:'a-brulee',section:'Desserts',name:"Chef's Cr\xe8me Br\xfbl\xe9e of the Day (V)",description:"Smooth Madagascan custard with a delicately caramelised sugar crust. Ask your server or see our specials board for today's flavour.",price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-crumble',section:'Desserts',name:'Seasonal Fruit Crumble (V)',description:'Slow-cooked seasonal fruit topped with a golden buttery crumble.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('crumble')]},{id:'a-stp',section:'Desserts',name:'Sticky Toffee Pudding (V)',description:'A rich, homemade steamed date pudding, drenched in our signature homemade butterscotch sauce.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('stp')]},{id:'a-cheesecake',section:'Desserts',name:'Cheesecake of the Day (V)',description:'A smooth, creamy cheesecake on a buttery biscuit base. Gluten-free and vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('cheesecake')]},{id:'a-affogato',section:'Desserts',name:'Affogato (V)',description:'Two scoops of creamy vanilla ice cream with a freshly brewed shot of Italian espresso poured over. Vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0}],t=['Starters','Mains','From the Grill',"Captain's Table",'Platters','Sides','Desserts','Mini Anchors (under 12s)'],o=n.map(({unsigned:i,soldOut:s,...n})=>({...n,allergens:{},allergenNotes:'',prepMins:0,optionGroups:n.optionGroups?.map(i=>({...i,choices:i.choices.map(i=>({...i,allergens:{}}))})),restaurantId:"anchorage",soldOut:!!s,signOff:null}))},1212,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SCOTTISH_BANK_HOLIDAYS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"BANK_HOLIDAY_SOURCE",{enumerable:!0,get:function(){return n}});const t=[{date:"2026-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2026-12-25",title:"Christmas Day",notes:""},{date:"2026-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2027-01-01",title:"New Year\u2019s Day",notes:""},{date:"2027-01-04",title:"2nd January",notes:"Substitute day"},{date:"2027-03-26",title:"Good Friday",notes:""},{date:"2027-05-03",title:"Early May bank holiday",notes:""},{date:"2027-05-31",title:"Spring bank holiday",notes:""},{date:"2027-08-02",title:"Summer bank holiday",notes:""},{date:"2027-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2027-12-27",title:"Christmas Day",notes:"Substitute day"},{date:"2027-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2028-01-03",title:"New Year\u2019s Day",notes:"Substitute day"},{date:"2028-01-04",title:"2nd January",notes:"Substitute day"},{date:"2028-04-14",title:"Good Friday",notes:""},{date:"2028-05-01",title:"Early May bank holiday",notes:""},{date:"2028-05-29",title:"Spring bank holiday",notes:""},{date:"2028-08-07",title:"Summer bank holiday",notes:""},{date:"2028-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2028-12-25",title:"Christmas Day",notes:""},{date:"2028-12-26",title:"Boxing Day",notes:""}],n='gov.uk/bank-holidays.json (Scotland)'},1213,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MESSAGING_CONFIG",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"previewProvider",{enumerable:!0,get:function(){return t}}),_e.relayProvider=n,Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"activeProvider",{enumerable:!0,get:function(){return s}});const e={mode:'preview',endpoint:'',smsService:'Twilio',emailService:'Postmark',smsSenderId:'ANCHORAGE',fromEmail:'bookings@your-venue.co.uk'},t={id:'preview',label:'Preview mode (nothing is sent)',live:!1,deliver:async()=>({ok:!0})};function n(e){return{id:'relay',label:'Your messaging server',live:!0,deliver:async t=>{try{const n=await fetch(e,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({channel:t.channel,to:t.to,subject:t.subject,body:t.body,html:t.html,ref:t.ref,kind:t.kind,restaurantId:t.restaurantId})});if(!n.ok)return{ok:!1,error:`Server said ${n.status}`};return{ok:!0,providerId:(await n.json().catch(()=>({}))).id}}catch(e){return{ok:!1,error:e?.message??'Network error'}}}}}const o=()=>'live'===e.mode&&!!e.endpoint,s=()=>o()?n(e.endpoint):t},1214,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"DEFAULT_TEMPLATES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PLACEHOLDERS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"teamName",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"longDate",{enumerable:!0,get:function(){return u}}),e.bookingVars=function(n,r){const o=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen).toLowerCase()}`).join(', '),a=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),i=`${n.partySize} ${1===n.partySize?'person':'people'}`,s={...c(r),first:l(n.name),name:n.name.trim(),date:u(n.date),time:n.time,covers:i,ref:n.ref};return{sms:{...s,allergy:n.allergies.length?` We\u2019ve noted the allergy (${o}) and the team will check it with you when you arrive.`:'',note:'',details:''},email:{...s,allergy:n.allergies.length?`Thank you for telling us about: ${a}. Our team will go through this with you when you arrive, and every dish for your table is checked at each step, from the kitchen to your table.`:'',note:n.notes.trim()?`Your note to us: "${n.notes.trim()}". We\u2019ll make sure the team sees it.`:'',details:[`Date: ${u(n.date)}`,`Time: ${n.time}`,`Table for: ${i}`,`Reference: ${n.ref}`].join('\n')}}},e.orderVars=function(r,o){const a=r.lines.reduce((t,n)=>t+n.qty,0),i=r.readyBy??r.slotTime,s=i?`at ${m(i)}`:'time to be confirmed',d=r.allergies.map(n=>(0,t.allergenLabel)(n.allergen).toLowerCase()).join(', '),u=r.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),y={...c(o),first:l(r.customerName),name:r.customerName,ref:r.ref,items:`${a} ${1===a?'item':'items'}`,total:(0,n.gbp)(r.total),collect:s,date:'',time:i?m(i):'',covers:''};return{sms:{...y,allergy:r.allergies.length?` We\u2019ve noted your allergy (${d}); the kitchen checks every item.`:'',itemList:'',details:'',note:''},email:{...y,allergy:r.allergies.length?`You told us about: ${u}. The kitchen signs off every item against it before your order leaves the pass.`:'',itemList:r.lines.map(t=>`${t.qty} \xd7 ${t.name}${t.choices.length?` (${t.choices.join(', ')})`:''}`).join('\n'),details:[`Order: ${r.ref}`,`Collection: ${i?m(i):'time to be confirmed'}`,`Items: ${a}`,`Total: ${(0,n.gbp)(r.total)}`].join('\n'),note:''}}},e.fill=y,Object.defineProperty(e,"fillEmailText",{enumerable:!0,get:function(){return h}}),e.emailHtml=function(t,n){const r=n.accent??'#B8893E',o=t.split(/\n{2,}/).map(t=>{const n=t.split('\n');return n.length>1&&n.every(t=>/^[^:]{2,22}:\s.+/.test(t))?`${n.map(t=>{const n=t.indexOf(':');return``}).join('')}
${p(t.slice(0,n))}${p(t.slice(n+1).trim())}
`:n.length>1&&n.every(t=>/^\d+ \xd7/.test(t))?`
    ${n.map(t=>`
  • ${p(t)}
  • `).join('')}
`:`

${n.map(p).join('
')}

`}).join('');return`${p(n.preheader??'')}
${p(n.venue.toUpperCase())}
${o}
You\u2019re getting this because you made a booking or order with ${p(n.venue)}. It\u2019s about your booking only, not marketing.
`},e.smsParts=function(t){const n=b(t),r=!f.test(n),o=n.length,a=r?o<=70?1:Math.ceil(o/67):o<=160?1:Math.ceil(o/153);return{chars:o,parts:a,unicode:r}},Object.defineProperty(e,"toGsm",{enumerable:!0,get:function(){return b}});var t=_r(_d[0]),n=_r(_d[1]);const r={booking:{title:'Booking confirmed',when:'Every booking: online, phone or in person (and when you confirm a request)'},request:{title:'Booking request received',when:'Online bookings that need you to confirm them first'},declined:{title:'Booking request declined',when:'When you decline a booking request'},order:{title:'Takeaway order confirmed',when:'Every takeaway order from the app (and phone orders with a number)'}},o={booking:{sms:'Hi {first}, you\u2019re booked in at {venue}: {date} at {time}, {covers}. Ref {ref}.{allergy} Need to change or cancel? Just call {venuePhone}. See you soon, {team}',subject:'You\u2019re booked in at {venue}: {date} at {time}',body:'Hi {first},\n\nThank you for booking with us. We\u2019re really looking forward to welcoming you.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf your plans change, just give us a ring on {venuePhone} and we\u2019ll happily move or cancel it for you. Please quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nWarm wishes,\n{team}'},request:{sms:'Hi {first}, thanks for your booking request at {venue} for {date} at {time}, {covers}. We\u2019ll text you shortly to confirm. Ref {ref}. Questions? Call {venuePhone}. {team}',subject:'We\u2019ve got your booking request for {date}',body:'Hi {first},\n\nThank you for your booking request. A member of the team will look at it and confirm with you very shortly.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf you have any questions in the meantime, call us on {venuePhone} and quote {ref}.\n\nWarm wishes,\n{team}'},declined:{sms:'Hi {first}, we\u2019re so sorry, we can\u2019t fit {covers} in on {date} at {time}. Please call {venuePhone} and we\u2019ll do our best to find another time. {team}',subject:'About your booking request for {date}',body:'Hi {first},\n\nThank you for asking to book with us. We\u2019re really sorry, but we can\u2019t fit your party in on {date} at {time}.\n\nWe\u2019d love to find another time that works. Give us a ring on {venuePhone} and we\u2019ll do our best.\n\nWith apologies and warm wishes,\n{team}'},order:{sms:'Hi {first}, thanks for your order {ref} from {venue}: {items}, {total}. Collection {collect}.{allergy} Questions? Call {venuePhone}. {team}',subject:'Your {venue} order {ref}',body:'Hi {first},\n\nThank you for your order. The kitchen has it and we\u2019ll have it ready for you.\n\n{details}\n\n{itemList}\n\n{allergy}\n\nAny questions, or need to change something? Call us on {venuePhone} and quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nEnjoy!\n{team}'}},a=[{key:'first',what:'Guest\u2019s first name'},{key:'name',what:'Name on the booking'},{key:'venue',what:'Venue name'},{key:'date',what:'Day and date'},{key:'time',what:'Time'},{key:'covers',what:'e.g. 4 people'},{key:'ref',what:'Reference'},{key:'venuePhone',what:'Venue phone'},{key:'address',what:'Venue address'},{key:'team',what:'e.g. The Anchorage team'},{key:'allergy',what:'Allergy reassurance (only if one was noted)'},{key:'note',what:'Their note (email only)'},{key:'details',what:'Details box (email only)'},{key:'items',what:'Orders: e.g. 3 items'},{key:'total',what:'Orders: total'},{key:'collect',what:'Orders: collection time'},{key:'itemList',what:'Orders: list of items (email)'}],i=t=>/^the\s/i.test(t.trim())?`${t.trim()} team`:`The ${t.trim()} team`,l=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||'there',s=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=['January','February','March','April','May','June','July','August','September','October','November','December'],u=t=>{const[n,r,o]=t.split('-').map(Number),a=new Date(n,r-1,o,12);return`${s[a.getDay()]} ${o} ${d[r-1]}`},m=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`};function c(t){return{venue:t.name,venuePhone:t.phone||'the restaurant',address:t.address||t.location,team:i(t.name)}}function y(t,n){return t.replace(/\{(\w+)\}/g,(t,r)=>r in n?n[r]:t).replace(/[ \t]{2,}/g,' ').replace(/ +([.,])/g,'$1').trim()}const h=(t,n)=>y(t,n).split(/\n{2,}/).map(t=>t.trim()).filter(Boolean).join('\n\n'),p=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"');const f=/^[A-Za-z0-9 \r\n@\xa3$\xa5\xe8\xe9\xf9\xec\xf2\xc7\xd8\xf8\xc5\xe5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\xc6\xe6\xdf\xc9!"#\xa4%&'()*+,\-./:;<=>?\xa1\xc4\xd6\xd1\xdc\xa7\xbf\xe4\xf6\xf1\xfc\xe0^{}\\[~\]|\u20ac]*$/;const b=t=>t.replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').replace(/[\u2013\u2014]/g,'-').replace(/\u2026/g,'...').replace(/\xd7/g,'x')},1215,[819,820]); +__d(function(g,_r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PHONE_ERROR",{enumerable:!0,get:function(){return s}}),e.ukPhone=function(s){if(!(s??'').trim())return{ok:!1,error:t};const o=n(r(s));return'bad'in o?{ok:!1,error:'chars'===o.bad?'Please use numbers only, for example 07700 900123.':'That doesn\u2019t look like a UK mobile or landline. For example 07700 900123 or 01292 502826.'}:o},e.guestPhone=function(o){if(!(o??'').trim())return{ok:!1,error:t};const u=r(o);if(/^(\+44|0044)/.test(u)||/^44\d{10}$/.test(u)||!/^(\+|00)/.test(u)){const t=n(u);return'bad'in t?{ok:!1,error:s}:t}const d=u.replace(/^(\+|00)/,'');if(!/^[1-9]\d+$/.test(d))return{ok:!1,error:s};const h=d.slice(0,l(d));let $=d.slice(h.length);$.startsWith('0')&&'39'!==h&&($=$.slice(1));return $.length<7||$.length>15||h.length+$.length>15?{ok:!1,error:s}:{ok:!0,e164:`+${h}${$}`,pretty:`+${h} ${c($)}`,kind:'international'}},e.emailOk=function(t){const s=(t??'').trim();return!s||/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s)};const t='A phone number is needed so we can send the confirmation.',s='That doesn\u2019t look like a phone number. For example 07700 900123 or +971 56 411 2017.';function n(t){if(t.startsWith('+44')?t='0'+t.slice(3):t.startsWith('0044')?t='0'+t.slice(4):/^44\d{10}$/.test(t)&&(t='0'+t.slice(2)),t.startsWith('0(0)')&&(t=t.replace('0(0)','0')),t.startsWith('00')&&(t=t.slice(1)),!/^0\d+$/.test(t))return{bad:'chars'};const s=/^07\d{9}$/.test(t),n=/^0[1238]\d{8,9}$/.test(t);if(!s&&!n)return{bad:'shape'};const r=s?`${t.slice(0,5)} ${t.slice(5)}`:/^02/.test(t)?`${t.slice(0,3)} ${t.slice(3,7)} ${t.slice(7)}`:/^0(3|8)/.test(t)?`${t.slice(0,4)} ${t.slice(4,7)} ${t.slice(7)}`:`${t.slice(0,5)} ${t.slice(5)}`;return{ok:!0,e164:'+44'+t.slice(1),pretty:r,kind:s?'mobile':'landline'}}const r=t=>(t??'').trim().replace(/[\s\-().]/g,'');const o=new Set('20 27 30 31 32 33 34 36 39 40 41 43 44 45 46 47 48 49 51 52 53 54 55 56 57 58 60 61 62 63 64 65 66 81 82 84 86 90 91 92 93 94 95 98'.split(' ')),l=t=>/^[17]/.test(t)?1:o.has(t.slice(0,2))?2:3;function c(t){const s=[t.slice(-4)];let n=t.slice(0,-4);for(;n.length>3;)s.unshift(n.slice(-3)),n=n.slice(0,-3);return n&&s.unshift(n),s.join(' ')}},1216,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shallow",{enumerable:!0,get:function(){return c}});const t=t=>Symbol.iterator in t,n=t=>"entries"in t,o=(t,n)=>{const o=t instanceof Map?t:new Map(t.entries()),s=n instanceof Map?n:new Map(n.entries());if(o.size!==s.size)return!1;for(const[t,n]of o)if(!s.has(t)||!Object.is(n,s.get(t)))return!1;return!0},s=(t,n)=>{const o=t[Symbol.iterator](),s=n[Symbol.iterator]();let c=o.next(),u=s.next();for(;!c.done&&!u.done;){if(!Object.is(c.value,u.value))return!1;c=o.next(),u=s.next()}return!!c.done&&!!u.done};function c(c,u){return!!Object.is(c,u)||"object"==typeof c&&null!==c&&"object"==typeof u&&null!==u&&(Object.getPrototypeOf(c)===Object.getPrototypeOf(u)&&(t(c)&&t(u)?n(c)&&n(u)?o(c,u):s(c,u):o({entries:()=>Object.entries(c)},{entries:()=>Object.entries(u)})))}},1217,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setLiveData=c,e.requireRealData=function(){t=!0,c(!0)},Object.defineProperty(e,"liveData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"examplesAllowed",{enumerable:!0,get:function(){return l}}),e.onDataModeChange=function(n){return s.add(n),()=>{s.delete(n)}},Object.defineProperty(e,"EXAMPLE_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"notEnoughTip",{enumerable:!0,get:function(){return b}});const n=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("abbotsford");let t=n,o=n;const s=new Set;function c(n){o!==(n=t||n)&&(o=n,s.forEach(n=>n()))}const u=()=>o,l=()=>!o;const f='Example figures',b=n=>`Forecasts start once CoverCharge has ${1===n?'1 week':`${n} weeks`} of your bookings and cash-ups.`},1218,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EXAMPLE_TAG",{enumerable:!0,get:function(){return t}}),_e.exampleCards=function(t){return l.flatMap(l=>{const h=t.find(e=>e.id===l.menuItemId);if(!h)return[];return[{id:(0,e.uuidFrom)(`card:${h.restaurantId}:${h.id}`),restaurantId:h.restaurantId,menuItemId:h.id,dish:h.name,section:h.section,price:h.price,photo:l.photo,ingredients:o(l.menuItemId,l.ings),steps:l.steps,allergens:l.allergens,dismissed:l.dismissed??[],allergenNotes:l.notes,allergensConfirmed:{by:s.by,at:s.at},signOff:l.awaiting?null:s,wasLive:!0,origin:'example',version:l.awaiting?2:1,createdAt:n,updatedAt:l.awaiting?'2026-10-28T15:20:00.000Z':n,updatedBy:l.awaiting?'Example edit (demo)':s.by}]})},_e.importedCard=function(t,s){return{id:(0,e.uuidFrom)(`card:${t.restaurantId}:${t.id}`),restaurantId:t.restaurantId,menuItemId:t.id,dish:t.name,section:t.section,price:t.price,ingredients:[],steps:[],allergens:{...t.allergens},dismissed:[],allergenNotes:t.allergenNotes,allergensConfirmed:t.signOff?{by:t.signOff.by,at:t.signOff.at}:void 0,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at}:null,wasLive:!t.hidden||!!t.signOff,origin:'imported',version:1,createdAt:s,updatedAt:s,updatedBy:'Imported from the menu'}};var e=r(d[0]);const t='Example data',s={by:'Example sign-off (demo)',at:'2026-10-26T10:00:00.000Z'},n='2026-10-26T09:00:00.000Z',o=(e,t)=>t.map(([t,s,n],o)=>({id:`${e}-i${o}`,qty:t,unit:s,name:n})),l=[{menuItemId:'a-lobster',photo:'asset:lobster',ings:[['1','whole','Live Dunure lobster (c. 600 g, Kitty Fisher)'],['60','g','Garlic butter'],['\xbd','','Lemon, charred'],['60','g','Mixed leaves, cucumber and red onion'],['15','ml','House vinaigrette (Dijon mustard)'],['200','g','Triple-cooked chips']],steps:['Chill the lobster for 20 minutes, then dispatch humanely and split lengthways. Remove the stomach sac and the intestinal tract.','Crack the claws. Season the flesh and spoon over half the garlic butter.','Grill flesh side up for 6\u20138 minutes until just opaque; baste with the rest of the butter.','Char the lemon on the grill. Dress the salad at the pass.','Plate on the long board: lobster, claws alongside, salad, chips in the cone, lemon and a pot of the pan butter.'],allergens:{crustaceans:'contains',milk:'contains',mustard:'contains',gluten:'may',fish:'may'},notes:'Chips are cooked in a shared fryer (gluten, fish, crustaceans may be present).'},{menuItemId:'a-skink',photo:'asset:skink',ings:[['120','g','Smoked haddock, undyed'],['200','ml','Whole milk'],['20','g','Butter'],['60','g','Leek, sliced'],['40','g','Onion, diced'],['120','g','Floury potato, diced'],['1','tbsp','Parsley, chopped'],['1','slice','Crusty bread'],['10','g','Butter (portion)']],steps:['Poach the haddock in the milk for 5 minutes. Lift out, flake and keep the milk.','Sweat the leek and onion in the butter until soft, with no colour.','Add the potato and the poaching milk; simmer for 15 minutes until the potato breaks down.','Crush a third of the potato for body, return the haddock and season with pepper.','Serve in the warm bowl, parsley on top, bread and butter on the side.'],allergens:{fish:'contains',milk:'contains',gluten:'contains'}},{menuItemId:'a-fishsupper',photo:'asset:fishsupper',ings:[['200','g','Haddock fillet, locally landed'],['80','g','Self-raising flour'],['100','ml','Beer (lager)'],['250','g','Triple-cooked chips'],['80','g','Garden peas'],['10','g','Butter'],['40','g','Tartare sauce (mayonnaise, capers, gherkins)'],['\xbc','','Lemon']],steps:['Whisk the flour and cold beer to a thick batter; rest for 10 minutes.','Dust the haddock in flour, dip in the batter and lower into the fryer at 180 \xb0C for 5\u20136 minutes.','Fry the chips at 190 \xb0C until golden.','Warm the peas with the butter.','Plate the fish on the chips, peas in the ramekin, tartare and lemon on the side.'],allergens:{fish:'contains',gluten:'contains',eggs:'contains',milk:'contains',mustard:'may',crustaceans:'may',sulphites:'may'},notes:'Shared fryer. Tartare is made with mayonnaise (egg, may contain mustard). The beer in the batter may contain sulphites.'},{menuItemId:'a-moules',photo:'asset:moules',ings:[['500','g','Scottish rope mussels, cleaned'],['30','g','Butter'],['1','','Shallot, finely diced'],['2','cloves','Garlic, sliced'],['100','ml','Dry white wine'],['60','ml','Double cream'],['1','tbsp','Parsley, chopped'],['2','slices','Crusty bread']],steps:['Check every mussel: discard any that are cracked or stay open when tapped.','Sweat the shallot and garlic in the butter for 2 minutes.','Add the mussels and wine, cover and steam on a high heat for 3\u20134 minutes until they open.','Discard any that stay shut. Stir in the cream and parsley.','Serve in the deep bowl with the bread and an empty-shell bowl.'],allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',gluten:'contains'}},{menuItemId:'a-stp',photo:'asset:stp',awaiting:!0,ings:[['30','g','Medjool dates, chopped'],['40','ml','Boiling water'],['25','g','Butter'],['30','g','Dark muscovado sugar'],['1','','Egg (\xbd per portion)'],['35','g','Self-raising flour'],['60','ml','Butterscotch sauce (butter, cream, brown sugar)']],steps:['Soak the dates in the boiling water for 10 minutes, then blitz.','Cream the butter and sugar, beat in the egg, fold in the flour and the dates.','Steam in buttered moulds for 35 minutes.','Warm the butterscotch sauce.','Turn out, pour over the sauce and serve with the guest\u2019s choice of custard, ice cream or cream.'],allergens:{gluten:'contains',milk:'contains',eggs:'contains',sulphites:'may'},notes:'Dried dates may contain sulphites. Accompaniments are chosen at order (see the dish options).'}]},1219,[1179]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg",width:800,height:600,toString(){return this.uri}}},1220,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg",width:800,height:600,toString(){return this.uri}}},1221,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},1222,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},1223,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/abbotsford/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},1224,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAvatars",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),o=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]);const l=(0,s.create)()((0,n.persist)((e,t)=>({photos:{},log:[],clears:{},doneClear:t=>e(e=>{if(!e.clears?.[t])return e;const o={...e.clears};return delete o[t],{clears:o}}),setOwn:(t,o,s,n)=>{if(!t||t!==o||!s.startsWith('data:image/'))return!1;const l=(new Date).toISOString();return e(e=>({clears:Object.fromEntries(Object.entries(e.clears??{}).filter(([e])=>e!==o)),photos:{...e.photos,[o]:{dataUrl:s,at:l}},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'made',by:n,at:l},...e.log].slice(0,100)})),!0},reset:(o,s)=>{if(s.id!==o&&'staff'===s.role)return!1;if(!t().photos[o])return!1;const n={...t().photos};return delete n[o],e(e=>({photos:n,clears:{...e.clears??{},[o]:(new Date).toISOString()},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'reset',by:s.name,at:(new Date).toISOString()},...e.log].slice(0,100)})),!0}}),{name:'covercharge-avatars-v1',storage:(0,n.createJSONStorage)(()=>o.default),version:1}))},1225,[1190,995,1191]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FunctionRegion",{enumerable:!0,get:function(){return e.FunctionRegion}}),Object.defineProperty(_e,"FunctionsError",{enumerable:!0,get:function(){return e.FunctionsError}}),Object.defineProperty(_e,"FunctionsFetchError",{enumerable:!0,get:function(){return e.FunctionsFetchError}}),Object.defineProperty(_e,"FunctionsHttpError",{enumerable:!0,get:function(){return e.FunctionsHttpError}}),Object.defineProperty(_e,"FunctionsRelayError",{enumerable:!0,get:function(){return e.FunctionsRelayError}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return t.PostgrestError}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return r.StorageApiError}}),Object.defineProperty(_e,"SupabaseClient",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"createClient",{enumerable:!0,get:function(){return N}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]);Object.keys(n).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return n[e]}})});var r=_r(d[3]),s=_r(d[4]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});let o,i="";var c;if("undefined"!=typeof Deno)i="deno",o=null===(c=Deno.version)||void 0===c?void 0:c.deno;else if("undefined"!=typeof document)i="web";else if("undefined"!=typeof navigator&&"ReactNative"===navigator.product)i="react-native";else{var u;i="node",o="undefined"!=typeof process?null===(u=process.version)||void 0===u?void 0:u.replace(/^v/,""):void 0}const l=[`runtime=${i}`];o&&l.push(`runtime-version=${o}`);const h={headers:{"X-Client-Info":`supabase-js/2.109.0; ${l.join("; ")}`}},f={schema:"public"},p={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},b={},v={enabled:!1,respectSamplingDecision:!0};let y=null;function w(){return e=this,t=void 0,r=function*(){try{const e=yield(null===y&&(y=import("@opentelemetry/api").catch(()=>null)),y);if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch(e){return null}},new((n=void 0)||(n=Promise))(function(s,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function c(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,c)}u((r=r.apply(e,t||[])).next())});var e,t,n,r}function k(e){if(!e||"string"!=typeof e)return null;const t=e.split("-");if(4!==t.length)return null;const[n,r,s,o]=t;if(2!==n.length||32!==r.length||16!==s.length||2!==o.length)return null;const i=/^[0-9a-f]+$/i;return i.test(n)&&i.test(r)&&i.test(s)&&i.test(o)?"00000000000000000000000000000000"===r||"0000000000000000"===s?null:{version:n,traceId:r,parentId:s,traceFlags:o,isSampled:!(1&~parseInt(o,16))}:null}function O(e,t){if(!e||!t||0===t.length)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch(e){return!1}for(const e of t)try{if("string"==typeof e){if(T(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if("function"==typeof e&&e(n))return!0}catch(e){continue}return!1}function T(e,t){if(t===e)return!0;if(t.startsWith("*.")){const n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith("."+n)))return!0}return!1}function P(e){const t=[];try{const n=new URL(e);t.push(n.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=j(e,"string");return"symbol"==S(t)?t:t+""}function U(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;te?(...t)=>e(...t):(...e)=>fetch(...e),F=(e,t,n,r,s)=>{const o=C(r),i=Headers,c=!0===(null==s?void 0:s.enabled),u=!1!==(null==s?void 0:s.respectSamplingDecision),l=c?P(t):null;return async(t,r)=>{var s;const c=null!==(s=await n())&&void 0!==s?s:e;let h=new i(null==r?void 0:r.headers);if(h.has("apikey")||h.set("apikey",e),h.has("Authorization")||h.set("Authorization",`Bearer ${c}`),l){const e=await _(t,l,u);e&&(e.traceparent&&!h.has("traceparent")&&h.set("traceparent",e.traceparent),e.tracestate&&!h.has("tracestate")&&h.set("tracestate",e.tracestate),e.baggage&&!h.has("baggage")&&h.set("baggage",e.baggage))}return o(t,R(R({},r),{},{headers:h}))}};async function _(e,t,n){if(!O("string"==typeof e||e instanceof URL?e:e.url,t))return null;const r=await w();if(!r||!r.traceparent)return null;if(n){const e=k(r.traceparent);if(e&&!e.isSampled)return null}return r}function L(e){return"boolean"==typeof e?{enabled:e}:e}function I(e,t){var n,r,s,o,i,c;const{db:u,auth:l,realtime:h,global:f}=e,{db:p,auth:b,realtime:v,global:y}=t,w=L(e.tracePropagation),k=L(t.tracePropagation),O={db:R(R({},p),u),auth:R(R({},b),l),realtime:R(R({},v),h),storage:{},global:R(R(R({},y),f),{},{headers:R(R({},null!==(n=null==y?void 0:y.headers)&&void 0!==n?n:{}),null!==(r=null==f?void 0:f.headers)&&void 0!==r?r:{})}),tracePropagation:{enabled:null!==(s=null!==(o=null==w?void 0:w.enabled)&&void 0!==o?o:null==k?void 0:k.enabled)&&void 0!==s&&s,respectSamplingDecision:null===(i=null!==(c=null==w?void 0:w.respectSamplingDecision)&&void 0!==c?c:null==k?void 0:k.respectSamplingDecision)||void 0===i||i},accessToken:async()=>""};return e.accessToken?O.accessToken=e.accessToken:delete O.accessToken,O}function D(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((n=t).endsWith("/")?n:n+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var n}var K=class extends s.AuthClient{constructor(e){super(e)}},x=class{constructor(e,n,s){var o,i;this.supabaseUrl=e,this.supabaseKey=n;const c=D(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,l=I(null!=s?s:{},{db:f,realtime:b,auth:R(R({},p),{},{storageKey:u}),global:h,tracePropagation:v});var y;(this.settings=l,this.storageKey=null!==(o=l.auth.storageKey)&&void 0!==o?o:"",this.headers=null!==(i=l.global.headers)&&void 0!==i?i:{},l.accessToken)?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!==(y=l.auth)&&void 0!==y?y:{},this.headers,l.global.fetch);this.fetch=F(n,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(R({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new t.PostgrestClient(new URL("rest/v1",c).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new r.StorageClient(this.storageUrl.href,this.headers,this.fetch,null==s?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new e.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t,n=this;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return null!==(e=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:o,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,lockAcquireTimeout:f,skipAutoInitialize:p},b,v){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K({url:this.authUrl.href,headers:R(R({},y),b),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,fetch:v,lockAcquireTimeout:f,skipAutoInitialize:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new n.RealtimeClient(this.realtimeUrl.href,R(R({},e),{},{params:R(R({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,n){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===n?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=n,this.realtime.setAuth(n))}};const N=(e,t,n)=>new x(e,t,n);(function(){if("undefined"!=typeof window)return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(null==t)return!1;const n=t.match(/^v(\d+)\./);return!!n&&parseInt(n[1],10)<=18})()&&console.warn("\u26a0\ufe0f Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")},1226,[1227,1232,1233,1248,1250]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return n.FunctionsClient}}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t.FunctionsError}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return t.FunctionsFetchError}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return t.FunctionsHttpError}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return t.FunctionsRelayError}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return t.FunctionRegion}});var n=r(d[0]),t=r(d[1])},1227,[1228,1231]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]),o=r(d[2]);class s{constructor(t,{headers:s={},customFetch:c,region:l=o.FunctionRegion.Any}={}){this.url=t,this.headers=s,this.region=l,this.fetch=(0,n.resolveFetch)(c)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(n){return(0,t.__awaiter)(this,arguments,void 0,function*(t,n={}){var s;let c,l;try{const{headers:u,method:f,body:h,signal:p,timeout:y}=n;let b={},{region:F}=n;F||(F=this.region);const v=new URL(`${this.url}/${t}`);let w;F&&'any'!==F&&(b['x-region']=F,v.searchParams.set('forceFunctionRegion',F));const j=!!u&&Object.keys(u).some(t=>'content-type'===t.toLowerCase());h&&!j?'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer?(b['Content-Type']='application/octet-stream',w=h):'string'==typeof h?(b['Content-Type']='text/plain',w=h):'undefined'!=typeof FormData&&h instanceof FormData?w=h:(b['Content-Type']='application/json',w=JSON.stringify(h)):w=!h||'string'==typeof h||'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer||'undefined'!=typeof FormData&&h instanceof FormData?h:JSON.stringify(h);let O=p;y&&(l=new AbortController,c=setTimeout(()=>l.abort(),y),p?(O=l.signal,p.addEventListener('abort',()=>l.abort())):O=l.signal);const x=yield this.fetch(v.toString(),{method:f||'POST',headers:Object.assign(Object.assign(Object.assign({},b),this.headers),u),body:w,signal:O}).catch(t=>{throw new o.FunctionsFetchError(t)}),B=x.headers.get('x-relay-error');if(B&&'true'===B)throw new o.FunctionsRelayError(x);if(!x.ok)throw new o.FunctionsHttpError(x);let C,T=(null!==(s=x.headers.get('Content-Type'))&&void 0!==s?s:'text/plain').split(';')[0].trim();return C='application/json'===T?yield x.json():'application/octet-stream'===T||'application/pdf'===T?yield x.blob():'text/event-stream'===T?x:'multipart/form-data'===T?yield x.formData():yield x.text(),{data:C,error:null,response:x}}catch(t){return{data:null,error:t,response:t instanceof o.FunctionsHttpError||t instanceof o.FunctionsRelayError?t.context:void 0}}finally{c&&clearTimeout(c)}})}}},1228,[1229,1230,1231]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return G}}),_e.__extends=t,Object.defineProperty(_e,"__assign",{enumerable:!0,get:function(){return r}}),_e.__rest=n,_e.__decorate=o,_e.__param=a,_e.__esDecorate=i,_e.__runInitializers=c,_e.__propKey=u,_e.__setFunctionName=s,_e.__metadata=f,_e.__awaiter=l,_e.__generator=p,Object.defineProperty(_e,"__createBinding",{enumerable:!0,get:function(){return y}}),_e.__exportStar=_,_e.__values=d,_e.__read=h,_e.__spread=b,_e.__spreadArrays=v,_e.__spreadArray=w,_e.__await=m,_e.__asyncGenerator=g,_e.__asyncDelegator=O,_e.__asyncValues=j,_e.__makeTemplateObject=P,_e.__importStar=x,_e.__importDefault=T,_e.__classPrivateFieldGet=I,_e.__classPrivateFieldSet=D,_e.__classPrivateFieldIn=R,_e.__addDisposableResource=k,_e.__disposeResources=F,_e.__rewriteRelativeImportExtension=C;var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){return function(r,n){t(r,n,e)}}function i(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,s="getter"===u?"get":"setter"===u?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,y=r.length-1;y>=0;y--){var _={};for(var d in n)_[d]="access"===d?{}:n[d];for(var d in n.access)_.access[d]=n.access[d];_.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[y])("accessor"===u?{get:l.get,set:l.set}:l[s],_);if("accessor"===u){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(c=i(h.get))&&(l.get=c),(c=i(h.set))&&(l.set=c),(c=i(h.init))&&o.unshift(c)}else(c=i(h))&&("field"===u?o.unshift(c):l[s]=c)}f&&Object.defineProperty(f,n.name,l),p=!0}function c(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function b(){for(var e=[],t=0;t1||c(e,t)})},t&&(n[e]=t(n[e])))}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,s):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:!1}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=d(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){o(n,a,(t=e[r](t)).done,t.value)})}}function o(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},E=function(e){return E=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},E(e)};function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=E(e),n=0;nt?(...n)=>t(...n):(...t)=>fetch(...t)},1230,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return u}});class t extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class n extends t{constructor(t){super('Failed to send a request to the Edge Function','FunctionsFetchError',t)}}class s extends t{constructor(t){super('Relay Error invoking the Edge Function','FunctionsRelayError',t)}}class o extends t{constructor(t){super('Edge Function returned a non-2xx status code','FunctionsHttpError',t)}}var u;!(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(u||(u={}))},1231,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PostgrestBuilder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"PostgrestClient",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"PostgrestFilterBuilder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"PostgrestQueryBuilder",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PostgrestTransformBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});const e=e=>Math.min(1e3*2**e,3e4),t=[520,503],r=["GET","HEAD","OPTIONS"];var s=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function n(e,t){return new Promise(r=>{if(null==t?void 0:t.aborted)return void r();const s=setTimeout(()=>{null==t||t.removeEventListener("abort",n),r()},e);function n(){clearTimeout(s),r()}null==t||t.addEventListener("abort",n)})}function i(e,s,n,i){return!(!i||n>=3)&&(!!r.includes(e)&&!!t.includes(s))}var l=class{constructor(e){var t,r,s,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,this.shouldStripNulls=null!==(s=e.shouldStripNulls)&&void 0!==s&&s,this.urlLengthLimit=null!==(n=e.urlLengthLimit)&&void 0!==n?n:8e3,this.retryEnabled=null===(i=e.retry)||void 0===i||i,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if("text/csv"===this.headers.get("Accept"))throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(t,s){var l=this;if(void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const e=this.headers.get("Accept");"application/vnd.pgrst.object+json"===e?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):e&&"application/json"!==e||this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const o=this.fetch;let h=(async()=>{let t=0;for(;;){const u={};let c;l.headers.forEach((e,t)=>{u[t]=e}),t>0&&(u["X-Retry-Count"]=String(t));try{c=await o(l.url.toString(),{method:l.method,headers:u,body:JSON.stringify(l.body,(e,t)=>"bigint"==typeof t?t.toString():t),signal:l.signal})}catch(s){if("AbortError"===(null==s?void 0:s.name)||"ABORT_ERR"===(null==s?void 0:s.code))throw s;if(!r.includes(l.method))throw s;if(l.retryEnabled&&t<3){const r=e(t);t++,await n(r,l.signal);continue}throw s}if(i(l.method,c.status,t,l.retryEnabled)){var s,h;const r=null!==(s=null===(h=c.headers)||void 0===h?void 0:h.get("Retry-After"))&&void 0!==s?s:null,i=null!==r?1e3*Math.max(0,parseInt(r,10)||0):e(t);await c.text(),t++,await n(i,l.signal);continue}return await l.processResponse(c)}})();return this.shouldThrowOnError||(h=h.catch(e=>{var t;let r="",s="",n="";const i=null==e?void 0:e.cause;if(i){var l,o,h,u;const t=null!==(l=null==i?void 0:i.message)&&void 0!==l?l:"",s=null!==(o=null==i?void 0:i.code)&&void 0!==o?o:"";r=`${null!==(h=null==e?void 0:e.name)&&void 0!==h?h:"FetchError"}: ${null==e?void 0:e.message}`,r+=`\n\nCaused by: ${null!==(u=null==i?void 0:i.name)&&void 0!==u?u:"Error"}: ${t}`,s&&(r+=` (${s})`),(null==i?void 0:i.stack)&&(r+=`\n${i.stack}`)}else{var c;r=null!==(c=null==e?void 0:e.stack)&&void 0!==c?c:""}const p=this.url.toString().length;return"AbortError"===(null==e?void 0:e.name)||"ABORT_ERR"===(null==e?void 0:e.code)?(n="",s="Request was aborted (timeout or manual cancellation)",p>this.urlLengthLimit&&(s+=`. Note: Your request URL is ${p} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):"HeadersOverflowError"!==(null==i?void 0:i.name)&&"UND_ERR_HEADERS_OVERFLOW"!==(null==i?void 0:i.code)||(n="",s="HTTP headers exceeded server limits (typically 16KB)",p>this.urlLengthLimit&&(s+=`. Your request URL is ${p} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:r,hint:s,code:n},data:null,count:null,status:0,statusText:""}})),h.then(t,s)}async processResponse(e){var t=this;let r=null,n=null,i=null,l=e.status,o=e.statusText;if(e.ok){var h,u;if("HEAD"!==t.method){var c;const i=await e.text();if(""===i);else if("text/csv"===t.headers.get("Accept"))n=i;else if(t.headers.get("Accept")&&(null===(c=t.headers.get("Accept"))||void 0===c?void 0:c.includes("application/vnd.pgrst.plan+text")))n=i;else try{n=JSON.parse(i)}catch(e){if(r={message:i},n=null,t.shouldThrowOnError)throw new s({message:i,details:"",hint:"",code:""})}}const p=null===(h=t.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),f=null===(u=e.headers.get("content-range"))||void 0===u?void 0:u.split("/");p&&f&&f.length>1&&(i=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,i=null,l=406,o="Not Acceptable"):n=1===n.length?n[0]:null)}else{const i=await e.text();try{r=JSON.parse(i),Array.isArray(r)&&404===e.status&&(n=[],r=null,l=200,o="OK")}catch(t){404===e.status&&""===i?(l=204,o="No Content"):r={message:i}}if(r&&t.shouldThrowOnError)throw new s(r)}return{success:null===r,error:r,data:n,count:i,status:l,statusText:o}}returns(){return this}overrideTypes(){return this}},o=class extends l{throwOnError(){return super.throwOnError()}select(e){let t=!1;const r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":("\""===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.order`:"order",l=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const n=void 0===s?"offset":`${s}.offset`,i=void 0===s?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(i,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:n=!1,format:i="text"}={}){var l;const o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,n?"wal":null].filter(Boolean).join("|"),h=null!==(l=this.headers.get("Accept"))&&void 0!==l?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${h}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const h=new RegExp("[,()]");var u=class extends o{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let n="";"plain"===s?n="pl":"phrase"===s?n="ph":"websearch"===s&&(n="w");const i=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${n}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>void 0!==t).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},c=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=null!=t?t:{},n=r?"HEAD":"GET";let i=!1;const l=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":("\""===e&&(i=!i),e)).join(""),{url:o,headers:h}=this.cloneRequestState();return o.searchParams.set("select",l),s&&h.append("Prefer",`count=${s}`),new u({method:n,url:o,headers:h,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const{url:n,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),r||i.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);n.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:n,headers:i,schema:this.schema,body:e,fetch:null!==(s=this.fetch)&&void 0!==s?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!0}={}){var i;const{url:l,headers:o}=this.cloneRequestState();if(o.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&l.searchParams.set("on_conflict",t),s&&o.append("Prefer",`count=${s}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);l.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:l,headers:o,schema:this.schema,body:e,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const{url:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new u({method:"PATCH",url:s,headers:n,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new u({method:"DELETE",url:r,headers:s,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=p(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=f(e,"string");return"symbol"==p(t)?t:t+""}function v(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function P(e){for(var t=1;t0?(e,t)=>{const r=new AbortController,s=setTimeout(()=>r.abort(),n),i=null==t?void 0:t.signal;if(i){if(i.aborted)return clearTimeout(s),o(e,t);const n=()=>{clearTimeout(s),r.abort()};return i.addEventListener("abort",n,{once:!0}),o(e,P(P({},t),{},{signal:r.signal})).finally(()=>{clearTimeout(s),i.removeEventListener("abort",n)})}return o(e,P(P({},t),{},{signal:r.signal})).finally(()=>clearTimeout(s))}:o,this.retry=l}from(e){if(!e||"string"!=typeof e||""===e.trim())throw new Error("Invalid relation name: relation must be a non-empty string.");return new c(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:s=!1,count:n}={}){var i;let l;const o=new URL(`${this.url}/rpc/${e}`);let h;const c=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(c)),p=r&&Object.values(t).some(c);p?(l="POST",h=t):r||s?(l=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{o.searchParams.append(e,t)})):(l="POST",h=t);const f=new Headers(this.headers);return p?f.set("Prefer",n?`count=${n},return=minimal`:"return=minimal"):n&&f.set("Prefer",`count=${n}`),new u({method:l,url:o,headers:f,schema:this.schemaName,body:h,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},w={PostgrestClient:$,PostgrestQueryBuilder:c,PostgrestFilterBuilder:u,PostgrestTransformBuilder:o,PostgrestBuilder:l,PostgrestError:s}},1232,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RealtimePresence",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"RealtimeChannel",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(_e,"RealtimeClient",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return n.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e,"postgresChangesFilter",{enumerable:!0,get:function(){return n.postgresChangesFilter}}),Object.defineProperty(_e,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n.REALTIME_LISTEN_TYPES}}),Object.defineProperty(_e,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return n.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return u.REALTIME_PRESENCE_LISTEN_EVENTS}}),Object.defineProperty(_e,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return n.REALTIME_SUBSCRIBE_STATES}}),Object.defineProperty(_e,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return n.REALTIME_CHANNEL_STATES}}),Object.defineProperty(_e,"WebSocketFactory",{enumerable:!0,get:function(){return l.default}});var t=e(r(d[0])),n=r(d[1]),E=e(n),u=r(d[2]),o=e(u),l=e(r(d[3]))},1233,[1234,1240,1241,1235]); +__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,"default",{enumerable:!0,get:function(){return f}});var t=e(r(d[0])),n=r(d[1]),s=e(r(d[2])),o=r(d[3]),c=e(r(d[4])),l=e(r(d[5]));const h=25e3,u=[1e3,2e3,5e3,1e4];function k(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem:t=>e.has(t)?e.get(t):null,key(t){var n;return null!==(n=Array.from(e.keys())[t])&&void 0!==n?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function p(){try{if('undefined'!=typeof globalThis&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(e){}return k()}class f{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint='',this.headers={},this.params={},this.ref=0,this.serializer=new s.default,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey))throw new Error('API key is required to connect to Realtime');this.apiKey=t.params.apikey;const c=this._initializeOptions(t);this.socketAdapter=new l.default(e,c),this.httpEndpoint=(0,o.httpEndpointURL)(e),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely('connect'),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const t=e.message;if(t.includes('Node.js'))throw new Error(`${t}\n\nTo use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n npm install ws\n\n import ws from "ws"\n const client = new RealtimeClient(url, {\n ...options,\n transport: ws\n })`);throw new Error(`WebSocket not available: ${t}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return this._cancelPendingDisconnect(),this.isDisconnecting()?'ok':await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return'ok'===t&&e.teardown(),t}async removeAllChannels(){const e=this.channels.map(async e=>{const t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,n){this.socketAdapter.log(e,t,n)}connectionState(){return this.socketAdapter.connectionState()||n.CONNECTION_STATE.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(e=>e.topic===n);if(s)return s;{const n=new c.default(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(n),n}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),0===this.channels.length&&(this.log('transport','no channels remaining, scheduling disconnect'),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),0===this._disconnectOnEmptyChannelsAfterMs)return this.log('transport','disconnecting immediately - no channels'),void this.disconnect();this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,0===this.channels.length&&(this.log('transport','deferred disconnect fired - no channels, disconnecting'),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log('transport',`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){null!==this._pendingDisconnectTimer&&(this.log('transport','pending disconnect cancelled - channel activity detected'),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let t,s=!1;if(e)t=e,s=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(e){this.log('error','Error fetching access token from callback',e),t=this.accessTokenValue}else t=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{const s={access_token:t,version:n.DEFAULT_VERSION};t&&e.updateJoinPayload(s),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(n.CHANNEL_EVENTS.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log('error',`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log('error','error waiting for auth on connect',e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,n)=>{'sent'==t&&this._setAuthSafely(),e&&e(t,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log('worker',`starting worker for from ${this.workerUrl}`):this.log('worker',"starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log('worker','worker error',e.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=e=>{'keepAlive'===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:'start',interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log('worker','terminating worker'),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{const e=new Blob(["\n addEventListener(\"message\", (e) => {\n if (e.data.event === \"start\") {\n setInterval(() => postMessage({ event: \"keepAlive\" }), e.data.interval);\n }\n });"],{type:'application/javascript'});t=URL.createObjectURL(e)}return t}_initializeOptions(e){var s,o,c,l,k,f,_,v,w,b,A,T;this.worker=null!==(s=null==e?void 0:e.worker)&&void 0!==s&&s,this.accessToken=null!==(o=null==e?void 0:e.accessToken)&&void 0!==o?o:null;const y={};let C,R;y.timeout=null!==(c=null==e?void 0:e.timeout)&&void 0!==c?c:n.DEFAULT_TIMEOUT,y.heartbeatIntervalMs=null!==(l=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==l?l:h,this._disconnectOnEmptyChannelsAfterMs=null!==(k=null==e?void 0:e.disconnectOnEmptyChannelsAfterMs)&&void 0!==k?k:2*(null!==(f=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==f?f:h),y.transport=null!==(_=null==e?void 0:e.transport)&&void 0!==_?_:t.default.getWebSocketConstructor(),y.params=null==e?void 0:e.params,y.logger=null==e?void 0:e.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(null==e?void 0:e.heartbeatCallback),y.sessionStorage=null!==(v=null==e?void 0:e.sessionStorage)&&void 0!==v?v:p(),y.reconnectAfterMs=null!==(w=null==e?void 0:e.reconnectAfterMs)&&void 0!==w?w:e=>u[e-1]||1e4;const E=null!==(b=null==e?void 0:e.vsn)&&void 0!==b?b:n.DEFAULT_VSN;switch(E){case n.VSN_1_0_0:C=(e,t)=>t(JSON.stringify(e)),R=(e,t)=>t(JSON.parse(e));break;case n.VSN_2_0_0:C=this.serializer.encode.bind(this.serializer),R=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=E,y.encode=null!==(A=null==e?void 0:e.encode)&&void 0!==A?A:C,y.decode=null!==(T=null==e?void 0:e.decode)&&void 0!==T?T:R,y.beforeReconnect=this._reconnectAuth.bind(this),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if('undefined'!=typeof window&&!window.Worker)throw new Error('Web Worker is not supported');this.workerUrl=null==e?void 0:e.workerUrl,y.autoSendHeartbeat=!this.worker}return y}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}},1234,[1235,1236,1238,1239,1240,1247]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebSocketFactory",{enumerable:!0,get:function(){return t}});class t{constructor(){}static detectEnvironment(){var t;if('undefined'!=typeof WebSocket)return{type:'native',wsConstructor:WebSocket};const o=globalThis;if('undefined'!=typeof globalThis&&void 0!==o.WebSocket)return{type:'native',wsConstructor:o.WebSocket};const n=void 0!==g?g:void 0;if(n&&void 0!==n.WebSocket)return{type:'native',wsConstructor:n.WebSocket};if('undefined'!=typeof globalThis&&void 0!==o.WebSocketPair&&void 0===globalThis.WebSocket)return{type:'cloudflare',error:'Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.',workaround:'Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.'};if('undefined'!=typeof globalThis&&o.EdgeRuntime||'undefined'!=typeof navigator&&(null===(t=navigator.userAgent)||void 0===t?void 0:t.includes('Vercel-Edge')))return{type:'unsupported',error:'Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.',workaround:'Use serverless functions or a different deployment target for WebSocket functionality.'};const s=globalThis.process;if(s){const t=s.versions;if(t&&t.node){const o=t.node,n=parseInt(o.replace(/^v/,'').split('.')[0]);return n>=22?void 0!==globalThis.WebSocket?{type:'native',wsConstructor:globalThis.WebSocket}:{type:'unsupported',error:`Node.js ${n} detected but native WebSocket not found.`,workaround:'Provide a WebSocket implementation via the transport option.'}:{type:'unsupported',error:`Node.js ${n} detected without native WebSocket support.`,workaround:"For Node.js < 22, install \"ws\" package and provide it via the transport option:\nimport ws from \"ws\"\nnew RealtimeClient(url, { transport: ws })"}}}return{type:'unsupported',error:'Unknown JavaScript runtime without WebSocket support.',workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let o=t.error||'WebSocket not supported in this environment.';throw t.workaround&&(o+=`\n\nSuggested solution: ${t.workaround}`),new Error(o)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return'native'===t.type||'ws'===t.type}catch(t){return!1}}}var o=t},1235,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_VERSION",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VSN_1_0_0",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"VSN_2_0_0",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_VSN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEFAULT_TIMEOUT",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"WS_CLOSE_NORMAL",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"MAX_PUSH_BUFFER_SIZE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SOCKET_STATES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"CHANNEL_STATES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"CHANNEL_EVENTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TRANSPORTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"CONNECTION_STATE",{enumerable:!0,get:function(){return E}});var n=r(d[0]);const t=`realtime-js/${n.version}`,o='1.0.0',c='2.0.0',u=c,l=n.version,b=1e4,_=1e3,f=100,p={connecting:0,open:1,closing:2,closed:3},s={closed:'closed',errored:'errored',joined:'joined',joining:'joining',leaving:'leaving'},O={close:'phx_close',error:'phx_error',join:'phx_join',reply:'phx_reply',leave:'phx_leave',access_token:'access_token'},j={websocket:'websocket'},E={connecting:'connecting',open:'open',closing:'closing',closed:'closed'}},1236,[1237]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1237,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});class t{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT='broadcast',this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=t?t:[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&'string'==typeof t.payload.event)return n(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer(null===(n=t.payload)||void 0===n?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:{},c=(new TextEncoder).encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,c)}_encodeUserBroadcastPush(t,n,s){var o,c;const l=t.topic,h=null!==(o=t.ref)&&void 0!==o?o:'',u=null!==(c=t.join_ref)&&void 0!==c?c:'',f=t.payload.event,y=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},_=0===Object.keys(y).length?'':JSON.stringify(y);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`ref length ${h.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`topic length ${l.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const A=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+h.length+l.length+f.length+_.length,E=new ArrayBuffer(this.HEADER_LENGTH+A);let U=new DataView(E),B=0;U.setUint8(B++,this.KINDS.userBroadcastPush),U.setUint8(B++,u.length),U.setUint8(B++,h.length),U.setUint8(B++,l.length),U.setUint8(B++,f.length),U.setUint8(B++,_.length),U.setUint8(B++,n),Array.from(u,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(h,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(l,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(f,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(_,t=>U.setUint8(B++,t.charCodeAt(0)));var N=new Uint8Array(E.byteLength+s.byteLength);return N.set(new Uint8Array(E),0),N.set(new Uint8Array(s),E.byteLength),N.buffer}decode(t,n){if(this._isArrayBuffer(t)){return n(this._binaryDecode(t))}if('string'==typeof t){const s=JSON.parse(t),[o,c,l,h,u]=s;return n({join_ref:o,ref:c,topic:l,event:h,payload:u})}return n({})}_binaryDecode(t){const n=new DataView(t),s=n.getUint8(0),o=new TextDecoder;if(s===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,o)}_decodeUserBroadcast(t,n,s){const o=n.getUint8(1),c=n.getUint8(2),l=n.getUint8(3),h=n.getUint8(4);let u=this.HEADER_LENGTH+4;const f=s.decode(t.slice(u,u+o));u+=o;const y=s.decode(t.slice(u,u+c));u+=c;const _=s.decode(t.slice(u,u+l));u+=l;const A=t.slice(u,t.byteLength),E=h===this.JSON_ENCODING?JSON.parse(s.decode(A)):A,U={type:this.BROADCAST_EVENT,event:y,payload:E};return l>0&&(U.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:f,event:this.BROADCAST_EVENT,payload:U}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||'ArrayBuffer'===(null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)}_pick(t,n){return t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([t])=>n.includes(t))):{}}}},1238,[]); +__d(function(g,r,i,a,m,e,d){"use strict";var t;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PostgresTypes",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"convertChangeData",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"convertColumn",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"convertCell",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toBoolean",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toNumber",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"toJson",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toTimestampString",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"httpEndpointURL",{enumerable:!0,get:function(){return y}}),(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(t||(t={}));const n=(t,n,o={})=>{var s;const u=null!==(s=o.skipTypes)&&void 0!==s?s:[];return n?Object.keys(n).reduce((o,s)=>(o[s]=c(s,t,n,u),o),{}):{}},c=(t,n,c,u)=>{const p=n.find(n=>n.name===t),l=null==p?void 0:p.type,f=c[t];return l&&!u.includes(l)?o(l,f):s(f)},o=(n,c)=>{if('_'===n.charAt(0)){const t=n.slice(1,n.length);return f(c,t)}switch(n){case t.bool:return u(c);case t.float4:case t.float8:case t.int2:case t.int4:case t.int8:case t.numeric:case t.oid:return p(c);case t.json:case t.jsonb:return l(c);case t.timestamp:return b(c);case t.abstime:case t.date:case t.daterange:case t.int4range:case t.int8range:case t.money:case t.reltime:case t.text:case t.time:case t.timestamptz:case t.timetz:case t.tsrange:case t.tstzrange:default:return s(c)}},s=t=>t,u=t=>{switch(t){case't':return!0;case'f':return!1;default:return t}},p=t=>{if('string'==typeof t){const n=parseFloat(t);if(!Number.isNaN(n))return n}return t},l=t=>{if('string'==typeof t)try{return JSON.parse(t)}catch(n){return t}return t},f=(t,n)=>{if('string'!=typeof t)return t;const c=t.length-1,s=t[c];if('{'===t[0]&&'}'===s){let s;const u=t.slice(1,c);try{s=JSON.parse('['+u+']')}catch(t){s=u?u.split(','):[]}return s.map(t=>o(n,t))}return t},b=t=>'string'==typeof t?t.replace(' ','T'):t,y=t=>{const n=new URL(t);return n.protocol=n.protocol.replace(/^ws/i,'http'),n.pathname=n.pathname.replace(/\/+$/,'').replace(/\/socket\/websocket$/i,'').replace(/\/socket$/i,'').replace(/\/websocket$/i,''),''===n.pathname||'/'===n.pathname?n.pathname='/api/broadcast':n.pathname=n.pathname+'/api/broadcast',n.href}},1239,[]); +__d(function(g,_r,_i,a,m,_e2,_d2){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return d.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e2,"postgresChangesFilter",{enumerable:!0,get:function(){return d.postgresChangesFilter}}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e2,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e2,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e2,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e2,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return h}});var t,n,i,s=_r(_d2[0]),r=e(_r(_d2[1])),o=_r(_d2[2]),c=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(o),l=_r(_d2[3]),u=e(_r(_d2[4])),d=_r(_d2[5]);!(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(t||(t={})),(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(n||(n={})),(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(i||(i={}));const h=s.CHANNEL_STATES;class p{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){var i,s;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,''),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},t.config),this.channelAdapter=new u.default(this.socket.socketAdapter,e,this.params),this.presence=new r.default(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=(0,o.httpEndpointURL)(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(null===(s=null===(i=this.params.config)||void 0===i?void 0:i.broadcast)||void 0===s?void 0:s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,o,c;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:h}}=this.params,p=null!==(o=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==o?o:[],E=!!this.bindings[n.PRESENCE]&&this.bindings[n.PRESENCE].length>0||!0===(null===(c=this.params.config.presence)||void 0===c?void 0:c.enabled),b={},f={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:E}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(t=>{null==e||e(i.CHANNEL_ERROR,(0,l.normalizeChannelError)(t))}),this._onClose(()=>null==e?void 0:e(i.CLOSED)),this.updateJoinPayload(Object.assign({config:f},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive('ok',async({postgres_changes:t})=>{this.socket._isManualToken()||this.socket.setAuth(),void 0!==t?this._updatePostgresBindings(t,e):null==e||e(i.SUBSCRIBED)}).receive('error',t=>{this.state=s.CHANNEL_STATES.errored;const n=Object.values(t).join(', ')||'error';null==e||e(i.CHANNEL_ERROR,new Error(n,{cause:t}))}).receive('timeout',()=>{null==e||e(i.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var n;const r=this.bindings.postgres_changes,o=null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0,c=[];for(let n=0;n{var i,s,r;const o=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);'broadcast'!==e.type||(null===(r=null===(s=null===(i=this.params)||void 0===i?void 0:i.config)||void 0===s?void 0:s.broadcast)||void 0===r?void 0:r.ack)||n('ok'),o.receive('ok',()=>n('ok')),o.receive('error',()=>n('error')),o.receive('timeout',()=>n('timed out'))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:r}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:'','Content-Type':'application/json'};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:'POST',headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:r,private:this.private}]})};try{const e=await this._fetchWithTimeout(this.broadcastEndpointURL,c,null!==(n=t.timeout)&&void 0!==n?n:this.timeout);return await(null===(i=e.body)||void 0===i?void 0:i.cancel()),e.ok?'ok':'error'}catch(e){return e instanceof Error&&'AbortError'===e.name?'timed out':'error'}}}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive('ok',()=>t('ok')).receive('timeout',()=>t('timed out')).receive('error',()=>t('error'))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){const i=new AbortController,s=setTimeout(()=>i.abort(),n),r=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(s),r}_on(e,t,n){const i=e.toLocaleLowerCase(),s=null==t?void 0:t.filter;(s instanceof d.RealtimePostgresFilterBuilder||'object'==typeof s&&null!==s&&'function'==typeof s.build)&&(t=Object.assign(Object.assign({},t),{filter:s.build()}));const r={type:i,filter:t,callback:n,ref:this.channelAdapter.on(e,n)};return this.bindings[i]?this.bindings[i].push(r):this.bindings[i]=[r],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{var i,s,r,o,c,l,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=null===(i=this.bindings[d])||void 0===i?void 0:i.find(t=>t.ref===e.ref);if(!h)return!0;if(['broadcast','presence','postgres_changes'].includes(d)){if('id'in h){const e=h.id,n=null===(s=h.filter)||void 0===s?void 0:s.event;return e&&(null===(r=t.ids)||void 0===r?void 0:r.includes(e))&&('*'===n||(null==n?void 0:n.toLocaleLowerCase())===(null===(o=t.data)||void 0===o?void 0:o.type.toLocaleLowerCase()))}{const e=null===(l=null===(c=null==h?void 0:h.filter)||void 0===c?void 0:c.event)||void 0===l?void 0:l.toLocaleLowerCase();return'*'===e||e===(null===(u=null==t?void 0:t.event)||void 0===u?void 0:u.toLocaleLowerCase())}}return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){const{close:n,error:i,leave:r,join:o}=s.CHANNEL_EVENTS;return t&&[n,i,r,o].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if('object'==typeof t&&'ids'in t){const e=t.data,{schema:n,table:i,commit_timestamp:s,type:r,errors:o}=e,c={schema:n,table:i,commit_timestamp:s,eventType:r,new:{},old:{},errors:o};return Object.assign(Object.assign({},c),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw new Error('cannot copy bindings into joined channel');for(const t in e.bindings)for(const n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_getPayloadRecords(e){const t={new:{},old:{}};return'INSERT'!==e.type&&'UPDATE'!==e.type||(t.new=c.convertChangeData(e.columns,e.record)),'UPDATE'!==e.type&&'DELETE'!==e.type||(t.old=c.convertChangeData(e.columns,e.old_record)),t}}},1240,[1236,1241,1239,1244,1245,1246]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return t}});var e,t,n=r(d[0]),c=(e=n)&&e.__esModule?e:{default:e};!(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(t||(t={}));class u{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new c.default(this.channel.channelAdapter,t)}}},1241,[1242]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(s,c){const u=o(c);this.presence=new n.Presence(s.getChannel(),u),this.presence.onJoin((n,c,o)=>{const u=t.onJoinPayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onLeave((n,c,o)=>{const u=t.onLeavePayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onSync(()=>{s.getChannel().trigger('presence',{event:'sync'})})}get state(){return t.transformState(this.presence.state)}static transformState(n){return n=c(n),Object.getOwnPropertyNames(n).reduce((t,c)=>{const o=n[c];return t[c]=s(o),t},{})}static onJoinPayload(n,t,c){return{event:'join',key:n,currentPresences:u(t),newPresences:s(c)}}static onLeavePayload(n,t,c){return{event:'leave',key:n,currentPresences:u(t),leftPresences:s(c)}}}function s(n){return n.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function c(n){return JSON.parse(JSON.stringify(n))}function o(n){return(null==n?void 0:n.events)&&{events:n.events}}function u(n){return(null==n?void 0:n.metas)?s(n):[]}},1242,[1243]); +__d(function(g,r,_i,a,_m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"Channel",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e2,"LongPoll",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e2,"Presence",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e2,"Push",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e2,"Serializer",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e2,"Socket",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e2,"Timer",{enumerable:!0,get:function(){return w}});var e=e=>{if("function"==typeof e)return e;return function(){return e}},t="undefined"!=typeof self?self:null,s="undefined"!=typeof window?window:null,i=t||s||globalThis,n=0,o=1,h=2,c=3,l="closed",u="errored",f="joined",p="joining",m="leaving",b="phx_close",k="phx_error",T="phx_join",y="phx_reply",C="phx_leave",v="longpoll",R="websocket",j=4,E="base64url.bearer.phx.",S=class{constructor(e,t,s,i){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},w=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},A=class{constructor(t,s,i){this.state=l,this.topic=t,this.params=e(s||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new S(this,T,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new w(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=f,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",e=>{this.state=u,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=l,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=u,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new S(this,C,e({}),this.timeout).send(),this.state=u,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(y,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=l,this.bindings=[]}onClose(e){this.on(b,e)}onError(e){return this.on(k,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(void 0===t||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new S(this,e,function(){return t},s);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=m;let s=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(b,"leave")},i=new S(this,C,e({}),t);return i.receive("ok",()=>s()).receive("timeout",()=>s()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,i){return this.topic===e&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=p,this.joinPush.resend(e))}trigger(e,t,s,i){let n=this.onMessage(e,t,s,i);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(i=>i.event===e&&this.filterBindings(i,t,s));for(let e=0;eu.abort(),o);l.signal=u.signal}return i.fetch(t,l).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>c&&c(e)).catch(e=>{"AbortError"===e.name&&h?h():c&&c(null)}),u}static xdomainRequest(e,t,s,i,n,o,h){return e.timeout=n,e.open(t,s),e.onload=()=>{let t=this.parseJSON(e.responseText);h&&h(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,s,i,n,o,h,c){e.open(t,s,!0),e.timeout=o;for(let[t,s]of Object.entries(i))e.setRequestHeader(t,s);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{if(e.readyState===j&&c){let t=this.parseJSON(e.responseText);c(t)}},h&&(e.ontimeout=h),e.send(n),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let s=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let n=t?`${t}[${i}]`:i,o=e[i];"object"==typeof o?s.push(this.serialize(o,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(o))}return s.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},L=e=>{let t="",s=new Uint8Array(e),i=s.byteLength;for(let e=0;ethis.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R),"$1/"+v)}endpointURL(){return H.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=n}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===o||this.readyState===n}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:s,messages:i}=e;if(410===t&&null!==this.token)return this.onerror(410),void this.closeAndRetry(3410,"session_gone",!1);this.token=s}else t=0;switch(t){case 200:i.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=o,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=L(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join("\n"),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,s){for(let e of this.reqs)e.abort();this.readyState=c;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,s,i,n){let o;o=H.request(e,this.endpointURL(),t,s,this.timeout,()=>{this.reqs.delete(o),i()},e=>{this.reqs.delete(o),this.isActive()&&n(e)}),this.reqs.add(o)}},B=class e{constructor(t,s={}){let i=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(i.state,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,s,i),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,s,i)}),this.pendingDiffs=[],n()}),this.channel.on(i.diff,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,s,i),n())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,s,i){let n=this.clone(e),o={},h={};return this.map(n,(e,s)=>{t[e]||(h[e]=s)}),this.map(t,(e,t)=>{let s=n[e];if(s){let i=t.metas.map(e=>e.phx_ref),n=s.metas.map(e=>e.phx_ref),c=t.metas.filter(e=>n.indexOf(e.phx_ref)<0),l=s.metas.filter(e=>i.indexOf(e.phx_ref)<0);c.length>0&&(o[e]=t,o[e].metas=c),l.length>0&&(h[e]=this.clone(s),h[e].metas=l)}else o[e]=t}),this.syncDiff(n,{joins:o,leaves:h},s,i)}static syncDiff(e,t,s,i){let{joins:n,leaves:o}=this.clone(t);return s||(s=function(){}),i||(i=function(){}),this.map(n,(t,i)=>{let n=e[t];if(e[t]=this.clone(i),n){let s=e[t].metas.map(e=>e.phx_ref),i=n.metas.filter(e=>s.indexOf(e.phx_ref)<0);e[t].metas.unshift(...i)}s(t,n,i)}),this.map(o,(t,s)=>{let n=e[t];if(!n)return;let o=s.metas.map(e=>e.phx_ref);n.metas=n.metas.filter(e=>o.indexOf(e.phx_ref)<0),i(t,n,s),0===n.metas.length&&delete e[t]}),e}static list(e,t){return t||(t=function(e,t){return t}),this.map(e,(e,s)=>t(e,s))}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static clone(e){return JSON.parse(JSON.stringify(e))}},O={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,i,n,o,h]=JSON.parse(e);return t({join_ref:s,ref:i,topic:n,event:o,payload:h})}},binaryEncode(e){let{join_ref:t,ref:s,event:i,topic:n,payload:o}=e,h=this.META_LENGTH+t.length+s.length+n.length+i.length,c=new ArrayBuffer(this.HEADER_LENGTH+h),l=new DataView(c),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,s.length),l.setUint8(u++,n.length),l.setUint8(u++,i.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(s,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(i,e=>l.setUint8(u++,e.charCodeAt(0)));var f=new Uint8Array(c.byteLength+o.byteLength);return f.set(new Uint8Array(c),0),f.set(new Uint8Array(o),c.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,c=s.decode(e.slice(h,h+i));h+=i;let l=s.decode(e.slice(h,h+n));h+=n;let u=s.decode(e.slice(h,h+o));return h+=o,{join_ref:c,ref:null,topic:l,event:u,payload:e.slice(h,e.byteLength)}},decodeReply(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(c,c+i));c+=i;let u=s.decode(e.slice(c,c+n));c+=n;let f=s.decode(e.slice(c,c+o));c+=o;let p=s.decode(e.slice(c,c+h));c+=h;let m=e.slice(c,e.byteLength);return{join_ref:l,ref:u,topic:f,event:y,payload:{status:p,response:m}}},decodeBroadcast(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=this.HEADER_LENGTH+2,h=s.decode(e.slice(o,o+i));o+=i;let c=s.decode(e.slice(o,o+n));return o+=n,{join_ref:null,ref:null,topic:h,event:c,payload:e.slice(o,e.byteLength)}}},$=class{constructor(t,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||1e4,this.transport=n.transport||i.WebSocket||P,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let o=null;try{o=i&&i.sessionStorage}catch{}this.sessionStore=n.sessionStorage||o,this.establishedConnections=0,this.defaultEncoder=O.encode.bind(O),this.defaultDecoder=O.decode.bind(O),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==P?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let h=null;s&&s.addEventListener&&(s.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),h=this.connectClock)}),s.addEventListener("pageshow",e=>{h===this.connectClock&&(h=null,this.connect())}),s.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>n.rejoinAfterMs?n.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>n.reconnectAfterMs?n.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(e,t,s)=>{console.log(`${e}: ${t}`,s)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=e(n.params||{}),this.endPoint=`${t}/${R}`,this.vsn=n.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new w(()=>{if(this.pageHidden)return this.log("Not reconnecting as page is hidden!"),void this.teardown();this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return P}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=H.appendParams(H.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=e(t)),this.conn&&!this.disconnecting||(this.longPollFallbackMs&&this.transport!==P?this.connectWithFallback(P,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(n=>{n.ref===t&&(this.off([i]),e(Date.now()-s))});return!0}transportName(e){return e===P?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${E}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let s,i=!1,n=!0,o=this.transportName(e),h=t=>{this.log("transport",`falling back to ${o}...`,t),this.off([void 0,s]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),s=this.onError(e=>{this.log("transport","error",e),n&&!i&&(clearTimeout(this.fallbackTimer),h(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!n){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const i=this.conn;this.waitForBufferDone(i,()=>{t?i.close(t,s||""):i.close(),this.waitForSocketClosed(i,()=>{this.conn===i&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){5!==s&&e.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s):t()}waitForSocketClosed(e,t,s=1){5!==s&&e.readyState!==c?setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s):t()}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(k,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case n:return"connecting";case o:return"open";case h:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let s=new A(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;this.log("push",`${t} ${s} (${o}, ${n})`,i)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(this.isConnected())if(this.pendingHeartbeatRef)this.heartbeatTimeout();else{this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}else try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;if(n&&n===this.pendingHeartbeatRef){const e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback("ok"===i.status?"ok":"error",e)}catch(e){this.log("error","error in heartbeat callback",e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${t} ${s} ${n&&"("+n+")"||""}`.trim(),i);for(let e=0;e{try{i(...t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}},1243,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeChannelError=function(n){if(n instanceof Error)return n;if('string'==typeof n)return new Error(n);if(n&&'object'==typeof n){const o=n;if('number'==typeof o.code){const t='string'==typeof o.reason&&o.reason?` (${o.reason})`:'';return new Error(`socket closed: ${o.code}${t}`,{cause:n})}return new Error('channel error: transport failure',{cause:n})}return new Error('channel error: connection lost')}},1244,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(n,t,s){const h=(o=s,{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},o.config)});var o;this.channel=n.getSocket().channel(t,h),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,t){return this.channel.on(n,t)}off(n,t){this.channel.off(n,t)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(t,s,h){let o;try{o=this.channel.push(t,s,h)}catch(n){throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>n.MAX_PUSH_BUFFER_SIZE){const n=this.channel.pushBuffer.shift();n.cancelTimeout(),this.socket.log('channel',`discarded push due to buffer overflow: ${n.event}`,n.payload())}return o}updateJoinPayload(n){const t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),n)}canPush(){return this.socket.isConnected()&&this.state===n.CHANNEL_STATES.joined}isJoined(){return this.state===n.CHANNEL_STATES.joined}isJoining(){return this.state===n.CHANNEL_STATES.joining}isClosed(){return this.state===n.CHANNEL_STATES.closed}isLeaving(){return this.state===n.CHANNEL_STATES.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}},1245,[1236]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"postgresChangesFilter",{enumerable:!0,get:function(){return c}});const t=/[,()"\\]/,n=n=>t.test(n)||n!==n.trim(),s=t=>`"${t.replace(/\\/g,'\\\\').replace(/"/g,'\\"')}"`,u=t=>{const u=null===t?'null':String(t);return n(u)?s(u):u},l=t=>null===t?'null':String(t),h=(t,n)=>{if('in'===t){const t=Array.isArray(n)?n:[n];if(0===t.length)throw new Error('Realtime `in` filter requires at least one value.');return`in.(${Array.from(new Set(t)).map(t=>u(t)).join(',')})`}return'is'===t?`is.${l(n)}`:`${t}.${u(n)}`};class o{constructor(){this.filters=[]}add(t,n,s,u=!1){const l=u?'not.':'';return this.filters.push(`${t}=${l}${h(n,s)}`),this}eq(t,n){return this.add(t,'eq',n)}neq(t,n){return this.add(t,'neq',n)}gt(t,n){return this.add(t,'gt',n)}gte(t,n){return this.add(t,'gte',n)}lt(t,n){return this.add(t,'lt',n)}lte(t,n){return this.add(t,'lte',n)}in(t,n){return this.add(t,'in',n)}like(t,n){return this.add(t,'like',n)}ilike(t,n){return this.add(t,'ilike',n)}match(t,n){return this.add(t,'match',n)}imatch(t,n){return this.add(t,'imatch',n)}is(t,n){return this.add(t,'is',n)}isDistinct(t,n){return this.add(t,'isdistinct',n)}not(t,n,s){return this.add(t,n,s,!0)}build(){return this.filters.join(',')}toString(){return this.build()}}const c=()=>new o},1246,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]);class s{constructor(n,s){this.socket=new t.Socket(n,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,s,o=1e4){return new Promise(c=>{setTimeout(()=>c('timeout'),o),this.socket.disconnect(()=>{t(),c('ok')},n,s)})}push(t){this.socket.push(t)}log(t,n,s){this.socket.log(t,n,s)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.connecting}isDisconnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}},1247,[1243,1236]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"StorageAnalyticsClient",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StorageClient",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(_e,"StorageError",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"StorageUnknownError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"StorageVectorsApiError",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"StorageVectorsClient",{enumerable:!0,get:function(){return X}}),Object.defineProperty(_e,"StorageVectorsError",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"VectorBucketApi",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"VectorBucketScope",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(_e,"VectorDataApi",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"VectorIndexApi",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(_e,"VectorIndexScope",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(_e,"isStorageError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isStorageVectorsError",{enumerable:!0,get:function(){return f}});var e=_r(d[0]);function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function n(e){var n=r(e,"string");return"symbol"==t(n)?n:n+""}function o(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},k=e=>{if(Array.isArray(e))return e.map(e=>k(e));if("function"==typeof e||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([e,r])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));t[n]=k(r)}),t},x=e=>!(!e||"string"!=typeof e)&&(!(0===e.length||e.length>100)&&(e.trim()===e&&(!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e)))),$=e=>{if("object"==typeof e&&null!==e){const t=e;if("string"==typeof t.msg)return t.msg;if("string"==typeof t.message)return t.message;if("string"==typeof t.error_description)return t.error_description;if("string"==typeof t.error)return t.error;if("object"==typeof t.error&&null!==t.error){const e=t.error;if("string"==typeof e.message)return e.message}}return JSON.stringify(e)},j=async(e,t,r,n)=>{if(null!==e&&"object"==typeof e&&"json"in e&&"function"==typeof e.json){const r=e;let o=parseInt(String(r.status),10);Number.isFinite(o)||(o=500),r.json().then(e=>{const r=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||o+"";t(new l($(e),o,r,n))}).catch(()=>{const e=o+"";t(new l(r.statusText||`HTTP ${o} error`,o,e,n))})}else t(new h($(e),e,n))},B=(e,t,r,n)=>{const o={method:e,headers:(null==t?void 0:t.headers)||{}};if("GET"===e||"HEAD"===e||!n)return c(c({},o),r);if(S(n)){var s;const e=(null==t?void 0:t.headers)||{};let r;for(const[t,n]of Object.entries(e))"content-type"===t.toLowerCase()&&(r=n);o.headers=w(e,"Content-Type",null!==(s=r)&&void 0!==s?s:"application/json"),o.body=JSON.stringify(n)}else o.body=n;return(null==t?void 0:t.duplex)&&(o.duplex=t.duplex),c(c({},o),r)};async function P(e,t,r,n,o,s,c){return new Promise((i,u)=>{e(r,B(t,n,o,s)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;if("vectors"===c){const t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status)return{};if(!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>i(e)).catch(e=>j(e,u,0,c))})}function N(e="storage"){return{get:async(t,r,n,o)=>P(t,"GET",r,n,o,void 0,e),post:async(t,r,n,o,s)=>P(t,"POST",r,o,s,n,e),put:async(t,r,n,o,s)=>P(t,"PUT",r,o,s,n,e),head:async(t,r,n,o)=>P(t,"HEAD",r,c(c({},n),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,n,o,s)=>P(t,"DELETE",r,o,s,n,e)}}const E=N("storage"),{get:C,post:V,put:I,head:T,remove:U}=E,_=N("vectors");var F=class{constructor(e,t={},r,n="storage"){var o;this.shouldThrowOnError=!1,this.url=e,this.headers=O(t),this.fetch=(o=r)?(...e)=>o(...e):(...e)=>fetch(...e),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=w(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let R;R=Symbol.toStringTag;var L=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[R]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let D;D=Symbol.toStringTag;var A=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[D]="BlobDownloadBuilder",this.promise=null}asStream(){return new L(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};const M={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},z={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J=class extends F{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var o=this;return o.handleOperation(async()=>{let s;const i=c(c({},z),n);let u=c(c({},o.headers),"POST"===e&&{"x-upsert":String(i.upsert)});const l=i.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(s=new FormData,s.append("cacheControl",i.cacheControl),l&&s.append("metadata",o.encodeMetadata(l)),s.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",i.cacheControl),l&&!s.has("metadata")&&s.append("metadata",o.encodeMetadata(l))):(s=r,u["cache-control"]=`max-age=${i.cacheControl}`,u["content-type"]=i.contentType,l&&(u["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&s instanceof ReadableStream||s&&"object"==typeof s&&"pipe"in s&&"function"==typeof s.pipe)&&!i.duplex&&(i.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))u=w(u,e,t);const h=o._removeEmptyFolders(t),p=o._getFinalPath(h),f=await("PUT"==e?I:V)(o.fetch,`${o.url}/object/${p}`,s,c({headers:u},(null==i?void 0:i.duplex)?{duplex:i.duplex}:{}));return{path:h,id:f.Id,fullPath:f.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var o=this;const s=o._removeEmptyFolders(e),i=o._getFinalPath(s),u=new URL(o.url+`/object/upload/sign/${i}`);return u.searchParams.set("token",t),o.handleOperation(async()=>{let e;const t=c(c({},z),n);let i=c(c({},o.headers),{"x-upsert":String(t.upsert)});const l=t.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),l&&e.append("metadata",o.encodeMetadata(l)),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.has("cacheControl")||e.append("cacheControl",t.cacheControl),l&&!e.has("metadata")&&e.append("metadata",o.encodeMetadata(l))):(e=r,i["cache-control"]=`max-age=${t.cacheControl}`,i["content-type"]=t.contentType,l&&(i["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&e instanceof ReadableStream||e&&"object"==typeof e&&"pipe"in e&&"function"==typeof e.pipe)&&!t.duplex&&(t.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))i=w(i,e,t);return{path:s,fullPath:(await I(o.fetch,u.toString(),e,c({headers:i},(null==t?void 0:t.duplex)?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const o=c({},r.headers);(null==t?void 0:t.upsert)&&(o["x-upsert"]="true");const s=await V(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:o}),u=new URL(r.url+s.url),l=u.searchParams.get("token");if(!l)throw new i("No token returned by API");return{signedUrl:u.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await V(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await V(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let o=n._getFinalPath(e);const s="object"==typeof(null==r?void 0:r.transform)&&null!==r.transform&&Object.keys(r.transform).length>0;let i=await V(n.fetch,`${n.url}/object/sign/${o}`,c({expiresIn:t},s?{transform:r.transform}:{}),{headers:n.headers});const u=new URLSearchParams;(null==r?void 0:r.download)&&u.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&u.set("cacheNonce",String(r.cacheNonce));const l=u.toString();return{signedUrl:encodeURI(`${n.url}${i.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const o=await V(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),s=new URLSearchParams;(null==r?void 0:r.download)&&s.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&s.set("cacheNonce",String(r.cacheNonce));const i=s.toString();return o.map(e=>c(c({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${i?`&${i}`:""}`):null}))})}download(e,t,r){const n="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(o,t.transform),null!=(null==t?void 0:t.cacheNonce)&&o.set("cacheNonce",String(t.cacheNonce));const s=o.toString(),c=this._getFinalPath(e);return new A(()=>C(this.fetch,`${this.url}/${n}/${c}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},r),this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>k(await C(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await T(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(u(e)){var n;const t=e instanceof l?e.status:e instanceof h?null===(n=e.originalError)||void 0===n?void 0:n.status:void 0;if(void 0!==t&&[400,404].includes(t))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;(null==t?void 0:t.download)&&n.set("download",!0===t.download?"":t.download),(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(n,t.transform),null!=(null==t?void 0:t.cacheNonce)&&n.set("cacheNonce",String(t.cacheNonce));const o=n.toString(),s="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=n._getFinalPath(e),s=new URLSearchParams;(null==t?void 0:t.transformations)&&s.set("transformations","true");const c=s.toString();return await U(n.fetch,`${n.url}/cdn/${o}${c?`?${c}`:""}`,{},{headers:n.headers},r)})}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const o=(null==t?void 0:t.sortBy)?c(c({},M.sortBy),t.sortBy):M.sortBy,s=c(c(c({},M),t),{},{sortBy:o,prefix:e||""});return await V(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=c({},e);return await V(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const K={"X-Client-Info":"storage-js/2.109.0"};var q=class extends F{constructor(e,t={},r,n){const o=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));super(o.href.replace(/\/$/,""),c(c({},K),t),r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await C(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await C(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await V(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await I(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=new URLSearchParams;(null==t?void 0:t.transformations)&&o.set("transformations","true");const s=o.toString();return await U(n.fetch,`${n.url}/cdn/${e}${s?`?${s}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},H=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),t),r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&r.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);const n=r.toString(),o=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await C(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(t){var r=this;if(!x(t))throw new i("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new e.IcebergRestCatalog({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>r.headers},fetch:this.fetch}),o=this.shouldThrowOnError;return new Proxy(n,{get(e,t){const r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(e){if(o)throw e;return{data:null,error:e}}}}})}},Q=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},G=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},W=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},X=class extends W{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Y(this.url,this.headers,e,this.fetch)}async createBucket(e){return(()=>super.createBucket)().call(this,e)}async getBucket(e){return(()=>super.getBucket)().call(this,e)}async listBuckets(e={}){return(()=>super.listBuckets)().call(this,e)}async deleteBucket(e){return(()=>super.deleteBucket)().call(this,e)}},Y=class extends Q{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return(()=>super.createIndex)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return(()=>super.listIndexes)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return(()=>super.getIndex)().call(this,this.vectorBucketName,e)}async deleteIndex(e){return(()=>super.deleteIndex)().call(this,this.vectorBucketName,e)}index(e){return new Z(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Z=class extends G{constructor(e,t,r,n,o){super(e,t,o),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=this;return(()=>super.putVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(e){var t=this;return(()=>super.getVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(e={}){var t=this;return(()=>super.listVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(e){var t=this;return(()=>super.queryVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(e){var t=this;return(()=>super.deleteVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},ee=class extends q{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new J(this.url,this.headers,e,this.fetch)}get vectors(){return new X(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new H(this.url+"/iceberg",this.headers,this.fetch)}}},1248,[1249]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IcebergError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"IcebergRestCatalog",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"getCurrentSchema",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isDecimalType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isFixedType",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseDecimalType",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"parseFixedType",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"typesEqual",{enumerable:!0,get:function(){return x}});var t=class extends Error{constructor(t,a){super(t),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown="CommitStateUnknownException"===a.icebergType||[500,502,504].includes(a.status)&&!0===a.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function a(t,a,s){const n=new URL(a,t);if(s)for(const[t,a]of Object.entries(s))void 0!==a&&n.searchParams.set(t,a);return n.toString()}async function s(t){return t&&"none"!==t.type?"bearer"===t.type?{Authorization:`Bearer ${t.token}`}:"header"===t.type?{[t.name]:t.value}:"custom"===t.type?await t.getHeaders():{}:{}}function n(n){const c=n.fetchImpl??globalThis.fetch;return{async request({method:o,path:p,query:u,body:l,headers:h}){const b=a(n.baseUrl,p,u),f=await s(n.auth),y=await c(b,{method:o,headers:{...l?{"Content-Type":"application/json"}:{},...f,...h},body:l?JSON.stringify(l):void 0}),T=await y.text(),w=(y.headers.get("content-type")||"").includes("application/json"),x=w&&T?JSON.parse(T):T;if(!y.ok){const a=w?x:void 0,s=a?.error;throw new t(s?.message??`Request failed with status ${y.status}`,{status:y.status,icebergType:s?.type,icebergCode:s?.code,details:a})}return{status:y.status,headers:y.headers,data:x}}}}function c(t){return t.join("\x1f")}var o=class{constructor(t,a=""){this.client=t,this.prefix=a}async listNamespaces(t){const a=t?{parent:c(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(t=>({namespace:t}))}async createNamespace(t,a){const s={namespace:t.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${c(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${c(t.namespace)}`})).data.properties}}async namespaceExists(a){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${c(a.namespace)}`}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createNamespaceIfNotExists(a,s){try{return await this.createNamespace(a,s)}catch(a){if(a instanceof t&&409===a.status)return;throw a}}};function p(t){return t.join("\x1f")}var u=class{constructor(t,a="",s){this.client=t,this.prefix=a,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`})).data.identifiers}async createTable(t,a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`,body:a,headers:s})).data.metadata}async updateTable(t,a){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,body:a});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(t){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,headers:a})).data.metadata}async tableExists(a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${p(a.namespace)}/tables/${a.name}`,headers:s}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createTableIfNotExists(a,s){try{return await this.createTable(a,s)}catch(n){if(n instanceof t&&409===n.status)return await this.loadTable({namespace:a.namespace,name:s.name});throw n}}},l=class{constructor(t){let a="v1";t.catalogName&&(a+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=n({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new o(this.client,a),this.tableOps=new u(this.client,a,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,a){return this.namespaceOps.createNamespace(t,a)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,a){return this.tableOps.createTable(t,a)}async updateTable(t,a){return this.tableOps.updateTable(t,a)}async dropTable(t,a){await this.tableOps.dropTable(t,a)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,a){return this.namespaceOps.createNamespaceIfNotExists(t,a)}async createTableIfNotExists(t,a){return this.tableOps.createTableIfNotExists(t,a)}},h=/^decimal\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)$/,b=/^fixed\s*\[\s*(\d+)\s*\]$/;function f(t){const a=t.match(h);return a?{precision:parseInt(a[1],10),scale:parseInt(a[2],10)}:null}function y(t){const a=t.match(b);return a?{length:parseInt(a[1],10)}:null}function T(t){return h.test(t)}function w(t){return b.test(t)}function x(t,a){const s=f(t),n=f(a);if(s&&n)return s.precision===n.precision&&s.scale===n.scale;const c=y(t),o=y(a);return c&&o?c.length===o.length:t===a}function O(t){return t.schemas.find(a=>a["schema-id"]===t["current-schema-id"])}},1249,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"navigatorLock",{enumerable:!0,get:function(){return l.navigatorLock}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return l.NavigatorLockAcquireTimeoutError}}),Object.defineProperty(_e,"lockInternals",{enumerable:!0,get:function(){return l.internals}}),Object.defineProperty(_e,"processLock",{enumerable:!0,get:function(){return l.processLock}}),Object.defineProperty(_e,"GoTrueAdminApi",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"GoTrueClient",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(_e,"AuthAdminApi",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"AuthClient",{enumerable:!0,get:function(){return u.default}});var t=e(r(d[0])),n=e(r(d[1])),o=e(r(d[2])),u=e(r(d[3])),c=r(d[4]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(d[5]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var l=r(d[6])},1250,[1251,1259,1266,1267,1258,1256,1261]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]),s=r(d[1]),n=r(d[2]),o=r(d[3]),h=r(d[4]);class u{constructor({url:t="",headers:s={},fetch:o,experimental:h}){this.url=t,this.headers=s,this.fetch=(0,n.resolveFetch)(o),this.experimental=null!=h?h:{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=o.SIGN_OUT_SCOPES[0]){if(o.SIGN_OUT_SCOPES.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${o.SIGN_OUT_SCOPES.join(', ')}`);try{return await(0,s._request)(this.fetch,'POST',`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async inviteUserByEmail(t,n={}){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async generateLink(n){try{const{options:o}=n,h=(0,t.__rest)(n,["options"]),u=Object.assign(Object.assign({},h),o);return'newEmail'in h&&(u.new_email=null==h?void 0:h.newEmail,delete u.newEmail),await(0,s._request)(this.fetch,'POST',`${this.url}/admin/generate_link`,{body:u,headers:this.headers,xform:s._generateLinkResponse,redirectTo:null==o?void 0:o.redirectTo})}catch(t){if((0,h.isAuthError)(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/users`,{body:t,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async listUsers(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{users:[]},error:t};throw t}}async getUserById(t){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t}`,{headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async updateUserById(t,o){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/users/${t}`,{body:o,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async deleteUser(t,o=!1){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:o},xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async _listFactors(t){(0,n.validateUUID)(t.userId);try{const{data:n,error:o}=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:t=>({data:{factors:t},error:null})});return{data:n,error:o}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteFactor(t){(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.id);try{return{data:await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listOAuthClients(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{clients:[]},error:t};throw t}}async _createOAuthClient(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getOAuthClient(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateOAuthClient(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteOAuthClient(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listCustomProviders(t){try{const n={};return(null==t?void 0:t.type)&&(n.type=t.type),await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:t=>{var s;return{data:{providers:null!==(s=null==t?void 0:t.providers)&&void 0!==s?s:[]},error:null}}})}catch(t){if((0,h.isAuthError)(t))return{data:{providers:[]},error:t};throw t}}async _createCustomProvider(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getCustomProvider(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateCustomProvider(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteCustomProvider(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminListPasskeys(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminDeletePasskey(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.passkeyId);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}}},1251,[1229,1252,1255,1258,1256]); +__d(function(g,r,_i,_a2,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.handleError=i,_e._request=async function(e,o,t,n){var a;const i=Object.assign({},null==n?void 0:n.headers);i[s.API_VERSION_HEADER_NAME]||(i[s.API_VERSION_HEADER_NAME]=s.API_VERSIONS['2024-01-01'].name);(null==n?void 0:n.jwt)&&(i.Authorization=`Bearer ${n.jwt}`);const u=null!==(a=null==n?void 0:n.query)&&void 0!==a?a:{};(null==n?void 0:n.redirectTo)&&(u.redirect_to=n.redirectTo);const l=Object.keys(u).length?'?'+new URLSearchParams(u).toString():'',_=await c(e,o,t+l,{headers:i,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(_):{data:Object.assign({},_),error:null}},_e._sessionResponse=l,_e._sessionResponsePassword=function(e){const s=l(e);!s.error&&e.weak_password&&'object'==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&'string'==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0)&&(s.data.weak_password=e.weak_password);return s},_e._userResponse=function(e){var s;return{data:{user:null!==(s=e.user)&&void 0!==s?s:e},error:null}},_e._ssoResponse=function(e){return{data:e,error:null}},_e._generateLinkResponse=function(s){const{action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i}=s,u=(0,e.__rest)(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i},l=Object.assign({},u);return{data:{properties:c,user:l},error:null}},_e._noResolveJsonResponse=function(e){return e};var e=r(d[0]),s=r(d[1]),o=r(d[2]),t=r(d[3]);const n=e=>{if('object'==typeof e&&null!==e){const s=e;if('string'==typeof s.msg)return s.msg;if('string'==typeof s.message)return s.message;if('string'==typeof s.error_description)return s.error_description;if('string'==typeof s.error)return s.error}return JSON.stringify(e)},a=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function i(e){var i;if(!(0,o.looksLikeFetchResponse)(e))throw new t.AuthRetryableFetchError(n(e),0);if(a.includes(e.status))throw new t.AuthRetryableFetchError(n(e),e.status);let u,c;try{u=await e.json()}catch(e){throw new t.AuthUnknownError(n(e),e)}const l=(0,o.parseResponseAPIVersion)(e);if(l&&l.getTime()>=s.API_VERSIONS['2024-01-01'].timestamp&&'object'==typeof u&&u&&'string'==typeof u.code?c=u.code:'object'==typeof u&&u&&'string'==typeof u.error_code&&(c=u.error_code),c){if('weak_password'===c)throw new t.AuthWeakPasswordError(n(u),e.status,(null===(i=u.weak_password)||void 0===i?void 0:i.reasons)||[]);if('session_not_found'===c)throw new t.AuthSessionMissingError}else if('object'==typeof u&&u&&'object'==typeof u.weak_password&&u.weak_password&&Array.isArray(u.weak_password.reasons)&&u.weak_password.reasons.length&&u.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0))throw new t.AuthWeakPasswordError(n(u),e.status,u.weak_password.reasons);throw new t.AuthApiError(n(u),e.status||500,c)}const u=(e,s,o,t)=>{const n={method:e,headers:(null==s?void 0:s.headers)||{}};return'GET'===e?n:(n.headers=Object.assign({'Content-Type':'application/json;charset=UTF-8'},null==s?void 0:s.headers),n.body=JSON.stringify(t),Object.assign(Object.assign({},n),o))};async function c(e,s,o,a,c,l){const _=u(s,a,c,l);let p;try{p=await e(o,Object.assign({},_))}catch(e){throw console.error(e),new t.AuthRetryableFetchError(n(e),0)}if(p.ok||await i(p),null==a?void 0:a.noResolveJson)return p;try{return await p.json()}catch(e){await i(e)}}function l(e){var s;let t=null;_(e)&&(t=Object.assign({},e),e.expires_at||(t.expires_at=(0,o.expiresAt)(e.expires_in)));return{data:{session:t,user:null!==(s=e.user)&&void 0!==s?s:'string'==typeof(null==e?void 0:e.id)?e:null},error:null}}function _(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}},1252,[1229,1253,1255,1256]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AUTO_REFRESH_TICK_DURATION_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AUTO_REFRESH_TICK_THRESHOLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"EXPIRY_MARGIN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REFRESH_FAILURE_COOLDOWN_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"GOTRUE_URL",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"STORAGE_KEY",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"AUDIENCE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DEFAULT_HEADERS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NETWORK_FAILURE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"API_VERSION_HEADER_NAME",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"API_VERSIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BASE64URL_REGEX",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"JWKS_TTL",{enumerable:!0,get:function(){return A}});var t=r(d[0]);const n=3e4,u=3,o=9e4,c=6e4,E='http://localhost:9999',_='supabase.auth.token',b='',f={'X-Client-Info':`gotrue-js/${t.version}`},R={MAX_RETRIES:10,RETRY_INTERVAL:2},O='X-Supabase-Api-Version',p={'2024-01-01':{timestamp:Date.parse('2024-01-01T00:00:00.0Z'),name:'2024-01-01'}},l=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,A=6e5},1253,[1254]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1254,[]); +__d(function(g,r,_i,a,m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),_e2.expiresAt=function(e){return Math.round(Date.now()/1e3)+e},_e2.generateCallbackId=function(){return Symbol('auth-callback')},Object.defineProperty(_e2,"isBrowser",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e2,"supportsLocalStorage",{enumerable:!0,get:function(){return i}}),_e2.parseParametersFromURL=function(e){const t={},n=new URL(e);if(n.hash&&'#'===n.hash[0])try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch(e){}return n.searchParams.forEach((e,n)=>{t[n]=e}),t},Object.defineProperty(_e2,"resolveFetch",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e2,"looksLikeFetchResponse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e2,"setItemAsync",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e2,"getItemAsync",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e2,"removeItemAsync",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e2,"Deferred",{enumerable:!0,get:function(){return p}}),_e2.decodeJWT=function(o){const s=o.split('.');if(3!==s.length)throw new t.AuthInvalidJwtError('Invalid JWT structure');for(let n=0;n{setTimeout(()=>t(null),e)})},_e2.retryable=function(e,t){return new Promise((n,o)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await e(s);if(!t(s,null,o))return void n(o)}catch(e){if(!t(s,e))return void o(e)}})()})},_e2.generatePKCEVerifier=b,_e2.generatePKCEChallenge=S,_e2.getCodeChallengeAndMethod=async function(e,t,n=!1){const o=b();let s=o;n&&(s+='/recovery');await l(e,`${t}-code-verifier`,s);const i=await S(o);return[i,o===i?'plain':'s256']},_e2.parseResponseAPIVersion=function(t){const n=t.headers.get(e.API_VERSION_HEADER_NAME);if(!n)return null;if(!n.match(P))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch(e){return null}},_e2.validateExp=function(e){if(!e)throw new Error('Missing exp claim');const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error('JWT has expired')},_e2.getAlgorithm=function(e){switch(e){case'RS256':return{name:'RSASSA-PKCS1-v1_5',hash:{name:'SHA-256'}};case'ES256':return{name:'ECDSA',namedCurve:'P-256',hash:{name:'SHA-256'}};default:throw new Error('Invalid alg claim')}},_e2.validateUUID=function(e){if(!A.test(e))throw new Error('@supabase/auth-js: Expected parameter to be UUID but is not')},_e2.assertPasskeyExperimentalEnabled=function(e){if(!e.passkey)throw new Error('@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).')},_e2.userNotAvailableProxy=function(){return new Proxy({},{get:(e,t)=>{if('__isUserNotAvailableProxy'===t)return!0;if('symbol'==typeof t){const e=t.toString();if('Symbol(Symbol.toPrimitive)'===e||'Symbol(Symbol.toStringTag)'===e||'Symbol(util.inspect.custom)'===e)return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})},_e2.insecureUserWarningProxy=function(e,t){return new Proxy(e,{get:(e,n,o)=>{if('__isInsecureUserWarningProxy'===n)return!0;if('symbol'==typeof n){const t=n.toString();if('Symbol(Symbol.toPrimitive)'===t||'Symbol(Symbol.toStringTag)'===t||'Symbol(util.inspect.custom)'===t||'Symbol(nodejs.util.inspect.custom)'===t)return Reflect.get(e,n,o)}return t.value||'string'!=typeof n||(console.warn('Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server.'),t.value=!0),Reflect.get(e,n,o)}})},_e2.deepClone=function(e){return JSON.parse(JSON.stringify(e))};var e=r(d[0]),t=r(d[1]),n=r(d[2]);const o=()=>'undefined'!=typeof window&&'undefined'!=typeof document,s={tested:!1,writable:!1},i=()=>{if(!o())return!1;try{if('object'!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(s.tested)return s.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),s.tested=!0,s.writable=!0}catch(e){s.tested=!0,s.writable=!1}return s.writable};const u=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),c=e=>'object'==typeof e&&null!==e&&'status'in e&&'ok'in e&&'json'in e&&'function'==typeof e.json,l=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},f=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return null}},h=async(e,t)=>{await e.removeItem(t)};class p{constructor(){this.promise=new p.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function y(e){return('0'+e.toString(16)).substr(-2)}function b(){const e=new Uint32Array(56);if('undefined'==typeof crypto){const e='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~',t=e.length;let n='';for(let o=0;o<56;o++)n+=e.charAt(Math.floor(Math.random()*t));return n}return crypto.getRandomValues(e),Array.from(e,y).join('')}async function w(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest('SHA-256',t),o=new Uint8Array(n);return Array.from(o).map(e=>String.fromCharCode(e)).join('')}async function S(e){if(!('undefined'!=typeof crypto&&void 0!==crypto.subtle&&'undefined'!=typeof TextEncoder))return console.warn('WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256.'),e;const t=await w(e);return btoa(t).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'')}p.promiseConstructor=Promise;const P=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;const A=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/},1255,[1253,1256,1257]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AuthError",{enumerable:!0,get:function(){return t}}),e.isAuthError=s,Object.defineProperty(e,"AuthApiError",{enumerable:!0,get:function(){return n}}),e.isAuthApiError=function(t){return s(t)&&'AuthApiError'===t.name},Object.defineProperty(e,"AuthUnknownError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CustomAuthError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AuthSessionMissingError",{enumerable:!0,get:function(){return c}}),e.isAuthSessionMissingError=function(t){return s(t)&&'AuthSessionMissingError'===t.name},Object.defineProperty(e,"AuthInvalidTokenResponseError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"AuthInvalidCredentialsError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AuthImplicitGrantRedirectError",{enumerable:!0,get:function(){return f}}),e.isAuthImplicitGrantRedirectError=function(t){return s(t)&&'AuthImplicitGrantRedirectError'===t.name},Object.defineProperty(e,"AuthPKCEGrantCodeExchangeError",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AuthPKCECodeVerifierMissingError",{enumerable:!0,get:function(){return A}}),e.isAuthPKCECodeVerifierMissingError=function(t){return s(t)&&'AuthPKCECodeVerifierMissingError'===t.name},Object.defineProperty(e,"AuthRetryableFetchError",{enumerable:!0,get:function(){return p}}),e.isAuthRetryableFetchError=function(t){return s(t)&&'AuthRetryableFetchError'===t.name},Object.defineProperty(e,"AuthRefreshDiscardedError",{enumerable:!0,get:function(){return b}}),e.isAuthRefreshDiscardedError=function(t){return s(t)&&'AuthRefreshDiscardedError'===t.name},Object.defineProperty(e,"AuthWeakPasswordError",{enumerable:!0,get:function(){return O}}),e.isAuthWeakPasswordError=function(t){return s(t)&&'AuthWeakPasswordError'===t.name},Object.defineProperty(e,"AuthInvalidJwtError",{enumerable:!0,get:function(){return P}});class t extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name='AuthError',this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function s(t){return'object'==typeof t&&null!==t&&'__isAuthError'in t}class n extends t{constructor(t,s,n){super(t,s,n),this.name='AuthApiError',this.status=s,this.code=n}}class o extends t{constructor(t,s){super(t),this.name='AuthUnknownError',this.originalError=s}}class u extends t{constructor(t,s,n,o){super(t,n,o),this.name=s,this.status=n}}class c extends u{constructor(){super('Auth session missing!','AuthSessionMissingError',400,void 0)}}class h extends u{constructor(){super('Auth session or user missing','AuthInvalidTokenResponseError',500,void 0)}}class l extends u{constructor(t){super(t,'AuthInvalidCredentialsError',400,void 0)}}class f extends u{constructor(t,s=null){super(t,'AuthImplicitGrantRedirectError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class E extends u{constructor(t,s=null){super(t,'AuthPKCEGrantCodeExchangeError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class A extends u{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.",'AuthPKCECodeVerifierMissingError',400,'pkce_code_verifier_not_found')}}class p extends u{constructor(t,s){super(t,'AuthRetryableFetchError',s,void 0)}}class b extends u{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,'AuthRefreshDiscardedError',409,void 0)}}class O extends u{constructor(t,s,n){super(t,'AuthWeakPasswordError',s,'weak_password'),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class P extends u{constructor(t){super(t,'AuthInvalidJwtError',400,'invalid_jwt')}}},1256,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.byteToBase64URL=o,e.byteFromBase64URL=i,e.stringToBase64URL=function(t){const u=[],n=t=>{u.push(t)},i={queue:0,queuedBits:0};return f(t,t=>{o(t,i,n)}),o(null,i,n),u.join('')},e.stringFromBase64URL=function(t){const u=[],n=t=>{u.push(String.fromCodePoint(t))},o={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},f=t=>{c(t,o,n)};for(let u=0;u{u.push(t)};for(let u=0;uu.push(t)),new Uint8Array(u)},e.bytesToBase64URL=function(t){const u=[],n={queue:0,queuedBits:0},i=t=>{u.push(t)};return t.forEach(t=>o(t,n,i)),o(null,n,i),u.join('')};const t='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'.split(''),u=' \t\n\r='.split(''),n=(()=>{const n=new Array(128);for(let t=0;t=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}}function i(t,u,o){const i=n[t];if(!(i>-1)){if(-2===i)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}for(u.queue=u.queue<<6|i,u.queuedBits+=6;u.queuedBits>=8;)o(u.queue>>u.queuedBits-8&255),u.queuedBits-=8}function s(t,u){if(!(t<=127)){if(t<=2047)return u(192|t>>6),void u(128|63&t);if(t<=65535)return u(224|t>>12),u(128|t>>6&63),void u(128|63&t);if(t<=1114111)return u(240|t>>18),u(128|t>>12&63),u(128|t>>6&63),void u(128|63&t);throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}u(t)}function f(t,u){for(let n=0;n55295&&o<=56319){const u=1024*(o-55296)&65535;o=65536+(t.charCodeAt(n+1)-56320&65535|u),n+=1}s(o,u)}}function c(t,u,n){if(0===u.utf8seq){if(t<=127)return void n(t);for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){u.utf8seq=n;break}if(2===u.utf8seq)u.codepoint=31&t;else if(3===u.utf8seq)u.codepoint=15&t;else{if(4!==u.utf8seq)throw new Error('Invalid UTF-8 sequence');u.codepoint=7&t}u.utf8seq-=1}else if(u.utf8seq>0){if(t<=127)throw new Error('Invalid UTF-8 sequence');u.codepoint=u.codepoint<<6|63&t,u.utf8seq-=1,0===u.utf8seq&&n(u.codepoint)}}},1257,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SIGN_OUT_SCOPES",{enumerable:!0,get:function(){return t}});const t=['global','local','others']},1258,[]); +__d(function(e,t,s,r,i,n,a){"use strict";Object.defineProperty(n,'__esModule',{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return A}});var o,l=t(a[0]),u=(o=l)&&o.__esModule?o:{default:o},h=t(a[1]),c=t(a[2]),d=t(a[3]),_=t(a[4]),g=t(a[5]),w=t(a[6]),y=t(a[7]),f=t(a[8]),p=t(a[9]),v=t(a[10]),b=t(a[11]);(0,y.polyfillGlobalThis)();const k={url:h.GOTRUE_URL,storageKey:h.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:h.DEFAULT_HEADERS,flowType:'implicit',debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},m={};class R{get jwks(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{cachedAt:e})}constructor(e){var t,s,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},k),e);if(this.storageKey=i.storageKey,this.instanceID=null!==(t=R.nextInstanceID[this.storageKey])&&void 0!==t?t:0,R.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,'function'==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&(0,_.isBrowser)()){const e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=null!==(s=i.experimental)&&void 0!==s?s:{},this.admin=new u.default({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=(0,_.resolveFetch)(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,null!=i.lock&&(this.lock=i.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new b.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,_.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),(0,_.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error('Failed to create a new BroadcastChannel, multi-tab state changes will not be available',e)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener('message',async e=>{this._debug('received broadcast notification from other tab or client',e),'TOKEN_REFRESHED'!==e.data.event&&'SIGNED_IN'!==e.data.event||(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug('#broadcastChannel','error',e)}})}i.skipAutoInitialize||this.initialize().catch(e=>{this._debug('#initialize()','error',e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${f.version}) ${(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())()),await this.initializePromise}async _initialize(){var e;try{let t={},s='none';if((0,_.isBrowser)()&&(t=(0,_.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(t)?s='implicit':await this._isPKCECallback(t)&&(s='pkce')),(0,_.isBrowser)()&&this.detectSessionInUrl&&'none'!==s){const{data:r,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug('#_initialize()','error detecting session from URL',i),(0,c.isAuthImplicitGrantRedirectError)(i)){const t=null===(e=i.details)||void 0===e?void 0:e.code;if('identity_already_exists'===t||'identity_not_found'===t||'single_identity_not_deletable'===t)return{error:i}}return{error:i}}const{session:n,redirectType:a}=r;return this._debug('#_initialize()','detected session in URL',n,'redirect type',a),await this._saveSession(n),setTimeout(async()=>{'recovery'===a?await this._notifyAllSubscribers('PASSWORD_RECOVERY',n):await this._notifyAllSubscribers('SIGNED_IN',n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return(0,c.isAuthError)(e)?this._returnResult({error:e}):this._returnResult({error:new c.AuthUnknownError('Unexpected error during initialization',e)})}finally{await this._handleVisibilityChange(),this._debug('#_initialize()','end')}}async signInAnonymously(e){var t,s,r;try{const i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{data:null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==s?s:{},gotrue_meta_security:{captcha_token:null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken}},xform:d._sessionResponse}),{data:n,error:a}=i;if(a||!n)return this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,s,r;try{let i;if('email'in e){const{email:s,password:r,options:n}=e;let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey)),i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:d._sessionResponse})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:t,password:n,options:a}=e;i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null==a?void 0:a.data)&&void 0!==s?s:{},channel:null!==(r=null==a?void 0:a.channel)&&void 0!==r?r:'sms',gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:d._sessionResponse})}}const{data:n,error:a}=i;if(a||!n)return await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if('email'in e){const{email:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}}const{data:s,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!s||!s.session||!s.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers('SIGNED_IN',s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,null!=this.lock?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:t}=e;switch(t){case'ethereum':return await this.signInWithEthereum(e);case'solana':return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,s,r,i,n,a,o,l,u,h,g;let w,y;if('message'in e)w=e.message,y=e.signature;else{const{chain:h,wallet:c,statement:d,options:g}=e;let f;if((0,_.isBrowser)())if('object'==typeof c)f=c;else{const e=window;if(!('ethereum'in e)||'object'!=typeof e.ethereum||!('request'in e.ethereum)||'function'!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");f=e.ethereum}else{if('object'!=typeof c||!(null==g?void 0:g.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');f=c}const p=new URL(null!==(t=null==g?void 0:g.url)&&void 0!==t?t:window.location.href),b=await f.request({method:'eth_requestAccounts'}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=(0,v.getAddress)(b[0]);let m=null===(s=null==g?void 0:g.signInWithEthereum)||void 0===s?void 0:s.chainId;if(!m){const e=await f.request({method:'eth_chainId'});m=(0,v.fromHex)(e)}const R={domain:p.host,address:k,statement:d,uri:p.href,version:'1',chainId:m,nonce:null===(r=null==g?void 0:g.signInWithEthereum)||void 0===r?void 0:r.nonce,issuedAt:null!==(n=null===(i=null==g?void 0:g.signInWithEthereum)||void 0===i?void 0:i.issuedAt)&&void 0!==n?n:new Date,expirationTime:null===(a=null==g?void 0:g.signInWithEthereum)||void 0===a?void 0:a.expirationTime,notBefore:null===(o=null==g?void 0:g.signInWithEthereum)||void 0===o?void 0:o.notBefore,requestId:null===(l=null==g?void 0:g.signInWithEthereum)||void 0===l?void 0:l.requestId,resources:null===(u=null==g?void 0:g.signInWithEthereum)||void 0===u?void 0:u.resources};w=(0,v.createSiweMessage)(R),y=await f.request({method:'personal_sign',params:[(0,v.toHex)(w),k]})}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'ethereum',message:w,signature:y},(null===(h=e.options)||void 0===h?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null===(g=e.options)||void 0===g?void 0:g.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,s,r,i,n,a,o,l,u,h,g,w;let y,f;if('message'in e)y=e.message,f=e.signature;else{const{chain:c,wallet:d,statement:g,options:w}=e;let p;if((0,_.isBrowser)())if('object'==typeof d)p=d;else{const e=window;if(!('solana'in e)||'object'!=typeof e.solana||!('signIn'in e.solana&&'function'==typeof e.solana.signIn||'signMessage'in e.solana&&'function'==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");p=e.solana}else{if('object'!=typeof d||!(null==w?void 0:w.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');p=d}const v=new URL(null!==(t=null==w?void 0:w.url)&&void 0!==t?t:window.location.href);if('signIn'in p&&p.signIn){const e=await p.signIn(Object.assign(Object.assign(Object.assign({issuedAt:(new Date).toISOString()},null==w?void 0:w.signInWithSolana),{version:'1',domain:v.host,uri:v.href}),g?{statement:g}:null));let t;if(Array.isArray(e)&&e[0]&&'object'==typeof e[0])t=e[0];else{if(!(e&&'object'==typeof e&&'signedMessage'in e&&'signature'in e))throw new Error('@supabase/auth-js: Wallet method signIn() returned unrecognized value');t=e}if(!('signedMessage'in t&&'signature'in t&&('string'==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields');y='string'==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),f=t.signature}else{if(!('signMessage'in p&&'function'==typeof p.signMessage&&'publicKey'in p&&'object'==typeof p&&p.publicKey&&'toBase58'in p.publicKey&&'function'==typeof p.publicKey.toBase58))throw new Error('@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API');y=[`${v.host} wants you to sign in with your Solana account:`,p.publicKey.toBase58(),...g?['',g,'']:[''],'Version: 1',`URI: ${v.href}`,`Issued At: ${null!==(r=null===(s=null==w?void 0:w.signInWithSolana)||void 0===s?void 0:s.issuedAt)&&void 0!==r?r:(new Date).toISOString()}`,...(null===(i=null==w?void 0:w.signInWithSolana)||void 0===i?void 0:i.notBefore)?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...(null===(n=null==w?void 0:w.signInWithSolana)||void 0===n?void 0:n.expirationTime)?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...(null===(a=null==w?void 0:w.signInWithSolana)||void 0===a?void 0:a.chainId)?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...(null===(o=null==w?void 0:w.signInWithSolana)||void 0===o?void 0:o.nonce)?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...(null===(l=null==w?void 0:w.signInWithSolana)||void 0===l?void 0:l.requestId)?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...(null===(h=null===(u=null==w?void 0:w.signInWithSolana)||void 0===u?void 0:u.resources)||void 0===h?void 0:h.length)?['Resources',...w.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join('\n');const e=await p.signMessage((new TextEncoder).encode(y),'utf8');if(!(e&&e instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet signMessage() API returned an recognized value');f=e}}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'solana',message:y,signature:(0,p.bytesToBase64URL)(f)},(null===(g=e.options)||void 0===g?void 0:g.captchaToken)?{gotrue_meta_security:{captcha_token:null===(w=e.options)||void 0===w?void 0:w.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!=t?t:'').split('/');try{if(!s&&'pkce'===this.flowType)throw new c.AuthPKCECodeVerifierMissingError;const{data:t,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:d._sessionResponse});if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('recovery'===r?'PASSWORD_RECOVERY':'SIGNED_IN',t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=r?r:null}),error:i})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,a=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:d._sessionResponse}),{data:o,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o||!o.session||!o.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers('SIGNED_IN',o.session)),this._returnResult({data:o,error:l})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if('email'in e){const{email:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null==i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:t,options:s}=e,{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null==s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null==s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},channel:null!==(n=null==s?void 0:s.channel)&&void 0!==n?n:'sms'}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number.')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,s;try{let r,i;'options'in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:a}=await(0,d._request)(this.fetch,'POST',`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:d._sessionResponse});if(a)throw a;if(!n){throw new Error('An error occurred on token verification.')}const o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers('recovery'==e.type?'PASSWORD_RECOVERY':'SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,s,r,i,n;try{let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const l=await(0,d._request)(this.fetch,'POST',`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},'providerId'in e?{provider_id:e.providerId}:null),'domain'in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:o}),headers:this.headers,xform:d._ssoResponse});return(null===(i=l.data)||void 0===i?void 0:i.url)&&(0,_.isBrowser)()&&!(null===(n=e.options)||void 0===n?void 0:n.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new c.AuthSessionMissingError;const{error:r}=await(0,d._request)(this.fetch,'GET',`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if('email'in e){const{email:s,type:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return o&&await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:s,type:r,options:i}=e,{data:n,error:a}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a type')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,t){this._debug('#_acquireLock','begin',e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug('#_acquireLock','lock acquired for storage key',this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug('#_acquireLock','lock released for storage key',this.storageKey),this.lockAcquired=!1}})}finally{this._debug('#_acquireLock','end')}}async _useSession(e){this._debug('#_useSession','begin');try{const t=await this.__loadSession();return await e(t)}finally{this._debug('#_useSession','end')}}async __loadSession(){this._debug('#__loadSession()','begin'),null==this.lock||this.lockAcquired||this._debug('#__loadSession()','used outside of an acquired lock!',(new Error).stack);try{let e=null;const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(this._debug('#getSession()','session from storage',t),null!==t&&(this._isValidSession(t)?e=t:(this._debug('#getSession()','session from storage is not valid'),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&1e3*e.expires_at-Date.now()Date.now())){const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(t&&t.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:r},error:null})}finally{this._debug('#__loadSession()','end')}}async getUser(e){if(e)return await this._getUser(e);let t;return await this.initializePromise,t=null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):await this._getUser(),t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:e,xform:d._userResponse}):await this._useSession(async e=>{var t,s,r;const{data:i,error:n}=e;if(n)throw n;return(null===(t=i.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0,xform:d._userResponse}):{data:{user:null},error:new c.AuthSessionMissingError}})}catch(e){if((0,c.isAuthError)(e))return(0,c.isAuthSessionMissingError)(e)&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t)):await this._updateUser(e,t)}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new c.AuthSessionMissingError;const n=r.session;let a=null,o=null;'pkce'===this.flowType&&null!=e.email&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{data:l,error:u}=await(0,d._request)(this.fetch,'PUT',`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:d._userResponse});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers('USER_UPDATED',n),this._returnResult({data:{user:n.user},error:null})})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new c.AuthSessionMissingError;const t=Date.now()/1e3;let s=t,r=!0,i=null;const{payload:n}=(0,_.decodeJWT)(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{data:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:'bearer',expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers('SIGNED_IN',i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null==e?void 0:e.refresh_token))throw new c.AuthSessionMissingError;const{data:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var s;try{if(!(0,_.isBrowser)())throw new c.AuthImplicitGrantRedirectError('No browser detected.');if(e.error||e.error_description||e.error_code)throw new c.AuthImplicitGrantRedirectError(e.error_description||'Error in URL with unspecified error_description',{error:e.error||'unspecified_error',code:e.error_code||'unspecified_code'});switch(t){case'implicit':if('pkce'===this.flowType)throw new c.AuthPKCEGrantCodeExchangeError('Not a valid PKCE flow url.');break;case'pkce':if('implicit'===this.flowType)throw new c.AuthImplicitGrantRedirectError('Not a valid implicit grant flow url.')}if('pkce'===t){if(this._debug('#_initialize()','begin','is PKCE flow',!0),!e.code)throw new c.AuthPKCEGrantCodeExchangeError('No code detected.');const{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;const i=new URL(window.location.href);return i.searchParams.delete('code'),window.history.replaceState(window.history.state,'',i.toString()),{data:{session:t.session,redirectType:null!==(s=t.redirectType)&&void 0!==s?s:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:n,refresh_token:a,expires_in:o,expires_at:l,token_type:u}=e;if(!(n&&o&&a&&u))throw new c.AuthImplicitGrantRedirectError('No session defined in URL');const d=Math.round(Date.now()/1e3),g=parseInt(o);let w=d+g;l&&(w=parseInt(l));const y=w-d;1e3*y<=h.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${g}s`);const f=w-g;d-f>=120?console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale',f,w,d):d-f<0&&console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew',f,w,d);const{data:p,error:v}=await this._getUser(n);if(v)throw v;const b={provider_token:r,provider_refresh_token:i,access_token:n,expires_in:g,expires_at:w,refresh_token:a,token_type:u,user:p.user};return window.location.hash='',this._debug('#_getSessionFromURL()','clearing window.location.hash'),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return'function'==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:'global'}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:'global'}){return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i&&!(0,c.isAuthSessionMissingError)(i))return this._returnResult({error:i});const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!(0,c.isAuthApiError)(t)||404!==t.status&&401!==t.status&&403!==t.status)&&!(0,c.isAuthSessionMissingError)(t))return this._returnResult({error:t})}return'others'!==e&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=(0,_.generateCallbackId)(),s={id:t,callback:e,unsubscribe:()=>{this._debug('#unsubscribe()','state change callback with id removed',t),this.stateChangeEmitters.delete(t)}};return this._debug('#onAuthStateChange()','registered callback with id',t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)}):await this._emitInitialSession(t)})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback('INITIAL_SESSION',r)),this._debug('INITIAL_SESSION','callback id',e,'session',r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback('INITIAL_SESSION',null)),this._debug('INITIAL_SESSION','callback id',e,'error',t),(0,c.isAuthSessionMissingError)(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let s=null,r=null;'pkce'===this.flowType&&([s,r]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,d._request)(this.fetch,'POST',`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return'token'in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:s,error:r}=await this._useSession(async t=>{var s,r,i,n,a;const{data:o,error:l}=t;if(l)throw l;const u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await(0,d._request)(this.fetch,'GET',u,{headers:this.headers,jwt:null!==(a=null===(n=o.session)||void 0===n?void 0:n.access_token)&&void 0!==a?a:void 0})});if(r)throw r;return(0,_.isBrowser)()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==s?void 0:s.url),this._returnResult({data:{provider:e.provider,url:null==s?void 0:s.url},error:null})}catch(t){if((0,c.isAuthError)(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var s;try{const{error:r,data:{session:i}}=t;if(r)throw r;const{options:n,provider:a,token:o,access_token:l,nonce:u}=e,h=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(s=null==i?void 0:i.access_token)&&void 0!==s?s:void 0,body:{provider:a,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:d._sessionResponse}),{data:_,error:g}=h;return g?this._returnResult({data:{user:null,session:null},error:g}):_&&_.session&&_.user?(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers('USER_UPDATED',_.session)),this._returnResult({data:_,error:g})):this._returnResult({data:{user:null,session:null},error:new c.AuthInvalidTokenResponseError})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){const t="#_refreshAccessToken()";this._debug(t,'begin');try{const s=Date.now();return await(0,_.retryable)(async s=>(s>0&&await(0,_.sleep)(200*Math.pow(2,s-1)),this._debug(t,'refreshing attempt',s),await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:d._sessionResponse})),(e,t)=>{const r=200*Math.pow(2,e);return t&&(0,c.isAuthRetryableFetchError)(t)&&Date.now()+r-sDate.now())?this._debug(r,'proactive refresh failed, access token still valid \u2014 preserving session'):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:s,expiresAt:Date.now()+h.REFRESH_FAILURE_COOLDOWN_MS},null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,'end')}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,'begin',t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map(async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(i),r.length>0){for(let e=0;ethis._autoRefreshTokenTick(),h.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&'object'==typeof e&&'function'==typeof e.unref?e.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&'object'==typeof t&&'function'==typeof t.unref?t.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug('#_stopAutoRefresh()');const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),null===(e=this.broadcastChannel)||void 0===e||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug('#_autoRefreshTokenTick()','begin'),null==this.lock)if(null===this.refreshingDeferred)try{const e=Date.now();try{await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}else this._debug('#_autoRefreshTokenTick()','refresh already in flight, skipping');else try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}})}catch(e){if(!(e instanceof w.LockAcquireTimeoutError))throw e;this._debug('auto refresh token tick lock not available')}}async _handleVisibilityChange(){if(this._debug('#_handleVisibilityChange()'),!(0,_.isBrowser)()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug('#visibilityChangedCallback','error',e)}},null===window||void 0===window||window.addEventListener('visibilitychange',this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error('_handleVisibilityChange',e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;if(this._debug(t,'visibilityState',document.visibilityState),'visible'===document.visibilityState){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,null!=this.lock)await this._acquireLock(this.lockAcquireTimeout,async()=>{'visible'===document.visibilityState?await this._recoverAndRefresh():this._debug(t,'acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting')});else{if('visible'!==document.visibilityState)return void this._debug(t,'visibilityState is no longer visible, skipping recovery');await this._recoverAndRefresh()}}else'hidden'===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null==s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null==s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),'pkce'===this.flowType){const[e,t]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey),s=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(s.toString())}if(null==s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null==s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join('&')}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;return i?this._returnResult({data:null,error:i}):await(0,d._request)(this.fetch,'DELETE',`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)return this._returnResult({data:null,error:n});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},'phone'===e.factorType?{phone:e.phone}:'totp'===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors`,{body:a,headers:this.headers,jwt:null===(s=null==i?void 0:i.session)||void 0===s?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):('totp'===e.factorType&&'totp'===o.type&&(null===(r=null==o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=Object.assign({challenge_id:e.challengeId},'webauthn'in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:'create'===e.webauthn.type?(0,b.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,b.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/verify`,{body:n,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers('MFA_CHALLENGE_VERIFIED',a),this._returnResult({data:a,error:o}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challenge(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});if(n.error)return n;const{data:a}=n;if('webauthn'!==a.type)return{data:a,error:null};switch(a.webauthn.type){case'create':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case'request':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:s}=await this.getUser();if(s)return{data:null,error:s};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])r.all.push(s),'verified'===s.status&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,s,r,i;if(e)try{const{payload:r}=(0,_.decodeJWT)(e);let i=null;r.aal&&(i=r.aal);let n=i;const{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!==(s=null===(t=null==a?void 0:a.factors)||void 0===t?void 0:t.filter(e=>'verified'===e.status))&&void 0!==s?s:[]).length>0&&(n='aal2');return{data:{currentLevel:i,nextLevel:n,currentAuthenticationMethods:r.amr||[]},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}const{data:{session:n},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=(0,_.decodeJWT)(n.access_token);let l=null;o.aal&&(l=o.aal);let u=l;(null!==(i=null===(r=n.user.factors)||void 0===r?void 0:r.filter(e=>'verified'===e.status))&&void 0!==i?i:[]).length>0&&(u='aal2');return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?await(0,d._request)(this.fetch,'GET',`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'approve'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'deny'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;return s?this._returnResult({data:null,error:s}):t?await(0,d._request)(this.fetch,'GET',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?(await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let s=t.keys.find(t=>t.kid===e);if(s)return s;const r=Date.now();if(s=this.jwks.keys.find(t=>t.kid===e),s&&this.jwks_cached_at+h.JWKS_TTL>r)return s;const{data:i,error:n}=await(0,d._request)(this.fetch,'GET',`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(n)throw n;return i.keys&&0!==i.keys.length?(this.jwks=i,this.jwks_cached_at=r,s=i.keys.find(t=>t.kid===e),s||null):null}async getClaims(e,t={}){try{let s=e;if(!s){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}const{header:r,payload:i,signature:n,raw:{header:a,payload:o}}=(0,_.decodeJWT)(s);if(!(null==t?void 0:t.allowExpired))try{(0,_.validateExp)(i.exp)}catch(e){throw new c.AuthInvalidJwtError(e instanceof Error?e.message:'JWT validation failed')}const l=r.alg&&!r.alg.startsWith('HS')&&r.kid&&'crypto'in globalThis&&'subtle'in globalThis.crypto?await this.fetchJwk(r.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!l){const{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:i,header:r,signature:n},error:null}}const u=(0,_.getAlgorithm)(r.alg),h=await crypto.subtle.importKey('jwk',l,u,!0,['verify']);if(!await crypto.subtle.verify(u,h,n,(0,p.stringToUint8Array)(`${a}.${o}`)))throw new c.AuthInvalidJwtError('Invalid JWT signature');return{data:{claims:i,header:r,signature:n},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,s,r;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:i,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}});if(n||!i)return this._returnResult({data:null,error:n});const a=(0,b.deserializeCredentialRequestOptions)(i.options),o=null!==(r=null===(s=null==e?void 0:e.options)||void 0===s?void 0:s.signal)&&void 0!==r?r:b.webAuthnAbortService.createNewAbortSignal(),{data:l,error:u}=await(0,b.getCredential)({publicKey:a,signal:o});if(u||!l)return this._returnResult({data:null,error:null!=u?u:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const h=(0,b.serializeCredentialRequestResponse)(l);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,s;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const n=(0,b.deserializeCredentialCreationOptions)(r.options),a=null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.signal)&&void 0!==s?s:b.webAuthnAbortService.createNewAbortSignal(),{data:o,error:l}=await(0,b.createCredential)({publicKey:n,signal:a});if(l||!o)return this._returnResult({data:null,error:null!=l?l:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const u=(0,b.serializeCredentialCreationResponse)(o);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:s,error:r}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:s,error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:d._sessionResponse});return s?this._returnResult({data:null,error:s}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:t,error:null}))}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'GET',`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'PATCH',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:e.friendlyName}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{error:i}=await(0,d._request)(this.fetch,'DELETE',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}}R.nextInstanceID={};var A=R},1259,[1251,1253,1256,1252,1255,1260,1261,1262,1254,1257,1263,1264]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.memoryLocalStorageAdapter=function(t={}){return{getItem:o=>t[o]||null,setItem:(o,n)=>{t[o]=n},removeItem:o=>{delete t[o]}}}},1260,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"internals",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"LockAcquireTimeoutError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"ProcessLockAcquireTimeoutError",{enumerable:!0,get:function(){return s}}),_e.navigatorLock=async function(e,t,s){o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire lock',e,t);const c=new globalThis.AbortController;let l;t>0&&(l=setTimeout(()=>{c.abort(),o.debug&&console.log('@supabase/gotrue-js: navigatorLock acquire timed out',e)},t));await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:'exclusive',ifAvailable:!0}:{mode:'exclusive',signal:c.signal},async c=>{if(!c){if(0===t)throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: not immediately available',e),new n(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(o.debug)try{const e=await globalThis.navigator.locks.query();console.log('@supabase/gotrue-js: Navigator LockManager state',JSON.stringify(e,null,' '))}catch(e){console.warn('@supabase/gotrue-js: Error when querying Navigator LockManager state',e)}return console.warn('@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request'),clearTimeout(l),await s()}clearTimeout(l),o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquired',e,c.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released',e,c.name)}})}catch(u){if(t>0&&clearTimeout(l),null!==u&&'object'==typeof u&&'name'in u&&'AbortError'===u.name&&t>0){if(c.signal.aborted)return o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock',e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:'exclusive',steal:!0},async t=>{if(!t)return console.warn('@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true'),await s();o.debug&&console.log('@supabase/gotrue-js: navigatorLock: recovered (stolen)',e,t.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released (stolen)',e,t.name)}}));throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: lock was stolen by another request',e),new n(`Lock "${e}" was released because another request stole it`)}throw u}},_e.processLock=async function(e,o,n){var l;const u=null!==(l=c[e])&&void 0!==l?l:Promise.resolve(),b=(async()=>{try{return await u,null}catch(e){return null}})(),k=(async()=>{let c=null;try{const t=o>=0?new Promise((t,n)=>{c=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${e}" acquisition timed out after ${o}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),n(new s(`Acquiring process lock with name "${e}" timed out`))},o)}):null;await Promise.race([b,t].filter(e=>e)),null!==c&&clearTimeout(c)}catch(e){if(null!==c&&clearTimeout(c),e instanceof t)throw e}return await n()})();return c[e]=(async()=>{try{return await k}catch(e){if(e instanceof t){try{await u}catch(e){}return null}throw e}})(),await k};var e=r(d[0]);const o={debug:!!(globalThis&&(0,e.supportsLocalStorage)()&&globalThis.localStorage&&'true'===globalThis.localStorage.getItem('supabase.gotrue-js.locks.debug'))};class t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class n extends t{}class s extends t{}const c={}},1261,[1255]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.polyfillGlobalThis=function(){if('object'==typeof globalThis)return;try{Object.defineProperty(Object.prototype,'__magic__',{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){'undefined'!=typeof self&&(self.globalThis=self)}}},1262,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}Object.defineProperty(e,'__esModule',{value:!0}),e.getAddress=t,e.fromHex=function(t){return parseInt(t,16)},e.toHex=function(t){const n=(new TextEncoder).encode(t);return'0x'+Array.from(n,t=>t.toString(16).padStart(2,'0')).join('')},e.createSiweMessage=function(n){var s;const{chainId:o,domain:u,expirationTime:c,issuedAt:l=new Date,nonce:f,notBefore:I,requestId:v,resources:h,scheme:$,uri:w,version:E}=n;if(!Number.isInteger(o))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${o}`);if(!u)throw new Error("@supabase/auth-js: Invalid SIWE message field \"domain\". Domain must be provided.");if(f&&f.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${f}`);if(!w)throw new Error("@supabase/auth-js: Invalid SIWE message field \"uri\". URI must be provided.");if('1'!==E)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${E}`);if(null===(s=n.statement)||void 0===s?void 0:s.includes('\n'))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`);const S=t(n.address),b=$?`${$}://${u}`:u,p=n.statement?`${n.statement}\n`:'',j=`${b} wants you to sign in with your Ethereum account:\n${S}\n\n${p}`;let x=`URI: ${w}\nVersion: ${E}\nChain ID: ${o}${f?`\nNonce: ${f}`:''}\nIssued At: ${l.toISOString()}`;c&&(x+=`\nExpiration Time: ${c.toISOString()}`);I&&(x+=`\nNot Before: ${I.toISOString()}`);v&&(x+=`\nRequest ID: ${v}`);if(h){let t='\nResources:';for(const n of h){if(!n||'string'!=typeof n)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${n}`);t+=`\n- ${n}`}x+=t}return`${j}\n${x}`}},1263,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return l.WebAuthnError}}),Object.defineProperty(e,"isWebAuthnError",{enumerable:!0,get:function(){return l.isWebAuthnError}}),Object.defineProperty(e,"identifyRegistrationError",{enumerable:!0,get:function(){return l.identifyRegistrationError}}),Object.defineProperty(e,"identifyAuthenticationError",{enumerable:!0,get:function(){return l.identifyAuthenticationError}}),Object.defineProperty(e,"WebAuthnAbortService",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"webAuthnAbortService",{enumerable:!0,get:function(){return u}}),e.deserializeCredentialCreationOptions=function(i){if(!i)throw new Error('Credential creation options are required');if('undefined'!=typeof PublicKeyCredential&&'parseCreationOptionsFromJSON'in PublicKeyCredential&&'function'==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:o,user:l,excludeCredentials:s}=i,u=(0,t.__rest)(i,["challenge","user","excludeCredentials"]),c=(0,n.base64UrlToUint8Array)(o).buffer,f=Object.assign(Object.assign({},l),{id:(0,n.base64UrlToUint8Array)(l.id).buffer}),h=Object.assign(Object.assign({},u),{challenge:c,user:f});if(s&&s.length>0){h.excludeCredentials=new Array(s.length);for(let t=0;t0){c.allowCredentials=new Array(l.length);for(let t=0;tnull!==t&&'object'==typeof t&&!Array.isArray(t),i=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),o={};for(const l of t)if(l)for(const t in l){const s=l[t];if(void 0!==s)if(Array.isArray(s))o[t]=s;else if(i(s))o[t]=s;else if(n(s)){const i=o[t];n(i)?o[t]=p(i,s):o[t]=p(s)}else o[t]=s}return o}function w(t,n){return p(b,t,n||{})}function A(t,n){return p(y,t,n||{})}class O{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:'webauthn'}))}async _challenge({factorId:t,webauthn:n,friendlyName:o,signal:l},s){var c;try{const{data:i,error:b}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!i)return{data:null,error:b};const y=null!=l?l:u.createNewAbortSignal();if('create'===i.webauthn.type){const{user:t}=i.webauthn.credential_options.publicKey;if(!t.name){const n=o;if(n)t.name=`${t.id}:${n}`;else{const n=(await this.client.getUser()).data.user,i=(null===(c=null==n?void 0:n.user_metadata)||void 0===c?void 0:c.name)||(null==n?void 0:n.email)||(null==n?void 0:n.id)||'User';t.name=`${t.id}:${i}`}}t.displayName||(t.displayName=t.name)}switch(i.webauthn.type){case'create':{const n=w(i.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:o,error:l}=await f({publicKey:n,signal:y});return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}case'request':{const n=A(i.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:o,error:l}=await h(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:n,signal:y}));return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in challenge',t)}}}async _verify({challengeId:t,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:i})}async _authenticate({factorId:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn authentication')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:o},signal:l},{request:s});if(!u)return{data:null,error:f};const{webauthn:h}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:o,credential_response:h.credential_response}})}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in authenticate',t)}}}async _register({friendlyName:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn registration')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(n=>{var i;return null===(i=n.data)||void 0===i?void 0:i.all.find(n=>'webauthn'===n.factor_type&&n.friendly_name===t&&'unverified'!==n.status)}).then(t=>t?this.client.mfa.unenroll({factorId:null==t?void 0:t.id}):void 0),{data:null,error:f};const{data:h,error:b}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:o},signal:l},{create:s});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:o,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:b}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in register',t)}}}}},1264,[1229,1257,1256,1255,1265]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebAuthnUnknownError",{enumerable:!0,get:function(){return t}}),e.isWebAuthnError=function(n){return'object'==typeof n&&null!==n&&'__isWebAuthnError'in n},e.identifyRegistrationError=function({error:t,options:s}){var u,c,R;const{publicKey:E}=s;if(!E)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Registration ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else if('ConstraintError'===t.name){if(!0===(null===(u=E.authenticatorSelection)||void 0===u?void 0:u.requireResidentKey))return new o({message:'Discoverable credentials were required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',cause:t});if('conditional'===s.mediation&&'required'===(null===(c=E.authenticatorSelection)||void 0===c?void 0:c.userVerification))return new o({message:'User verification was required during automatic registration but it could not be performed',code:'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',cause:t});if('required'===(null===(R=E.authenticatorSelection)||void 0===R?void 0:R.userVerification))return new o({message:'User verification was required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',cause:t})}else{if('InvalidStateError'===t.name)return new o({message:'The authenticator was previously registered',code:'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',cause:t});if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('NotSupportedError'===t.name){return 0===E.pubKeyCredParams.filter(n=>'public-key'===n.type).length?new o({message:'No entry in pubKeyCredParams was of type "public-key"',code:'ERROR_MALFORMED_PUBKEYCREDPARAMS',cause:t}):new o({message:'No available authenticator supported any of the specified pubKeyCredParams algorithms',code:'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',cause:t})}if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(E.rp.id!==s)return new o({message:`The RP ID "${E.rp.id}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('TypeError'===t.name){if(E.user.id.byteLength<1||E.user.id.byteLength>64)return new o({message:'User ID was not between 1 and 64 characters',code:'ERROR_INVALID_USER_ID_LENGTH',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new credential',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})},e.identifyAuthenticationError=function({error:t,options:s}){const{publicKey:u}=s;if(!u)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Authentication ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else{if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(u.rpId!==s)return new o({message:`The RP ID "${u.rpId}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new assertion signature',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})};var n=r(d[0]);class o extends Error{constructor({message:n,code:o,cause:t,name:s}){var u;super(n,{cause:t}),this.__isWebAuthnError=!0,this.name=null!==(u=null!=s?s:t instanceof Error?t.name:void 0)&&void 0!==u?u:'Unknown Error',this.code=o}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class t extends o{constructor(n,o){super({code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:o,message:n}),this.name='WebAuthnUnknownError',this.originalError=o}}},1265,[1264]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1266,[1251]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1267,[1259]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.setSyncNamespace=function(e){s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:${e}:`:`cc-sync:${e}:`},Object.defineProperty(_e,"syncNamespace",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"kv",{enumerable:!0,get:function(){return i}}),_e.uuid=function(){const e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();const t=new Uint8Array(16);if(e?.getRandomValues)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,'0')).join('');return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`};var e,t=r(d[0]),n=r(d[1]),c=(e=n)&&e.__esModule?e:{default:e};let s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:`:'cc-sync:';const o=()=>s,i={async get(e,t){try{const n=await c.default.getItem(s+e);return null==n?t:JSON.parse(n)}catch{return t}},async set(e,t){try{await c.default.setItem(s+e,JSON.stringify(t))}catch{}},async remove(e){try{await c.default.removeItem(s+e)}catch{}}}},1268,[5,1190]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UK14",{enumerable:!0,get:function(){return t}}),e.cardAllergenMap=n,e.applyServerCard=function(t,s){const i=s.updated_at?new Date(String(s.updated_at)).toISOString():t.updatedAt,o=s.doc?.item?.allergenNotes;return{...t,allergens:n(s.allergens,s.may_contain),allergenNotes:'string'==typeof o&&o?o:void 0,dish:'string'==typeof s.dish&&s.dish?s.dish:t.dish,section:'string'==typeof s.section&&s.section?s.section:t.section,price:'number'==typeof s.price_pence?s.price_pence:t.price,signOff:t.signOff??{by:'Head chef',at:i}}},e.serverItem=function(t,s){const i=t.doc?.item;return i&&i.id?{...i,restaurantId:s,allergens:n(t.allergens,t.may_contain)}:null},Object.defineProperty(e,"noAllergenWords",{enumerable:!0,get:function(){return s}});const t=['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'];function n(n,s){const i=n=>Array.isArray(n)?n.map(String).filter(n=>t.includes(n)):[],o={};for(const t of i(s))o[t]='may';for(const t of i(n))o[t]='contains';return o}const s=t=>t?'No listed allergens':'Allergens not confirmed yet: ask staff'},1269,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isKitchenTeam",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canEditKitchenRota",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"kitchenTeam",{enumerable:!0,get:function(){return c}}),e.kitchenPending=function(t,n,c,s){return t.filter(t=>n.has(t.staffId)&&!!t.date&&t.date>=c&&t.date<=s&&(!t.published||t.changed))},e.publishKitchen=function(t,n,c,s){let u=0;return{shifts:t.map(t=>!n.has(t.staffId)||!t.date||t.dates||t.published&&!t.changed?t:(u++,{...t,published:!0,changed:!1})),n:u}},Object.defineProperty(e,"clashes",{enumerable:!0,get:function(){return s}});const t=t=>'kitchen'===String(t.dept??'').trim().toLowerCase()&&'owner'!==t.role&&'manager'!==t.role&&!t.managerAccess&&!t.ownerAccess,n=t=>t.includes('*')||t.includes('rota.kitchen')||t.includes('rota.manage'),c=n=>n.filter(n=>!1!==n.active&&t(n));const s=(t,n,c,s,u,o)=>t.some(t=>t.staffId===n&&t.date===c&&t.id!==o&&t.startt.category===n&&t.menuPrice&&t.id!==r).map(t=>t.menuPrice);return i.length?{avg:Math.round(i.reduce((t,n)=>t+n,0)/i.length),count:i.length}:null},Object.defineProperty(e,"GRAMS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"PACK_UNITS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"unitName",{enumerable:!0,get:function(){return u}}),e.convert=function(t,n,r){const i=a[n],o=a[r];return i&&o&&i.dim===o.dim?t*i.f/o.f:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"perServing",{enumerable:!0,get:function(){return f}}),e.perBaseUnit=d,Object.defineProperty(e,"servingWord",{enumerable:!0,get:function(){return p}}),e.lineCost=g,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return m}}),e.suggestAllergens=function t(n,r,i=[],o=0){const c=new Set;for(const a of n.lines)if(a.ingId.startsWith('dish:')){const n=i.find(t=>t.id===a.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>c.add(t)),t(n,r,i,o+1).forEach(t=>c.add(t)))}else r.find(t=>t.id===a.ingId)?.allergens?.forEach(t=>c.add(t));return[...c]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return h}}),e.gpOf=P,e.toPricePoint=b,e.suggestPrice=y,Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return O}}),e.multipleOf=function(t,n,r,i="inc"){return t<=0?0:('inc'===i?n:h(n,r))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return x}}),e.suggestForMultiple=function(t,n,r,i,o){const c=t*Math.max(0,n)*('ex'===i?1+r/100:1);return o?b(Math.ceil(c)):Math.ceil(c)},e.amountLabel=S,e.cardCostSummary=function(t,n,r,i){const o=(t?.lines??[]).map(t=>{const r=n.find(n=>n.id===t.ingId);return{line:t,name:r?.name??'Removed ingredient',cost:g(t,n),label:S(t,r)}}),c=o.reduce((t,n)=>t+n.cost,0),a=Math.max(1,t?.portions||1),s=c/a,u=t?.target??r.defaultTarget??70,l=s>0?y(s,u,r.vatPct,r.pricePoints):null,f=t?.menuPrice&&t.menuPrice>0?t.menuPrice:null,d=f??(i&&i>0?i:l),p=d&&s>0?P(s,d,r.vatPct):null;return{lines:o,batch:c,perPortion:s,target:u,suggested:l,price:d,priceIsSuggested:!(f||i&&i>0),gp:p?p.gpPct:null,cashGp:p?p.cashGp:null,foodCostPct:p?p.foodCostPct:null,tone:p?v(p.gpPct,u):null,missing:o.filter(t=>t.cost<=0).length}},Object.defineProperty(e,"foodCostTargetOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"targetGpForFoodCost",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"foodCostTone",{enumerable:!0,get:function(){return C}}),e.lineRates=function(t,n,r){const i=Math.max(1,n||1),o=r?d(r):null;return{perPortion:t/i,perKilo:o?o.pence:null,per:o?o.per:null}},e.lineRatesText=function(t){return`${M(t.perPortion)} a portion${null!=t.perKilo?` \xb7 ${M(t.perKilo)} a ${'item'===t.per?'item':t.per}`:''}`},e.vatAwareGp=function(t,n,r){const i=P(t,n,r),o=n>0?(n-t)/n*100:0;return{...i,vatPence:n-i.ex,naiveGpPct:o}},e.menuOverview=function(t){return[...t].sort((t,n)=>(null==t.gp?1:0)-(null==n.gp?1:0)||(t.gp??0)-(n.gp??0)||(n.foodCostPct??0)-(t.foodCostPct??0)||t.name.localeCompare(n.name))},e.marginDrops=function(t,n){const r=new Set,i=[];for(const o of[...t].filter(t=>t.gp&&t.date>=n).sort((t,n)=>(n.gp.at||n.date).localeCompare(t.gp.at||t.date)))for(const t of o.gp.dishes)null==t.before||null==t.after||r.has(t.id)||t.aftert.prices?.length?t.prices:[{p:t.packPrice,at:''}];function i(t,n=5){const i=r(t),o=i.slice(-Math.max(1,n)),c=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:i[i.length-1].p,avg:c,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const o=(t,n="latest",r=5)=>'average'===n?i(t,r).avg:i(t,r).latest;const c={g:1,kg:1e3,oz:28.349523125,lb:453.59237,stone:1e3*t.KG_PER_STONE},a={kg:{dim:'mass',f:c.kg},g:{dim:'mass',f:c.g},oz:{dim:'mass',f:c.oz},lb:{dim:'mass',f:c.lb},stone:{dim:'mass',f:c.stone},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},s=['kg','g','stone','lb','oz','L','ml','each'],u=(t,n=1)=>'L'===t?1===n?'litre':'litres':'stone'===t?'stone':'each'===t?'each':t;const l=(t,n)=>[...'mass'===a[t].dim?['g','kg','oz','lb']:'vol'===a[t].dim?['ml','L']:['each'],...n&&n>0?['serving']:[]],f=t=>t.servings&&t.servings>0?t.packPrice/t.servings:null;function d(t){const n=a[t.packUnit];if(!(n&&t.packSize>0))return null;const r=t.packSize*n.f;return'mass'===n.dim?{pence:t.packPrice/r*1e3,per:'kg'}:'vol'===n.dim?{pence:t.packPrice/r*1e3,per:'litre'}:{pence:t.packPrice/r,per:'item'}}const p=(t,n)=>{const r=(t?.servingName||'serving').trim().toLowerCase();return 1===n?r:/(s|sh|ch|x)$/.test(r)?`${r}es`:`${r}s`};function g(t,n,r=[],i=0){if(t.ingId.startsWith('dish:')){const o=r.find(n=>n.id===t.ingId.slice(5));return o&&i<4?m(o,n,r,i+1)*t.qty:0}const o=n.find(n=>n.id===t.ingId);if(!o||!o.packSize)return 0;if('serving'===t.unit){const n=f(o);return null==n?0:t.qty*n}const c=a[o.packUnit],s=a[t.unit];if(!s||c.dim!==s.dim)return 0;const u=o.packPrice/(o.packSize*c.f),l=Math.min(95,Math.max(0,t.wastePct??o.wastePct??0));return t.qty*s.f*u/(1-l/100)}const m=(t,n,r=[],i=0)=>t.lines.reduce((t,o)=>t+g(o,n,r,i),0)/Math.max(1,t.portions||1);const h=(t,n)=>t/(1+n/100);function P(t,n,r){const i=h(n,r);return{ex:i,gpPct:i>0?(i-t)/i*100:0,cashGp:i-t,foodCostPct:i>0?t/i*100:0}}function b(t){const n=Math.floor(t/100),r=t-100*n;return r<=50?100*n+50:r<=95?100*n+95:100*(n+1)+50}function y(t,n,r,i){const o=t/(1-Math.min(95,Math.max(0,n))/100)*(1+r/100);return i?b(Math.ceil(o)):Math.ceil(o)}const v=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',M=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,O=t=>`${t.toFixed(1)}%`;const x=t=>`${t.toFixed(1)}x`;function S(t,n){const r=Number.isInteger(t.qty)?String(t.qty):String(Math.round(1e3*t.qty)/1e3);return'serving'===t.unit?`${r} ${p(n,t.qty)}`:'each'===t.unit?`${r} ${1===t.qty?'item':'items'}`:`${r} ${u(t.unit,t.qty)}`}const k=t=>Math.round(10*(100-t))/10,j=t=>Math.round(10*(100-Math.min(60,Math.max(5,t))))/10,C=(t,n)=>t<=n+.05?'ok':t<=n+5?'amber':'red'},1271,[1085]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"piecesPerPack",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pieceName",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"lineTotal",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"deliveryTotal",{enumerable:!0,get:function(){return l}}),e.countPacks=a,Object.defineProperty(e,"countLineValue",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"countValue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"countUnitsFor",{enumerable:!0,get:function(){return p}}),e.applyDelivery=function(i,c,l,a,u=(new Date).toISOString(),o){let p=f(i,c.id,l,u,o);const v=`${c.date}T12:00:00.000Z`,h=c.lines.map(i=>{const o=i.name.trim();let f=p.find(n=>n.id===i.ingId)??p.find(n=>n.name.trim().toLowerCase()===o.toLowerCase());const h={p:Math.round(i.packPrice),at:v,src:c.id},k=t(i),b=k?{servings:Math.round(1e3*k)/1e3,servingName:s(i)}:{};if(!f){const n=a();return f={id:n,name:o,packSize:i.packSize,packUnit:i.packUnit,packPrice:h.p,wastePct:0,prices:[h],...b,...c.supplier.trim()?{supplier:c.supplier.trim()}:{},updatedAt:u},p=[...p,f],{...i,ingId:n,name:o,...k?{prevServings:null,prevServingName:null}:{}}}const P=d([...f.prices?.length?f.prices:[{p:f.packPrice,at:''}],h]).slice(-20),y=k?{prevServings:f.servings??null,prevServingName:f.servingName??null}:{},S={...f,packSize:i.packSize,packUnit:i.packUnit,prices:P,...b,...c.supplier.trim()?{supplier:c.supplier.trim()}:{},updatedAt:u};return S.packPrice=(0,n.costingPrice)(S,l.priceBasis,l.avgOf??5),p=p.map(n=>n.id===f.id?S:n),{...i,ingId:f.id,name:f.name,...y}});return{ingredients:p,lines:h}},e.removeDeliveryPrices=f,e.matchIngredient=function(n,t){const i=k(n);if(!i.length)return null;let s=null,c=0;for(const l of t){if(h(n)!==h(l.name))continue;const t=k(l.name),a=(n,t)=>n===t||Math.min(n.length,t.length)>=5&&(n.startsWith(t)||t.startsWith(n)),u=i.filter(n=>t.some(t=>a(n,t))).length,o=u?u/Math.max(i.length,t.length)+(l.name.trim().toLowerCase()===n.trim().toLowerCase()?1:0):0;o>c&&(c=o,s=l)}return c>=.5?s:null},e.cardUnit=b,e.suggestAmount=function(t,i,s){const c=(0,n.unitsFor)(s.packUnit,s.servings),l=Number(String(t).replace(',','.').trim()),a=b(i);if(Number.isFinite(l)&&l>0&&a){if('each'===a&&!c.includes('each')&&c.includes('serving'))return{qty:l,unit:'serving'};if(c.includes(a))return{qty:l,unit:a}}return{qty:0,unit:c[0]}};var n=r(_d[0]);const t=n=>n.count&&n.count>0&&n.packs>0?n.count/n.packs:null,i=n=>{const t=n.trim().toLowerCase();return t.length>3&&/ies$/.test(t)?`${t.slice(0,-3)}y`:t.length>3&&/(sh|ch|x)es$/.test(t)?t.slice(0,-2):t.length>3&&/s$/.test(t)&&!/ss$/.test(t)?t.slice(0,-1):t},s=n=>i(n.countName||'piece')||'piece',c=n=>Math.round((n.packs||0)*(n.packPrice||0)),l=n=>n.lines.reduce((n,t)=>n+c(t),0);function a(t){if(!(t.qty>=0))return null;if('pack'===t.unit)return t.qty;if('serving'===t.unit)return t.servings&&t.servings>0?t.qty/t.servings:null;const i=(0,n.convert)(t.qty,t.unit,t.packUnit);return null!=i&&t.packSize>0?i/t.packSize:null}const u=n=>{const t=a(n);return null==t?0:Math.round(t*n.packPrice)},o=n=>n.lines.reduce((n,t)=>n+u(t),0),p=t=>['pack',...(0,n.unitsFor)(t.packUnit,t.servings)],d=n=>[...n].sort((n,t)=>(n.at||'').localeCompare(t.at||''));function f(t,i,s,c=(new Date).toISOString(),l){return t.map(t=>{if(!t.prices?.some(n=>n.src===i))return t;const a=t.prices.filter(n=>n.src!==i),u=l?.lines.find(n=>n.ingId===t.id&&void 0!==n.prevServings),o=u?{servings:u.prevServings??void 0,servingName:u.prevServingName??void 0}:{},p={...t,...o,prices:a.length?a:[{p:t.packPrice,at:''}],updatedAt:c};return u&&null==u.prevServings&&(delete p.servings,delete p.servingName),p.packPrice=(0,n.costingPrice)(p,s.priceBasis,s.avgOf??5),p})}const v=n=>n.toLowerCase().replace(/\b(pea|bean|broccoli|radish|sunflower)\s*-?\s*(shoots?|sprouts?)\b/g,'$1$2'),h=n=>(v(n).match(/[a-z]*(shoot|sprout|cress)[a-z]*/g)||[]).map(n=>n.replace(/s$/,'')).sort().join(','),k=n=>v(n).replace(/\([^)]*\)/g,' ').replace(/[^a-z\s]/g,' ').split(/\s+/).filter(n=>n.length>2&&!['the','and','with','cooked','fresh','chopped','diced','sliced','cleaned','whole'].includes(n)).map(n=>n.replace(/(es|s)$/,''));function b(n){const t=n.trim().toLowerCase().replace(/\.$/,'');return['g','gram','grams','gr'].includes(t)?'g':['kg','kilo','kilos','kgs'].includes(t)?'kg':['ml','mls'].includes(t)?'ml':['l','litre','litres','liter','liters','ltr'].includes(t)?'L':['oz','ounce','ounces'].includes(t)?'oz':['lb','lbs','pound','pounds'].includes(t)?'lb':['','whole','each','single','singles','piece','pieces','slice','slices','sliced','portion','portions','wedge','wedges','x'].includes(t)?'each':null}},1272,[1271]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"normRead",{enumerable:!0,get:function(){return r}}),e.rememberedMatch=i,e.matchLine=function(t,r,a,s,c){const o=i(t,a,s,c);if(o)return{ing:o,how:'remembered'};const l=r.trim().toLowerCase(),u=c.find(t=>t.name.trim().toLowerCase()===l);if(u)return{ing:u,how:'exact'};const p=(0,n.matchIngredient)(r,c)??(0,n.matchIngredient)(t,c);return p?{ing:p,how:'close'}:{ing:null,how:'new'}},e.packUnitOf=s,e.lineFlags=function(t,n){const r=[];t.sure||r.push('Not sure it read this line right');t.item||r.push('Item name not read');t.packs&&t.packs>0||r.push('Quantity not read');t.packSize&&t.packSize>0&&s(t.packUnit)||r.push('Pack size not read');null==t.unitPrice&&r.push('Price not read');null!=t.unitPrice&&t.packs&&null!=t.lineTotal&&Math.abs(t.packs*t.unitPrice-t.lineTotal)>Math.max(2,.01*t.lineTotal)&&r.push('Quantity times price does not match the line total');'new'===n&&r.push('New item: not on your price list yet');'close'===n&&r.push('Matched to a similar name: check it is the same item');return r},e.costView=c,e.lineCostChange=function(r,a,i){const s=(0,n.piecesPerPack)(a),o=s?{servings:s,servingName:(a.countName||'piece').replace(/s$/i,'')}:{},l=r?{...r,packSize:a.packSize,packUnit:a.packUnit,...o,prices:[...r.prices?.length?r.prices:[{p:r.packPrice,at:''}],{p:a.packPrice,at:'z'}]}:{id:'',name:'',packSize:a.packSize,packUnit:a.packUnit,packPrice:a.packPrice,wastePct:0,...o};l.packPrice=r?(0,t.costingPrice)(l,i.priceBasis,i.avgOf??5):a.packPrice;const u=c(r),p=c(l),d=u?.base&&p?.base&&u.base.per===p.base.per&&u.base.pence>0?(p.base.pence-u.base.pence)/u.base.pence*100:null;return{before:u,after:p,changePct:d}},e.menuGp=o,Object.defineProperty(e,"NOTICEABLE_DROP",{enumerable:!0,get:function(){return l}}),e.gpImpact=function(t,r,a,i,s,c){const u=o(t,r,a,i),{ingredients:p}=(0,n.applyDelivery)(t,s,i,()=>`tmp-${Math.random()}`,void 0,c),d=o(p,r,a,i),m=d.dishes.map(t=>{const n=u.dishes.find(n=>n.id===t.id),r=n?.gp??t.gp,a=r-t.gp;return{id:t.id,name:t.name,before:r,after:t.gp,target:t.target,drop:a,flagged:a>=l||r>=t.target-.05&&t.gpMath.abs(t.before-t.after)>=.05).sort((t,n)=>n.drop-t.drop);return{snap:{at:`${s.date}T12:00:00.000Z`,before:u.menu,after:d.menu,dishes:d.dishes.map(t=>({id:t.id,name:t.name,before:u.dishes.find(n=>n.id===t.id)?.gp??null,after:t.gp}))},dishes:m,after:p}},Object.defineProperty(e,"RANGE_WEEKS",{enumerable:!0,get:function(){return u}}),e.mondayOf=m,e.gpHistory=function(t,n,r,a=d(new Date)){const i=[],s=m(a),[c,o,l]=s.split('-').map(Number);for(let t=u[r]-1;t>=0;t--)i.push(d(new Date(c,o-1,l-7*t)));const p=[...t].sort((t,n)=>t.date.localeCompare(n.date)||(t.createdAt??'').localeCompare(n.createdAt??'')),f={};let h=null;for(const t of p)t.datenull!=t.after).map(t=>[t.id,t.after]))});const b=[],k=[];for(const t of i){const r=d(new Date(Number(t.slice(0,4)),Number(t.slice(5,7))-1,Number(t.slice(8,10))+7)),a=p.filter(n=>n.date>=t&&n.datenull!=t.after).map(t=>[t.id,t.after]))},n.gp.dishes.forEach(t=>{f[t.id]=t.name}));const r=n.gp&&null!=n.gp.before&&null!=n.gp.after?n.gp.after-n.gp.before:null;(!n.gp||null==r||Math.abs(r)>=.05)&&k.push({week:t,date:n.date,id:n.id,supplier:n.supplier,change:r})}t!==s?b.push(h?{...h,week:t}:{week:t,menu:null,dishes:{}}):b.push({week:t,menu:n.menu,dishes:Object.fromEntries(n.dishes.map(t=>[t.id,t.gp]))})}return{points:b,markers:k,names:f}},Object.defineProperty(e,"RANGE_SAID",{enumerable:!0,get:function(){return f}}),e.gpSummary=function(t,n){const r=t.filter(t=>null!=t.menu);if(!r.length)return'No GP history yet. It starts with the first delivery that changes a cost.';const a=r[r.length-1].menu,i=t=>Math.abs(t)<.05?'steady':`${t>0?'up':'down'} ${Math.abs(t).toFixed(1)} points`,s=r.length>1?r[r.length-2].menu:null,c=r[0].menu;return null==s?`Menu GP now ${a.toFixed(1)} percent. Not enough history to compare yet.`:`Menu GP now ${a.toFixed(1)} percent, ${i(a-s)} on the week before, ${i(a-c)} over ${f[n]}.`};var t=_r(_d[0]),n=_r(_d[1]);const r=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,' ').replace(/\s+/g,' ').trim(),a=(t,n)=>r(t)===r(n)&&!!r(t);function i(t,n,i,s){const c=r(t);if(!c)return null;const o=(Array.isArray(i)?i:Object.values(i)).filter(t=>a(t.supplier,n)).sort((t,n)=>(n.updatedAt??n.createdAt).localeCompare(t.updatedAt??t.createdAt));for(const t of o)for(const n of t.lines)if(n.read&&r(n.read)===c){const t=s.find(t=>t.id===n.ingId);if(t)return t}return null}function s(n){const r=(n??'').trim().toLowerCase().replace(/\.$/,'');return r?['kg','kgs','kilo','kilos','kilogram','kilograms'].includes(r)?'kg':['g','gr','gram','grams','gm','gms'].includes(r)?'g':['l','lt','ltr','litre','litres','liter','liters'].includes(r)?'L':['ml','mls'].includes(r)?'ml':['lb','lbs','pound','pounds'].includes(r)?'lb':['oz','ounce','ounces'].includes(r)?'oz':['st','stone'].includes(r)?'stone':['each','ea','x','unit','units','pc','pcs','piece','pieces','item','items','case','cases','box','boxes','tray','trays','pack','packs','bottle','bottles','can','cans','tin','tins','jar','jars','tub','tubs','bag','bags','dozen','doz'].includes(r)?'each':t.PACK_UNITS.includes(r)?r:null:null}function c(n){if(!n)return null;const r=(0,t.perServing)(n);return{base:(0,t.perBaseUnit)(n),piece:null!=r?{pence:r,name:(n.servingName||'piece').toLowerCase()}:null}}function o(n,r,a,i){const s=a.map(a=>{const s=(0,t.cardCostSummary)(r[a.id],n,i,a.price);return{id:a.id,name:a.dish,gp:s.gp,target:s.target}}).filter(t=>null!=t.gp);return{menu:s.length?s.reduce((t,n)=>t+n.gp,0)/s.length:null,dishes:s}}const l=2;const u={'4w':4,'3m':13,'12m':52},p=t=>String(t).padStart(2,'0'),d=t=>`${t.getFullYear()}-${p(t.getMonth()+1)}-${p(t.getDate())}`;function m(t){const[n,r,a]=t.split('-').map(Number),i=new Date(n,r-1,a);return i.setDate(i.getDate()-(i.getDay()+6)%7),d(i)}const f={'4w':'4 weeks','3m':'3 months','12m':'12 months'}},1273,[1271,1272]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteFromLocation=function(n,t){const o=new URLSearchParams(n).get('invite');if(o)return o;const s=(t||'').match(/[#&]invite=([A-Za-z0-9_-]{10,})/);return s?s[1]:null},e.addressWithoutInvite=function(n){try{const t=new URL(n);t.searchParams.delete('invite');const o=t.hash.replace(/^#/,'').split('&').filter(n=>n&&!n.startsWith('invite=')&&!n.startsWith('ccchrome=')&&!n.startsWith('cckitchen=')).join('&');return t.hash=o?`#${o}`:'',t.toString()}catch{return n}},Object.defineProperty(e,"PHONE_LINKED_TEXT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isPhoneLinked",{enumerable:!0,get:function(){return t}}),e.inviteRefusal=function(t){return/already linked to another phone/i.test(t)?n:/update the app/i.test(t)?'Update the app: close it, then open your personal link again.':/already been used/i.test(t)?'This link has already been used on another device. Ask your manager for a new one.':/expired/i.test(t)?'This link has expired. Ask your manager for a new one.':/replaced|switched off|not valid|invalid|unknown invite/i.test(t)?'This link has been replaced or switched off. Ask your manager for a new one.':/personal app link is incomplete/i.test(t)?'Open the complete personal iPhone link your manager sent.':/no longer active/i.test(t)?'This person is no longer on the team. Ask your manager if this is wrong.':null},Object.defineProperty(e,"WIPE_PREFIXES",{enumerable:!0,get:function(){return o}}),e.keysToWipe=function(n){return n.filter(n=>o.some(t=>n.startsWith(t)))},e.handoverFromHash=function(n){const t=(n||'').match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|$)/);return t?t[1]:null};const n='This link is already linked to another phone. Ask a manager to reset it or send you a new link.',t=n=>!!n&&/already linked to another phone/i.test(n);const o=['covercharge-','cc-sync:','cc-','sb-']},1274,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.persistedSessionSlice=function(n,o){return n?{welcomed:o.welcomed}:{meId:o.meId,signedInAt:o.signedInAt,welcomed:o.welcomed}},e.migrateCarSession=function(n){return{meId:null,signedInAt:void 0,welcomed:(n&&'object'==typeof n?n:{}).welcomed??{}}},e.carResetsSessionOnLoad=function(n,o){return n&&!o}},1275,[]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hrRemote",{enumerable:!0,get:function(){return y}}),_e.exampleHr=f,_e.stripHrSamples=m,Object.defineProperty(_e,"useHr",{enumerable:!0,get:function(){return q}});var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),i=r(_d[4]),u=(e=i)&&e.__esModule?e:{default:e},d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const y={live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null},v=(e,t,s)=>(0,c.oneWayToken)(e,`shift:${t}:${s}`),p=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function f(e,t){const s=[];for(let n=14;n>=1;n--){const o=p(t,-n),i=4===n?2:4+7*n%4;for(let t=0;t!((0,s.isAnchorage)(e.venue)&&e.example)),questions:e.questions.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrq-ex-[123]$/.test(e.id))),shouts:e.shouts.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrs-ex-[123]$/.test(e.id)))}}const q=(0,d.create)()((0,l.persist)((e,t)=>({secret:(0,c.newSecret)(),answered:[],voted:{},checkins:[],questions:[],shouts:[],log:[],seeded:{},ensure:(s,i)=>{if(n.LIVE_VENUE_BUILD||o.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(s)||t().seeded[s]||y.live)return;const u=f(s,i);e(e=>({seeded:{...e.seeded,[s]:!0},checkins:[...e.checkins,...u.checkins],questions:[...e.questions,...u.questions],shouts:[...e.shouts,...u.shouts]}))},hasAnswered:(e,s)=>t().answered.includes(v(t().secret,e,s)),submit:s=>{const n=t(),o=v(n.secret,s.rid,s.shiftKey);if(n.answered.includes(o))return'already';const i=(0,c.checkInPayload)({venue:s.rid,day:s.day,token:o,morale:s.morale,staffing:s.staffing}),u=s.question?(0,c.cleanQuestion)(s.question):null,d=s.shoutTo?.trim().slice(0,80)||void 0,l=s.shoutBody?.trim().slice(0,280)||void 0;return e({answered:[...n.answered,o].slice(-300)}),y.live&&y.checkout?(y.checkout({rid:s.rid,shiftKey:'',day:i.day,morale:i.morale,staffing:i.staffing,question:u??void 0,kind:s.kind??'up',shoutTo:d,shoutBody:l,token:o}),'queued'):(e(e=>({checkins:[...e.checkins,{venue:i.venue,day:i.day,morale:i.morale,staffing:i.staffing}],questions:u?[...e.questions,{id:(0,h.uuid)(),venue:s.rid,body:u,kind:s.kind??'up',up:0,yes:0,no:0,hidden:!1,postedOn:s.day}]:e.questions,shouts:d?[...e.shouts,{id:(0,h.uuid)(),venue:s.rid,day:s.day,to:d,body:l}]:e.shouts})),'ok')},skip:(s,n)=>{const o=t(),i=v(o.secret,s,n);o.answered.includes(i)||e({answered:[...o.answered,i].slice(-300)})},post:(t,s,n,o)=>{const i=(0,c.cleanQuestion)(s);if(!i)return null;const u=(0,h.uuid)();return e(e=>({questions:[...e.questions,{id:u,venue:t,body:i,kind:n,up:0,yes:0,no:0,hidden:!1,postedOn:o}]})),y.live&&y.post&&y.post(t,u,i,n),u},vote:(s,n)=>{const o=t();if(o.voted[s])return!1;const i=o.questions.find(e=>e.id===s);if(!i||i.hidden)return!1;const u='up'===i.kind?1:n;return e({voted:{...o.voted,[s]:u},questions:o.questions.map(e=>e.id===s?(0,c.applyVote)(e,u):e)}),y.live&&y.vote&&y.vote(s,(0,c.oneWayToken)(o.secret,`vote:${s}`),u),!0},moderate:(s,n,o,i)=>{const u=t().questions.find(e=>e.id===s);u&&(e(e=>({questions:e.questions.map(e=>e.id===s?{...e,hidden:'hide'===n}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:n,reason:o.trim()||void 0,by:i,at:(new Date).toISOString()},...e.log].slice(0,500)})),y.live&&y.moderate&&y.moderate(s,n,o.trim()))},reply:(s,n,o)=>{const i=n.trim().slice(0,600),u=t().questions.find(e=>e.id===s);if(!u)return;const d=(new Date).toISOString();e(e=>({questions:e.questions.map(e=>e.id===s?{...e,reply:i||void 0,replyAt:i?d:void 0}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:'reply',by:o,at:d},...e.log].slice(0,500)})),y.live&&y.reply&&y.reply(s,i)},setRemoteBoard:(t,s)=>e(e=>({questions:[...e.questions.filter(e=>e.venue!==t),...s]})),upsertRemote:t=>e(e=>({questions:e.questions.some(e=>e.id===t.id)?e.questions.map(e=>e.id===t.id?t:e):[...e.questions,t]}))}),{name:'covercharge-hr-v1',version:3,storage:(0,l.createJSONStorage)(()=>u.default),migrate:async e=>n.LIVE_VENUE_BUILD&&e?(await(0,t.archiveChefCache)('hr',e),{...e,...m(e)}):e}))},1276,[1198,1084,842,5,1190,995,1191,1277,1099]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_ANSWERS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_WORDING",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_HR",{enumerable:!0,get:function(){return r}}),e.hrSettingsOf=function(t){const n=t??{},r=n.wording??{},s=Object.fromEntries(Object.entries(o).map(([t,n])=>[t,a(r[t],'intro'===t||'staffing'===t||'question'===t?160:60,n)]));return{on:!1!==n.on,askQuestion:!1!==n.askQuestion,askShout:!1!==n.askShout,board:!1!==n.board,wording:s}},Object.defineProperty(e,"MORALE_STEPS",{enumerable:!0,get:function(){return s}}),e.moraleWord=function(t,n=o){return t<=1?n.moraleLow:t>=5?n.moraleHigh:2===t?'Fairly low':3===t?'OK':'Good'},Object.defineProperty(e,"STAFF_STOPS",{enumerable:!0,get:function(){return u}}),e.snapStaffing=i,e.staffingWord=function(t,n=o){const r=i(t);return r<=12?n.staffLow:r<45?"A bit short":r<=55?n.staffMid:r<88?"A bit over":n.staffHigh},e.oneWayToken=function(n,o){return(0,t.sha256HexSync)(`cc-hr:${n}:${o}`).slice(0,40)},e.newSecret=function(){let t='';const n=globalThis.crypto;if(n?.getRandomValues){return n.getRandomValues(new Uint8Array(24)).forEach(n=>{t+=n.toString(16).padStart(2,'0')}),t}for(let n=0;n<48;n++)t+=Math.floor(16*Math.random()).toString(16);return t},e.checkInPayload=function(t){const n=Math.max(1,Math.min(5,Math.round(t.morale)));return{venue:t.venue,day:t.day,token:t.token,morale:n,staffing:null==t.staffing?null:i(t.staffing)}},e.dayResults=function(t,o=n){const r=new Map;for(const n of t){const t=r.get(n.day)??[];t.push(n),r.set(n.day,t)}const a=[];let s=0;for(const[t,n]of[...r.entries()].sort(([t],[n])=>t.localeCompare(n))){if(n.lengtht.staffing).filter(t=>null!=t);a.push({day:t,answers:n.length,morale:Math.round(n.reduce((t,n)=>t+n.morale,0)/n.length*10)/10,staffing:r.length?Math.round(r.reduce((t,n)=>t+n,0)/r.length):null,short:r.filter(t=>t<45).length,perfect:r.filter(t=>t>=45&&t<=55).length,over:r.filter(t=>t>55).length})}return{shown:a,held:s}},Object.defineProperty(e,"QUESTION_MAX",{enumerable:!0,get:function(){return f}}),e.cleanQuestion=function(t){const n=t.replace(/\s+/g,' ').trim().slice(0,f);return n.length>=3?n:null},e.boardOrder=function(t,n){const o=t=>'up'===t.kind?t.up:t.yes+t.no;return t.filter(t=>n||!t.hidden).sort((t,n)=>Number(t.hidden)-Number(n.hidden)||o(n)-o(t)||n.postedOn.localeCompare(t.postedOn)||t.id.localeCompare(n.id))},e.applyVote=function(t,n){return'up'===t.kind?{...t,up:t.up+1}:1===n?{...t,yes:t.yes+1}:{...t,no:t.no+1}};var t=_r(d[0]);const n=3,o={intro:'Before you go: 3 quick taps, about 15 seconds. Your name is never saved with your answers.',morale:'How was team morale today?',moraleLow:'Low',moraleHigh:'High',staffing:'Was there enough staff on today for the number of customers?',staffLow:'Not enough',staffMid:'Perfect',staffHigh:'Overstaffed',question:'Got a question you\u2019d like to post anonymously for the team to vote on?',shout:'Shout out a teammate?'},r={on:!0,askQuestion:!0,askShout:!0,board:!0,wording:o},a=(t,n,o)=>('string'==typeof t?t.trim().slice(0,n):'')||o;const s=[1,2,3,4,5];const u=[0,12.5,25,37.5,50,62.5,75,87.5,100].map(t=>Math.round(t));function i(t){const n=Math.max(0,Math.min(100,Number.isFinite(t)?t:50));return u.reduce((t,o)=>Math.abs(o-n)>>0;o.push(c>>>24&255,c>>>16&255,c>>>8&255,255&c,h>>>24&255,h>>>16&255,h>>>8&255,255&h);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64),f=(t,n)=>t>>>n|t<<32-n;for(let n=0;n>>3,e=f(u[t-2],17)^f(u[t-2],19)^u[t-2]>>>10;u[t]=u[t-16]+n+u[t-7]+e>>>0}let e=l[0],s=l[1],c=l[2],h=l[3],a=l[4],i=l[5],p=l[6],d=l[7];for(let n=0;n<64;n++){const o=d+(f(a,6)^f(a,11)^f(a,25))+(a&i^~a&p)+t[n]+u[n]>>>0,l=(f(e,2)^f(e,13)^f(e,22))+(e&s^e&c^s&c)>>>0;d=p,p=i,i=a,a=h+o>>>0,h=c,c=s,s=e,e=o+l>>>0}l[0]=l[0]+e>>>0,l[1]=l[1]+s>>>0,l[2]=l[2]+c>>>0,l[3]=l[3]+h>>>0,l[4]=l[4]+a>>>0,l[5]=l[5]+i>>>0,l[6]=l[6]+p>>>0,l[7]=l[7]+d>>>0}return Array.from(l).map(t=>t.toString(16).padStart(8,'0')).join('')};const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t){const n=[];for(let e=0;e=55296&&o<=56319&&e+1=56320&&n<=57343&&(o=65536+(o-55296<<10)+(n-56320),e++)}o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<65536?n.push(224|o>>12,128|o>>6&63,128|63&o):n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}return n}},1278,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isOnline",{enumerable:!0,get:function(){return t}}),_e.setOnline=o,_e.onConnectivity=function(e){return n.add(e),()=>{n.delete(e)}},_e.isNetworkError=function(e){if(!e)return!1;const n=String(e.message??e).toLowerCase();return 0===e.status||/network|fetch failed|failed to fetch|timeout|timed out|offline|econn|enotfound|socket/.test(n)};let e=!0;const n=new Set,t=()=>e;function o(t){t!==e&&(e=t,n.forEach(n=>n(e)))}const s=globalThis.window;s?.addEventListener&&('boolean'==typeof s.navigator?.onLine&&(e=s.navigator.onLine),s.addEventListener('online',()=>o(!0)),s.addEventListener('offline',()=>o(!1)))},1279,[]); +__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'}},1280,[1279]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1281,[1282,1283,872,1268,1074]); +__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())}}}},1283,[1268]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.staffNickname=t,_e.staffDate=l,_e.staffSyncItem=c,_e.staffRevision=o,_e.staffEdited=function(e,n,t){return o(e,t)!==o(n,t)},_e.staffRow=function(e,t,l,o){const s=c(e,l),m={venue_id:t,external_ref:s.id,display_name:s.name||'Staff',job_title:s.job||null,department:s.dept||null,active:!1!==s.active};l.nickname&&(m.nickname=s.nickname??null);l.display&&(m.display_clock=!0===s.displayClock,m.temp=!0===s.temp,m.temp_until=s.temp?s.tempUntil??null:null);o&&n.test(o)&&!s.ownerAccess&&!s.managerAccess&&(m.role_id=o);return m};const e=/^\d{4}-\d{2}-\d{2}$/,n=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function t(e){if('string'!=typeof e)return null;return e.trim().slice(0,40)||null}function l(n){return'string'==typeof n&&e.test(n)?n:null}function c(e,n={nickname:!0,display:!0}){const c='owner'===e.role||'manager'===e.role||'staff'===e.role?e.role:'staff',o=!0===e.temp,s={id:e.id,name:(e.name??'').trim(),role:c,level:(e.level??'').trim(),job:(e.job??'').trim(),dept:(e.dept??'').trim(),active:!1!==e.active,managerAccess:!0===e.managerAccess,ownerAccess:!0===e.ownerAccess};return'boolean'==typeof e.bookingWrite&&(s.bookingWrite=e.bookingWrite),n.nickname&&(s.nickname=t(e.nickname)),n.display&&(s.displayClock=!0===e.displayClock,s.temp=o,s.tempUntil=o?l(e.tempUntil):null),s}function o(e,n={nickname:!0,display:!0}){const t=c(e,n);return JSON.stringify({name:t.name??'',job:t.job??'',dept:t.dept??'',active:!1!==t.active,...n.nickname?{nickname:t.nickname??null}:{},...n.display?{displayClock:!0===t.displayClock,temp:!0===t.temp,tempUntil:t.tempUntil??null}:{}})}},1284,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBookingSaves",{enumerable:!0,get:function(){return s}}),_e.notSavedWhat=u,Object.defineProperty(_e,"notSavedLine",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),n=r(d[1]),o=r(d[2]),l=(e=o)&&e.__esModule?e:{default:e};const s=(0,t.create)()((0,n.persist)((e,t)=>({count:()=>Object.keys(t().notSaved).length,notSaved:{},mark:t=>e(e=>({notSaved:{...e.notSaved,[t.id]:{...t,at:(new Date).toISOString()}}})),clear:t=>e(e=>{if(!e.notSaved[t])return e;const n={...e.notSaved};return delete n[t],{notSaved:n}}),clearAll:()=>e({notSaved:{}})}),{name:'covercharge-booking-saves-v1',storage:(0,n.createJSONStorage)(()=>l.default),version:1,partialize:e=>({notSaved:e.notSaved})})),c=e=>{const t=(e??'').split('+').map(e=>e.trim()).filter(Boolean);return t.length?`${t.length>1?'Tables':'Table'} ${t.join(' + ')}`:''};function u(e){const t=c(e.table);if(e.walkIn)return`Walk-in of ${e.partySize}${t?` on ${t}`:''}`;const n=(e.name||'Guest').trim();return t?`${t} for ${n}`:`Booking for ${n} at ${e.time}`}const v=e=>`${u(e)} did not save. Tap to try again.`},1285,[995,1191,1190]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useTempSaves",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"tempKey",{enumerable:!0,get:function(){return l}}),_e.tempNotSavedLine=function(e,t){const n=[];e&&n.push(1===e?'1 temperature reading':`${e} temperature readings`);t.length&&n.push(1===t.length?`the change to ${t[0]}`:`${t.length} unit changes`);const o=n.join(' and ');return`${o.charAt(0).toUpperCase()}${o.slice(1)} did not save. Tap to try again.`},_e.tempWaitingLine=function(e){return`${1===e?'1 temperature reading is':`${e} temperature readings are`} waiting to send. ${1===e?'It sends':'They send'} by itself when the connection is back.`.replace('They send by itself','They send by themselves')};var e,t=r(d[0]),n=r(d[1]),o=r(d[2]),s=(e=o)&&e.__esModule?e:{default:e};const c=(e,t)=>`${e}:${t}`,u=(0,t.create)()((0,n.persist)((e,t)=>({notSaved:{},count:()=>Object.keys(t().notSaved).length,mark:t=>e(e=>({notSaved:{...e.notSaved,[c(t.table,t.id)]:{...t,at:(new Date).toISOString()}}})),clear:t=>e(e=>{if(!e.notSaved[t])return e;const n={...e.notSaved};return delete n[t],{notSaved:n}})}),{name:'covercharge-temp-saves-v1',storage:(0,n.createJSONStorage)(()=>s.default),version:1,partialize:e=>({notSaved:e.notSaved})})),l=c},1286,[995,1191,1190]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.pointFromRow=i,_e.pointToRow=n,_e.readingFromRow=r,_e.readingToRow=o,Object.defineProperty(_e,"sameReading",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"readingRev",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"pointRev",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"TEMP_WINDOW_DAYS",{enumerable:!0,get:function(){return l}}),_e.tempUnitsSpec=function(e,t){return{name:'temp_units',table:'temp_units',conflict:'venue_id,id',deletes:!1,list:()=>e.getState().points??[],key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>/^[A-Za-z0-9_.:-]{1,64}$/.test(e.id),writable:t,matchKey:e=>({id:e}),revision:s,knownByRevision:!0,filter:e=>e.order('sort',{ascending:!0}),toRow:(t,i)=>n(t,i,10*Math.max(0,(e.getState().points??[]).findIndex(e=>e.id===t.id))),fromRow:e=>i(e),apply:t=>e.setState(e=>{const i=new Map(t.map(e=>[e.id,e])),n=(e.points??[]).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{points:[...n,...t.filter(e=>!r.has(e.id))]}}),afterRead:t=>{const i=new Map(t.map((e,t)=>[String(e.id),Number(e.sort??t)]));e.setState(e=>{const t=e.points??[],n=[...t.filter(e=>i.has(e.id)).sort((e,t)=>i.get(e.id)-i.get(t.id)),...t.filter(e=>!i.has(e.id))];return n.every((e,i)=>e===t[i])?e:{points:n}})},subscribe:t=>e.subscribe((e,i)=>{e.points!==i.points&&t()})}},_e.tempReadingsSpec=function(e,t){const i=()=>new Date(Date.now()-6912e7).toISOString();return{name:'temp_readings',table:'temp_readings',mode:'insert',conflict:'venue_id,id',deletes:!1,protect:!0,list:()=>e.getState().entries??[],key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>/^[A-Za-z0-9_.:-]{1,64}$/.test(e.id)&&!!e.pointId&&!!e.at,writable:t,matchKey:e=>({id:e}),revision:c,knownByRevision:!0,filter:e=>e.gte('taken_at',i()),inWindow:e=>e.at>=i(),toRow:(e,t)=>o(e,t),fromRow:e=>r(e),supersededBy:(e,t)=>t.some(t=>t.id!==e.id&&a(t,e)),apply:(t,i)=>e.setState(e=>{const n=new Map(t.map(e=>[e.id,e])),r=new Set(i),o=e.entries??[],c=o.filter(e=>n.has(e.id)||!t.some(t=>t.id!==e.id&&a(t,e))).filter(e=>!r.has(e.id)||!o.some(t=>t.id!==e.id&&!r.has(t.id)&&a(t,e))).map(e=>{const t=n.get(e.id);return t?e.photo?{...t,photo:e.photo}:t:e}),s=new Set(c.map(e=>e.id));return{entries:[...t.filter(e=>!s.has(e.id)),...c].sort((e,t)=>t.at.localeCompare(e.at))}}),subscribe:t=>e.subscribe((e,i)=>{e.entries!==i.entries&&t()})}};var e=_r(d[0]);const t=e=>null==e||''===e?void 0:Number(e);function i(e){const i={id:String(e.id),name:String(e.name),kind:e.kind,due:Array.isArray(e.due)?e.due.map(String):[],aliases:Array.isArray(e.aliases)?e.aliases.map(String):[]},n=t(e.min_c),r=t(e.max_c);return void 0!==n&&(i.min=n),void 0!==r&&(i.max=r),e.section&&(i.section=e.section),e.location&&(i.location=String(e.location)),e.archived&&(i.archived=!0),i}function n(e,t,i){return{venue_id:t,id:e.id,name:e.name.slice(0,80),kind:e.kind,location:e.location?.trim()||null,min_c:e.min??null,max_c:e.max??null,due:e.due??[],aliases:e.aliases??[],section:e.section??null,archived:!!e.archived,sort:i}}function r(e){const i={id:String(e.id),pointId:String(e.point_id),name:String(e.point_name),kind:e.kind,at:new Date(e.taken_at).toISOString(),by:String(e.by_name??''),byId:String(e.by_ref??''),app:e.app??'chef',ok:!!e.ok,source:e.source??'typed'},n=t(e.value);void 0!==n&&(i.value=n),null!==e.done&&void 0!==e.done&&(i.done=!!e.done),e.corrective&&(i.corrective=String(e.corrective)),e.note&&(i.note=String(e.note)),e.initials&&(i.initials=String(e.initials)),e.probe_id&&(i.probeId=String(e.probe_id)),e.archived&&(i.archived=!0);const r=t(e.corrected_value);return void 0!==r&&(i.correctedValue=r),e.correction_note&&(i.correctionNote=String(e.correction_note)),e.corrected_by&&(i.correctedBy=String(e.corrected_by)),i}function o(e,t){return{venue_id:t,id:e.id,point_id:e.pointId,point_name:(e.name||'Check').slice(0,200),kind:e.kind,taken_at:e.at,value:e.value??null,done:e.done??null,ok:!!e.ok,by_name:(e.by??'').slice(0,120),by_ref:e.byId||null,app:e.app??null,source:e.source??null,corrective:e.corrective?.slice(0,1e3)||null,note:e.note?.slice(0,1e3)||null,initials:e.initials||null,probe_id:e.probeId||null}}const a=(e,t)=>e.pointId===t.pointId&&e.at===t.at&&(e.value??null)===(t.value??null)&&(e.done??null)===(t.done??null),c=t=>(0,e.hashOf)(r({...o(t,''),archived:t.archived??!1,corrected_value:t.correctedValue??null,correction_note:t.correctionNote??null,corrected_by:t.correctedBy??null})),s=t=>(0,e.hashOf)(i(n(t,'',0))),l=800},1287,[1166]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.mirrorRecords=o,_e.csToRow=i,_e.csFromRow=r,Object.defineProperty(_e,"csRev",{enumerable:!0,get:function(){return c}}),_e.applyRecords=s,_e.cooksafeSpec=function(t,n,d,a){return{name:'cooksafe_records',table:'cooksafe_records',conflict:'venue_id,id',deletes:!1,protect:!0,list:()=>o(t.getState(),n.getState().records??[],d),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,e.csIdOk)(t.id)&&e.CS_KINDS.includes(t.kind)&&!!t.at,writable:a,matchKey:e=>({id:e}),revision:c,knownByRevision:!0,toRow:(e,t)=>i(e,t),fromRow:e=>r(e),apply:e=>s(e,t,n),subscribe:e=>{const d=t.subscribe((t,n)=>{t.diary===n.diary&&t.daySigns===n.daySigns&&t.weekly===n.weekly&&t.inspectorSends===n.inspectorSends&&t.accidents===n.accidents&&t.entries===n.entries||e()}),o=n.subscribe((t,n)=>{t.records!==n.records&&e()});return()=>{d(),o()}}}};var e=_r(_d[0]),t=_r(_d[1]);const n=e=>`photo-${e}`.slice(0,64),d=e=>JSON.parse(JSON.stringify(e));function o(e,t,o){const i=[...t];for(const t of e.diary??[])i.push({id:t.id,kind:'diary',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.daySigns??[])i.push({id:`day-${t.date}`,kind:'daysign',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.weekly??[])i.push({id:`week-${t.week}`,kind:'weekly',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.inspectorSends??[])i.push({id:t.id,kind:'inspector',at:t.at,by:t.by,byId:t.byId,doc:d(t)});for(const t of e.accidents??[])o(t)||i.push({id:t.id,kind:'accident',at:t.createdAt,by:t.reportedBy,byId:t.reportedById,doc:d(t)});for(const t of e.entries??[])t.photo&&i.push({id:n(t.id),kind:'photo',at:t.at,by:t.by,byId:t.byId,doc:{entryId:t.id,photo:t.photo}});return i}function i(e,t){return{venue_id:t,id:e.id,kind:e.kind,at:e.at,by_name:(e.by??'').slice(0,120),doc:{...e.doc,...e.byId?{_byId:e.byId}:{}},archived:!!e.archived}}function r(t){if(!e.CS_KINDS.includes(t.kind))return null;const n={...t.doc??{}},d=n._byId?String(n._byId):void 0;delete n._byId;const o={id:String(t.id),kind:t.kind,at:new Date(t.at).toISOString(),by:String(t.by_name??''),doc:n};return d&&(o.byId=d),t.archived&&(o.archived=!0),o}const c=e=>(0,t.hashOf)(r({...i(e,''),at:e.at}));function s(t,n,d){if(!t.length)return;const o=t.filter(t=>e.CS_OWN.includes(t.kind));o.length&&d.setState(e=>{const t=new Map(o.map(e=>[e.id,e])),n=e.records.map(e=>t.get(e.id)??e),d=new Set(n.map(e=>e.id));return{records:[...o.filter(e=>!d.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at))}});const i=e=>t.filter(t=>t.kind===e).map(e=>e.doc),r=(e,t,n,d=!0)=>{if(!t.length)return e??[];const o=new Map(t.map(e=>[n(e),e])),i=(e??[]).map(e=>o.get(n(e))??e),r=new Set(i.map(n)),c=[...t.filter(e=>!r.has(n(e))),...i];return d?c:c.reverse()},c=t.filter(e=>'photo'===e.kind);n.setState(e=>{const t={},n=i('diary');n.length&&(t.diary=r(e.diary,n,e=>e.id).sort((e,t)=>t.at.localeCompare(e.at)));const d=i('daysign');d.length&&(t.daySigns=r(e.daySigns,d,e=>e.date));const o=i('weekly');o.length&&(t.weekly=r(e.weekly,o,e=>e.week).sort((e,t)=>t.at.localeCompare(e.at)));const s=i('inspector');s.length&&(t.inspectorSends=r(e.inspectorSends,s,e=>e.id).sort((e,t)=>t.at.localeCompare(e.at)));const a=i('accident');if(a.length&&(t.accidents=r(e.accidents,a,e=>e.id).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))),c.length){const n=new Map(c.map(e=>[String(e.doc.entryId),String(e.doc.photo??'')]));let d=!1;const o=(e.entries??[]).map(e=>{const t=n.get(e.id);return t&&e.photo!==t?(d=!0,{...e,photo:t}):e});d&&(t.entries=o)}return t})}},1288,[1289,1166]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CS_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"CS_PRIVATE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CS_OWN",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"csIdOk",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"csId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CS_SECTION_LABEL",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"REHEAT_MIN_C",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"reheatOk",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"ICE_RANGE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"BOIL_RANGE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"iceOk",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"boilOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"calibrationOk",{enumerable:!0,get:function(){return b}}),e.offsiteOk=function(t,n){return!!Number.isFinite(n)&&('chilled'===t?n<=8:'frozen'===t?n<=-15:n>=63)},e.deliveryOk=function(t,n){return'ambient'===t||!(null===n||!Number.isFinite(n))&&('chilled'===t?n<=8:n<=-15)},Object.defineProperty(e,"tempWords",{enumerable:!0,get:function(){return y}}),e.calibrationDue=function(t,n){const r=k(t,'calibration');return!r||n.getTime()-new Date(r).getTime()>26784e5},e.reviewDue=function(t,n){const r=k(t,'review');return!r||n.getTime()-new Date(r).getTime()>157248e5},Object.defineProperty(e,"REVIEW_QUESTIONS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"EXCLUSION_HOURS",{enumerable:!0,get:function(){return v}}),e.returnFrom=C,e.mayReturn=function(t,n){return!!t&&n.getTime()>=C(t).getTime()},Object.defineProperty(e,"HOUSE_RULES",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"FLOW_STEPS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"CLEANING_DEFAULT",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"FREQ_LABEL",{enumerable:!0,get:function(){return x}}),e.cleaningDue=function(t,n,r){const i=t=>{const n=new Date(t);return Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())},o=i(r.toISOString());return t.filter(t=>{const r=n.filter(n=>'cleaning'===n.kind&&!n.archived&&n.doc.taskId===t.id).map(t=>t.at).sort().pop();return!r||(o-i(r))/w>=P[t.freq]})},e.allergenMatrix=function(n){const r=n.filter(t=>!!t.signOff);return{rows:r.map(n=>({id:n.id,dish:n.dish,section:n.section??'',cells:t.ALLERGENS.map(t=>n.allergens?.[t.id]??'')})).sort((t,n)=>t.section.localeCompare(n.section)||t.dish.localeCompare(n.dish)),left:n.length-r.length}},Object.defineProperty(e,"MATRIX_HEAD",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"matrixCell",{enumerable:!0,get:function(){return D}}),e.matrixSpoken=function(n){const r=t.ALLERGENS.filter((t,r)=>'contains'===n.cells[r]).map(t=>t.short),i=t.ALLERGENS.filter((t,r)=>'may'===n.cells[r]).map(t=>t.short);return`${n.dish}: ${r.length?`contains ${r.join(', ')}`:'none of the 14 allergens'}${i.length?`; may contain ${i.join(', ')}`:''}.`},Object.defineProperty(e,"CS_KIND_LABEL",{enumerable:!0,get:function(){return A}}),e.recordSummary=_,e.csCsv=function(t){return['Date and time,Record,By,Details',...t.filter(t=>i.includes(t.kind)&&!t.archived).sort((t,n)=>t.at.localeCompare(n.at)).map(t=>[new Date(t.at).toLocaleString('en-GB'),A[t.kind],t.by,_(t)].map(N).join(','))].join('\n')};var t=_r(_d[0]);const n=['diary','daysign','weekly','inspector','accident','photo','reheat','calibration','review','offsite','delivery','training','exclusion','houserule','cleaning','pest','maintenance'],r=['accident','training','exclusion'],i=['reheat','calibration','review','offsite','delivery','training','exclusion','houserule','cleaning','pest','maintenance'],o=t=>/^[A-Za-z0-9_.:-]{1,64}$/.test(t);let a=0;const l=t=>`cs-${t.slice(0,6)}-${Date.now().toString(36)}${(a++).toString(36)}`,s={cross:'Cross-contamination & allergens',cleaning:'Cleaning',chilling:'Chilled storage & cooling',cooking:'Cooking, reheating & hot holding',management:'Management & records'},c=82,d=t=>Number.isFinite(t)&&t>=c,u=[-1,1],f=[99,101],h=t=>Number.isFinite(t)&&t>=u[0]&&t<=u[1],p=t=>Number.isFinite(t)&&t>=f[0]&&t<=f[1],b=(t,n)=>h(t)&&p(n);const y=t=>`${t<0?'minus ':''}${Math.abs(t)} degrees`,w=864e5,k=(t,n)=>t.filter(t=>t.kind===n&&!t.archived).map(t=>t.at).sort().pop()??null;const $=['New dishes, suppliers or equipment are covered by the CookSafe safe methods','Critical limits (cooking 75\xb0C, reheating 82\xb0C, chilling 8\xb0C or below, hot holding 63\xb0C or above) still right','Records were kept every day, with corrective actions written down','Every member of the team has training and induction records','House Rules read and still followed','Allergen information matches the signed-off recipe cards'],v=48;function C(t){return new Date(new Date(t).getTime()+1728e5)}const O=[{id:'hr-personal',title:'Personal hygiene',text:'Clean work clothes and aprons; hair tied back and covered; no jewellery except a plain band; cuts covered with a blue waterproof dressing; no smoking, eating or vaping in food areas.'},{id:'hr-fitness',title:'Fitness to work',text:'Anyone with sickness, diarrhoea, skin infections or infected cuts tells the person in charge before starting work. Food handlers with sickness or diarrhoea stay off until 48 hours after the symptoms stop.'},{id:'hr-hands',title:'Handwashing',text:'Wash hands with soap and warm water and dry with paper towels: before handling food, after raw food, after breaks, the toilet, bins, cleaning and touching face or phone.'},{id:'hr-cross',title:'Cross-contamination',text:'Raw and ready-to-eat food kept apart in storage, preparation and display; separate colour-coded boards, knives and equipment; raw meat on the bottom shelf; separate complex equipment for raw and ready-to-eat food.'},{id:'hr-allergens',title:'Allergen management',text:'Allergen information comes only from signed-off recipe cards; any change to a recipe or supplier is checked before serving; orders with an allergy are made separately with clean equipment.'},{id:'hr-cleaning',title:'Cleaning',text:'Clean as you go; follow the cleaning schedule; use the right chemical at the right dilution and contact time; food contact surfaces disinfected with a product meeting BS EN 1276 or 13697.'},{id:'hr-pests',title:'Pest control',text:'Doors and windows proofed or screened; food stored off the floor and covered; any sign of pests reported straight away and written in the pest control log.'},{id:'hr-maintenance',title:'Maintenance',text:'Equipment, fridges and the building kept in good repair; faults reported, written in the maintenance log and fixed before the equipment is used for food.'},{id:'hr-waste',title:'Waste management',text:'Bins lidded and emptied regularly; waste never left in food rooms overnight; outside bins kept closed and the area clean.'},{id:'hr-stock',title:'Stock control',text:'Deliveries checked and put away straight away; first in, first out; food labelled and dated; nothing used past its use-by date.'},{id:'hr-water',title:'Water supply',text:'Mains drinking water used for food, ice and cleaning; ice machines cleaned to the schedule.'},{id:'hr-physical',title:'Physical and chemical contamination',text:'No glass in food areas where avoidable; breakages cleared and recorded; chemicals stored away from food and clearly labelled.'},{id:'hr-training',title:'Training and supervision',text:'Every food handler has induction before starting and training for their job, recorded in the training records; the person in charge supervises and checks the daily records.'}],S=[{id:'purchase',title:'Purchase',limit:'Approved suppliers only'},{id:'delivery',title:'Delivery',limit:'Chilled 8\xb0C or below \xb7 Frozen \u221215\xb0C or below'},{id:'storage',title:'Storage',limit:'Fridges 5\xb0C or below (8\xb0C legal limit) \xb7 Freezers \u221218\xb0C or below'},{id:'prep',title:'Preparation',limit:'Raw and ready-to-eat kept apart \xb7 Allergens checked'},{id:'cooking',title:'Cooking',limit:'Core 75\xb0C or above'},{id:'cooling',title:'Cooling',limit:'Cooled within 90 minutes, then chilled'},{id:'reheating',title:'Reheating',limit:'Core 82\xb0C or above (Scotland)'},{id:'hothold',title:'Hot holding',limit:'63\xb0C or above'},{id:'service',title:'Service',limit:'Allergen information from signed-off cards'}],E=[{id:'cl-surfaces',task:'Work surfaces and chopping boards',freq:'daily'},{id:'cl-handbasins',task:'Hand-wash basins and taps',freq:'daily'},{id:'cl-floors',task:'Kitchen floors',freq:'daily'},{id:'cl-bins',task:'Bins emptied and cleaned',freq:'daily'},{id:'cl-handles',task:'Door, fridge and freezer handles',freq:'daily'},{id:'cl-fridges',task:'Inside fridges and seals',freq:'weekly'},{id:'cl-ovens',task:'Ovens, grill and fryer',freq:'weekly'},{id:'cl-filters',task:'Extraction canopy filters',freq:'weekly'},{id:'cl-freezers',task:'Freezers defrosted and cleaned',freq:'monthly'},{id:'cl-walls',task:'Walls, shelves and behind equipment',freq:'monthly'}],P={daily:1,weekly:7,monthly:31},x={daily:'Daily',weekly:'Weekly',monthly:'Monthly'};const j=['Dish',...t.ALLERGENS.map(t=>t.short)],D=t=>'contains'===t?'Yes':'may'===t?'May':'';const A={diary:'Diary',daysign:'Daily sign-off',weekly:'Weekly sign-off',inspector:'Sent to inspector',accident:'Accident book',photo:'Check photo',reheat:'Reheating',calibration:'Probe calibration',review:'Six-monthly review',offsite:'Off-site temperature',delivery:'Delivery',training:'Training',exclusion:'Exclusion / return to work',houserule:'House Rule',cleaning:'Cleaning',pest:'Pest control',maintenance:'Maintenance'},N=t=>`"${String(t??'').replace(/"/g,'""')}"`;function _(t){const n=t.doc;switch(t.kind){case'reheat':return`${n.food??''}: ${n.value}\xb0C${n.ok?'':' (below 82\xb0C)'}${n.action?`; action: ${n.action}`:''}`;case'calibration':return`${n.probe??'Probe'}: iced water ${n.ice}\xb0C, boiling ${n.boil}\xb0C${n.ok?'':' (out of range)'}${n.action?`; action: ${n.action}`:''}`;case'offsite':return`${n.food??''} at ${n.place??''}: ${n.value}\xb0C (${n.type})${n.ok?'':' (out of range)'}${n.action?`; action: ${n.action}`:''}`;case'delivery':return`${n.supplier??''}: ${n.items??''}${null!==n.value&&void 0!==n.value?`, ${n.value}\xb0C`:''} (${n.type})${!1===n.accepted?', rejected':''}${n.note?`; ${n.note}`:''}`;case'training':return`${n.person??''}: ${n.course??''}${n.expires?`, renew ${n.expires}`:''}`;case'exclusion':return`${n.person??''}: off from ${n.from??''}${n.stopped?`, symptoms stopped ${n.stopped}`:''}${n.returned?`, back ${n.returned}`:''}`;case'houserule':return`${n.title??''}: ${n.inPlace?'in place':'not ticked'}${n.text?` \u2014 ${n.text}`:''}`;case'cleaning':return`${n.task??''}${n.note?`; ${n.note}`:''}`;case'pest':case'maintenance':return`${n.what??''}${n.action?`; action: ${n.action}`:''}${n.contractor?` (${n.contractor})`:''}`;case'review':return`${n.answers?.filter(Boolean).length??0} of ${$.length} confirmed${n.note?`; ${n.note}`:''}`;default:return String(n.text??n.note??'')}}},1289,[819]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCookSafe",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"SCHEDULE_ID",{enumerable:!0,get:function(){return u}}),_e.scheduleOf=function(e){const r=e.find(e=>e.id===u),t=r?.doc.schedule;return Array.isArray(t)&&t.length?t:n.CLEANING_DEFAULT},Object.defineProperty(_e,"ruleRecordId",{enumerable:!0,get:function(){return l}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},c=_r(d[1]),o=_r(d[2]),n=_r(d[3]);const s=(0,c.create)()((0,o.persist)(e=>({records:[],add:(r,t,c,o,s)=>{const u={id:s??(0,n.csId)(r),kind:r,at:o??(new Date).toISOString(),by:c.by.replace(' (example)',''),byId:c.byId,doc:t};return e(e=>({records:[u,...e.records.filter(e=>e.id!==u.id)]})),u},update:(r,t)=>e(e=>({records:e.records.map(e=>e.id===r?{...e,doc:{...e.doc,...t}}:e)})),archive:r=>e(e=>({records:e.records.map(e=>e.id===r?{...e,archived:!0}:e)}))}),{name:'covercharge-cooksafe-v1',storage:(0,o.createJSONStorage)(()=>t.default),version:1})),u='cs-cleaning-schedule';const l=e=>`houserule-${e}`},1290,[1190,995,1191,1289]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEED_INGREDIENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SEED_RECIPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"WASTE_REASONS",{enumerable:!0,get:function(){return f}}),_e.stripKitchenExamples=S,Object.defineProperty(_e,"useKitchen",{enumerable:!0,get:function(){return w}});var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e},l=_r(_d[6]),p=_r(_d[7]);const c=(e,t,s,i,n,r,o,d=[],l)=>({id:e,name:t,unit:s,cost:i,supplierId:n,par:r,onHand:o,allergens:d,prevCost:l}),u=[c('haddock','Haddock fillet','kg',1848,'sup-1',14,9.5,['fish'],1650),c('smk-haddock','Smoked haddock','kg',1500,'sup-1',4,3.2,['fish']),c('smk-salmon','Smoked salmon','kg',2800,'sup-1',3,1.1,['fish']),c('crab','White and brown crab meat','kg',3800,'sup-1',3,2.4,['crustaceans']),c('mussels','Rope mussels','kg',450,'sup-1',12,0,['molluscs']),c('langoustine','Langoustines','kg',2600,'sup-1',6,4.5,['crustaceans']),c('lobster','Lobster (whole)','each',1800,'sup-1',6,4,['crustaceans']),c('prawns','Prawns (cooked, peeled)','kg',1400,'sup-1',3,2.6,['crustaceans']),c('beef-fillet','Beef fillet','kg',4800,'sup-2',4,2.9),c('steak','Braising steak','kg',1200,'sup-2',8,6.2),c('patty','Burger patty 6 oz','each',160,'sup-2',40,18),c('chicken','Chicken breast','kg',950,'sup-2',10,7.5),c('chorizo','Chorizo','kg',1400,'sup-2',2,1.6,['sulphites']),c('haggis','Haggis','kg',900,'sup-2',4,3.5,['gluten','celery']),c('potatoes','Potatoes (chipping)','kg',90,'sup-3',75,40),c('onions','Onions','kg',110,'sup-3',15,11),c('leaves','Salad leaves','kg',700,'sup-3',3,.8),c('lemons','Lemons','each',25,'sup-3',60,44),c('milk','Whole milk','L',110,'sup-4',20,14,['milk']),c('cream','Double cream','L',380,'sup-4',12,9,['milk']),c('butter','Butter','kg',850,'sup-4',6,4.5,['milk']),c('cheddar','Mature cheddar','kg',900,'sup-4',5,3.8,['milk']),c('parmesan','Parmesan','kg',1800,'sup-4',2,1.4,['milk']),c('eggs','Free-range eggs','each',28,'sup-4',120,90,['eggs']),c('ice-cream','Vanilla ice cream','L',450,'sup-4',10,7,['milk','eggs']),c('flour','Plain flour','kg',90,'sup-5',16,12,['gluten']),c('batter','Beer batter mix','kg',220,'sup-5',12,3.5,['gluten']),c('pastry','Puff pastry','kg',450,'sup-5',6,4.2,['gluten','milk']),c('macaroni','Macaroni','kg',180,'sup-5',6,5,['gluten']),c('penne','Penne','kg',180,'sup-5',6,4.5,['gluten']),c('buns','Brioche buns','each',45,'sup-5',40,30,['gluten','eggs','milk','sesame']),c('baguette','Garlic baguette','each',90,'sup-5',24,16,['gluten','milk']),c('oil','Rapeseed oil (fryer)','L',200,'sup-5',60,32),c('sponge','Sticky toffee sponge (portion)','each',95,'sup-5',30,22,['gluten','eggs','milk']),c('truffle-oil','Truffle oil','L',3e3,'sup-5',1,.6)],k=(e,t,s)=>({dishId:e,yield:t,lines:s.map(([e,t])=>({ing:e,qty:t}))}),h=[k('a-fishsupper','1 portion (220 g fillet)',[['haddock',.22],['batter',.06],['potatoes',.35],['oil',.05],['lemons',1]]),k('a-skink','1 bowl',[['smk-haddock',.08],['potatoes',.1],['milk',.15],['cream',.05],['onions',.03],['butter',.01]]),k('a-salmon','1 plate',[['smk-salmon',.07],['cream',.03],['leaves',.02],['lemons',1]]),k('a-haggis','1 plate',[['haggis',.1],['flour',.02],['eggs',1],['oil',.03]]),k('a-crabcakes','2 cakes',[['crab',.08],['potatoes',.06],['flour',.02],['eggs',1],['leaves',.02]]),k('a-tempura','1 plate',[['haddock',.07],['prawns',.05],['onions',.05],['batter',.06],['oil',.04],['lemons',1]]),k('a-mini-fish-goujons','Fish Goujons & Chips',[['haddock',.1],['potatoes',.2],['batter',.03],['oil',.03]]),k('a-pie','1 pie',[['steak',.22],['pastry',.08],['onions',.05],['potatoes',.3],['oil',.03]]),k('a-chicken','1 plate',[['chicken',.22],['potatoes',.25],['cream',.05],['butter',.02]]),k('a-maccheese','1 bowl',[['macaroni',.12],['cheddar',.08],['milk',.2],['butter',.02],['flour',.015]]),k('a-penne','1 bowl',[['penne',.12],['chicken',.15],['chorizo',.04],['cream',.08],['parmesan',.01]]),k('a-caesar','1 plate',[['chicken',.16],['leaves',.08],['parmesan',.015],['eggs',1],['baguette',.25]]),k('a-moules','1 pot',[['mussels',.5],['cream',.08],['onions',.03],['baguette',.5]]),k('a-fillet','8 oz steak',[['beef-fillet',.227],['potatoes',.35],['onions',.05],['oil',.05],['butter',.02]]),k('a-claymore','1 burger',[['patty',1],['buns',1],['cheddar',.03],['potatoes',.3],['onions',.06],['batter',.03],['oil',.05]]),k('a-langoustines','1 plate',[['langoustine',.35],['butter',.03],['baguette',.5],['leaves',.03],['lemons',1]]),k('a-lobster','1 lobster',[['lobster',1],['butter',.04],['potatoes',.3],['oil',.04],['leaves',.03],['lemons',1]]),k('a-smorgasbord','Serves one',[['langoustine',.3],['mussels',.3],['crab',.08],['prawns',.1],['smk-salmon',.06],['leaves',.05],['lemons',2]]),k('a-deluxe','Serves two',[['lobster',1],['langoustine',.5],['crab',.15],['mussels',.5],['prawns',.15],['smk-salmon',.1],['leaves',.1],['lemons',3],['baguette',1]]),k('a-chips','1 side',[['potatoes',.35],['oil',.05]]),k('a-onionrings','1 side',[['onions',.15],['batter',.06],['oil',.04]]),k('a-garlicbread','1 side',[['baguette',.5],['butter',.02]]),k('a-truffle','1 side',[['potatoes',.35],['oil',.05],['parmesan',.015],['truffle-oil',.005]]),k('a-salad','1 side',[['leaves',.06],['lemons',.5]]),k('a-stp','1 portion',[['sponge',1],['cream',.05],['butter',.02],['ice-cream',.08]])],f=['Out of date','Spoiled','Over-production','Dropped / burnt','Returned by customer','Prep trim'],b=(e,t=10)=>{const s=new Date;return s.setDate(s.getDate()-e),s.setHours(t,0,0,0),s.toISOString()},y=e=>`${e}-${Math.random().toString(36).slice(2,8)}`;function v(){return{ingredients:u.map(e=>({...e})),recipes:h,targetGp:70,deliveries:[{id:'dl-today-fish',supplierId:'sup-1',due:'today',status:'expected',lines:[{ing:'haddock',ordered:10,received:8,price:1848},{ing:'mussels',ordered:12,received:12,price:450},{ing:'langoustine',ordered:3,received:3,price:2750},{ing:'smk-salmon',ordered:2,received:2,price:2800}]},{id:'dl-today-veg',supplierId:'sup-3',due:'today',status:'expected',lines:[{ing:'potatoes',ordered:50,received:50,price:90},{ing:'leaves',ordered:3,received:2,price:700},{ing:'lemons',ordered:30,received:30,price:25}]}],stockTakes:[{id:'stk-1',at:b(7,22),by:'Head Chef (example)',lines:[{ing:'haddock',expected:6,counted:5.4,cost:1650},{ing:'potatoes',expected:30,counted:28,cost:90},{ing:'cream',expected:8,counted:8,cost:380},{ing:'beef-fillet',expected:3.2,counted:3,cost:4800}]}],waste:[{id:'w1',at:b(1,21),by:'Head Chef (example)',item:'Haddock fillet',ing:'haddock',qty:.6,unit:'kg',reason:'Over-production',cost:1109},{id:'w2',at:b(2,15),by:'Head Chef (example)',item:'Salad leaves',ing:'leaves',qty:.5,unit:'kg',reason:'Spoiled',cost:350},{id:'w3',at:b(3,20),by:'Head Chef (example)',item:'Fish supper',qty:1,unit:'portion',reason:'Dropped / burnt',cost:517},{id:'w4',at:b(4,11),by:'Head Chef (example)',item:'Double cream',ing:'cream',qty:1,unit:'L',reason:'Out of date',cost:380},{id:'w5',at:b(5,22),by:'Head Chef (example)',item:'Chips',ing:'potatoes',qty:3,unit:'kg',reason:'Over-production',cost:270}],orders:[{id:'po-1',supplierId:'sup-1',at:b(1,13),by:'Head Chef (example)',status:'placed (by phone)',lines:[{ing:'haddock',qty:10,cost:1848},{ing:'mussels',qty:12,cost:450},{ing:'langoustine',qty:3,cost:2600},{ing:'smk-salmon',qty:2,cost:2800}],total:30520},{id:'po-2',supplierId:'sup-3',at:b(1,18),by:'Head Chef (example)',status:'placed (on website)',lines:[{ing:'potatoes',qty:50,cost:90},{ing:'leaves',qty:3,cost:700},{ing:'lemons',qty:30,cost:25}],total:7350}],prepTicks:{},temps:[{id:'t1',at:b(0,9),by:'Head Chef (example)',kind:'fridge',unit:'Walk-in fridge',temp:3},{id:'t2',at:b(0,9),by:'Head Chef (example)',kind:'freezer',unit:'Chest freezer',temp:-20}]}}function S(e){const t=v(),s=(e,t)=>t.some(t=>JSON.stringify(t)===JSON.stringify(e)),i=e.recipes.filter(e=>!s(e,t.recipes)),r=e.deliveries.filter(e=>!t.deliveries.some(t=>t.id===e.id&&t.supplierId===e.supplierId&&t.due===e.due&&'expected'===e.status&&!e.checkedBy&&!e.note&&JSON.stringify(t.lines)===JSON.stringify(e.lines))),o=e.stockTakes.filter(e=>!(0,n.demoActor)(e.by)),d=e.waste.filter(e=>!(0,n.demoActor)(e.by)),l=e.orders.filter(e=>!(0,n.demoActor)(e.by)),p=e.temps.filter(e=>!(0,n.demoActor)(e.by)),c=new Set([...i,...r,...o,...l].flatMap(e=>e.lines.map(e=>e.ing)));return d.forEach(e=>{e.ing&&c.add(e.ing)}),{ingredients:e.ingredients.filter(e=>c.has(e.id)||!s(e,t.ingredients)),recipes:i,deliveries:r,stockTakes:o,waste:d,orders:l,temps:p}}const w=(0,l.create)()((0,p.persist)(e=>({...r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v(),setTarget:t=>e({targetGp:Math.max(40,Math.min(90,Math.round(t)))}),setIngredient:(t,s)=>e(e=>({ingredients:e.ingredients.map(e=>e.id===t?{...e,...s}:e)})),setRecipeQty:(t,s,i)=>e(e=>({recipes:e.recipes.map(e=>e.dishId!==t?e:{...e,lines:i>0?e.lines.some(e=>e.ing===s)?e.lines.map(e=>e.ing===s?{...e,qty:i}:e):[...e.lines,{ing:s,qty:i}]:e.lines.filter(e=>e.ing!==s)})})),acceptDelivery:(t,i,n,o)=>e(e=>({deliveries:e.deliveries.map(e=>e.id===t?{...e,lines:i,status:'accepted',checkedBy:n,at:(new Date).toISOString(),note:o}:e),ingredients:e.ingredients.map(e=>{const t=i.find(t=>t.ing===e.id);return t?{...e,onHand:(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand+t.received:Math.round(100*(e.onHand+t.received))/100,...t.price!==e.cost?{prevCost:e.cost,cost:t.price}:{}}:e})})),saveStockTake:(t,s)=>e(e=>({stockTakes:[{id:y('stk'),at:(new Date).toISOString(),by:s,lines:Object.entries(t).map(([t,s])=>{const i=e.ingredients.find(e=>e.id===t);return{ing:t,expected:i.onHand,counted:s,cost:i.cost}})},...e.stockTakes],ingredients:e.ingredients.map(e=>e.id in t?{...e,onHand:t[e.id]}:e)})),addWaste:t=>e(e=>({waste:[{...t,id:y('w'),at:(new Date).toISOString()},...e.waste],ingredients:t.ing?e.ingredients.map(e=>e.id===t.ing?{...e,onHand:Math.max(0,(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand-t.qty:Math.round(100*(e.onHand-t.qty))/100)}:e):e.ingredients})),addOrder:t=>{const s=y('po');return e(e=>({orders:[{...t,id:s,at:(new Date).toISOString()},...e.orders]})),s},setOrderStatus:(t,s)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,status:s}:e)})),tickPrep:(t,s)=>e(e=>{const i={...e.prepTicks};return s?i[t]={by:s,at:(new Date).toISOString()}:delete i[t],{prepTicks:i}}),addTemp:t=>e(e=>({temps:[{...t,id:y('t'),at:(new Date).toISOString()},...e.temps]})),reset:()=>e(r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v())}),{name:'covercharge-kitchen-v1',version:3,storage:(0,p.createJSONStorage)(()=>d.default),migrate:async e=>{const s=e;return t.LIVE_VENUE_BUILD?(await(0,i.archiveChefCache)('kitchen',s),{...s,...S(s)}):s}}))},1291,[842,1085,1198,1084,5,1190,995,1191]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fixSupplierNames=function(b){return b?s.reduce((s,[b,n])=>s.replace(b,n),b):b};const s=[[/\bAl{2}sons?'?s?\b|\bAlson's\b/g,'Alsons'],[/\bSpe[zs] ?[Bb]ona\b|\bSpezbona\b/g,'Spes Bona'],[/\bReeds\b/gi,'Reids']]},1292,[]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_ORDER_LIST_SETTINGS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"UNITS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY_FULL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"normName",{enumerable:!0,get:function(){return a}}),e.findDuplicate=function(t,n,i,s){return t.find(t=>t.listId===n&&!t.removed&&'open'===t.status&&a(t.name)===a(i)&&u(t.unit)===u(s))},e.bumpQty=function(t,n,i,a,u){return{...t,qty:Math.round(100*(t.qty+n))/100,bumps:[...t.bumps??[],{by:i,name:a,qty:n,at:u}],updatedAt:u}},Object.defineProperty(e,"qtyText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"validQty",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"liveItems",{enumerable:!0,get:function(){return d}}),e.finishOrder=function(t,n,i,a,u,s){const o=d(n,t.id),l=o.filter(t=>'got'!==t.status),c={id:s(),listId:t.id,listName:t.name,finishedAt:u,finishedBy:a.id,finishedByName:a.name,items:o.map(t=>({name:t.name,qty:t.qty,unit:t.unit,note:t.note,status:t.status,addedByName:t.addedByName})),carried:i?l.length:0},p=i?l.map(t=>({...t,status:'open',carried:'missing'===t.status?'missing':'not-got',statusBy:void 0,statusAt:void 0,updatedAt:u})):[],m=new Set(p.map(t=>t.id));return{round:c,drop:o.filter(t=>!m.has(t.id)).map(t=>t.id),carriedOver:p}},e.nextTripDate=p,e.tripText=function(t,n,a){const u=p(t,n,a);if(!u)return'Running list';const[,s,o]=u.split('-').map(Number);return"Next trip "+(u===n?'today':u===l(n,1)?'tomorrow':`${i[c(u)]} ${o} ${['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][s-1]}`)},e.initials=function(t){const n=t.replace(/\(.*?\)/g,' ').split(/[^A-Za-z0-9]+/).filter(t=>t&&!['and','the','of','&'].includes(t.toLowerCase()));return n.length?(1===n.length?n[0].slice(0,2):n[0][0]+n[1][0]).toUpperCase():'?'},e.telHref=function(t){if(!t)return null;const n=t.trim().replace(/[^\d+]/g,'').replace(/(?!^)\+/g,'');return n.replace(/\D/g,'').length>=6?`tel:${n}`:null};const t={allowStaff:!0,defaultTripDay:5},n=['','cases','bottles','kegs','boxes','bags','packs','kg','litres','each'],i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],a=t=>t.trim().toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').replace(/s$/,''),u=t=>t.trim().toLowerCase().replace(/s$/,'');const s=t=>`${Number.isInteger(t.qty)?t.qty:t.qty.toFixed(2).replace(/0$/,'')}${t.unit?` ${t.unit}`:''}`,o=t=>Number.isFinite(t)&&t>0&&t<=9999,d=(t,n)=>t.filter(t=>t.listId===n&&!t.removed).sort((t,n)=>('open'===t.status?0:1)-('open'===n.status?0:1)||t.addedAt.localeCompare(n.addedAt));const l=(t,n)=>{const[i,a,u]=t.split('-').map(Number);return new Date(Date.UTC(i,a-1,u+n)).toISOString().slice(0,10)},c=t=>{const[n,i,a]=t.split('-').map(Number);return new Date(Date.UTC(n,i-1,a)).getUTCDay()};function p(n,i,a=t.defaultTripDay){if('trip'!==n.kind)return null;if(n.nextTrip&&n.nextTrip>=i)return n.nextTrip;const u=n.tripDay??a;return l(i,(u-c(i)+7)%7)}},1293,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useClockArea",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"areaOf",{enumerable:!0,get:function(){return _}});var e,t=r(d[0]),n=r(d[1]),s=r(d[2]),u=(e=s)&&e.__esModule?e:{default:e},c=r(d[3]),l=r(d[4]),E=r(d[5]);const o=(0,c.create)()((0,l.persist)(e=>({areas:(0,n.privateClockVenue)(t.VENUE_RID)?{[t.VENUE_RID]:(0,n.venueClockArea)(t.VENUE_RID)}:{},visiting:{},set:(s,u,c)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{...e.areas[s]??{},...u}),updatedAt:(new Date).toISOString(),updatedBy:c}}}),reset:(s,u)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{lat:e.areas[s]?.lat??null,lng:e.areas[s]?.lng??null}),updatedAt:(new Date).toISOString(),updatedBy:u}}}),setVisiting:t=>e(e=>({visiting:Object.fromEntries([...Object.entries(e.visiting).slice(-60),[t,!0]])}))}),{name:'covercharge-clock-area-v1',version:1,storage:(0,l.createJSONStorage)(()=>u.default)})),_=e=>t.IS_ISOLATED_VENUE&&e!==t.VENUE_RID?(0,E.cleanArea)(E.DEFAULT_CLOCK_AREA):(0,n.venueClockArea)(e,o.getState().areas[e]??{})},1294,[5,869,1190,995,1191,870]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteStatus=function(){return{'st-tracy':{state:'used',usedAt:s(3e3),devices:2},'st-gordon':{state:'used',usedAt:s(2940),devices:2},'st-bisto':{state:'used',usedAt:s(1800),devices:1},'st-agate':{state:'used',usedAt:s(1680),devices:1},'st-lenny':{state:'used',usedAt:s(1560),devices:1},'st-finn':{state:'unused',expiresAt:n(52),devices:0},'st-eilidh':{state:'used',usedAt:s(1200),devices:1},'st-emily':{state:'expired',devices:0},'st-lillie':{state:'used',usedAt:s(480),devices:1},'st-jack':{state:'unused',expiresAt:n(70),devices:0}}},e.linkPhones=async function(){return{...a}},e.resetPhone=async function(t){const s=a[t]?.phones??0;return delete a[t],s},e.reissueInvite=async function(t){const s='st-bisto'===t?'chef':['st-tracy','st-gordon','st-agate'].includes(t)?'owner':'staff';return{ok:!0,token:'DEMO-link-not-real-0000',expiresAt:n(72),app:s}},e.unlockCashUp=async function(s,n,a){const c=new Date(Date.now()+18e5).toISOString();'cashup'===s?t.useCashUp.setState(t=>({cashUps:t.cashUps.map(t=>t.id===n?{...t,unlockedUntil:c}:t)})):t.useCashUp.setState(t=>({sales:t.sales.map(t=>t.id===n?{...t,unlockedUntil:c}:t)}));return{ok:!0,until:c}},e.cashAudit=async function(t){return[{at:s(780),action:'unlocked',by:'Morgan',tbl:'cash_ups',reason:'Card total keyed as 1,284 not 1,248',changed:[]},{at:s(768),action:'changed',by:'Alex',tbl:'cash_ups',changed:['card']},{at:s(840),action:'created',by:'Alex',tbl:'cash_ups',changed:[]}]},e.pitchRpc=function(t,s){switch(t){case'list_displays':return c;case'create_display_code':case'new_code_for_display':return[{code:'DEMO7K2QX',expires_at:n(24*Number(s.p_hours?Number(s.p_hours)/24:7))}];default:return[]}};var t=r(d[0]);const s=t=>new Date(Date.now()-6e4*t).toISOString(),n=t=>new Date(Date.now()+36e5*t).toISOString();const a={'st-tracy':{phones:1,since:s(4445)},'st-bisto':{phones:1,since:s(2920)},'st-agate':{phones:1,since:s(1680)},'st-lenny':{phones:1,since:s(1560)},'st-eilidh':{phones:1,since:s(1200)}};const c=[{id:'pd-1',label:'Front desk tablet',can_write:!0,created_at:s(17280),last_seen_at:s(2),revoked_at:null,sessions:1,open_codes:0},{id:'pd-2',label:'Kitchen pass tablet',can_write:!1,created_at:s(12960),last_seen_at:s(5),revoked_at:null,sessions:1,open_codes:0}]},1295,[1048]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useChatSync",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"chatSynced",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({synced:!1,checked:!1})),n=()=>t.getState().synced},1296,[995]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestSpecialsAfter=function(t,n){return n.ok?n.board?t&&t.postedAt>n.board.postedAt?{board:t,note:''}:{board:n.board,note:''}:{board:null,note:''}:{board:t,note:n.message}},Object.defineProperty(e,"GUEST_SPECIALS_OFFLINE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SUPPORT_NOT_SENT",{enumerable:!0,get:function(){return n}}),e.supportAfterWrite=function(t,o){return t.trim()?o.ok?{text:t,sent:!0,note:''}:{text:t,sent:!1,note:o.message||n}:{text:t,sent:!1,note:''}};const t='The specials board could not be loaded. What is already on this phone is unchanged.',n='Saved on this phone. It was not sent.'},1297,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1298,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get Badge(){return x.Badge},get DarkTheme(){return y.DarkTheme},get DefaultTheme(){return _.DefaultTheme},get ErrorBoundary(){return v.ErrorBoundary},get ExperimentalStack(){return U.ExperimentalStack},get ExpoRoot(){return c.ExpoRoot},get Icon(){return x.Icon},get IsWithinNativeNavigator(){return B.IsWithinNativeNavigator},get Label(){return x.Label},get LocaleProvider(){return I.LocaleProvider},get NativeStackView(){return E.NativeStackView},get NavigationAwareActivity(){return R.NavigationAwareActivity},get Navigator(){return t.Navigator},get RouterActionHandling(){return C.RouterActionHandling},get Sitemap(){return b.Sitemap},get Slot(){return t.Slot},get SplashScreen(){return S},get StackRouter(){return C.StackRouter},get SuspenseFallback(){return f.SuspenseFallback},get TabRouter(){return C.TabRouter},get Tabs(){return M.Tabs},get ThemeProvider(){return T.ThemeProvider},get Unmatched(){return l.Unmatched},get VectorIcon(){return x.VectorIcon},get attachRouteState(){return C.attachRouteState},get createBaseStackProps(){return j.createBaseStackProps},get createBaseTabProps(){return D.createBaseTabProps},get createNativeStackProps(){return W.createNativeStackProps},get createStandardRouterNavigator(){return B.createStandardRouterNavigator},get enableLegacyHeaderAppearance(){return F.enableLegacyHeaderAppearance},get extendRouter(){return C.extendRouter},get extendRouterActions(){return C.extendRouterActions},get integrateWithRouter(){return B.integrateWithRouter},get isActionHandled(){return C.isActionHandled},get router(){return u.router},get unstable_PerformanceObserver(){return G.unstable_PerformanceObserver},get unstable_createStandardRouterNavigator(){return B.unstable_createStandardRouterNavigator},get unstable_enablePerformanceIntegration(){return G.unstable_enablePerformanceIntegration},get unstable_integrateWithRouter(){return B.unstable_integrateWithRouter},get unstable_performance(){return G.unstable_performance},get unstable_useIsNavigating(){return o.useIsNavigating},get unstable_useReconcileTabHistory(){return H.useReconcileTabHistory},get useCanGoBack(){return n.useCanGoBack},get useCurrentRouteInfo(){return n.useCurrentRouteInfo},get useFocusEffect(){return h.useFocusEffect},get useGlobalSearchParams(){return n.useGlobalSearchParams},get useIsFocused(){return N.useIsFocused},get useLoaderData(){return n.useLoaderData},get useLocalSearchParams(){return n.useLocalSearchParams},get useNavigation(){return P.useNavigation},get useNavigationContainerRef(){return n.useNavigationContainerRef},get usePathname(){return n.usePathname},get usePreventRemove(){return L.usePreventRemove},get useRootNavigation(){return n.useRootNavigation},get useRootNavigationState(){return n.useRootNavigationState},get useRoute(){return A.useRoute},get useRoutePath(){return O.useRoutePath},get useRouter(){return n.useRouter},get useScrollToTop(){return w.useScrollToTop},get useSegments(){return n.useSegments},get useSitemap(){return p.useSitemap},get useTheme(){return k.useTheme},get useUnstableGlobalHref(){return n.useUnstableGlobalHref},get withLayoutContext(){return s.withLayoutContext}});const t=r(d[0]),n=r(d[1]),u=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),l=r(d[6]),b=r(d[7]),p=r(d[8]),v=r(d[9]),f=r(d[10]),R=r(d[11]),S=q(r(d[12])),P=r(d[13]),h=r(d[14]),N=r(d[15]),y=r(d[16]),_=r(d[17]),T=r(d[18]),k=r(d[19]),I=r(d[20]),O=r(d[21]),w=r(d[22]),A=r(d[23]),L=r(d[24]),x=r(d[25]),B=r(d[26]),H=r(d[27]),j=r(d[28]),D=r(d[29]),W=r(d[30]),C=r(d[31]),E=r(d[32]),F=r(d[33]),G=r(d[34]),M=r(d[35]),U=r(d[36]);function V(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(V=function(t){return t?u:n})(t)}function q(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=V(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=s?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(o,c,l):o[c]=t[c]}return o.default=t,u&&u.set(t,o),o}},1299,[695,420,513,1300,713,33,767,758,761,1301,665,663,668,534,538,543,482,484,448,449,1302,489,490,479,477,525,712,658,726,1303,725,359,704,709,379,1304,1307]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useIsNavigating",{enumerable:!0,get:function(){return u}});const t=r(d[1]);function u(){return(0,n().use)(t.NavigationPendingContext)}},1300,[31,376]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}function n(){const t=r(d[2]);return n=function(){return t},t}function l(){const t=r(d[3]);return l=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ErrorBoundary",{enumerable:!0,get:function(){return f}});r(d[4]);const s=r(d[5]),c=r(d[6]),u=r(d[7]);function h({error:o}){return(0,t().jsxs)(n().View,{style:{marginBottom:12,gap:4,flexWrap:'wrap'},children:[(0,t().jsx)(n().Text,{role:"heading","aria-level":1,style:y.title,children:"Something went wrong"}),(0,t().jsxs)(n().Text,{testID:"router_error_message",role:"heading","aria-level":2,style:y.errorMessage,children:["Error: ",o.message]})]})}function f({error:f,retry:x}){const w=(0,o().use)(s.BottomTabBarHeightContext)?n().View:l().SafeAreaView,S=f instanceof c.ReactServerError;return(0,t().jsx)(n().View,{style:y.container,children:(0,t().jsxs)(w,{style:{flex:1,gap:8,maxWidth:720,marginHorizontal:'auto'},children:[S?(0,t().jsx)(b,{error:f}):(0,t().jsx)(h,{error:f}),(0,t().jsx)(n().View,{style:{flex:1}}),!1,(0,t().jsx)(u.Pressable,{testID:"router_error_retry",onPress:x,children:({hovered:o,pressed:l})=>(0,t().jsx)(n().View,{style:[y.buttonInner,(o||l)&&{backgroundColor:'white'}],children:(0,t().jsx)(n().Text,{style:[y.buttonText,{color:o||l?'black':'white'}],children:"Retry"})})})]})})}const x={404:'NOT_FOUND',500:'INTERNAL_SERVER_ERROR',503:'SERVICE_UNAVAILABLE',504:'GATEWAY_TIMEOUT'};function b({error:o}){let l=String(o.statusCode);l+=': '+(x[o.statusCode]??'Server Error');const s=o.headers.get('cf-ray'),c=o.headers.get('Date');return(0,t().jsxs)(n().View,{style:{padding:12,gap:8},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:n().Platform.select({web:24,default:16}),fontWeight:'bold',marginBottom:4,color:'white'},children:l}),(0,t().jsx)(n().ScrollView,{style:{borderColor:'rgba(255,255,255,0.5)',borderTopWidth:n().StyleSheet.hairlineWidth,borderBottomWidth:n().StyleSheet.hairlineWidth,maxHeight:150},contentContainerStyle:{paddingVertical:4},children:(0,t().jsx)(n().Text,{testID:"router_error_message",selectable:!0,allowFontScaling:!0,style:{color:'white'},children:o.message})}),(0,t().jsx)(w,{title:"Code",right:o.statusCode}),s&&(0,t().jsx)(w,{title:"ID",right:s}),c&&(0,t().jsx)(w,{title:"Date",right:c}),o.url&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:14,opacity:.5,color:'white'},children:o.url})]})}function w({title:o,right:l}){const s={fontSize:16,color:'white'};return(0,t().jsxs)(n().View,{style:{flexDirection:'row',justifyContent:'space-between'},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:s,children:o}),l&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:[s,y.code],children:l})]})}const y=n().StyleSheet.create({container:{flex:1,backgroundColor:'black',padding:24,alignItems:'stretch',justifyContent:'center'},title:{color:'white',fontSize:n().Platform.select({web:32,default:24}),fontWeight:'bold'},buttonText:{fontSize:18,fontWeight:'bold',color:'black',...n().Platform.select({web:{transitionDuration:'100ms'}})},buttonInner:{...n().Platform.select({web:{transitionDuration:'100ms'}}),paddingVertical:12,paddingHorizontal:24,borderColor:'white',borderWidth:2,marginLeft:8,justifyContent:'center',alignItems:'center'},code:{fontFamily:n().Platform.select({default:'Courier',ios:'Courier New',android:'monospace'}),fontWeight:'500'},errorMessage:{color:'white',fontSize:16},subtitle:{color:'white',fontSize:14,marginBottom:12},link:{color:'rgba(255,255,255,0.4)',textDecorationStyle:'solid',textDecorationLine:'underline',fontSize:14,textAlign:'center'}})},1301,[25,31,34,290,509,546,667,760]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LocaleProvider",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o({direction:o,children:c}){return(0,n().jsx)(t.LocaleDirContext.Provider,{value:o,children:c})}},1302,[25,430]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({dispatch:t,isPreloaded:o,isRemovalPrevented:n,state:s}){return{isPreloaded:o,isRemovalPrevented:n,routeNames:s.routeNames,preload:o=>t({type:'PRELOAD',payload:{name:o}})}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createBaseTabProps",{enumerable:!0,get:function(){return t}})},1303,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get BottomTabBar(){return n.BottomTabBar},get BottomTabBarHeightCallbackContext(){return n.BottomTabBarHeightCallbackContext},get BottomTabBarHeightContext(){return n.BottomTabBarHeightContext},get BottomTabView(){return n.BottomTabView},get SceneStyleInterpolators(){return u},get Tabs(){return n.default},get TransitionPresets(){return c},get TransitionSpecs(){return f},get createJSTabsProps(){return n.createJSTabsProps},get createStandardBottomTabNavigator(){return n.createStandardBottomTabNavigator},get default(){return s},get useBottomTabBarHeight(){return n.useBottomTabBarHeight}});const t=r(d[0]),o=r(d[1]),n=b(r(d[2])),u=b(r(d[3])),c=b(r(d[4])),f=b(r(d[5]));function l(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,n=new WeakMap;return(l=function(t){return t?n:o})(t)}function b(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=l(o);if(n&&n.has(t))return n.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var b=c?Object.getOwnPropertyDescriptor(t,f):null;b&&(b.get||b.set)?Object.defineProperty(u,f,b):u[f]=t[f]}return u.default=t,n&&n.set(t,u),u}n.default.Screen=o.Screen,n.default.Protected=t.Protected;const s=n.default},1304,[719,720,1305,547,548,549]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get createJSTabsProps(){return h},get default(){return y}});const o=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),f=r(d[7]);var l,b;function h(t){const{dispatch:n,state:o}=t;return{...(0,f.createBaseTabProps)(t),popNestedStackToTop:t=>{const s=o.routes.find(n=>n.key===t)?.state;s?.key&&n({...c.StackActions.popToTop(),target:s.key})}}}l=r(d[8]),b=e,Object.keys(l).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(b,t)||Object.defineProperty(b,t,{enumerable:!0,get:function(){return l[t]}})});const y=(0,u.integrateWithRouter)(s.createStandardBottomTabNavigator,c.TabRouter,{activityDefaultThreshold:1,processDescriptors:p.appendMissingPlaceholderTabDescriptors,processState:p.appendMissingPlaceholderTabRoutes,createProps:h,processScreens:s=>s.map(s=>{if('function'!=typeof s.options&&void 0!==s.options?.href){const{href:c,...u}=s.options;if(u.tabBarButton)throw new Error('Cannot use `href` and `tabBarButton` together.');return null===c?{...s,options:{...u,hidden:!0}}:{...s,options:{...u,tabBarButton:s=>{const u='web'===n().Platform.OS?s.children:(0,t().jsx)(n().Pressable,{children:s.children});return(0,t().jsx)(o.Link,{...s,style:[{display:'flex'},s.style],href:c,asChild:'web'!==n().Platform.OS,children:u})}}}}return s})})},1305,[25,34,509,653,428,712,1306,1303,546]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){const s=n.routeNames.filter(t=>!n.routes.some(n=>n.name===t));if(0===s.length)return t;const u=s.reduce((t,n)=>(t[n]=o({key:void 0,name:n}),t),{});return{...t,...u}}function n(t,n){if(!t.routeNames.some(n=>!t.routes.some(t=>t.name===n)))return t;const s=t.routes[t.index]?.key,u=t.routeNames.map(s=>{const u=t.routes.find(t=>t.name===s);return u||o(s,n)}),c=Math.max(0,u.findIndex(t=>t.key===s));return{...t,index:c,routes:u}}function o(t,n){const o=n[t];if(!o)throw new Error(`Could not find a descriptor for route "${t}". This is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.`);return{...o.route,key:t,name:t}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get appendMissingPlaceholderTabDescriptors(){return t},get appendMissingPlaceholderTabRoutes(){return n}})},1306,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get ExperimentalStack(){return c},get default(){return o}});const n=u(r(d[1]));function u(t){return t&&t.__esModule?t:{default:t}}const c=Object.assign(u=>(0,t().jsx)(n.default,{...u}),{Screen:n.default.Screen,Protected:n.default.Protected}),o=c},1307,[25,1308]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,u){for(var n in u)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(u,n).get})})(e,{get Stack(){return t.default},get default(){return l}});const t=c(r(d[0])),u=r(d[1]),n=r(d[2]);function c(t){return t&&t.__esModule?t:{default:t}}t.default.Screen=u.StackScreen,t.default.Header=u.StackHeader,t.default.Title=u.StackTitle,t.default.Toolbar=n.StackToolbar;const l=t.default},1308,[696,729,734]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.default}});const t=o((n=r(d[0]),u=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(u,t)||Object.defineProperty(u,t,{enumerable:!0,get:function(){return n[t]}})}),n));var n,u;function o(t){return t&&t.__esModule?t:{default:t}}},1309,[1308]); +__d(function(g,r,i,a,m,e,d){"use strict";var t,n;Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get useIsPreview(){return s.useIsPreview},get usePreventZoomTransitionDismissal(){return o.usePreventZoomTransitionDismissal}}),t=r(d[0]),n=e,Object.keys(t).forEach(function(o){"default"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return t[o]}})});const o=r(d[1]),s=r(d[2])},1310,[509,1311,422]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreventZoomTransitionDismissal",{enumerable:!0,get:function(){return n}})},1311,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Color",{enumerable:!0,get:function(){return y}});r(d[0]);function t(t,n){return Object.keys(t).forEach(function(u){"default"===u||Object.prototype.hasOwnProperty.call(n,u)||Object.defineProperty(n,u,{enumerable:!0,get:function(){return t[u]}})}),t}t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e),t(r(d[5]),e);const n=new Proxy({},{get:(t,n)=>null}),u=new Proxy({},{get:(t,n)=>null}),o=new Proxy({},{get:(t,n)=>null}),l=new Proxy({},{get:(t,n)=>null}),c=new Proxy({get attr(){return u},get material(){return o},get dynamic(){return l}},{get:(t,n)=>n in t?t[n]:null}),y={get ios(){return n},get android(){return c}}},1312,[1313,1314,1315,1316,1317,1318]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return null}function n(t){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Material3Color(){return n},get Material3DynamicColor(){return t}})},1313,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1314,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1315,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1316,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1317,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1318,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inlineStyles",{enumerable:!0,get:function(){return n.inlineStyles}}),Object.defineProperty(_e,"loadLocalRawResource",{enumerable:!0,get:function(){return n.loadLocalRawResource}}),Object.defineProperty(_e,"LocalSvg",{enumerable:!0,get:function(){return n.LocalSvg}}),Object.defineProperty(_e,"SvgCss",{enumerable:!0,get:function(){return n.SvgCss}}),Object.defineProperty(_e,"SvgCssUri",{enumerable:!0,get:function(){return n.SvgCssUri}}),Object.defineProperty(_e,"SvgWithCss",{enumerable:!0,get:function(){return n.SvgWithCss}}),Object.defineProperty(_e,"SvgWithCssUri",{enumerable:!0,get:function(){return n.SvgWithCssUri}}),Object.defineProperty(_e,"WithLocalSvg",{enumerable:!0,get:function(){return n.WithLocalSvg}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return e.camelCase}}),Object.defineProperty(_e,"fetchText",{enumerable:!0,get:function(){return t.fetchText}}),Object.defineProperty(_e,"parse",{enumerable:!0,get:function(){return e.parse}}),Object.defineProperty(_e,"SvgAst",{enumerable:!0,get:function(){return e.SvgAst}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return e.SvgFromUri}}),Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return e.SvgFromXml}}),Object.defineProperty(_e,"SvgUri",{enumerable:!0,get:function(){return e.SvgUri}}),Object.defineProperty(_e,"SvgXml",{enumerable:!0,get:function(){return e.SvgXml}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),u=r(d[3]);Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});var o=r(d[4]);Object.keys(o).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return o[e]}})});var c,f=(c=o)&&c.__esModule?c:{default:c}},1319,[1320,1321,1340,1341,1323]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SvgAst=c,_e.SvgXml=l,_e.SvgUri=function(r){const{onError:o=i,uri:s,onLoad:c,fallback:u}=r,[f,p]=(0,t.useState)(null),[d,h]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s?(0,n.fetchText)(s).then(t=>{p(t),d&&h(!1),c?.()}).catch(t=>{o(t),h(!0)}):p(null)},[o,s,c]),d)return u??null;return e.createElement(l,{xml:f,override:r,fallback:u})},Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return d}}),_e.getStyle=h,_e.astToReact=x,_e.parse=j,Object.defineProperty(_e,"tags",{enumerable:!0,get:function(){return r.tags}});var t=_r(_d[0]),e=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e})(t),n=_r(_d[1]),r=_r(_d[2]);function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;enull!==o?j(o):null,[o]);return e.createElement(c,{ast:r,override:s||n})}catch(t){return r(t),l??null}}class u extends t.Component{state={ast:null};componentDidMount(){this.parse(this.props.xml)}componentDidUpdate(t){const{xml:e}=this.props;e!==t.xml&&this.parse(e)}parse(t){const{onError:e=i}=this.props;try{this.setState({ast:t?j(t):null})}catch(t){const n=t;e({...n,message:`[RNSVG] Couldn't parse SVG, reason: ${n.message}`})}}render(){const{props:t,state:{ast:n}}=this;return e.createElement(c,{ast:n,override:t.override||t})}}class f extends t.Component{state={xml:null};componentDidMount(){this.fetch(this.props.uri)}componentDidUpdate(t){const{uri:e}=this.props;e!==t.uri&&this.fetch(e)}async fetch(t){try{this.setState({xml:t?await(0,n.fetchText)(t):null})}catch(t){console.error(t)}}render(){const{props:t,state:{xml:n}}=this;return e.createElement(u,{xml:n,override:t,onError:t.onError})}}const p=(t,e)=>e.toUpperCase(),d=t=>t.replace(/[:-]([a-z])/g,p);function h(t){const e={},n=t.split(';').filter(t=>t.trim()),{length:r}=n;for(let t=0;tb(' ',t.length);function v(t,e){const n=t.split('\n'),r=n.length;let o=e,s=0;for(;s=t))break;o-=t}const c=t.slice(0,e).replace(/^\t+/,y),i=/(^|\n).*$/.exec(c),l=i&&i[0]||'',u=t.slice(e),f=/.*(\n|$)/.exec(u);return{line:s,column:o,snippet:`${l}${f&&f[0]}\n${b(' ',l.length)}^`}}const E=/[a-zA-Z0-9:_-]/,O=/
The Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

- + diff --git a/abbotsford/staff-app/sw.js b/abbotsford/staff-app/sw.js index d1b3e6eaa135e31c4b8a016cae2a38eee1ecbb10..77cc98b7a6f39d9d91ba9451f62e92fc872dc851 100644 --- a/abbotsford/staff-app/sw.js +++ b/abbotsford/staff-app/sw.js @@ -1,4 +1,4 @@ -const V="cc-abbotsford-staff-9eeef22f48796f8b",B="/abbotsford/staff-app/",P=["/abbotsford/staff-app/apple-touch-icon.png", "/abbotsford/staff-app/favicon.ico", "/abbotsford/staff-app/team.html", "/abbotsford/staff-app/icon-192.png", "/abbotsford/staff-app/icon-512.png", "/abbotsford/staff-app/brand-logo.png", "/abbotsford/staff-app/index.html", "/abbotsford/staff-app/manifest.webmanifest", "/abbotsford/staff-app/brand-hero.png", "/abbotsford/staff-app/_expo/static/js/web/basket-7c4fed68ce9e0c09c65383c7cef79793.js", "/abbotsford/staff-app/_expo/static/js/web/index-e7d08ddd8307cc90502f5624c0ccc0bd.js", "/abbotsford/staff-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/abbotsford/staff-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/abbotsford/staff-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/abbotsford/staff-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/abbotsford/staff-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/abbotsford/staff-app/_expo/static/js/web/loyalty-679d7aa42c3cddfce82c3e1207d2d4cf.js", "/abbotsford/staff-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/abbotsford/staff-app/_expo/static/js/web/refer-01535dadf727412eb1a34a61dcc6d53d.js", "/abbotsford/staff-app/_expo/static/js/web/historicalBookingApi-0882cd30208cbd3c9dac9321ada9420d.js", "/abbotsford/staff-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/abbotsford/staff-app/_expo/static/js/web/book-7c4c90140093809a35e48a974143bb55.js", "/abbotsford/staff-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/abbotsford/staff-app/_expo/static/js/web/profile-b82887516ccba728915e95d502c0081a.js", "/abbotsford/staff-app/_expo/static/js/web/offers-eba5409c285b6031064e79e9f1ea19e0.js", "/abbotsford/staff-app/_expo/static/js/web/merch-63634eac687774d71f27698748247bd2.js", "/abbotsford/staff-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/abbotsford/staff-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js", "/abbotsford/staff-app/_expo/static/js/web/waitlist-7da65cbcea167a5ec8823003e69ae268.js", "/abbotsford/staff-app/_expo/static/js/web/whatson-dd3d796ea1e77876d5803d9ecd8c1109.js", "/abbotsford/staff-app/_expo/static/js/web/__common-0a285e7d7116cab61f753700128f3a80.js", "/abbotsford/staff-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/abbotsford/staff-app/_expo/static/js/web/_layout-5ffd4b2a0012c89bc166d7f2d151a28f.js", "/abbotsford/staff-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/abbotsford/staff-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/abbotsford/staff-app/_expo/static/js/web/index-d58b7a576319791e18a9011cfd7e460f.js", "/abbotsford/staff-app/_expo/static/js/web/index-ccdd70985f76dcdc8b4e70d8de5161d4.js", "/abbotsford/staff-app/_expo/static/js/web/lost-817d2886f8973bfa630e2a69674dc584.js", "/abbotsford/staff-app/_expo/static/js/web/index-c21267a9b534b341ed4458adcc7f4444.js", "/abbotsford/staff-app/_expo/static/js/web/index-a8d325e71cfb545e78d104b9bbbd17ea.js", "/abbotsford/staff-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/abbotsford/staff-app/_expo/static/js/web/index-997bc0470ef63b01fb21fb195351458b.js", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/abbotsford/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/abbotsford/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/abbotsford/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/abbotsford/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/abbotsford/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/abbotsford/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/abbotsford/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/abbotsford/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/abbotsford/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/abbotsford/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/abbotsford/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/abbotsford/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/abbotsford/staff-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/abbotsford/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/abbotsford/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/abbotsford/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/abbotsford/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/abbotsford/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/abbotsford/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/abbotsford/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/abbotsford/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/abbotsford/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/abbotsford/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/abbotsford/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/abbotsford/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/abbotsford/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/abbotsford/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/abbotsford/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/abbotsford/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/abbotsford/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/abbotsford/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/abbotsford/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/abbotsford/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/abbotsford/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/abbotsford/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/abbotsford/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/abbotsford/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/abbotsford/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/abbotsford/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/abbotsford/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/abbotsford/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png"]; +const V="cc-abbotsford-staff-b1a8ffffa05b57d8",B="/abbotsford/staff-app/",P=["/abbotsford/staff-app/index.html", "/abbotsford/staff-app/icon-192.png", "/abbotsford/staff-app/brand-logo.png", "/abbotsford/staff-app/favicon.ico", "/abbotsford/staff-app/brand-hero.png", "/abbotsford/staff-app/icon-512.png", "/abbotsford/staff-app/team.html", "/abbotsford/staff-app/apple-touch-icon.png", "/abbotsford/staff-app/manifest.webmanifest", "/abbotsford/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/abbotsford/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/abbotsford/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/abbotsford/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/abbotsford/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/abbotsford/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/abbotsford/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/abbotsford/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/abbotsford/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/abbotsford/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/abbotsford/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/abbotsford/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/abbotsford/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/abbotsford/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/abbotsford/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/abbotsford/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/abbotsford/staff-app/assets/assets/brand/smokinggoat.fff2a9a694b41fed68c80a2c9bfe65da.png", "/abbotsford/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/abbotsford/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/abbotsford/staff-app/assets/assets/brand/drunkencoo.272f746bf13376f503acd81a524a7998.png", "/abbotsford/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/abbotsford/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/abbotsford/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/abbotsford/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/abbotsford/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/abbotsford/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/abbotsford/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/abbotsford/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/abbotsford/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/abbotsford/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/abbotsford/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/abbotsford/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/abbotsford/staff-app/assets/assets/brand/3idiots-hero.77d66ccb53ec1835c3b8a838e9bcfb5a.png", "/abbotsford/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/abbotsford/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/abbotsford/staff-app/assets/assets/brand/drunkencoo-hero.7c01fed6cb075a3a8e4f969bff1cf103.png", "/abbotsford/staff-app/assets/assets/brand/smokinggoat-hero.b2ae48c4a1fcf2521ae9ff58435a6649.png", "/abbotsford/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/abbotsford/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/abbotsford/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/abbotsford/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/abbotsford/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/abbotsford/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/abbotsford/staff-app/_expo/static/js/web/index-ba5aea4e23e402619315d92ef1e4fc6c.js", "/abbotsford/staff-app/_expo/static/js/web/gift-791c64f5dbcb5e9b9629af9241dde456.js", "/abbotsford/staff-app/_expo/static/js/web/index-708cc108b14a03d1e55d135c08408edf.js", "/abbotsford/staff-app/_expo/static/js/web/[token]-27d64602702848e6f817cb3e11170985.js", "/abbotsford/staff-app/_expo/static/js/web/basket-b6d5d5daeda35a03cd8137d4a926f820.js", "/abbotsford/staff-app/_expo/static/js/web/merch-1080abcf96d828ded78defd0c4e60db8.js", "/abbotsford/staff-app/_expo/static/js/web/waitlist-57b6a339b55faddefcbf15cc558b7de7.js", "/abbotsford/staff-app/_expo/static/js/web/lost-ce780ee1f6f200e996e7d3ed8cbad51e.js", "/abbotsford/staff-app/_expo/static/js/web/index-d72f0e09722c49318a402489e965ec4a.js", "/abbotsford/staff-app/_expo/static/js/web/feedback-e234bfa389c6fd89a2e9f35bd3515c4d.js", "/abbotsford/staff-app/_expo/static/js/web/refer-04f1fe483aeb39c42e1a284a988d0659.js", "/abbotsford/staff-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/abbotsford/staff-app/_expo/static/js/web/index-eae28ef7f0787cddcf90124d27547cf2.js", "/abbotsford/staff-app/_expo/static/js/web/index-00e2bf91b2da20ccbf9a88a1e8c0f4b9.js", "/abbotsford/staff-app/_expo/static/js/web/loyalty-1a6a63899543a8249ca64860b4832a26.js", "/abbotsford/staff-app/_expo/static/js/web/_layout-83bbb68bfc0b6cd9e55bd87c8a796528.js", "/abbotsford/staff-app/_expo/static/js/web/index-2c33bb80c88c28d14a905ee5ebc63cab.js", "/abbotsford/staff-app/_expo/static/js/web/[did]-d0ec4f21f40eb7b8eb13e49d83178ff4.js", "/abbotsford/staff-app/_expo/static/js/web/index-222dc045fd0aac3818857fc3da15e957.js", "/abbotsford/staff-app/_expo/static/js/web/index-ab435cea987dbb211ee63b086301a279.js", "/abbotsford/staff-app/_expo/static/js/web/+not-found-a85f4163079f520711a9e40e645ca875.js", "/abbotsford/staff-app/_expo/static/js/web/offers-4bae334794c27ee5d138768273078ed2.js", "/abbotsford/staff-app/_expo/static/js/web/[oid]-34de93199ed1b45f11064148f5365bb9.js", "/abbotsford/staff-app/_expo/static/js/web/index-18a42003614e46ed29f029ff3e81efd8.js", "/abbotsford/staff-app/_expo/static/js/web/[section]-2201675add2ff7b9966ea9d886c9adf3.js", "/abbotsford/staff-app/_expo/static/js/web/book-34e99aaf0197899dc09c20d6bb54139f.js", "/abbotsford/staff-app/_expo/static/js/web/profile-51acbb4fee90028b48e71efb79e6d43a.js", "/abbotsford/staff-app/_expo/static/js/web/demo-bb0072f641fdd92aa99cba5bc91fc36d.js", "/abbotsford/staff-app/_expo/static/js/web/__common-3b974beb5fe67ef162fce1dc85149441.js", "/abbotsford/staff-app/_expo/static/js/web/[n]-21ee7870b018e4360f6e825c15dd672b.js", "/abbotsford/staff-app/_expo/static/js/web/whatson-6498b8821e66bd4aa1639b57afb933a3.js", "/abbotsford/staff-app/_expo/static/js/web/index-2feb7702f4a44076eef4f4dd92ae4639.js"]; self.addEventListener('install',e=>e.waitUntil(caches.open(V).then(c=>Promise.all(P.map(u=>fetch(u).then(r=>{if(!r.ok)throw Error('cache');return c.put(u,r)})))).then(()=>self.skipWaiting()))); self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-abbotsford-staff-')&&k!==V).map(k=>caches.delete(k)))).then(()=>self.clients.claim()))); self.addEventListener('fetch',e=>{const u=new URL(e.request.url);if(e.request.method!=='GET'||u.origin!==location.origin||!u.pathname.startsWith(B))return;if(e.request.mode==='navigate'){e.respondWith(fetch(e.request).then(r=>r.ok?r:caches.match(B+'index.html')).catch(()=>caches.match(B+'index.html')));return;}e.respondWith(caches.match(e.request).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/abbotsford/staff-app/team.html b/abbotsford/staff-app/team.html index 11114acd01769f90a7d25d15ef98d87418dde652..5e6876f0ac83f44469ab9ddeae7b7eec8246d378 100644 --- a/abbotsford/staff-app/team.html +++ b/abbotsford/staff-app/team.html @@ -30,6 +30,6 @@
The Abbotsford Hotel

The Abbotsford Hotel

14 Corsehill Road, Ayr KA7 2ST

- +